Index: tools/push-to-trunk/test_scripts.py |
diff --git a/tools/push-to-trunk/test_scripts.py b/tools/push-to-trunk/test_scripts.py |
index 9107db97ec5762a8783f21536e935df1e2aade25..f1fe46f106629bea9dd9d300e5f218232f401f91 100644 |
--- a/tools/push-to-trunk/test_scripts.py |
+++ b/tools/push-to-trunk/test_scripts.py |
@@ -34,6 +34,7 @@ import unittest |
import auto_push |
from auto_push import CheckLastPush |
from auto_push import SETTINGS_LOCATION |
+import auto_roll |
import common_includes |
from common_includes import * |
import merge_to_branch |
@@ -261,7 +262,7 @@ class SimpleMock(object): |
# arguments. |
if len(args) > len(expected_call['args']): |
raise NoRetryException("When calling %s with arguments, the " |
- "expectations must consist of at least as many arguments.") |
+ "expectations must consist of at least as many arguments." % name) |
# Compare expected and actual arguments. |
for (expected_arg, actual_arg) in zip(expected_call['args'], args): |
@@ -908,6 +909,70 @@ Performance and stability improvements on all platforms.""", commit) |
auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS) |
self.assertRaises(Exception, RunAutoPush) |
+ def testAutoRollExistingRoll(self): |
+ self.ExpectReadURL([ |
+ URL("https://codereview.chromium.org/search", |
+ "owner=author%40chromium.org&limit=30&closed=3&format=json", |
+ ("{\"results\": [{\"subject\": \"different\"}," |
+ "{\"subject\": \"Update V8 to Version...\"}]}")), |
+ ]) |
+ |
+ result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
+ AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]]) |
+ self.assertEquals(1, result) |
+ |
+ # Snippet from the original DEPS file. |
+ FAKE_DEPS = """ |
+vars = { |
+ "v8_revision": "123455", |
+} |
+deps = { |
+ "src/v8": |
+ (Var("googlecode_url") % "v8") + "/" + Var("v8_branch") + "@" + |
+ Var("v8_revision"), |
+} |
+""" |
+ |
+ def testAutoRollUpToDate(self): |
+ self.ExpectReadURL([ |
+ URL("https://codereview.chromium.org/search", |
+ "owner=author%40chromium.org&limit=30&closed=3&format=json", |
+ ("{\"results\": [{\"subject\": \"different\"}]}")), |
+ URL("http://src.chromium.org/svn/trunk/src/DEPS", |
+ self.FAKE_DEPS), |
+ ]) |
+ |
+ self.ExpectGit([ |
+ Git(("log -1 --format=%H --grep=" |
+ "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " |
+ "svn/trunk"), "push_hash\n"), |
+ Git("svn find-rev push_hash", "123455\n"), |
+ ]) |
+ |
+ result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
+ AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]]) |
+ self.assertEquals(1, result) |
+ |
+ def testAutoRoll(self): |
+ self.ExpectReadURL([ |
+ URL("https://codereview.chromium.org/search", |
+ "owner=author%40chromium.org&limit=30&closed=3&format=json", |
+ ("{\"results\": [{\"subject\": \"different\"}]}")), |
+ URL("http://src.chromium.org/svn/trunk/src/DEPS", |
+ self.FAKE_DEPS), |
+ ]) |
+ |
+ self.ExpectGit([ |
+ Git(("log -1 --format=%H --grep=" |
+ "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " |
+ "svn/trunk"), "push_hash\n"), |
+ Git("svn find-rev push_hash", "123456\n"), |
+ ]) |
+ |
+ result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
+ AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM], "--roll"]) |
+ self.assertEquals(0, result) |
+ |
def testMergeToBranch(self): |
TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile() |
TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |