OLD | NEW |
---|---|
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 18 matching lines...) Expand all Loading... | |
29 """Abstract base class of Port-specific entry points for the layout tests | 29 """Abstract base class of Port-specific entry points for the layout tests |
30 test infrastructure (the Port and Driver classes). | 30 test infrastructure (the Port and Driver classes). |
31 """ | 31 """ |
32 | 32 |
33 import cgi | 33 import cgi |
34 import collections | 34 import collections |
35 import difflib | 35 import difflib |
36 import errno | 36 import errno |
37 import functools | 37 import functools |
38 import json | 38 import json |
39 import hashlib | |
39 import logging | 40 import logging |
40 import optparse | 41 import optparse |
41 import re | 42 import re |
42 import sys | 43 import sys |
43 | 44 |
44 from webkitpy.common import find_files | 45 from webkitpy.common import find_files |
45 from webkitpy.common import read_checksum_from_png | 46 from webkitpy.common import read_checksum_from_png |
46 from webkitpy.common.memoized import memoized | 47 from webkitpy.common.memoized import memoized |
47 from webkitpy.common.system.executive import ScriptError | 48 from webkitpy.common.system.executive import ScriptError |
48 from webkitpy.common.system.path import cygpath, abspath_to_uri | 49 from webkitpy.common.system.path import cygpath, abspath_to_uri |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
732 url = manifest_items[0][0] | 733 url = manifest_items[0][0] |
733 if url[1:] != path_in_wpt: | 734 if url[1:] != path_in_wpt: |
734 # TODO(tkent): foo.any.js and bar.worker.js should be accessed | 735 # TODO(tkent): foo.any.js and bar.worker.js should be accessed |
735 # as foo.any.html, foo.any.worker, and bar.worker with WPTServe. | 736 # as foo.any.html, foo.any.worker, and bar.worker with WPTServe. |
736 continue | 737 continue |
737 tests.append(file_path) | 738 tests.append(file_path) |
738 return tests | 739 return tests |
739 | 740 |
740 @memoized | 741 @memoized |
741 def _wpt_manifest(self): | 742 def _wpt_manifest(self): |
742 path = self._filesystem.join(self.layout_tests_dir(), 'external', 'wpt', 'MANIFEST.json') | 743 manifest_path = self._filesystem.join(self.layout_tests_dir(), 'external ', 'wpt', 'MANIFEST.json') |
743 return json.loads(self._filesystem.read_text_file(path)) | 744 |
745 original_hash = self._get_manifest_hash(manifest_path) | |
746 self._generate_manifest() | |
747 updated_hash = self._get_manifest_hash(manifest_path) | |
748 | |
749 if original_hash != updated_hash: | |
750 _log.warning('MANIFEST.json has been updated to reflect changes in e xternal/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
| |
751 | |
752 return json.loads(self._filesystem.read_text_file(manifest_path)) | |
753 | |
754 def _get_manifest_hash(self, manifest_path): | |
755 hash_context = hashlib.md5() | |
756 manifest_buffer = self._filesystem.read_binary_file(manifest_path) | |
757 assert manifest_buffer | |
758 hash_context.update(manifest_buffer) | |
759 return hash_context.hexdigest() | |
760 | |
761 def _generate_manifest(self): | |
762 wpt_path = self._webkit_finder.path_from_webkit_base('LayoutTests', 'ext ernal', 'wpt') | |
763 manifest_path = self._webkit_finder.path_from_webkit_base( | |
764 'Tools', 'Scripts', 'webkitpy', 'thirdparty', 'wpt', 'wpt', 'manifes t') | |
765 | |
766 _log.info('Generating MANIFEST.json') | |
767 self._executive.run_command([manifest_path, '--work', '--tests-root', wp t_path]) | |
744 | 768 |
745 def _manifest_items_for_path(self, path_in_wpt): | 769 def _manifest_items_for_path(self, path_in_wpt): |
746 """Returns a manifest item for the given WPT path, or None if not found. | 770 """Returns a manifest item for the given WPT path, or None if not found. |
747 | 771 |
748 The format of a manifest item depends on | 772 The format of a manifest item depends on |
749 https://github.com/w3c/wpt-tools/blob/master/manifest/item.py | 773 https://github.com/w3c/wpt-tools/blob/master/manifest/item.py |
750 and is assumed to be a list of the format [url, extras], | 774 and is assumed to be a list of the format [url, extras], |
751 or [url, references, extras] for reftests, or None if not found. | 775 or [url, references, extras] for reftests, or None if not found. |
752 | 776 |
753 For most testharness tests, the returned manifest_items is expected | 777 For most testharness tests, the returned manifest_items is expected |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1643 | 1667 |
1644 def __init__(self, base, args, reference_args=None): | 1668 def __init__(self, base, args, reference_args=None): |
1645 self.name = base | 1669 self.name = base |
1646 self.base = base | 1670 self.base = base |
1647 self.args = args | 1671 self.args = args |
1648 self.reference_args = args if reference_args is None else reference_args | 1672 self.reference_args = args if reference_args is None else reference_args |
1649 self.tests = set() | 1673 self.tests = set() |
1650 | 1674 |
1651 def __repr__(self): | 1675 def __repr__(self): |
1652 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) | 1676 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) |
OLD | NEW |