OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import optparse | 5 import optparse |
6 import unittest | 6 import unittest |
7 | 7 |
8 from webkitpy.common.net.buildbot import Build | 8 from webkitpy.common.net.buildbot import Build |
9 from webkitpy.common.net.layouttestresults import LayoutTestResults | 9 from webkitpy.common.net.layouttestresults import LayoutTestResults |
10 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 | 10 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 command_constructor = CopyExistingBaselinesInternal | 107 command_constructor = CopyExistingBaselinesInternal |
108 | 108 |
109 def setUp(self): | 109 def setUp(self): |
110 super(TestCopyExistingBaselinesInternal, self).setUp() | 110 super(TestCopyExistingBaselinesInternal, self).setUp() |
111 | 111 |
112 def test_copying_overwritten_baseline(self): | 112 def test_copying_overwritten_baseline(self): |
113 self.tool.executive = MockExecutive2() | 113 self.tool.executive = MockExecutive2() |
114 | 114 |
115 port = self.tool.port_factory.get('test-mac-mac10.10') | 115 port = self.tool.port_factory.get('test-mac-mac10.10') |
116 self._write( | 116 self._write( |
117 port._filesystem.join( | 117 port.host.filesystem.join( |
118 port.layout_tests_dir(), | 118 port.layout_tests_dir(), |
119 'platform/test-mac-mac10.10/failures/expected/image-expected.txt
'), | 119 'platform/test-mac-mac10.10/failures/expected/image-expected.txt
'), |
120 'original mac10.11 result') | 120 'original mac10.11 result') |
121 | 121 |
122 oc = OutputCapture() | 122 oc = OutputCapture() |
123 try: | 123 try: |
124 options = optparse.Values({ | 124 options = optparse.Values({ |
125 'builder': "MOCK Mac10.11", | 125 'builder': "MOCK Mac10.11", |
126 'suffixes': 'txt', | 126 'suffixes': 'txt', |
127 'verbose': True, | 127 'verbose': True, |
(...skipping 10 matching lines...) Expand all Loading... |
138 port.layout_tests_dir(), | 138 port.layout_tests_dir(), |
139 'platform/test-mac-mac10.10/failures/expected/image-expected.txt
')), | 139 'platform/test-mac-mac10.10/failures/expected/image-expected.txt
')), |
140 'original mac10.11 result') | 140 'original mac10.11 result') |
141 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete"
: []}\n') | 141 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete"
: []}\n') |
142 | 142 |
143 def test_copying_overwritten_baseline_to_multiple_locations(self): | 143 def test_copying_overwritten_baseline_to_multiple_locations(self): |
144 self.tool.executive = MockExecutive2() | 144 self.tool.executive = MockExecutive2() |
145 | 145 |
146 port = self.tool.port_factory.get('test-win-win7') | 146 port = self.tool.port_factory.get('test-win-win7') |
147 self._write( | 147 self._write( |
148 port._filesystem.join(port.layout_tests_dir(), 'platform/test-win-wi
n7/failures/expected/image-expected.txt'), | 148 port.host.filesystem.join(port.layout_tests_dir(), 'platform/test-wi
n-win7/failures/expected/image-expected.txt'), |
149 'original win7 result') | 149 'original win7 result') |
150 | 150 |
151 oc = OutputCapture() | 151 oc = OutputCapture() |
152 try: | 152 try: |
153 options = optparse.Values({ | 153 options = optparse.Values({ |
154 'builder': "MOCK Win7", | 154 'builder': "MOCK Win7", |
155 'suffixes': "txt", | 155 'suffixes': "txt", |
156 'verbose': True, | 156 'verbose': True, |
157 'test': "failures/expected/image.html", | 157 'test': "failures/expected/image.html", |
158 'results_directory': None | 158 'results_directory': None |
(...skipping 11 matching lines...) Expand all Loading... |
170 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 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'))) | 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( | 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'))) | 173 port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/ano
ther-test-expected.txt'))) |
174 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete"
: []}\n') | 174 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete"
: []}\n') |
175 | 175 |
176 def test_no_copy_existing_baseline(self): | 176 def test_no_copy_existing_baseline(self): |
177 self.tool.executive = MockExecutive2() | 177 self.tool.executive = MockExecutive2() |
178 | 178 |
179 port = self.tool.port_factory.get('test-win-win7') | 179 port = self.tool.port_factory.get('test-win-win7') |
180 self._write(port._filesystem.join(port.layout_tests_dir(), | 180 self._write( |
181 'platform/test-win-win7/failures/expec
ted/image-expected.txt'), 'original win7 result') | 181 port.host.filesystem.join( |
| 182 port.layout_tests_dir(), |
| 183 'platform/test-win-win7/failures/expected/image-expected.txt'), |
| 184 'original win7 result') |
182 | 185 |
183 oc = OutputCapture() | 186 oc = OutputCapture() |
184 try: | 187 try: |
185 options = optparse.Values({ | 188 options = optparse.Values({ |
186 'builder': "MOCK Win7", | 189 'builder': "MOCK Win7", |
187 'suffixes': "txt", | 190 'suffixes': "txt", |
188 'verbose': True, | 191 'verbose': True, |
189 'test': "failures/expected/image.html", | 192 'test': "failures/expected/image.html", |
190 'results_directory': None | 193 'results_directory': None |
191 }) | 194 }) |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 { | 337 { |
335 'add': ['/test.checkout/LayoutTests/platform/test-linux-trusty/u
serscripts/another-test-expected.txt'], | 338 'add': ['/test.checkout/LayoutTests/platform/test-linux-trusty/u
serscripts/another-test-expected.txt'], |
336 'delete': [], | 339 'delete': [], |
337 'remove-lines': [] | 340 'remove-lines': [] |
338 }) | 341 }) |
339 | 342 |
340 def test_rebaseline_test_internal_with_port_that_lacks_buildbot(self): | 343 def test_rebaseline_test_internal_with_port_that_lacks_buildbot(self): |
341 self.tool.executive = MockExecutive2() | 344 self.tool.executive = MockExecutive2() |
342 | 345 |
343 port = self.tool.port_factory.get('test-win-win7') | 346 port = self.tool.port_factory.get('test-win-win7') |
344 self._write(port._filesystem.join(port.layout_tests_dir(), | 347 self._write( |
345 'platform/test-win-win10/failures/expe
cted/image-expected.txt'), 'original win10 result') | 348 port.host.filesystem.join( |
| 349 port.layout_tests_dir(), |
| 350 'platform/test-win-win10/failures/expected/image-expected.txt'), |
| 351 'original win10 result') |
346 | 352 |
347 oc = OutputCapture() | 353 oc = OutputCapture() |
348 try: | 354 try: |
349 options = optparse.Values({ | 355 options = optparse.Values({ |
350 'optimize': True, | 356 'optimize': True, |
351 'builder': "MOCK Win10", | 357 'builder': "MOCK Win10", |
352 'suffixes': "txt", | 358 'suffixes': "txt", |
353 'verbose': True, | 359 'verbose': True, |
354 'test': "failures/expected/image.html", | 360 'test': "failures/expected/image.html", |
355 'results_directory': None, | 361 'results_directory': None, |
356 'build_number': None | 362 'build_number': None |
357 }) | 363 }) |
358 oc.capture_output() | 364 oc.capture_output() |
359 self.command.execute(options, [], self.tool) | 365 self.command.execute(options, [], self.tool) |
360 finally: | 366 finally: |
361 out, _, _ = oc.restore_output() | 367 out, _, _ = oc.restore_output() |
362 | 368 |
363 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo
ut_tests_dir( | 369 self.assertMultiLineEqual( |
364 ), 'platform/test-win-win10/failures/expected/image-expected.txt')), 'MO
CK Web result, convert 404 to None=True') | 370 self._read(self.tool.filesystem.join( |
| 371 port.layout_tests_dir(), |
| 372 'platform/test-win-win10/failures/expected/image-expected.txt'))
, |
| 373 'MOCK Web result, convert 404 to None=True') |
365 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( | 374 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( |
366 port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/i
mage-expected.txt'))) | 375 port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/i
mage-expected.txt'))) |
367 self.assertMultiLineEqual( | 376 self.assertMultiLineEqual( |
368 out, '{"add": [], "remove-lines": [{"test": "failures/expected/image
.html", "builder": "MOCK Win10"}], "delete": []}\n') | 377 out, '{"add": [], "remove-lines": [{"test": "failures/expected/image
.html", "builder": "MOCK Win10"}], "delete": []}\n') |
369 | 378 |
370 | 379 |
371 class TestAbstractParallelRebaselineCommand(BaseTestCase): | 380 class TestAbstractParallelRebaselineCommand(BaseTestCase): |
372 command_constructor = AbstractParallelRebaselineCommand | 381 command_constructor = AbstractParallelRebaselineCommand |
373 | 382 |
374 def test_builders_to_fetch_from(self): | 383 def test_builders_to_fetch_from(self): |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 for cmd_line, cwd in commands: | 936 for cmd_line, cwd in commands: |
928 out = self.run_command(cmd_line, cwd=cwd) | 937 out = self.run_command(cmd_line, cwd=cwd) |
929 if 'rebaseline-test-internal' in cmd_line: | 938 if 'rebaseline-test-internal' in cmd_line: |
930 out = '{"add": [], "remove-lines": [{"test": "%s", "builder": "%
s"}], "delete": []}\n' % (cmd_line[8], cmd_line[6]) | 939 out = '{"add": [], "remove-lines": [{"test": "%s", "builder": "%
s"}], "delete": []}\n' % (cmd_line[8], cmd_line[6]) |
931 command_outputs.append([0, out, '']) | 940 command_outputs.append([0, out, '']) |
932 | 941 |
933 new_calls = self.calls[num_previous_calls:] | 942 new_calls = self.calls[num_previous_calls:] |
934 self.calls = self.calls[:num_previous_calls] | 943 self.calls = self.calls[:num_previous_calls] |
935 self.calls.append(new_calls) | 944 self.calls.append(new_calls) |
936 return command_outputs | 945 return command_outputs |
OLD | NEW |