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

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

Issue 1839193004: Run auto-formatter (autopep8) on webkitpy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 8 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
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 class TestCopyExistingBaselinesInternal(_BaseTestCase): 102 class TestCopyExistingBaselinesInternal(_BaseTestCase):
103 command_constructor = CopyExistingBaselinesInternal 103 command_constructor = CopyExistingBaselinesInternal
104 104
105 def setUp(self): 105 def setUp(self):
106 super(TestCopyExistingBaselinesInternal, self).setUp() 106 super(TestCopyExistingBaselinesInternal, self).setUp()
107 107
108 def test_copying_overwritten_baseline(self): 108 def test_copying_overwritten_baseline(self):
109 self.tool.executive = MockExecutive2() 109 self.tool.executive = MockExecutive2()
110 110
111 # FIXME: crbug.com/279494. it's confusing that this is the test- port, a nd not the regular mac10.10 port. Really all of the tests should be using the te st ports. 111 # FIXME: crbug.com/279494. it's confusing that this is the test- port, a nd
112 # not the regular mac10.10 port. Really all of the tests should be using
113 # the test ports.
112 port = self.tool.port_factory.get('test-mac-mac10.10') 114 port = self.tool.port_factory.get('test-mac-mac10.10')
113 self._write(port._filesystem.join(port.layout_tests_dir(), 'platform/tes t-mac-mac10.10/failures/expected/image-expected.txt'), 'original mac10.11 result ') 115 self._write(port._filesystem.join(port.layout_tests_dir(),
116 'platform/test-mac-mac10.10/failures/e xpected/image-expected.txt'), 'original mac10.11 result')
114 117
115 old_exact_matches = builders._exact_matches 118 old_exact_matches = builders._exact_matches
116 oc = OutputCapture() 119 oc = OutputCapture()
117 try: 120 try:
118 builders._exact_matches = { 121 builders._exact_matches = {
119 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers" : set(["mock-specifier"])}, 122 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers" : set(["mock-specifier"])},
120 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers" : set(["mock-specifier"])}, 123 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers" : set(["mock-specifier"])},
121 } 124 }
122 125
123 options = MockOptions(builder="MOCK Mac10.11", suffixes="txt", verbo se=True, test="failures/expected/image.html", results_directory=None) 126 options = MockOptions(builder="MOCK Mac10.11", suffixes="txt", verbo se=True,
127 test="failures/expected/image.html", results_d irectory=None)
124 128
125 oc.capture_output() 129 oc.capture_output()
126 self.command.execute(options, [], self.tool) 130 self.command.execute(options, [], self.tool)
127 finally: 131 finally:
128 out, _, _ = oc.restore_output() 132 out, _, _ = oc.restore_output()
129 builders._exact_matches = old_exact_matches 133 builders._exact_matches = old_exact_matches
130 134
131 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(), 'platform/test-mac-mac10.10/failures/expected/image-expected.txt ')), 'original mac10.11 result') 135 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(),
136 'platform /test-mac-mac10.10/failures/expected/image-expected.txt')), 'original mac10.11 r esult')
132 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete" : []}\n') 137 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete" : []}\n')
133 138
134 def test_copying_overwritten_baseline_to_multiple_locations(self): 139 def test_copying_overwritten_baseline_to_multiple_locations(self):
135 self.tool.executive = MockExecutive2() 140 self.tool.executive = MockExecutive2()
136 141
137 # FIXME: crbug.com/279494. it's confusing that this is the test- port, a nd not the regular win port. Really all of the tests should be using the test po rts. 142 # FIXME: crbug.com/279494. it's confusing that this is the test- port, a nd
143 # not the regular win port. Really all of the tests should be using the
144 # test ports.
138 port = self.tool.port_factory.get('test-win-win7') 145 port = self.tool.port_factory.get('test-win-win7')
139 self._write(port._filesystem.join(port.layout_tests_dir(), 'platform/tes t-win-win7/failures/expected/image-expected.txt'), 'original win7 result') 146 self._write(port._filesystem.join(port.layout_tests_dir(),
147 'platform/test-win-win7/failures/expec ted/image-expected.txt'), 'original win7 result')
140 148
141 old_exact_matches = builders._exact_matches 149 old_exact_matches = builders._exact_matches
142 oc = OutputCapture() 150 oc = OutputCapture()
143 try: 151 try:
144 builders._exact_matches = { 152 builders._exact_matches = {
145 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers" : set(["mock-specifier"])}, 153 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers" : set(["mock-specifier"])},
146 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])}, 154 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])},
147 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers" : set(["mock-specifier"])}, 155 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers" : set(["mock-specifier"])},
148 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set([" mock-specifier"])}, 156 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set([" mock-specifier"])},
149 } 157 }
150 158
151 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T rue, test="failures/expected/image.html", results_directory=None) 159 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T rue,
160 test="failures/expected/image.html", results_d irectory=None)
152 161
153 oc.capture_output() 162 oc.capture_output()
154 self.command.execute(options, [], self.tool) 163 self.command.execute(options, [], self.tool)
155 finally: 164 finally:
156 out, _, _ = oc.restore_output() 165 out, _, _ = oc.restore_output()
157 builders._exact_matches = old_exact_matches 166 builders._exact_matches = old_exact_matches
158 167
159 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(), 'platform/test-linux-trusty/failures/expected/image-expected.txt ')), 'original win7 result') 168 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(),
160 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(p ort.layout_tests_dir(), 'platform/test-linux-precise/userscripts/another-test-ex pected.txt'))) 169 'platform /test-linux-trusty/failures/expected/image-expected.txt')), 'original win7 resul t')
161 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(p ort.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/another-test-exp ected.txt'))) 170 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
171 port.layout_tests_dir(), 'platform/test-linux-precise/userscripts/an other-test-expected.txt')))
172 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
173 port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/ano ther-test-expected.txt')))
162 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete" : []}\n') 174 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete" : []}\n')
163 175
164 def test_no_copy_existing_baseline(self): 176 def test_no_copy_existing_baseline(self):
165 self.tool.executive = MockExecutive2() 177 self.tool.executive = MockExecutive2()
166 178
167 # 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. 179 # FIXME: it's confusing that this is the test- port, and not the regular
180 # win port. Really all of the tests should be using the test ports.
168 port = self.tool.port_factory.get('test-win-win7') 181 port = self.tool.port_factory.get('test-win-win7')
169 self._write(port._filesystem.join(port.layout_tests_dir(), 'platform/tes t-win-win7/failures/expected/image-expected.txt'), 'original win7 result') 182 self._write(port._filesystem.join(port.layout_tests_dir(),
183 'platform/test-win-win7/failures/expec ted/image-expected.txt'), 'original win7 result')
170 184
171 old_exact_matches = builders._exact_matches 185 old_exact_matches = builders._exact_matches
172 oc = OutputCapture() 186 oc = OutputCapture()
173 try: 187 try:
174 builders._exact_matches = { 188 builders._exact_matches = {
175 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers" : set(["mock-specifier"])}, 189 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers" : set(["mock-specifier"])},
176 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])}, 190 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])},
177 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set([" mock-specifier"])}, 191 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set([" mock-specifier"])},
178 } 192 }
179 193
180 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T rue, test="failures/expected/image.html", results_directory=None) 194 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T rue,
195 test="failures/expected/image.html", results_d irectory=None)
181 196
182 oc.capture_output() 197 oc.capture_output()
183 self.command.execute(options, [], self.tool) 198 self.command.execute(options, [], self.tool)
184 finally: 199 finally:
185 out, _, _ = oc.restore_output() 200 out, _, _ = oc.restore_output()
186 builders._exact_matches = old_exact_matches 201 builders._exact_matches = old_exact_matches
187 202
188 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(), 'platform/test-linux-trusty/failures/expected/image-expected.txt ')), 'original win7 result') 203 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(),
189 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') 204 'platform /test-linux-trusty/failures/expected/image-expected.txt')), 'original win7 resul t')
190 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(p ort.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/another-test-exp ected.txt'))) 205 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(),
206 'platform /test-win-win7/failures/expected/image-expected.txt')), 'original win7 result')
207 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
208 port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/ano ther-test-expected.txt')))
191 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete" : []}\n') 209 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete" : []}\n')
192 210
193 def test_no_copy_skipped_test(self): 211 def test_no_copy_skipped_test(self):
194 self.tool.executive = MockExecutive2() 212 self.tool.executive = MockExecutive2()
195 port = self.tool.port_factory.get('test-win-win7') 213 port = self.tool.port_factory.get('test-win-win7')
196 fs = self.tool.filesystem 214 fs = self.tool.filesystem
197 self._write(fs.join(port.layout_tests_dir(), 'platform/test-win-win7/fai lures/expected/image-expected.txt'), 'original win7 result') 215 self._write(fs.join(port.layout_tests_dir(), 'platform/test-win-win7/fai lures/expected/image-expected.txt'), 'original win7 result')
198 expectations_path = fs.join(port.path_to_generic_test_expectations_file( )) 216 expectations_path = fs.join(port.path_to_generic_test_expectations_file( ))
199 self._write(expectations_path, ( 217 self._write(expectations_path, (
200 "[ Win ] failures/expected/image.html [ Failure ]\n" 218 "[ Win ] failures/expected/image.html [ Failure ]\n"
201 "[ Linux ] failures/expected/image.html [ Skip ]\n")) 219 "[ Linux ] failures/expected/image.html [ Skip ]\n"))
202 old_exact_matches = builders._exact_matches 220 old_exact_matches = builders._exact_matches
203 oc = OutputCapture() 221 oc = OutputCapture()
204 try: 222 try:
205 builders._exact_matches = { 223 builders._exact_matches = {
206 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers" : set(["mock-specifier"])}, 224 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers" : set(["mock-specifier"])},
207 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])}, 225 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])},
208 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers" : set(["mock-specifier"])}, 226 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers" : set(["mock-specifier"])},
209 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set([" mock-specifier"])}, 227 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set([" mock-specifier"])},
210 } 228 }
211 229
212 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T rue, test="failures/expected/image.html", results_directory=None) 230 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T rue,
231 test="failures/expected/image.html", results_d irectory=None)
213 232
214 oc.capture_output() 233 oc.capture_output()
215 self.command.execute(options, [], self.tool) 234 self.command.execute(options, [], self.tool)
216 finally: 235 finally:
217 out, _, _ = oc.restore_output() 236 out, _, _ = oc.restore_output()
218 builders._exact_matches = old_exact_matches 237 builders._exact_matches = old_exact_matches
219 238
220 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-mac-mac10.10/failures/expected/image-expected.txt'))) 239 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-mac-mac10.10/failures/expected/image-expected.txt')))
221 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-linux-trusty/failures/expected/image-expected.txt'))) 240 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-linux-trusty/failures/expected/image-expected.txt')))
222 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-linux-precise/failures/expected/image-expected.txt'))) 241 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(),
242 'platform/test-linux-precise/failures /expected/image-expected.txt')))
223 self.assertEqual(self._read(fs.join(port.layout_tests_dir(), 'platform/t est-win-win7/failures/expected/image-expected.txt')), 243 self.assertEqual(self._read(fs.join(port.layout_tests_dir(), 'platform/t est-win-win7/failures/expected/image-expected.txt')),
224 'original win7 result') 244 'original win7 result')
225 245
226 246
227 class TestRebaselineTest(_BaseTestCase): 247 class TestRebaselineTest(_BaseTestCase):
228 command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-int ernal 248 command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-int ernal
229 249
230 def setUp(self): 250 def setUp(self):
231 super(TestRebaselineTest, self).setUp() 251 super(TestRebaselineTest, self).setUp()
232 self.options = MockOptions(builder="WebKit Mac10.11", test="userscripts/ another-test.html", suffixes="txt", results_directory=None) 252 self.options = MockOptions(builder="WebKit Mac10.11", test="userscripts/ another-test.html",
253 suffixes="txt", results_directory=None)
233 254
234 def test_baseline_directory(self): 255 def test_baseline_directory(self):
235 command = self.command 256 command = self.command
236 self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.11") , "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac") 257 self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.11") ,
237 self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.10") , "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10") 258 "/mock-checkout/third_party/WebKit/LayoutTests /platform/mac")
238 self.assertMultiLineEqual(command._baseline_directory("WebKit Linux Trus ty"), "/mock-checkout/third_party/WebKit/LayoutTests/platform/linux") 259 self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.10") ,
239 self.assertMultiLineEqual(command._baseline_directory("WebKit Linux"), " /mock-checkout/third_party/WebKit/LayoutTests/platform/linux-precise") 260 "/mock-checkout/third_party/WebKit/LayoutTests /platform/mac-mac10.10")
261 self.assertMultiLineEqual(command._baseline_directory("WebKit Linux Trus ty"),
262 "/mock-checkout/third_party/WebKit/LayoutTests /platform/linux")
263 self.assertMultiLineEqual(command._baseline_directory("WebKit Linux"),
264 "/mock-checkout/third_party/WebKit/LayoutTests /platform/linux-precise")
240 265
241 def test_rebaseline_updates_expectations_file_noop(self): 266 def test_rebaseline_updates_expectations_file_noop(self):
242 self._zero_out_test_expectations() 267 self._zero_out_test_expectations()
243 self._write(self.mac_expectations_path, """Bug(B) [ Mac Linux Win7 Debug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ] 268 self._write(self.mac_expectations_path, """Bug(B) [ Mac Linux Win7 Debug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]
244 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] 269 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]
245 """) 270 """)
246 self._write("fast/dom/Window/window-postmessage-clone-really-deep-array. html", "Dummy test contents") 271 self._write("fast/dom/Window/window-postmessage-clone-really-deep-array. html", "Dummy test contents")
247 self._write("fast/css/large-list-of-rules-crash.html", "Dummy test conte nts") 272 self._write("fast/css/large-list-of-rules-crash.html", "Dummy test conte nts")
248 self._write("userscripts/another-test.html", "Dummy test contents") 273 self._write("userscripts/another-test.html", "Dummy test contents")
249 274
250 self.options.suffixes = "png,wav,txt" 275 self.options.suffixes = "png,wav,txt"
251 self.command._rebaseline_test_and_update_expectations(self.options) 276 self.command._rebaseline_test_and_update_expectations(self.options)
252 277
253 self.assertItemsEqual(self.tool.web.urls_fetched, 278 self.assertItemsEqual(self.tool.web.urls_fetched,
254 [self.WEB_PREFIX + '/userscripts/another-test-actual.png', 279 [self.WEB_PREFIX + '/userscripts/another-test-actu al.png',
255 self.WEB_PREFIX + '/userscripts/another-test-actual.wav', 280 self.WEB_PREFIX + '/userscripts/another-test-actu al.wav',
256 self.WEB_PREFIX + '/userscripts/another-test-actual.txt']) 281 self.WEB_PREFIX + '/userscripts/another-test-actu al.txt'])
257 new_expectations = self._read(self.mac_expectations_path) 282 new_expectations = self._read(self.mac_expectations_path)
258 self.assertMultiLineEqual(new_expectations, """Bug(B) [ Mac Linux Win7 D ebug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ] 283 self.assertMultiLineEqual(new_expectations, """Bug(B) [ Mac Linux Win7 D ebug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]
259 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] 284 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]
260 """) 285 """)
261 286
262 def test_rebaseline_test(self): 287 def test_rebaseline_test(self):
263 self.command._rebaseline_test("WebKit Linux Trusty", "userscripts/anothe r-test.html", "txt", self.WEB_PREFIX) 288 self.command._rebaseline_test("WebKit Linux Trusty", "userscripts/anothe r-test.html", "txt", self.WEB_PREFIX)
264 self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/u serscripts/another-test-actual.txt']) 289 self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/u serscripts/another-test-actual.txt'])
265 290
266 def test_rebaseline_test_with_results_directory(self): 291 def test_rebaseline_test_with_results_directory(self):
267 self._write("userscripts/another-test.html", "test data") 292 self._write("userscripts/another-test.html", "test data")
268 self._write(self.mac_expectations_path, "Bug(x) [ Mac ] userscripts/anot her-test.html [ Failure ]\nbug(z) [ Linux ] userscripts/another-test.html [ Fail ure ]\n") 293 self._write(self.mac_expectations_path,
294 "Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\nb ug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n")
269 self.options.results_directory = '/tmp' 295 self.options.results_directory = '/tmp'
270 self.command._rebaseline_test_and_update_expectations(self.options) 296 self.command._rebaseline_test_and_update_expectations(self.options)
271 self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscri pts/another-test-actual.txt']) 297 self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscri pts/another-test-actual.txt'])
272 298
273 def test_rebaseline_reftest(self): 299 def test_rebaseline_reftest(self):
274 self._write("userscripts/another-test.html", "test data") 300 self._write("userscripts/another-test.html", "test data")
275 self._write("userscripts/another-test-expected.html", "generic result") 301 self._write("userscripts/another-test-expected.html", "generic result")
276 OutputCapture().assert_outputs(self, self.command._rebaseline_test_and_u pdate_expectations, args=[self.options], 302 OutputCapture().assert_outputs(self, self.command._rebaseline_test_and_u pdate_expectations, args=[self.options],
277 expected_logs="Cannot rebaseline reftest: userscripts/another-test.h tml\n") 303 expected_logs="Cannot rebaseline reftest: userscripts/another-test.html\n")
278 self.assertDictEqual(self.command._scm_changes, {'add': [], 'remove-line s': [], "delete": []}) 304 self.assertDictEqual(self.command._scm_changes, {'add': [], 'remove-line s': [], "delete": []})
279 305
280 def test_rebaseline_test_and_print_scm_changes(self): 306 def test_rebaseline_test_and_print_scm_changes(self):
281 self.command._print_scm_changes = True 307 self.command._print_scm_changes = True
282 self.command._scm_changes = {'add': [], 'delete': []} 308 self.command._scm_changes = {'add': [], 'delete': []}
283 self.tool._scm.exists = lambda x: False 309 self.tool._scm.exists = lambda x: False
284 310
285 self.command._rebaseline_test("WebKit Linux Trusty", "userscripts/anothe r-test.html", "txt", None) 311 self.command._rebaseline_test("WebKit Linux Trusty", "userscripts/anothe r-test.html", "txt", None)
286 312
287 self.assertDictEqual(self.command._scm_changes, {'add': ['/mock-checkout /third_party/WebKit/LayoutTests/platform/linux/userscripts/another-test-expected .txt'], 'delete': []}) 313 self.assertDictEqual(self.command._scm_changes, {
314 'add': ['/mock-checkout/third_party/WebKit/LayoutTe sts/platform/linux/userscripts/another-test-expected.txt'], 'delete': []})
288 315
289 def test_rebaseline_test_internal_with_port_that_lacks_buildbot(self): 316 def test_rebaseline_test_internal_with_port_that_lacks_buildbot(self):
290 self.tool.executive = MockExecutive2() 317 self.tool.executive = MockExecutive2()
291 318
292 # 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. 319 # FIXME: it's confusing that this is the test- port, and not the regular
320 # win port. Really all of the tests should be using the test ports.
293 port = self.tool.port_factory.get('test-win-win7') 321 port = self.tool.port_factory.get('test-win-win7')
294 self._write(port._filesystem.join(port.layout_tests_dir(), 'platform/tes t-win-win10/failures/expected/image-expected.txt'), 'original win10 result') 322 self._write(port._filesystem.join(port.layout_tests_dir(),
323 'platform/test-win-win10/failures/expe cted/image-expected.txt'), 'original win10 result')
295 324
296 old_exact_matches = builders._exact_matches 325 old_exact_matches = builders._exact_matches
297 oc = OutputCapture() 326 oc = OutputCapture()
298 try: 327 try:
299 builders._exact_matches = { 328 builders._exact_matches = {
300 "MOCK Win7": {"port_name": "test-win-win7"}, 329 "MOCK Win7": {"port_name": "test-win-win7"},
301 "MOCK Win10": {"port_name": "test-win-win10"}, 330 "MOCK Win10": {"port_name": "test-win-win10"},
302 } 331 }
303 332
304 options = MockOptions(optimize=True, builder="MOCK Win10", suffixes= "txt", 333 options = MockOptions(optimize=True, builder="MOCK Win10", suffixes= "txt",
305 verbose=True, test="failures/expected/image.html", results_direc tory=None) 334 verbose=True, test="failures/expected/image.ht ml", results_directory=None)
306 335
307 oc.capture_output() 336 oc.capture_output()
308 self.command.execute(options, [], self.tool) 337 self.command.execute(options, [], self.tool)
309 finally: 338 finally:
310 out, _, _ = oc.restore_output() 339 out, _, _ = oc.restore_output()
311 builders._exact_matches = old_exact_matches 340 builders._exact_matches = old_exact_matches
312 341
313 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') 342 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(
314 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(p ort.layout_tests_dir(), 'platform/test-win-win7/failures/expected/image-expected .txt'))) 343 ), 'platform/test-win-win10/failures/expected/image-expected.txt')), 'MO CK Web result, convert 404 to None=True')
315 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [{"test": "f ailures/expected/image.html", "builder": "MOCK Win10"}], "delete": []}\n') 344 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
345 port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/i mage-expected.txt')))
346 self.assertMultiLineEqual(
347 out, '{"add": [], "remove-lines": [{"test": "failures/expected/image .html", "builder": "MOCK Win10"}], "delete": []}\n')
316 348
317 349
318 class TestAbstractParallelRebaselineCommand(_BaseTestCase): 350 class TestAbstractParallelRebaselineCommand(_BaseTestCase):
319 command_constructor = AbstractParallelRebaselineCommand 351 command_constructor = AbstractParallelRebaselineCommand
320 352
321 def test_builders_to_fetch_from(self): 353 def test_builders_to_fetch_from(self):
322 old_exact_matches = builders._exact_matches 354 old_exact_matches = builders._exact_matches
323 try: 355 try:
324 builders._exact_matches = { 356 builders._exact_matches = {
325 "MOCK Win10": {"port_name": "test-win-win10"}, 357 "MOCK Win10": {"port_name": "test-win-win10"},
326 "MOCK Win7": {"port_name": "test-win-win7"}, 358 "MOCK Win7": {"port_name": "test-win-win7"},
327 "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7"}, 359 "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7"},
328 "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7"}, 360 "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7"},
329 } 361 }
330 362
331 builders_to_fetch = self.command._builders_to_fetch_from(["MOCK Win1 0", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK Win7"]) 363 builders_to_fetch = self.command._builders_to_fetch_from(
364 ["MOCK Win10", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK Win7"])
332 self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"]) 365 self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"])
333 finally: 366 finally:
334 builders._exact_matches = old_exact_matches 367 builders._exact_matches = old_exact_matches
335 368
336 369
337 class TestRebaselineJson(_BaseTestCase): 370 class TestRebaselineJson(_BaseTestCase):
338 command_constructor = RebaselineJson 371 command_constructor = RebaselineJson
339 372
340 def setUp(self): 373 def setUp(self):
341 super(TestRebaselineJson, self).setUp() 374 super(TestRebaselineJson, self).setUp()
(...skipping 24 matching lines...) Expand all
366 });""") 399 });""")
367 return self.command._builder_data 400 return self.command._builder_data
368 401
369 self.command.builder_data = builder_data 402 self.command.builder_data = builder_data
370 403
371 options = MockOptions(optimize=True, verbose=True, results_directory=Non e) 404 options = MockOptions(optimize=True, verbose=True, results_directory=Non e)
372 405
373 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n") 406 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n")
374 self._write("userscripts/first-test.html", "Dummy test contents") 407 self._write("userscripts/first-test.html", "Dummy test contents")
375 408
376 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOC K builder": ["txt", "png"]}}) 409 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK builder": ["txt", "png"]}})
377 410
378 self.assertEqual(self.tool.executive.calls, []) 411 self.assertEqual(self.tool.executive.calls, [])
379 412
380 def test_rebaseline_all(self): 413 def test_rebaseline_all(self):
381 self._setup_mock_builder_data() 414 self._setup_mock_builder_data()
382 415
383 options = MockOptions(optimize=True, verbose=True, results_directory=Non e) 416 options = MockOptions(optimize=True, verbose=True, results_directory=Non e)
384 self._write("userscripts/first-test.html", "Dummy test contents") 417 self._write("userscripts/first-test.html", "Dummy test contents")
385 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOC K builder": ["txt", "png"]}}) 418 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK builder": ["txt", "png"]}})
386 419
387 # Note that we have one run_in_parallel() call followed by a run_command () 420 # Note that we have one run_in_parallel() call followed by a run_command ()
388 self.assertEqual(self.tool.executive.calls, 421 self.assertEqual(self.tool.executive.calls,
389 [[['python', 'echo', 'copy-existing-baselines-internal', '--suffixes ', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.htm l', '--verbose']], 422 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/f irst-test.html', '--verbose']],
390 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt, png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--v erbose']], 423 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder',
391 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suf fixes', 'txt,png', 'userscripts/first-test.html', '--verbose']]]) 424 'MOCK builder', '--test', 'userscripts/first-test.ht ml', '--verbose']],
425 [['python', 'echo', 'optimize-baselines', '--no-mod ify-scm', '--suffixes', 'txt,png', 'userscripts/first-test.html', '--verbose']]] )
392 426
393 def test_rebaseline_debug(self): 427 def test_rebaseline_debug(self):
394 self._setup_mock_builder_data() 428 self._setup_mock_builder_data()
395 429
396 options = MockOptions(optimize=True, verbose=True, results_directory=Non e) 430 options = MockOptions(optimize=True, verbose=True, results_directory=Non e)
397 self._write("userscripts/first-test.html", "Dummy test contents") 431 self._write("userscripts/first-test.html", "Dummy test contents")
398 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOC K builder (Debug)": ["txt", "png"]}}) 432 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK builder (Debug)": ["txt", "png"]}})
399 433
400 # Note that we have one run_in_parallel() call followed by a run_command () 434 # Note that we have one run_in_parallel() call followed by a run_command ()
401 self.assertEqual(self.tool.executive.calls, 435 self.assertEqual(self.tool.executive.calls,
402 [[['python', 'echo', 'copy-existing-baselines-internal', '--suffixes ', 'txt,png', '--builder', 'MOCK builder (Debug)', '--test', 'userscripts/first- test.html', '--verbose']], 436 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK builder (Debug)', '--test', 'users cripts/first-test.html', '--verbose']],
403 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt, png', '--builder', 'MOCK builder (Debug)', '--test', 'userscripts/first-test.htm l', '--verbose']], 437 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder',
404 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suf fixes', 'txt,png', 'userscripts/first-test.html', '--verbose']]]) 438 'MOCK builder (Debug)', '--test', 'userscripts/first -test.html', '--verbose']],
439 [['python', 'echo', 'optimize-baselines', '--no-mod ify-scm', '--suffixes', 'txt,png', 'userscripts/first-test.html', '--verbose']]] )
405 440
406 def test_no_optimize(self): 441 def test_no_optimize(self):
407 self._setup_mock_builder_data() 442 self._setup_mock_builder_data()
408 443
409 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 444 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
410 self._write("userscripts/first-test.html", "Dummy test contents") 445 self._write("userscripts/first-test.html", "Dummy test contents")
411 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOC K builder (Debug)": ["txt", "png"]}}) 446 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK builder (Debug)": ["txt", "png"]}})
412 447
413 # Note that we have only one run_in_parallel() call 448 # Note that we have only one run_in_parallel() call
414 self.assertEqual(self.tool.executive.calls, 449 self.assertEqual(self.tool.executive.calls,
415 [[['python', 'echo', 'copy-existing-baselines-internal', '--suffixes ', 'txt,png', '--builder', 'MOCK builder (Debug)', '--test', 'userscripts/first- test.html', '--verbose']], 450 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK builder (Debug)', '--test', 'users cripts/first-test.html', '--verbose']],
416 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt, png', '--builder', 'MOCK builder (Debug)', '--test', 'userscripts/first-test.htm l', '--verbose']]]) 451 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK builder (Debug)', '--test', 'userscripts/f irst-test.html', '--verbose']]])
417 452
418 def test_results_directory(self): 453 def test_results_directory(self):
419 self._setup_mock_builder_data() 454 self._setup_mock_builder_data()
420 455
421 options = MockOptions(optimize=False, verbose=True, results_directory='/ tmp') 456 options = MockOptions(optimize=False, verbose=True, results_directory='/ tmp')
422 self._write("userscripts/first-test.html", "Dummy test contents") 457 self._write("userscripts/first-test.html", "Dummy test contents")
423 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOC K builder": ["txt", "png"]}}) 458 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK builder": ["txt", "png"]}})
424 459
425 # Note that we have only one run_in_parallel() call 460 # Note that we have only one run_in_parallel() call
426 self.assertEqual(self.tool.executive.calls, 461 self.assertEqual(self.tool.executive.calls,
427 [[['python', 'echo', 'copy-existing-baselines-internal', '--suffixes ', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.htm l', '--results-directory', '/tmp', '--verbose']], 462 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/f irst-test.html', '--results-directory', '/tmp', '--verbose']],
428 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt, png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--r esults-directory', '/tmp', '--verbose']]]) 463 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-tes t.html', '--results-directory', '/tmp', '--verbose']]])
464
429 465
430 class TestRebaselineJsonUpdatesExpectationsFiles(_BaseTestCase): 466 class TestRebaselineJsonUpdatesExpectationsFiles(_BaseTestCase):
431 command_constructor = RebaselineJson 467 command_constructor = RebaselineJson
432 468
433 def setUp(self): 469 def setUp(self):
434 super(TestRebaselineJsonUpdatesExpectationsFiles, self).setUp() 470 super(TestRebaselineJsonUpdatesExpectationsFiles, self).setUp()
435 self.tool.executive = MockExecutive2() 471 self.tool.executive = MockExecutive2()
436 472
437 def mock_run_command(args, 473 def mock_run_command(args,
438 cwd=None, 474 cwd=None,
439 input=None, 475 input=None,
440 error_handler=None, 476 error_handler=None,
441 return_exit_code=False, 477 return_exit_code=False,
442 return_stderr=True, 478 return_stderr=True,
443 decode_output=False, 479 decode_output=False,
444 env=None): 480 env=None):
445 return '{"add": [], "remove-lines": [{"test": "userscripts/first-tes t.html", "builder": "WebKit Mac10.11"}]}\n' 481 return '{"add": [], "remove-lines": [{"test": "userscripts/first-tes t.html", "builder": "WebKit Mac10.11"}]}\n'
446 self.tool.executive.run_command = mock_run_command 482 self.tool.executive.run_command = mock_run_command
447 483
448 def test_rebaseline_updates_expectations_file(self): 484 def test_rebaseline_updates_expectations_file(self):
449 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 485 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
450 486
451 self._write(self.mac_expectations_path, "Bug(x) [ Mac ] userscripts/firs t-test.html [ Failure ]\nbug(z) [ Linux ] userscripts/first-test.html [ Failure ]\n") 487 self._write(self.mac_expectations_path,
488 "Bug(x) [ Mac ] userscripts/first-test.html [ Failure ]\nbug (z) [ Linux ] userscripts/first-test.html [ Failure ]\n")
452 self._write("userscripts/first-test.html", "Dummy test contents") 489 self._write("userscripts/first-test.html", "Dummy test contents")
453 self._setup_mock_builder_data() 490 self._setup_mock_builder_data()
454 491
455 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web Kit Mac10.11": ["txt", "png"]}}) 492 self.command._rebaseline(options, {"userscripts/first-test.html": {"WebK it Mac10.11": ["txt", "png"]}})
456 493
457 new_expectations = self._read(self.mac_expectations_path) 494 new_expectations = self._read(self.mac_expectations_path)
458 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Mac10.10 Mac10.9 R etina ] userscripts/first-test.html [ Failure ]\nbug(z) [ Linux ] userscripts/fi rst-test.html [ Failure ]\n") 495 self.assertMultiLineEqual(
496 new_expectations, "Bug(x) [ Mac10.10 Mac10.9 Retina ] userscripts/fi rst-test.html [ Failure ]\nbug(z) [ Linux ] userscripts/first-test.html [ Failur e ]\n")
459 497
460 def test_rebaseline_updates_expectations_file_all_platforms(self): 498 def test_rebaseline_updates_expectations_file_all_platforms(self):
461 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 499 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
462 500
463 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n") 501 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n")
464 self._write("userscripts/first-test.html", "Dummy test contents") 502 self._write("userscripts/first-test.html", "Dummy test contents")
465 self._setup_mock_builder_data() 503 self._setup_mock_builder_data()
466 504
467 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web Kit Mac10.11": ["txt", "png"]}}) 505 self.command._rebaseline(options, {"userscripts/first-test.html": {"WebK it Mac10.11": ["txt", "png"]}})
468 506
469 new_expectations = self._read(self.mac_expectations_path) 507 new_expectations = self._read(self.mac_expectations_path)
470 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Android Linux Mac1 0.10 Mac10.9 Retina Win ] userscripts/first-test.html [ Failure ]\n") 508 self.assertMultiLineEqual(
509 new_expectations, "Bug(x) [ Android Linux Mac10.10 Mac10.9 Retina Wi n ] userscripts/first-test.html [ Failure ]\n")
471 510
472 def test_rebaseline_handles_platform_skips(self): 511 def test_rebaseline_handles_platform_skips(self):
473 # This test is just like test_rebaseline_updates_expectations_file_all_p latforms(), 512 # This test is just like test_rebaseline_updates_expectations_file_all_p latforms(),
474 # except that if a particular port happens to SKIP a test in an override s file, 513 # except that if a particular port happens to SKIP a test in an override s file,
475 # we count that as passing, and do not think that we still need to rebas eline it. 514 # we count that as passing, and do not think that we still need to rebas eline it.
476 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 515 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
477 516
478 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n") 517 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n")
479 self._write("NeverFixTests", "Bug(y) [ Android ] userscripts [ WontFix ] \n") 518 self._write("NeverFixTests", "Bug(y) [ Android ] userscripts [ WontFix ] \n")
480 self._write("userscripts/first-test.html", "Dummy test contents") 519 self._write("userscripts/first-test.html", "Dummy test contents")
481 self._setup_mock_builder_data() 520 self._setup_mock_builder_data()
482 521
483 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web Kit Mac10.11": ["txt", "png"]}}) 522 self.command._rebaseline(options, {"userscripts/first-test.html": {"WebK it Mac10.11": ["txt", "png"]}})
484 523
485 new_expectations = self._read(self.mac_expectations_path) 524 new_expectations = self._read(self.mac_expectations_path)
486 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux Mac10.10 Mac 10.9 Retina Win ] userscripts/first-test.html [ Failure ]\n") 525 self.assertMultiLineEqual(
526 new_expectations, "Bug(x) [ Linux Mac10.10 Mac10.9 Retina Win ] user scripts/first-test.html [ Failure ]\n")
487 527
488 def test_rebaseline_handles_skips_in_file(self): 528 def test_rebaseline_handles_skips_in_file(self):
489 # This test is like test_Rebaseline_handles_platform_skips, except that the 529 # This test is like test_Rebaseline_handles_platform_skips, except that the
490 # Skip is in the same (generic) file rather than a platform file. In thi s case, 530 # Skip is in the same (generic) file rather than a platform file. In thi s case,
491 # the Skip line should be left unmodified. Note that the first line is n ow 531 # the Skip line should be left unmodified. Note that the first line is n ow
492 # qualified as "[Linux Mac Win]"; if it was unqualified, it would confli ct with 532 # qualified as "[Linux Mac Win]"; if it was unqualified, it would confli ct with
493 # the second line. 533 # the second line.
494 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 534 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
495 535
496 self._write(self.mac_expectations_path, 536 self._write(self.mac_expectations_path,
497 ("Bug(x) [ Linux Mac Win ] userscripts/first-test.html [ Failure ]\n " 537 ("Bug(x) [ Linux Mac Win ] userscripts/first-test.html [ Fai lure ]\n"
498 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n")) 538 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n" ))
499 self._write("userscripts/first-test.html", "Dummy test contents") 539 self._write("userscripts/first-test.html", "Dummy test contents")
500 self._setup_mock_builder_data() 540 self._setup_mock_builder_data()
501 541
502 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web Kit Mac10.11": ["txt", "png"]}}) 542 self.command._rebaseline(options, {"userscripts/first-test.html": {"WebK it Mac10.11": ["txt", "png"]}})
503 543
504 new_expectations = self._read(self.mac_expectations_path) 544 new_expectations = self._read(self.mac_expectations_path)
505 self.assertMultiLineEqual( 545 self.assertMultiLineEqual(
506 new_expectations, 546 new_expectations,
507 ("Bug(x) [ Linux Mac10.10 Mac10.9 Retina Win ] userscripts/first-tes t.html [ Failure ]\n" 547 ("Bug(x) [ Linux Mac10.10 Mac10.9 Retina Win ] userscripts/first-tes t.html [ Failure ]\n"
508 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n")) 548 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n"))
509 549
510 def test_rebaseline_handles_smoke_tests(self): 550 def test_rebaseline_handles_smoke_tests(self):
511 # This test is just like test_rebaseline_handles_platform_skips, except that we check for 551 # This test is just like test_rebaseline_handles_platform_skips, except that we check for
512 # a test not being in the SmokeTests file, instead of using overrides fi les. 552 # a test not being in the SmokeTests file, instead of using overrides fi les.
513 # If a test is not part of the smoke tests, we count that as passing on ports that only 553 # If a test is not part of the smoke tests, we count that as passing on ports that only
514 # run smoke tests, and do not think that we still need to rebaseline it. 554 # run smoke tests, and do not think that we still need to rebaseline it.
515 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 555 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
516 556
517 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n") 557 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n")
518 self._write("SmokeTests", "fast/html/article-element.html") 558 self._write("SmokeTests", "fast/html/article-element.html")
519 self._write("userscripts/first-test.html", "Dummy test contents") 559 self._write("userscripts/first-test.html", "Dummy test contents")
520 self._setup_mock_builder_data() 560 self._setup_mock_builder_data()
521 561
522 self.command._rebaseline(options, {"userscripts/first-test.html": {"Web Kit Mac10.11": ["txt", "png"]}}) 562 self.command._rebaseline(options, {"userscripts/first-test.html": {"WebK it Mac10.11": ["txt", "png"]}})
523 563
524 new_expectations = self._read(self.mac_expectations_path) 564 new_expectations = self._read(self.mac_expectations_path)
525 self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux Mac10.10 Mac 10.9 Retina Win ] userscripts/first-test.html [ Failure ]\n") 565 self.assertMultiLineEqual(
566 new_expectations, "Bug(x) [ Linux Mac10.10 Mac10.9 Retina Win ] user scripts/first-test.html [ Failure ]\n")
526 567
527 568
528 class TestRebaseline(_BaseTestCase): 569 class TestRebaseline(_BaseTestCase):
529 # This command shares most of its logic with RebaselineJson, so these tests just test what is different. 570 # This command shares most of its logic with RebaselineJson, so these tests just test what is different.
530 571
531 command_constructor = Rebaseline # AKA webkit-patch rebaseline 572 command_constructor = Rebaseline # AKA webkit-patch rebaseline
532 573
533 def test_rebaseline(self): 574 def test_rebaseline(self):
534 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder ')] 575 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder ')]
535 576
536 self._write("userscripts/first-test.html", "test data") 577 self._write("userscripts/first-test.html", "test data")
537 578
538 self._zero_out_test_expectations() 579 self._zero_out_test_expectations()
539 self._setup_mock_builder_data() 580 self._setup_mock_builder_data()
540 581
541 old_exact_matches = builders._exact_matches 582 old_exact_matches = builders._exact_matches
542 try: 583 try:
543 builders._exact_matches = { 584 builders._exact_matches = {
544 "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])}, 585 "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
545 } 586 }
546 self.command.execute(MockOptions(results_directory=False, optimize=F alse, builders=None, suffixes="txt,png", verbose=True), ['userscripts/first-test .html'], self.tool) 587 self.command.execute(MockOptions(results_directory=False, optimize=F alse, builders=None,
588 suffixes="txt,png", verbose=True), ['userscripts/first-test.html'], self.tool)
547 finally: 589 finally:
548 builders._exact_matches = old_exact_matches 590 builders._exact_matches = old_exact_matches
549 591
550 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t ool.executive.calls) 592 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t ool.executive.calls)
551 self.assertEqual(calls, 593 self.assertEqual(calls,
552 [[['python', 'echo', 'copy-existing-baselines-internal', '--suffixes ', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.htm l', '--verbose']], 594 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/f irst-test.html', '--verbose']],
553 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt, png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--v erbose']]]) 595 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-tes t.html', '--verbose']]])
554 596
555 def test_rebaseline_directory(self): 597 def test_rebaseline_directory(self):
556 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder ')] 598 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder ')]
557 599
558 self._write("userscripts/first-test.html", "test data") 600 self._write("userscripts/first-test.html", "test data")
559 self._write("userscripts/second-test.html", "test data") 601 self._write("userscripts/second-test.html", "test data")
560 602
561 self._setup_mock_builder_data() 603 self._setup_mock_builder_data()
562 604
563 old_exact_matches = builders._exact_matches 605 old_exact_matches = builders._exact_matches
564 try: 606 try:
565 builders._exact_matches = { 607 builders._exact_matches = {
566 "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])}, 608 "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
567 } 609 }
568 self.command.execute(MockOptions(results_directory=False, optimize=F alse, builders=None, suffixes="txt,png", verbose=True), ['userscripts'], self.to ol) 610 self.command.execute(MockOptions(results_directory=False, optimize=F alse, builders=None,
611 suffixes="txt,png", verbose=True), ['userscripts'], self.tool)
569 finally: 612 finally:
570 builders._exact_matches = old_exact_matches 613 builders._exact_matches = old_exact_matches
571 614
572 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t ool.executive.calls) 615 calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.t ool.executive.calls)
573 self.assertEqual(calls, 616 self.assertEqual(calls,
574 [[['python', 'echo', 'copy-existing-baselines-internal', '--suffixes ', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.htm l', '--verbose'], 617 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/f irst-test.html', '--verbose'],
575 ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes ', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/second-test.ht ml', '--verbose']], 618 ['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/s econd-test.html', '--verbose']],
576 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt, png', '--builder', 'MOCK builder', '--test', 'userscripts/first-test.html', '--v erbose'], 619 [['python', 'echo', 'rebaseline-test-internal', '-- suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first- test.html', '--verbose'],
577 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt, png', '--builder', 'MOCK builder', '--test', 'userscripts/second-test.html', '-- verbose']]]) 620 ['python', 'echo', 'rebaseline-test-internal', '-- suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/second -test.html', '--verbose']]])
578 621
579 622
580 class MockLineRemovingExecutive(MockExecutive): 623 class MockLineRemovingExecutive(MockExecutive):
624
581 def run_in_parallel(self, commands): 625 def run_in_parallel(self, commands):
582 assert len(commands) 626 assert len(commands)
583 627
584 num_previous_calls = len(self.calls) 628 num_previous_calls = len(self.calls)
585 command_outputs = [] 629 command_outputs = []
586 for cmd_line, cwd in commands: 630 for cmd_line, cwd in commands:
587 out = self.run_command(cmd_line, cwd=cwd) 631 out = self.run_command(cmd_line, cwd=cwd)
588 if 'rebaseline-test-internal' in cmd_line: 632 if 'rebaseline-test-internal' in cmd_line:
589 out = '{"add": [], "remove-lines": [{"test": "%s", "builder": "% s"}], "delete": []}\n' % (cmd_line[8], cmd_line[6]) 633 out = '{"add": [], "remove-lines": [{"test": "%s", "builder": "% s"}], "delete": []}\n' % (cmd_line[8], cmd_line[6])
590 command_outputs.append([0, out, '']) 634 command_outputs.append([0, out, ''])
591 635
592 new_calls = self.calls[num_previous_calls:] 636 new_calls = self.calls[num_previous_calls:]
593 self.calls = self.calls[:num_previous_calls] 637 self.calls = self.calls[:num_previous_calls]
594 self.calls.append(new_calls) 638 self.calls.append(new_calls)
595 return command_outputs 639 return command_outputs
596 640
597 641
598 class TestRebaselineExpectations(_BaseTestCase): 642 class TestRebaselineExpectations(_BaseTestCase):
599 command_constructor = RebaselineExpectations 643 command_constructor = RebaselineExpectations
600 644
601 def setUp(self): 645 def setUp(self):
602 super(TestRebaselineExpectations, self).setUp() 646 super(TestRebaselineExpectations, self).setUp()
603 self.options = MockOptions(optimize=False, builders=None, suffixes=['txt '], verbose=False, platform=None, results_directory=None) 647 self.options = MockOptions(optimize=False, builders=None, suffixes=[
648 'txt'], verbose=False, platform=None, results _directory=None)
604 649
605 def _write_test_file(self, port, path, contents): 650 def _write_test_file(self, port, path, contents):
606 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path) 651 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path)
607 self.tool.filesystem.write_text_file(abs_path, contents) 652 self.tool.filesystem.write_text_file(abs_path, contents)
608 653
609 def _setup_test_port(self): 654 def _setup_test_port(self):
610 test_port = self.tool.port_factory.get('test') 655 test_port = self.tool.port_factory.get('test')
611 original_get = self.tool.port_factory.get 656 original_get = self.tool.port_factory.get
612 657
613 def get_test_port(port_name=None, options=None, **kwargs): 658 def get_test_port(port_name=None, options=None, **kwargs):
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers" : set(["mock-specifier"])}, 704 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers" : set(["mock-specifier"])},
660 } 705 }
661 self.command.execute(self.options, [], self.tool) 706 self.command.execute(self.options, [], self.tool)
662 finally: 707 finally:
663 builders._exact_matches = old_exact_matches 708 builders._exact_matches = old_exact_matches
664 709
665 # FIXME: change this to use the test- ports. 710 # FIXME: change this to use the test- ports.
666 calls = filter(lambda x: x != ['qmake', '-v'], self.tool.executive.calls ) 711 calls = filter(lambda x: x != ['qmake', '-v'], self.tool.executive.calls )
667 self.assertEqual(self.tool.executive.calls, [ 712 self.assertEqual(self.tool.executive.calls, [
668 [ 713 [
669 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt', '--builder', 'MOCK Mac10.10', '--test', 'userscripts/another-test.ht ml'], 714 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt',
670 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt', '--builder', 'MOCK Mac10.11', '--test', 'userscripts/another-test.ht ml'], 715 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/another -test.html'],
671 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'png', '--builder', 'MOCK Mac10.10', '--test', 'userscripts/images.svg'], 716 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt',
672 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'png', '--builder', 'MOCK Mac10.11', '--test', 'userscripts/images.svg'], 717 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/another -test.html'],
718 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'png',
719 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/images. svg'],
720 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'png',
721 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/images. svg'],
673 ], 722 ],
674 [ 723 [
675 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t', '--builder', 'MOCK Mac10.10', '--test', 'userscripts/another-test.html'], 724 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t',
676 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t', '--builder', 'MOCK Mac10.11', '--test', 'userscripts/another-test.html'], 725 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/another -test.html'],
677 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn g', '--builder', 'MOCK Mac10.10', '--test', 'userscripts/images.svg'], 726 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t',
678 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn g', '--builder', 'MOCK Mac10.11', '--test', 'userscripts/images.svg'], 727 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/another -test.html'],
728 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn g',
729 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/images. svg'],
730 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn g',
731 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/images. svg'],
679 ], 732 ],
680 ]) 733 ])
681 734
682 def test_rebaseline_expectations_noop(self): 735 def test_rebaseline_expectations_noop(self):
683 self._zero_out_test_expectations() 736 self._zero_out_test_expectations()
684 737
685 oc = OutputCapture() 738 oc = OutputCapture()
686 try: 739 try:
687 oc.capture_output() 740 oc.capture_output()
688 self.command.execute(self.options, [], self.tool) 741 self.command.execute(self.options, [], self.tool)
689 finally: 742 finally:
690 _, _, logs = oc.restore_output() 743 _, _, logs = oc.restore_output()
691 self.assertEqual(self.tool.filesystem.written_files, {}) 744 self.assertEqual(self.tool.filesystem.written_files, {})
692 self.assertEqual(logs, 'Did not find any tests marked Rebaseline.\n' ) 745 self.assertEqual(logs, 'Did not find any tests marked Rebaseline.\n' )
693 746
694 def disabled_test_overrides_are_included_correctly(self): 747 def disabled_test_overrides_are_included_correctly(self):
695 # This tests that the any tests marked as REBASELINE in the overrides ar e found, but 748 # This tests that the any tests marked as REBASELINE in the overrides ar e found, but
696 # that the overrides do not get written into the main file. 749 # that the overrides do not get written into the main file.
697 self._zero_out_test_expectations() 750 self._zero_out_test_expectations()
698 751
699 self._write(self.mac_expectations_path, '') 752 self._write(self.mac_expectations_path, '')
700 self.mac_port.expectations_dict = lambda: { 753 self.mac_port.expectations_dict = lambda: {
701 self.mac_expectations_path: '', 754 self.mac_expectations_path: '',
702 'overrides': ('Bug(x) userscripts/another-test.html [ Failure Rebase line ]\n' 755 'overrides': ('Bug(x) userscripts/another-test.html [ Failure Rebase line ]\n'
703 'Bug(y) userscripts/test.html [ Crash ]\n')} 756 'Bug(y) userscripts/test.html [ Crash ]\n')}
704 self._write('/userscripts/another-test.html', '') 757 self._write('/userscripts/another-test.html', '')
705 758
706 self.assertDictEqual(self.command._tests_to_rebaseline(self.mac_port), { 'userscripts/another-test.html': set(['png', 'txt', 'wav'])}) 759 self.assertDictEqual(self.command._tests_to_rebaseline(self.mac_port), {
760 'userscripts/another-test.html': set(['png', 'txt', 'wav'])})
707 self.assertEqual(self._read(self.mac_expectations_path), '') 761 self.assertEqual(self._read(self.mac_expectations_path), '')
708 762
709 def test_rebaseline_without_other_expectations(self): 763 def test_rebaseline_without_other_expectations(self):
710 self._write("userscripts/another-test.html", "Dummy test contents") 764 self._write("userscripts/another-test.html", "Dummy test contents")
711 self._write(self.mac_expectations_path, "Bug(x) userscripts/another-test .html [ Rebaseline ]\n") 765 self._write(self.mac_expectations_path, "Bug(x) userscripts/another-test .html [ Rebaseline ]\n")
712 self.assertDictEqual(self.command._tests_to_rebaseline(self.mac_port), { 'userscripts/another-test.html': ('png', 'wav', 'txt')}) 766 self.assertDictEqual(self.command._tests_to_rebaseline(self.mac_port), {
767 'userscripts/another-test.html': ('png', 'wav', 'tx t')})
713 768
714 def test_rebaseline_test_passes_everywhere(self): 769 def test_rebaseline_test_passes_everywhere(self):
715 test_port = self._setup_test_port() 770 test_port = self._setup_test_port()
716 771
717 old_builder_data = self.command.builder_data 772 old_builder_data = self.command.builder_data
718 773
719 def builder_data(): 774 def builder_data():
720 self.command._builder_data['MOCK Mac10.10'] = self.command._builder_ data['MOCK Mac10.11'] = LayoutTestResults.results_from_string("""ADD_RESULTS({ 775 self.command._builder_data['MOCK Mac10.10'] = self.command._builder_ data['MOCK Mac10.11'] = LayoutTestResults.results_from_string("""ADD_RESULTS({
721 "tests": { 776 "tests": {
722 "fast": { 777 "fast": {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 809
755 # The mac ports should both be removed since they're the only ones i n builders._exact_matches. 810 # The mac ports should both be removed since they're the only ones i n builders._exact_matches.
756 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """ 811 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """
757 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ Rebaseline ] 812 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ Rebaseline ]
758 """) 813 """)
759 finally: 814 finally:
760 builders._exact_matches = old_exact_matches 815 builders._exact_matches = old_exact_matches
761 816
762 817
763 class _FakeOptimizer(BaselineOptimizer): 818 class _FakeOptimizer(BaselineOptimizer):
819
764 def read_results_by_directory(self, baseline_name): 820 def read_results_by_directory(self, baseline_name):
765 if baseline_name.endswith('txt'): 821 if baseline_name.endswith('txt'):
766 return {'LayoutTests/passes/text.html': '123456'} 822 return {'LayoutTests/passes/text.html': '123456'}
767 return {} 823 return {}
768 824
769 825
770 class TestOptimizeBaselines(_BaseTestCase): 826 class TestOptimizeBaselines(_BaseTestCase):
771 command_constructor = OptimizeBaselines 827 command_constructor = OptimizeBaselines
772 828
773 def _write_test_file(self, port, path, contents): 829 def _write_test_file(self, port, path, contents):
(...skipping 20 matching lines...) Expand all
794 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "speci fiers": set(["mock-specifier"])}, 850 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "speci fiers": set(["mock-specifier"])},
795 } 851 }
796 OutputCapture().assert_outputs(self, self.command.execute, args=[ 852 OutputCapture().assert_outputs(self, self.command.execute, args=[
797 MockOptions(suffixes='txt', no_modify_scm=False, platform='test- mac-mac10.10'), 853 MockOptions(suffixes='txt', no_modify_scm=False, platform='test- mac-mac10.10'),
798 ['another/test.html'], 854 ['another/test.html'],
799 self.tool, 855 self.tool,
800 ], expected_stdout='{"add": [], "remove-lines": [], "delete": []}\n' ) 856 ], expected_stdout='{"add": [], "remove-lines": [], "delete": []}\n' )
801 finally: 857 finally:
802 builders._exact_matches = old_exact_matches 858 builders._exact_matches = old_exact_matches
803 859
804 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(t est_port.layout_tests_dir(), 'platform/mac/another/test-expected.txt'))) 860 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
805 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(te st_port.layout_tests_dir(), 'another/test-expected.txt'))) 861 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx t')))
862 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(
863 test_port.layout_tests_dir(), 'another/test-expected.txt')))
806 864
807 def test_no_modify_scm(self): 865 def test_no_modify_scm(self):
808 test_port = self.tool.port_factory.get('test') 866 test_port = self.tool.port_factory.get('test')
809 self._write_test_file(test_port, 'another/test.html', "Dummy test conten ts") 867 self._write_test_file(test_port, 'another/test.html', "Dummy test conten ts")
810 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp ected.txt', "result A") 868 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp ected.txt', "result A")
811 self._write_test_file(test_port, 'another/test-expected.txt', "result A" ) 869 self._write_test_file(test_port, 'another/test-expected.txt', "result A" )
812 870
813 old_exact_matches = builders._exact_matches 871 old_exact_matches = builders._exact_matches
814 try: 872 try:
815 builders._exact_matches = { 873 builders._exact_matches = {
816 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "speci fiers": set(["mock-specifier"])}, 874 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "speci fiers": set(["mock-specifier"])},
817 } 875 }
818 OutputCapture().assert_outputs(self, self.command.execute, args=[ 876 OutputCapture().assert_outputs(self, self.command.execute, args=[
819 MockOptions(suffixes='txt', no_modify_scm=True, platform='test-m ac-mac10.10'), 877 MockOptions(suffixes='txt', no_modify_scm=True, platform='test-m ac-mac10.10'),
820 ['another/test.html'], 878 ['another/test.html'],
821 self.tool, 879 self.tool,
822 ], expected_stdout='{"add": [], "remove-lines": [], "delete": ["/moc k-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-exp ected.txt"]}\n') 880 ], expected_stdout='{"add": [], "remove-lines": [], "delete": ["/moc k-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-exp ected.txt"]}\n')
823 finally: 881 finally:
824 builders._exact_matches = old_exact_matches 882 builders._exact_matches = old_exact_matches
825 883
826 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(t est_port.layout_tests_dir(), 'platform/mac/another/test-expected.txt'))) 884 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
827 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(te st_port.layout_tests_dir(), 'another/test-expected.txt'))) 885 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx t')))
886 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(
887 test_port.layout_tests_dir(), 'another/test-expected.txt')))
828 888
829 def test_optimize_all_suffixes_by_default(self): 889 def test_optimize_all_suffixes_by_default(self):
830 test_port = self.tool.port_factory.get('test') 890 test_port = self.tool.port_factory.get('test')
831 self._write_test_file(test_port, 'another/test.html', "Dummy test conten ts") 891 self._write_test_file(test_port, 'another/test.html', "Dummy test conten ts")
832 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp ected.txt', "result A") 892 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp ected.txt', "result A")
833 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp ected.png', "result A png") 893 self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-exp ected.png', "result A png")
834 self._write_test_file(test_port, 'another/test-expected.txt', "result A" ) 894 self._write_test_file(test_port, 'another/test-expected.txt', "result A" )
835 self._write_test_file(test_port, 'another/test-expected.png', "result A png") 895 self._write_test_file(test_port, 'another/test-expected.png', "result A png")
836 896
837 old_exact_matches = builders._exact_matches 897 old_exact_matches = builders._exact_matches
838 try: 898 try:
839 builders._exact_matches = { 899 builders._exact_matches = {
840 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "speci fiers": set(["mock-specifier"])}, 900 "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "speci fiers": set(["mock-specifier"])},
841 } 901 }
842 oc = OutputCapture() 902 oc = OutputCapture()
843 oc.capture_output() 903 oc.capture_output()
844 self.command.execute(MockOptions(suffixes='txt,wav,png', no_modify_s cm=True, platform='test-mac-mac10.10'), 904 self.command.execute(MockOptions(suffixes='txt,wav,png', no_modify_s cm=True, platform='test-mac-mac10.10'),
845 ['another/test.html'], 905 ['another/test.html'],
846 self.tool) 906 self.tool)
847 finally: 907 finally:
848 out, err, logs = oc.restore_output() 908 out, err, logs = oc.restore_output()
849 builders._exact_matches = old_exact_matches 909 builders._exact_matches = old_exact_matches
850 910
851 self.assertEquals(out, '{"add": [], "remove-lines": [], "delete": ["/moc k-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-exp ected.txt", "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10 /another/test-expected.png"]}\n') 911 self.assertEquals(out, '{"add": [], "remove-lines": [], "delete": ["/moc k-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-exp ected.txt", "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10 /another/test-expected.png"]}\n')
852 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(t est_port.layout_tests_dir(), 'platform/mac/another/test-expected.txt'))) 912 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
853 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(t est_port.layout_tests_dir(), 'platform/mac/another/test-expected.png'))) 913 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx t')))
854 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(te st_port.layout_tests_dir(), 'another/test-expected.txt'))) 914 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
855 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(te st_port.layout_tests_dir(), 'another/test-expected.png'))) 915 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.pn g')))
916 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(
917 test_port.layout_tests_dir(), 'another/test-expected.txt')))
918 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(
919 test_port.layout_tests_dir(), 'another/test-expected.png')))
856 920
857 921
858 class TestAnalyzeBaselines(_BaseTestCase): 922 class TestAnalyzeBaselines(_BaseTestCase):
859 command_constructor = AnalyzeBaselines 923 command_constructor = AnalyzeBaselines
860 924
861 def setUp(self): 925 def setUp(self):
862 super(TestAnalyzeBaselines, self).setUp() 926 super(TestAnalyzeBaselines, self).setUp()
863 self.port = self.tool.port_factory.get('test') 927 self.port = self.tool.port_factory.get('test')
864 self.tool.port_factory.get = (lambda port_name=None, options=None: self. port) 928 self.tool.port_factory.get = (lambda port_name=None, options=None: self. port)
865 self.lines = [] 929 self.lines = []
866 self.command._optimizer_class = _FakeOptimizer 930 self.command._optimizer_class = _FakeOptimizer
867 self.command._write = (lambda msg: self.lines.append(msg)) # pylint bug warning about unnecessary lambda? pylint: disable=W0108 931 # pylint bug warning about unnecessary lambda? pylint: disable=W0108
932 self.command._write = (lambda msg: self.lines.append(msg))
868 933
869 def test_default(self): 934 def test_default(self):
870 self.command.execute(MockOptions(suffixes='txt', missing=False, platform =None), ['passes/text.html'], self.tool) 935 self.command.execute(MockOptions(suffixes='txt', missing=False, platform =None), ['passes/text.html'], self.tool)
871 self.assertEqual(self.lines, 936 self.assertEqual(self.lines,
872 ['passes/text-expected.txt:', 937 ['passes/text-expected.txt:',
873 ' (generic): 123456']) 938 ' (generic): 123456'])
874 939
875 def test_missing_baselines(self): 940 def test_missing_baselines(self):
876 self.command.execute(MockOptions(suffixes='png,txt', missing=True, platf orm=None), ['passes/text.html'], self.tool) 941 self.command.execute(MockOptions(suffixes='png,txt', missing=True, platf orm=None), ['passes/text.html'], self.tool)
877 self.assertEqual(self.lines, 942 self.assertEqual(self.lines,
878 ['passes/text-expected.png: (no baselines found)', 943 ['passes/text-expected.png: (no baselines found)',
879 'passes/text-expected.txt:', 944 'passes/text-expected.txt:',
880 ' (generic): 123456']) 945 ' (generic): 123456'])
881 946
882 947
883 class TestAutoRebaseline(_BaseTestCase): 948 class TestAutoRebaseline(_BaseTestCase):
884 command_constructor = AutoRebaseline 949 command_constructor = AutoRebaseline
885 950
886 def _write_test_file(self, port, path, contents): 951 def _write_test_file(self, port, path, contents):
887 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path) 952 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path)
888 self.tool.filesystem.write_text_file(abs_path, contents) 953 self.tool.filesystem.write_text_file(abs_path, contents)
889 954
890 def _setup_test_port(self): 955 def _setup_test_port(self):
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/rebaseline-wi th-modifiers.html [ NeedsRebaseline ] 998 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/rebaseline-wi th-modifiers.html [ NeedsRebaseline ]
934 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 crbug.com/234 path/to/rebaselin e-without-modifiers.html [ NeedsRebaseline ] 999 624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 crbug.com/234 path/to/rebaselin e-without-modifiers.html [ NeedsRebaseline ]
935 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org@ bbb929c8-8fbe-4397-9dbb-9b2b20218538> 2013-04-28 04:52:41 +0000 12) crbug.com/ 24182 path/to/rebaseline-new-revision.html [ NeedsRebaseline ] 1000 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org@ bbb929c8-8fbe-4397-9dbb-9b2b20218538> 2013-04-28 04:52:41 +0000 12) crbug.com/ 24182 path/to/rebaseline-new-revision.html [ NeedsRebaseline ]
936 624caaaaaa path/to/TestExpectations (<foo@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots .html [ NeedsRebaseline ] 1001 624caaaaaa path/to/TestExpectations (<foo@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots .html [ NeedsRebaseline ]
937 0000000000 path/to/TestExpectations (<foo@chromium.org@@bbb929 c8-8fbe-4397-9dbb-9b2b20218538> 2013-04-28 04:52:41 +0000 12) crbug.com /24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] 1002 0000000000 path/to/TestExpectations (<foo@chromium.org@@bbb929 c8-8fbe-4397-9dbb-9b2b20218538> 2013-04-28 04:52:41 +0000 12) crbug.com /24182 path/to/locally-changed-lined.html [ NeedsRebaseline ]
938 """ 1003 """
939 self.tool.scm().blame = blame 1004 self.tool.scm().blame = blame
940 1005
941 min_revision = 9000 1006 min_revision = 9000
942 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio n, print_revisions=False), ( 1007 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio n, print_revisions=False), (
943 set(['path/to/rebaseline-without-bug-number.html', 'path/to/reba seline-with-modifiers.html', 'path/to/rebaseline-without-modifiers.html']), 1008 set(['path/to/rebaseline-without-bug-number.html',
944 5678, 1009 'path/to/rebaseline-with-modifiers.html', 'path/to/rebaseline-w ithout-modifiers.html']),
945 '624c3081c0', 1010 5678,
946 'foobarbaz1@chromium.org', 1011 '624c3081c0',
947 set(['24182', '234']), 1012 'foobarbaz1@chromium.org',
948 True)) 1013 set(['24182', '234']),
1014 True))
949 1015
950 def test_tests_to_rebaseline_over_limit(self): 1016 def test_tests_to_rebaseline_over_limit(self):
951 def blame(path): 1017 def blame(path):
952 result = "" 1018 result = ""
953 for i in range(0, self.command.MAX_LINES_TO_REBASELINE + 1): 1019 for i in range(0, self.command.MAX_LINES_TO_REBASELINE + 1):
954 result += "624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) crbug.com/24182 path /to/rebaseline-%s.html [ NeedsRebaseline ]\n" % i 1020 result += "624c3081c0 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) crbug.com/24182 path /to/rebaseline-%s.html [ NeedsRebaseline ]\n" % i
955 return result 1021 return result
956 self.tool.scm().blame = blame 1022 self.tool.scm().blame = blame
957 1023
958 expected_list_of_tests = [] 1024 expected_list_of_tests = []
959 for i in range(0, self.command.MAX_LINES_TO_REBASELINE): 1025 for i in range(0, self.command.MAX_LINES_TO_REBASELINE):
960 expected_list_of_tests.append("path/to/rebaseline-%s.html" % i) 1026 expected_list_of_tests.append("path/to/rebaseline-%s.html" % i)
961 1027
962 min_revision = 9000 1028 min_revision = 9000
963 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio n, print_revisions=False), ( 1029 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio n, print_revisions=False), (
964 set(expected_list_of_tests), 1030 set(expected_list_of_tests),
965 5678, 1031 5678,
966 '624c3081c0', 1032 '624c3081c0',
967 'foobarbaz1@chromium.org', 1033 'foobarbaz1@chromium.org',
968 set(['24182']), 1034 set(['24182']),
969 True)) 1035 True))
970 1036
971 def test_commit_message(self): 1037 def test_commit_message(self):
972 author = "foo@chromium.org" 1038 author = "foo@chromium.org"
973 revision = 1234 1039 revision = 1234
974 commit = "abcd567" 1040 commit = "abcd567"
975 bugs = set() 1041 bugs = set()
976 self.assertEqual(self.command.commit_message(author, revision, commit, b ugs), 1042 self.assertEqual(self.command.commit_message(author, revision, commit, b ugs),
977 """Auto-rebaseline for r1234 1043 """Auto-rebaseline for r1234
978 1044
979 https://chromium.googlesource.com/chromium/src/+/abcd567 1045 https://chromium.googlesource.com/chromium/src/+/abcd567
980 1046
981 TBR=foo@chromium.org 1047 TBR=foo@chromium.org
982 """) 1048 """)
983 1049
984 bugs = set(["234", "345"]) 1050 bugs = set(["234", "345"])
985 self.assertEqual(self.command.commit_message(author, revision, commit, b ugs), 1051 self.assertEqual(self.command.commit_message(author, revision, commit, b ugs),
986 """Auto-rebaseline for r1234 1052 """Auto-rebaseline for r1234
987 1053
988 https://chromium.googlesource.com/chromium/src/+/abcd567 1054 https://chromium.googlesource.com/chromium/src/+/abcd567
989 1055
990 BUG=234,345 1056 BUG=234,345
991 TBR=foo@chromium.org 1057 TBR=foo@chromium.org
992 """) 1058 """)
993 1059
994 def test_no_needs_rebaseline_lines(self): 1060 def test_no_needs_rebaseline_lines(self):
995 def blame(path): 1061 def blame(path):
996 return """ 1062 return """
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 self.command.tree_status = lambda: 'closed' 1138 self.command.tree_status = lambda: 'closed'
1073 self._execute_command_with_mock_options() 1139 self._execute_command_with_mock_options()
1074 self.assertEqual(self.tool.executive.calls, []) 1140 self.assertEqual(self.tool.executive.calls, [])
1075 1141
1076 self.command.tree_status = lambda: 'open' 1142 self.command.tree_status = lambda: 'open'
1077 self.tool.executive.calls = [] 1143 self.tool.executive.calls = []
1078 self._execute_command_with_mock_options() 1144 self._execute_command_with_mock_options()
1079 1145
1080 self.assertEqual(self.tool.executive.calls, [ 1146 self.assertEqual(self.tool.executive.calls, [
1081 [ 1147 [
1082 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt,png', '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype- chocolate.html'], 1148 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt,png',
1083 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'png', '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-stra wberry.html'], 1149 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/protot ype-chocolate.html'],
1084 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt', '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-taco .html'], 1150 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'png',
1085 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt', '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco .html'], 1151 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/protot ype-strawberry.html'],
1152 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt',
1153 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/protot ype-taco.html'],
1154 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt',
1155 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/protot ype-taco.html'],
1086 ], 1156 ],
1087 [ 1157 [
1088 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-chocolat e.html'], 1158 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png',
1089 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-strawberry.h tml'], 1159 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/protot ype-chocolate.html'],
1090 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-taco.html'], 1160 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder',
1091 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.html'], 1161 'MOCK Mac10.11', '--test', 'fast/dom/prototype-strawberr y.html'],
1162 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt',
1163 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/protot ype-taco.html'],
1164 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt',
1165 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/protot ype-taco.html'],
1092 ], 1166 ],
1093 [ 1167 [
1094 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt,png', 'fast/dom/prototype-chocolate.html'], 1168 ['python', 'echo', 'optimize-baselines', '--no-modify-scm',
1095 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'png', 'fast/dom/prototype-strawberry.html'], 1169 '--suffixes', 'txt,png', 'fast/dom/prototype-chocolate.h tml'],
1170 ['python', 'echo', 'optimize-baselines', '--no-modify-scm',
1171 '--suffixes', 'png', 'fast/dom/prototype-strawberry.html '],
1096 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt', 'fast/dom/prototype-taco.html'], 1172 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt', 'fast/dom/prototype-taco.html'],
1097 ], 1173 ],
1098 ['git', 'cl', 'upload', '-f'], 1174 ['git', 'cl', 'upload', '-f'],
1099 ['git', 'pull'], 1175 ['git', 'pull'],
1100 ['git', 'cl', 'land', '-f', '-v'], 1176 ['git', 'cl', 'land', '-f', '-v'],
1101 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'], 1177 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'],
1102 ]) 1178 ])
1103 1179
1104 # The mac ports should both be removed since they're the only ones i n builders._exact_matches. 1180 # The mac ports should both be removed since they're the only ones i n builders._exact_matches.
1105 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """ 1181 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 } 1232 }
1157 1233
1158 self.command.SECONDS_BEFORE_GIVING_UP = 0 1234 self.command.SECONDS_BEFORE_GIVING_UP = 0
1159 self.command.tree_status = lambda: 'open' 1235 self.command.tree_status = lambda: 'open'
1160 self.tool.executive = MockExecutive() 1236 self.tool.executive = MockExecutive()
1161 self.tool.executive.calls = [] 1237 self.tool.executive.calls = []
1162 self._execute_command_with_mock_options() 1238 self._execute_command_with_mock_options()
1163 1239
1164 self.assertEqual(self.tool.executive.calls, [ 1240 self.assertEqual(self.tool.executive.calls, [
1165 [ 1241 [
1166 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt', '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco .html'], 1242 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt',
1243 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/protot ype-taco.html'],
1167 ], 1244 ],
1168 [ 1245 [
1169 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.html'], 1246 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt',
1247 '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/protot ype-taco.html'],
1170 ], 1248 ],
1171 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', 'txt', 'fast/dom/prototype-taco.html']], 1249 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', 'txt', 'fast/dom/prototype-taco.html']],
1172 ['git', 'cl', 'upload', '-f'], 1250 ['git', 'cl', 'upload', '-f'],
1173 ]) 1251 ])
1174 finally: 1252 finally:
1175 builders._exact_matches = old_exact_matches 1253 builders._exact_matches = old_exact_matches
1176 1254
1177 def test_execute_test_passes_everywhere(self): 1255 def test_execute_test_passes_everywhere(self):
1178 def blame(path): 1256 def blame(path):
1179 return """ 1257 return """
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 self.tool.executive = MockLineRemovingExecutive() 1472 self.tool.executive = MockLineRemovingExecutive()
1395 1473
1396 old_exact_matches = builders._exact_matches 1474 old_exact_matches = builders._exact_matches
1397 try: 1475 try:
1398 builders._exact_matches = { 1476 builders._exact_matches = {
1399 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers" : set(["mock-specifier"])}, 1477 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers" : set(["mock-specifier"])},
1400 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers" : set(["mock-specifier"])}, 1478 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers" : set(["mock-specifier"])},
1401 } 1479 }
1402 1480
1403 self.command.tree_status = lambda: 'open' 1481 self.command.tree_status = lambda: 'open'
1404 self._execute_command_with_mock_options(auth_refresh_token_json=auth _refresh_token_json, commit_author=commit_author, dry_run=dry_run) 1482 self._execute_command_with_mock_options(auth_refresh_token_json=auth _refresh_token_json,
1483 commit_author=commit_author, dry_run=dry_run)
1405 self.assertEqual(self.tool.executive.calls, expected_executive_calls ) 1484 self.assertEqual(self.tool.executive.calls, expected_executive_calls )
1406 1485
1407 # The mac ports should both be removed since they're the only ones i n builders._exact_matches. 1486 # The mac ports should both be removed since they're the only ones i n builders._exact_matches.
1408 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """ 1487 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """
1409 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] 1488 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
1410 """) 1489 """)
1411 finally: 1490 finally:
1412 builders._exact_matches = old_exact_matches 1491 builders._exact_matches = old_exact_matches
1413 1492
1414 def test_execute_with_rietveld_auth_refresh_token(self): 1493 def test_execute_with_rietveld_auth_refresh_token(self):
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 oc.capture_output() 1547 oc.capture_output()
1469 self.command._do_one_rebaseline() 1548 self.command._do_one_rebaseline()
1470 out, _, _ = oc.restore_output() 1549 out, _, _ = oc.restore_output()
1471 1550
1472 self.assertEqual(out, 'MOCK STDOUT\n') 1551 self.assertEqual(out, 'MOCK STDOUT\n')
1473 self.assertEqual(self.tool.executive.calls, [ 1552 self.assertEqual(self.tool.executive.calls, [
1474 ['git', 'pull'], 1553 ['git', 'pull'],
1475 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au to-rebaseline', '--verbose'], 1554 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au to-rebaseline', '--verbose'],
1476 ]) 1555 ])
1477 self.assertEqual(self._logs, ['MOCK STDOUT']) 1556 self.assertEqual(self._logs, ['MOCK STDOUT'])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698