Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py

Issue 2694293003: Simplify specifiers when all platforms are covered, and sort lines. (Closed)
Patch Set: Rebased Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import json 5 import json
6 import copy 6 import copy
7 7
8 from webkitpy.common.host_mock import MockHost 8 from webkitpy.common.host_mock import MockHost
9 from webkitpy.common.net.buildbot import Build 9 from webkitpy.common.net.buildbot import Build
10 from webkitpy.common.net.buildbot_mock import MockBuildBot 10 from webkitpy.common.net.buildbot_mock import MockBuildBot
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 updater = WPTExpectationsUpdater(self.mock_host()) 143 updater = WPTExpectationsUpdater(self.mock_host())
144 results = { 144 results = {
145 'fake/test/path.html': { 145 'fake/test/path.html': {
146 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ test'}, 146 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ test'},
147 'two': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ test'}, 147 'two': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ test'},
148 } 148 }
149 } 149 }
150 self.assertEqual(updater.create_line_list(results), []) 150 self.assertEqual(updater.create_line_list(results), [])
151 151
152 def test_create_line_list_new_tests(self): 152 def test_create_line_list_new_tests(self):
153 # In this example, there are unexpected non-fail results in w3c tests. 153 # In this example, there are three unexpected results. The new
154 # test expectation lines are sorted by test, and then specifier.
154 updater = WPTExpectationsUpdater(self.mock_host()) 155 updater = WPTExpectationsUpdater(self.mock_host())
155 results = { 156 results = {
157 'external/fake/test/zzzz.html': {
158 'test-mac-mac10.10': {'expected': 'PASS', 'actual': 'FAIL', 'bug ': 'crbug.com/test'},
159 },
156 'external/fake/test/path.html': { 160 'external/fake/test/path.html': {
157 'test-linux-trusty': {'expected': 'FAIL', 'actual': 'PASS', 'bug ': 'crbug.com/test'}, 161 'test-linux-trusty': {'expected': 'FAIL', 'actual': 'PASS', 'bug ': 'crbug.com/test'},
158 'test-mac-mac10.10': {'expected': 'FAIL', 'actual': 'PASS', 'bug ': 'crbug.com/test'},
159 'test-mac-mac10.11': {'expected': 'FAIL', 'actual': 'TIMEOUT', ' bug': 'crbug.com/test'}, 162 'test-mac-mac10.11': {'expected': 'FAIL', 'actual': 'TIMEOUT', ' bug': 'crbug.com/test'},
160 } 163 },
161 } 164 }
162 self.assertEqual( 165 self.assertEqual(
163 updater.create_line_list(results), 166 updater.create_line_list(results),
164 [ 167 [
165 'crbug.com/test [ Linux ] external/fake/test/path.html [ Pass ]' , 168 'crbug.com/test [ Linux ] external/fake/test/path.html [ Pass ]' ,
166 'crbug.com/test [ Mac10.10 ] external/fake/test/path.html [ Pass ]',
167 'crbug.com/test [ Mac10.11 ] external/fake/test/path.html [ Time out ]', 169 'crbug.com/test [ Mac10.11 ] external/fake/test/path.html [ Time out ]',
170 'crbug.com/test [ Mac10.10 ] external/fake/test/zzzz.html [ Fail ure ]',
168 ]) 171 ])
169 172
170 def test_specifier_part(self): 173 def test_specifier_part(self):
171 updater = WPTExpectationsUpdater(self.mock_host()) 174 updater = WPTExpectationsUpdater(self.mock_host())
172 self.assertEqual(updater.specifier_part(['test-mac-mac10.10'], 'x/y.html '), '[ Mac10.10 ]') 175 self.assertEqual(updater.specifier_part(['test-mac-mac10.10'], 'x/y.html '), '[ Mac10.10 ]')
173 176
174 def test_skipped_specifiers_when_test_is_wontfix(self): 177 def test_skipped_specifiers_when_test_is_wontfix(self):
175 host = self.mock_host() 178 host = self.mock_host()
176 expectations_path = '/test.checkout/LayoutTests/NeverFixTests' 179 expectations_path = '/test.checkout/LayoutTests/NeverFixTests'
177 host.filesystem.files[expectations_path] = 'crbug.com/111 [ Trusty ] ext ernal/wpt/test.html [ WontFix ]\n' 180 host.filesystem.files[expectations_path] = 'crbug.com/111 [ Trusty ] ext ernal/wpt/test.html [ WontFix ]\n'
178 host.filesystem.files['/test.checkout/LayoutTests/external/wpt/test.html '] = '' 181 host.filesystem.files['/test.checkout/LayoutTests/external/wpt/test.html '] = ''
179 updater = WPTExpectationsUpdater(host) 182 updater = WPTExpectationsUpdater(host)
180 self.assertEqual(updater.skipped_specifiers('external/wpt/test.html'), [ 'Trusty']) 183 self.assertEqual(updater.skipped_specifiers('external/wpt/test.html'), [ 'Trusty'])
181 184
182 def test_simplify_specifiers(self): 185 def test_simplify_specifiers(self):
183 macros = { 186 macros = {
184 'mac': ['Mac10.10', 'mac10.11'], 187 'mac': ['Mac10.10', 'mac10.11'],
185 'win': ['Win7', 'win10'], 188 'win': ['Win7', 'win10'],
186 'linux': ['Trusty'], 189 'Linux': ['TRUSTY'],
187 } 190 }
188 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['mac10.10', 'mac10.11'], macros), ['Mac']) 191 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['mac10.10', 'mac10.11'], macros), ['Mac'])
189 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['Mac10.10', 'Mac10.11', 'Trusty'], macros), ['Linux', 'Mac']) 192 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['Mac10.10', 'Mac10.11', 'Trusty'], macros), ['Linux', 'Mac'])
190 self.assertEqual( 193 self.assertEqual(
191 WPTExpectationsUpdater.simplify_specifiers(['Mac10.10', 'Mac10.11', 'Trusty', 'Win7', 'Win10'], macros), []) 194 WPTExpectationsUpdater.simplify_specifiers(['Mac10.10', 'Mac10.11', 'Trusty', 'Win7', 'Win10'], macros), [])
192 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['a', 'b', ' c'], {}), ['A', 'B', 'C']) 195 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['a', 'b', ' c'], {}), ['A', 'B', 'C'])
196 self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['Mac', 'Win ', 'Linux'], macros), [])
193 197
194 def test_merge_dicts_with_conflict_raise_exception(self): 198 def test_merge_dicts_with_conflict_raise_exception(self):
195 updater = WPTExpectationsUpdater(self.mock_host()) 199 updater = WPTExpectationsUpdater(self.mock_host())
196 # Both dicts here have the key "one", and the value is not equal. 200 # Both dicts here have the key "one", and the value is not equal.
197 with self.assertRaises(ValueError): 201 with self.assertRaises(ValueError):
198 updater.merge_dicts( 202 updater.merge_dicts(
199 { 203 {
200 'external/fake/test/path.html': { 204 'external/fake/test/path.html': {
201 'one': {'expected': 'FAIL', 'actual': 'PASS'}, 205 'one': {'expected': 'FAIL', 'actual': 'PASS'},
202 'two': {'expected': 'FAIL', 'actual': 'TIMEOUT'}, 206 'two': {'expected': 'FAIL', 'actual': 'TIMEOUT'},
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 updater = WPTExpectationsUpdater(host) 438 updater = WPTExpectationsUpdater(host)
435 updater.get_issue_number = lambda: '11112222' 439 updater.get_issue_number = lambda: '11112222'
436 self.assertEqual(1, updater.run(args=[])) 440 self.assertEqual(1, updater.run(args=[]))
437 self.assertEqual( 441 self.assertEqual(
438 host.web.urls_fetched, 442 host.web.urls_fetched,
439 [ 443 [
440 'https://codereview.chromium.org/api/11112222', 444 'https://codereview.chromium.org/api/11112222',
441 'https://codereview.chromium.org/api/11112222/1' 445 'https://codereview.chromium.org/api/11112222/1'
442 ]) 446 ])
443 self.assertLog(['ERROR: No try job information was collected.\n']) 447 self.assertLog(['ERROR: No try job information was collected.\n'])
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698