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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 urllib.urlretrieve(download_url, BUILD_ZIP_NAME) | 105 urllib.urlretrieve(download_url, BUILD_ZIP_NAME) |
106 except Exception, e: | 106 except Exception, e: |
107 print("Could not retrieve the download. Sorry.") | 107 print("Could not retrieve the download. Sorry.") |
108 sys.exit(-1) | 108 sys.exit(-1) |
109 | 109 |
110 # Unzip the file. | 110 # Unzip the file. |
111 print 'Unzipping ...' | 111 print 'Unzipping ...' |
112 os.system("unzip -q %s" % BUILD_ZIP_NAME) | 112 os.system("unzip -q %s" % BUILD_ZIP_NAME) |
113 | 113 |
114 # Tell the system to open the app. | 114 # Tell the system to open the app. |
115 print 'Running %s/%s/%s' % (os.getcwd(), BUILD_DIR_NAME, BUILD_EXE_NAME) | 115 flags = '--user-data-dir=profile' |
| 116 print 'Running %s/%s/%s %s' % (os.getcwd(), BUILD_DIR_NAME, BUILD_EXE_NAME, |
| 117 flags) |
116 if BUILD_ARCHIVE_TYPE in ('linux', 'linux-64'): | 118 if BUILD_ARCHIVE_TYPE in ('linux', 'linux-64'): |
117 os.system("%s/%s" % (BUILD_DIR_NAME, BUILD_EXE_NAME)) | 119 os.system("%s/%s %s" % (BUILD_DIR_NAME, BUILD_EXE_NAME, flags)) |
118 elif BUILD_ARCHIVE_TYPE in ('mac'): | 120 elif BUILD_ARCHIVE_TYPE in ('mac'): |
119 os.system("open %s/%s" % (BUILD_DIR_NAME, BUILD_EXE_NAME)) | 121 os.system("open %s/%s %s" % (BUILD_DIR_NAME, BUILD_EXE_NAME, flags)) |
120 elif BUILD_ARCHIVE_TYPE in ('xp'): | 122 elif BUILD_ARCHIVE_TYPE in ('xp'): |
121 # TODO(mmoss) Does Windows need 'start' or something? | 123 # TODO(mmoss) Does Windows need 'start' or something? |
122 os.system("%s/%s" % (BUILD_DIR_NAME, BUILD_EXE_NAME)) | 124 os.system("%s/%s %s" % (BUILD_DIR_NAME, BUILD_EXE_NAME, flags)) |
123 | 125 |
124 os.chdir(cwd) | 126 os.chdir(cwd) |
125 print 'Cleaning temp dir ...' | 127 print 'Cleaning temp dir ...' |
126 try: | 128 try: |
127 shutil.rmtree(tempdir, True) | 129 shutil.rmtree(tempdir, True) |
128 except Exception, e: | 130 except Exception, e: |
129 pass | 131 pass |
130 | 132 |
131 def AskIsGoodBuild(rev): | 133 def AskIsGoodBuild(rev): |
132 """Annoyingly ask the user whether build |rev| is good or bad.""" | 134 """Annoyingly ask the user whether build |rev| is good or bad.""" |
133 while True: | 135 while True: |
134 check = raw_input("\nBuild %d is [(g)ood/(b)ad]: " % int(rev))[0] | 136 check = raw_input("\nBuild %d is [(g)ood/(b)ad]: " % int(rev))[0] |
135 if (check == "g" or check == "b"): | 137 if (check == "g" or check == "b"): |
136 return (check == "g") | 138 return (check == "g") |
137 else: | 139 else: |
138 print("Just answer the question...") | 140 print("Just answer the question...") |
139 | 141 |
140 def main(): | 142 def main(): |
141 usage = ('%prog [options]\n' | 143 usage = ('%prog [options]\n' |
142 'Perform binary search on the snapshot builds.') | 144 'Perform binary search on the snapshot builds.') |
143 parser = optparse.OptionParser(usage=usage) | 145 parser = optparse.OptionParser(usage=usage) |
| 146 # Strangely, the default help output doesn't include the choice list. |
| 147 choices = ['mac', 'xp', 'linux', 'linux-64'] |
144 parser.add_option('-a', '--archive', | 148 parser.add_option('-a', '--archive', |
145 choices = ['mac', 'xp', 'linux', 'linux-64'], | 149 choices = choices, |
146 help = 'The buildbot archive to bisect.') | 150 help = 'The buildbot archive to bisect [%s].' % |
| 151 '|'.join(choices)) |
147 parser.add_option('-b', '--bad', type = 'int', | 152 parser.add_option('-b', '--bad', type = 'int', |
148 help = 'The bad revision to bisect to.') | 153 help = 'The bad revision to bisect to.') |
149 parser.add_option('-g', '--good', type = 'int', | 154 parser.add_option('-g', '--good', type = 'int', |
150 help = 'The last known good revision to bisect from.') | 155 help = 'The last known good revision to bisect from.') |
151 (opts, args) = parser.parse_args() | 156 (opts, args) = parser.parse_args() |
152 | 157 |
153 if opts.archive is None: | 158 if opts.archive is None: |
154 parser.print_help() | 159 parser.print_help() |
155 return 1 | 160 return 1 |
156 | 161 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 else: | 228 else: |
224 bad = test | 229 bad = test |
225 | 230 |
226 # We're done. Let the user know the results in an official manner. | 231 # We're done. Let the user know the results in an official manner. |
227 print("You are probably looking for build %d." % revlist[bad]) | 232 print("You are probably looking for build %d." % revlist[bad]) |
228 print("This is the ViewVC URL for the potential bustage:") | 233 print("This is the ViewVC URL for the potential bustage:") |
229 print(BUILD_VIEWVC_URL % revlist[bad]) | 234 print(BUILD_VIEWVC_URL % revlist[bad]) |
230 | 235 |
231 if __name__ == '__main__': | 236 if __name__ == '__main__': |
232 sys.exit(main()) | 237 sys.exit(main()) |
OLD | NEW |