Esempio n. 1
0
    def test_update(self):
        host = MockHost()
        try_jobs = {
            self.linux_build: TryJobStatus('COMPLETED', 'SUCCESS'),
            self.win_build: TryJobStatus('COMPLETED', 'SUCCESS'),
            self.mac_build: TryJobStatus('COMPLETED', 'SUCCESS')
        }
        self._setup_mock_results(host.buildbot)
        TryFlag(['update'], host, MockGitCL(host, try_jobs)).run()

        def results_url(build):
            return '%s/%s/%s/layout-test-results/results.html' % (
                'https://storage.googleapis.com/chromium-layout-test-archives',
                build.builder_name, build.build_number)

        self.assertEqual(
            host.stdout.getvalue(), '\n'.join([
                'Fetching results...',
                '-- Linux: %s' % results_url(self.linux_build),
                '-- Mac: %s' % results_url(self.mac_build),
                '-- Win: %s' % results_url(self.win_build), '',
                '### 1 unexpected passes:', '',
                'Bug(none) [ Mac ] something/pass-unexpectedly-mac.html [ Pass ]',
                '', '### 2 unexpected failures:', '',
                'Bug(none) something/fail-everywhere.html [ Failure ]',
                'Bug(none) [ Linux Win ] something/fail-win-and-linux.html [ Failure ]',
                ''
            ]))
Esempio n. 2
0
 def test_run_commit_queue_for_cl_pass(self):
     host = MockHost()
     host.filesystem.write_text_file(
         '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations',
         '')
     importer = TestImporter(host)
     # Only the latest job for each builder is counted.
     importer.git_cl = MockGitCL(host,
                                 results={
                                     Build('cq-builder-a', 120):
                                     TryJobStatus('COMPLETED', 'FAILURE'),
                                     Build('cq-builder-a', 123):
                                     TryJobStatus('COMPLETED', 'SUCCESS'),
                                 })
     success = importer.run_commit_queue_for_cl()
     self.assertTrue(success)
     self.assertLog([
         'INFO: Triggering CQ try jobs.\n',
         'INFO: CQ appears to have passed; trying to commit.\n',
         'INFO: Update completed.\n',
     ])
     self.assertEqual(importer.git_cl.calls, [
         ['git', 'cl', 'try'],
         ['git', 'cl', 'upload', '-f', '--send-mail'],
         ['git', 'cl', 'set-commit'],
     ])
 def test_latest_try_builds(self):
     git_cl = GitCL(MockHost())
     git_cl.fetch_raw_try_job_results = lambda: [
         {
             'builder_name': 'builder-b',
             'status': 'COMPLETED',
             'result': 'SUCCESS',
             'url': 'http://build.chromium.org/p/master/builders/builder-b/builds/100',
         },
         {
             'builder_name': 'builder-b',
             'status': 'COMPLETED',
             'result': 'SUCCESS',
             'url': 'http://build.chromium.org/p/master/builders/builder-b/builds/90',
         },
         {
             'builder_name': 'builder-a',
             'status': 'SCHEDULED',
             'result': None,
             'url': None,
         },
         {
             'builder_name': 'builder-c',
             'status': 'COMPLETED',
             'result': 'SUCCESS',
             'url': 'http://build.chromium.org/p/master/builders/builder-c/builds/123',
         },
     ]
     self.assertEqual(
         git_cl.latest_try_jobs(['builder-a', 'builder-b']),
         {
             Build('builder-a'): TryJobStatus('SCHEDULED'),
             Build('builder-b', 100): TryJobStatus('COMPLETED', 'SUCCESS'),
         })
