Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(846)

Unified Diff: tools/auto_bisect/bisect_perf_regression.py

Issue 564663002: Move bisect-perf-regression.py into auto_bisect directory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Upload a config for doing a test run. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/auto_bisect/bisect_perf_regression.py
diff --git a/tools/bisect-perf-regression.py b/tools/auto_bisect/bisect_perf_regression.py
similarity index 98%
rename from tools/bisect-perf-regression.py
rename to tools/auto_bisect/bisect_perf_regression.py
index 2030677c2c21ce12c7ffeba913299fb840516b90..81f499162e45415375720d9ea4efb918b9901a49 100755
--- a/tools/bisect-perf-regression.py
+++ b/tools/auto_bisect/bisect_perf_regression.py
@@ -49,12 +49,12 @@ import zipfile
sys.path.append(os.path.join(os.path.dirname(__file__), 'telemetry'))
-from auto_bisect import bisect_utils
-from auto_bisect import builder
-from auto_bisect import math_utils
-from auto_bisect import request_build
-from auto_bisect import source_control as source_control_module
-from auto_bisect import ttest
+import bisect_utils
+import builder
+import math_utils
+import request_build
+import source_control as source_control_module
+import ttest
from telemetry.util import cloud_storage
# Below is the map of "depot" names to information about each depot. Each depot
@@ -150,6 +150,12 @@ DEPOT_DEPS_NAME = {
DEPOT_NAMES = DEPOT_DEPS_NAME.keys()
+# The script is in chromium/src/tools/auto_bisect. Throughout this script,
+# we use paths to other things in the chromium/src repository.
+SRC_DIR = os.path.join(os.path.dirname(__file__),
+ os.path.pardir,
+ os.path.pardir)
+
CROS_CHROMEOS_PATTERN = 'chromeos-base/chromeos-chrome'
# Possible return values from BisectPerformanceMetrics.RunTest.
@@ -914,8 +920,7 @@ class BisectPerformanceMetrics(object):
self.opts = opts
self.source_control = source_control
- self.src_cwd = os.getcwd()
- self.cros_cwd = os.path.join(os.getcwd(), '..', 'cros')
+ self.cros_cwd = os.path.join(SRC_DIR, 'tools', 'cros')
self.depot_cwd = {}
self.cleanup_commands = []
self.warnings = []
@@ -926,11 +931,11 @@ class BisectPerformanceMetrics(object):
# since we're already in 'src', we can skip that part.
self.depot_cwd[d] = os.path.join(
- self.src_cwd, DEPOT_DEPS_NAME[d]['src'][4:])
+ SRC_DIR, DEPOT_DEPS_NAME[d]['src'][4:])
def PerformCleanup(self):
"""Performs cleanup when script is finished."""
- os.chdir(self.src_cwd)
+ os.chdir(SRC_DIR)
for c in self.cleanup_commands:
if c[0] == 'mv':
shutil.move(c[1], c[2])
@@ -1091,7 +1096,7 @@ class BisectPerformanceMetrics(object):
depot_data_src = depot_data.get('src') or depot_data.get('src_old')
src_dir = deps_data.get(depot_data_src)
if src_dir:
- self.depot_cwd[depot_name] = os.path.join(self.src_cwd,
+ self.depot_cwd[depot_name] = os.path.join(SRC_DIR,
depot_data_src[4:])
re_results = rxp.search(src_dir)
if re_results:
@@ -1198,7 +1203,7 @@ class BisectPerformanceMetrics(object):
Path to backup or restored location as string. otherwise None if it fails.
"""
build_dir = os.path.abspath(
- builder.GetBuildOutputDirectory(self.opts, self.src_cwd))
+ builder.GetBuildOutputDirectory(self.opts, SRC_DIR))
source_dir = os.path.join(build_dir, build_type)
destination_dir = os.path.join(build_dir, '%s.bak' % build_type)
if restore:
@@ -1262,7 +1267,7 @@ class BisectPerformanceMetrics(object):
# Get Build output directory
abs_build_dir = os.path.abspath(
- builder.GetBuildOutputDirectory(self.opts, self.src_cwd))
+ builder.GetBuildOutputDirectory(self.opts, SRC_DIR))
fetch_build_func = lambda: self.GetBuildArchiveForRevision(
revision, self.opts.gs_bucket, self.opts.target_arch,
@@ -1485,7 +1490,7 @@ class BisectPerformanceMetrics(object):
Returns:
A tuple with git hash of chromium revision and DEPS patch text.
"""
- deps_file_path = os.path.join(self.src_cwd, bisect_utils.FILE_DEPS)
+ deps_file_path = os.path.join(SRC_DIR, bisect_utils.FILE_DEPS)
if not os.path.exists(deps_file_path):
raise RuntimeError('DEPS file does not exists.[%s]' % deps_file_path)
# Get current chromium revision (git hash).
@@ -1498,7 +1503,7 @@ class BisectPerformanceMetrics(object):
'v8' in DEPOT_DEPS_NAME[depot]['from']):
# Checkout DEPS file for the current chromium revision.
if self.source_control.CheckoutFileAtRevision(
- bisect_utils.FILE_DEPS, chromium_sha, cwd=self.src_cwd):
+ bisect_utils.FILE_DEPS, chromium_sha, cwd=SRC_DIR):
if self.UpdateDeps(revision, depot, deps_file_path):
diff_command = [
'diff',
@@ -1507,7 +1512,7 @@ class BisectPerformanceMetrics(object):
'--no-ext-diff',
bisect_utils.FILE_DEPS,
]
- diff_text = bisect_utils.CheckRunGit(diff_command, cwd=self.src_cwd)
+ diff_text = bisect_utils.CheckRunGit(diff_command, cwd=SRC_DIR)
return (chromium_sha, ChangeBackslashToSlashInPatch(diff_text))
else:
raise RuntimeError(
@@ -1528,7 +1533,7 @@ class BisectPerformanceMetrics(object):
build_success = False
cwd = os.getcwd()
- os.chdir(self.src_cwd)
+ os.chdir(SRC_DIR)
# Fetch build archive for the given revision from the cloud storage when
# the storage bucket is passed.
if self.IsDownloadable(depot) and revision:
@@ -1540,7 +1545,7 @@ class BisectPerformanceMetrics(object):
if deps_patch:
# Reverts the changes to DEPS file.
self.source_control.CheckoutFileAtRevision(
- bisect_utils.FILE_DEPS, revision, cwd=self.src_cwd)
+ bisect_utils.FILE_DEPS, revision, cwd=SRC_DIR)
build_success = True
else:
# These codes are executed when bisect bots builds binaries locally.
@@ -1556,7 +1561,7 @@ class BisectPerformanceMetrics(object):
"""
if self.opts.debug_ignore_build:
return True
- return not bisect_utils.RunGClient(['runhooks'], cwd=self.src_cwd)
+ return not bisect_utils.RunGClient(['runhooks'], cwd=SRC_DIR)
def _IsBisectModeUsingMetric(self):
return self.opts.bisect_mode in [BISECT_MODE_MEAN, BISECT_MODE_STD_DEV]
@@ -1577,9 +1582,9 @@ class BisectPerformanceMetrics(object):
# When its a third_party depot, get the chromium revision.
if depot != 'chromium':
revision = bisect_utils.CheckRunGit(
- ['rev-parse', 'HEAD'], cwd=self.src_cwd).strip()
+ ['rev-parse', 'HEAD'], cwd=SRC_DIR).strip()
commit_position = self.source_control.GetCommitPosition(revision,
- cwd=self.src_cwd)
+ cwd=SRC_DIR)
if not commit_position:
return command_to_run
cmd_re = re.compile('--browser=(?P<browser_type>\S+)')
@@ -1660,7 +1665,7 @@ class BisectPerformanceMetrics(object):
current_args.append('--results-label=%s' % results_label)
try:
output, return_code = bisect_utils.RunProcessAndRetrieveOutput(
- current_args, cwd=self.src_cwd)
+ current_args, cwd=SRC_DIR)
except OSError, e:
if e.errno == errno.ENOENT:
err_text = ('Something went wrong running the performance test. '
@@ -1787,13 +1792,14 @@ class BisectPerformanceMetrics(object):
return revisions_to_sync
- def PerformPreBuildCleanup(self):
+ @staticmethod
+ def PerformPreBuildCleanup():
"""Performs cleanup between runs."""
print 'Cleaning up between runs.'
print
# Leaving these .pyc files around between runs may disrupt some perf tests.
- for (path, _, files) in os.walk(self.src_cwd):
+ for (path, _, files) in os.walk(SRC_DIR):
for cur_file in files:
if cur_file.endswith('.pyc'):
path_to_file = os.path.join(path, cur_file)
@@ -1837,7 +1843,7 @@ class BisectPerformanceMetrics(object):
if depot == 'chromium' or depot == 'android-chrome':
# Removes third_party/libjingle. At some point, libjingle was causing
# issues syncing when using the git workflow (crbug.com/266324).
- os.chdir(self.src_cwd)
+ os.chdir(SRC_DIR)
if not bisect_utils.RemoveThirdPartyDirectory('libjingle'):
return False
# Removes third_party/skia. At some point, skia was causing
@@ -1859,7 +1865,7 @@ class BisectPerformanceMetrics(object):
"""
if self.opts.target_platform == 'android':
if not builder.SetupAndroidBuildEnvironment(self.opts,
- path_to_src=self.src_cwd):
+ path_to_src=SRC_DIR):
return False
if depot == 'cros':
@@ -2024,7 +2030,7 @@ class BisectPerformanceMetrics(object):
def _GetDepotDirectory(self, depot_name):
if depot_name == 'chromium':
- return self.src_cwd
+ return SRC_DIR
elif depot_name == 'cros':
return self.cros_cwd
elif depot_name in DEPOT_NAMES:
@@ -2121,12 +2127,12 @@ class BisectPerformanceMetrics(object):
# V8 (and possibly others) is merged in periodically. Bisecting
# this directory directly won't give much good info.
if DEPOT_DEPS_NAME[current_depot].has_key('custom_deps'):
- config_path = os.path.join(self.src_cwd, '..')
+ config_path = os.path.join(SRC_DIR, '..')
if bisect_utils.RunGClientAndCreateConfig(self.opts,
DEPOT_DEPS_NAME[current_depot]['custom_deps'], cwd=config_path):
return []
if bisect_utils.RunGClient(
- ['sync', '--revision', previous_revision], cwd=self.src_cwd):
+ ['sync', '--revision', previous_revision], cwd=SRC_DIR):
return []
if current_depot == 'v8_bleeding_edge':
@@ -2138,8 +2144,8 @@ class BisectPerformanceMetrics(object):
self.cleanup_commands.append(['mv', 'v8', 'v8_bleeding_edge'])
self.cleanup_commands.append(['mv', 'v8.bak', 'v8'])
- self.depot_cwd['v8_bleeding_edge'] = os.path.join(self.src_cwd, 'v8')
- self.depot_cwd['v8'] = os.path.join(self.src_cwd, 'v8.bak')
+ self.depot_cwd['v8_bleeding_edge'] = os.path.join(SRC_DIR, 'v8')
+ self.depot_cwd['v8'] = os.path.join(SRC_DIR, 'v8.bak')
self.ChangeToDepotWorkingDirectory(current_depot)
@@ -2284,7 +2290,7 @@ class BisectPerformanceMetrics(object):
this will contain the field "error", otherwise None.
"""
if self.opts.target_platform == 'android':
- revision_to_check = self.source_control.GetCommitPosition(good_revision)
+ good_revision = self.source_control.GetCommitPosition(good_revision)
qyearsley 2014/09/11 16:38:38 revision_to_check was not referenced. Pylint caugh
if (bisect_utils.IsStringInt(good_revision)
and good_revision < 265549):
return {'error': (

Powered by Google App Engine
This is Rietveld 408576698