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

Side by Side 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: fix 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 unified diff | Download patch | Annotate | Revision Log
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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 """) 976 """)
977 977
978 def test_no_needs_rebaseline_lines(self): 978 def test_no_needs_rebaseline_lines(self):
979 def blame(path): 979 def blame(path):
980 return """ 980 return """
981 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.ht ml [ ImageOnlyFailure ] 981 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.ht ml [ ImageOnlyFailure ]
982 """ 982 """
983 self.tool.scm().blame = blame 983 self.tool.scm().blame = blame
984 984
985 self.command.execute(MockOptions(optimize=True, verbose=False, move_over written_baselines=False, results_directory=False), [], self.tool) 985 self.command.execute(MockOptions(optimize=True, verbose=False, move_over written_baselines=False, results_directory=False), [], self.tool)
986 self.assertEqual(self.tool.executive.calls, []) 986 self.assertEqual(self.tool.executive.calls, [['git', 'auto-svn']])
987 987
988 def test_execute(self): 988 def test_execute(self):
989 def blame(path): 989 def blame(path):
990 return """ 990 return """
991 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-06-14 20:18:46 +0000 11) # Test NeedsRebaseline being in a comment doesn't bork parsing. 991 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-06-14 20:18:46 +0000 11) # Test NeedsRebaseline being in a comment doesn't bork parsing.
992 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.ht ml [ ImageOnlyFailure ] 992 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.ht ml [ ImageOnlyFailure ]
993 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsReba seline ] 993 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsReba seline ]
994 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-06-14 20:18:46 +0000 11) crbug.com/24182 [ SnowLeopard ] fast/dom/prototyp e-strawberry.html [ NeedsRebaseline ] 994 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-06-14 20:18:46 +0000 11) crbug.com/24182 [ SnowLeopard ] fast/dom/prototyp e-strawberry.html [ NeedsRebaseline ]
995 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-04-28 04:52:41 +0000 12) crbug.com/24182 fast/dom/prototype-chocolate.html [ NeedsRebaseline ] 995 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2 013-04-28 04:52:41 +0000 12) crbug.com/24182 fast/dom/prototype-chocolate.html [ NeedsRebaseline ]
996 624caaaaaa path/to/TestExpectations (foo@chromium.org 2 013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots.h tml [ NeedsRebaseline ] 996 624caaaaaa path/to/TestExpectations (foo@chromium.org 2 013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots.h tml [ NeedsRebaseline ]
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 1048
1049 old_exact_matches = builders._exact_matches 1049 old_exact_matches = builders._exact_matches
1050 try: 1050 try:
1051 builders._exact_matches = { 1051 builders._exact_matches = {
1052 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])}, 1052 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])},
1053 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci fiers": set(["mock-specifier"])}, 1053 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci fiers": set(["mock-specifier"])},
1054 } 1054 }
1055 1055
1056 self.command.tree_status = lambda: 'closed' 1056 self.command.tree_status = lambda: 'closed'
1057 self.command.execute(MockOptions(optimize=True, verbose=False, move_ overwritten_baselines=False, results_directory=False), [], self.tool) 1057 self.command.execute(MockOptions(optimize=True, verbose=False, move_ overwritten_baselines=False, results_directory=False), [], self.tool)
1058 self.assertEqual(self.tool.executive.calls, []) 1058 self.assertEqual(self.tool.executive.calls, [['git', 'auto-svn']])
1059 1059
1060 self.command.tree_status = lambda: 'open' 1060 self.command.tree_status = lambda: 'open'
1061 self.tool.executive.calls = [] 1061 self.tool.executive.calls = []
1062 self.command.execute(MockOptions(optimize=True, verbose=False, move_ overwritten_baselines=False, results_directory=False), [], self.tool) 1062 self.command.execute(MockOptions(optimize=True, verbose=False, move_ overwritten_baselines=False, results_directory=False), [], self.tool)
1063 1063
1064 self.assertEqual(self.tool.executive.calls, [ 1064 self.assertEqual(self.tool.executive.calls, [
1065 ['git', 'auto-svn'],
1066 ['git', 'rev-parse', '--symbolic-full-name', 'HEAD'],
1065 [ 1067 [
1066 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt,png', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-c hocolate.html'], 1068 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt,png', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-c hocolate.html'],
1067 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'png', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-s trawberry.html'], 1069 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'png', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-s trawberry.html'],
1068 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-taco. html'], 1070 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-taco. html'],
1069 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-t aco.html'], 1071 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-t aco.html'],
1070 ], 1072 ],
1071 [ 1073 [
1072 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-chocolate .html'], 1074 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-chocolate .html'],
1073 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-strawberr y.html'], 1075 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'png', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-strawberr y.html'],
1074 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-taco.html'], 1076 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-taco.html'],
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 builders._exact_matches = { 1140 builders._exact_matches = {
1139 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci fiers": set(["mock-specifier"])}, 1141 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci fiers": set(["mock-specifier"])},
1140 } 1142 }
1141 1143
1142 self.command.SECONDS_BEFORE_GIVING_UP = 0 1144 self.command.SECONDS_BEFORE_GIVING_UP = 0
1143 self.command.tree_status = lambda: 'open' 1145 self.command.tree_status = lambda: 'open'
1144 self.tool.executive.calls = [] 1146 self.tool.executive.calls = []
1145 self.command.execute(MockOptions(optimize=True, verbose=False, move_ overwritten_baselines=False, results_directory=False), [], self.tool) 1147 self.command.execute(MockOptions(optimize=True, verbose=False, move_ overwritten_baselines=False, results_directory=False), [], self.tool)
1146 1148
1147 self.assertEqual(self.tool.executive.calls, [ 1149 self.assertEqual(self.tool.executive.calls, [
1150 ['git', 'auto-svn'],
1151 ['git', 'rev-parse', '--symbolic-full-name', 'HEAD'],
1148 [ 1152 [
1149 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-t aco.html'], 1153 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-t aco.html'],
1150 ], 1154 ],
1151 [ 1155 [
1152 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-taco.html '], 1156 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-taco.html '],
1153 ], 1157 ],
1154 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', 'txt', 'fast/dom/prototype-taco.html']], 1158 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', 'txt', 'fast/dom/prototype-taco.html']],
1155 ['git', 'cl', 'upload', '-f'], 1159 ['git', 'cl', 'upload', '-f'],
1156 ]) 1160 ])
1157 finally: 1161 finally:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 old_exact_matches = builders._exact_matches 1201 old_exact_matches = builders._exact_matches
1198 try: 1202 try:
1199 builders._exact_matches = { 1203 builders._exact_matches = {
1200 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])}, 1204 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])},
1201 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci fiers": set(["mock-specifier"])}, 1205 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci fiers": set(["mock-specifier"])},
1202 } 1206 }
1203 1207
1204 self.command.tree_status = lambda: 'open' 1208 self.command.tree_status = lambda: 'open'
1205 self.command.execute(MockOptions(optimize=True, verbose=False, move_ overwritten_baselines=False, results_directory=False), [], self.tool) 1209 self.command.execute(MockOptions(optimize=True, verbose=False, move_ overwritten_baselines=False, results_directory=False), [], self.tool)
1206 self.assertEqual(self.tool.executive.calls, [ 1210 self.assertEqual(self.tool.executive.calls, [
1211 ['git', 'auto-svn'],
1212 ['git', 'rev-parse', '--symbolic-full-name', 'HEAD'],
1207 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', '', 'fast/dom/prototype-taco.html']], 1213 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', '', 'fast/dom/prototype-taco.html']],
1208 ['git', 'cl', 'upload', '-f'], 1214 ['git', 'cl', 'upload', '-f'],
1209 ['git', 'pull'], 1215 ['git', 'pull'],
1210 ['git', 'cl', 'dcommit', '-f'], 1216 ['git', 'cl', 'dcommit', '-f'],
1211 ['git', 'cl', 'set_close'], 1217 ['git', 'cl', 'set_close'],
1212 ]) 1218 ])
1213 1219
1214 # The mac ports should both be removed since they're the only ones i n builders._exact_matches. 1220 # The mac ports should both be removed since they're the only ones i n builders._exact_matches.
1215 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """ 1221 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_ to_generic_test_expectations_file()), """
1216 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] 1222 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ]
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 oc.capture_output() 1266 oc.capture_output()
1261 self.command._do_one_rebaseline() 1267 self.command._do_one_rebaseline()
1262 out, _, _ = oc.restore_output() 1268 out, _, _ = oc.restore_output()
1263 1269
1264 self.assertEqual(out, 'MOCK STDOUT\n') 1270 self.assertEqual(out, 'MOCK STDOUT\n')
1265 self.assertEqual(self.tool.executive.calls, [ 1271 self.assertEqual(self.tool.executive.calls, [
1266 ['git', 'pull'], 1272 ['git', 'pull'],
1267 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au to-rebaseline', '--verbose'], 1273 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au to-rebaseline', '--verbose'],
1268 ]) 1274 ])
1269 self.assertEqual(self._logs, ['MOCK STDOUT']) 1275 self.assertEqual(self._logs, ['MOCK STDOUT'])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698