Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py |
| index ef62e807f288f4d51d1ca50b30d716fdb515c3f0..14ea0ea1a7909e9a791ee150081adcf045b40c57 100644 |
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py |
| @@ -36,6 +36,7 @@ import difflib |
| import errno |
| import functools |
| import json |
| +import hashlib |
| import logging |
| import optparse |
| import re |
| @@ -739,8 +740,31 @@ class Port(object): |
| @memoized |
| def _wpt_manifest(self): |
| - path = self._filesystem.join(self.layout_tests_dir(), 'external', 'wpt', 'MANIFEST.json') |
| - return json.loads(self._filesystem.read_text_file(path)) |
| + manifest_path = self._filesystem.join(self.layout_tests_dir(), 'external', 'wpt', 'MANIFEST.json') |
| + |
| + original_hash = self._get_manifest_hash(manifest_path) |
| + self._generate_manifest() |
| + updated_hash = self._get_manifest_hash(manifest_path) |
| + |
| + if original_hash != updated_hash: |
| + _log.warning('MANIFEST.json has been updated to reflect changes in external/wpt!') |
|
jeffcarp
2017/01/23 22:27:51
I spent an hour trying to write a unit test for th
jeffcarp
2017/01/24 20:32:39
Replacing line 269 of base_unittest.py below with
jeffcarp
2017/01/24 20:42:59
I figured it out (see newest patch). My guess is t
|
| + |
| + return json.loads(self._filesystem.read_text_file(manifest_path)) |
| + |
| + def _get_manifest_hash(self, manifest_path): |
| + hash_context = hashlib.md5() |
| + manifest_buffer = self._filesystem.read_binary_file(manifest_path) |
| + assert manifest_buffer |
| + hash_context.update(manifest_buffer) |
| + return hash_context.hexdigest() |
| + |
| + def _generate_manifest(self): |
| + wpt_path = self._webkit_finder.path_from_webkit_base('LayoutTests', 'external', 'wpt') |
| + manifest_path = self._webkit_finder.path_from_webkit_base( |
| + 'Tools', 'Scripts', 'webkitpy', 'thirdparty', 'wpt', 'wpt', 'manifest') |
| + |
| + _log.info('Generating MANIFEST.json') |
| + self._executive.run_command([manifest_path, '--work', '--tests-root', wpt_path]) |
| def _manifest_items_for_path(self, path_in_wpt): |
| """Returns a manifest item for the given WPT path, or None if not found. |