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

Side by Side Diff: tools/push-to-trunk/auto_roll.py

Issue 196883003: Suppress error handling for test coverage in push and merge scripts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/push-to-trunk/common_includes.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 the V8 project authors. All rights reserved. 2 # Copyright 2013 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 if re.search(r"nopush|no push", self["tree_message"], flags=re.I): 75 if re.search(r"nopush|no push", self["tree_message"], flags=re.I):
76 self.Die("Push to trunk disabled by tree state: %s" 76 self.Die("Push to trunk disabled by tree state: %s"
77 % self["tree_message"]) 77 % self["tree_message"])
78 78
79 79
80 class FetchLatestRevision(Step): 80 class FetchLatestRevision(Step):
81 MESSAGE = "Fetching latest V8 revision." 81 MESSAGE = "Fetching latest V8 revision."
82 82
83 def RunStep(self): 83 def RunStep(self):
84 match = re.match(r"^r(\d+) ", self.GitSVNLog()) 84 match = re.match(r"^r(\d+) ", self.GitSVNLog())
85 if not match: 85 if not match: # pragma: no cover
86 self.Die("Could not extract current svn revision from log.") 86 self.Die("Could not extract current svn revision from log.")
87 self["latest"] = match.group(1) 87 self["latest"] = match.group(1)
88 88
89 89
90 class CheckLastPush(Step): 90 class CheckLastPush(Step):
91 MESSAGE = "Checking last V8 push to trunk." 91 MESSAGE = "Checking last V8 push to trunk."
92 92
93 def RunStep(self): 93 def RunStep(self):
94 last_push_hash = self.FindLastTrunkPush() 94 last_push_hash = self.FindLastTrunkPush()
95 last_push = int(self.GitSVNFindSVNRev(last_push_hash)) 95 last_push = int(self.GitSVNFindSVNRev(last_push_hash))
96 96
97 # TODO(machenbach): This metric counts all revisions. It could be 97 # TODO(machenbach): This metric counts all revisions. It could be
98 # improved by counting only the revisions on bleeding_edge. 98 # improved by counting only the revisions on bleeding_edge.
99 if int(self["latest"]) - last_push < 10: 99 if int(self["latest"]) - last_push < 10: # pragma: no cover
100 # This makes sure the script doesn't push twice in a row when the cron 100 # This makes sure the script doesn't push twice in a row when the cron
101 # job retries several times. 101 # job retries several times.
102 self.Die("Last push too recently: %d" % last_push) 102 self.Die("Last push too recently: %d" % last_push)
103 103
104 104
105 class FetchLKGR(Step): 105 class FetchLKGR(Step):
106 MESSAGE = "Fetching V8 LKGR." 106 MESSAGE = "Fetching V8 LKGR."
107 107
108 def RunStep(self): 108 def RunStep(self):
109 lkgr_url = "https://v8-status.appspot.com/lkgr" 109 lkgr_url = "https://v8-status.appspot.com/lkgr"
(...skipping 21 matching lines...) Expand all
131 def RunStep(self): 131 def RunStep(self):
132 latest = int(self["latest"]) 132 latest = int(self["latest"])
133 lkgr = int(self["lkgr"]) 133 lkgr = int(self["lkgr"])
134 if latest == lkgr: 134 if latest == lkgr:
135 print "ToT (r%d) is clean. Pushing to trunk." % latest 135 print "ToT (r%d) is clean. Pushing to trunk." % latest
136 self.PushTreeStatus("Tree is closed (preparing to push)") 136 self.PushTreeStatus("Tree is closed (preparing to push)")
137 137
138 # TODO(machenbach): Update the script before calling it. 138 # TODO(machenbach): Update the script before calling it.
139 try: 139 try:
140 if self._options.push: 140 if self._options.push:
141 P = push_to_trunk.PushToTrunk
141 self._side_effect_handler.Call( 142 self._side_effect_handler.Call(
142 PushToTrunk(push_to_trunk.CONFIG, self._side_effect_handler).Run, 143 P(push_to_trunk.CONFIG, self._side_effect_handler).Run,
143 ["-a", self._options.author, 144 ["-a", self._options.author,
144 "-c", self._options.chromium, 145 "-c", self._options.chromium,
145 "-r", self._options.reviewer, 146 "-r", self._options.reviewer,
146 "-f"]) 147 "-f"])
147 finally: 148 finally:
148 self.PushTreeStatus(self["tree_message"]) 149 self.PushTreeStatus(self["tree_message"])
149 else: 150 else:
150 print("ToT (r%d) is ahead of the LKGR (r%d). Skipping push to trunk." 151 print("ToT (r%d) is ahead of the LKGR (r%d). Skipping push to trunk."
151 % (latest, lkgr)) 152 % (latest, lkgr))
152 153
153 154
154 class AutoRoll(ScriptsBase): 155 class AutoRoll(ScriptsBase):
155 def _PrepareOptions(self, parser): 156 def _PrepareOptions(self, parser):
156 parser.add_argument("-c", "--chromium", required=True, 157 parser.add_argument("-c", "--chromium", required=True,
157 help=("The path to your Chromium src/ " 158 help=("The path to your Chromium src/ "
158 "directory to automate the V8 roll.")) 159 "directory to automate the V8 roll."))
159 parser.add_argument("-p", "--push", 160 parser.add_argument("-p", "--push",
160 help="Push to trunk. Dry run if unspecified.", 161 help="Push to trunk. Dry run if unspecified.",
161 default=False, action="store_true") 162 default=False, action="store_true")
162 parser.add_argument("--status-password", 163 parser.add_argument("--status-password",
163 help="A file with the password to the status app.") 164 help="A file with the password to the status app.")
164 165
165 def _ProcessOptions(self, options): 166 def _ProcessOptions(self, options):
166 if not options.author or not options.reviewer: 167 if not options.author or not options.reviewer: # pragma: no cover
167 print "You need to specify author and reviewer." 168 print "You need to specify author and reviewer."
168 return False 169 return False
169 options.requires_editor = False 170 options.requires_editor = False
170 return True 171 return True
171 172
172 def _Steps(self): 173 def _Steps(self):
173 return [ 174 return [
174 Preparation, 175 Preparation,
175 CheckAutoRollSettings, 176 CheckAutoRollSettings,
176 CheckTreeStatus, 177 CheckTreeStatus,
177 FetchLatestRevision, 178 FetchLatestRevision,
178 CheckLastPush, 179 CheckLastPush,
179 FetchLKGR, 180 FetchLKGR,
180 PushToTrunk, 181 PushToTrunk,
181 ] 182 ]
182 183
183 184
184 if __name__ == "__main__": 185 if __name__ == "__main__": # pragma: no cover
185 sys.exit(AutoRoll(CONFIG).Run()) 186 sys.exit(AutoRoll(CONFIG).Run())
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/common_includes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698