diff options
author | simonhatch@chromium.org <simonhatch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-12 04:00:41 +0000 |
---|---|---|
committer | simonhatch@chromium.org <simonhatch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-12 04:00:41 +0000 |
commit | aedeaf64f2c0e2fbdef8c43f4554f9648bc815a5 (patch) | |
tree | 8eb998e6f06cf7c06b35e0e2b7a55c7ceaa22e6a /tools/bisect-perf-regression.py | |
parent | 798501315e5d0c0c094af9d47c268b735523e59a (diff) | |
download | chromium_src-aedeaf64f2c0e2fbdef8c43f4554f9648bc815a5.zip chromium_src-aedeaf64f2c0e2fbdef8c43f4554f9648bc815a5.tar.gz chromium_src-aedeaf64f2c0e2fbdef8c43f4554f9648bc815a5.tar.bz2 |
Modified bisect script to delete the webkit directory when before sycing to/from blink/webkit.
BUG=230428
Review URL: https://chromiumcodereview.appspot.com/14088003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/bisect-perf-regression.py')
-rwxr-xr-x | tools/bisect-perf-regression.py | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tools/bisect-perf-regression.py b/tools/bisect-perf-regression.py index 40e23d5..768c77f 100755 --- a/tools/bisect-perf-regression.py +++ b/tools/bisect-perf-regression.py @@ -476,6 +476,24 @@ class GitSourceControl(SourceControl): return commit_info + def CheckoutFileAtRevision(self, file_name, revision): + """Performs a checkout on a file at the given revision. + + Returns: + True if successful. + """ + return not RunGit(['checkout', revision, file_name])[1] + + def RevertFileToHead(self, file_name): + """Unstages a file and returns it to HEAD. + + Returns: + True if successful. + """ + # Reset doesn't seem to return 0 on success. + RunGit(['reset', 'HEAD', FILE_DEPS_GIT]) + + return not RunGit(['checkout', FILE_DEPS_GIT])[1] class BisectPerformanceMetrics(object): """BisectPerformanceMetrics performs a bisection against a list of range @@ -491,6 +509,9 @@ class BisectPerformanceMetrics(object): self.depot_cwd = {} self.cleanup_commands = [] + # This always starts true since the script grabs latest first. + self.was_blink = True + for d in DEPOT_NAMES: # The working directory of each depot is just the path to the depot, but # since we're already in 'src', we can skip that part. @@ -765,6 +786,53 @@ class BisectPerformanceMetrics(object): path_to_file = os.path.join(path, cur_file) os.remove(path_to_file) + def PerformWebkitDirectoryCleanup(self, revision): + """If the script is switching between Blink and WebKit during bisect, + its faster to just delete the directory rather than leave it up to git + to sync. + + Returns: + True if successful. + """ + if not self.source_control.CheckoutFileAtRevision( + FILE_DEPS_GIT, revision): + return False + + cwd = os.getcwd() + os.chdir(self.src_cwd) + + locals = {'Var': lambda _: locals["vars"][_], + 'From': lambda *args: None} + execfile(FILE_DEPS_GIT, {}, locals) + + os.chdir(cwd) + + is_blink = 'blink.git' in locals['vars']['webkit_url'] + + if not self.source_control.RevertFileToHead(FILE_DEPS_GIT): + return False + + if self.was_blink != is_blink: + self.was_blink = is_blink + try: + path_to_dir = os.path.join(os.getcwd(), 'third_party', 'WebKit') + if os.path.exists(path_to_dir): + shutil.rmtree(path_to_dir) + except OSError, e: + if e.errno != errno.ENOENT: + return False + return True + + def PerformPreSyncCleanup(self, revision, depot): + """Performs any necessary cleanup before syncing. + + Returns: + True if successful. + """ + if depot == 'chromium': + return self.PerformWebkitDirectoryCleanup(revision) + return True + def SyncBuildAndRunRevision(self, revision, depot, command_to_run, metric): """Performs a full sync/build/run of the specified revision. @@ -785,6 +853,9 @@ class BisectPerformanceMetrics(object): if not revisions_to_sync: return ('Failed to resolve dependant depots.', 1) + if not self.PerformPreSyncCleanup(revision, depot): + return ('Failed to perform pre-sync cleanup.', 1) + success = True if not self.opts.debug_ignore_sync: |