def export_testcases(self):
        vp.print("Copying test data...")
        try:
            test_name_list = tu.get_test_names_from_tests_dir(TESTS_DIR)
        except tu.MalformedTestsException as e:
            raise ExportFailureException(str(e))
        vp.print_var("test_name_list", test_name_list)
        available_tests, missing_tests = tu.divide_tests_by_availability(
            test_name_list, TESTS_DIR)
        if missing_tests:
            warn("Missing tests: " + (", ".join(missing_tests)))
        vp.print_var("available_tests", available_tests)

        self.create_directory(self.TESTS_DIR_NAME)
        for test_name in available_tests:
            clean_test_name = make_clean_name(test_name)
            self.copy_file(
                os.path.join(TESTS_DIR, "{}.in".format(test_name)),
                os.path.join(self.TESTS_DIR_NAME,
                             "{}.in".format(clean_test_name)),
            )
            self.copy_file(
                os.path.join(TESTS_DIR, "{}.out".format(test_name)),
                os.path.join(self.TESTS_DIR_NAME,
                             "{}.out".format(clean_test_name)))
示例#2
0
    tests_dir = sys.argv[1]

    try:
        test_name_list = tu.get_test_names_from_tests_dir(tests_dir)
    except tu.MalformedTestsException as e:
        cprinterr(colors.ERROR, "Error:")
        sys.stderr.write("{}\n".format(e))
        sys.exit(4)

    if SPECIFIC_TESTS:
        tu.check_pattern_exists_in_test_names(SPECIFIED_TESTS_PATTERN,
                                              test_name_list)
        test_name_list = tu.filter_test_names_by_pattern(
            test_name_list, SPECIFIED_TESTS_PATTERN)

    available_tests, missing_tests = tu.divide_tests_by_availability(
        test_name_list, tests_dir)
    if missing_tests:
        cprinterr(colors.WARN, "Missing tests: " + (", ".join(missing_tests)))

    for test_name in available_tests:
        command = [
            'bash',
            os.path.join(INTERNALS_DIR, 'invoke_test.sh'),
            tests_dir,
            test_name,
        ]
        wait_process_success(subprocess.Popen(command))

    if missing_tests:
        cprinterr(
            colors.WARN, "Missing {} {}!".format(