def _ArchiveTestResults(self, test_results_dir, test_basename): """Archives test results to Google Storage. Args: test_results_dir: Name of the directory containing the test results. test_basename: The basename to archive the tests. """ results_path = commands.GetTestResultsDir( self._build_root, test_results_dir) # Skip archiving if results_path does not exist or is an empty directory. if self._NoTestResults(results_path): return archived_results_dir = os.path.join(self.archive_path, test_basename) # Copy relevant files to archvied_results_dir. commands.ArchiveTestResults(results_path, archived_results_dir) upload_paths = [os.path.basename(archived_results_dir)] # Create the compressed tarball to upload. # TODO: We should revisit whether uploading the tarball is necessary. test_tarball = commands.BuildAndArchiveTestResultsTarball( archived_results_dir, self._build_root) upload_paths.append(test_tarball) got_symbols = self.GetParallel('breakpad_symbols_generated', pretty_name='breakpad symbols') upload_paths += commands.GenerateStackTraces( self._build_root, self._current_board, test_results_dir, self.archive_path, got_symbols) self._Upload(upload_paths) self._PrintFailedTests(results_path, test_basename) # Remove the test results directory. osutils.RmDir(results_path, ignore_missing=True, sudo=True)
def testGenerateStackTraces(self): """Test if we can generate stack traces for minidumps.""" os.makedirs(os.path.join(self._chroot, 'tmp')) dump_file = os.path.join(self._chroot, 'tmp', 'test.dmp') dump_file_dir, dump_file_name = os.path.split(dump_file) ret = [(dump_file_dir, [''], [dump_file_name])] with mock.patch('os.walk', return_value=ret): test_results_dir = os.path.join(self.tempdir, 'test_results') commands.GenerateStackTraces(self._buildroot, self._board, test_results_dir, self.tempdir, True) self.assertCommandContains(['minidump_stackwalk'])