def UploadCL(self, short_description=False): cli_helpers.Step('UPLOAD CL: %s' % self.story) if short_description: commit_message = 'Automated upload' else: commit_message = ( 'Add %s system health story\n\nThis CL was created automatically ' 'with tools/perf/update_wpr script' % self.story) if self.bug_id: commit_message += '\n\nBug: %s' % self.bug_id if subprocess.call(['git', 'diff', '--quiet']): cli_helpers.Run(['git', 'commit', '-a', '-m', commit_message]) commit_msg_file = os.path.join(self.output_dir, 'commit_message.tmp') with open(commit_msg_file, 'w') as fd: fd.write(commit_message) return cli_helpers.Run( [ 'git', 'cl', 'upload', '--reviewers', ','.join(self.reviewers), '--force', # to prevent message editor from appearing '--message-file', commit_msg_file ], ok_fail=True)
def UploadWpr(self): cli_helpers.Step('UPLOAD WPR: %s' % self.story) archive, _ = self._ExistingWpr() if archive is None: cli_helpers.Error('NO WPR FOUND, use the "record" subcommand') _UploadArchiveToGoogleStorage(archive) return _GitAddArtifactHash(archive)
def testPrintsStep(self, print_mock): long_step_name = 'foobar' * 15 cli_helpers.Step(long_step_name) self.assertListEqual(print_mock.call_args_list, [ mock.call('\033[92m' + ('=' * 90) + '\033[0m'), mock.call('\033[92m' + long_step_name + '\033[0m'), mock.call('\033[92m' + ('=' * 90) + '\033[0m'), ])
def RecordWpr(self): cli_helpers.Step('RECORD WPR: %s' % self.story) self._DeleteExistingWpr() args = [RECORD_WPR, '--story-filter={story}'] + self._BrowserArgs() if self._IsDesktop(): args.append('desktop_system_health_story_set') else: args.extend( ['--device={device_id}', 'mobile_system_health_story_set']) out_file = self._CheckLog(args, log_name='record') self._PrintRunInfo(out_file, results_details=False)
def ReplayWpr(self): cli_helpers.Step('REPLAY WPR: %s' % self.story) out_file = self._RunSystemHealthMemoryBenchmark(log_name='replay', live=False) self._PrintRunInfo(out_file) return out_file
def LiveRun(self): cli_helpers.Step('LIVE RUN: %s' % self.story) out_file = self._RunSystemHealthMemoryBenchmark(log_name='live', live=True) self._PrintRunInfo(out_file) return out_file