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

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

Issue 23135008: Modify the rebaselining logic to handle skipped tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 "actual": "IMAGE+TEXT" 86 "actual": "IMAGE+TEXT"
87 } 87 }
88 } 88 }
89 } 89 }
90 });""") 90 });""")
91 for builder in ['MOCK builder', 'MOCK builder (Debug)', 'WebKit Mac10.7' ]: 91 for builder in ['MOCK builder', 'MOCK builder (Debug)', 'WebKit Mac10.7' ]:
92 self.command._builder_data[builder] = data 92 self.command._builder_data[builder] = data
93 93
94 94
95 class TestCopyExistingBaselinesInternal(_BaseTestCase): 95 class TestCopyExistingBaselinesInternal(_BaseTestCase):
96 command_constructor = CopyExistingBaselinesInternal # AKA webkit-patch reba seline-test-internal 96 command_constructor = CopyExistingBaselinesInternal
97 97
98 def setUp(self): 98 def setUp(self):
99 super(TestCopyExistingBaselinesInternal, self).setUp() 99 super(TestCopyExistingBaselinesInternal, self).setUp()
100 100
101 def test_copying_overwritten_baseline(self): 101 def test_copying_overwritten_baseline(self):
102 self.tool.executive = MockExecutive2() 102 self.tool.executive = MockExecutive2()
103 103
104 # FIXME: it's confusing that this is the test- port, and not the regular lion port. Really all of the tests should be using the test ports. 104 # FIXME: it's confusing that this is the test- port, and not the regular lion port. Really all of the tests should be using the test ports.
105 port = self.tool.port_factory.get('test-mac-snowleopard') 105 port = self.tool.port_factory.get('test-mac-snowleopard')
106 self._write(port._filesystem.join(port.layout_tests_dir(), 'platform/tes t-mac-snowleopard/failures/expected/image-expected.txt'), 'original snowleopard result') 106 self._write(port._filesystem.join(port.layout_tests_dir(), 'platform/tes t-mac-snowleopard/failures/expected/image-expected.txt'), 'original snowleopard result')
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 self.command.execute(options, [], self.tool) 174 self.command.execute(options, [], self.tool)
175 finally: 175 finally:
176 out, _, _ = oc.restore_output() 176 out, _, _ = oc.restore_output()
177 builders._exact_matches = old_exact_matches 177 builders._exact_matches = old_exact_matches
178 178
179 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(), 'platform/test-linux-x86_64/failures/expected/image-expected.txt ')), 'original win7 result') 179 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(), 'platform/test-linux-x86_64/failures/expected/image-expected.txt ')), 'original win7 result')
180 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(), 'platform/test-win-win7/failures/expected/image-expected.txt')), 'original win7 result') 180 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(), 'platform/test-win-win7/failures/expected/image-expected.txt')), 'original win7 result')
181 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(p ort.layout_tests_dir(), 'platform/mac-leopard/userscripts/another-test-expected. txt'))) 181 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(p ort.layout_tests_dir(), 'platform/mac-leopard/userscripts/another-test-expected. txt')))
182 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": []}\n') 182 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": []}\n')
183 183
184 def test_no_copy_skipped_test(self):
185 self.tool.executive = MockExecutive2()
186
187 port = self.tool.port_factory.get('test-win-win7')
188 fs = self.tool.filesystem
189 self._write(fs.join(port.layout_tests_dir(), 'platform/test-win-win7/fai lures/expected/image-expected.txt'), 'original win7 result')
190 expectations_path = fs.join(port.path_to_generic_test_expectations_file( ))
191 self._write(expectations_path, (
192 "[ Win ] failures/expected/image.html [ Failure ]\n"
193 "[ Linux ] failures/expected/image.html [ Skip ]\n"))
194 old_exact_matches = builders._exact_matches
195 oc = OutputCapture()
196 try:
197 builders._exact_matches = {
198 "MOCK Linux": {"port_name": "test-linux-x86_64", "specifiers": s et(["mock-specifier"])},
199 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])},
200 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set([" mock-specifier"])},
201 }
202
203 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T rue, test="failures/expected/image.html", results_directory=None)
204
205 oc.capture_output()
206 self.command.execute(options, [], self.tool)
207 finally:
208 out, _, _ = oc.restore_output()
209 builders._exact_matches = old_exact_matches
210
211 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-linux-x86_64/failures/expected/image-expected.txt')))
212 self.assertEqual(self._read(fs.join(port.layout_tests_dir(), 'platform/t est-win-win7/failures/expected/image-expected.txt')),
213 'original win7 result')
214
184 215
185 class TestRebaselineTest(_BaseTestCase): 216 class TestRebaselineTest(_BaseTestCase):
186 command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-int ernal 217 command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-int ernal
187 218
188 def setUp(self): 219 def setUp(self):
189 super(TestRebaselineTest, self).setUp() 220 super(TestRebaselineTest, self).setUp()
190 self.options = MockOptions(builder="WebKit Mac10.7", test="userscripts/a nother-test.html", suffixes="txt", results_directory=None) 221 self.options = MockOptions(builder="WebKit Mac10.7", test="userscripts/a nother-test.html", suffixes="txt", results_directory=None)
191 222
192 def test_baseline_directory(self): 223 def test_baseline_directory(self):
193 command = self.command 224 command = self.command
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 ['echo', 'optimize-baselines', '--suffixes', 'txt', 'fast/dom/pr ototype-taco.html'], 873 ['echo', 'optimize-baselines', '--suffixes', 'txt', 'fast/dom/pr ototype-taco.html'],
843 ['git', 'pull'], 874 ['git', 'pull'],
844 ]) 875 ])
845 876
846 # The mac ports should both be removed since they're the only ones i n builders._exact_matches. 877 # The mac ports should both be removed since they're the only ones i n builders._exact_matches.
847 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """ 878 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """
848 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] 879 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
849 """) 880 """)
850 finally: 881 finally:
851 builders._exact_matches = old_exact_matches 882 builders._exact_matches = old_exact_matches
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698