| OLD | NEW |
| 1 #!/usr/bin/python2.5 | 1 #!/usr/bin/python2.5 |
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Snapshot Build Bisect Tool | 6 """Snapshot Build Bisect Tool |
| 7 | 7 |
| 8 This script bisects a snapshot archive using binary search. It starts at | 8 This script bisects a snapshot archive using binary search. It starts at |
| 9 a bad revision (it will try to guess HEAD) and asks for a last known-good | 9 a bad revision (it will try to guess HEAD) and asks for a last known-good |
| 10 revision. It will then binary search across this revision range by downloading, | 10 revision. It will then binary search across this revision range by downloading, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 def AskIsGoodBuild(rev): | 138 def AskIsGoodBuild(rev): |
| 139 """Annoyingly ask the user whether build |rev| is good or bad.""" | 139 """Annoyingly ask the user whether build |rev| is good or bad.""" |
| 140 while True: | 140 while True: |
| 141 check = raw_input("\nBuild %d is [(g)ood/(b)ad]: " % int(rev))[0] | 141 check = raw_input("\nBuild %d is [(g)ood/(b)ad]: " % int(rev))[0] |
| 142 if (check == "g" or check == "b"): | 142 if (check == "g" or check == "b"): |
| 143 return (check == "g") | 143 return (check == "g") |
| 144 else: | 144 else: |
| 145 print("Just answer the question...") | 145 print("Just answer the question...") |
| 146 | 146 |
| 147 def main(): | 147 def main(): |
| 148 usage = ('%prog [options]\n' | 148 usage = ('%prog [options] [-- chromium-options]\n' |
| 149 'Perform binary search on the snapshot builds.') | 149 'Perform binary search on the snapshot builds.') |
| 150 parser = optparse.OptionParser(usage=usage) | 150 parser = optparse.OptionParser(usage=usage) |
| 151 # Strangely, the default help output doesn't include the choice list. | 151 # Strangely, the default help output doesn't include the choice list. |
| 152 choices = ['mac', 'xp', 'linux', 'linux-64'] | 152 choices = ['mac', 'xp', 'linux', 'linux-64'] |
| 153 parser.add_option('-a', '--archive', | 153 parser.add_option('-a', '--archive', |
| 154 choices = choices, | 154 choices = choices, |
| 155 help = 'The buildbot archive to bisect [%s].' % | 155 help = 'The buildbot archive to bisect [%s].' % |
| 156 '|'.join(choices)) | 156 '|'.join(choices)) |
| 157 parser.add_option('-b', '--bad', type = 'int', | 157 parser.add_option('-b', '--bad', type = 'int', |
| 158 help = 'The bad revision to bisect to.') | 158 help = 'The bad revision to bisect to.') |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 good_rev = opts.good | 199 good_rev = opts.good |
| 200 else: | 200 else: |
| 201 good_rev = 0 | 201 good_rev = 0 |
| 202 try: | 202 try: |
| 203 good_rev = int(raw_input("Last known good [0]: ")) | 203 good_rev = int(raw_input("Last known good [0]: ")) |
| 204 except Exception, e: | 204 except Exception, e: |
| 205 pass | 205 pass |
| 206 | 206 |
| 207 # Get a list of revisions to bisect across. | 207 # Get a list of revisions to bisect across. |
| 208 revlist = GetRevList(good_rev, bad_rev) | 208 revlist = GetRevList(good_rev, bad_rev) |
| 209 if len(revlist) < 2: # Don't have enough builds to bisect |
| 210 print "We don't have enough builds to bisect. revlist: %s" % revlist |
| 211 sys.exit(1) |
| 209 | 212 |
| 210 # If we don't have a |good_rev|, set it to be the first revision possible. | 213 # If we don't have a |good_rev|, set it to be the first revision possible. |
| 211 if good_rev == 0: | 214 if good_rev == 0: |
| 212 good_rev = revlist[0] | 215 good_rev = revlist[0] |
| 213 | 216 |
| 214 # These are indexes of |revlist|. | 217 # These are indexes of |revlist|. |
| 215 good = 0 | 218 good = 0 |
| 216 bad = len(revlist) - 1 | 219 bad = len(revlist) - 1 |
| 217 last_known_good_rev = revlist[good] | 220 last_known_good_rev = revlist[good] |
| 218 | 221 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 243 | 246 |
| 244 # We're done. Let the user know the results in an official manner. | 247 # We're done. Let the user know the results in an official manner. |
| 245 print("You are probably looking for build %d." % revlist[bad]) | 248 print("You are probably looking for build %d." % revlist[bad]) |
| 246 print("CHANGELOG URL:") | 249 print("CHANGELOG URL:") |
| 247 print(CHANGELOG_URL % (last_known_good_rev, revlist[bad])) | 250 print(CHANGELOG_URL % (last_known_good_rev, revlist[bad])) |
| 248 print("Built at revision:") | 251 print("Built at revision:") |
| 249 print(BUILD_VIEWVC_URL % revlist[bad]) | 252 print(BUILD_VIEWVC_URL % revlist[bad]) |
| 250 | 253 |
| 251 if __name__ == '__main__': | 254 if __name__ == '__main__': |
| 252 sys.exit(main()) | 255 sys.exit(main()) |
| OLD | NEW |