Index: tools/bisect-builds.py |
diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py |
index 8a02b25f45b816a6c46e69afe8b6aae8e825f6e5..40297f21fadf5ce633ec8a80b9b36e0e715168d5 100755 |
--- a/tools/bisect-builds.py |
+++ b/tools/bisect-builds.py |
@@ -300,23 +300,19 @@ def FetchRevision(context, rev, filename, quit_event=None, progress_event=None): |
pass |
-def RunRevision(context, revision, zipfile, profile, num_runs, args): |
+def RunRevision(context, revision, zipfile, num_runs, testargs, tempdir, |
+ outdir=None): |
Ian Vollick
2012/09/18 17:46:32
Why is tempdir a parameter? It doesn't look like g
hartmanng
2012/09/19 02:17:55
Done.
|
"""Given a zipped revision, unzip it and run the test.""" |
print "Trying revision %s..." % str(revision) |
- # Create a temp directory and unzip the revision into it. |
- cwd = os.getcwd() |
- tempdir = tempfile.mkdtemp(prefix='bisect_tmp') |
UnzipFilenameToDir(zipfile, tempdir) |
- os.chdir(tempdir) |
- # Run the build as many times as specified. |
- testargs = [context.GetLaunchPath(), '--user-data-dir=%s' % profile] + args |
# The sandbox must be run as root on Official Chrome, so bypass it. |
if context.is_official and (context.platform == 'linux' or |
context.platform == 'linux64'): |
testargs.append('--no-sandbox') |
+ # Run the build as many times as specified. |
for i in range(0, num_runs): |
subproc = subprocess.Popen(testargs, |
bufsize=-1, |
@@ -324,11 +320,18 @@ def RunRevision(context, revision, zipfile, profile, num_runs, args): |
stderr=subprocess.PIPE) |
(stdout, stderr) = subproc.communicate() |
- os.chdir(cwd) |
- try: |
- shutil.rmtree(tempdir, True) |
- except Exception, e: |
- pass |
+ if outdir is not None: |
+ if not os.path.isdir(outdir): |
+ os.mkdir(outdir) |
+ |
+ fout = open(os.path.join(outdir, '%s_%s.out' % (str(revision), str(i))), |
+ 'w') |
+ fout.write(stdout) |
+ fout.close() |
+ ferr = open(os.path.join(outdir, '%s_%s.err' % (str(revision), str(i))), |
+ 'w') |
+ ferr.write(stderr) |
+ ferr.close() |
Ian Vollick
2012/09/18 17:46:32
It looks like we shutil.rmtree after every call to
hartmanng
2012/09/19 02:17:55
Done.
|
return (subproc.returncode, stdout, stderr) |
@@ -476,12 +479,20 @@ def Bisect(platform, |
up_fetch.Start() |
# Run test on the pivot revision. |
+ tempdir = tempfile.mkdtemp(prefix='bisect_tmp') |
+ testargs = [os.path.join(tempdir, context.GetLaunchPath()), |
+ '--user-data-dir=%s' % profile] + try_args |
(status, stdout, stderr) = RunRevision(context, |
rev, |
zipfile, |
- profile, |
num_runs, |
- try_args) |
+ testargs, |
+ tempdir) |
+ try: |
+ shutil.rmtree(tempdir, True) |
+ except Exception, e: |
+ pass |
+ |
os.unlink(zipfile) |
zipfile = None |