diff options
author | Ali Ijaz Sheikh <ofrobots@google.com> | 2016-03-01 08:58:05 -0800 |
---|---|---|
committer | Ali Sheikh <ofrobots@lemonhope.roam.corp.google.com> | 2016-03-03 20:35:20 -0800 |
commit | 069e02ab47656b3efd1b6829c65856b2e1c2d1db (patch) | |
tree | eb643e0a2e88fd64bb9fc927423458d2ae96c2db /deps/v8/tools/release | |
parent | 8938355398c79f583a468284b768652d12ba9bc9 (diff) | |
download | android-node-v8-069e02ab47656b3efd1b6829c65856b2e1c2d1db.tar.gz android-node-v8-069e02ab47656b3efd1b6829c65856b2e1c2d1db.tar.bz2 android-node-v8-069e02ab47656b3efd1b6829c65856b2e1c2d1db.zip |
deps: upgrade to V8 4.9.385.18
Pick up the current branch head for V8 4.9
https://github.com/v8/v8/commit/1ecba0f
PR-URL: https://github.com/nodejs/node/pull/4722
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com>
Diffstat (limited to 'deps/v8/tools/release')
-rwxr-xr-x | deps/v8/tools/release/auto_roll.py | 222 | ||||
-rwxr-xr-x | deps/v8/tools/release/chromium_roll.py | 161 | ||||
-rw-r--r-- | deps/v8/tools/release/common_includes.py | 50 | ||||
-rwxr-xr-x | deps/v8/tools/release/releases.py | 9 | ||||
-rw-r--r-- | deps/v8/tools/release/test_scripts.py | 145 |
5 files changed, 241 insertions, 346 deletions
diff --git a/deps/v8/tools/release/auto_roll.py b/deps/v8/tools/release/auto_roll.py index f7692cf6f9..27fd370971 100755 --- a/deps/v8/tools/release/auto_roll.py +++ b/deps/v8/tools/release/auto_roll.py @@ -4,61 +4,68 @@ # found in the LICENSE file. import argparse -import json import os import sys -import urllib from common_includes import * -import chromium_roll +ROLL_SUMMARY = ("Summary of changes available at:\n" + "https://chromium.googlesource.com/v8/v8/+log/%s..%s") -class CheckActiveRoll(Step): - MESSAGE = "Check active roll." +ISSUE_MSG = ( +"""Please follow these instructions for assigning/CC'ing issues: +https://github.com/v8/v8/wiki/Triaging%20issues - @staticmethod - def ContainsChromiumRoll(changes): - for change in changes: - if change["subject"].startswith("Update V8 to"): - return True - return False +Please close rolling in case of a roll revert: +https://v8-roll.appspot.com/ +This only works with a Google account.""") + +class Preparation(Step): + MESSAGE = "Preparation." def RunStep(self): - params = { - "closed": 3, - "owner": self._options.author, - "limit": 30, - "format": "json", - } - params = urllib.urlencode(params) - search_url = "https://codereview.chromium.org/search" - result = self.ReadURL(search_url, params, wait_plan=[5, 20]) - if self.ContainsChromiumRoll(json.loads(result)["results"]): - print "Stop due to existing Chromium roll." - return True + self['json_output']['monitoring_state'] = 'preparation' + # Update v8 remote tracking branches. + self.GitFetchOrigin() + self.Git("fetch origin +refs/tags/*:refs/tags/*") class DetectLastRoll(Step): MESSAGE = "Detect commit ID of the last Chromium roll." def RunStep(self): + self['json_output']['monitoring_state'] = 'detect_last_roll' + self["last_roll"] = self._options.last_roll + if not self["last_roll"]: + # Interpret the DEPS file to retrieve the v8 revision. + # TODO(machenbach): This should be part or the roll-deps api of + # depot_tools. + Var = lambda var: '%s' + exec(FileToText(os.path.join(self._options.chromium, "DEPS"))) + + # The revision rolled last. + self["last_roll"] = vars['v8_revision'] + self["last_version"] = self.GetVersionTag(self["last_roll"]) + assert self["last_version"], "The last rolled v8 revision is not tagged." + + +class DetectRevisionToRoll(Step): + MESSAGE = "Detect commit ID of the V8 revision to roll." + + def RunStep(self): + self['json_output']['monitoring_state'] = 'detect_revision' + self["roll"] = self._options.revision + if self["roll"]: + # If the revision was passed on the cmd line, continue script execution + # in the next step. + return False + # The revision that should be rolled. Check for the latest of the most # recent releases based on commit timestamp. revisions = self.GetRecentReleases( max_age=self._options.max_age * DAY_IN_SECONDS) assert revisions, "Didn't find any recent release." - # Interpret the DEPS file to retrieve the v8 revision. - # TODO(machenbach): This should be part or the roll-deps api of - # depot_tools. - Var = lambda var: '%s' - exec(FileToText(os.path.join(self._options.chromium, "DEPS"))) - - # The revision rolled last. - self["last_roll"] = vars['v8_revision'] - last_version = self.GetVersionTag(self["last_roll"]) - assert last_version, "The last rolled v8 revision is not tagged." - # There must be some progress between the last roll and the new candidate # revision (i.e. we don't go backwards). The revisions are ordered newest # to oldest. It is possible that the newest timestamp has no progress @@ -68,35 +75,107 @@ class DetectLastRoll(Step): version = self.GetVersionTag(revision) assert version, "Internal error. All recent releases should have a tag" - if SortingKey(last_version) < SortingKey(version): + if SortingKey(self["last_version"]) < SortingKey(version): self["roll"] = revision break else: print("There is no newer v8 revision than the one in Chromium (%s)." % self["last_roll"]) + self['json_output']['monitoring_state'] = 'up_to_date' return True -class RollChromium(Step): - MESSAGE = "Roll V8 into Chromium." +class PrepareRollCandidate(Step): + MESSAGE = "Robustness checks of the roll candidate." def RunStep(self): - if self._options.roll: - args = [ - "--author", self._options.author, - "--reviewer", self._options.reviewer, - "--chromium", self._options.chromium, - "--last-roll", self["last_roll"], - "--use-commit-queue", - self["roll"], - ] - if self._options.sheriff: - args.append("--sheriff") - if self._options.dry_run: - args.append("--dry-run") - if self._options.work_dir: - args.extend(["--work-dir", self._options.work_dir]) - self._side_effect_handler.Call(chromium_roll.ChromiumRoll().Run, args) + self['json_output']['monitoring_state'] = 'prepare_candidate' + self["roll_title"] = self.GitLog(n=1, format="%s", + git_hash=self["roll"]) + + # Make sure the last roll and the roll candidate are releases. + version = self.GetVersionTag(self["roll"]) + assert version, "The revision to roll is not tagged." + version = self.GetVersionTag(self["last_roll"]) + assert version, "The revision used as last roll is not tagged." + + +class SwitchChromium(Step): + MESSAGE = "Switch to Chromium checkout." + + def RunStep(self): + self['json_output']['monitoring_state'] = 'switch_chromium' + cwd = self._options.chromium + self.InitialEnvironmentChecks(cwd) + # Check for a clean workdir. + if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover + self.Die("Workspace is not clean. Please commit or undo your changes.") + # Assert that the DEPS file is there. + if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover + self.Die("DEPS file not present.") + + +class UpdateChromiumCheckout(Step): + MESSAGE = "Update the checkout and create a new branch." + + def RunStep(self): + self['json_output']['monitoring_state'] = 'update_chromium' + cwd = self._options.chromium + self.GitCheckout("master", cwd=cwd) + self.DeleteBranch("work-branch", cwd=cwd) + self.Command("gclient", "sync --nohooks", cwd=cwd) + self.GitPull(cwd=cwd) + + # Update v8 remotes. + self.GitFetchOrigin() + + self.GitCreateBranch("work-branch", cwd=cwd) + + +class UploadCL(Step): + MESSAGE = "Create and upload CL." + + def RunStep(self): + self['json_output']['monitoring_state'] = 'upload' + cwd = self._options.chromium + # Patch DEPS file. + if self.Command("roll-dep-svn", "v8 %s" % + self["roll"], cwd=cwd) is None: + self.Die("Failed to create deps for %s" % self["roll"]) + + message = [] + message.append("Update V8 to %s." % self["roll_title"].lower()) + + message.append( + ROLL_SUMMARY % (self["last_roll"][:8], self["roll"][:8])) + + message.append(ISSUE_MSG) + + message.append("TBR=%s" % self._options.reviewer) + self.GitCommit("\n\n".join(message), author=self._options.author, cwd=cwd) + if not self._options.dry_run: + self.GitUpload(author=self._options.author, + force=True, + cq=self._options.use_commit_queue, + cwd=cwd) + print "CL uploaded." + else: + print "Dry run - don't upload." + + self.GitCheckout("master", cwd=cwd) + self.GitDeleteBranch("work-branch", cwd=cwd) + +class CleanUp(Step): + MESSAGE = "Done!" + + def RunStep(self): + self['json_output']['monitoring_state'] = 'success' + print("Congratulations, you have successfully rolled %s into " + "Chromium." + % self["roll"]) + + # Clean up all temporary files. + Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"]) class AutoRoll(ScriptsBase): @@ -104,30 +183,45 @@ class AutoRoll(ScriptsBase): parser.add_argument("-c", "--chromium", required=True, help=("The path to your Chromium src/ " "directory to automate the V8 roll.")) - parser.add_argument("--max-age", default=3, type=int, + parser.add_argument("--last-roll", + help="The git commit ID of the last rolled version. " + "Auto-detected if not specified.") + parser.add_argument("--max-age", default=7, type=int, help="Maximum age in days of the latest release.") - parser.add_argument("--roll", help="Call Chromium roll script.", - default=False, action="store_true") + parser.add_argument("--revision", + help="Revision to roll. Auto-detected if not " + "specified."), + parser.add_argument("--roll", help="Deprecated.", + default=True, action="store_true") + parser.add_argument("--use-commit-queue", + help="Check the CQ bit on upload.", + default=True, action="store_true") def _ProcessOptions(self, options): # pragma: no cover - if not options.reviewer: - print "A reviewer (-r) is required." - return False - if not options.author: - print "An author (-a) is required." + if not options.author or not options.reviewer: + print "A reviewer (-r) and an author (-a) are required." return False + + options.requires_editor = False + options.force = True + options.manual = False return True def _Config(self): return { - "PERSISTFILE_BASENAME": "/tmp/v8-auto-roll-tempfile", + "PERSISTFILE_BASENAME": "/tmp/v8-chromium-roll-tempfile", } def _Steps(self): return [ - CheckActiveRoll, + Preparation, DetectLastRoll, - RollChromium, + DetectRevisionToRoll, + PrepareRollCandidate, + SwitchChromium, + UpdateChromiumCheckout, + UploadCL, + CleanUp, ] diff --git a/deps/v8/tools/release/chromium_roll.py b/deps/v8/tools/release/chromium_roll.py deleted file mode 100755 index bcc6c79f2d..0000000000 --- a/deps/v8/tools/release/chromium_roll.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env python -# Copyright 2014 the V8 project authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import sys - -from common_includes import * - -ROLL_SUMMARY = ("Summary of changes available at:\n" - "https://chromium.googlesource.com/v8/v8/+log/%s..%s") - -ISSUE_MSG = ( -"""Please follow these instructions for assigning/CC'ing issues: -https://code.google.com/p/v8-wiki/wiki/TriagingIssues - -Please close rolling in case of a roll revert: -https://v8-roll.appspot.com/ -This only works with a Google account.""") - -class Preparation(Step): - MESSAGE = "Preparation." - - def RunStep(self): - # Update v8 remote tracking branches. - self.GitFetchOrigin() - self.Git("fetch origin +refs/tags/*:refs/tags/*") - - -class PrepareRollCandidate(Step): - MESSAGE = "Robustness checks of the roll candidate." - - def RunStep(self): - self["roll_title"] = self.GitLog(n=1, format="%s", - git_hash=self._options.roll) - - # Make sure the last roll and the roll candidate are releases. - version = self.GetVersionTag(self._options.roll) - assert version, "The revision to roll is not tagged." - version = self.GetVersionTag(self._options.last_roll) - assert version, "The revision used as last roll is not tagged." - - -class SwitchChromium(Step): - MESSAGE = "Switch to Chromium checkout." - - def RunStep(self): - cwd = self._options.chromium - self.InitialEnvironmentChecks(cwd) - # Check for a clean workdir. - if not self.GitIsWorkdirClean(cwd=cwd): # pragma: no cover - self.Die("Workspace is not clean. Please commit or undo your changes.") - # Assert that the DEPS file is there. - if not os.path.exists(os.path.join(cwd, "DEPS")): # pragma: no cover - self.Die("DEPS file not present.") - - -class UpdateChromiumCheckout(Step): - MESSAGE = "Update the checkout and create a new branch." - - def RunStep(self): - cwd = self._options.chromium - self.GitCheckout("master", cwd=cwd) - self.DeleteBranch("work-branch", cwd=cwd) - self.Command("gclient", "sync --nohooks", cwd=cwd) - self.GitPull(cwd=cwd) - - # Update v8 remotes. - self.GitFetchOrigin() - - self.GitCreateBranch("work-branch", cwd=cwd) - - -class UploadCL(Step): - MESSAGE = "Create and upload CL." - - def RunStep(self): - cwd = self._options.chromium - # Patch DEPS file. - if self.Command("roll-dep-svn", "v8 %s" % - self._options.roll, cwd=cwd) is None: - self.Die("Failed to create deps for %s" % self._options.roll) - - message = [] - message.append("Update V8 to %s." % self["roll_title"].lower()) - - message.append( - ROLL_SUMMARY % (self._options.last_roll[:8], self._options.roll[:8])) - - message.append(ISSUE_MSG) - - message.append("TBR=%s" % self._options.reviewer) - self.GitCommit("\n\n".join(message), author=self._options.author, cwd=cwd) - if not self._options.dry_run: - self.GitUpload(author=self._options.author, - force=True, - cq=self._options.use_commit_queue, - cwd=cwd) - print "CL uploaded." - else: - print "Dry run - don't upload." - - self.GitCheckout("master", cwd=cwd) - self.GitDeleteBranch("work-branch", cwd=cwd) - -class CleanUp(Step): - MESSAGE = "Done!" - - def RunStep(self): - print("Congratulations, you have successfully rolled %s into " - "Chromium." - % self._options.roll) - - # Clean up all temporary files. - Command("rm", "-f %s*" % self._config["PERSISTFILE_BASENAME"]) - - -class ChromiumRoll(ScriptsBase): - def _PrepareOptions(self, parser): - parser.add_argument("-c", "--chromium", required=True, - help=("The path to your Chromium src/ " - "directory to automate the V8 roll.")) - parser.add_argument("--last-roll", required=True, - help="The git commit ID of the last rolled version.") - parser.add_argument("roll", nargs=1, help="Revision to roll."), - parser.add_argument("--use-commit-queue", - help="Check the CQ bit on upload.", - default=False, action="store_true") - - def _ProcessOptions(self, options): # pragma: no cover - if not options.author or not options.reviewer: - print "A reviewer (-r) and an author (-a) are required." - return False - - options.requires_editor = False - options.force = True - options.manual = False - options.roll = options.roll[0] - return True - - def _Config(self): - return { - "PERSISTFILE_BASENAME": "/tmp/v8-chromium-roll-tempfile", - } - - def _Steps(self): - return [ - Preparation, - PrepareRollCandidate, - DetermineV8Sheriff, - SwitchChromium, - UpdateChromiumCheckout, - UploadCL, - CleanUp, - ] - - -if __name__ == "__main__": # pragma: no cover - sys.exit(ChromiumRoll().Run()) diff --git a/deps/v8/tools/release/common_includes.py b/deps/v8/tools/release/common_includes.py index 41fe359624..c2b64c38ec 100644 --- a/deps/v8/tools/release/common_includes.py +++ b/deps/v8/tools/release/common_includes.py @@ -738,9 +738,12 @@ class Step(GitRecipesMixin): class BootstrapStep(Step): - MESSAGE = "Bootstapping v8 checkout." + MESSAGE = "Bootstrapping checkout and state." def RunStep(self): + # Reserve state entry for json output. + self['json_output'] = {} + if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE): self.Die("Can't use v8 checkout with calling script as work checkout.") # Directory containing the working v8 checkout. @@ -766,32 +769,6 @@ class UploadStep(Step): cc=self._options.cc) -class DetermineV8Sheriff(Step): - MESSAGE = "Determine the V8 sheriff for code review." - - def RunStep(self): - self["sheriff"] = None - if not self._options.sheriff: # pragma: no cover - return - - # The sheriff determined by the rotation on the waterfall has a - # @google.com account. - url = "https://chromium-build.appspot.com/p/chromium/sheriff_v8.js" - match = re.match(r"document\.write\('(\w+)'\)", self.ReadURL(url)) - - # If "channel is sheriff", we can't match an account. - if match: - g_name = match.group(1) - # Optimistically assume that google and chromium account name are the - # same. - self["sheriff"] = g_name + "@chromium.org" - self._options.reviewer = ("%s,%s" % - (self["sheriff"], self._options.reviewer)) - print "Found active sheriff: %s" % self["sheriff"] - else: - print "No active sheriff found." - - def MakeStep(step_class=Step, number=0, state=None, config=None, options=None, side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): # Allow to pass in empty dictionaries. @@ -838,12 +815,10 @@ class ScriptsBase(object): help="The author email used for rietveld.") parser.add_argument("--dry-run", default=False, action="store_true", help="Perform only read-only actions.") + parser.add_argument("--json-output", + help="File to write results summary to.") parser.add_argument("-r", "--reviewer", default="", help="The account name to be used for reviews.") - parser.add_argument("--sheriff", default=False, action="store_true", - help=("Determine current sheriff to review CLs. On " - "success, this will overwrite the reviewer " - "option.")) parser.add_argument("-s", "--step", help="Specify the step where to start work. Default: 0.", default=0, type=int) @@ -896,9 +871,16 @@ class ScriptsBase(object): for (number, step_class) in enumerate([BootstrapStep] + step_classes): steps.append(MakeStep(step_class, number, self._state, self._config, options, self._side_effect_handler)) - for step in steps[options.step:]: - if step.Run(): - return 0 + + try: + for step in steps[options.step:]: + if step.Run(): + return 0 + finally: + if options.json_output: + with open(options.json_output, "w") as f: + json.dump(self._state['json_output'], f) + return 0 def Run(self, args=None): diff --git a/deps/v8/tools/release/releases.py b/deps/v8/tools/release/releases.py index 5b826fccba..7b659ccb80 100755 --- a/deps/v8/tools/release/releases.py +++ b/deps/v8/tools/release/releases.py @@ -463,10 +463,15 @@ class RetrieveInformationOnChromeReleases(Step): def _GetGitHashForV8Version(self, v8_version): if v8_version == "N/A": return "" + + real_v8_version = v8_version if v8_version.split(".")[3]== "0": - return self.GitGetHashOfTag(v8_version[:-2]) + real_v8_version = v8_version[:-2] - return self.GitGetHashOfTag(v8_version) + try: + return self.GitGetHashOfTag(real_v8_version) + except GitFailedException: + return "" def _CreateCandidate(self, current_version): params = None diff --git a/deps/v8/tools/release/test_scripts.py b/deps/v8/tools/release/test_scripts.py index 825c191d4e..4a3cb5b24a 100644 --- a/deps/v8/tools/release/test_scripts.py +++ b/deps/v8/tools/release/test_scripts.py @@ -1003,30 +1003,68 @@ git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123456 123 """ - ROLL_COMMIT_MSG = """Update V8 to version 3.22.4 (based on abc). + ROLL_COMMIT_MSG = """Update V8 to version 3.22.4. Summary of changes available at: https://chromium.googlesource.com/v8/v8/+log/last_rol..roll_hsh Please follow these instructions for assigning/CC'ing issues: -https://code.google.com/p/v8-wiki/wiki/TriagingIssues +https://github.com/v8/v8/wiki/Triaging%20issues Please close rolling in case of a roll revert: https://v8-roll.appspot.com/ This only works with a Google account. -TBR=g_name@chromium.org,reviewer@chromium.org""" +TBR=reviewer@chromium.org""" + + # Snippet from the original DEPS file. + FAKE_DEPS = """ +vars = { + "v8_revision": "last_roll_hsh", +} +deps = { + "src/v8": + (Var("googlecode_url") % "v8") + "/" + Var("v8_branch") + "@" + + Var("v8_revision"), +} +""" + + def testChromiumRollUpToDate(self): + TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() + json_output_file = os.path.join(TEST_CONFIG["CHROMIUM"], "out.json") + TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) + self.Expect([ + Cmd("git fetch origin", ""), + Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), + Cmd("git describe --tags last_roll_hsh", "3.22.4"), + Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), + Cmd("git rev-list --max-age=395200 --tags", + "bad_tag\nroll_hsh\nhash_123"), + Cmd("git describe --tags bad_tag", ""), + Cmd("git describe --tags roll_hsh", "3.22.4"), + Cmd("git describe --tags hash_123", "3.22.3"), + Cmd("git describe --tags roll_hsh", "3.22.4"), + Cmd("git describe --tags hash_123", "3.22.3"), + ]) + + result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( + AUTO_PUSH_ARGS + [ + "-c", TEST_CONFIG["CHROMIUM"], + "--json-output", json_output_file]) + self.assertEquals(0, result) + json_output = json.loads(FileToText(json_output_file)) + self.assertEquals("up_to_date", json_output["monitoring_state"]) + def testChromiumRoll(self): # Setup fake directory structures. TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() + json_output_file = os.path.join(TEST_CONFIG["CHROMIUM"], "out.json") + TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) TextToFile("", os.path.join(TEST_CONFIG["CHROMIUM"], ".git")) chrome_dir = TEST_CONFIG["CHROMIUM"] os.makedirs(os.path.join(chrome_dir, "v8")) - # Write fake deps file. - TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", - os.path.join(chrome_dir, "DEPS")) def WriteDeps(): TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line", os.path.join(chrome_dir, "DEPS")) @@ -1034,12 +1072,17 @@ TBR=g_name@chromium.org,reviewer@chromium.org""" expectations = [ Cmd("git fetch origin", ""), Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), - Cmd("git log -1 --format=%s roll_hsh", - "Version 3.22.4 (based on abc)\n"), + Cmd("git describe --tags last_roll_hsh", "3.22.3.1"), + Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), + Cmd("git rev-list --max-age=395200 --tags", + "bad_tag\nroll_hsh\nhash_123"), + Cmd("git describe --tags bad_tag", ""), + Cmd("git describe --tags roll_hsh", "3.22.4"), + Cmd("git describe --tags hash_123", "3.22.3"), + Cmd("git describe --tags roll_hsh", "3.22.4"), + Cmd("git log -1 --format=%s roll_hsh", "Version 3.22.4\n"), Cmd("git describe --tags roll_hsh", "3.22.4"), Cmd("git describe --tags last_roll_hsh", "3.22.2.1"), - URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js", - "document.write('g_name')"), Cmd("git status -s -uno", "", cwd=chrome_dir), Cmd("git checkout -f master", "", cwd=chrome_dir), Cmd("git branch", "", cwd=chrome_dir), @@ -1052,23 +1095,23 @@ TBR=g_name@chromium.org,reviewer@chromium.org""" "--author \"author@chromium.org <author@chromium.org>\"" % self.ROLL_COMMIT_MSG), "", cwd=chrome_dir), - Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f", "", - cwd=chrome_dir), + Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f " + "--use-commit-queue", "", cwd=chrome_dir), Cmd("git checkout -f master", "", cwd=chrome_dir), Cmd("git branch -D work-branch", "", cwd=chrome_dir), ] self.Expect(expectations) args = ["-a", "author@chromium.org", "-c", chrome_dir, - "--sheriff", - "-r", "reviewer@chromium.org", - "--last-roll", "last_roll_hsh", - "roll_hsh"] - ChromiumRoll(TEST_CONFIG, self).Run(args) + "-r", "reviewer@chromium.org", "--json-output", json_output_file] + auto_roll.AutoRoll(TEST_CONFIG, self).Run(args) deps = FileToText(os.path.join(chrome_dir, "DEPS")) self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps)) + json_output = json.loads(FileToText(json_output_file)) + self.assertEquals("success", json_output["monitoring_state"]) + def testCheckLastPushRecently(self): self.Expect([ Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), @@ -1103,74 +1146,6 @@ TBR=g_name@chromium.org,reviewer@chromium.org""" self.assertEquals("abc123", state["candidate"]) - def testAutoRollExistingRoll(self): - self.Expect([ - 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(0, result) - - # Snippet from the original DEPS file. - FAKE_DEPS = """ -vars = { - "v8_revision": "abcd123455", -} -deps = { - "src/v8": - (Var("googlecode_url") % "v8") + "/" + Var("v8_branch") + "@" + - Var("v8_revision"), -} -""" - - def testAutoRollUpToDate(self): - TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() - TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) - self.Expect([ - URL("https://codereview.chromium.org/search", - "owner=author%40chromium.org&limit=30&closed=3&format=json", - ("{\"results\": [{\"subject\": \"different\"}]}")), - Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), - Cmd("git rev-list --max-age=740800 --tags", - "bad_tag\nhash_234\nhash_123"), - Cmd("git describe --tags bad_tag", ""), - Cmd("git describe --tags hash_234", "3.22.4"), - Cmd("git describe --tags hash_123", "3.22.3"), - Cmd("git describe --tags abcd123455", "3.22.4"), - Cmd("git describe --tags hash_234", "3.22.4"), - Cmd("git describe --tags hash_123", "3.22.3"), - ]) - - result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( - AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"]]) - self.assertEquals(0, result) - - def testAutoRoll(self): - TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() - TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) - - self.Expect([ - URL("https://codereview.chromium.org/search", - "owner=author%40chromium.org&limit=30&closed=3&format=json", - ("{\"results\": [{\"subject\": \"different\"}]}")), - Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), - Cmd("git rev-list --max-age=740800 --tags", - "bad_tag\nhash_234\nhash_123"), - Cmd("git describe --tags bad_tag", ""), - Cmd("git describe --tags hash_234", "3.22.4"), - Cmd("git describe --tags hash_123", "3.22.3"), - Cmd("git describe --tags abcd123455", "3.22.3.1"), - Cmd("git describe --tags hash_234", "3.22.4"), - ]) - - 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() TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) |