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

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

Issue 1939843002: Replace webkitpy standalone builders functions with instantiable class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved builders out of port, updated comment Created 4 years, 7 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
index 5dd00d5790e2cd119ed27dbecf3349a831593eeb..eab855fd3d9cd0d5fddb1fab44a63625f9e709fc 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
@@ -37,10 +37,18 @@ from webkitpy.common.net.layouttestresults import LayoutTestResults
from webkitpy.common.system.executive_mock import MockExecutive
from webkitpy.common.system.executive_mock import MockExecutive2
from webkitpy.common.system.outputcapture import OutputCapture
+from webkitpy.layout_tests.builders import Builders
from webkitpy.tool.commands.rebaseline import *
from webkitpy.tool.mocktool import MockTool, MockOptions
+class FakeBuilders(Builders):
+
+ def __init__(self, builders_dict):
+ super(FakeBuilders, self).__init__()
+ self._exact_matches = builders_dict
+
+
class _BaseTestCase(unittest.TestCase):
MOCK_WEB_RESULT = 'MOCK Web result, convert 404 to None=True'
WEB_PREFIX = 'http://example.com/f/builders/WebKit Mac10.11/results/layout-test-results'
@@ -115,14 +123,13 @@ class TestCopyExistingBaselinesInternal(_BaseTestCase):
self._write(port._filesystem.join(port.layout_tests_dir(),
'platform/test-mac-mac10.10/failures/expected/image-expected.txt'), 'original mac10.11 result')
- old_exact_matches = builders._exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
+ })
+
oc = OutputCapture()
try:
- builders._exact_matches = {
- "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
- }
-
options = MockOptions(builder="MOCK Mac10.11", suffixes="txt", verbose=True,
test="failures/expected/image.html", results_directory=None)
@@ -130,7 +137,6 @@ class TestCopyExistingBaselinesInternal(_BaseTestCase):
self.command.execute(options, [], self.tool)
finally:
out, _, _ = oc.restore_output()
- builders._exact_matches = old_exact_matches
self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layout_tests_dir(),
'platform/test-mac-mac10.10/failures/expected/image-expected.txt')), 'original mac10.11 result')
@@ -146,16 +152,14 @@ class TestCopyExistingBaselinesInternal(_BaseTestCase):
self._write(port._filesystem.join(port.layout_tests_dir(),
'platform/test-win-win7/failures/expected/image-expected.txt'), 'original win7 result')
- old_exact_matches = builders._exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])},
+ "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": set(["mock-specifier"])},
+ "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
+ })
oc = OutputCapture()
try:
- builders._exact_matches = {
- "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])},
- "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": set(["mock-specifier"])},
- "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
- }
-
options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=True,
test="failures/expected/image.html", results_directory=None)
@@ -163,7 +167,6 @@ class TestCopyExistingBaselinesInternal(_BaseTestCase):
self.command.execute(options, [], self.tool)
finally:
out, _, _ = oc.restore_output()
- builders._exact_matches = old_exact_matches
self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layout_tests_dir(),
'platform/test-linux-trusty/failures/expected/image-expected.txt')), 'original win7 result')
@@ -182,15 +185,13 @@ class TestCopyExistingBaselinesInternal(_BaseTestCase):
self._write(port._filesystem.join(port.layout_tests_dir(),
'platform/test-win-win7/failures/expected/image-expected.txt'), 'original win7 result')
- old_exact_matches = builders._exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])},
+ "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
+ })
oc = OutputCapture()
try:
- builders._exact_matches = {
- "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])},
- "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
- }
-
options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=True,
test="failures/expected/image.html", results_directory=None)
@@ -198,7 +199,6 @@ class TestCopyExistingBaselinesInternal(_BaseTestCase):
self.command.execute(options, [], self.tool)
finally:
out, _, _ = oc.restore_output()
- builders._exact_matches = old_exact_matches
self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layout_tests_dir(),
'platform/test-linux-trusty/failures/expected/image-expected.txt')), 'original win7 result')
@@ -217,16 +217,14 @@ class TestCopyExistingBaselinesInternal(_BaseTestCase):
self._write(expectations_path, (
"[ Win ] failures/expected/image.html [ Failure ]\n"
"[ Linux ] failures/expected/image.html [ Skip ]\n"))
- old_exact_matches = builders._exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])},
+ "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": set(["mock-specifier"])},
+ "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
+ })
oc = OutputCapture()
try:
- builders._exact_matches = {
- "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set(["mock-specifier"])},
- "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": set(["mock-specifier"])},
- "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
- }
-
options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=True,
test="failures/expected/image.html", results_directory=None)
@@ -234,7 +232,6 @@ class TestCopyExistingBaselinesInternal(_BaseTestCase):
self.command.execute(options, [], self.tool)
finally:
out, _, _ = oc.restore_output()
- builders._exact_matches = old_exact_matches
self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/test-mac-mac10.10/failures/expected/image-expected.txt')))
self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/test-linux-trusty/failures/expected/image-expected.txt')))
@@ -322,14 +319,12 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]
self._write(port._filesystem.join(port.layout_tests_dir(),
'platform/test-win-win10/failures/expected/image-expected.txt'), 'original win10 result')
- old_exact_matches = builders._exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Win7": {"port_name": "test-win-win7"},
+ "MOCK Win10": {"port_name": "test-win-win10"},
+ })
oc = OutputCapture()
try:
- builders._exact_matches = {
- "MOCK Win7": {"port_name": "test-win-win7"},
- "MOCK Win10": {"port_name": "test-win-win10"},
- }
-
options = MockOptions(optimize=True, builder="MOCK Win10", suffixes="txt",
verbose=True, test="failures/expected/image.html", results_directory=None)
@@ -337,7 +332,6 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]
self.command.execute(options, [], self.tool)
finally:
out, _, _ = oc.restore_output()
- builders._exact_matches = old_exact_matches
self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layout_tests_dir(
), 'platform/test-win-win10/failures/expected/image-expected.txt')), 'MOCK Web result, convert 404 to None=True')
@@ -351,20 +345,16 @@ class TestAbstractParallelRebaselineCommand(_BaseTestCase):
command_constructor = AbstractParallelRebaselineCommand
def test_builders_to_fetch_from(self):
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK Win10": {"port_name": "test-win-win10"},
- "MOCK Win7": {"port_name": "test-win-win7"},
- "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7"},
- "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7"},
- }
+ self.tool.builders = FakeBuilders({
+ "MOCK Win10": {"port_name": "test-win-win10"},
+ "MOCK Win7": {"port_name": "test-win-win7"},
+ "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7"},
+ "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7"},
+ })
- builders_to_fetch = self.command._builders_to_fetch_from(
- ["MOCK Win10", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK Win7"])
- self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"])
- finally:
- builders._exact_matches = old_exact_matches
+ builders_to_fetch = self.command._builders_to_fetch_from(
+ ["MOCK Win10", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK Win7"])
+ self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"])
class TestRebaselineJson(_BaseTestCase):
@@ -373,14 +363,12 @@ class TestRebaselineJson(_BaseTestCase):
def setUp(self):
super(TestRebaselineJson, self).setUp()
self.tool.executive = MockExecutive2()
- self.old_exact_matches = builders._exact_matches
- builders._exact_matches = {
+ self.tool.builders = FakeBuilders({
"MOCK builder": {"port_name": "test-mac-mac10.11"},
"MOCK builder (Debug)": {"port_name": "test-mac-mac10.11"},
- }
+ })
def tearDown(self):
- builders._exact_matches = self.old_exact_matches
super(TestRebaselineJson, self).tearDown()
def test_rebaseline_test_passes_on_all_builders(self):
@@ -579,15 +567,11 @@ class TestRebaseline(_BaseTestCase):
self._zero_out_test_expectations()
self._setup_mock_builder_data()
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- }
- self.command.execute(MockOptions(results_directory=False, optimize=False, builders=None,
- suffixes="txt,png", verbose=True), ['userscripts/first-test.html'], self.tool)
- finally:
- builders._exact_matches = old_exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ })
+ self.command.execute(MockOptions(results_directory=False, optimize=False, builders=None,
+ suffixes="txt,png", verbose=True), ['userscripts/first-test.html'], self.tool)
calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.tool.executive.calls)
self.assertEqual(calls,
@@ -602,15 +586,11 @@ class TestRebaseline(_BaseTestCase):
self._setup_mock_builder_data()
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- }
- self.command.execute(MockOptions(results_directory=False, optimize=False, builders=None,
- suffixes="txt,png", verbose=True), ['userscripts'], self.tool)
- finally:
- builders._exact_matches = old_exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK builder": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ })
+ self.command.execute(MockOptions(results_directory=False, optimize=False, builders=None,
+ suffixes="txt,png", verbose=True), ['userscripts'], self.tool)
calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.tool.executive.calls)
self.assertEqual(calls,
@@ -697,15 +677,11 @@ class TestRebaselineExpectations(_BaseTestCase):
'userscripts/not-actually-failing.html': set(['txt', 'png', 'wav']),
}
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
- }
- self.command.execute(self.options, [], self.tool)
- finally:
- builders._exact_matches = old_exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
+ })
+ self.command.execute(self.options, [], self.tool)
# FIXME: change this to use the test- ports.
calls = filter(lambda x: x != ['qmake', '-v'], self.tool.executive.calls)
@@ -797,22 +773,17 @@ Bug(foo) fast/dom/prototype-taco.html [ Rebaseline ]
self.tool.executive = MockLineRemovingExecutive()
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
- }
-
- self.command.execute(self.options, [], self.tool)
- self.assertEqual(self.tool.executive.calls, [])
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
+ })
+ self.command.execute(self.options, [], self.tool)
+ self.assertEqual(self.tool.executive.calls, [])
- # The mac ports should both be removed since they're the only ones in builders._exact_matches.
- self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """
+ # The mac ports should both be removed since they're the only ones in builders._exact_matches.
+ self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """
Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ Rebaseline ]
""")
- finally:
- builders._exact_matches = old_exact_matches
class _FakeOptimizer(BaselineOptimizer):
@@ -844,18 +815,14 @@ class TestOptimizeBaselines(_BaseTestCase):
self._write_test_file(test_port, 'platform/mac/another/test-expected.txt', "result A")
self._write_test_file(test_port, 'another/test-expected.txt', "result A")
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- }
- OutputCapture().assert_outputs(self, self.command.execute, args=[
- MockOptions(suffixes='txt', no_modify_scm=False, platform='test-mac-mac10.10'),
- ['another/test.html'],
- self.tool,
- ], expected_stdout='{"add": [], "remove-lines": [], "delete": []}\n')
- finally:
- builders._exact_matches = old_exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ })
+ OutputCapture().assert_outputs(self, self.command.execute, args=[
+ MockOptions(suffixes='txt', no_modify_scm=False, platform='test-mac-mac10.10'),
+ ['another/test.html'],
+ self.tool,
+ ], expected_stdout='{"add": [], "remove-lines": [], "delete": []}\n')
self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
test_port.layout_tests_dir(), 'platform/mac/another/test-expected.txt')))
@@ -868,18 +835,14 @@ class TestOptimizeBaselines(_BaseTestCase):
self._write_test_file(test_port, 'platform/mac-mac10.10/another/test-expected.txt', "result A")
self._write_test_file(test_port, 'another/test-expected.txt', "result A")
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- }
- OutputCapture().assert_outputs(self, self.command.execute, args=[
- MockOptions(suffixes='txt', no_modify_scm=True, platform='test-mac-mac10.10'),
- ['another/test.html'],
- self.tool,
- ], expected_stdout='{"add": [], "remove-lines": [], "delete": ["/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-expected.txt"]}\n')
- finally:
- builders._exact_matches = old_exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ })
+ OutputCapture().assert_outputs(self, self.command.execute, args=[
+ MockOptions(suffixes='txt', no_modify_scm=True, platform='test-mac-mac10.10'),
+ ['another/test.html'],
+ self.tool,
+ ], expected_stdout='{"add": [], "remove-lines": [], "delete": ["/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-expected.txt"]}\n')
self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
test_port.layout_tests_dir(), 'platform/mac/another/test-expected.txt')))
@@ -894,11 +857,10 @@ class TestOptimizeBaselines(_BaseTestCase):
self._write_test_file(test_port, 'another/test-expected.txt', "result A")
self._write_test_file(test_port, 'another/test-expected.png', "result A png")
- old_exact_matches = builders._exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ })
try:
- builders._exact_matches = {
- "MOCK Mac10.10 Debug": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- }
oc = OutputCapture()
oc.capture_output()
self.command.execute(MockOptions(suffixes='txt,wav,png', no_modify_scm=True, platform='test-mac-mac10.10'),
@@ -906,7 +868,6 @@ class TestOptimizeBaselines(_BaseTestCase):
self.tool)
finally:
out, err, logs = oc.restore_output()
- builders._exact_matches = old_exact_matches
self.assertEquals(out, '{"add": [], "remove-lines": [], "delete": ["/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-expected.txt", "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-expected.png"]}\n')
self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
@@ -978,16 +939,12 @@ class TestAutoRebaseline(_BaseTestCase):
self.command.bot_revision_data = lambda: [{"builder": "Mock builder", "revision": "9000"}]
def test_release_builders(self):
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- "MOCK Mac10.11 Debug": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
- "MOCK Mac10.11 ASAN": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
- }
- self.assertEqual(self.command._release_builders(), ['MOCK Mac10.10'])
- finally:
- builders._exact_matches = old_exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ "MOCK Mac10.11 Debug": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
+ "MOCK Mac10.11 ASAN": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
+ })
+ self.assertEqual(self.command._release_builders(), ['MOCK Mac10.10'])
def test_tests_to_rebaseline(self):
def blame(path):
@@ -1128,65 +1085,61 @@ crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ]
self.tool.executive = MockLineRemovingExecutive()
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
- }
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
+ })
- self.command.tree_status = lambda: 'closed'
- self._execute_command_with_mock_options()
- self.assertEqual(self.tool.executive.calls, [])
+ self.command.tree_status = lambda: 'closed'
+ self._execute_command_with_mock_options()
+ self.assertEqual(self.tool.executive.calls, [])
- self.command.tree_status = lambda: 'open'
- self.tool.executive.calls = []
- self._execute_command_with_mock_options()
+ self.command.tree_status = lambda: 'open'
+ self.tool.executive.calls = []
+ self._execute_command_with_mock_options()
- self.assertEqual(self.tool.executive.calls, [
- [
- ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,png',
- '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-chocolate.html'],
- ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'png',
- '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-strawberry.html'],
- ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'txt',
- '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-taco.html'],
- ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'txt',
- '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.html'],
- ],
- [
- ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png',
- '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-chocolate.html'],
- ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder',
- 'MOCK Mac10.11', '--test', 'fast/dom/prototype-strawberry.html'],
- ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt',
- '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-taco.html'],
- ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt',
- '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.html'],
- ],
- [
- ['python', 'echo', 'optimize-baselines', '--no-modify-scm',
- '--suffixes', 'txt,png', 'fast/dom/prototype-chocolate.html'],
- ['python', 'echo', 'optimize-baselines', '--no-modify-scm',
- '--suffixes', 'png', 'fast/dom/prototype-strawberry.html'],
- ['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt', 'fast/dom/prototype-taco.html'],
- ],
- ['git', 'cl', 'upload', '-f'],
- ['git', 'pull'],
- ['git', 'cl', 'land', '-f', '-v'],
- ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'],
- ])
+ self.assertEqual(self.tool.executive.calls, [
+ [
+ ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,png',
+ '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-chocolate.html'],
+ ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'png',
+ '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-strawberry.html'],
+ ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'txt',
+ '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-taco.html'],
+ ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'txt',
+ '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.html'],
+ ],
+ [
+ ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png',
+ '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-chocolate.html'],
+ ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder',
+ 'MOCK Mac10.11', '--test', 'fast/dom/prototype-strawberry.html'],
+ ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt',
+ '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/prototype-taco.html'],
+ ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt',
+ '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.html'],
+ ],
+ [
+ ['python', 'echo', 'optimize-baselines', '--no-modify-scm',
+ '--suffixes', 'txt,png', 'fast/dom/prototype-chocolate.html'],
+ ['python', 'echo', 'optimize-baselines', '--no-modify-scm',
+ '--suffixes', 'png', 'fast/dom/prototype-strawberry.html'],
+ ['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt', 'fast/dom/prototype-taco.html'],
+ ],
+ ['git', 'cl', 'upload', '-f'],
+ ['git', 'pull'],
+ ['git', 'cl', 'land', '-f', '-v'],
+ ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'],
+ ])
- # The mac ports should both be removed since they're the only ones in builders._exact_matches.
- self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """
+ # The mac ports should both be removed since they're the only ones in builders._exact_matches.
+ self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """
crbug.com/24182 [ Debug ] path/to/norebaseline.html [ Rebaseline ]
Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
crbug.com/24182 [ Linux Win ] fast/dom/prototype-chocolate.html [ NeedsRebaseline ]
crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ]
crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ]
""")
- finally:
- builders._exact_matches = old_exact_matches
def test_execute_git_cl_hangs(self):
def blame(path):
@@ -1225,32 +1178,28 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents")
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
- }
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
+ })
- self.command.SECONDS_BEFORE_GIVING_UP = 0
- self.command.tree_status = lambda: 'open'
- self.tool.executive = MockExecutive()
- self.tool.executive.calls = []
- self._execute_command_with_mock_options()
+ self.command.SECONDS_BEFORE_GIVING_UP = 0
+ self.command.tree_status = lambda: 'open'
+ self.tool.executive = MockExecutive()
+ self.tool.executive.calls = []
+ self._execute_command_with_mock_options()
- self.assertEqual(self.tool.executive.calls, [
- [
- ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'txt',
- '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.html'],
- ],
- [
- ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt',
- '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.html'],
- ],
- [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt', 'fast/dom/prototype-taco.html']],
- ['git', 'cl', 'upload', '-f'],
- ])
- finally:
- builders._exact_matches = old_exact_matches
+ self.assertEqual(self.tool.executive.calls, [
+ [
+ ['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'txt',
+ '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.html'],
+ ],
+ [
+ ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt',
+ '--builder', 'MOCK Mac10.11', '--test', 'fast/dom/prototype-taco.html'],
+ ],
+ [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt', 'fast/dom/prototype-taco.html']],
+ ['git', 'cl', 'upload', '-f'],
+ ])
def test_execute_test_passes_everywhere(self):
def blame(path):
@@ -1289,28 +1238,24 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
self.tool.executive = MockLineRemovingExecutive()
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
- }
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
+ })
- self.command.tree_status = lambda: 'open'
- self._execute_command_with_mock_options()
- self.assertEqual(self.tool.executive.calls, [
- ['git', 'cl', 'upload', '-f'],
- ['git', 'pull'],
- ['git', 'cl', 'land', '-f', '-v'],
- ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'],
- ])
+ self.command.tree_status = lambda: 'open'
+ self._execute_command_with_mock_options()
+ self.assertEqual(self.tool.executive.calls, [
+ ['git', 'cl', 'upload', '-f'],
+ ['git', 'pull'],
+ ['git', 'cl', 'land', '-f', '-v'],
+ ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'],
+ ])
- # The mac ports should both be removed since they're the only ones in builders._exact_matches.
- self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """
+ # The mac ports should both be removed since they're the only ones in builders._exact_matches.
+ self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """
Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
""")
- finally:
- builders._exact_matches = old_exact_matches
def test_execute_use_alternate_rebaseline_branch(self):
def blame(path):
@@ -1349,13 +1294,11 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
self.tool.executive = MockLineRemovingExecutive()
- old_exact_matches = builders._exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Win": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
+ })
old_branch_name = webkitpy.tool.commands.rebaseline._get_branch_name_or_ref
try:
- builders._exact_matches = {
- "MOCK Win": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
- }
-
self.command.tree_status = lambda: 'open'
webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = lambda x: 'auto-rebaseline-temporary-branch'
self._execute_command_with_mock_options()
@@ -1370,7 +1313,6 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
""")
finally:
- builders._exact_matches = old_exact_matches
webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = old_branch_name
def test_execute_stuck_on_alternate_rebaseline_branch(self):
@@ -1410,13 +1352,12 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
self.tool.executive = MockLineRemovingExecutive()
- old_exact_matches = builders._exact_matches
+ self.tool.builders = FakeBuilders({
+ "MOCK Win": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
+ })
+
old_branch_name = webkitpy.tool.commands.rebaseline._get_branch_name_or_ref
try:
- builders._exact_matches = {
- "MOCK Win": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
- }
-
self.command.tree_status = lambda: 'open'
webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = lambda x: 'auto-rebaseline-alt-temporary-branch'
self._execute_command_with_mock_options()
@@ -1431,7 +1372,6 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
Bug(foo) [ Linux Mac Win10 ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
""")
finally:
- builders._exact_matches = old_exact_matches
webkitpy.tool.commands.rebaseline._get_branch_name_or_ref = old_branch_name
def _basic_execute_test(self, expected_executive_calls, auth_refresh_token_json=None, commit_author=None, dry_run=False):
@@ -1471,24 +1411,20 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
self.tool.executive = MockLineRemovingExecutive()
- old_exact_matches = builders._exact_matches
- try:
- builders._exact_matches = {
- "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
- "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
- }
+ self.tool.builders = FakeBuilders({
+ "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": set(["mock-specifier"])},
+ "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": set(["mock-specifier"])},
+ })
- self.command.tree_status = lambda: 'open'
- self._execute_command_with_mock_options(auth_refresh_token_json=auth_refresh_token_json,
- commit_author=commit_author, dry_run=dry_run)
- self.assertEqual(self.tool.executive.calls, expected_executive_calls)
+ self.command.tree_status = lambda: 'open'
+ self._execute_command_with_mock_options(auth_refresh_token_json=auth_refresh_token_json,
+ commit_author=commit_author, dry_run=dry_run)
+ self.assertEqual(self.tool.executive.calls, expected_executive_calls)
- # The mac ports should both be removed since they're the only ones in builders._exact_matches.
- self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """
+ # The mac ports should both be removed since they're the only ones in builders._exact_matches.
+ self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """
Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
""")
- finally:
- builders._exact_matches = old_exact_matches
def test_execute_with_rietveld_auth_refresh_token(self):
RIETVELD_REFRESH_TOKEN = '/creds/refresh_tokens/test_rietveld_token'
« 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