Chromium Code Reviews| Index: tools/bisect-builds.py |
| diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py |
| index 04b4689d4e42dd5935ff9fcb4b6b21bc11c7001f..4733e00d69b234608704318e554648fc10cca2db 100755 |
| --- a/tools/bisect-builds.py |
| +++ b/tools/bisect-builds.py |
| @@ -182,7 +182,7 @@ class PathContext(object): |
| except ValueError: |
| pass |
| return (revisions, next_marker) |
| - |
| + |
| # Fetch the first list of revisions. |
| (revisions, next_marker) = _FetchAndParse(self.GetListingURL()) |
| @@ -296,23 +296,20 @@ 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, exec_args, outdir=None): |
| """Given a zipped revision, unzip it and run the test.""" |
|
Robert Sesek
2012/09/24 17:52:30
Can you properly document this function's params?
hartmanng
2012/09/24 20:13:20
Done.
|
| 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) |
| + testargs = exec_args(os.path.join(tempdir, context.GetLaunchPath())) |
| - # 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, |
| @@ -320,7 +317,19 @@ def RunRevision(context, revision, zipfile, profile, num_runs, args): |
| stderr=subprocess.PIPE) |
| (stdout, stderr) = subproc.communicate() |
| - os.chdir(cwd) |
| + 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') |
|
Robert Sesek
2012/09/24 17:52:30
This should probably align with the 'o' in |os| si
hartmanng
2012/09/24 20:13:20
Done.
|
| + fout.write(stdout) |
| + fout.close() |
| + ferr = open(os.path.join(outdir, '%s_%s.err' % (str(revision), str(i))), |
| + 'w') |
| + ferr.write(stderr) |
| + ferr.close() |
| + |
| try: |
| shutil.rmtree(tempdir, True) |
| except Exception, e: |
| @@ -471,6 +480,9 @@ def Bisect(platform, |
| _GetDownloadPath(up_rev)) |
| up_fetch.Start() |
| + def execute_args(chrome_path): |
| + return [chrome_path, '--user-data-dir=%s' % profile] + try_args |
| + |
| # Run test on the pivot revision. |
| status = None |
| stdout = None |
| @@ -479,11 +491,11 @@ def Bisect(platform, |
| (status, stdout, stderr) = RunRevision(context, |
| rev, |
| zipfile, |
| - profile, |
| num_runs, |
| - try_args) |
| + execute_args) |
| except Exception, e: |
| print >>sys.stderr, e |
| + |
| os.unlink(zipfile) |
| zipfile = None |