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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 def _write(self, path, contents): | 66 def _write(self, path, contents): |
67 self.tool.filesystem.write_text_file(self._expand(path), contents) | 67 self.tool.filesystem.write_text_file(self._expand(path), contents) |
68 | 68 |
69 def _zero_out_test_expectations(self): | 69 def _zero_out_test_expectations(self): |
70 for port_name in self.tool.port_factory.all_port_names(): | 70 for port_name in self.tool.port_factory.all_port_names(): |
71 port = self.tool.port_factory.get(port_name) | 71 port = self.tool.port_factory.get(port_name) |
72 for path in port.expectations_files(): | 72 for path in port.expectations_files(): |
73 self._write(path, '') | 73 self._write(path, '') |
74 self.tool.filesystem.written_files = {} | 74 self.tool.filesystem.written_files = {} |
75 | 75 |
| 76 def _setup_mock_builder_data(self): |
| 77 data = LayoutTestResults.results_from_string("""ADD_RESULTS({ |
| 78 "tests": { |
| 79 "userscripts": { |
| 80 "first-test.html": { |
| 81 "expected": "PASS", |
| 82 "actual": "IMAGE+TEXT" |
| 83 }, |
| 84 "second-test.html": { |
| 85 "expected": "FAIL", |
| 86 "actual": "IMAGE+TEXT" |
| 87 } |
| 88 } |
| 89 } |
| 90 });""") |
| 91 for builder in ['MOCK builder', 'MOCK builder (Debug)', 'WebKit Mac10.7'
]: |
| 92 self.command._builder_data[builder] = data |
| 93 |
76 | 94 |
77 class TestCopyExistingBaselinesInternal(_BaseTestCase): | 95 class TestCopyExistingBaselinesInternal(_BaseTestCase): |
78 command_constructor = CopyExistingBaselinesInternal # AKA webkit-patch reba
seline-test-internal | 96 command_constructor = CopyExistingBaselinesInternal # AKA webkit-patch reba
seline-test-internal |
79 | 97 |
80 def setUp(self): | 98 def setUp(self): |
81 super(TestCopyExistingBaselinesInternal, self).setUp() | 99 super(TestCopyExistingBaselinesInternal, self).setUp() |
82 | 100 |
83 def test_copying_overwritten_baseline(self): | 101 def test_copying_overwritten_baseline(self): |
84 self.tool.executive = MockExecutive2() | 102 self.tool.executive = MockExecutive2() |
85 | 103 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 builders._exact_matches = { | 300 builders._exact_matches = { |
283 "MOCK builder": {"port_name": "test-mac-snowleopard"}, | 301 "MOCK builder": {"port_name": "test-mac-snowleopard"}, |
284 "MOCK builder (Debug)": {"port_name": "test-mac-snowleopard"}, | 302 "MOCK builder (Debug)": {"port_name": "test-mac-snowleopard"}, |
285 } | 303 } |
286 | 304 |
287 def tearDown(self): | 305 def tearDown(self): |
288 builders._exact_matches = self.old_exact_matches | 306 builders._exact_matches = self.old_exact_matches |
289 super(TestRebaselineJson, self).tearDown() | 307 super(TestRebaselineJson, self).tearDown() |
290 | 308 |
291 def test_rebaseline_all(self): | 309 def test_rebaseline_all(self): |
| 310 self._setup_mock_builder_data() |
| 311 |
292 options = MockOptions(optimize=True, verbose=True, results_directory=Non
e) | 312 options = MockOptions(optimize=True, verbose=True, results_directory=Non
e) |
293 self._write("user-scripts/another-test.html", "Dummy test contents") | 313 self._write("userscripts/first-test.html", "Dummy test contents") |
294 self.command._rebaseline(options, {"user-scripts/another-test.html": {"
MOCK builder": ["txt", "png"]}}) | 314 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOC
K builder": ["txt", "png"]}}) |
295 | 315 |
296 # Note that we have one run_in_parallel() call followed by a run_command
() | 316 # Note that we have one run_in_parallel() call followed by a run_command
() |
297 self.assertEqual(self.tool.executive.calls, | 317 self.assertEqual(self.tool.executive.calls, |
298 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder', '--test', 'user-scripts/another-test.html', '--
verbose']], | 318 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--ver
bose']], |
299 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder', '--test', 'user-scripts/another-test.html', '--verbose'
]], | 319 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--verbose']], |
300 ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png'
, 'user-scripts/another-test.html']]) | 320 ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png'
, 'userscripts/first-test.html']]) |
301 | 321 |
302 def test_rebaseline_debug(self): | 322 def test_rebaseline_debug(self): |
| 323 self._setup_mock_builder_data() |
| 324 |
303 options = MockOptions(optimize=True, verbose=True, results_directory=Non
e) | 325 options = MockOptions(optimize=True, verbose=True, results_directory=Non
e) |
304 self._write("user-scripts/another-test.html", "Dummy test contents") | 326 self._write("userscripts/first-test.html", "Dummy test contents") |
305 self.command._rebaseline(options, {"user-scripts/another-test.html": {"
MOCK builder (Debug)": ["txt", "png"]}}) | 327 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOC
K builder (Debug)": ["txt", "png"]}}) |
306 | 328 |
307 # Note that we have one run_in_parallel() call followed by a run_command
() | 329 # Note that we have one run_in_parallel() call followed by a run_command
() |
308 self.assertEqual(self.tool.executive.calls, | 330 self.assertEqual(self.tool.executive.calls, |
309 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder (Debug)', '--test', 'user-scripts/another-test.ht
ml', '--verbose']], | 331 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder (Debug)', '--test', 'userscripts/first-test.html'
, '--verbose']], |
310 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder (Debug)', '--test', 'user-scripts/another-test.html', '--
verbose']], | 332 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder (Debug)', '--test', 'userscripts/first-test.html', '--ver
bose']], |
311 ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png'
, 'user-scripts/another-test.html']]) | 333 ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png'
, 'userscripts/first-test.html']]) |
312 | 334 |
313 def test_no_optimize(self): | 335 def test_no_optimize(self): |
| 336 self._setup_mock_builder_data() |
| 337 |
314 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) | 338 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) |
315 self._write("user-scripts/another-test.html", "Dummy test contents") | 339 self._write("userscripts/first-test.html", "Dummy test contents") |
316 self.command._rebaseline(options, {"user-scripts/another-test.html": {"
MOCK builder (Debug)": ["txt", "png"]}}) | 340 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOC
K builder (Debug)": ["txt", "png"]}}) |
317 | 341 |
318 # Note that we have only one run_in_parallel() call | 342 # Note that we have only one run_in_parallel() call |
319 self.assertEqual(self.tool.executive.calls, | 343 self.assertEqual(self.tool.executive.calls, |
320 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder (Debug)', '--test', 'user-scripts/another-test.ht
ml', '--verbose']], | 344 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder (Debug)', '--test', 'userscripts/first-test.html'
, '--verbose']], |
321 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder (Debug)', '--test', 'user-scripts/another-test.html', '--
verbose']]]) | 345 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder (Debug)', '--test', 'userscripts/first-test.html', '--ver
bose']]]) |
322 | 346 |
323 def test_results_directory(self): | 347 def test_results_directory(self): |
| 348 self._setup_mock_builder_data() |
| 349 |
324 options = MockOptions(optimize=False, verbose=True, results_directory='/
tmp') | 350 options = MockOptions(optimize=False, verbose=True, results_directory='/
tmp') |
325 self._write("user-scripts/another-test.html", "Dummy test contents") | 351 self._write("userscripts/first-test.html", "Dummy test contents") |
326 self.command._rebaseline(options, {"user-scripts/another-test.html": {"
MOCK builder": ["txt", "png"]}}) | 352 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOC
K builder": ["txt", "png"]}}) |
327 | 353 |
328 # Note that we have only one run_in_parallel() call | 354 # Note that we have only one run_in_parallel() call |
329 self.assertEqual(self.tool.executive.calls, | 355 self.assertEqual(self.tool.executive.calls, |
330 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder', '--test', 'user-scripts/another-test.html', '--
results-directory', '/tmp', '--verbose']], | 356 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--res
ults-directory', '/tmp', '--verbose']], |
331 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder', '--test', 'user-scripts/another-test.html', '--results-
directory', '/tmp', '--verbose']]]) | 357 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--results-dir
ectory', '/tmp', '--verbose']]]) |
332 | 358 |
333 class TestRebaselineJsonUpdatesExpectationsFiles(_BaseTestCase): | 359 class TestRebaselineJsonUpdatesExpectationsFiles(_BaseTestCase): |
334 command_constructor = RebaselineJson | 360 command_constructor = RebaselineJson |
335 | 361 |
336 def setUp(self): | 362 def setUp(self): |
337 super(TestRebaselineJsonUpdatesExpectationsFiles, self).setUp() | 363 super(TestRebaselineJsonUpdatesExpectationsFiles, self).setUp() |
338 self.tool.executive = MockExecutive2() | 364 self.tool.executive = MockExecutive2() |
339 | 365 |
340 def mock_run_command(args, | 366 def mock_run_command(args, |
341 cwd=None, | 367 cwd=None, |
342 input=None, | 368 input=None, |
343 error_handler=None, | 369 error_handler=None, |
344 return_exit_code=False, | 370 return_exit_code=False, |
345 return_stderr=True, | 371 return_stderr=True, |
346 decode_output=False, | 372 decode_output=False, |
347 env=None): | 373 env=None): |
348 return '{"add": [], "remove-lines": [{"test": "userscripts/another-t
est.html", "builder": "WebKit Mac10.7"}]}\n' | 374 return '{"add": [], "remove-lines": [{"test": "userscripts/first-tes
t.html", "builder": "WebKit Mac10.7"}]}\n' |
349 self.tool.executive.run_command = mock_run_command | 375 self.tool.executive.run_command = mock_run_command |
350 | 376 |
351 def test_rebaseline_updates_expectations_file(self): | 377 def test_rebaseline_updates_expectations_file(self): |
352 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) | 378 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) |
353 | 379 |
354 self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/ano
ther-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/another-test.h
tml [ ImageOnlyFailure ]\n") | 380 self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/fir
st-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/first-test.html
[ ImageOnlyFailure ]\n") |
355 self._write("userscripts/another-test.html", "Dummy test contents") | 381 self._write("userscripts/first-test.html", "Dummy test contents") |
| 382 self._setup_mock_builder_data() |
356 | 383 |
357 self.command._rebaseline(options, {"userscripts/another-test.html": {"W
ebKit Mac10.7": ["txt", "png"]}}) | 384 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) |
358 | 385 |
359 new_expectations = self._read(self.lion_expectations_path) | 386 new_expectations = self._read(self.lion_expectations_path) |
360 self.assertMultiLineEqual(new_expectations, "Bug(x) [ MountainLion SnowL
eopard ] userscripts/another-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] us
erscripts/another-test.html [ ImageOnlyFailure ]\n") | 387 self.assertMultiLineEqual(new_expectations, "Bug(x) [ MountainLion SnowL
eopard ] userscripts/first-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] user
scripts/first-test.html [ ImageOnlyFailure ]\n") |
361 | 388 |
362 def test_rebaseline_updates_expectations_file_all_platforms(self): | 389 def test_rebaseline_updates_expectations_file_all_platforms(self): |
363 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) | 390 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) |
364 | 391 |
365 self._write(self.lion_expectations_path, "Bug(x) userscripts/another-tes
t.html [ ImageOnlyFailure ]\n") | 392 self._write(self.lion_expectations_path, "Bug(x) userscripts/first-test.
html [ ImageOnlyFailure ]\n") |
366 self._write("userscripts/another-test.html", "Dummy test contents") | 393 self._write("userscripts/first-test.html", "Dummy test contents") |
| 394 self._setup_mock_builder_data() |
367 | 395 |
368 self.command._rebaseline(options, {"userscripts/another-test.html": {"W
ebKit Mac10.7": ["txt", "png"]}}) | 396 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) |
369 | 397 |
370 new_expectations = self._read(self.lion_expectations_path) | 398 new_expectations = self._read(self.lion_expectations_path) |
371 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux MountainLion
SnowLeopard Win ] userscripts/another-test.html [ ImageOnlyFailure ]\n") | 399 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux MountainLion
SnowLeopard Win ] userscripts/first-test.html [ ImageOnlyFailure ]\n") |
372 | 400 |
373 | 401 |
374 class TestRebaseline(_BaseTestCase): | 402 class TestRebaseline(_BaseTestCase): |
375 # This command shares most of its logic with RebaselineJson, so these tests
just test what is different. | 403 # This command shares most of its logic with RebaselineJson, so these tests
just test what is different. |
376 | 404 |
377 command_constructor = Rebaseline # AKA webkit-patch rebaseline | 405 command_constructor = Rebaseline # AKA webkit-patch rebaseline |
378 | 406 |
379 def test_rebaseline(self): | 407 def test_rebaseline(self): |
380 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder
')] | 408 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder
')] |
381 | 409 |
382 self._write("mock/path/to/test.html", "Dummy test contents") | 410 self._write("userscripts/first-test.html", "test data") |
383 | 411 |
384 self._zero_out_test_expectations() | 412 self._zero_out_test_expectations() |
| 413 self._setup_mock_builder_data() |
385 | 414 |
386 old_exact_matches = builders._exact_matches | 415 old_exact_matches = builders._exact_matches |
387 try: | 416 try: |
388 builders._exact_matches = { | 417 builders._exact_matches = { |
389 "MOCK builder": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, | 418 "MOCK builder": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, |
390 } | 419 } |
391 self.command.execute(MockOptions(results_directory=False, optimize=F
alse, builders=None, suffixes="txt,png", verbose=True), ['mock/path/to/test.html
'], self.tool) | 420 self.command.execute(MockOptions(results_directory=False, optimize=F
alse, builders=None, suffixes="txt,png", verbose=True), ['userscripts/first-test
.html'], self.tool) |
392 finally: | 421 finally: |
393 builders._exact_matches = old_exact_matches | 422 builders._exact_matches = old_exact_matches |
394 | 423 |
395 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t
ool.executive.calls) | 424 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t
ool.executive.calls) |
396 self.assertEqual(calls, | 425 self.assertEqual(calls, |
397 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder', '--test', 'mock/path/to/test.html', '--verbose'
]], | 426 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--ver
bose']], |
398 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder', '--test', 'mock/path/to/test.html', '--verbose']]]) | 427 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--verbose']]]
) |
399 | 428 |
400 def test_rebaseline_directory(self): | 429 def test_rebaseline_directory(self): |
401 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder
')] | 430 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder
')] |
402 | 431 |
403 self._write("userscripts/first-test.html", "test data") | 432 self._write("userscripts/first-test.html", "test data") |
404 self._write("userscripts/second-test.html", "test data") | 433 self._write("userscripts/second-test.html", "test data") |
405 | 434 |
| 435 self._setup_mock_builder_data() |
| 436 |
406 old_exact_matches = builders._exact_matches | 437 old_exact_matches = builders._exact_matches |
407 try: | 438 try: |
408 builders._exact_matches = { | 439 builders._exact_matches = { |
409 "MOCK builder": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, | 440 "MOCK builder": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, |
410 } | 441 } |
411 self.command.execute(MockOptions(results_directory=False, optimize=F
alse, builders=None, suffixes="txt,png", verbose=True), ['userscripts'], self.to
ol) | 442 self.command.execute(MockOptions(results_directory=False, optimize=F
alse, builders=None, suffixes="txt,png", verbose=True), ['userscripts'], self.to
ol) |
412 finally: | 443 finally: |
413 builders._exact_matches = old_exact_matches | 444 builders._exact_matches = old_exact_matches |
414 | 445 |
415 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t
ool.executive.calls) | 446 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t
ool.executive.calls) |
416 self.assertEqual(calls, | 447 self.assertEqual(calls, |
417 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--ver
bose'], | 448 [[['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--ver
bose'], |
418 ['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder', '--test', 'userscripts/second-test.html', '--ve
rbose']], | 449 ['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,pn
g', '--builder', 'MOCK builder', '--test', 'userscripts/second-test.html', '--ve
rbose']], |
419 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--verbose'], | 450 [['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--verbose'], |
420 ['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder', '--test', 'userscripts/second-test.html', '--verbose']]
]) | 451 ['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--b
uilder', 'MOCK builder', '--test', 'userscripts/second-test.html', '--verbose']]
]) |
421 | 452 |
422 | 453 |
423 class TestRebaselineExpectations(_BaseTestCase): | 454 class TestRebaselineExpectations(_BaseTestCase): |
424 command_constructor = RebaselineExpectations | 455 command_constructor = RebaselineExpectations |
425 | 456 |
426 def setUp(self): | 457 def setUp(self): |
427 super(TestRebaselineExpectations, self).setUp() | 458 super(TestRebaselineExpectations, self).setUp() |
428 self.options = MockOptions(optimize=False, builders=None, suffixes=['txt
'], verbose=False, platform=None, results_directory=None) | 459 self.options = MockOptions(optimize=False, builders=None, suffixes=['txt
'], verbose=False, platform=None, results_directory=None) |
429 | 460 |
430 def test_rebaseline_expectations(self): | 461 def test_rebaseline_expectations(self): |
431 self._zero_out_test_expectations() | 462 self._zero_out_test_expectations() |
432 | 463 |
433 self.tool.executive = MockExecutive2() | 464 self.tool.executive = MockExecutive2() |
434 | 465 |
| 466 def builder_data(): |
| 467 self.command._builder_data['MOCK SnowLeopard'] = self.command._build
er_data['MOCK Leopard'] = LayoutTestResults.results_from_string("""ADD_RESULTS({ |
| 468 "tests": { |
| 469 "userscripts": { |
| 470 "another-test.html": { |
| 471 "expected": "PASS", |
| 472 "actual": "PASS TEXT" |
| 473 }, |
| 474 "images.svg": { |
| 475 "expected": "FAIL", |
| 476 "actual": "IMAGE+TEXT" |
| 477 } |
| 478 } |
| 479 } |
| 480 });""") |
| 481 return self.command._builder_data |
| 482 |
| 483 self.command.builder_data = builder_data |
| 484 |
435 self._write("userscripts/another-test.html", "Dummy test contents") | 485 self._write("userscripts/another-test.html", "Dummy test contents") |
436 self._write("userscripts/images.svg", "Dummy test contents") | 486 self._write("userscripts/images.svg", "Dummy test contents") |
437 self.command._tests_to_rebaseline = lambda port: {'userscripts/another-t
est.html': set(['txt']), 'userscripts/images.svg': set(['png'])} | 487 self.command._tests_to_rebaseline = lambda port: { |
438 self.command.execute(self.options, [], self.tool) | 488 'userscripts/another-test.html': set(['txt']), |
| 489 'userscripts/images.svg': set(['png']), |
| 490 'userscripts/not-actually-failing.html': set(['txt', 'png', 'wav']), |
| 491 } |
| 492 |
| 493 old_exact_matches = builders._exact_matches |
| 494 try: |
| 495 builders._exact_matches = { |
| 496 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, |
| 497 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci
fiers": set(["mock-specifier"])}, |
| 498 } |
| 499 self.command.execute(self.options, [], self.tool) |
| 500 finally: |
| 501 builders._exact_matches = old_exact_matches |
439 | 502 |
440 # FIXME: change this to use the test- ports. | 503 # FIXME: change this to use the test- ports. |
441 calls = filter(lambda x: x != ['qmake', '-v'], self.tool.executive.calls
) | 504 calls = filter(lambda x: x != ['qmake', '-v'], self.tool.executive.calls
) |
442 self.assertEqual(len(calls), 2) | 505 self.assertEqual(self.tool.executive.calls, [ |
443 self.assertEqual(len(calls[0]), 14) | 506 [ |
| 507 ['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt'
, '--builder', 'MOCK Leopard', '--test', 'userscripts/another-test.html'], |
| 508 ['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt'
, '--builder', 'MOCK SnowLeopard', '--test', 'userscripts/another-test.html'], |
| 509 ['echo', 'copy-existing-baselines-internal', '--suffixes', 'png'
, '--builder', 'MOCK Leopard', '--test', 'userscripts/images.svg'], |
| 510 ['echo', 'copy-existing-baselines-internal', '--suffixes', 'png'
, '--builder', 'MOCK SnowLeopard', '--test', 'userscripts/images.svg'] |
| 511 ], |
| 512 [ |
| 513 ['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--bui
lder', 'MOCK Leopard', '--test', 'userscripts/another-test.html'], |
| 514 ['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--bui
lder', 'MOCK SnowLeopard', '--test', 'userscripts/another-test.html'], |
| 515 ['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--bui
lder', 'MOCK Leopard', '--test', 'userscripts/images.svg'], |
| 516 ['echo', 'rebaseline-test-internal', '--suffixes', 'png', '--bui
lder', 'MOCK SnowLeopard', '--test', 'userscripts/images.svg'] |
| 517 ] |
| 518 ]) |
444 | 519 |
445 def test_rebaseline_expectations_noop(self): | 520 def test_rebaseline_expectations_noop(self): |
446 self._zero_out_test_expectations() | 521 self._zero_out_test_expectations() |
447 | 522 |
448 oc = OutputCapture() | 523 oc = OutputCapture() |
449 try: | 524 try: |
450 oc.capture_output() | 525 oc.capture_output() |
451 self.command.execute(self.options, [], self.tool) | 526 self.command.execute(self.options, [], self.tool) |
452 finally: | 527 finally: |
453 _, _, logs = oc.restore_output() | 528 _, _, logs = oc.restore_output() |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 ['echo', 'optimize-baselines', '--suffixes', 'txt', 'fast/dom/pr
ototype-taco.html'], | 839 ['echo', 'optimize-baselines', '--suffixes', 'txt', 'fast/dom/pr
ototype-taco.html'], |
765 ['git', 'pull'], | 840 ['git', 'pull'], |
766 ]) | 841 ]) |
767 | 842 |
768 # The mac ports should both be removed since they're the only ones i
n builders._exact_matches. | 843 # The mac ports should both be removed since they're the only ones i
n builders._exact_matches. |
769 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ | 844 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ |
770 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] | 845 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] |
771 """) | 846 """) |
772 finally: | 847 finally: |
773 builders._exact_matches = old_exact_matches | 848 builders._exact_matches = old_exact_matches |
OLD | NEW |