def filter_existing_tests(self, tests_runtimes):
     """Filter out tests that do not exist in the filesystem."""
     all_tests = [teststats.normalize_test_name(test) for test in self.list_tests()]
     return [
         info for info in tests_runtimes
         if os.path.exists(info.test_name) and info.test_name in all_tests
     ]
示例#2
0
    def filter_tests(self, tests_runtimes: List[TestRuntime],
                     params: SuiteSplitParameters) -> List[TestRuntime]:
        """
        Filter out tests that do not exist in the filesystem.

        :param tests_runtimes: List of tests with runtimes to filter.
        :param params: Suite split parameters.
        :return: Test list with unneeded tests filtered out.
        """
        if params.test_file_filter:
            tests_runtimes = [
                test for test in tests_runtimes if params.test_file_filter(test.test_name)
            ]
        all_tests = [
            normalize_test_name(test) for test in self.resmoke_proxy.list_tests(params.suite_name)
        ]
        return [
            info for info in tests_runtimes
            if os.path.exists(info.test_name) and info.test_name in all_tests
        ]
    def decorate_tasks_with_explicit_files(
            self, sub_tasks: List[ResmokeTask],
            params: MultiversionDecoratorParams) -> List[ResmokeTask]:
        """
        Make multiversion subtasks based on generated subtasks for explicit tasks.

        Explicit tasks need to have new resmoke.py suite files created for each one with a
        unique list of test roots.
        """
        fixture_type = self._get_suite_fixture_type(params.base_suite)
        versions_combinations = self._get_versions_combinations(fixture_type)

        decorated_tasks = []
        for old_version in self.old_versions:
            for mixed_bin_versions in versions_combinations:
                for index, sub_task in enumerate(sub_tasks):
                    shrub_task = sub_task.shrub_task
                    commands = list(shrub_task.commands)

                    # Decorate the task name.
                    base_task_name = self._build_name(params.task, old_version,
                                                      mixed_bin_versions)
                    sub_task_name = taskname.name_generated_task(
                        base_task_name, index, params.num_tasks,
                        params.variant)

                    # Decorate the suite name
                    resmoke_suite_name = self._build_name(
                        sub_task.resmoke_suite_name, old_version,
                        mixed_bin_versions)
                    all_tests = [
                        normalize_test_name(test) for test in
                        self.resmoke_proxy.list_tests(resmoke_suite_name)
                    ]
                    test_list = [
                        test for test in sub_task.test_list
                        if test in all_tests
                    ]
                    excludes = [
                        test for test in sub_task.excludes if test in all_tests
                    ]
                    execution_task_suite_name = taskname.name_generated_task(
                        resmoke_suite_name, index, params.num_tasks)
                    execution_task_suite_yaml_dir = os.path.dirname(
                        sub_task.execution_task_suite_yaml_path)
                    execution_task_suite_yaml_file = f"{execution_task_suite_name}.yml"
                    execution_task_suite_yaml_path = os.path.join(
                        execution_task_suite_yaml_dir,
                        execution_task_suite_yaml_file)

                    # Decorate the command invocation options.
                    self._update_execution_task_suite_info(
                        commands, execution_task_suite_yaml_path, old_version)
                    commands = self._add_multiversion_commands(commands)

                    # Store the result.
                    shrub_task = Task(name=sub_task_name,
                                      commands=commands,
                                      dependencies=shrub_task.dependencies)
                    decorated_tasks.append(
                        ResmokeTask(shrub_task=shrub_task,
                                    resmoke_suite_name=resmoke_suite_name,
                                    execution_task_suite_yaml_name=
                                    execution_task_suite_yaml_file,
                                    execution_task_suite_yaml_path=
                                    execution_task_suite_yaml_path,
                                    test_list=test_list,
                                    excludes=excludes))

        return decorated_tasks
示例#4
0
 def test_windows_names(self):
     self.assertEqual(
         "/home/user/test.js",
         under_test.normalize_test_name("\\home\\user\\test.js"))
示例#5
0
 def test_unix_names(self):
     self.assertEqual("/home/user/test.js",
                      under_test.normalize_test_name("/home/user/test.js"))
示例#6
0
 def test_windows_names(self):
     self.assertEqual(
         "/home/user/test.js",
         teststats_utils.normalize_test_name("\\home\\user\\test.js"))
示例#7
0
 def test_unix_names(self):
     self.assertEqual(
         "/home/user/test.js",
         teststats_utils.normalize_test_name("/home/user/test.js"))