Esempio n. 4
0
 def test_execute_with_unfinished_jobs(self):
     builds = {
         Build('MOCK Try Win', 5000): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('MOCK Try Mac', 4000): TryJobStatus('STARTED'),
         Build('MOCK Try Linux', 6000): TryJobStatus('SCHEDULED'),
     }
     git_cl = GitCL(self.tool)
     git_cl.get_issue_number = lambda: '11112222'
     git_cl.latest_try_jobs = lambda _: builds
     self.command.git_cl = lambda: git_cl
     exit_code = self.command.execute(self.command_options(), [], self.tool)
     self.assertEqual(exit_code, 1)
     self.assertLog([
         'INFO: Finished try jobs:\n',
         'INFO:   MOCK Try Win\n',
         'INFO: Scheduled or started try jobs:\n',
         'INFO:   MOCK Try Linux\n',
         'INFO:   MOCK Try Mac\n',
         'INFO: There are some builders with no results:\n',
         'INFO:   MOCK Try Linux\n',
         'INFO:   MOCK Try Mac\n',
         'INFO: Would you like to try to fill in missing results with\n'
         'available results? This assumes that layout test results\n'
         'for the platforms with missing results are the same as\n'
         'results on other platforms.\n',
         'INFO: Aborting.\n',
     ])
Esempio n. 5
0
 def test_run_commit_queue_for_cl_fails(self):
     host = MockHost()
     host.filesystem.write_text_file(
         '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations',
         '')
     importer = TestImporter(host)
     importer.git_cl = MockGitCL(host,
                                 results={
                                     Build('cq-builder-a', 120):
                                     TryJobStatus('COMPLETED', 'SUCCESS'),
                                     Build('cq-builder-a', 123):
                                     TryJobStatus('COMPLETED', 'FAILURE'),
                                     Build('cq-builder-b', 200):
                                     TryJobStatus('COMPLETED', 'SUCCESS'),
                                 })
     importer.fetch_new_expectations_and_baselines = lambda: None
     success = importer.run_commit_queue_for_cl()
     self.assertFalse(success)
     self.assertLog([
         'INFO: Triggering CQ try jobs.\n',
         'ERROR: CQ appears to have failed; aborting.\n',
     ])
     self.assertEqual(importer.git_cl.calls, [
         ['git', 'cl', 'try'],
         ['git', 'cl', 'set-close'],
     ])
Esempio n. 6
0
 def test_run_commit_queue_for_cl_only_checks_non_blink_bots(self):
     host = MockHost()
     host.filesystem.write_text_file(
         '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations',
         '')
     host.builders = BuilderList({
         'fakeos_blink_rel': {
             'port_name': 'test-fakeos',
             'specifiers': ['FakeOS', 'Release'],
             'is_try_builder': True,
         }
     })
     importer = TestImporter(host)
     importer.git_cl = MockGitCL(host,
                                 results={
                                     Build('fakeos_blink_rel', 123):
                                     TryJobStatus('COMPLETED', 'FAILURE'),
                                     Build('cq-builder-b', 200):
                                     TryJobStatus('COMPLETED', 'SUCCESS'),
                                 })
     importer.fetch_new_expectations_and_baselines = lambda: None
     success = importer.run_commit_queue_for_cl()
     self.assertTrue(success)
     self.assertLog([
         'INFO: Triggering CQ try jobs.\n',
         'INFO: CQ appears to have passed; trying to commit.\n',
         'INFO: Update completed.\n',
     ])
     self.assertEqual(importer.git_cl.calls, [
         ['git', 'cl', 'try'],
         ['git', 'cl', 'upload', '-f', '--send-mail'],
         ['git', 'cl', 'set-commit'],
     ])
 def test_run_commit_queue_for_cl_closed_cl(self):
     host = MockHost()
     host.filesystem.write_text_file(
         '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations',
         '')
     importer = TestImporter(host)
     importer.git_cl = MockGitCL(
         host,
         results=CLStatus(
             status='closed',
             try_job_results={
                 Build('cq-builder-a', 120):
                 TryJobStatus('COMPLETED', 'SUCCESS'),
                 Build('cq-builder-b', 200):
                 TryJobStatus('COMPLETED', 'SUCCESS'),
             },
         ))
     success = importer.run_commit_queue_for_cl()
     self.assertFalse(success)
     self.assertLog([
         'INFO: Triggering CQ try jobs.\n',
         'ERROR: The CL was closed; aborting.\n',
     ])
     self.assertEqual(importer.git_cl.calls, [
         ['git', 'cl', 'try'],
     ])
