summaryrefslogtreecommitdiffstats
path: root/tools/auto_bisect
diff options
context:
space:
mode:
authorprasadv <prasadv@chromium.org>2015-01-08 18:37:25 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-09 02:38:49 +0000
commita2fe607ce642aac9ce063d84ee79b92ff256e436 (patch)
tree4a0537d9b7e80f72060d13f2334256125dc748ff /tools/auto_bisect
parentd9172a7dfca4561cf2dfdc9463ccf5f20b88d404 (diff)
downloadchromium_src-a2fe607ce642aac9ce063d84ee79b92ff256e436.zip
chromium_src-a2fe607ce642aac9ce063d84ee79b92ff256e436.tar.gz
chromium_src-a2fe607ce642aac9ce063d84ee79b92ff256e436.tar.bz2
Sync android-chrome revision along with chromium on android-chrome platform.
android-chrome revision is overwritten with TOT revision when we sync only chromium revision. This causes inconsistency between android-chrome and chromium revisions that we want to bisect. Therefore we pass android-chrome revision along with chromium revision to make sure we are bisect chromium on proper android-chrome revision. BUG=447348 NOTRY=true Review URL: https://codereview.chromium.org/800143003 Cr-Commit-Position: refs/heads/master@{#310681}
Diffstat (limited to 'tools/auto_bisect')
-rwxr-xr-xtools/auto_bisect/bisect_perf_regression.py25
-rw-r--r--tools/auto_bisect/bisect_perf_regression_test.py26
-rw-r--r--tools/auto_bisect/bisect_utils.py10
-rw-r--r--tools/auto_bisect/source_control.py18
4 files changed, 73 insertions, 6 deletions
diff --git a/tools/auto_bisect/bisect_perf_regression.py b/tools/auto_bisect/bisect_perf_regression.py
index 2de8f2c..df60f26 100755
--- a/tools/auto_bisect/bisect_perf_regression.py
+++ b/tools/auto_bisect/bisect_perf_regression.py
@@ -1409,7 +1409,7 @@ class BisectPerformanceMetrics(object):
Returns:
True if successful.
"""
- if self.opts.target_platform == 'android':
+ if 'android' in self.opts.target_platform:
if not builder.SetupAndroidBuildEnvironment(self.opts,
path_to_src=self.src_cwd):
return False
@@ -1540,9 +1540,32 @@ class BisectPerformanceMetrics(object):
if sync_client == 'gclient' and revision:
revision = '%s@%s' % (bisect_utils.DEPOT_DEPS_NAME[depot]['src'],
revision)
+ if depot == 'chromium' and self.opts.target_platform == 'android-chrome':
+ return self._SyncRevisionsForAndroidChrome(revision)
return source_control.SyncToRevision(revision, sync_client)
+ def _SyncRevisionsForAndroidChrome(self, revision):
+ """Syncs android-chrome and chromium repos to particular revision.
+
+ This is a special case for android-chrome as the gclient sync for chromium
+ overwrites the android-chrome revision to TOT. Therefore both the repos
+ are synced to known revisions.
+
+ Args:
+ revision: Git hash of the Chromium to sync.
+
+ Returns:
+ True if successful, False otherwise.
+ """
+ revisions_list = [revision]
+ current_android_rev = source_control.GetCurrentRevision(
+ self.depot_registry.GetDepotDir('android-chrome'))
+ revisions_list.append(
+ '%s@%s' % (bisect_utils.DEPOT_DEPS_NAME['android-chrome']['src'],
+ current_android_rev))
+ return not bisect_utils.RunGClientAndSync(revisions_list)
+
def _CheckIfRunPassed(self, current_value, known_good_value, known_bad_value):
"""Given known good and bad values, decide if the current_value passed
or failed.
diff --git a/tools/auto_bisect/bisect_perf_regression_test.py b/tools/auto_bisect/bisect_perf_regression_test.py
index df5f279..c10ed78 100644
--- a/tools/auto_bisect/bisect_perf_regression_test.py
+++ b/tools/auto_bisect/bisect_perf_regression_test.py
@@ -430,6 +430,32 @@ class BisectPerfRegressionTest(unittest.TestCase):
ss = re.compile('["\']%s["\']: ["\']%s["\']' % (deps_key, git_revision))
self.assertIsNotNone(re.search(ss, updated_content))
+ @mock.patch('bisect_utils.RunGClient')
+ def testSyncToRevisionForChromium(self, mock_RunGClient):
+ bisect_instance = _GetBisectPerformanceMetricsInstance(DEFAULT_OPTIONS)
+ bisect_instance._SyncRevision(
+ 'chromium', 'e6db23a037cad47299a94b155b95eebd1ee61a58', 'gclient')
+ expected_params = [
+ 'sync',
+ '--verbose',
+ '--nohooks',
+ '--force',
+ '--delete_unversioned_trees',
+ '--revision',
+ 'src@e6db23a037cad47299a94b155b95eebd1ee61a58'
+ ]
+
+ mock_RunGClient.assert_called_with(expected_params, cwd=None)
+
+ @mock.patch('bisect_utils.RunGit')
+ def testSyncToRevisionForWebKit(self, mock_RunGit):
+ bisect_instance = _GetBisectPerformanceMetricsInstance(DEFAULT_OPTIONS)
+ mock_RunGit.return_value = None, None
+ bisect_instance._SyncRevision(
+ 'webkit', 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61' , None)
+ expected_params = ['checkout', 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61']
+ mock_RunGit.assert_called_with(expected_params)
+
class DepotDirectoryRegistryTest(unittest.TestCase):
diff --git a/tools/auto_bisect/bisect_utils.py b/tools/auto_bisect/bisect_utils.py
index e63b9a5..95ca455 100644
--- a/tools/auto_bisect/bisect_utils.py
+++ b/tools/auto_bisect/bisect_utils.py
@@ -352,11 +352,12 @@ def _CleanupPreviousGitRuns(cwd=os.getcwd()):
os.remove(path_to_file)
-def RunGClientAndSync(revision=None, cwd=None):
+def RunGClientAndSync(revisions=None, cwd=None):
"""Runs gclient and does a normal sync.
Args:
- revision: Revision that need to be synced.
+ revisions: List of revisions that need to be synced.
+ E.g., "src@2ae43f...", "src/third_party/webkit@asr1234" etc.
cwd: Working directory to run from.
Returns:
@@ -364,8 +365,9 @@ def RunGClientAndSync(revision=None, cwd=None):
"""
params = ['sync', '--verbose', '--nohooks', '--force',
'--delete_unversioned_trees']
- if revision:
- params.extend(['--revision', revision])
+ if revisions is not None:
+ for revision in revisions:
+ params.extend(['--revision', revision])
return RunGClient(params, cwd=cwd)
diff --git a/tools/auto_bisect/source_control.py b/tools/auto_bisect/source_control.py
index 9249f17..cebb164f 100644
--- a/tools/auto_bisect/source_control.py
+++ b/tools/auto_bisect/source_control.py
@@ -34,16 +34,32 @@ def GetRevisionList(end_revision_hash, start_revision_hash, cwd=None):
def SyncToRevision(revision, sync_client=None):
+ """Syncs or checks out a revision based on sync_client argument.
+
+ Args:
+ revision: Git hash for the solutions with the format <repo>@rev.
+ E.g., "src@2ae43f...", "src/third_party/webkit@asr1234" etc.
+ sync_client: Syncs to revision when this is True otherwise checks out
+ the revision.
+
+ Returns:
+ True if sync or checkout is successful, False otherwise.
+ """
if not sync_client:
_, return_code = bisect_utils.RunGit(['checkout', revision])
elif sync_client == 'gclient':
- return_code = bisect_utils.RunGClientAndSync(revision)
+ return_code = bisect_utils.RunGClientAndSync([revision])
else:
raise NotImplementedError('Unsupported sync_client: "%s"' % sync_client)
return not return_code
+def GetCurrentRevision(cwd=None):
+ """Gets current revision of the given repository."""
+ return bisect_utils.CheckRunGit(['rev-parse', 'HEAD'], cwd=cwd).strip()
+
+
def ResolveToRevision(revision_to_check, depot, depot_deps_dict,
search, cwd=None):
"""Tries to resolve an SVN revision or commit position to a git SHA1.