Changeset 268811 in webkit
- Timestamp:
- Oct 21, 2020, 11:33:17 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/Scripts/webkitpy/common/test_expectations.py (modified) (2 diffs)
-
Tools/Scripts/webkitpy/common/test_expectations_unittest.py (modified) (3 diffs)
-
WebDriverTests/ChangeLog (modified) (1 diff)
-
WebDriverTests/TestExpectations.json (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r268796 r268811 1 2020-10-21 Lauro Moura <lmoura@igalia.com> 2 3 webkitpy: Check for duplicated keys in json expectation files 4 https://bugs.webkit.org/show_bug.cgi?id=218032 5 6 Reviewed by Carlos Alberto Lopez Perez. 7 8 When JSON contains repeated keys, Python only uses the last key/value 9 pair in the resulting dict, without warnings. This may cause some 10 expectations to be ignored, like what r267323 fixed. 11 12 This change also makes MockTestExpectations use the same loading 13 validation as the actual expectation instead of calling json.loads 14 directly. 15 16 * Scripts/webkitpy/common/test_expectations.py: 17 (check_repeated_keys): Added. 18 (TestExpectations.__init__): Use helper function. 19 (TestExpectations._load_expectation_string): Moved validation here. 20 * Scripts/webkitpy/common/test_expectations_unittest.py: 21 (MockTestExpectations.__init__): Use helper function. 22 (test_repeated_keys): Added test when there are repeated keys. 23 1 24 2020-10-21 Alex Christensen <achristensen@webkit.org> 2 25 -
trunk/Tools/Scripts/webkitpy/common/test_expectations.py
r226944 r268811 25 25 26 26 27 def check_repeated_keys(args): 28 seen = {} 29 for key, val in args: 30 if key in seen: 31 raise ValueError("Key %s appears more than once" % key) 32 else: 33 seen[key] = val 34 35 return seen 36 37 27 38 class TestExpectations(object): 28 39 … … 32 43 if os.path.isfile(expectations_file): 33 44 with open(expectations_file, 'r') as fd: 34 self._expectations = json.load(fd)45 self._expectations = self._load_expectation_string(fd.read()) 35 46 else: 36 47 self._expectations = {} 48 49 def _load_expectation_string(self, expectations): 50 return json.loads(expectations, object_pairs_hook=check_repeated_keys) 37 51 38 52 def _port_name_for_expected(self, expected): -
trunk/Tools/Scripts/webkitpy/common/test_expectations_unittest.py
r227406 r268811 38 38 self._port_name = port.name() 39 39 self._build_type = build_type 40 self._expectations = json.loads(expectations)40 self._expectations = self._load_expectation_string(expectations) 41 41 42 42 def is_skip(self, test, subtest): … … 183 183 } 184 184 } 185 } 186 }""" 187 188 REPEATED_KEYS = """ 189 { 190 "TestDummy": { 191 "a": 1 192 }, 193 "TestAnother": { 194 }, 195 "TestDummy": { 196 "a": 2 185 197 } 186 198 }""" … … 294 306 self.assert_slow('TestWebKit', 'WebKit.MouseMoveAfterCrash', True) 295 307 self.assert_slow('TestWebKit', 'WebKit.WKConnection', False) 308 309 def test_repeated_keys(self): 310 self.assertRaises(ValueError, lambda: MockTestExpectations('gtk', self.REPEATED_KEYS)) -
trunk/WebDriverTests/ChangeLog
r268793 r268811 1 2020-10-21 Lauro Moura <lmoura@igalia.com> 2 3 webkitpy: Check for duplicated keys in json expectation files 4 https://bugs.webkit.org/show_bug.cgi?id=218032 5 6 Reviewed by Carlos Alberto Lopez Perez. 7 8 * TestExpectations.json: Fix duplicated test key. 9 1 10 2020-10-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 11 -
trunk/WebDriverTests/TestExpectations.json
r268793 r268811 515 515 "test_duplicated_cookie": { 516 516 "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/182330"}} 517 }, 518 "test_no_top_browsing_context": { 519 "expected": {"wpe": {"status": ["FAIL"], "bug": "webkit.org/b/212950"}} 520 }, 521 "test_no_browsing_context": { 522 "expected": {"wpe": {"status": ["FAIL"], "bug": "webkit.org/b/212950"}} 517 523 } 518 524 } … … 924 930 925 931 "imported/w3c/webdriver/tests/get_element_text/get.py": { 926 "subtests": {927 "test_no_top_browsing_context": {928 "expected": {"wpe": {"status": ["FAIL"], "bug": "webkit.org/b/212950"}}929 },930 "test_no_browsing_context": {931 "expected": {"wpe": {"status": ["FAIL"], "bug": "webkit.org/b/212950"}}932 }933 }934 },935 936 "imported/w3c/webdriver/tests/get_named_cookie/get.py": {937 932 "subtests": { 938 933 "test_no_top_browsing_context": {
Note:
See TracChangeset
for help on using the changeset viewer.