| Index: tools/release/test_scripts.py
|
| diff --git a/tools/release/test_scripts.py b/tools/release/test_scripts.py
|
| index 8bf7b43e67281cbae837786becc04e473362abca..27c005ba5cdc265a8a9edf703bf87f33404b1a2d 100644
|
| --- a/tools/release/test_scripts.py
|
| +++ b/tools/release/test_scripts.py
|
| @@ -40,13 +40,14 @@ from common_includes import *
|
| import create_release
|
| from create_release import CreateRelease
|
| import merge_to_branch
|
| -from merge_to_branch import *
|
| +from merge_to_branch import MergeToBranch
|
| import push_to_candidates
|
| from push_to_candidates import *
|
| import releases
|
| from releases import Releases
|
| from auto_tag import AutoTag
|
| -
|
| +import roll_merge
|
| +from roll_merge import RollMerge
|
|
|
| TEST_CONFIG = {
|
| "DEFAULT_CWD": None,
|
| @@ -528,7 +529,7 @@ class ScriptTest(unittest.TestCase):
|
| self._state["version"] = "tag_name"
|
| self._state["commit_title"] = "Title"
|
| self.assertRaises(Exception,
|
| - lambda: self.RunStep(MergeToBranch, TagRevision, args))
|
| + lambda: self.RunStep(RollMerge, TagRevision, args))
|
|
|
| def testReadAndPersistVersion(self):
|
| self.WriteFakeVersionFile(build=5)
|
| @@ -1175,7 +1176,7 @@ deps = {
|
|
|
| self.assertEquals("abc123", state["candidate"])
|
|
|
| - def testMergeToBranch(self):
|
| + def testRollMerge(self):
|
| TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile()
|
| TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
|
| self.WriteFakeVersionFile(build=5)
|
| @@ -1306,6 +1307,376 @@ LOG=N
|
|
|
| # The first run of the script stops because of git being down.
|
| self.assertRaises(GitFailedException,
|
| + lambda: RollMerge(TEST_CONFIG, self).Run(args))
|
| +
|
| + # Test that state recovery after restarting the script works.
|
| + args += ["-s", "4"]
|
| + RollMerge(TEST_CONFIG, self).Run(args)
|
| +
|
| + def testReleases(self):
|
| + c_hash1_commit_log = """Update V8 to Version 4.2.71.
|
| +
|
| +Cr-Commit-Position: refs/heads/master@{#5678}
|
| +"""
|
| + c_hash2_commit_log = """Revert something.
|
| +
|
| +BUG=12345
|
| +
|
| +Reason:
|
| +> Some reason.
|
| +> Cr-Commit-Position: refs/heads/master@{#12345}
|
| +> git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12345 003-1c4
|
| +
|
| +Review URL: https://codereview.chromium.org/12345
|
| +
|
| +Cr-Commit-Position: refs/heads/master@{#4567}
|
| +git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4567 0039-1c4b
|
| +
|
| +"""
|
| + c_hash3_commit_log = """Simple.
|
| +
|
| +git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b
|
| +
|
| +"""
|
| + c_hash_234_commit_log = """Version 3.3.1.1 (cherry-pick).
|
| +
|
| +Merged abc12.
|
| +
|
| +Review URL: fake.com
|
| +
|
| +Cr-Commit-Position: refs/heads/candidates@{#234}
|
| +"""
|
| + c_hash_123_commit_log = """Version 3.3.1.0
|
| +
|
| +git-svn-id: googlecode@123 0039-1c4b
|
| +"""
|
| + c_hash_345_commit_log = """Version 3.4.0.
|
| +
|
| +Cr-Commit-Position: refs/heads/candidates@{#345}
|
| +"""
|
| + c_hash_456_commit_log = """Version 4.2.71.
|
| +
|
| +Cr-Commit-Position: refs/heads/4.2.71@{#1}
|
| +"""
|
| + c_deps = "Line\n \"v8_revision\": \"%s\",\n line\n"
|
| +
|
| + json_output = self.MakeEmptyTempFile()
|
| + csv_output = self.MakeEmptyTempFile()
|
| + self.WriteFakeVersionFile()
|
| +
|
| + TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory()
|
| + chrome_dir = TEST_CONFIG["CHROMIUM"]
|
| + chrome_v8_dir = os.path.join(chrome_dir, "v8")
|
| + os.makedirs(chrome_v8_dir)
|
| +
|
| + def ResetVersion(major, minor, build, patch=0):
|
| + return lambda: self.WriteFakeVersionFile(major=major,
|
| + minor=minor,
|
| + build=build,
|
| + patch=patch)
|
| +
|
| + self.Expect([
|
| + Cmd("git status -s -uno", ""),
|
| + Cmd("git checkout -f origin/master", ""),
|
| + Cmd("git fetch", ""),
|
| + Cmd("git branch", " branch1\n* branch2\n"),
|
| + Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], ""),
|
| + Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
|
| + Cmd("git rev-list --max-age=395200 --tags",
|
| + "bad_tag\nhash_234\nhash_123\nhash_345\nhash_456\n"),
|
| + Cmd("git describe --tags bad_tag", "3.23.42-1-deadbeef"),
|
| + Cmd("git describe --tags hash_234", "3.3.1.1"),
|
| + Cmd("git describe --tags hash_123", "3.21.2"),
|
| + Cmd("git describe --tags hash_345", "3.22.3"),
|
| + Cmd("git describe --tags hash_456", "4.2.71"),
|
| + Cmd("git diff --name-only hash_234 hash_234^", VERSION_FILE),
|
| + Cmd("git checkout -f hash_234 -- %s" % VERSION_FILE, "",
|
| + cb=ResetVersion(3, 3, 1, 1)),
|
| + Cmd("git branch -r --contains hash_234", " branch-heads/3.3\n"),
|
| + Cmd("git log -1 --format=%B hash_234", c_hash_234_commit_log),
|
| + Cmd("git log -1 --format=%s hash_234", ""),
|
| + Cmd("git log -1 --format=%B hash_234", c_hash_234_commit_log),
|
| + Cmd("git log -1 --format=%ci hash_234", "18:15"),
|
| + Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "",
|
| + cb=ResetVersion(3, 22, 5)),
|
| + Cmd("git diff --name-only hash_123 hash_123^", VERSION_FILE),
|
| + Cmd("git checkout -f hash_123 -- %s" % VERSION_FILE, "",
|
| + cb=ResetVersion(3, 21, 2)),
|
| + Cmd("git branch -r --contains hash_123", " branch-heads/3.21\n"),
|
| + Cmd("git log -1 --format=%B hash_123", c_hash_123_commit_log),
|
| + Cmd("git log -1 --format=%s hash_123", ""),
|
| + Cmd("git log -1 --format=%B hash_123", c_hash_123_commit_log),
|
| + Cmd("git log -1 --format=%ci hash_123", "03:15"),
|
| + Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "",
|
| + cb=ResetVersion(3, 22, 5)),
|
| + Cmd("git diff --name-only hash_345 hash_345^", VERSION_FILE),
|
| + Cmd("git checkout -f hash_345 -- %s" % VERSION_FILE, "",
|
| + cb=ResetVersion(3, 22, 3)),
|
| + Cmd("git branch -r --contains hash_345", " origin/candidates\n"),
|
| + Cmd("git log -1 --format=%B hash_345", c_hash_345_commit_log),
|
| + Cmd("git log -1 --format=%s hash_345", ""),
|
| + Cmd("git log -1 --format=%B hash_345", c_hash_345_commit_log),
|
| + Cmd("git log -1 --format=%ci hash_345", ""),
|
| + Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "",
|
| + cb=ResetVersion(3, 22, 5)),
|
| + Cmd("git diff --name-only hash_456 hash_456^", VERSION_FILE),
|
| + Cmd("git checkout -f hash_456 -- %s" % VERSION_FILE, "",
|
| + cb=ResetVersion(4, 2, 71)),
|
| + Cmd("git branch -r --contains hash_456", " origin/4.2.71\n"),
|
| + Cmd("git log -1 --format=%B hash_456", c_hash_456_commit_log),
|
| + Cmd("git log -1 --format=%H 4.2.71", "hash_456"),
|
| + Cmd("git log -1 --format=%s hash_456", "Version 4.2.71"),
|
| + Cmd("git log -1 --format=%H hash_456^", "master_456"),
|
| + Cmd("git log -1 --format=%B master_456",
|
| + "Cr-Commit-Position: refs/heads/master@{#456}"),
|
| + Cmd("git log -1 --format=%B hash_456", c_hash_456_commit_log),
|
| + Cmd("git log -1 --format=%ci hash_456", "02:15"),
|
| + Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "",
|
| + cb=ResetVersion(3, 22, 5)),
|
| + Cmd("git fetch origin +refs/heads/*:refs/remotes/origin/* "
|
| + "+refs/branch-heads/*:refs/remotes/branch-heads/*", "",
|
| + cwd=chrome_dir),
|
| + Cmd("git fetch origin", "", cwd=chrome_v8_dir),
|
| + Cmd("git log --format=%H --grep=\"V8\" origin/master -- DEPS",
|
| + "c_hash1\nc_hash2\nc_hash3\n",
|
| + cwd=chrome_dir),
|
| + Cmd("git show c_hash1:DEPS", c_deps % "hash_456", cwd=chrome_dir),
|
| + Cmd("git log -1 --format=%B c_hash1", c_hash1_commit_log,
|
| + cwd=chrome_dir),
|
| + Cmd("git show c_hash2:DEPS", c_deps % "hash_345", cwd=chrome_dir),
|
| + Cmd("git log -1 --format=%B c_hash2", c_hash2_commit_log,
|
| + cwd=chrome_dir),
|
| + Cmd("git show c_hash3:DEPS", c_deps % "deadbeef", cwd=chrome_dir),
|
| + Cmd("git log -1 --format=%B c_hash3", c_hash3_commit_log,
|
| + cwd=chrome_dir),
|
| + Cmd("git branch -r", " weird/123\n branch-heads/7\n", cwd=chrome_dir),
|
| + Cmd("git show refs/branch-heads/7:DEPS", c_deps % "hash_345",
|
| + cwd=chrome_dir),
|
| + URL("http://omahaproxy.appspot.com/all.json", """[{
|
| + "os": "win",
|
| + "versions": [{
|
| + "version": "2.2.2.2",
|
| + "v8_version": "22.2.2.2",
|
| + "current_reldate": "04/09/15",
|
| + "os": "win",
|
| + "channel": "canary",
|
| + "previous_version": "1.1.1.0"
|
| + }]
|
| + }]"""),
|
| + URL("http://omahaproxy.appspot.com/v8.json?version=1.1.1.0", """{
|
| + "chromium_version": "1.1.1.0",
|
| + "v8_version": "11.1.1.0"
|
| + }"""),
|
| + Cmd("git rev-list -1 11.1.1", "v8_previous_version_hash"),
|
| + Cmd("git rev-list -1 22.2.2.2", "v8_version_hash"),
|
| + Cmd("git checkout -f origin/master", ""),
|
| + Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], "")
|
| + ])
|
| +
|
| + args = ["-c", TEST_CONFIG["CHROMIUM"],
|
| + "--json", json_output,
|
| + "--csv", csv_output,
|
| + "--max-releases", "1"]
|
| + Releases(TEST_CONFIG, self).Run(args)
|
| +
|
| + # Check expected output.
|
| + csv = ("4.2.71,4.2.71,1,5678,\r\n"
|
| + "3.22.3,candidates,345,4567:5677,\r\n"
|
| + "3.21.2,3.21,123,,\r\n"
|
| + "3.3.1.1,3.3,234,,abc12\r\n")
|
| + self.assertEquals(csv, FileToText(csv_output))
|
| +
|
| + expected_json = {"chrome_releases":{
|
| + "canaries": [
|
| + {
|
| + "chrome_version": "2.2.2.2",
|
| + "os": "win",
|
| + "release_date": "04/09/15",
|
| + "v8_version": "22.2.2.2",
|
| + "v8_version_hash": "v8_version_hash",
|
| + "v8_previous_version": "11.1.1.0",
|
| + "v8_previous_version_hash": "v8_previous_version_hash"
|
| + }]},
|
| + "releases":[
|
| + {
|
| + "revision": "1",
|
| + "revision_git": "hash_456",
|
| + "master_position": "456",
|
| + "master_hash": "master_456",
|
| + "patches_merged": "",
|
| + "version": "4.2.71",
|
| + "chromium_revision": "5678",
|
| + "branch": "4.2.71",
|
| + "review_link": "",
|
| + "date": "02:15",
|
| + "chromium_branch": "",
|
| + # FIXME(machenbach): Fix revisions link for git.
|
| + "revision_link": "https://code.google.com/p/v8/source/detail?r=1",
|
| + },
|
| + {
|
| + "revision": "345",
|
| + "revision_git": "hash_345",
|
| + "master_position": "",
|
| + "master_hash": "",
|
| + "patches_merged": "",
|
| + "version": "3.22.3",
|
| + "chromium_revision": "4567:5677",
|
| + "branch": "candidates",
|
| + "review_link": "",
|
| + "date": "",
|
| + "chromium_branch": "7",
|
| + "revision_link": "https://code.google.com/p/v8/source/detail?r=345",
|
| + },
|
| + {
|
| + "revision": "123",
|
| + "revision_git": "hash_123",
|
| + "patches_merged": "",
|
| + "master_position": "",
|
| + "master_hash": "",
|
| + "version": "3.21.2",
|
| + "chromium_revision": "",
|
| + "branch": "3.21",
|
| + "review_link": "",
|
| + "date": "03:15",
|
| + "chromium_branch": "",
|
| + "revision_link": "https://code.google.com/p/v8/source/detail?r=123",
|
| + },
|
| + {
|
| + "revision": "234",
|
| + "revision_git": "hash_234",
|
| + "patches_merged": "abc12",
|
| + "master_position": "",
|
| + "master_hash": "",
|
| + "version": "3.3.1.1",
|
| + "chromium_revision": "",
|
| + "branch": "3.3",
|
| + "review_link": "fake.com",
|
| + "date": "18:15",
|
| + "chromium_branch": "",
|
| + "revision_link": "https://code.google.com/p/v8/source/detail?r=234",
|
| + },],
|
| + }
|
| + self.assertEquals(expected_json, json.loads(FileToText(json_output)))
|
| +
|
| + def testMergeToBranch(self):
|
| + TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile()
|
| + TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
|
| + self.WriteFakeVersionFile(build=5)
|
| + os.environ["EDITOR"] = "vi"
|
| + extra_patch = self.MakeEmptyTempFile()
|
| +
|
| +
|
| + def VerifyPatch(patch):
|
| + return lambda: self.assertEquals(patch,
|
| + FileToText(TEST_CONFIG["TEMPORARY_PATCH_FILE"]))
|
| +
|
| + info_msg = ("Please note that you are using a new "
|
| + "version of the script merge_to_branch.py. "
|
| + "This script will no longer automatically update include/v8-version.h "
|
| + "and create a tag. This is ok, the trustworthy autotag bot will "
|
| + "take care of that. The old script is still available in "
|
| + "tools/release/roll_merge.py.")
|
| +
|
| + msg = """Merged: Squashed multiple commits.
|
| +
|
| +Merged: Title4
|
| +Revision: ab12345
|
| +
|
| +Merged: Title2
|
| +Revision: ab23456
|
| +
|
| +Merged: Title3
|
| +Revision: ab34567
|
| +
|
| +Merged: Title1
|
| +Revision: ab45678
|
| +
|
| +Merged: Revert \"Something\"
|
| +Revision: ab56789
|
| +
|
| +BUG=123,234,345,456,567,v8:123
|
| +LOG=N
|
| +"""
|
| +
|
| + def VerifyLand():
|
| + commit = FileToText(TEST_CONFIG["COMMITMSG_FILE"])
|
| + self.assertEquals(msg, commit)
|
| +
|
| + self.Expect([
|
| + Cmd("git status -s -uno", ""),
|
| + Cmd("git checkout -f origin/master", ""),
|
| + Cmd("git fetch", ""),
|
| + Cmd("git branch", " branch1\n* branch2\n"),
|
| + Cmd("git new-branch %s --upstream refs/remotes/origin/candidates" %
|
| + TEST_CONFIG["BRANCHNAME"], ""),
|
| + Cmd(("git log --format=%H --grep=\"^[Pp]ort ab12345\" "
|
| + "--reverse origin/master"),
|
| + "ab45678\nab23456"),
|
| + Cmd("git log -1 --format=%s ab45678", "Title1"),
|
| + Cmd("git log -1 --format=%s ab23456", "Title2"),
|
| + Cmd(("git log --format=%H --grep=\"^[Pp]ort ab23456\" "
|
| + "--reverse origin/master"),
|
| + ""),
|
| + Cmd(("git log --format=%H --grep=\"^[Pp]ort ab34567\" "
|
| + "--reverse origin/master"),
|
| + "ab56789"),
|
| + Cmd("git log -1 --format=%s ab56789", "Title3"),
|
| + RL("Y"), # Automatically add corresponding ports (ab34567, ab56789)?
|
| + # Simulate git being down which stops the script.
|
| + Cmd("git log -1 --format=%s ab12345", None),
|
| + # Restart script in the failing step.
|
| + Cmd("git log -1 --format=%s ab12345", "Title4"),
|
| + Cmd("git log -1 --format=%s ab23456", "Title2"),
|
| + Cmd("git log -1 --format=%s ab34567", "Title3"),
|
| + Cmd("git log -1 --format=%s ab45678", "Title1"),
|
| + Cmd("git log -1 --format=%s ab56789", "Revert \"Something\""),
|
| + Cmd("git log -1 ab12345", "Title4\nBUG=123\nBUG=234"),
|
| + Cmd("git log -1 ab23456", "Title2\n BUG = v8:123,345"),
|
| + Cmd("git log -1 ab34567", "Title3\nLOG=n\nBUG=567, 456"),
|
| + Cmd("git log -1 ab45678", "Title1\nBUG="),
|
| + Cmd("git log -1 ab56789", "Revert \"Something\"\nBUG=none"),
|
| + Cmd("git log -1 -p ab12345", "patch4"),
|
| + Cmd(("git apply --index --reject \"%s\"" %
|
| + TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
|
| + "", cb=VerifyPatch("patch4")),
|
| + Cmd("git log -1 -p ab23456", "patch2"),
|
| + Cmd(("git apply --index --reject \"%s\"" %
|
| + TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
|
| + "", cb=VerifyPatch("patch2")),
|
| + Cmd("git log -1 -p ab34567", "patch3"),
|
| + Cmd(("git apply --index --reject \"%s\"" %
|
| + TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
|
| + "", cb=VerifyPatch("patch3")),
|
| + Cmd("git log -1 -p ab45678", "patch1"),
|
| + Cmd(("git apply --index --reject \"%s\"" %
|
| + TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
|
| + "", cb=VerifyPatch("patch1")),
|
| + Cmd("git log -1 -p ab56789", "patch5\n"),
|
| + Cmd(("git apply --index --reject \"%s\"" %
|
| + TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
|
| + "", cb=VerifyPatch("patch5\n")),
|
| + Cmd("git apply --index --reject \"%s\"" % extra_patch, ""),
|
| + Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], ""),
|
| + RL("reviewer@chromium.org"), # V8 reviewer.
|
| + Cmd("git cl upload --send-mail -r \"reviewer@chromium.org\" "
|
| + "--bypass-hooks --cc \"ulan@chromium.org\"", ""),
|
| + Cmd("git cl comments -a \"%s\"" % info_msg, ""),
|
| + Cmd("git checkout -f %s" % TEST_CONFIG["BRANCHNAME"], ""),
|
| + RL("LGTM"), # Enter LGTM for V8 CL.
|
| + Cmd("git cl presubmit", "Presubmit successfull\n"),
|
| + Cmd("git cl land -f --bypass-hooks", "Closing issue\n",
|
| + cb=VerifyLand),
|
| + Cmd("git checkout -f origin/master", ""),
|
| + Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
|
| + ])
|
| +
|
| + # ab12345 and ab34567 are patches. ab23456 (included) and ab45678 are the
|
| + # MIPS ports of ab12345. ab56789 is the MIPS port of ab34567.
|
| + args = ["-f", "-p", extra_patch, "--branch", "candidates",
|
| + "ab12345", "ab23456", "ab34567"]
|
| +
|
| + # The first run of the script stops because of git being down.
|
| + self.assertRaises(GitFailedException,
|
| lambda: MergeToBranch(TEST_CONFIG, self).Run(args))
|
|
|
| # Test that state recovery after restarting the script works.
|
| @@ -1558,6 +1929,8 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1}
|
| self.assertEquals(expected_json, json.loads(FileToText(json_output)))
|
|
|
|
|
| +
|
| +
|
| class SystemTest(unittest.TestCase):
|
| def testReload(self):
|
| options = ScriptsBase(
|
|
|