Exemplo n.º 1
0
def main():
    print(sys.argv)
    print(SENDGRID_KEY)
    print(BUILD_ID)
    print(USER_REPO)
    print(USER_BRANCH)
    print(USER_TARGET)
    print(USER_LIVE)
    print(ARTIFACT_DIR)
    print(REQUESTED_FOR_EMAIL)
    print(ACCOUNT_KEY)

    # Upload results to storage account, container
    container = ''
    try:
        print('Uploading test results to storage account...')
        container = get_container_name()
        upload_files(container)
    except Exception:
        print(traceback.format_exc())

    # Collect statistics
    testdata = test_data.TestData(ARTIFACT_DIR)
    testdata.collect()

    # Write database
    write_db()

    # Send email
    send_email(container, testdata)
Exemplo n.º 2
0
def main():
    print('Enter main()')

    print(sys.argv)
    print(SENDGRID_KEY)
    print(BUILD_ID)
    print(USER_REPO)
    print(USER_BRANCH)
    print(USER_TARGET)
    print(USER_LIVE)
    print(ARTIFACT_DIR)
    print(REQUESTED_FOR_EMAIL)
    print(ACCOUNT_KEY)
    print(COMMIT_ID)
    print(DB_PWD)

    # Upload results to storage account, container
    container = ''
    try:
        print('Uploading test results to storage account...')
        container = get_container_name()
        upload_files(container)
    except Exception:
        print(traceback.format_exc())

    # Collect statistics
    testdata = test_data.TestData(ARTIFACT_DIR)
    testdata.collect()

    # Send email
    try:
        send_email(container, testdata)
    except Exception:
        print(traceback.format_exc())

    # Generate index.html
    try:
        container_url = 'https://clitestresultstac.blob.core.windows.net/' + container
        generate_index.generate(container, container_url, testdata, USER_REPO,
                                USER_BRANCH, COMMIT_ID, USER_LIVE)
    except Exception:
        print(traceback.format_exc())

    # Write database
    try:
        write_db(container, testdata)
    except Exception:
        print(traceback.format_exc())

    print('Exit main()')
Exemplo n.º 3
0
def main():
    logger.warning('Enter main()')

    logger.warning(sys.argv)
    logger.warning(SENDGRID_KEY)
    logger.warning(BUILD_ID)
    logger.warning(USER_REPO)
    logger.warning(USER_BRANCH)
    logger.warning(USER_TARGET)
    logger.warning(USER_LIVE)
    logger.warning(ARTIFACT_DIR)
    logger.warning(REQUESTED_FOR_EMAIL)
    logger.warning(ACCOUNT_KEY)
    logger.warning(COMMIT_ID)
    logger.warning(DB_PWD)

    # Upload results to storage account, container
    container = ''
    try:
        logger.warning('Uploading test results to storage account...')
        container = get_container_name()
        upload_files(container)
    except Exception:
        logger.exception(traceback.format_exc())

    # Collect statistics
    testdata = test_data.TestData(ARTIFACT_DIR)
    testdata.collect()

    # Generate index.html, send email
    try:
        # Generate index.html
        container_url = 'https://clitestresultstac.blob.core.windows.net/' + container
        html_content = generate_index.generate(container, container_url, testdata, USER_REPO, USER_BRANCH, COMMIT_ID, USER_LIVE, USER_TARGET)
        # Send email
        send_email(html_content)
    except Exception:
        logger.exception(traceback.format_exc())

    # Write database
    # try:
    #     write_db(container, testdata)
    # except Exception:
    #     logger.exception(traceback.format_exc())

    logger.warning('Exit main()')
Exemplo n.º 4
0
 def setUp(self):
   self.test_data = test_data.TestData()
Exemplo n.º 5
0
    return rtrs


