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

Side by Side Diff: tools/push-to-trunk/test_scripts.py

Issue 212983003: Implement auto-roll script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review Created 6 years, 8 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
« no previous file with comments | « tools/push-to-trunk/common_includes.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 the V8 project authors. All rights reserved. 2 # Copyright 2013 the V8 project authors. All rights reserved.
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 10 # copyright notice, this list of conditions and the following
(...skipping 16 matching lines...) Expand all
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 import os 29 import os
30 import tempfile 30 import tempfile
31 import traceback 31 import traceback
32 import unittest 32 import unittest
33 33
34 import auto_push 34 import auto_push
35 from auto_push import CheckLastPush 35 from auto_push import CheckLastPush
36 from auto_push import SETTINGS_LOCATION 36 from auto_push import SETTINGS_LOCATION
37 import auto_roll
37 import common_includes 38 import common_includes
38 from common_includes import * 39 from common_includes import *
39 import merge_to_branch 40 import merge_to_branch
40 from merge_to_branch import * 41 from merge_to_branch import *
41 import push_to_trunk 42 import push_to_trunk
42 from push_to_trunk import * 43 from push_to_trunk import *
43 import chromium_roll 44 import chromium_roll
44 from chromium_roll import CHROMIUM 45 from chromium_roll import CHROMIUM
45 from chromium_roll import DEPS_FILE 46 from chromium_roll import DEPS_FILE
46 from chromium_roll import ChromiumRoll 47 from chromium_roll import ChromiumRoll
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 255
255 if not isinstance(expected_call, dict): 256 if not isinstance(expected_call, dict):
256 raise NoRetryException("Found wrong expectation type for %s %s" 257 raise NoRetryException("Found wrong expectation type for %s %s"
257 % (name, " ".join(args))) 258 % (name, " ".join(args)))
258 259
259 260
260 # The number of arguments in the expectation must match the actual 261 # The number of arguments in the expectation must match the actual
261 # arguments. 262 # arguments.
262 if len(args) > len(expected_call['args']): 263 if len(args) > len(expected_call['args']):
263 raise NoRetryException("When calling %s with arguments, the " 264 raise NoRetryException("When calling %s with arguments, the "
264 "expectations must consist of at least as many arguments.") 265 "expectations must consist of at least as many arguments." % name)
265 266
266 # Compare expected and actual arguments. 267 # Compare expected and actual arguments.
267 for (expected_arg, actual_arg) in zip(expected_call['args'], args): 268 for (expected_arg, actual_arg) in zip(expected_call['args'], args):
268 if expected_arg != actual_arg: 269 if expected_arg != actual_arg:
269 raise NoRetryException("Expected: %s - Actual: %s" 270 raise NoRetryException("Expected: %s - Actual: %s"
270 % (expected_arg, actual_arg)) 271 % (expected_arg, actual_arg))
271 272
272 # The expected call contains an optional callback for checking the context 273 # The expected call contains an optional callback for checking the context
273 # at the time of the call. 274 # at the time of the call.
274 if expected_call['cb']: 275 if expected_call['cb']:
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 self.ExpectGit([ 902 self.ExpectGit([
902 Git("status -s -uno", ""), 903 Git("status -s -uno", ""),
903 Git("status -s -b -uno", "## some_branch\n"), 904 Git("status -s -b -uno", "## some_branch\n"),
904 Git("svn fetch", ""), 905 Git("svn fetch", ""),
905 ]) 906 ])
906 907
907 def RunAutoPush(): 908 def RunAutoPush():
908 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS) 909 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS)
909 self.assertRaises(Exception, RunAutoPush) 910 self.assertRaises(Exception, RunAutoPush)
910 911
912 def testAutoRollExistingRoll(self):
913 self.ExpectReadURL([
914 URL("https://codereview.chromium.org/search",
915 "owner=author%40chromium.org&limit=30&closed=3&format=json",
916 ("{\"results\": [{\"subject\": \"different\"},"
917 "{\"subject\": \"Update V8 to Version...\"}]}")),
918 ])
919
920 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
921 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]])
922 self.assertEquals(1, result)
923
924 # Snippet from the original DEPS file.
925 FAKE_DEPS = """
926 vars = {
927 "v8_revision": "123455",
928 }
929 deps = {
930 "src/v8":
931 (Var("googlecode_url") % "v8") + "/" + Var("v8_branch") + "@" +
932 Var("v8_revision"),
933 }
934 """
935
936 def testAutoRollUpToDate(self):
937 self.ExpectReadURL([
938 URL("https://codereview.chromium.org/search",
939 "owner=author%40chromium.org&limit=30&closed=3&format=json",
940 ("{\"results\": [{\"subject\": \"different\"}]}")),
941 URL("http://src.chromium.org/svn/trunk/src/DEPS",
942 self.FAKE_DEPS),
943 ])
944
945 self.ExpectGit([
946 Git(("log -1 --format=%H --grep="
947 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" "
948 "svn/trunk"), "push_hash\n"),
949 Git("svn find-rev push_hash", "123455\n"),
950 ])
951
952 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
953 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]])
954 self.assertEquals(1, result)
955
956 def testAutoRoll(self):
957 self.ExpectReadURL([
958 URL("https://codereview.chromium.org/search",
959 "owner=author%40chromium.org&limit=30&closed=3&format=json",
960 ("{\"results\": [{\"subject\": \"different\"}]}")),
961 URL("http://src.chromium.org/svn/trunk/src/DEPS",
962 self.FAKE_DEPS),
963 ])
964
965 self.ExpectGit([
966 Git(("log -1 --format=%H --grep="
967 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" "
968 "svn/trunk"), "push_hash\n"),
969 Git("svn find-rev push_hash", "123456\n"),
970 ])
971
972 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
973 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM], "--roll"])
974 self.assertEquals(0, result)
975
911 def testMergeToBranch(self): 976 def testMergeToBranch(self):
912 TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile() 977 TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile()
913 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 978 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
914 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() 979 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
915 self.WriteFakeVersionFile(build=5) 980 self.WriteFakeVersionFile(build=5)
916 os.environ["EDITOR"] = "vi" 981 os.environ["EDITOR"] = "vi"
917 extra_patch = self.MakeEmptyTempFile() 982 extra_patch = self.MakeEmptyTempFile()
918 983
919 def VerifyPatch(patch): 984 def VerifyPatch(patch):
920 return lambda: self.assertEquals(patch, 985 return lambda: self.assertEquals(patch,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 1116
1052 Review URL: https://codereview.chromium.org/83173002 1117 Review URL: https://codereview.chromium.org/83173002
1053 1118
1054 ------------------------------------------------------------------------""") 1119 ------------------------------------------------------------------------""")
1055 self.assertEquals( 1120 self.assertEquals(
1056 """Prepare push to trunk. Now working on version 3.23.11. 1121 """Prepare push to trunk. Now working on version 3.23.11.
1057 1122
1058 R=danno@chromium.org 1123 R=danno@chromium.org
1059 1124
1060 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1125 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698