Esempio n. 8
0
 def test_try_job_results_with_task_id_in_url(self):
     git_cl = GitCL(MockHost())
     git_cl.fetch_raw_try_job_results = lambda **_: [
         {
             'builder_name':
             'builder-a',
             'status':
             'COMPLETED',
             'result':
             'FAILURE',
             'failure_reason':
             'BUILD_FAILURE',
             'url': ('https://ci.chromium.org/swarming/task/'
                     '36a767f405d9ee10'),
         },
         {
             'builder_name':
             'builder-b',
             'status':
             'COMPLETED',
             'result':
             'SUCCESS',
             'url': ('https://ci.chromium.org/swarming/task/'
                     '38740befcd9c0010?server=chromium-swarm.appspot.com'),
         },
     ]
     self.assertEqual(
         git_cl.try_job_results(), {
             Build('builder-a', '36a767f405d9ee10'):
             TryJobStatus('COMPLETED', 'FAILURE'),
             Build('builder-b', '38740befcd9c0010'):
             TryJobStatus('COMPLETED', 'SUCCESS'),
         })
Esempio n. 9
0
 def test_latest_try_builds_failures(self):
     git_cl = GitCL(MockHost())
     git_cl.fetch_raw_try_job_results = lambda: [
         {
             'builder_name':
             'builder-a',
             'status':
             'COMPLETED',
             'result':
             'FAILURE',
             'failure_reason':
             'BUILD_FAILURE',
             'url':
             'http://build.chromium.org/p/master/builders/builder-a/builds/100',
         },
         {
             'builder_name':
             'builder-b',
             'status':
             'COMPLETED',
             'result':
             'FAILURE',
             'failure_reason':
             'INFRA_FAILURE',
             'url':
             'http://build.chromium.org/p/master/builders/builder-b/builds/200',
         },
     ]
     self.assertEqual(
         git_cl.latest_try_jobs(['builder-a', 'builder-b']), {
             Build('builder-a', 100): TryJobStatus('COMPLETED', 'FAILURE'),
             Build('builder-b', 200): TryJobStatus('COMPLETED', 'FAILURE'),
         })
Esempio n. 10
0
    def _fetch_results(self, jobs):
        """Fetches results for all of the given builds.

        There should be a one-to-one correspondence between Builds, supported
        platforms, and try bots. If not all of the builds can be fetched, then
        continuing with rebaselining may yield incorrect results, when the new
        baselines are deduped, an old baseline may be kept for the platform
        that's missing results.

        Args:
            jobs: A dict mapping Build objects to TryJobStatus objects.

        Returns:
            A dict mapping Build to LayoutTestResults for all completed jobs.
        """
        buildbot = self._tool.buildbot
        results = {}
        for build, status in jobs.iteritems():
            if status == TryJobStatus('COMPLETED', 'SUCCESS'):
                # Builds with passing try jobs are mapped to None, to indicate
                # that there are no baselines to download.
                results[build] = None
                continue
            if status != TryJobStatus('COMPLETED', 'FAILURE'):
                # Only completed failed builds will contain actual failed
                # layout tests to download baselines for.
                continue
            results_url = buildbot.results_url(build.builder_name, build.build_number)
            layout_test_results = buildbot.fetch_results(build)
            if layout_test_results is None:
                _log.info('Failed to fetch results for "%s".', build.builder_name)
                _log.info('Results URL: %s/results.html', results_url)
                continue
            results[build] = layout_test_results
        return results
