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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py

Issue 1624373005: Remove XP port from Blink LayoutTest related scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head. Created 4 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/tool/commands/queries_unittest.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 (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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 def test_baseline_directory(self): 240 def test_baseline_directory(self):
241 command = self.command 241 command = self.command
242 self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.7"), "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-lion") 242 self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.7"), "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-lion")
243 self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.6"), "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-snowleopard") 243 self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.6"), "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-snowleopard")
244 self.assertMultiLineEqual(command._baseline_directory("WebKit Linux Trus ty"), "/mock-checkout/third_party/WebKit/LayoutTests/platform/linux") 244 self.assertMultiLineEqual(command._baseline_directory("WebKit Linux Trus ty"), "/mock-checkout/third_party/WebKit/LayoutTests/platform/linux")
245 self.assertMultiLineEqual(command._baseline_directory("WebKit Linux"), " /mock-checkout/third_party/WebKit/LayoutTests/platform/linux-precise") 245 self.assertMultiLineEqual(command._baseline_directory("WebKit Linux"), " /mock-checkout/third_party/WebKit/LayoutTests/platform/linux-precise")
246 self.assertMultiLineEqual(command._baseline_directory("WebKit Linux 32") , "/mock-checkout/third_party/WebKit/LayoutTests/platform/linux-x86") 246 self.assertMultiLineEqual(command._baseline_directory("WebKit Linux 32") , "/mock-checkout/third_party/WebKit/LayoutTests/platform/linux-x86")
247 247
248 def test_rebaseline_updates_expectations_file_noop(self): 248 def test_rebaseline_updates_expectations_file_noop(self):
249 self._zero_out_test_expectations() 249 self._zero_out_test_expectations()
250 self._write(self.lion_expectations_path, """Bug(B) [ Mac Linux XP Debug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ] 250 self._write(self.lion_expectations_path, """Bug(B) [ Mac Linux Win7 Debu g ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]
251 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] 251 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]
252 """) 252 """)
253 self._write("fast/dom/Window/window-postmessage-clone-really-deep-array. html", "Dummy test contents") 253 self._write("fast/dom/Window/window-postmessage-clone-really-deep-array. html", "Dummy test contents")
254 self._write("fast/css/large-list-of-rules-crash.html", "Dummy test conte nts") 254 self._write("fast/css/large-list-of-rules-crash.html", "Dummy test conte nts")
255 self._write("userscripts/another-test.html", "Dummy test contents") 255 self._write("userscripts/another-test.html", "Dummy test contents")
256 256
257 self.options.suffixes = "png,wav,txt" 257 self.options.suffixes = "png,wav,txt"
258 self.command._rebaseline_test_and_update_expectations(self.options) 258 self.command._rebaseline_test_and_update_expectations(self.options)
259 259
260 self.assertItemsEqual(self.tool.web.urls_fetched, 260 self.assertItemsEqual(self.tool.web.urls_fetched,
261 [self.WEB_PREFIX + '/userscripts/another-test-actual.png', 261 [self.WEB_PREFIX + '/userscripts/another-test-actual.png',
262 self.WEB_PREFIX + '/userscripts/another-test-actual.wav', 262 self.WEB_PREFIX + '/userscripts/another-test-actual.wav',
263 self.WEB_PREFIX + '/userscripts/another-test-actual.txt']) 263 self.WEB_PREFIX + '/userscripts/another-test-actual.txt'])
264 new_expectations = self._read(self.lion_expectations_path) 264 new_expectations = self._read(self.lion_expectations_path)
265 self.assertMultiLineEqual(new_expectations, """Bug(B) [ Mac Linux XP Deb ug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ] 265 self.assertMultiLineEqual(new_expectations, """Bug(B) [ Mac Linux Win7 D ebug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]
266 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] 266 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]
267 """) 267 """)
268 268
269 def test_rebaseline_test(self): 269 def test_rebaseline_test(self):
270 self.command._rebaseline_test("WebKit Linux Trusty", "userscripts/anothe r-test.html", "txt", self.WEB_PREFIX) 270 self.command._rebaseline_test("WebKit Linux Trusty", "userscripts/anothe r-test.html", "txt", self.WEB_PREFIX)
271 self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/u serscripts/another-test-actual.txt']) 271 self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/u serscripts/another-test-actual.txt'])
272 272
273 def test_rebaseline_test_with_results_directory(self): 273 def test_rebaseline_test_with_results_directory(self):
274 self._write("userscripts/another-test.html", "test data") 274 self._write("userscripts/another-test.html", "test data")
275 self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/ano ther-test.html [ Failure ]\nbug(z) [ Linux ] userscripts/another-test.html [ Fai lure ]\n") 275 self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/ano ther-test.html [ Failure ]\nbug(z) [ Linux ] userscripts/another-test.html [ Fai lure ]\n")
(...skipping 15 matching lines...) Expand all
291 291
292 self.command._rebaseline_test("WebKit Linux Trusty", "userscripts/anothe r-test.html", "txt", None) 292 self.command._rebaseline_test("WebKit Linux Trusty", "userscripts/anothe r-test.html", "txt", None)
293 293
294 self.assertDictEqual(self.command._scm_changes, {'add': ['/mock-checkout /third_party/WebKit/LayoutTests/platform/linux/userscripts/another-test-expected .txt'], 'delete': []}) 294 self.assertDictEqual(self.command._scm_changes, {'add': ['/mock-checkout /third_party/WebKit/LayoutTests/platform/linux/userscripts/another-test-expected .txt'], 'delete': []})
295 295
296 def test_rebaseline_test_internal_with_port_that_lacks_buildbot(self): 296 def test_rebaseline_test_internal_with_port_that_lacks_buildbot(self):
297 self.tool.executive = MockExecutive2() 297 self.tool.executive = MockExecutive2()
298 298
299 # FIXME: it's confusing that this is the test- port, and not the regular win port. Really all of the tests should be using the test ports. 299 # FIXME: it's confusing that this is the test- port, and not the regular win port. Really all of the tests should be using the test ports.
300 port = self.tool.port_factory.get('test-win-win7') 300 port = self.tool.port_factory.get('test-win-win7')
301 self._write(port._filesystem.join(port.layout_tests_dir(), 'platform/tes t-win-win7/failures/expected/image-expected.txt'), 'original win7 result') 301 self._write(port._filesystem.join(port.layout_tests_dir(), 'platform/tes t-win-win10/failures/expected/image-expected.txt'), 'original win10 result')
302 302
303 old_exact_matches = builders._exact_matches 303 old_exact_matches = builders._exact_matches
304 oc = OutputCapture() 304 oc = OutputCapture()
305 try: 305 try:
306 builders._exact_matches = { 306 builders._exact_matches = {
307 "MOCK XP": {"port_name": "test-win-xp"},
308 "MOCK Win7": {"port_name": "test-win-win7"}, 307 "MOCK Win7": {"port_name": "test-win-win7"},
308 "MOCK Win10": {"port_name": "test-win-win10"},
309 } 309 }
310 310
311 options = MockOptions(optimize=True, builder="MOCK Win7", suffixes=" txt", 311 options = MockOptions(optimize=True, builder="MOCK Win10", suffixes= "txt",
312 verbose=True, test="failures/expected/image.html", results_direc tory=None) 312 verbose=True, test="failures/expected/image.html", results_direc tory=None)
313 313
314 oc.capture_output() 314 oc.capture_output()
315 self.command.execute(options, [], self.tool) 315 self.command.execute(options, [], self.tool)
316 finally: 316 finally:
317 out, _, _ = oc.restore_output() 317 out, _, _ = oc.restore_output()
318 builders._exact_matches = old_exact_matches 318 builders._exact_matches = old_exact_matches
319 319
320 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(), 'platform/test-win-win7/failures/expected/image-expected.txt')), 'MOCK Web result, convert 404 to None=True') 320 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(), 'platform/test-win-win10/failures/expected/image-expected.txt')) , 'MOCK Web result, convert 404 to None=True')
321 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(p ort.layout_tests_dir(), 'platform/test-win-xp/failures/expected/image-expected.t xt'))) 321 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(p ort.layout_tests_dir(), 'platform/test-win-win7/failures/expected/image-expected .txt')))
322 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [{"test": "f ailures/expected/image.html", "builder": "MOCK Win7"}], "delete": []}\n') 322 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [{"test": "f ailures/expected/image.html", "builder": "MOCK Win10"}], "delete": []}\n')
323 323
324 324
325 class TestAbstractParallelRebaselineCommand(_BaseTestCase): 325 class TestAbstractParallelRebaselineCommand(_BaseTestCase):
326 command_constructor = AbstractParallelRebaselineCommand 326 command_constructor = AbstractParallelRebaselineCommand
327 327
328 def test_builders_to_fetch_from(self): 328 def test_builders_to_fetch_from(self):
329 old_exact_matches = builders._exact_matches 329 old_exact_matches = builders._exact_matches
330 try: 330 try:
331 builders._exact_matches = { 331 builders._exact_matches = {
332 "MOCK XP": {"port_name": "test-win-xp"}, 332 "MOCK Win10": {"port_name": "test-win-win10"},
333 "MOCK Win7": {"port_name": "test-win-win7"}, 333 "MOCK Win7": {"port_name": "test-win-win7"},
334 "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7"}, 334 "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7"},
335 "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7"}, 335 "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7"},
336 } 336 }
337 337
338 builders_to_fetch = self.command._builders_to_fetch_from(["MOCK XP", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK Win7"]) 338 builders_to_fetch = self.command._builders_to_fetch_from(["MOCK Win1 0", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK Win7"])
339 self.assertEqual(builders_to_fetch, ["MOCK XP", "MOCK Win7"]) 339 self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"])
340 finally: 340 finally:
341 builders._exact_matches = old_exact_matches 341 builders._exact_matches = old_exact_matches
342 342
343 343
344 class TestRebaselineJson(_BaseTestCase): 344 class TestRebaselineJson(_BaseTestCase):
345 command_constructor = RebaselineJson 345 command_constructor = RebaselineJson
346 346
347 def setUp(self): 347 def setUp(self):
348 super(TestRebaselineJson, self).setUp() 348 super(TestRebaselineJson, self).setUp()
349 self.tool.executive = MockExecutive2() 349 self.tool.executive = MockExecutive2()
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 self.command.execute(MockOptions(optimize=True, verbose=False, resul ts_directory=False, auth_refresh_token_json=None), [], self.tool) 1287 self.command.execute(MockOptions(optimize=True, verbose=False, resul ts_directory=False, auth_refresh_token_json=None), [], self.tool)
1288 self.assertEqual(self.tool.executive.calls, [ 1288 self.assertEqual(self.tool.executive.calls, [
1289 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', '', 'fast/dom/prototype-taco.html']], 1289 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', '', 'fast/dom/prototype-taco.html']],
1290 ['git', 'cl', 'upload', '-f'], 1290 ['git', 'cl', 'upload', '-f'],
1291 ['git', 'pull'], 1291 ['git', 'pull'],
1292 ['git', 'cl', 'land', '-f', '-v'], 1292 ['git', 'cl', 'land', '-f', '-v'],
1293 ['git', 'config', 'branch.auto-rebaseline-alt-temporary-branch.r ietveldissue'], 1293 ['git', 'config', 'branch.auto-rebaseline-alt-temporary-branch.r ietveldissue'],
1294 ]) 1294 ])
1295 1295
1296 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """ 1296 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """
1297 Bug(foo) [ Linux Mac XP ] fast/dom/prototype-taco.html [ NeedsRebaseline ] 1297 Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
1298 """) 1298 """)
1299 finally: 1299 finally:
1300 builders._exact_matches = old_exact_matches 1300 builders._exact_matches = old_exact_matches
1301 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = old_bran ch_name 1301 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = old_bran ch_name
1302 1302
1303 def test_execute_stuck_on_alternate_rebaseline_branch(self): 1303 def test_execute_stuck_on_alternate_rebaseline_branch(self):
1304 def blame(path): 1304 def blame(path):
1305 return """ 1305 return """
1306 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ] 1306 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ]
1307 """ 1307 """
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 self.command.execute(MockOptions(optimize=True, verbose=False, resul ts_directory=False, auth_refresh_token_json=None), [], self.tool) 1349 self.command.execute(MockOptions(optimize=True, verbose=False, resul ts_directory=False, auth_refresh_token_json=None), [], self.tool)
1350 self.assertEqual(self.tool.executive.calls, [ 1350 self.assertEqual(self.tool.executive.calls, [
1351 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', '', 'fast/dom/prototype-taco.html']], 1351 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', '', 'fast/dom/prototype-taco.html']],
1352 ['git', 'cl', 'upload', '-f'], 1352 ['git', 'cl', 'upload', '-f'],
1353 ['git', 'pull'], 1353 ['git', 'pull'],
1354 ['git', 'cl', 'land', '-f', '-v'], 1354 ['git', 'cl', 'land', '-f', '-v'],
1355 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'], 1355 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'],
1356 ]) 1356 ])
1357 1357
1358 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """ 1358 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """
1359 Bug(foo) [ Linux Mac XP ] fast/dom/prototype-taco.html [ NeedsRebaseline ] 1359 Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
1360 """) 1360 """)
1361 finally: 1361 finally:
1362 builders._exact_matches = old_exact_matches 1362 builders._exact_matches = old_exact_matches
1363 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = old_bran ch_name 1363 webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = old_bran ch_name
1364 1364
1365 def test_execute_with_rietveld_auth_refresh_token(self): 1365 def test_execute_with_rietveld_auth_refresh_token(self):
1366 RIETVELD_REFRESH_TOKEN = '/creds/refresh_tokens/test_rietveld_token' 1366 RIETVELD_REFRESH_TOKEN = '/creds/refresh_tokens/test_rietveld_token'
1367 1367
1368 def blame(path): 1368 def blame(path):
1369 return """ 1369 return """
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 oc.capture_output() 1467 oc.capture_output()
1468 self.command._do_one_rebaseline() 1468 self.command._do_one_rebaseline()
1469 out, _, _ = oc.restore_output() 1469 out, _, _ = oc.restore_output()
1470 1470
1471 self.assertEqual(out, 'MOCK STDOUT\n') 1471 self.assertEqual(out, 'MOCK STDOUT\n')
1472 self.assertEqual(self.tool.executive.calls, [ 1472 self.assertEqual(self.tool.executive.calls, [
1473 ['git', 'pull'], 1473 ['git', 'pull'],
1474 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au to-rebaseline', '--verbose'], 1474 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au to-rebaseline', '--verbose'],
1475 ]) 1475 ])
1476 self.assertEqual(self._logs, ['MOCK STDOUT']) 1476 self.assertEqual(self._logs, ['MOCK STDOUT'])
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698