Commit 17a3319b authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa Committed by Commit Bot

WPT import: Change defaults for notifier-related variables.

Instead of initializing TestImporter's |rebaselined_tests| and
|new_test_expectations| to None, initialize them to the types that
ImportNotifier expects (an iterable and a dict, respectively).

Using None causes the notification mechanisms to fail when a WPT import does
not require any rebaseline changes, as
TestImporter.fetch_new_expecations_and_baselines() is not called and we end
up passing None to ImportNotifier.find_changed_baselines_of_tests() and
ImportNotifier.examine_new_test_expectations().

From https://ci.chromium.org/buildbot/chromium.infra.cron/wpt-importer/7427:
Traceback (most recent call last):
  File "/mnt/data/b/rr/tmpKoSTkX/w/src/third_party/WebKit/Tools/Scripts/wpt-import", line 25, in <module>
    main()
  File "/mnt/data/b/rr/tmpKoSTkX/w/src/third_party/WebKit/Tools/Scripts/wpt-import", line 18, in main
    host.exit(importer.main())
  File "/mnt/data/b/rr/tmpKoSTkX/w/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py", line 168, in main
    if not self.send_notifications(local_wpt):
  File "/mnt/data/b/rr/tmpKoSTkX/w/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py", line 631, in send_notifications
    issue, patchset)
  File "/mnt/data/b/rr/tmpKoSTkX/w/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/import_notifier.py", line 60, in main
    changed_test_baselines = self.find_changed_baselines_of_tests(rebaselined_tests)
  File "/mnt/data/b/rr/tmpKoSTkX/w/src/third_party/WebKit/Tools/Scripts/webkitpy/w3c/import_notifier.py", line 78, in find_changed_baselines_of_tests
    for test_name in rebaselined_tests:
TypeError: 'NoneType' object is not iterable

Bug: 765334
Change-Id: I36195763226cd393312e80c8819aac546c7daef9
Reviewed-on: https://chromium-review.googlesource.com/819410Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Reviewed-by: default avatarQuinten Yearsley <qyearsley@chromium.org>
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/master@{#523111}
parent a26e1e71
...@@ -40,6 +40,8 @@ class ImportNotifierTest(unittest.TestCase): ...@@ -40,6 +40,8 @@ class ImportNotifierTest(unittest.TestCase):
'third_party/WebKit/LayoutTests/platform/linux/external/wpt/foo/bar-expected.txt', 'third_party/WebKit/LayoutTests/platform/linux/external/wpt/foo/bar-expected.txt',
]}) ]})
self.assertEqual(self.notifier.find_changed_baselines_of_tests(set()), {})
def test_more_failures_in_baseline_more_fails(self): def test_more_failures_in_baseline_more_fails(self):
# Replacing self.host.executive won't work here, because ImportNotifier # Replacing self.host.executive won't work here, because ImportNotifier
# has been instantiated with a MockGit backed by an empty MockExecutive. # has been instantiated with a MockGit backed by an empty MockExecutive.
...@@ -123,6 +125,10 @@ class ImportNotifierTest(unittest.TestCase): ...@@ -123,6 +125,10 @@ class ImportNotifierTest(unittest.TestCase):
]} ]}
) )
self.notifier.new_failures_by_directory = {}
self.notifier.examine_new_test_expectations({})
self.assertEqual(self.notifier.new_failures_by_directory, {})
def test_format_commit_list(self): def test_format_commit_list(self):
imported_commits = ['SHA1', 'SHA2'] imported_commits = ['SHA1', 'SHA2']
......
...@@ -63,11 +63,11 @@ class TestImporter(object): ...@@ -63,11 +63,11 @@ class TestImporter(object):
# The WPT revision we are importing and the one imported last time. # The WPT revision we are importing and the one imported last time.
self.wpt_revision = None self.wpt_revision = None
self.last_wpt_revision = None self.last_wpt_revision = None
# A list of rebaselined tests and a dictionary of new test expectations # A set of rebaselined tests and a dictionary of new test expectations
# mapping failing tests to platforms to # mapping failing tests to platforms to
# wpt_expectations_updater.SimpleTestResult. # wpt_expectations_updater.SimpleTestResult.
self.rebaselined_tests = None self.rebaselined_tests = set()
self.new_test_expectations = None self.new_test_expectations = {}
self.verbose = False self.verbose = False
def main(self, argv=None): def main(self, argv=None):
......
...@@ -79,8 +79,6 @@ class WPTExpectationsUpdater(object): ...@@ -79,8 +79,6 @@ class WPTExpectationsUpdater(object):
for build, job_status in build_to_status.iteritems(): for build, job_status in build_to_status.iteritems():
if job_status.result == 'SUCCESS': if job_status.result == 'SUCCESS':
self.ports_with_all_pass.add(self.port_name(build)) self.ports_with_all_pass.add(self.port_name(build))
port_results = self.get_failing_results_dict(build) port_results = self.get_failing_results_dict(build)
test_expectations = self.merge_dicts(test_expectations, port_results) test_expectations = self.merge_dicts(test_expectations, port_results)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment