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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 self._write("userscripts/another-test.html", "test data") | 289 self._write("userscripts/another-test.html", "test data") |
290 self._write(self.mac_expectations_path, | 290 self._write(self.mac_expectations_path, |
291 "Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\nb
ug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n") | 291 "Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\nb
ug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n") |
292 self.options.results_directory = '/tmp' | 292 self.options.results_directory = '/tmp' |
293 self.command._rebaseline_test_and_update_expectations(self.options) | 293 self.command._rebaseline_test_and_update_expectations(self.options) |
294 self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscri
pts/another-test-actual.txt']) | 294 self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscri
pts/another-test-actual.txt']) |
295 | 295 |
296 def test_rebaseline_reftest(self): | 296 def test_rebaseline_reftest(self): |
297 self._write("userscripts/another-test.html", "test data") | 297 self._write("userscripts/another-test.html", "test data") |
298 self._write("userscripts/another-test-expected.html", "generic result") | 298 self._write("userscripts/another-test-expected.html", "generic result") |
| 299 self.options.suffixes = 'png' |
299 OutputCapture().assert_outputs(self, self.command._rebaseline_test_and_u
pdate_expectations, args=[self.options], | 300 OutputCapture().assert_outputs(self, self.command._rebaseline_test_and_u
pdate_expectations, args=[self.options], |
300 expected_logs="Cannot rebaseline reftest:
userscripts/another-test.html\n") | 301 expected_logs="Cannot rebaseline image re
sult for reftest: userscripts/another-test.html\n") |
301 self.assertDictEqual(self.command._scm_changes, {'add': [], 'remove-line
s': [], "delete": []}) | 302 self.assertDictEqual(self.command._scm_changes, {'add': [], 'remove-line
s': [], "delete": []}) |
302 | 303 |
303 def test_rebaseline_test_and_print_scm_changes(self): | 304 def test_rebaseline_test_and_print_scm_changes(self): |
304 self.command._print_scm_changes = True | 305 self.command._print_scm_changes = True |
305 self.command._scm_changes = {'add': [], 'delete': []} | 306 self.command._scm_changes = {'add': [], 'delete': []} |
306 self.tool._scm.exists = lambda x: False | 307 self.tool._scm.exists = lambda x: False |
307 | 308 |
308 self.command._rebaseline_test("WebKit Linux Trusty", "userscripts/anothe
r-test.html", "txt", None) | 309 self.command._rebaseline_test("WebKit Linux Trusty", "userscripts/anothe
r-test.html", "txt", None) |
309 | 310 |
310 self.assertDictEqual(self.command._scm_changes, { | 311 self.assertDictEqual(self.command._scm_changes, { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/another
-test.html'], | 702 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/another
-test.html'], |
702 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx
t', | 703 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx
t', |
703 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/another
-test.html'], | 704 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/another
-test.html'], |
704 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn
g', | 705 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn
g', |
705 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/images.
svg'], | 706 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/images.
svg'], |
706 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn
g', | 707 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn
g', |
707 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/images.
svg'], | 708 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/images.
svg'], |
708 ], | 709 ], |
709 ]) | 710 ]) |
710 | 711 |
| 712 def test_rebaseline_expectations_reftests(self): |
| 713 self._zero_out_test_expectations() |
| 714 |
| 715 self.tool.executive = MockExecutive2() |
| 716 |
| 717 def builder_data(): |
| 718 self.command._builder_data['MOCK Mac10.10'] = self.command._builder_
data['MOCK Mac10.11'] = LayoutTestResults.results_from_string("""ADD_RESULTS({ |
| 719 "tests": { |
| 720 "userscripts": { |
| 721 "reftest-text.html": { |
| 722 "expected": "PASS", |
| 723 "actual": "TEXT" |
| 724 }, |
| 725 "reftest-image.html": { |
| 726 "expected": "FAIL", |
| 727 "actual": "IMAGE" |
| 728 }, |
| 729 "reftest-image-text.html": { |
| 730 "expected": "FAIL", |
| 731 "actual": "IMAGE+TEXT" |
| 732 } |
| 733 } |
| 734 } |
| 735 });""") |
| 736 return self.command._builder_data |
| 737 |
| 738 self.command.builder_data = builder_data |
| 739 |
| 740 self._write("userscripts/reftest-text.html", "Dummy test contents") |
| 741 self._write("userscripts/reftest-text-expected.html", "Dummy test conten
ts") |
| 742 self._write("userscripts/reftest-text-expected.html", "Dummy test conten
ts") |
| 743 self.command._tests_to_rebaseline = lambda port: { |
| 744 'userscripts/reftest-text.html': set(['txt']), |
| 745 'userscripts/reftest-image.html': set(['png']), |
| 746 'userscripts/reftest-image-text.html': set(['png', 'txt']), |
| 747 } |
| 748 |
| 749 self.tool.builders = FakeBuilders({ |
| 750 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se
t(["mock-specifier"])}, |
| 751 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": se
t(["mock-specifier"])}, |
| 752 }) |
| 753 self.command.execute(self.options, [], self.tool) |
| 754 |
| 755 # FIXME: change this to use the test- ports. |
| 756 calls = filter(lambda x: x != ['qmake', '-v'], self.tool.executive.calls
) |
| 757 |
| 758 self.assertEqual(self.tool.executive.calls, [ |
| 759 [ |
| 760 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'txt', |
| 761 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/reftest
-text.html'], |
| 762 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix
es', 'txt', |
| 763 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/reftest
-text.html'], |
| 764 ], |
| 765 [ |
| 766 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx
t', |
| 767 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/reftest
-text.html'], |
| 768 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx
t', |
| 769 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/reftest
-text.html'], |
| 770 ], |
| 771 ]) |
| 772 |
711 def test_rebaseline_expectations_noop(self): | 773 def test_rebaseline_expectations_noop(self): |
712 self._zero_out_test_expectations() | 774 self._zero_out_test_expectations() |
713 | 775 |
714 oc = OutputCapture() | 776 oc = OutputCapture() |
715 try: | 777 try: |
716 oc.capture_output() | 778 oc.capture_output() |
717 self.command.execute(self.options, [], self.tool) | 779 self.command.execute(self.options, [], self.tool) |
718 finally: | 780 finally: |
719 _, _, logs = oc.restore_output() | 781 _, _, logs = oc.restore_output() |
720 self.assertEqual(self.tool.filesystem.written_files, {}) | 782 self.assertEqual(self.tool.filesystem.written_files, {}) |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV
ELD_REFRESH_TOKEN], | 1495 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV
ELD_REFRESH_TOKEN], |
1434 ['git', 'pull'], | 1496 ['git', 'pull'], |
1435 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R
IETVELD_REFRESH_TOKEN], | 1497 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R
IETVELD_REFRESH_TOKEN], |
1436 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], | 1498 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv
eldissue'], |
1437 ], | 1499 ], |
1438 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN) | 1500 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN) |
1439 | 1501 |
1440 def test_execute_with_dry_run(self): | 1502 def test_execute_with_dry_run(self): |
1441 self._basic_execute_test([], dry_run=True) | 1503 self._basic_execute_test([], dry_run=True) |
1442 self.assertEqual(self.tool.scm().local_commits(), []) | 1504 self.assertEqual(self.tool.scm().local_commits(), []) |
OLD | NEW |