Esempio n. 11
0
 def test_has_failing_try_results_only_success_and_started(self):
     self.assertFalse(
         GitCL.some_failed({
             Build('some-builder', 90):
             TryJobStatus('COMPLETED', 'SUCCESS'),
             Build('some-builder', 100):
             TryJobStatus('STARTED'),
         }))
Esempio n. 12
0
 def test_all_success_with_started_build(self):
     self.assertFalse(
         GitCL.all_success({
             Build('some-builder', 1):
             TryJobStatus('COMPLETED', 'SUCCESS'),
             Build('some-builder', 2):
             TryJobStatus('STARTED'),
         }))
Esempio n. 13
0
 def __init__(self, *args, **kwargs):
     self.linux_build = Build('linux_chromium_rel_ng', 100)
     self.mac_build = Build('mac_chromium_rel_ng', 101)
     self.win_build = Build('win7_chromium_rel_ng', 102)
     self.mock_try_results = {
         self.linux_build: TryJobStatus('COMPLETED', 'SUCCESS'),
         self.win_build: TryJobStatus('COMPLETED', 'SUCCESS'),
         self.mac_build: TryJobStatus('COMPLETED', 'SUCCESS')
     }
     super(TryFlagTest, self).__init__(*args, **kwargs)
Esempio n. 14
0
 def test_filter_latest(self):
     try_job_results = {
         Build('builder-a', 100): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('builder-a', 200): TryJobStatus('COMPLETED', 'SUCCESS'),
         Build('builder-b', 50): TryJobStatus('SCHEDULED'),
     }
     self.assertEqual(
         GitCL.filter_latest(try_job_results), {
             Build('builder-a', 200): TryJobStatus('COMPLETED', 'SUCCESS'),
             Build('builder-b', 50): TryJobStatus('SCHEDULED'),
         })
Esempio n. 15
0
 def test_latest_try_builds_ignores_swarming(self):
     git_cl = GitCL(MockHost())
     git_cl.fetch_raw_try_job_results = lambda: [{
         'builder_name':
         'builder-b',
         'status':
         'COMPLETED',
         'result':
         'SUCCESS',
         'url':
         'http://build.chromium.org/p/master/builders/builder-b/builds/100',
     }, {
         'builder_name':
         'builder-b',
         'status':
         'COMPLETED',
         'result':
         'SUCCESS',
         'url':
         'https://ci.chromium.org/swarming/task/1234abcd1234abcd?server=chromium-swarm.appspot.com',
     }]
     self.assertEqual(
         git_cl.latest_try_jobs(['builder-b']), {
             Build('builder-b', 100): TryJobStatus('COMPLETED', 'SUCCESS'),
         })
Esempio n. 16
0
 def test_wait_for_try_jobs_done(self):
     host = MockHost()
     host.executive = MockExecutive(output='lgtm')
     git_cl = GitCL(host)
     git_cl.fetch_raw_try_job_results = lambda: [
         {
             'builder_name':
             'some-builder',
             'status':
             'COMPLETED',
             'result':
             'FAILURE',
             'url':
             'http://build.chromium.org/p/master/builders/some-builder/builds/100',
         },
     ]
     self.assertEqual(
         git_cl.wait_for_try_jobs(),
         CLStatus(status='lgtm',
                  try_job_results={
                      Build('some-builder', 100):
                      TryJobStatus('COMPLETED', 'FAILURE'),
                  }))
     self.assertEqual(host.stdout.getvalue(),
                      'Waiting for try jobs, timeout: 7200 seconds.\n')
 def test_execute_with_canceled_job(self):
     builds = {
         Build('MOCK Try Win', 5000): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('MOCK Try Mac', 4000): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('MOCK Try Linux', 6000): TryJobStatus('COMPLETED', 'CANCELED'),
     }
     self.command.git_cl = MockGitCL(self.tool, builds)
     exit_code = self.command.execute(self.command_options(), [], self.tool)
     self.assertEqual(exit_code, 1)
     self.assertLog([
         'INFO: Finished try jobs found for all try bots.\n',
         'INFO: There are some builders with no results:\n',
         'INFO:   MOCK Try Linux\n',
         'INFO: Would you like to continue?\n',
         'INFO: Aborting.\n',
     ])
