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

Unified Diff: tools/push-to-trunk/test_scripts.py

Issue 389353003: Add script to bump up version on bleeding edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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
« no previous file with comments | « tools/push-to-trunk/releases.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0c71bba929abaf208b6c393337df310edaa022e9..f03cec63ac63dde4abb4554b820396ad512a1036 100644
--- a/tools/push-to-trunk/test_scripts.py
+++ b/tools/push-to-trunk/test_scripts.py
@@ -48,6 +48,10 @@ from chromium_roll import DEPS_FILE
from chromium_roll import ChromiumRoll
import releases
from releases import Releases
+import bump_up_version
+from bump_up_version import BumpUpVersion
+from bump_up_version import LastChangeBailout
+from bump_up_version import LKGRVersionUpToDateBailout
TEST_CONFIG = {
@@ -352,7 +356,7 @@ class ScriptTest(unittest.TestCase):
def RunStep(self, script=PushToTrunk, step_class=Step, args=None):
"""Convenience wrapper."""
- args = args or ["-m"]
+ args = args if args is not None else ["-m"]
return script(TEST_CONFIG, self, self._state).RunSteps([step_class], args)
def GitMock(self, cmd, args="", pipe=True):
@@ -597,13 +601,19 @@ class ScriptTest(unittest.TestCase):
self.assertEquals("New\n Lines",
FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]))
+ # Version on trunk: 3.22.4.0. Version on master (bleeding_edge): 3.22.6.
+ # Make sure that the increment is 3.22.7.0.
def testIncrementVersion(self):
TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
self.WriteFakeVersionFile()
self._state["last_push_trunk"] = "hash1"
+ self._state["latest_build"] = "6"
+ self._state["latest_version"] = "3.22.6.0"
self.ExpectGit([
- Git("checkout -f hash1 -- %s" % TEST_CONFIG[VERSION_FILE], "")
+ Git("checkout -f hash1 -- %s" % TEST_CONFIG[VERSION_FILE], ""),
+ Git("checkout -f master -- %s" % TEST_CONFIG[VERSION_FILE], "",
+ cb=lambda: self.WriteFakeVersionFile(22, 6)),
])
self.ExpectReadline([
@@ -614,7 +624,7 @@ class ScriptTest(unittest.TestCase):
self.assertEquals("3", self._state["new_major"])
self.assertEquals("22", self._state["new_minor"])
- self.assertEquals("5", self._state["new_build"])
+ self.assertEquals("7", self._state["new_build"])
self.assertEquals("0", self._state["new_patch"])
def _TestSquashCommits(self, change_log, expected_msg):
@@ -741,6 +751,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 master -- %s" % TEST_CONFIG[VERSION_FILE], "",
+ cb=self.WriteFakeVersionFile),
Git("checkout -f hash2 -- %s" % TEST_CONFIG[VERSION_FILE], "",
cb=self.WriteFakeVersionFile),
Git("log --format=%H hash3..push_hash", "rev1\n"),
@@ -1266,6 +1278,92 @@ LOG=N
self.assertEquals(expected_json, json.loads(FileToText(json_output)))
+ def testBumpUpVersion(self):
+ TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
+ self.WriteFakeVersionFile()
+
+ def ResetVersion(minor, build, patch=0):
+ return lambda: self.WriteFakeVersionFile(minor=minor,
+ build=build,
+ patch=patch)
+
+ self.ExpectGit([
+ Git("status -s -uno", ""),
+ Git("checkout -f bleeding_edge", "", cb=ResetVersion(11, 4)),
+ Git("pull", ""),
+ Git("branch", ""),
+ Git("checkout -f bleeding_edge", ""),
+ Git("log -1 --format=%H", "latest_hash"),
+ Git("diff --name-only latest_hash latest_hash^", ""),
+ Git("checkout -f bleeding_edge", ""),
+ Git("log --format=%H --grep=\"^git-svn-id: [^@]*@12345 [A-Za-z0-9-]*$\"",
+ "lkgr_hash"),
+ Git("checkout -b auto-bump-up-version lkgr_hash", ""),
+ Git("checkout -f bleeding_edge", ""),
+ Git("branch", ""),
+ Git("diff --name-only lkgr_hash lkgr_hash^", ""),
+ Git("checkout -f master", "", cb=ResetVersion(11, 5)),
+ Git("pull", ""),
+ Git("checkout -b auto-bump-up-version bleeding_edge", "",
+ cb=ResetVersion(11, 4)),
+ Git("commit -am \"[Auto-roll] Bump up version to 3.11.6.0\n\n"
+ "TBR=author@chromium.org\"", ""),
+ Git("cl upload --send-mail --email \"author@chromium.org\" -f", ""),
+ Git("cl dcommit -f --bypass-hooks", ""),
+ Git("checkout -f bleeding_edge", ""),
+ Git("branch", "auto-bump-up-version\n* bleeding_edge"),
+ Git("branch -D auto-bump-up-version", ""),
+ ])
+
+ self.ExpectReadURL([
+ URL("https://v8-status.appspot.com/lkgr", "12345"),
+ URL("https://v8-status.appspot.com/current?format=json",
+ "{\"message\": \"Tree is open\"}"),
+ ])
+
+ BumpUpVersion(TEST_CONFIG, self).Run(["-a", "author@chromium.org"])
+
+ # Test that we bail out if the last change was a version change.
+ def testBumpUpVersionBailout1(self):
+ TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
+ self._state["latest"] = "latest_hash"
+
+ self.ExpectGit([
+ Git("diff --name-only latest_hash latest_hash^",
+ TEST_CONFIG[VERSION_FILE]),
+ ])
+
+ self.assertEquals(1,
+ self.RunStep(BumpUpVersion, LastChangeBailout, ["--dry_run"]))
+
+ # Test that we bail out if the lkgr was a version change.
+ def testBumpUpVersionBailout2(self):
+ TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
+ self._state["lkgr"] = "lkgr_hash"
+
+ self.ExpectGit([
+ Git("diff --name-only lkgr_hash lkgr_hash^", TEST_CONFIG[VERSION_FILE]),
+ ])
+
+ self.assertEquals(1,
+ self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"]))
+
+ # Test that we bail out if the last version is already newer than the lkgr's
+ # version.
+ def testBumpUpVersionBailout3(self):
+ TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
+ self._state["lkgr"] = "lkgr_hash"
+ self._state["lkgr_version"] = "3.22.4.0"
+ self._state["latest_version"] = "3.22.5.0"
+
+ self.ExpectGit([
+ Git("diff --name-only lkgr_hash lkgr_hash^", ""),
+ ])
+
+ self.assertEquals(1,
+ self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"]))
+
+
class SystemTest(unittest.TestCase):
def testReload(self):
step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={},
« no previous file with comments | « tools/push-to-trunk/releases.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698