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

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

Issue 2409903002: When rebaselining testharness tests with new all-PASS results, remove the baseline. (Closed)
Patch Set: Undo docstrings that no longer apply Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 new_expectations = self._read(self.mac_expectations_path) 274 new_expectations = self._read(self.mac_expectations_path)
275 self.assertMultiLineEqual( 275 self.assertMultiLineEqual(
276 new_expectations, 276 new_expectations,
277 ("Bug(B) [ Mac Linux Win7 Debug ] fast/dom/Window/window-postmessage -clone-really-deep-array.html [ Pass ]\n" 277 ("Bug(B) [ Mac Linux Win7 Debug ] fast/dom/Window/window-postmessage -clone-really-deep-array.html [ Pass ]\n"
278 "Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failu re ]\n")) 278 "Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failu re ]\n"))
279 279
280 def test_rebaseline_test(self): 280 def test_rebaseline_test(self):
281 self.command._rebaseline_test("MOCK Trusty", "userscripts/another-test.h tml", "txt", self.WEB_PREFIX) 281 self.command._rebaseline_test("MOCK Trusty", "userscripts/another-test.h tml", "txt", self.WEB_PREFIX)
282 self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/u serscripts/another-test-actual.txt']) 282 self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/u serscripts/another-test-actual.txt'])
283 283
284 def test_rebaseline_all_pass_testharness_result_removes_baseline(self):
285 self.tool.web.urls = {
286 ('https://storage.googleapis.com/chromium-layout-test-archives'
287 '/MOCK_Win7/results/layout-test-results/failures/unexpected'
288 '/text-actual.txt'): 'This is a testharness.js-based test.\n PASS: foo \n Harness: the test ran to completion.'
289 }
290 self._write(
291 '/test.checkout/LayoutTests/platform/test-win-win7/failures/unexpect ed/text-expected.txt',
292 'original baseline')
293 oc = OutputCapture()
294 oc.capture_output()
295 self.command.execute(self.options(builder='MOCK Win7', test="failures/un expected/text.html"), [], self.tool)
296 out, _, _ = oc.restore_output()
297 self.assertEqual('{"remove-lines": [{"test": "failures/unexpected/text.h tml", "builder": "MOCK Win7"}]}\n', out)
298 self.assertFalse(self.tool.filesystem.exists(
299 '/test.checkout/LayoutTests/platform/test-win-win7/failures/unexpect ed/text-expected.txt'))
300
301 def test_rebaseline_test_non_all_pass_testharness_result(self):
302 self.tool.web.urls = {
303 ('https://storage.googleapis.com/chromium-layout-test-archives/MOCK_ Win7'
304 '/results/layout-test-results/failures/unexpected/text-actual.txt') :
305 ('This is some other baseline content, not an all-pass testharness.j s result.')}
306 self._write(
307 '/test.checkout/LayoutTests/platform/test-win-win7/failures/unexpect ed/text-expected.txt',
308 'original baseline')
309 oc = OutputCapture()
310 oc.capture_output()
311 self.command.execute(self.options(builder='MOCK Win7', test="failures/un expected/text.html"), [], self.tool)
312 out, _, _ = oc.restore_output()
313 self.assertEqual('{"remove-lines": [{"test": "failures/unexpected/text.h tml", "builder": "MOCK Win7"}]}\n', out)
314 self.assertTrue(self.tool.filesystem.exists(
315 '/test.checkout/LayoutTests/platform/test-win-win7/failures/unexpect ed/text-expected.txt'))
316
284 def test_rebaseline_test_with_results_directory(self): 317 def test_rebaseline_test_with_results_directory(self):
285 self._write("userscripts/another-test.html", "test data") 318 self._write("userscripts/another-test.html", "test data")
286 self._write( 319 self._write(
287 self.mac_expectations_path, 320 self.mac_expectations_path,
288 ("Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\n" 321 ("Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\n"
289 "bug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n")) 322 "bug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n"))
290 self.command._rebaseline_test_and_update_expectations(self.options(resul ts_directory='/tmp')) 323 self.command._rebaseline_test_and_update_expectations(self.options(resul ts_directory='/tmp'))
291 self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscri pts/another-test-actual.txt']) 324 self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscri pts/another-test-actual.txt'])
292 325
293 def test_rebaseline_reftest(self): 326 def test_rebaseline_reftest(self):
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 for cmd_line, cwd in commands: 927 for cmd_line, cwd in commands:
895 out = self.run_command(cmd_line, cwd=cwd) 928 out = self.run_command(cmd_line, cwd=cwd)
896 if 'rebaseline-test-internal' in cmd_line: 929 if 'rebaseline-test-internal' in cmd_line:
897 out = '{"remove-lines": [{"test": "%s", "builder": "%s"}]}\n' % (cmd_line[8], cmd_line[6]) 930 out = '{"remove-lines": [{"test": "%s", "builder": "%s"}]}\n' % (cmd_line[8], cmd_line[6])
898 command_outputs.append([0, out, '']) 931 command_outputs.append([0, out, ''])
899 932
900 new_calls = self.calls[num_previous_calls:] 933 new_calls = self.calls[num_previous_calls:]
901 self.calls = self.calls[:num_previous_calls] 934 self.calls = self.calls[:num_previous_calls]
902 self.calls.append(new_calls) 935 self.calls.append(new_calls)
903 return command_outputs 936 return command_outputs
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698