diff options
author | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-17 20:50:50 +0000 |
---|---|---|
committer | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-17 20:50:50 +0000 |
commit | e29c08c582bf0a23c68dde448d0a486e15a4e2d6 (patch) | |
tree | 7ba4746f50dbf55f84be016fa516a78e13501010 | |
parent | fa3a7e87b0468ee6d8e44954af2a1123ab260671 (diff) | |
download | chromium_src-e29c08c582bf0a23c68dde448d0a486e15a4e2d6.zip chromium_src-e29c08c582bf0a23c68dde448d0a486e15a4e2d6.tar.gz chromium_src-e29c08c582bf0a23c68dde448d0a486e15a4e2d6.tar.bz2 |
Don't crash on corrupted archive and allow user to continue bisect with different builds.
BUG=NONE
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/10917277
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157192 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | tools/bisect-builds.py | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py index 8a02b25..04b4689 100755 --- a/tools/bisect-builds.py +++ b/tools/bisect-builds.py @@ -240,29 +240,25 @@ def UnzipFilenameToDir(filename, dir): filename = os.path.join(cwd, filename) zf = zipfile.ZipFile(filename) # Make base. - try: - if not os.path.isdir(dir): - os.mkdir(dir) - os.chdir(dir) - # Extract files. - for info in zf.infolist(): - name = info.filename - if name.endswith('/'): # dir - if not os.path.isdir(name): - os.makedirs(name) - else: # file - dir = os.path.dirname(name) - if not os.path.isdir(dir): - os.makedirs(dir) - out = open(name, 'wb') - out.write(zf.read(name)) - out.close() - # Set permissions. Permission info in external_attr is shifted 16 bits. - os.chmod(name, info.external_attr >> 16L) - os.chdir(cwd) - except Exception, e: - print >>sys.stderr, e - sys.exit(1) + if not os.path.isdir(dir): + os.mkdir(dir) + os.chdir(dir) + # Extract files. + for info in zf.infolist(): + name = info.filename + if name.endswith('/'): # dir + if not os.path.isdir(name): + os.makedirs(name) + else: # file + dir = os.path.dirname(name) + if not os.path.isdir(dir): + os.makedirs(dir) + out = open(name, 'wb') + out.write(zf.read(name)) + out.close() + # Set permissions. Permission info in external_attr is shifted 16 bits. + os.chmod(name, info.external_attr >> 16L) + os.chdir(cwd) def FetchRevision(context, rev, filename, quit_event=None, progress_event=None): @@ -476,12 +472,18 @@ def Bisect(platform, up_fetch.Start() # Run test on the pivot revision. - (status, stdout, stderr) = RunRevision(context, - rev, - zipfile, - profile, - num_runs, - try_args) + status = None + stdout = None + stderr = None + try: + (status, stdout, stderr) = RunRevision(context, + rev, + zipfile, + profile, + num_runs, + try_args) + except Exception, e: + print >>sys.stderr, e os.unlink(zipfile) zipfile = None |