if __name__ == "__main__":

    class dummy_args():
        skip_all_data = False
        skip_detail = False
        skip_msg_progress = False
        split = False
        time_start = None
        time_end = None

    print("Line-by-line split test")
    try:
        for line in td.TestData().data():
            if "transfer" not in line:
                print(proton_split(line))
            else:
                pass  # splitter does not split transfers
        pass
    except:
        traceback.print_exc(file=sys.stdout)
        pass

    print("Canned data parse test")
    data = td.TestData().data()
    log_index = 0  # from file for router A
    instance = 0  # all from router instance 0
    comn = common.Common()
    comn.args = dummy_args()
Exemplo n.º 6
0
import test_data as data

x = data.TestData(40, True)
x.generate_data()

print(f"Inputs: \n {x.inputs}")
print(f"Targets: \n {x.targets}")

a = [(1, 2, 3), (4, 5, 6), (7, 8, 9)]

res = [x[0] for x in a]

print(res)
Exemplo n.º 7
0
def main():
    log_new('_main')

    config = Config()

    parameters = get_parameters(config)

    screens_diff_dir = prepare_dir_structure(parameters, config)

    current_data = test_data.TestData(parameters.current_dir,
                                      config.RESULTS_EXTENSIONS)
    baseline_data = test_data.TestData(parameters.baseline_dir,
                                       config.RESULTS_EXTENSIONS)

    current_images = current_data.get_files('screens')
    current_images_dir = current_data.get_dir('screens')

    baseline_images = baseline_data.get_files('screens')
    baseline_images_dir = baseline_data.get_dir('screens')

    logg('current_images', current_images)
    logg('baseline_images', baseline_images)

    current_log = current_data.get_files('logs')[0]
    baseline_log = baseline_data.get_files('logs')[0]

    if parameters.test_name is None:  # case of local run
        correct_images = []
    else:
        current_scenario = current_data.get_files('scenario')[0]
        baseline_scenario = baseline_data.get_files('scenario')[0]
        correct_images = jsoner.create_correct_list(current_scenario,
                                                    baseline_scenario)

    images_lists_diff = list_comparison.compare_lists(current_images,
                                                      baseline_images,
                                                      correct_images)

    log_diffs = log_comparison.compare_logs(current_log, baseline_log,
                                            correct_images, config)

    images_process_list = list_comparison.create_process_list(
        correct_images, images_lists_diff, current_images_dir,
        baseline_images_dir)

    images_diffs = image_comparison.compare_images(images_process_list,
                                                   screens_diff_dir,
                                                   parameters.rgb_threshold,
                                                   parameters.size_threshold,
                                                   config)

    stat, status = statistics.create_image_statistics(images_lists_diff,
                                                      images_diffs)

    webreport = create_webreport(images_diffs, log_diffs, stat, status,
                                 parameters, config)

    save_file(os.path.join(config.TEMP_ARTIFACTS_DIR, 'report.html'),
              webreport)
    copy_directory(config.WEB_REPORT_LIB_DIR,
                   config.TEMP_ARTIFACTS_WEBREPORT_LIB_DIR)
    copy_directory(config.TEMP_DATA_DIR, config.TEMP_ARTIFACTS_DATA_DIR)

    return 0
Exemplo n.º 8
0
print(sys.argv)
for i, arg in enumerate(sys.argv):
    if sys.argv[i] == '-kf':
        kfun = sys.argv[i + 1]
        opt = int(sys.argv[i + 2])
    if sys.argv[i] == '-slack':
        slack = float(sys.argv[i + 1])
    if sys.argv[i] == '-pid':
        plotId = int(sys.argv[i + 1])

# What kernel function to use
kernel_function = lambda x, y: kf.functions[kfun](x, y, opt)
# Number of training samples
N = 200
# Generate our test data
data = test_data.TestData(N, True)
data.generate_data()
# Initial guess of the alpha vector
start = numpy.zeros(N, dtype='float64')
upper_bound = slack
# Lower and upper bounds for each value in alpha vector
B = [(0, upper_bound) for b in range(N)]
# Global variable for alpha, targets and support vectors
nonZeroAlpha = []
target_values = []
support_vectors = []
bValue = 0

# Pre-compute the matrix P by multiplying the every combination of target values, t, and kernel K.
preComputedMatrix = numpy.empty([N, N])
for i in range(N):