Ejemplo n.º 1
0
 def get_split_params(self) -> SuiteSplitParameters:
     """Get the parameters specified to split suites."""
     return SuiteSplitParameters(
         task_name=self.task_name,
         suite_name=self.suite or self.task,
         filename=self.suite or self.task,
         test_file_filter=None,
         build_variant=self.build_variant,
         is_asan=self.is_asan_build(),
     )
Ejemplo n.º 2
0
 def get_suite_split_params(self) -> SuiteSplitParameters:
     """Get the parameters to use for splitting suites."""
     task = remove_gen_suffix(self.task_name)
     return SuiteSplitParameters(
         build_variant=self.build_variant,
         task_name=task,
         suite_name=self.suite or task,
         filename=self.suite or task,
         test_file_filter=None,
         is_asan=self.is_asan_build(),
     )
Ejemplo n.º 3
0
    def generate_build_variant(self, build_variant_config: Variant,
                               changed_files: Set[str],
                               builder: EvgConfigBuilder) -> None:
        """
        Generate the selected tasks on the specified build variant.

        :param build_variant_config: Configuration of build variant to generate.
        :param changed_files: List of file changes to determine what to run.
        :param builder: Builder to create new configuration.
        """
        build_variant_name = build_variant_config.name
        LOGGER.info("Generating build variant",
                    build_variant=build_variant_name)
        task_configs = self.get_task_config(build_variant_config,
                                            changed_files)

        for task_config in task_configs.values():
            task_def = Task(task_config)
            test_filter = None
            if "selected_tests_to_run" in task_config:
                test_filter = partial(
                    filter_set, input_set=task_config["selected_tests_to_run"])
            split_params = SuiteSplitParameters(
                build_variant=build_variant_name,
                task_name=task_config["task_name"],
                suite_name=task_config.get("suite", task_config["task_name"]),
                filename=task_config.get("suite", task_config["task_name"]),
                test_file_filter=test_filter,
                is_asan=build_variant_config.is_asan_build(),
            )
            gen_params = ResmokeGenTaskParams(
                use_large_distro=task_config.get("use_large_distro", False),
                large_distro_name=task_config.get("large_distro_name"),
                require_multiversion_setup=task_def.require_multiversion_setup(
                ),
                require_multiversion_version_combo=False,
                repeat_suites=task_config.get("repeat_suites", 1),
                resmoke_args=task_config.get("resmoke_args", ""),
                resmoke_jobs_max=task_config.get("resmoke_jobs_max"),
                config_location=self.evg_expansions.get_config_location(),
                dependencies={
                    depends_on["name"]
                    for depends_on in task_def.depends_on
                },
            )
            builder.generate_suite(split_params, gen_params)
Ejemplo n.º 4
0
    def task_def_to_split_params(self, task_def: Task,
                                 build_variant_gen: str) -> SuiteSplitParameters:
        """
        Build parameters for how a task should be split based on its task definition.

        :param task_def: Task definition in evergreen project config.
        :param build_variant_gen: Name of Build Variant being generated.
        :return: Parameters for how task should be split.
        """
        build_variant = self.evg_project_config.get_variant(build_variant_gen)
        task_name = remove_gen_suffix(task_def.name)
        run_vars = task_def.generate_resmoke_tasks_command.get("vars", {})

        suite_name = run_vars.get("suite", task_name)
        return SuiteSplitParameters(
            build_variant=build_variant_gen,
            task_name=task_name,
            suite_name=suite_name,
            filename=suite_name,
            is_asan=build_variant.is_asan_build(),
        )
Ejemplo n.º 5
0
    def generate_configuration(self, tests_by_task: Dict[str, TaskInfo],
                               target_file: str,
                               build_variant: str) -> GeneratedConfiguration:
        """
        Generate configuration for the given tasks and tests.

        :param tests_by_task: Map of what to generate.
        :param target_file: Location to write generated configuration.
        :param build_variant: Name of build variant being generated on.
        :return: Generated configuration to create requested tasks and tests.
        """
        builder = EvgConfigBuilder()  # pylint: disable=no-value-for-parameter
        build_variant_config = self.evg_config.get_variant(build_variant)
        is_asan = build_variant_config.is_asan_build()
        tasks = set()
        if tests_by_task:
            # Get the multiversion suites that will run in as part of burn_in_multiversion.
            multiversion_suites = get_named_suites_with_root_level_key(
                MULTIVERSION_CONFIG_KEY)
            for suite in multiversion_suites:
                task_name = suite["origin"]
                if task_name not in tests_by_task.keys():
                    # Only generate burn in multiversion tasks for suites that would run the
                    # detected changed tests.
                    continue

                LOGGER.debug("Generating multiversion suite",
                             suite=suite["multiversion_name"])
                test_list = tests_by_task[task_name].tests
                split_params = SuiteSplitParameters(
                    task_name=suite["multiversion_name"],
                    suite_name=task_name,
                    filename=task_name,
                    test_file_filter=partial(filter_list,
                                             input_list=test_list),
                    build_variant=build_variant,
                    is_asan=is_asan)
                version_configs = self.multiversion_util.get_version_configs_for_suite(
                    task_name)
                gen_params = MultiversionGenTaskParams(
                    mixed_version_configs=version_configs,
                    is_sharded=self.multiversion_util.is_suite_sharded(
                        task_name),
                    resmoke_args="",
                    parent_task_name="burn_in_tests_multiversion",
                    origin_suite=task_name,
                    use_large_distro=False,
                    large_distro_name=None,
                    name_prefix="burn_in_multiversion",
                    create_misc_suite=False,
                    add_to_display_task=False,
                    config_location=self.burn_in_config.build_config_location(
                    ),
                )

                tasks = tasks.union(
                    builder.add_multiversion_burn_in_test(
                        split_params, gen_params))

        if len(tasks) == 0:
            builder.get_build_variant(build_variant)

        executions_tasks = {task.name for task in tasks}
        executions_tasks.add("burn_in_tests_multiversion_gen")
        builder.add_display_task(display_task_name="burn_in_multiversion",
                                 execution_task_names=executions_tasks,
                                 build_variant=build_variant)

        return builder.build(target_file)