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 1208c52b3eb055c1cca0e2f343d6389fdebb001d..d6fa5c9ccc775c5945f8bd21ca5b7db99f454a71 100644 |
--- a/tools/push-to-trunk/test_scripts.py |
+++ b/tools/push-to-trunk/test_scripts.py |
@@ -294,13 +294,13 @@ class ScriptTest(unittest.TestCase): |
self._tmp_files.append(name) |
return name |
- def WriteFakeVersionFile(self): |
+ def WriteFakeVersionFile(self, build=4): |
with open(TEST_CONFIG[VERSION_FILE], "w") as f: |
f.write(" // Some line...\n") |
f.write("\n") |
f.write("#define MAJOR_VERSION 3\n") |
f.write("#define MINOR_VERSION 22\n") |
- f.write("#define BUILD_NUMBER 5\n") |
+ f.write("#define BUILD_NUMBER %s\n" % build) |
f.write("#define PATCH_LEVEL 0\n") |
f.write(" // Some line...\n") |
f.write("#define IS_CANDIDATE_VERSION 0\n") |
@@ -440,7 +440,7 @@ class ScriptTest(unittest.TestCase): |
def testReadAndPersistVersion(self): |
TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
- self.WriteFakeVersionFile() |
+ self.WriteFakeVersionFile(build=5) |
step = self.MakeStep() |
step.ReadAndPersistVersion() |
self.assertEquals("3", step["major"]) |
@@ -499,6 +499,7 @@ class ScriptTest(unittest.TestCase): |
]) |
self._state["last_push_bleeding_edge"] = "1234" |
+ self._state["version"] = "3.22.5" |
self.RunStep(PushToTrunk, PrepareChangeLog) |
actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]) |
@@ -530,10 +531,6 @@ class ScriptTest(unittest.TestCase): |
#""" |
self.assertEquals(expected_cl, actual_cl) |
- self.assertEquals("3", self._state["major"]) |
- self.assertEquals("22", self._state["minor"]) |
- self.assertEquals("5", self._state["build"]) |
- self.assertEquals("0", self._state["patch"]) |
def testEditChangeLog(self): |
TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
@@ -552,7 +549,11 @@ class ScriptTest(unittest.TestCase): |
def testIncrementVersion(self): |
TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
self.WriteFakeVersionFile() |
- self._state["build"] = "5" |
+ self._state["last_push_trunk"] = "hash1" |
+ |
+ self.ExpectGit([ |
+ Git("checkout -f hash1 -- %s" % TEST_CONFIG[VERSION_FILE], "") |
+ ]) |
self.ExpectReadline([ |
RL("Y"), # Increment build number. |
@@ -562,7 +563,7 @@ class ScriptTest(unittest.TestCase): |
self.assertEquals("3", self._state["new_major"]) |
self.assertEquals("22", self._state["new_minor"]) |
- self.assertEquals("6", self._state["new_build"]) |
+ self.assertEquals("5", self._state["new_build"]) |
self.assertEquals("0", self._state["new_patch"]) |
def _TestSquashCommits(self, change_log, expected_msg): |
@@ -619,8 +620,12 @@ Performance and stability improvements on all platforms.""" |
def _PushToTrunk(self, force=False, manual=False): |
TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
+ |
+ # The version file on bleeding edge has build level 5, while the version |
+ # file from trunk has build level 4. |
TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
- self.WriteFakeVersionFile() |
+ self.WriteFakeVersionFile(build=5) |
+ |
TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() |
if not os.path.exists(TEST_CONFIG[CHROMIUM]): |
@@ -698,6 +703,8 @@ Performance and stability improvements on all platforms.""", commit) |
Git("log -1 --format=%s hash2", |
"Version 3.4.5 (based on bleeding_edge revision r1234)\n"), |
Git("svn find-rev r1234", "hash3\n"), |
+ Git("checkout -f hash2 -- %s" % TEST_CONFIG[VERSION_FILE], "", |
+ cb=self.WriteFakeVersionFile), |
Git("log --format=%H hash3..HEAD", "rev1\n"), |
Git("log -1 --format=%s rev1", "Log text 1.\n"), |
Git("log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), |
@@ -886,7 +893,7 @@ Performance and stability improvements on all platforms.""", commit) |
TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile() |
TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
- self.WriteFakeVersionFile() |
+ self.WriteFakeVersionFile(build=5) |
os.environ["EDITOR"] = "vi" |
extra_patch = self.MakeEmptyTempFile() |