Esempio n. 18
0
 def test_latest_try_jobs_cq_only(self):
     git_cl = GitCL(MockHost())
     git_cl.fetch_raw_try_job_results = lambda **_: [
         {
             'builder_name': 'cq-a',
             'experimental': False,
             'result': None,
             'status': 'SCHEDULED',
             'tags': ['user_agent:cq'],
             'url': None,
         },
         {
             'builder_name': 'cq-a-experimental',
             'experimental': True,
             'result': None,
             'status': 'SCHEDULED',
             'tags': ['user_agent:cq'],
             'url': None,
         },
         {
             'builder_name': 'other',
             'experimental': False,
             'status': 'SCHEDULED',
             'result': None,
             'tags': ['user_agent:git_cl_try'],
             'url': None,
         },
     ]
     self.assertEqual(
         git_cl.latest_try_jobs(cq_only=True),
         {
             Build('cq-a'): TryJobStatus('SCHEDULED'),
         })
 def test_execute_with_passing_jobs(self):
     builds = {
         Build('MOCK Try Win', 5000): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('MOCK Try Mac', 4000): TryJobStatus('COMPLETED', 'SUCCESS'),
         Build('MOCK Try Linux', 6000): TryJobStatus('COMPLETED', 'SUCCESS'),
     }
     self.command.git_cl = MockGitCL(self.tool, builds)
     exit_code = self.command.execute(self.command_options(), [], self.tool)
     self.assertEqual(exit_code, 0)
     self.assertLog([
         'INFO: Finished try jobs found for all try bots.\n',
         'INFO: Rebaselining one/flaky-fail.html\n',
         'INFO: Rebaselining one/missing.html\n',
         'INFO: Rebaselining one/slow-fail.html\n',
         'INFO: Rebaselining one/text-fail.html\n',
         'INFO: Rebaselining two/image-fail.html\n'
     ])
Esempio n. 20
0
 def test_execute_one_missing_build(self):
     builds = {
         Build('MOCK Try Win', 5000): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('MOCK Try Mac', 4000): TryJobStatus('COMPLETED', 'FAILURE'),
     }
     self.command.git_cl = MockGitCL(self.tool, builds)
     exit_code = self.command.execute(self.command_options(), [], self.tool)
     self.assertEqual(exit_code, 1)
     self.assertLog([
         'INFO: Finished try jobs:\n',
         'INFO:   MOCK Try Mac\n',
         'INFO:   MOCK Try Win\n',
         'INFO: Triggering try jobs:\n',
         'INFO:   MOCK Try Linux\n',
         'INFO: Once all pending try jobs have finished, please re-run\n'
         'webkit-patch rebaseline-cl to fetch new baselines.\n',
     ])
Esempio n. 21
0
 def test_execute_with_no_trigger_jobs_option(self):
     builds = {
         Build('MOCK Try Win', 5000): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('MOCK Try Mac', 4000): TryJobStatus('COMPLETED', 'FAILURE'),
     }
     self.command.git_cl = MockGitCL(self.tool, builds)
     exit_code = self.command.execute(
         self.command_options(trigger_jobs=False), [], self.tool)
     self.assertEqual(exit_code, 1)
     self.assertLog([
         'INFO: Finished try jobs:\n',
         'INFO:   MOCK Try Mac\n',
         'INFO:   MOCK Try Win\n',
         'INFO: There are some builders with no results:\n',
         'INFO:   MOCK Try Linux\n',
         'INFO: Would you like to continue?\n',
         'INFO: Aborting.\n',
     ])
 def test_execute_with_no_trigger_jobs_option(self):
     builds = {
         Build('MOCK Try Win', 5000): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('MOCK Try Mac', 4000): TryJobStatus('COMPLETED', 'FAILURE'),
     }
     self.command.git_cl = MockGitCL(self.tool, builds)
     exit_code = self.command.execute(
         self.command_options(trigger_jobs=False), [], self.tool)
     self.assertEqual(exit_code, 1)
     self.assertLog([
         'INFO: Finished try jobs:\n', 'INFO:   MOCK Try Mac\n',
         'INFO:   MOCK Try Win\n',
         'INFO: There are some builders with no results:\n',
         'INFO:   MOCK Try Linux\n',
         'INFO: Would you like to try to fill in missing results with\n'
         'available results? This assumes that layout test results\n'
         'for the platforms with missing results are the same as\n'
         'results on other platforms.\n', 'INFO: Aborting.\n'
     ])
Esempio n. 23
0
 def test_execute_with_test_that_fails_on_retry(self):
     # In this example, one test failed both with and without the patch
     # in the try job, so it is not rebaselined.
     builds = {
         Build('MOCK Try Win', 5000): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('MOCK Try Mac', 4000): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('MOCK Try Linux', 6000): TryJobStatus('COMPLETED', 'FAILURE'),
     }
     for build in builds:
         self.tool.buildbot.set_retry_sumary_json(build, json.dumps({
             'failures': ['one/text-fail.html'],
             'ignored': ['two/image-fail.html'],
         }))
     exit_code = self.command.execute(self.command_options(), [], self.tool)
     self.assertEqual(exit_code, 0)
     self.assertLog([
         'INFO: Finished try jobs found for all try bots.\n',
         'INFO: Rebaselining one/text-fail.html\n',
     ])
Esempio n. 24
0
 def test_update_expectations_for_cl_all_jobs_pass(self):
     host = MockHost()
     host.filesystem.write_text_file(
         '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '')
     importer = TestImporter(host)
     importer.git_cl = MockGitCL(host, results={
         Build('builder-a', 123): TryJobStatus('COMPLETED', 'SUCCESS'),
     })
     success = importer.update_expectations_for_cl()
     self.assertTrue(success)
Esempio n. 25
0
 def test_latest_try_jobs_started_build_luci_url(self):
     git_cl = GitCL(MockHost())
     git_cl.fetch_raw_try_job_results = lambda **_: [
         {
             'builder_name': 'builder-a',
             'status': 'STARTED',
             'result': None,
             'url': 'http://ci.chromium.org/p/master/some-builder/100',
         },
     ]
     self.assertEqual(git_cl.latest_try_jobs(['builder-a']),
                      {Build('builder-a', 100): TryJobStatus('STARTED')})
Esempio n. 26
0
 def test_execute_with_unfinished_jobs(self):
     builds = {
         Build('MOCK Try Win', 5000): TryJobStatus('COMPLETED', 'FAILURE'),
         Build('MOCK Try Mac', 4000): TryJobStatus('STARTED'),
         Build('MOCK Try Linux', 6000): TryJobStatus('SCHEDULED'),
     }
     self.command.git_cl = MockGitCL(self.tool, builds)
     exit_code = self.command.execute(self.command_options(), [], self.tool)
     self.assertEqual(exit_code, 1)
     self.assertLog([
         'INFO: Finished try jobs:\n',
         'INFO:   MOCK Try Win\n',
         'INFO: Scheduled or started try jobs:\n',
         'INFO:   MOCK Try Linux\n',
         'INFO:   MOCK Try Mac\n',
         'INFO: There are some builders with no results:\n',
         'INFO:   MOCK Try Linux\n',
         'INFO:   MOCK Try Mac\n',
         'INFO: Would you like to continue?\n',
         'INFO: Aborting.\n',
     ])
    def test_run_single_platform_failure(self):
        """Tests the main run method in a case where one test fails on one platform."""
        host = self.mock_host()

        # Fill in an initial value for TestExpectations
        expectations_path = host.port_factory.get(
        ).path_to_generic_test_expectations_file()
        host.filesystem.write_text_file(expectations_path,
                                        MARKER_COMMENT + '\n')

        # Set up fake try job results.
        updater = WPTExpectationsUpdater(host)
        updater.git_cl = MockGitCL(
            updater.host, {
                Build('MOCK Try Mac10.10', 333):
                TryJobStatus('COMPLETED', 'FAILURE'),
                Build('MOCK Try Mac10.11', 111):
                TryJobStatus('COMPLETED', 'SUCCESS'),
                Build('MOCK Try Trusty', 222):
                TryJobStatus('COMPLETED', 'SUCCESS'),
                Build('MOCK Try Precise', 333):
                TryJobStatus('COMPLETED', 'SUCCESS'),
                Build('MOCK Try Win10', 444):
                TryJobStatus('COMPLETED', 'SUCCESS'),
                Build('MOCK Try Win7', 555):
                TryJobStatus('COMPLETED', 'SUCCESS'),
            })

        # Set up failing results for one try bot. It shouldn't matter what
        # results are for the other builders since we shouldn't need to even
        # fetch results, since the try job status already tells us that all
        # of the tests passed.
        host.buildbot.set_results(
            Build('MOCK Try Mac10.10', 333),
            LayoutTestResults({
                'tests': {
                    'external': {
                        'wpt': {
                            'test': {
                                'path.html': {
                                    'expected': 'PASS',
                                    'actual': 'TIMEOUT',
                                    'is_unexpected': True,
                                }
                            }
                        }
                    }
                }
            }))
        self.assertEqual(0, updater.run(args=[]))

        # Results are only fetched for failing builds.
        self.assertEqual(host.buildbot.fetched_builds,
                         [Build('MOCK Try Mac10.10', 333)])

        self.assertEqual(
            host.filesystem.read_text_file(expectations_path),
            '# ====== New tests from wpt-importer added here ======\n'
            'crbug.com/626703 [ Mac10.10 ] external/wpt/test/path.html [ Timeout ]\n'
        )
Esempio n. 28
0
 def test_update_expectations_for_cl_fail_but_no_changes(self):
     host = MockHost()
     host.filesystem.write_text_file(
         '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '')
     importer = TestImporter(host)
     importer.git_cl = MockGitCL(host, results={
         Build('builder-a', 123): TryJobStatus('COMPLETED', 'FAILURE'),
     })
     importer.fetch_new_expectations_and_baselines = lambda: None
     success = importer.update_expectations_for_cl()
     self.assertTrue(success)
     self.assertLog([
         'INFO: Triggering try jobs for updating expectations.\n',
     ])
 def test_update_expectations_for_cl_closed_cl(self):
     host = MockHost()
     host.filesystem.write_text_file(
         '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '')
     importer = TestImporter(host)
     importer.git_cl = MockGitCL(host, status='closed', try_job_results={
         Build('builder-a', 123): TryJobStatus('COMPLETED', 'SUCCESS'),
     })
     success = importer.update_expectations_for_cl()
     self.assertFalse(success)
     self.assertLog([
         'INFO: Triggering try jobs for updating expectations.\n',
         'ERROR: The CL was closed, aborting.\n',
     ])
 def test_update_expectations_for_cl_all_jobs_pass(self):
     host = MockHost()
     host.filesystem.write_text_file(
         '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '')
     importer = TestImporter(host)
     importer.git_cl = MockGitCL(host, status='lgtm', try_job_results={
         Build('builder-a', 123): TryJobStatus('COMPLETED', 'SUCCESS'),
     })
     success = importer.update_expectations_for_cl()
     self.assertLog([
         'INFO: Triggering try jobs for updating expectations.\n',
         'INFO: All jobs finished.\n',
     ])
     self.assertTrue(success)