Esempio n. 1
0
    def testRunPaygenInProcessWithUnifiedBuild(self):
        self._run.config.models = [
            config_lib.ModelTestConfig('model1', 'model1'),
            config_lib.ModelTestConfig('model2', 'board', ['au'])
        ]

        # Have to patch and verify that the PaygenTestStage is created.
        stage = self.ConstructStage()

        with patch(paygen_build_lib, 'ScheduleAutotestTests') as sched_tests:
            # Call the method under test.
            stage._RunPaygenInProcess('foo',
                                      'foo-board',
                                      'foo-version',
                                      True,
                                      False,
                                      False,
                                      skip_duts_check=False)
            # Ensure that the first model from the unified build was selected
            # as the platform to be tested
            sched_tests.assert_called_once_with(
                'foo-suite-name',
                'board',
                'model2',
                'foo-archive-build',
                False,
                True, [self.payload_config1, self.payload_config2],
                constants.ENV_AUTOTEST,
                job_keyvals=mock.ANY)
  def testGetHWTestStageWithPerModelFilters(self):
    """Verify hwtests are filtered correctly on a per-model basis"""
    extra_argv = ['--hwtest']
    unified_build = self._initConfig(
        'eve-release',
        extra_argv=extra_argv)
    unified_build.attrs.chrome_version = 'TheChromeVersion'

    test_phase1 = unified_build.config.hw_tests[0]
    test_phase2 = unified_build.config.hw_tests[1]

    model1 = config_lib.ModelTestConfig('model1', 'some_lab_board')
    model2 = config_lib.ModelTestConfig('model2', 'mode11', [test_phase2.suite])

    hw_stage = simple_builders.SimpleBuilder(unified_build)._GetHWTestStage(
        unified_build,
        'eve',
        model1,
        test_phase1)
    self.assertIsNotNone(hw_stage)
    self.assertEqual(hw_stage._board_name, 'some_lab_board')

    hw_stage = simple_builders.SimpleBuilder(unified_build)._GetHWTestStage(
        unified_build,
        'eve',
        model2,
        test_phase1)
    self.assertIsNone(hw_stage)

    hw_stage = simple_builders.SimpleBuilder(unified_build)._GetHWTestStage(
        unified_build,
        'eve',
        model2,
        test_phase2)
    self.assertIsNotNone(hw_stage)
    def testUnifiedReleaseBuilders(self):
        coral_release = self._site_config['coral-release']
        self.assertIsNotNone(coral_release)
        models = coral_release['models']
        self.assertIn(config_lib.ModelTestConfig('coral', 'coral', [], False),
                      models)
        self.assertIn(config_lib.ModelTestConfig('robo', 'robo', ['sanity']),
                      models)

        master_release = self._site_config['master-release']
        self.assertIn('coral-release', master_release['slave_configs'])
 def testUnifiedBuildsRunHwTestsForAllModels(self):
   """Verify hwtests run for model fanout with unified builds"""
   extra_argv = ['--hwtest']
   unified_build = self._initConfig(
       'eve-release',
       extra_argv=extra_argv,
       models=[config_lib.ModelTestConfig('model1', 'model1'),
               config_lib.ModelTestConfig(
                   'model2', 'model2', ['sanity', 'bvt-inline'])])
   unified_build.attrs.chrome_version = 'TheChromeVersion'
   simple_builders.SimpleBuilder(unified_build).RunStages()
Esempio n. 5
0
  def testRunPaygenInProcessWithUnifiedBuildInSkylab(self):
    """Test that _RunPaygenInProcess works for unibuild in Skylab."""
    self._run.config.enable_skylab_hw_tests = True
    self._run.config.models = [
        config_lib.ModelTestConfig('model2', 'board', ['au'],
                                   enable_skylab=True),
    ]

    # Have to patch and verify that the PaygenTestStage is created.
    stage = self.ConstructStage()

    with patch(paygen_build_lib, 'ScheduleAutotestTests') as sched_tests:
      # Call the method under test.
      stage._RunPaygenInProcess(
          'foo',
          'foo-board',
          'foo-version',
          True,
          False,
          False,
          skip_duts_check=False)
      # Ensure that the first model from the unified build was selected
      # as the platform to be tested
      sched_tests.assert_called_once_with(
          'foo-suite-name',
          'board',
          'model2',
          'foo-archive-build',
          False,
          True,
          [],
          constants.ENV_SKYLAB,
          job_keyvals=mock.ANY)
    def testRunPaygenInParallelWithUnifiedBuild(self):
        self._run.config.models = [
            config_lib.ModelTestConfig('model1', 'model1', ['au']),
            config_lib.ModelTestConfig('model2', 'model1', ['au'])
        ]

        # Have to patch and verify that the PaygenTestStage is created.
        stage = self.ConstructStage()

        with patch(parallel, 'RunParallelSteps') as parallel_tests:
            stage._RunPaygenInProcess('foo',
                                      'foo-board',
                                      'foo-version',
                                      True,
                                      False,
                                      False,
                                      skip_duts_check=False)
            parallel_tests.assert_called_once_with([mock.ANY, mock.ANY])
