Revision: 19838
Author: [email protected]
Date: Wed Mar 12 10:45:23 2014 UTC
Log: Suppress error handling for test coverage in push and merge
scripts.
- This adds a suppression of lines concerning error handling for the test
coverage analysis
- Fixes also calling push-to-trunk from auto-roll
TEST=tools/push-to-trunk/script_test.py
[email protected]
Review URL: https://codereview.chromium.org/196883003
http://code.google.com/p/v8/source/detail?r=19838
Modified:
/branches/bleeding_edge/tools/push-to-trunk/auto_roll.py
/branches/bleeding_edge/tools/push-to-trunk/common_includes.py
/branches/bleeding_edge/tools/push-to-trunk/git_recipes.py
/branches/bleeding_edge/tools/push-to-trunk/merge_to_branch.py
/branches/bleeding_edge/tools/push-to-trunk/push_to_trunk.py
/branches/bleeding_edge/tools/push-to-trunk/test_scripts.py
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/auto_roll.py Tue Mar 4
23:27:27 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/auto_roll.py Wed Mar 12
10:45:23 2014 UTC
@@ -82,7 +82,7 @@
def RunStep(self):
match = re.match(r"^r(\d+) ", self.GitSVNLog())
- if not match:
+ if not match: # pragma: no cover
self.Die("Could not extract current svn revision from log.")
self["latest"] = match.group(1)
@@ -96,7 +96,7 @@
# TODO(machenbach): This metric counts all revisions. It could be
# improved by counting only the revisions on bleeding_edge.
- if int(self["latest"]) - last_push < 10:
+ if int(self["latest"]) - last_push < 10: # pragma: no cover
# This makes sure the script doesn't push twice in a row when the
cron
# job retries several times.
self.Die("Last push too recently: %d" % last_push)
@@ -138,8 +138,9 @@
# TODO(machenbach): Update the script before calling it.
try:
if self._options.push:
+ P = push_to_trunk.PushToTrunk
self._side_effect_handler.Call(
- PushToTrunk(push_to_trunk.CONFIG,
self._side_effect_handler).Run,
+ P(push_to_trunk.CONFIG, self._side_effect_handler).Run,
["-a", self._options.author,
"-c", self._options.chromium,
"-r", self._options.reviewer,
@@ -163,7 +164,7 @@
help="A file with the password to the status app.")
def _ProcessOptions(self, options):
- if not options.author or not options.reviewer:
+ if not options.author or not options.reviewer: # pragma: no cover
print "You need to specify author and reviewer."
return False
options.requires_editor = False
@@ -181,5 +182,5 @@
]
-if __name__ == "__main__":
+if __name__ == "__main__": # pragma: no cover
sys.exit(AutoRoll(CONFIG).Run())
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/common_includes.py Tue Mar
4 23:27:27 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/common_includes.py Wed Mar
12 10:45:23 2014 UTC
@@ -192,7 +192,7 @@
# Wrapper for side effects.
-class SideEffectHandler(object):
+class SideEffectHandler(object): # pragma: no cover
def Call(self, fun, *args, **kwargs):
return fun(*args, **kwargs)
@@ -270,7 +270,7 @@
# Persist state.
TextToFile(json.dumps(self._state), state_file)
- def RunStep(self):
+ def RunStep(self): # pragma: no cover
raise NotImplementedError
def Retry(self, cb, retry_on=None, wait_plan=None):
@@ -295,7 +295,7 @@
except Exception:
got_exception = True
if got_exception or retry_on(result):
- if not wait_plan:
+ if not wait_plan: # pragma: no cover
raise Exception("Retried too often. Giving up.")
wait_time = wait_plan.pop()
print "Waiting for %f seconds." % wait_time
@@ -343,7 +343,7 @@
raise Exception(msg)
def DieNoManualMode(self, msg=""):
- if not self._options.manual:
+ if not self._options.manual: # pragma: no cover
msg = msg or "Only available in manual mode."
self.Die(msg)
@@ -365,17 +365,17 @@
def InitialEnvironmentChecks(self):
# Cancel if this is not a git checkout.
- if not os.path.exists(self._config[DOT_GIT_LOCATION]):
+ if not os.path.exists(self._config[DOT_GIT_LOCATION]): # pragma: no
cover
self.Die("This is not a git checkout, this script won't work for
you.")
# Cancel if EDITOR is unset or not executable.
if (self._options.requires_editor and (not os.environ.get("EDITOR") or
- Command("which", os.environ["EDITOR"]) is None)):
+ Command("which", os.environ["EDITOR"]) is None)): # pragma: no
cover
self.Die("Please set your EDITOR environment variable, you'll need
it.")
def CommonPrepare(self):
# Check for a clean workdir.
- if not self.GitIsWorkdirClean():
+ if not self.GitIsWorkdirClean(): # pragma: no cover
self.Die("Workspace is not clean. Please commit or undo your
changes.")
# Persist current branch.
@@ -507,7 +507,7 @@
def _ProcessOptions(self, options):
return True
- def _Steps(self):
+ def _Steps(self): # pragma: no cover
raise Exception("Not implemented.")
def MakeOptions(self, args=None):
@@ -522,13 +522,13 @@
self._PrepareOptions(parser)
- if args is None:
+ if args is None: # pragma: no cover
options = parser.parse_args()
else:
options = parser.parse_args(args)
# Process common options.
- if options.step < 0:
+ if options.step < 0: # pragma: no cover
print "Bad step number %d" % options.step
parser.print_help()
return None
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/git_recipes.py Wed Feb 26
16:12:32 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/git_recipes.py Wed Mar 12
10:45:23 2014 UTC
@@ -68,7 +68,7 @@
for line in self.Git("status -s -b -uno").strip().splitlines():
match = re.match(r"^## (.+)", line)
if match: return match.group(1)
- raise Exception("Couldn't find curent branch.")
+ raise Exception("Couldn't find curent branch.") # pragma: no cover
@Strip
def GitLog(self, n=0, format="", grep="", git_hash="", parent_hash="",
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/merge_to_branch.py Tue Mar
4 23:27:27 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/merge_to_branch.py Wed Mar
12 10:45:23 2014 UTC
@@ -57,7 +57,7 @@
if os.path.exists(self.Config(ALREADY_MERGING_SENTINEL_FILE)):
if self._options.force:
os.remove(self.Config(ALREADY_MERGING_SENTINEL_FILE))
- elif self._options.step == 0:
+ elif self._options.step == 0: # pragma: no cover
self.Die("A merge is already in progress")
open(self.Config(ALREADY_MERGING_SENTINEL_FILE), "a").close()
@@ -66,7 +66,7 @@
self["merge_to_branch"] = "bleeding_edge"
elif self._options.branch:
self["merge_to_branch"] = self._options.branch
- else:
+ else: # pragma: no cover
self.Die("Please specify a branch to merge to")
self.CommonPrepare()
@@ -95,7 +95,7 @@
branch="svn/bleeding_edge")
for git_hash in git_hashes.splitlines():
svn_revision = self.GitSVNFindSVNRev(git_hash, "svn/bleeding_edge")
- if not svn_revision:
+ if not svn_revision: # pragma: no cover
self.Die("Cannot determine svn revision for %s" % git_hash)
revision_title = self.GitLog(n=1, format="%s", git_hash=git_hash)
@@ -123,7 +123,7 @@
self["patch_commit_hashes"] = []
for revision in self["full_revision_list"]:
next_hash = self.GitSVNFindGitHash(revision, "svn/bleeding_edge")
- if not next_hash:
+ if not next_hash: # pragma: no cover
self.Die("Cannot determine git hash for r%s" % revision)
self["patch_commit_hashes"].append(next_hash)
@@ -131,7 +131,7 @@
self["revision_list"] = ", ".join(map(lambda s: "r%s" % s,
self["full_revision_list"]))
- if not self["revision_list"]:
+ if not self["revision_list"]: # pragma: no cover
self.Die("Revision list is empty.")
if self._options.revert:
@@ -232,7 +232,7 @@
self.GitSVNFetch()
commit_hash = self.GitLog(n=1, format="%H",
grep=self["new_commit_msg"],
branch="svn/%s" % self["merge_to_branch"])
- if not commit_hash:
+ if not commit_hash: # pragma: no cover
self.Die("Unable to map git commit to svn revision.")
self["svn_revision"] = self.GitSVNFindSVNRev(commit_hash)
print "subversion revision number is r%s" % self["svn_revision"]
@@ -327,5 +327,5 @@
]
-if __name__ == "__main__":
+if __name__ == "__main__": # pragma: no cover
sys.exit(MergeToBranch(CONFIG).Run())
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/push_to_trunk.py Wed Mar 12
07:39:56 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/push_to_trunk.py Wed Mar 12
10:45:23 2014 UTC
@@ -95,11 +95,11 @@
# the push commit message.
last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push)
last_push_be_svn = PUSH_MESSAGE_RE.match(last_push_title).group(1)
- if not last_push_be_svn:
+ if not last_push_be_svn: # pragma: no cover
self.Die("Could not retrieve bleeding edge revision for trunk
push %s"
% last_push)
last_push_bleeding_edge = self.GitSVNFindGitHash(last_push_be_svn)
- if not last_push_bleeding_edge:
+ if not last_push_bleeding_edge: # pragma: no cover
self.Die("Could not retrieve bleeding edge git hash for trunk
push %s"
% last_push)
@@ -129,7 +129,7 @@
# Fetch from Rietveld but only retry once with one second delay
since
# there might be many revisions.
body = self.ReadURL(cl_url, wait_plan=[1])
- except urllib2.URLError:
+ except urllib2.URLError: # pragma: no cover
pass
return body
@@ -186,7 +186,7 @@
changelog_entry = "\n".join(map(Fill80, changelog_entry.splitlines()))
changelog_entry = changelog_entry.lstrip()
- if changelog_entry == "":
+ if changelog_entry == "": # pragma: no cover
self.Die("Empty ChangeLog entry.")
# Safe new change log for adding it later to the trunk patch.
@@ -290,7 +290,7 @@
strip = lambda line: line.strip()
text = SplitMapJoin("\n\n", SplitMapJoin("\n",
strip, " "), "\n\n")(text)
- if not text:
+ if not text: # pragma: no cover
self.Die("Commit message editing failed.")
TextToFile(text, self.Config(COMMITMSG_FILE))
os.remove(self.Config(CHANGELOG_ENTRY_FILE))
@@ -347,7 +347,7 @@
if not self.Confirm("Please check if your local checkout is sane:
Inspect "
"%s, compile, run tests. Do you want to commit this new trunk "
"revision to the repository?" % self.Config(VERSION_FILE)):
- self.Die("Execution canceled.")
+ self.Die("Execution canceled.") # pragma: no cover
class CommitSVN(Step):
@@ -355,7 +355,7 @@
def RunStep(self):
result = self.GitSVNDCommit()
- if not result:
+ if not result: # pragma: no cover
self.Die("'git svn dcommit' failed.")
result = filter(lambda x: re.search(r"^Committed r[0-9]+", x),
result.splitlines())
@@ -405,10 +405,10 @@
os.chdir(self["chrome_path"])
self.InitialEnvironmentChecks()
# Check for a clean workdir.
- if not self.GitIsWorkdirClean():
+ if not self.GitIsWorkdirClean(): # 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(self.Config(DEPS_FILE)):
+ if not os.path.exists(self.Config(DEPS_FILE)): # pragma: no cover
self.Die("DEPS file not present.")
@@ -468,7 +468,7 @@
print("Congratulations, you have successfully created the trunk "
"revision %s and rolled it into Chromium. Please don't forget
to "
"update the v8rel spreadsheet:" % self["version"])
- else:
+ else: # pragma: no cover
print("Congratulations, you have successfully created the trunk "
"revision %s. Please don't forget to roll this new version
into "
"Chromium, and to update the v8rel spreadsheet:"
@@ -500,7 +500,7 @@
parser.add_argument("-l", "--last-push",
help="The git commit ID of the last push to
trunk.")
- def _ProcessOptions(self, options):
+ def _ProcessOptions(self, options): # pragma: no cover
if not options.manual and not options.reviewer:
print "A reviewer (-r) is required in (semi-)automatic mode."
return False
@@ -543,5 +543,5 @@
]
-if __name__ == "__main__":
+if __name__ == "__main__": # pragma: no cover
sys.exit(PushToTrunk(CONFIG).Run())
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Wed Mar 12
07:39:56 2014 UTC
+++ /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Wed Mar 12
10:45:23 2014 UTC
@@ -802,7 +802,7 @@
])
auto_roll.AutoRoll(TEST_CONFIG, self).Run(
- AUTO_ROLL_ARGS + ["--status-password", password])
+ AUTO_ROLL_ARGS + ["--status-password", password, "--push"])
state = json.loads(FileToText("%s-state.json"
% TEST_CONFIG[PERSISTFILE_BASENAME]))
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.