Пример #1
0
 def test_update_config_git_try(self):
     finder_options = browser_options.BrowserFinderOptions()
     self._MockTryserverJson({'android_nexus4_perf_bisect': 'stuff'})
     browser = trybot_browser_finder.PossibleTrybotBrowser(
         'trybot-android-nexus4', finder_options)
     self._ExpectProcesses(
         ((['git', 'commit', '-a', '-m',
            'bisect config: android'], (0, 'None', None)), ([
                'git', 'cl', 'upload', '-f', '--bypass-hooks', '-m',
                '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))))
     self._stubs.sys.argv = [
         'tools/perf/run_benchmark',
         '--browser=%s' % browser, 'sunspider'
     ]
     cfg_filename = 'tools/run-perf-test.cfg'
     cfg = StringIO.StringIO()
     self._stubs.open.files = {cfg_filename: cfg}
     self.assertEquals(
         (0, 'https://codereview.chromium.org/12345'),
         browser._UpdateConfigAndRunTryjob('android', cfg_filename))
Пример #2
0
    def test_branch_checkout_fails(self):
        finder_options = browser_options.BrowserFinderOptions()
        self._MockTryserverJson({'android_nexus4_perf_bisect': 'stuff'})
        browser = trybot_browser_finder.PossibleTrybotBrowser(
            'trybot-android-nexus4', finder_options)
        self._ExpectProcesses((
            (['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, 'logs here', None)),
            (['git', 'checkout', '-b', 'telemetry-tryjob'],
             (1, None,
              'fatal: A branch named \'telemetry-try\' already exists.')),
        ))

        browser.RunRemote()
        self.assertEquals(
            ('Error creating branch telemetry-tryjob. '
             'Please delete it if it exists.\n'
             'fatal: A branch named \'telemetry-try\' already exists.\n'),
            self.log_output.getvalue())
Пример #3
0
 def test_constructor_trybot_all(self):
     finder_options = browser_options.BrowserFinderOptions()
     self._MockTryserverJson({
         'android_nexus4_perf_bisect': 'stuff',
         'android_nexus5_perf_bisect': 'stuff2',
         'mac_10_9_perf_bisect': 'otherstuff',
         'mac_perf_bisect': 'otherstuff1',
         'win_perf_bisect': 'otherstuff2',
         'linux_perf_bisect': 'otherstuff3',
         'win_x64_perf_bisect': 'otherstuff4',
         'win_perf_bisect_builder': 'not a trybot',
     })
     browser = trybot_browser_finder.PossibleTrybotBrowser(
         'trybot-all', finder_options)
     self.assertEquals('all', browser.target_os)
     # pylint: disable=W0212
     self.assertEquals(['android', 'linux', 'mac', 'win', 'win-x64'],
                       sorted(browser._builder_names))
     self.assertEquals(
         ['android_nexus4_perf_bisect', 'android_nexus5_perf_bisect'],
         sorted(browser._builder_names.get('android')))
     self.assertEquals(['mac_10_9_perf_bisect', 'mac_perf_bisect'],
                       sorted(browser._builder_names.get('mac')))
     self.assertEquals(['linux_perf_bisect'],
                       sorted(browser._builder_names.get('linux')))
     self.assertEquals(['win_perf_bisect'],
                       sorted(browser._builder_names.get('win')))
     self.assertEquals(['win_x64_perf_bisect'],
                       sorted(browser._builder_names.get('win-x64')))
Пример #4
0
    def test_no_local_commits(self):
        finder_options = browser_options.BrowserFinderOptions()
        self._MockTryserverJson({'android_nexus4_perf_bisect': 'stuff'})
        browser = trybot_browser_finder.PossibleTrybotBrowser(
            'trybot-android-nexus4', finder_options)
        self._ExpectProcesses((
            (['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)),
            (['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)),
        ))

        browser.RunRemote()
        self.assertEquals((
            'No local changes found in chromium or blink trees. '
            'browser=trybot-android-nexus4 argument sends local changes to the '
            'perf trybot(s): '
            '[[\'android_nexus4_perf_bisect\']].\n'),
                          self.log_output.getvalue())
Пример #5
0
 def test_no_git(self):
     finder_options = browser_options.BrowserFinderOptions()
     self._MockTryserverJson({'android_nexus4_perf_bisect': 'stuff'})
     browser = trybot_browser_finder.PossibleTrybotBrowser(
         'trybot-android-nexus4', finder_options)
     self._ExpectProcesses(((['git', 'rev-parse', '--abbrev-ref',
                              'HEAD'], (128, None, None)), ))
     browser.RunRemote()
     self.assertEquals(
         'Must be in a git repository to send changes to trybots.\n',
         self.log_output.getvalue())
Пример #6
0
 def test_support_with_chrome_root(self):
     finder_options = browser_options.BrowserFinderOptions()
     finder_options.profile_dir = None
     finder_options.chrome_root = '/a/b/c'
     self._MockTryserverJson({
         'android_nexus4_perf_bisect': 'stuff',
         'mac_10_9_perf_bisect': 'otherstuff',
         'win_perf_bisect_builder': 'not a trybot',
     })
     browser = trybot_browser_finder.PossibleTrybotBrowser(
         'trybot-android-nexus4', finder_options)
     self.assertTrue(browser.SupportsOptions(finder_options))
Пример #7
0
    def _GetConfigForBrowser(self,
                             name,
                             platform,
                             branch,
                             cfg_filename,
                             is_blink=False):
        finder_options = browser_options.BrowserFinderOptions()
        bot = '%s_perf_bisect' % name.replace('trybot-', '').replace('-', '_')
        self._MockTryserverJson({bot: 'stuff'})
        browser = trybot_browser_finder.PossibleTrybotBrowser(
            name, finder_options)
        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))))
        self._stubs.sys.argv = [
            'tools/perf/run_benchmark',
            '--browser=%s' % browser, 'sunspider'
        ]
        cfg = StringIO.StringIO()
        self._stubs.open.files = {cfg_filename: cfg}

        browser.RunRemote()
        return cfg.getvalue()
Пример #8
0
 def test_constructor(self):
     finder_options = browser_options.BrowserFinderOptions()
     self._MockTryserverJson({
         'android_nexus4_perf_bisect': 'stuff',
         'mac_10_9_perf_bisect': 'otherstuff',
         'win_perf_bisect_builder': 'not a trybot',
     })
     browser = trybot_browser_finder.PossibleTrybotBrowser(
         'trybot-android-nexus4', finder_options)
     self.assertEquals('android', browser.target_os)
     # pylint: disable=W0212
     self.assertTrue('android' in browser._builder_names)
     self.assertEquals(['android_nexus4_perf_bisect'],
                       browser._builder_names.get('android'))
Пример #9
0
 def test_constructor_trybot_all_mac(self):
     finder_options = browser_options.BrowserFinderOptions()
     self._MockTryserverJson({
         'android_nexus4_perf_bisect': 'stuff',
         'win_8_perf_bisect': 'otherstuff',
         'mac_perf_bisect': 'otherstuff2',
         'win_perf_bisect_builder': 'not a trybot',
     })
     browser = trybot_browser_finder.PossibleTrybotBrowser(
         'trybot-all-mac', finder_options)
     self.assertEquals('all', browser.target_os)
     # pylint: disable=protected-access
     self.assertEquals(['mac'], sorted(browser._builder_names))
     self.assertEquals(['mac_perf_bisect'],
                       sorted(browser._builder_names.get('mac')))
Пример #10
0
 def test_constructor_trybot_all_android(self):
     finder_options = browser_options.BrowserFinderOptions()
     self._MockTryserverJson({
         'android_nexus4_perf_bisect': 'stuff',
         'android_nexus5_perf_bisect': 'stuff2',
         'win_8_perf_bisect': 'otherstuff',
         'win_perf_bisect': 'otherstuff2',
         'linux_perf_bisect': 'otherstuff3',
         'win_x64_perf_bisect': 'otherstuff4',
         'win_perf_bisect_builder': 'not a trybot',
     })
     browser = trybot_browser_finder.PossibleTrybotBrowser(
         'trybot-all-android', finder_options)
     self.assertEquals(
         ['android_nexus4_perf_bisect', 'android_nexus5_perf_bisect'],
         sorted(browser._builder_names.get('android')))
Пример #11
0
    def test_dirty_tree(self):
        finder_options = browser_options.BrowserFinderOptions()
        self._MockTryserverJson({'android_nexus4_perf_bisect': 'stuff'})
        browser = trybot_browser_finder.PossibleTrybotBrowser(
            'trybot-android-nexus4', finder_options)
        self._ExpectProcesses((
            (['git', 'rev-parse', '--abbrev-ref', 'HEAD'], (0, 'br', None)),
            (['git', 'update-index', '--refresh', '-q'], (
                0,
                None,
                None,
            )),
            (['git', 'diff-index', 'HEAD'], (0, 'dirty tree', None)),
        ))

        browser.RunRemote()
        self.assertEquals(
            'Cannot send a try job with a dirty tree. Commit locally first.\n',
            self.log_output.getvalue())