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

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

Issue 1187483002: Setup git-svn and handle detached HEAD state in auto-rebaseline script. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: git auto-svn only when neccessary, add tests Created 5 years, 6 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
Index: Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
diff --git a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
index 96f06c34bfd32c78281ce8433a9adc73710e5810..d7a60ee685569b43a3176cb0e81fdc6ed6b3ca70 100644
--- a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
+++ b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
@@ -875,6 +875,7 @@ class TestAnalyzeBaselines(_BaseTestCase):
class TestAutoRebaseline(_BaseTestCase):
+ SVN_REMOTE_CMD = ['git', 'config', '--local', '--get-regexp', '^svn-remote\\.']
command_constructor = AutoRebaseline
def _write_test_file(self, port, path, contents):
@@ -982,7 +983,7 @@ TBR=foo@chromium.org
"""
self.tool.scm().blame = blame
- self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool)
+ self.command.execute(MockOptions(optimize=True, verbose=False, results_directory=False), [], self.tool)
self.assertEqual(self.tool.executive.calls, [])
def test_execute(self):
@@ -1044,7 +1045,8 @@ crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ]
self._write_test_file(test_port, 'fast/dom/prototype-strawberry.html', "Dummy test contents")
self._write_test_file(test_port, 'fast/dom/prototype-chocolate.html', "Dummy test contents")
- self.tool.executive = MockLineRemovingExecutive()
+ self.tool.executive = MockLineRemovingExecutive(
+ should_return_zero_when_run=set(self.SVN_REMOTE_CMD))
old_exact_matches = builders._exact_matches
try:
@@ -1054,14 +1056,16 @@ crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ]
}
self.command.tree_status = lambda: 'closed'
- self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool)
+ self.command.execute(MockOptions(optimize=True, verbose=False, results_directory=False), [], self.tool)
self.assertEqual(self.tool.executive.calls, [])
self.command.tree_status = lambda: 'open'
self.tool.executive.calls = []
- self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool)
+ self.command.execute(MockOptions(optimize=True, verbose=False, results_directory=False), [], self.tool)
self.assertEqual(self.tool.executive.calls, [
+ self.SVN_REMOTE_CMD,
+ ['git', 'rev-parse', '--symbolic-full-name', 'HEAD'],
[
['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,png', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-chocolate.html'],
['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'png', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-strawberry.html'],
@@ -1141,10 +1145,14 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
self.command.SECONDS_BEFORE_GIVING_UP = 0
self.command.tree_status = lambda: 'open'
+ self.tool.executive = MockExecutive(
+ should_return_zero_when_run=set(self.SVN_REMOTE_CMD))
self.tool.executive.calls = []
- self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool)
+ self.command.execute(MockOptions(optimize=True, verbose=False, results_directory=False), [], self.tool)
self.assertEqual(self.tool.executive.calls, [
+ self.SVN_REMOTE_CMD,
+ ['git', 'rev-parse', '--symbolic-full-name', 'HEAD'],
[
['python', 'echo', 'copy-existing-baselines-internal', '--suffixes', 'txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-taco.html'],
],
@@ -1192,7 +1200,8 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents")
- self.tool.executive = MockLineRemovingExecutive()
+ self.tool.executive = MockLineRemovingExecutive(
+ should_return_zero_when_run=set(self.SVN_REMOTE_CMD))
old_exact_matches = builders._exact_matches
try:
@@ -1202,8 +1211,10 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
}
self.command.tree_status = lambda: 'open'
- self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool)
+ self.command.execute(MockOptions(optimize=True, verbose=False, results_directory=False), [], self.tool)
self.assertEqual(self.tool.executive.calls, [
+ self.SVN_REMOTE_CMD,
+ ['git', 'rev-parse', '--symbolic-full-name', 'HEAD'],
[['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', '', 'fast/dom/prototype-taco.html']],
['git', 'cl', 'upload', '-f'],
['git', 'pull'],
@@ -1218,6 +1229,68 @@ Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
finally:
builders._exact_matches = old_exact_matches
+ def test_execute_setup_git_svn(self):
+ def blame(path):
+ return """
+6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
+"""
+ self.tool.scm().blame = blame
+
+ test_port = self._setup_test_port()
+
+ old_builder_data = self.command.builder_data
+
+ def builder_data():
+ self.command._builder_data['MOCK Win'] = LayoutTestResults.results_from_string("""ADD_RESULTS({
+ "tests": {
+ "fast": {
+ "dom": {
+ "prototype-taco.html": {
+ "expected": "FAIL",
+ "actual": "PASS",
+ "is_unexpected": true
+ }
+ }
+ }
+ }
+});""")
+ return self.command._builder_data
+
+ self.command.builder_data = builder_data
+
+ self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expectations_file(), """
+Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
+""")
+
+ self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents")
+
+ self.tool.executive = MockLineRemovingExecutive()
+
+ old_exact_matches = builders._exact_matches
+ try:
+ builders._exact_matches = {
+ "MOCK Win": {"port_name": "test-win-win7", "specifiers": set(["mock-specifier"])},
+ }
+
+ self.command.tree_status = lambda: 'open'
+ self.command.execute(MockOptions(optimize=True, verbose=False, results_directory=False), [], self.tool)
+ self.assertEqual(self.tool.executive.calls, [
+ self.SVN_REMOTE_CMD,
+ ['git', 'auto-svn'],
+ ['git', 'rev-parse', '--symbolic-full-name', 'HEAD'],
+ [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', '', 'fast/dom/prototype-taco.html']],
+ ['git', 'cl', 'upload', '-f'],
+ ['git', 'pull'],
+ ['git', 'cl', 'dcommit', '-f'],
+ ['git', 'cl', 'set_close'],
+ ])
+
+ self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_generic_test_expectations_file()), """
+Bug(foo) [ Linux Mac XP ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
+""")
+ finally:
+ builders._exact_matches = old_exact_matches
+
class TestRebaselineOMatic(_BaseTestCase):
command_constructor = RebaselineOMatic

Powered by Google App Engine
This is Rietveld 408576698