| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 def test_rebaseline_updates_expectations_file(self): | 443 def test_rebaseline_updates_expectations_file(self): |
| 444 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) | 444 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) |
| 445 | 445 |
| 446 self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/fir
st-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/first-test.html
[ ImageOnlyFailure ]\n") | 446 self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/fir
st-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/first-test.html
[ ImageOnlyFailure ]\n") |
| 447 self._write("userscripts/first-test.html", "Dummy test contents") | 447 self._write("userscripts/first-test.html", "Dummy test contents") |
| 448 self._setup_mock_builder_data() | 448 self._setup_mock_builder_data() |
| 449 | 449 |
| 450 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) | 450 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) |
| 451 | 451 |
| 452 new_expectations = self._read(self.lion_expectations_path) | 452 new_expectations = self._read(self.lion_expectations_path) |
| 453 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Mavericks Mountain
Lion Retina SnowLeopard ] userscripts/first-test.html [ ImageOnlyFailure ]\nbug(
z) [ Linux ] userscripts/first-test.html [ ImageOnlyFailure ]\n") | 453 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Mavericks Mountain
Lion Retina SnowLeopard Yosemite ] userscripts/first-test.html [ ImageOnlyFailur
e ]\nbug(z) [ Linux ] userscripts/first-test.html [ ImageOnlyFailure ]\n") |
| 454 | 454 |
| 455 def test_rebaseline_updates_expectations_file_all_platforms(self): | 455 def test_rebaseline_updates_expectations_file_all_platforms(self): |
| 456 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) | 456 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) |
| 457 | 457 |
| 458 self._write(self.lion_expectations_path, "Bug(x) userscripts/first-test.
html [ ImageOnlyFailure ]\n") | 458 self._write(self.lion_expectations_path, "Bug(x) userscripts/first-test.
html [ ImageOnlyFailure ]\n") |
| 459 self._write("userscripts/first-test.html", "Dummy test contents") | 459 self._write("userscripts/first-test.html", "Dummy test contents") |
| 460 self._setup_mock_builder_data() | 460 self._setup_mock_builder_data() |
| 461 | 461 |
| 462 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) | 462 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) |
| 463 | 463 |
| 464 new_expectations = self._read(self.lion_expectations_path) | 464 new_expectations = self._read(self.lion_expectations_path) |
| 465 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Android Linux Mave
ricks MountainLion Retina SnowLeopard Win ] userscripts/first-test.html [ ImageO
nlyFailure ]\n") | 465 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Android Linux Mave
ricks MountainLion Retina SnowLeopard Win Yosemite ] userscripts/first-test.html
[ ImageOnlyFailure ]\n") |
| 466 | 466 |
| 467 def test_rebaseline_handles_platform_skips(self): | 467 def test_rebaseline_handles_platform_skips(self): |
| 468 # This test is just like test_rebaseline_updates_expectations_file_all_p
latforms(), | 468 # This test is just like test_rebaseline_updates_expectations_file_all_p
latforms(), |
| 469 # except that if a particular port happens to SKIP a test in an override
s file, | 469 # except that if a particular port happens to SKIP a test in an override
s file, |
| 470 # we count that as passing, and do not think that we still need to rebas
eline it. | 470 # we count that as passing, and do not think that we still need to rebas
eline it. |
| 471 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) | 471 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) |
| 472 | 472 |
| 473 self._write(self.lion_expectations_path, "Bug(x) userscripts/first-test.
html [ ImageOnlyFailure ]\n") | 473 self._write(self.lion_expectations_path, "Bug(x) userscripts/first-test.
html [ ImageOnlyFailure ]\n") |
| 474 self._write("NeverFixTests", "Bug(y) [ Android ] userscripts [ Skip ]\n"
) | 474 self._write("NeverFixTests", "Bug(y) [ Android ] userscripts [ Skip ]\n"
) |
| 475 self._write("userscripts/first-test.html", "Dummy test contents") | 475 self._write("userscripts/first-test.html", "Dummy test contents") |
| 476 self._setup_mock_builder_data() | 476 self._setup_mock_builder_data() |
| 477 | 477 |
| 478 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) | 478 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) |
| 479 | 479 |
| 480 new_expectations = self._read(self.lion_expectations_path) | 480 new_expectations = self._read(self.lion_expectations_path) |
| 481 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux Mavericks Mo
untainLion Retina SnowLeopard Win ] userscripts/first-test.html [ ImageOnlyFailu
re ]\n") | 481 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux Mavericks Mo
untainLion Retina SnowLeopard Win Yosemite ] userscripts/first-test.html [ Image
OnlyFailure ]\n") |
| 482 | 482 |
| 483 def test_rebaseline_handles_skips_in_file(self): | 483 def test_rebaseline_handles_skips_in_file(self): |
| 484 # This test is like test_Rebaseline_handles_platform_skips, except that
the | 484 # This test is like test_Rebaseline_handles_platform_skips, except that
the |
| 485 # Skip is in the same (generic) file rather than a platform file. In thi
s case, | 485 # Skip is in the same (generic) file rather than a platform file. In thi
s case, |
| 486 # the Skip line should be left unmodified. Note that the first line is n
ow | 486 # the Skip line should be left unmodified. Note that the first line is n
ow |
| 487 # qualified as "[Linux Mac Win]"; if it was unqualified, it would confli
ct with | 487 # qualified as "[Linux Mac Win]"; if it was unqualified, it would confli
ct with |
| 488 # the second line. | 488 # the second line. |
| 489 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) | 489 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) |
| 490 | 490 |
| 491 self._write(self.lion_expectations_path, | 491 self._write(self.lion_expectations_path, |
| 492 ("Bug(x) [ Linux Mac Win ] userscripts/first-test.html [ ImageOnlyFa
ilure ]\n" | 492 ("Bug(x) [ Linux Mac Win ] userscripts/first-test.html [ ImageOnlyFa
ilure ]\n" |
| 493 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n")) | 493 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n")) |
| 494 self._write("userscripts/first-test.html", "Dummy test contents") | 494 self._write("userscripts/first-test.html", "Dummy test contents") |
| 495 self._setup_mock_builder_data() | 495 self._setup_mock_builder_data() |
| 496 | 496 |
| 497 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) | 497 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) |
| 498 | 498 |
| 499 new_expectations = self._read(self.lion_expectations_path) | 499 new_expectations = self._read(self.lion_expectations_path) |
| 500 self.assertMultiLineEqual(new_expectations, | 500 self.assertMultiLineEqual( |
| 501 ("Bug(x) [ Linux Mavericks MountainLion Retina SnowLeopard Win ] use
rscripts/first-test.html [ ImageOnlyFailure ]\n" | 501 new_expectations, |
| 502 ("Bug(x) [ Linux Mavericks MountainLion Retina SnowLeopard Win Yosem
ite ] userscripts/first-test.html [ ImageOnlyFailure ]\n" |
| 502 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n")) | 503 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n")) |
| 503 | 504 |
| 504 def test_rebaseline_handles_smoke_tests(self): | 505 def test_rebaseline_handles_smoke_tests(self): |
| 505 # This test is just like test_rebaseline_handles_platform_skips, except
that we check for | 506 # This test is just like test_rebaseline_handles_platform_skips, except
that we check for |
| 506 # a test not being in the SmokeTests file, instead of using overrides fi
les. | 507 # a test not being in the SmokeTests file, instead of using overrides fi
les. |
| 507 # If a test is not part of the smoke tests, we count that as passing on
ports that only | 508 # If a test is not part of the smoke tests, we count that as passing on
ports that only |
| 508 # run smoke tests, and do not think that we still need to rebaseline it. | 509 # run smoke tests, and do not think that we still need to rebaseline it. |
| 509 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) | 510 options = MockOptions(optimize=False, verbose=True, results_directory=No
ne) |
| 510 | 511 |
| 511 self._write(self.lion_expectations_path, "Bug(x) userscripts/first-test.
html [ ImageOnlyFailure ]\n") | 512 self._write(self.lion_expectations_path, "Bug(x) userscripts/first-test.
html [ ImageOnlyFailure ]\n") |
| 512 self._write("SmokeTests", "fast/html/article-element.html") | 513 self._write("SmokeTests", "fast/html/article-element.html") |
| 513 self._write("userscripts/first-test.html", "Dummy test contents") | 514 self._write("userscripts/first-test.html", "Dummy test contents") |
| 514 self._setup_mock_builder_data() | 515 self._setup_mock_builder_data() |
| 515 | 516 |
| 516 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) | 517 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web
Kit Mac10.7": ["txt", "png"]}}) |
| 517 | 518 |
| 518 new_expectations = self._read(self.lion_expectations_path) | 519 new_expectations = self._read(self.lion_expectations_path) |
| 519 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux Mavericks Mo
untainLion Retina SnowLeopard Win ] userscripts/first-test.html [ ImageOnlyFailu
re ]\n") | 520 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux Mavericks Mo
untainLion Retina SnowLeopard Win Yosemite ] userscripts/first-test.html [ Image
OnlyFailure ]\n") |
| 520 | 521 |
| 521 | 522 |
| 522 class TestRebaseline(_BaseTestCase): | 523 class TestRebaseline(_BaseTestCase): |
| 523 # This command shares most of its logic with RebaselineJson, so these tests
just test what is different. | 524 # This command shares most of its logic with RebaselineJson, so these tests
just test what is different. |
| 524 | 525 |
| 525 command_constructor = Rebaseline # AKA webkit-patch rebaseline | 526 command_constructor = Rebaseline # AKA webkit-patch rebaseline |
| 526 | 527 |
| 527 def test_rebaseline(self): | 528 def test_rebaseline(self): |
| 528 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder
')] | 529 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder
')] |
| 529 | 530 |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 oc.capture_output() | 1334 oc.capture_output() |
| 1334 self.command._do_one_rebaseline() | 1335 self.command._do_one_rebaseline() |
| 1335 out, _, _ = oc.restore_output() | 1336 out, _, _ = oc.restore_output() |
| 1336 | 1337 |
| 1337 self.assertEqual(out, 'MOCK STDOUT\n') | 1338 self.assertEqual(out, 'MOCK STDOUT\n') |
| 1338 self.assertEqual(self.tool.executive.calls, [ | 1339 self.assertEqual(self.tool.executive.calls, [ |
| 1339 ['git', 'pull'], | 1340 ['git', 'pull'], |
| 1340 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au
to-rebaseline', '--verbose'], | 1341 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au
to-rebaseline', '--verbose'], |
| 1341 ]) | 1342 ]) |
| 1342 self.assertEqual(self._logs, ['MOCK STDOUT']) | 1343 self.assertEqual(self._logs, ['MOCK STDOUT']) |
| OLD | NEW |