Esempio n. 7
0
    def testRunPaygenInParallelWithUnifiedBuild(self):
        # payload_config1 defines applicable_models as model1 and model3.
        # model3 does not have au enabled but gets scheduled since it has type FSI.
        # payload_config2 has type OMAHA so gets scheduled on model1 and model2
        # (all models with au enabled). So we should get 4 parallel runs total.
        self._run.config.models = [
            config_lib.ModelTestConfig('model1', 'model1', ['au']),
            config_lib.ModelTestConfig('model2', 'model1', ['au']),
            config_lib.ModelTestConfig('model3', 'model1')
        ]

        # Have to patch and verify that the PaygenTestStage is created.
        stage = self.ConstructStage()

        with patch(parallel, 'RunParallelSteps') as parallel_tests:
            stage._RunPaygenInProcess('foo',
                                      'foo-board',
                                      'foo-version',
                                      True,
                                      False,
                                      False,
                                      skip_duts_check=False)
            parallel_tests.assert_called_once_with(
                [mock.ANY, mock.ANY, mock.ANY, mock.ANY])
Esempio n. 8
0
  def PerformStage(self):
    builder_run = self._run
    board = self._current_board

    if not builder_run.options.archive:
      logging.warning('HWTests were requested but could not be run because '
                      "artifacts weren't uploaded. Please ensure the archive "
                      'option in the builder config is set to True.')
      return


    models = [config_lib.ModelTestConfig(
        None, config_lib.GetNonUniBuildLabBoardName(board))]
    if builder_run.config.models:
      models = builder_run.config.models

    logging.info('Suites defined for the board: %s', str(
        [x.suite for x in builder_run.config.hw_tests]))
    for m in models:
      logging.info('For model: %s', m.name)
      logging.info('Testing suites: %s', str(m.test_suites))
    parallel_stages = []
    for suite_config in builder_run.config.hw_tests:
      # Even for blocking stages, all models can still be run in parallel since
      # it will still block the next stage from executing.
      for model in models:
        new_stage = self._GetHWTestStage(builder_run, self.buildstore, board,
                                         model, suite_config)
        if new_stage:
          parallel_stages.append(new_stage)

      # Please see docstring for blocking in the HWTestConfig for more
      # information on this behavior.
      # Expected behavior:
      #     1) Blocking suites are kicked off first, e.g. provision suite.
      #     2) If it's unibuild, the blocking suites of all models are kicked
      #        off in parallel first.
      if suite_config.blocking:
        steps = [stage.Run for stage in parallel_stages]
        logging.info('Launching %d tests', len(steps))
        parallel.RunParallelSteps(steps)
        parallel_stages = []

    if parallel_stages:
      steps = [stage.Run for stage in parallel_stages]
      logging.info('Launching %d tests', len(steps))
      parallel.RunParallelSteps(steps)
Esempio n. 9
0
    def _RunHWTests(self, builder_run, board):
        """Run hwtest-related stages for the specified board.

    Args:
      builder_run: BuilderRun object for these background stages.
      board: Board name.
    """

        if not builder_run.options.archive:
            logging.warning(
                "HWTests were requested but could not be run because "
                "artifacts weren't uploaded. Please ensure the archive "
                "option in the builder config is set to True.")
            return

        # For non-uni builds, we don't pass a model (just board)
        models = [config_lib.ModelTestConfig(None, board)]

        unibuild = False
        if builder_run.config.models:
            models = builder_run.config.models
            unibuild = True

        parallel_stages = []
        for suite_config in builder_run.config.hw_tests:
            # Even for blocking stages, all models can still be run in parallel since
            # it will still block the next stage from executing.
            for model in models:
                new_stage = self._GetHWTestStage(builder_run, board, model,
                                                 suite_config)
                if new_stage:
                    parallel_stages.append(new_stage)

            # Please see docstring for blocking in the HWTestConfig for more
            # information on this behavior.
            if suite_config.blocking and not unibuild:
                self._RunParallelStages(parallel_stages)
                parallel_stages = []

        if parallel_stages:
            self._RunParallelStages(parallel_stages)