| Index: tools/perf/core/trybot_command_unittest.py
|
| diff --git a/tools/perf/core/trybot_command_unittest.py b/tools/perf/core/trybot_command_unittest.py
|
| index 4d7aa2bf3b934308eca6e49a7b8ba6f5214ee2a9..53498bdb767ee94bbf6249c0b936d30f93bf31f4 100644
|
| --- a/tools/perf/core/trybot_command_unittest.py
|
| +++ b/tools/perf/core/trybot_command_unittest.py
|
| @@ -333,111 +333,85 @@ class TrybotCommandTest(unittest.TestCase):
|
| 'fatal: A branch named \'telemetry-try\' already exists.\n'),
|
| self.log_output.getvalue())
|
|
|
| - def _GetConfigForTrybot(self, name, platform, branch, cfg_filename,
|
| - is_blink=False, extra_benchmark_args=None):
|
| - bot = '%s_perf_bisect' % name.replace('', '').replace('-', '_')
|
| - self._MockTryserverJson({bot: 'stuff'})
|
| - first_processes = ()
|
| - if is_blink:
|
| - first_processes = (
|
| - (['git', 'rev-parse', '--abbrev-ref', 'HEAD'], (0, 'br', None)),
|
| - (['git', 'update-index', '--refresh', '-q'], (0, None, None,)),
|
| - (['git', 'diff-index', 'HEAD'], (0, '', None)),
|
| - (['git', 'log', 'origin/master..HEAD'], (0, '', None))
|
| - )
|
| - self._ExpectProcesses(first_processes + (
|
| - (['git', 'rev-parse', '--abbrev-ref', 'HEAD'], (0, branch, None)),
|
| - (['git', 'update-index', '--refresh', '-q'], (0, None, None,)),
|
| - (['git', 'diff-index', 'HEAD'], (0, '', None)),
|
| - (['git', 'log', 'origin/master..HEAD'], (0, 'logs here', None)),
|
| - (['git', 'checkout', '-b', 'telemetry-tryjob'], (0, None, None)),
|
| - (['git', 'branch', '--set-upstream-to', 'origin/master'],
|
| - (0, None, None)),
|
| - (['git', 'commit', '-a', '-m', 'bisect config: %s' % platform],
|
| - (0, None, None)),
|
| - (['git', 'cl', 'upload', '-f', '--bypass-hooks', '-m',
|
| - 'CL for perf tryjob on %s' % platform],
|
| - (0, 'stuff https://codereview.chromium.org/12345 stuff', None)),
|
| - (['git', 'cl', 'try', '-m', 'tryserver.chromium.perf', '-b', bot],
|
| - (0, None, None)),
|
| - (['git', 'checkout', branch], (0, None, None)),
|
| - (['git', 'branch', '-D', 'telemetry-tryjob'], (0, None, None))
|
| - ))
|
| - cfg = StringIO.StringIO()
|
| - self._stubs.open.files = {cfg_filename: cfg}
|
| -
|
| - options = argparse.Namespace(trybot=name, benchmark_name='sunspider')
|
| + def _SetupTrybotCommand(self, try_json_dict, trybot):
|
| + self._MockTryserverJson(try_json_dict)
|
| command = trybot_command.Trybot()
|
| + command._InitializeBuilderNames(trybot)
|
| + return command
|
| +
|
| + def _GetConfigForTrybot(self, name, platform, extra_benchmark_args=None,
|
| + repo_name='chromium'):
|
| + bot = '%s_perf_bisect' % name.replace('', '').replace('-', '_')
|
| + command = self._SetupTrybotCommand({bot: 'stuff'}, name)
|
| + options = argparse.Namespace(
|
| + trybot=name, benchmark_name='sunspider', repo_name=repo_name)
|
| extra_benchmark_args = extra_benchmark_args or []
|
| - command.Run(options, extra_benchmark_args)
|
| - return cfg.getvalue()
|
| + arguments = [options.benchmark_name] + extra_benchmark_args
|
| + cfg = command._GetPerfConfig(platform, arguments)
|
| +
|
| + return cfg
|
| +
|
| + def _GetTestConfigForGitTryParams(self, name, platform, repo_name):
|
| + config = self._GetConfigForTrybot(name, platform, repo_name=repo_name)
|
| + return 'perf_try_config=%s' % json.dumps(
|
| + config, sort_keys=True, indent=2, separators=(',', ': '))
|
|
|
| def testConfigAndroid(self):
|
| - config = self._GetConfigForTrybot(
|
| - 'android-nexus4', 'android', 'somebranch',
|
| - 'tools/run-perf-test.cfg')
|
| + config = self._GetConfigForTrybot('android-nexus4', 'android')
|
| self.assertEquals(
|
| - ('config = {\n'
|
| - ' "command": "./tools/perf/run_benchmark '
|
| - '--browser=android-chromium sunspider --verbose",\n'
|
| - ' "max_time_minutes": "120",\n'
|
| - ' "repeat_count": "1",\n'
|
| - ' "target_arch": "ia32",\n'
|
| - ' "truncate_percent": "0"\n'
|
| - '}'), config)
|
| + {'command': ('src/tools/perf/run_benchmark '
|
| + '--browser=android-chromium sunspider --verbose'),
|
| + 'max_time_minutes': '120',
|
| + 'repeat_count': '1',
|
| + 'target_arch': 'ia32',
|
| + 'truncate_percent': '0'
|
| + }, config)
|
|
|
| def testConfigMac(self):
|
| - config = self._GetConfigForTrybot(
|
| - 'mac-10-9', 'mac', 'currentwork', 'tools/run-perf-test.cfg')
|
| + config = self._GetConfigForTrybot('mac-10-9', 'mac')
|
| self.assertEquals(
|
| - ('config = {\n'
|
| - ' "command": "./tools/perf/run_benchmark '
|
| - '--browser=release sunspider --verbose",\n'
|
| - ' "max_time_minutes": "120",\n'
|
| - ' "repeat_count": "1",\n'
|
| - ' "target_arch": "ia32",\n'
|
| - ' "truncate_percent": "0"\n'
|
| - '}'), config)
|
| + {'command': ('src/tools/perf/run_benchmark '
|
| + '--browser=release sunspider --verbose'),
|
| + 'max_time_minutes': '120',
|
| + 'repeat_count': '1',
|
| + 'target_arch': 'ia32',
|
| + 'truncate_percent': '0'
|
| + }, config)
|
|
|
| def testConfigWinX64(self):
|
| - config = self._GetConfigForTrybot(
|
| - 'win-x64', 'win-x64', 'currentwork', 'tools/run-perf-test.cfg')
|
| - self.assertEquals(
|
| - ('config = {\n'
|
| - ' "command": "python tools\\\\perf\\\\run_benchmark '
|
| - '--browser=release_x64 sunspider --verbose",\n'
|
| - ' "max_time_minutes": "120",\n'
|
| - ' "repeat_count": "1",\n'
|
| - ' "target_arch": "x64",\n'
|
| - ' "truncate_percent": "0"\n'
|
| - '}'), config)
|
| + config = self._GetConfigForTrybot('win-x64', 'win-x64')
|
|
|
| + self.assertEquals(
|
| + {'command': ('src/tools/perf/run_benchmark '
|
| + '--browser=release_x64 sunspider --verbose'),
|
| + 'max_time_minutes': '120',
|
| + 'repeat_count': '1',
|
| + 'target_arch': 'x64',
|
| + 'truncate_percent': '0'
|
| + }, config)
|
| +
|
| def testVerboseOptionIsNotAddedTwice(self):
|
| - config = self._GetConfigForTrybot(
|
| - 'win-x64', 'win-x64', 'currentwork', 'tools/run-perf-test.cfg',
|
| - extra_benchmark_args=['-v'])
|
| + config = self._GetConfigForTrybot('win-x64', 'win-x64',
|
| + extra_benchmark_args=['-v'])
|
| self.assertEquals(
|
| - ('config = {\n'
|
| - ' "command": "python tools\\\\perf\\\\run_benchmark '
|
| - '--browser=release_x64 sunspider -v",\n'
|
| - ' "max_time_minutes": "120",\n'
|
| - ' "repeat_count": "1",\n'
|
| - ' "target_arch": "x64",\n'
|
| - ' "truncate_percent": "0"\n'
|
| - '}'), config)
|
| + {'command': ('src/tools/perf/run_benchmark '
|
| + '--browser=release_x64 sunspider -v'),
|
| + 'max_time_minutes': '120',
|
| + 'repeat_count': '1',
|
| + 'target_arch': 'x64',
|
| + 'truncate_percent': '0'
|
| + }, config)
|
|
|
| def testConfigWinX64WithNoHyphen(self):
|
| - config = self._GetConfigForTrybot(
|
| - 'winx64nvidia', 'win-x64', 'currentwork', 'tools/run-perf-test.cfg')
|
| + config = self._GetConfigForTrybot('winx64nvidia', 'win-x64')
|
| self.assertEquals(
|
| - ('config = {\n'
|
| - ' "command": "python tools\\\\perf\\\\run_benchmark '
|
| - '--browser=release_x64 sunspider --verbose",\n'
|
| - ' "max_time_minutes": "120",\n'
|
| - ' "repeat_count": "1",\n'
|
| - ' "target_arch": "x64",\n'
|
| - ' "truncate_percent": "0"\n'
|
| - '}'), config)
|
| + {'command': ('src/tools/perf/run_benchmark '
|
| + '--browser=release_x64 sunspider --verbose'),
|
| + 'max_time_minutes': '120',
|
| + 'repeat_count': '1',
|
| + 'target_arch': 'x64',
|
| + 'truncate_percent': '0'
|
| + }, config)
|
|
|
| def testUnsupportedTrybot(self):
|
| self.assertRaises(
|
| @@ -447,24 +421,10 @@ class TrybotCommandTest(unittest.TestCase):
|
| {'win_perf_bisect': 'stuff'}
|
| )
|
|
|
| - def testConfigBlink(self):
|
| - config = self._GetConfigForTrybot(
|
| - 'mac-10-9', 'mac', 'blinkbranch',
|
| - 'Tools/run-perf-test.cfg', True)
|
| - self.assertEquals(
|
| - ('config = {\n'
|
| - ' "command": "./tools/perf/run_benchmark '
|
| - '--browser=release sunspider --verbose",\n'
|
| - ' "max_time_minutes": "120",\n'
|
| - ' "repeat_count": "1",\n'
|
| - ' "target_arch": "ia32",\n'
|
| - ' "truncate_percent": "0"\n'
|
| - '}'), config)
|
| -
|
| def testUpdateConfigGitCommitTrybotError(self):
|
| - self._MockTryserverJson({'android_nexus4_perf_bisect': 'stuff'})
|
| - command = trybot_command.Trybot()
|
| - command._InitializeBuilderNames('android-nexus4')
|
| +
|
| + command = self._SetupTrybotCommand(
|
| + ('android_nexus4_perf_bisect': 'stuff'}, 'android-nexus4')
|
| self._ExpectProcesses((
|
| (['git', 'commit', '-a', '-m', 'bisect config: android'],
|
| (128, 'None', 'commit failed')),
|
| @@ -472,7 +432,8 @@ class TrybotCommandTest(unittest.TestCase):
|
| 'CL for perf tryjob on android'],
|
| (0, 'stuff https://codereview.chromium.org/12345 stuff', None)),
|
| (['git', 'cl', 'try', '-m', 'tryserver.chromium.perf', '-b',
|
| - 'android_nexus4_perf_bisect'], (0, None, None))))
|
| + 'android_nexus4_perf_bisect',
|
| + '=p', ], (0, None, None))))
|
| cfg_filename = 'tools/run-perf-test.cfg'
|
| cfg = StringIO.StringIO()
|
| self._stubs.open.files = {cfg_filename: cfg}
|
|
|