def PerformStage(self): # These directories are used later to archive test artifacts. test_results_root = commands.CreateTestRoot(self._build_root) test_basename = _GCE_TEST_RESULTS % dict(attempt=self._attempt) if self._test_basename: test_basename = self._test_basename try: if not self._gce_tests: self._gce_tests = self._run.config.gce_tests for gce_test in self._gce_tests: logging.info('Running GCE test %s.', gce_test.test_type) if gce_test.test_type == constants.GCE_SUITE_TEST_TYPE: per_test_results_dir = os.path.join( test_results_root, gce_test.test_suite) else: per_test_results_dir = os.path.join( test_results_root, gce_test.test_type) with cgroups.SimpleContainChildren('GCETest'): r = ' Reached GCETestStage test run timeout.' with timeout_util.Timeout(self.TEST_TIMEOUT, reason_message=r): self._RunTest(gce_test, per_test_results_dir) except Exception: # pylint: disable=logging-not-lazy logging.error( _ERROR_MSG % dict(test_name='GCETests', test_results=test_basename)) raise finally: self._ArchiveTestResults(test_results_root, test_basename)
def PerformStage(self): """Performs the stage. Overridden from generic_stages.BuilderStage.""" # CreateTestRoot creates a results directory and returns its path relative # to the chroot. chroot_results_dir = commands.CreateTestRoot(self._build_root) try: got_exception = False try: self._RunAllSuites(self._run.config.tast_vm_tests, chroot_results_dir) except Exception: # sys.exc_info() returns (None, None, None) in the finally block, so we # need to record the fact that we already have an error here. got_exception = True raise finally: self._ProcessAndArchiveResults( self._MakeChrootPathAbsolute(chroot_results_dir), [t.suite_name for t in self._run.config.tast_vm_tests], got_exception) except Exception: logging.exception('Tast VM tests failed') raise
def PerformStage(self): # These directories are used later to archive test artifacts. if not self._run.options.vmtests: return test_results_root = commands.CreateTestRoot(self._build_root) test_basename = _VM_TEST_RESULTS % dict(attempt=self._attempt) if self._test_basename: test_basename = self._test_basename try: if not self._vm_tests: self._vm_tests = self._run.config.vm_tests failed_tests = [] for vm_test in self._vm_tests: logging.info('Running VM test %s.', vm_test.test_type) if vm_test.test_type == constants.VM_SUITE_TEST_TYPE: per_test_results_dir = os.path.join( test_results_root, vm_test.test_suite) else: per_test_results_dir = os.path.join( test_results_root, vm_test.test_type) try: with cgroups.SimpleContainChildren('VMTest'): r = ' Reached VMTestStage test run timeout.' with timeout_util.Timeout(vm_test.timeout, reason_message=r): self._RunTest(vm_test, per_test_results_dir) except Exception: failed_tests.append(vm_test) if vm_test.warn_only: logging.warning( 'Optional test failed. Forgiving the failure.') else: raise if failed_tests: # If any of the tests failed but not raise an exception, mark # the stage as warning. self._stage_exception_handler = self._HandleExceptionAsWarning raise failures_lib.TestWarning( 'VMTestStage succeeded, but some optional tests failed.') except Exception as e: if not isinstance(e, failures_lib.TestWarning): # pylint: disable=logging-not-lazy logging.error( _ERROR_MSG % dict(test_name='VMTests', test_results=test_basename)) self._ArchiveVMFiles(test_results_root) raise finally: if self._run.config.vm_test_report_to_dashboards: self._ReportResultsToDashboards(test_results_root) self._ArchiveTestResults(test_results_root, test_basename)
def PerformStage(self): # These directories are used later to archive test artifacts. test_results_dir = commands.CreateTestRoot(self._build_root) test_basename = constants.GCE_TEST_RESULTS % dict(attempt=self._attempt) try: logging.info('Running GCE tests...') with cgroups.SimpleContainChildren('GCETest'): r = ' Reached GCETestStage test run timeout.' with timeout_util.Timeout(self.TEST_TIMEOUT, reason_message=r): self._RunTest(constants.GCE_VM_TEST_TYPE, test_results_dir) except Exception: logging.error(_GCE_TEST_ERROR_MSG % dict(gce_test_results=test_basename)) raise finally: self._ArchiveTestResults(test_results_dir, test_basename)
def PerformStage(self): test_results_dir = commands.CreateTestRoot(self._build_root) # CreateTestRoot returns a temp directory inside chroot. # We bring that back out to the build root. test_results_dir = os.path.join(self._build_root, test_results_dir[1:]) test_results_dir = os.path.join(test_results_dir, 'image_test_results') osutils.SafeMakedirs(test_results_dir) try: with timeout_util.Timeout(self.IMAGE_TEST_TIMEOUT): commands.RunTestImage( self._build_root, self._current_board, self.GetImageDirSymlink(), test_results_dir, ) finally: self.SendPerfValues(test_results_dir)
def PerformStage(self): test_root_in_chroot = commands.CreateTestRoot(self._build_root) test_root = path_util.FromChrootPath(test_root_in_chroot) results_dir = os.path.join(test_root, 'results') work_dir = os.path.join(test_root, 'workdir') osutils.SafeMakedirsNonRoot(results_dir) osutils.SafeMakedirsNonRoot(work_dir) try: self._PerformStage(work_dir, results_dir) except: logging.error( _ERROR_MSG % dict(test_name='MoblabVMTest', test_results='directory')) raise finally: self._ArchiveTestResults(results_dir)
def PerformStage(self): # These directories are used later to archive test artifacts. test_results_dir = commands.CreateTestRoot(self._build_root) test_basename = constants.VM_TEST_RESULTS % dict(attempt=self._attempt) try: for vm_test in self._run.config.vm_tests: logging.info('Running VM test %s.', vm_test.test_type) with cgroups.SimpleContainChildren('VMTest'): r = ' Reached VMTestStage test run timeout.' with timeout_util.Timeout(vm_test.timeout, reason_message=r): self._RunTest(vm_test.test_type, test_results_dir) except Exception: logging.error(_VM_TEST_ERROR_MSG % dict(vm_test_results=test_basename)) self._ArchiveVMFiles(test_results_dir) raise finally: self._ArchiveTestResults(test_results_dir, test_basename)