diff options
author | prasadv <prasadv@google.com> | 2015-03-11 13:51:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-11 20:51:56 +0000 |
commit | 8235d84d7493f31b23f54c67d92a7115edaf4c8d (patch) | |
tree | cc0743f94200db88e7fe7afa01328ce40b5cc08b /tools/auto_bisect | |
parent | c12345f315ad642ebbd0bba87b26ad3642025e6d (diff) | |
download | chromium_src-8235d84d7493f31b23f54c67d92a7115edaf4c8d.zip chromium_src-8235d84d7493f31b23f54c67d92a7115edaf4c8d.tar.gz chromium_src-8235d84d7493f31b23f54c67d92a7115edaf4c8d.tar.bz2 |
Make android-chrome bisect work with archives.
BUG=465868
NOTRY=true
Review URL: https://codereview.chromium.org/994183002
Cr-Commit-Position: refs/heads/master@{#320142}
Diffstat (limited to 'tools/auto_bisect')
-rwxr-xr-x | tools/auto_bisect/bisect_perf_regression.py | 46 | ||||
-rw-r--r-- | tools/auto_bisect/bisect_perf_regression_test.py | 44 | ||||
-rw-r--r-- | tools/auto_bisect/fetch_build.py | 35 | ||||
-rw-r--r-- | tools/auto_bisect/fetch_build_test.py | 7 | ||||
-rw-r--r-- | tools/auto_bisect/request_build.py | 39 |
5 files changed, 120 insertions, 51 deletions
diff --git a/tools/auto_bisect/bisect_perf_regression.py b/tools/auto_bisect/bisect_perf_regression.py index 746952e..6c49a98 100755 --- a/tools/auto_bisect/bisect_perf_regression.py +++ b/tools/auto_bisect/bisect_perf_regression.py @@ -125,7 +125,8 @@ BISECT_PATCH_FILE = 'deps_patch.txt' # SVN repo where the bisect try jobs are submitted. PERF_SVN_REPO_URL = 'svn://svn.chromium.org/chrome-try/try-perf' FULL_SVN_REPO_URL = 'svn://svn.chromium.org/chrome-try/try' - +ANDROID_CHROME_SVN_REPO_URL = ('svn://svn.chromium.org/chrome-try-internal/' + 'try-perf') class RunGitError(Exception): @@ -195,17 +196,16 @@ def _ParseRevisionsFromDEPSFileManually(deps_file_contents): return dict(re_results) -def _WaitUntilBuildIsReady(fetch_build_func, builder_name, builder_type, - build_request_id, max_timeout): +def _WaitUntilBuildIsReady(fetch_build_func, builder_name, build_request_id, + max_timeout, buildbot_server_url): """Waits until build is produced by bisect builder on try server. Args: fetch_build_func: Function to check and download build from cloud storage. builder_name: Builder bot name on try server. - builder_type: Builder type, e.g. "perf" or "full". Refer to the constants - |fetch_build| which determine the valid values that can be passed. build_request_id: A unique ID of the build request posted to try server. max_timeout: Maximum time to wait for the build. + buildbot_server_url: Buildbot url to check build status. Returns: Downloaded archive file path if exists, otherwise None. @@ -218,6 +218,7 @@ def _WaitUntilBuildIsReady(fetch_build_func, builder_name, builder_type, status_check_interval = 600 last_status_check = time.time() start_time = time.time() + while True: # Checks for build on gs://chrome-perf and download if exists. res = fetch_build_func() @@ -231,12 +232,12 @@ def _WaitUntilBuildIsReady(fetch_build_func, builder_name, builder_type, if not build_num: # Get the build number on try server for the current build. build_num = request_build.GetBuildNumFromBuilder( - build_request_id, builder_name, builder_type) + build_request_id, builder_name, buildbot_server_url) # Check the status of build using the build number. # Note: Build is treated as PENDING if build number is not found # on the the try server. build_status, status_link = request_build.GetBuildStatus( - build_num, builder_name, builder_type) + build_num, builder_name, buildbot_server_url) if build_status == request_build.FAILED: return (None, 'Failed to produce build, log: %s' % status_link) elapsed_time = time.time() - start_time @@ -647,6 +648,8 @@ def _TryJobSvnRepo(builder_type): return PERF_SVN_REPO_URL if builder_type == fetch_build.FULL_BUILDER: return FULL_SVN_REPO_URL + if builder_type == fetch_build.ANDROID_CHROME_PERF_BUILDER: + return ANDROID_CHROME_SVN_REPO_URL raise NotImplementedError('Unknown builder type "%s".' % builder_type) @@ -814,7 +817,7 @@ class BisectPerformanceMetrics(object): """ patch = None patch_sha = None - if depot != 'chromium': + if depot not in ('chromium', 'android-chrome'): # Create a DEPS patch with new revision for dependency repository. self._CreateDEPSPatch(depot, revision) create_patch = True @@ -859,7 +862,8 @@ class BisectPerformanceMetrics(object): revision, builder_type=self.opts.builder_type, target_arch=self.opts.target_arch, target_platform=self.opts.target_platform, - deps_patch_sha=deps_patch_sha) + deps_patch_sha=deps_patch_sha, + extra_src=self.opts.extra_src) output_dir = os.path.abspath(build_dir) fetch_build_func = lambda: fetch_build.FetchFromCloudStorage( bucket_name, remote_path, output_dir) @@ -908,7 +912,8 @@ class BisectPerformanceMetrics(object): builder_name, build_timeout = fetch_build.GetBuilderNameAndBuildTime( builder_type=self.opts.builder_type, target_arch=self.opts.target_arch, - target_platform=self.opts.target_platform) + target_platform=self.opts.target_platform, + extra_src=self.opts.extra_src) try: _StartBuilderTryJob(self.opts.builder_type, git_revision, builder_name, @@ -918,9 +923,16 @@ class BisectPerformanceMetrics(object): 'Error: %s', git_revision, e) return None + # Get the buildbot master url to monitor build status. + buildbot_server_url = fetch_build.GetBuildBotUrl( + builder_type=self.opts.builder_type, + target_arch=self.opts.target_arch, + target_platform=self.opts.target_platform, + extra_src=self.opts.extra_src) + archive_filename, error_msg = _WaitUntilBuildIsReady( - fetch_build_func, builder_name, self.opts.builder_type, - build_request_id, build_timeout) + fetch_build_func, builder_name, build_request_id, build_timeout, + buildbot_server_url) if not archive_filename: logging.warn('%s [revision: %s]', error_msg, git_revision) return archive_filename @@ -1006,9 +1018,15 @@ class BisectPerformanceMetrics(object): def IsDownloadable(self, depot): """Checks if build can be downloaded based on target platform and depot.""" - if (self.opts.target_platform in ['chromium', 'android'] + if (self.opts.target_platform in ['chromium', 'android', 'android-chrome'] and self.opts.builder_type): - return (depot == 'chromium' or + # In case of android-chrome platform, download archives only for + # android-chrome depot; for other depots such as chromium, v8, skia + # etc., build the binary locally. + if self.opts.target_platform == 'android-chrome': + return depot == 'android-chrome' + else: + return (depot == 'chromium' or 'chromium' in bisect_utils.DEPOT_DEPS_NAME[depot]['from'] or 'v8' in bisect_utils.DEPOT_DEPS_NAME[depot]['from']) return False diff --git a/tools/auto_bisect/bisect_perf_regression_test.py b/tools/auto_bisect/bisect_perf_regression_test.py index bd49d8a..3060f45 100644 --- a/tools/auto_bisect/bisect_perf_regression_test.py +++ b/tools/auto_bisect/bisect_perf_regression_test.py @@ -430,7 +430,7 @@ class BisectPerfRegressionTest(unittest.TestCase): def testGetCommitPositionForSkia(self): bisect_instance = _GetBisectPerformanceMetricsInstance(DEFAULT_OPTIONS) - skia_rev = 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61' + skia_rev = 'a94d028eCheckAbortsEarly0f2c77f159b3dac95eb90c3b4cf48c61' depot_path = os.path.join(bisect_instance.src_cwd, 'third_party', 'skia') # Skia doesn't use commit positions, and GetCommitPosition should # return None for repos that don't use commit positions. @@ -481,6 +481,48 @@ class BisectPerfRegressionTest(unittest.TestCase): expected_params = ['checkout', 'a94d028e0f2c77f159b3dac95eb90c3b4cf48c61'] mock_RunGit.assert_called_with(expected_params) + def testTryJobSvnRepo_PerfBuilderType_ReturnsRepoUrl(self): + self.assertEqual(bisect_perf_regression.PERF_SVN_REPO_URL, + bisect_perf_regression._TryJobSvnRepo(fetch_build.PERF_BUILDER)) + + def testTryJobSvnRepo_FullBuilderType_ReturnsRepoUrl(self): + self.assertEqual(bisect_perf_regression.FULL_SVN_REPO_URL, + bisect_perf_regression._TryJobSvnRepo(fetch_build.FULL_BUILDER)) + + def testTryJobSvnRepo_WithUnknownBuilderType_ThrowsError(self): + with self.assertRaises(NotImplementedError): + bisect_perf_regression._TryJobSvnRepo('foo') + + def _CheckIsDownloadable(self, depot, target_platform='chromium', + builder_type='perf'): + opts = dict(DEFAULT_OPTIONS) + opts.update({'target_platform': target_platform, + 'builder_type': builder_type}) + bisect_instance = _GetBisectPerformanceMetricsInstance(opts) + return bisect_instance.IsDownloadable(depot) + + def testIsDownloadable_ChromiumDepot_ReturnsTrue(self): + self.assertTrue(self._CheckIsDownloadable(depot='chromium')) + + def testIsDownloadable_DEPSDepot_ReturnsTrue(self): + self.assertTrue(self._CheckIsDownloadable(depot='v8')) + + def testIsDownloadable_AndroidChromeDepot_ReturnsTrue(self): + self.assertTrue(self._CheckIsDownloadable( + depot='android-chrome', target_platform='android-chrome')) + + def testIsDownloadable_AndroidChromeWithDEPSChromium_ReturnsFalse(self): + self.assertFalse(self._CheckIsDownloadable( + depot='chromium', target_platform='android-chrome')) + + def testIsDownloadable_AndroidChromeWithDEPSV8_ReturnsFalse(self): + self.assertFalse(self._CheckIsDownloadable( + depot='v8', target_platform='android-chrome')) + + def testIsDownloadable_NoBuilderType_ReturnsFalse(self): + self.assertFalse( + self._CheckIsDownloadable(depot='chromium', builder_type='')) + class DepotDirectoryRegistryTest(unittest.TestCase): diff --git a/tools/auto_bisect/fetch_build.py b/tools/auto_bisect/fetch_build.py index 7b622fb..b4036ac 100644 --- a/tools/auto_bisect/fetch_build.py +++ b/tools/auto_bisect/fetch_build.py @@ -37,6 +37,10 @@ MAX_MAC_BUILD_TIME = 14400 MAX_WIN_BUILD_TIME = 14400 MAX_LINUX_BUILD_TIME = 14400 +# Try server status page URLs, used to get build status. +PERF_TRY_SERVER_URL = 'http://build.chromium.org/p/tryserver.chromium.perf' +LINUX_TRY_SERVER_URL = 'http://build.chromium.org/p/tryserver.chromium.linux' + def GetBucketAndRemotePath(revision, builder_type=PERF_BUILDER, target_arch='ia32', target_platform='chromium', @@ -77,6 +81,17 @@ def GetBuilderNameAndBuildTime(builder_type=PERF_BUILDER, target_arch='ia32', return build_archive.GetBuilderName(), build_archive.GetBuilderBuildTime() +def GetBuildBotUrl(builder_type=PERF_BUILDER, target_arch='ia32', + target_platform='chromium', extra_src=None): + """Gets buildbot URL for a given builder type.""" + logging.info('Getting buildbot URL for "%s", "%s", "%s".', + builder_type, target_arch, target_platform) + build_archive = BuildArchive.Create( + builder_type, target_arch=target_arch, target_platform=target_platform, + extra_src=extra_src) + return build_archive.GetBuildBotUrl() + + class BuildArchive(object): """Represents a place where builds of some type are stored. @@ -109,6 +124,8 @@ class BuildArchive(object): self._extra_src = extra_src if bisect_utils.IsLinuxHost() and target_platform == 'android': self._platform = 'android' + elif bisect_utils.IsLinuxHost() and target_platform == 'android-chrome': + self._platform = 'android-chrome' elif bisect_utils.IsLinuxHost(): self._platform = 'linux' elif bisect_utils.IsMacHost(): @@ -175,12 +192,15 @@ class BuildArchive(object): """Returns the time to wait for a build after requesting one.""" if self._platform in ('win', 'win64'): return MAX_WIN_BUILD_TIME - if self._platform in ('linux', 'android'): + if self._platform in ('linux', 'android', 'android-chrome'): return MAX_LINUX_BUILD_TIME if self._platform == 'mac': return MAX_MAC_BUILD_TIME raise NotImplementedError('Unsupported Platform "%s".' % sys.platform) + def GetBuildBotUrl(self): + raise NotImplementedError() + class PerfBuildArchive(BuildArchive): @@ -217,6 +237,10 @@ class PerfBuildArchive(BuildArchive): return 'mac_perf_bisect_builder' raise NotImplementedError('Unsupported platform "%s".' % sys.platform) + def GetBuildBotUrl(self): + """Returns buildbot URL for fetching build info.""" + return PERF_TRY_SERVER_URL + class FullBuildArchive(BuildArchive): @@ -253,6 +277,11 @@ class FullBuildArchive(BuildArchive): return 'linux_full_bisect_builder' raise NotImplementedError('Unsupported platform "%s".' % sys.platform) + def GetBuildBotUrl(self): + """Returns buildbot URL for fetching build info.""" + return LINUX_TRY_SERVER_URL + + class AndroidChromeBuildArchive(BuildArchive): """Represents a place where builds of android-chrome type are stored. @@ -293,6 +322,10 @@ class AndroidChromeBuildArchive(BuildArchive): """Returns the builder name extra source.""" return self._extra_src.GetBuilderName() + def GetBuildBotUrl(self): + """Returns buildbot URL for fetching build info.""" + return self._extra_src.GetBuildBotUrl() + def BuildIsAvailable(bucket_name, remote_path): """Checks whether a build is currently archived at some place.""" diff --git a/tools/auto_bisect/fetch_build_test.py b/tools/auto_bisect/fetch_build_test.py index dfd81d2..85c8ff2 100644 --- a/tools/auto_bisect/fetch_build_test.py +++ b/tools/auto_bisect/fetch_build_test.py @@ -166,6 +166,13 @@ class BuildArchiveTest(unittest.TestCase): archive._platform = 'mac' self.assertEqual(14400, archive.GetBuilderBuildTime()) + def test_GetBuildBotUrl_Perf(self): + self.assertEqual(fetch_build.PERF_TRY_SERVER_URL, + fetch_build.GetBuildBotUrl(fetch_build.PERF_BUILDER)) + + def test_GetBuildBotUrl_full(self): + self.assertEqual(fetch_build.LINUX_TRY_SERVER_URL, + fetch_build.GetBuildBotUrl(fetch_build.FULL_BUILDER)) class UnzipTest(unittest.TestCase): diff --git a/tools/auto_bisect/request_build.py b/tools/auto_bisect/request_build.py index 77ce63b..c43cf5c 100644 --- a/tools/auto_bisect/request_build.py +++ b/tools/auto_bisect/request_build.py @@ -28,10 +28,6 @@ BUILDER_JSON_URL = ('%(server_url)s/json/builders/%(bot_name)s/builds/' # URL template for displaying build steps. BUILDER_HTML_URL = '%(server_url)s/builders/%(bot_name)s/builds/%(build_num)s' -# Try server status page URLs, used to get build status. -PERF_TRY_SERVER_URL = 'http://build.chromium.org/p/tryserver.chromium.perf' -LINUX_TRY_SERVER_URL = 'http://build.chromium.org/p/tryserver.chromium.linux' - # Status codes that can be returned by the GetBuildStatus method # From buildbot.status.builder. # See: http://docs.buildbot.net/current/developer/results.html @@ -151,44 +147,21 @@ def _GetBuildData(buildbot_url): return None -def _GetBuildBotUrl(builder_type): - """Gets build bot URL for fetching build info. - - Bisect builder bots are hosted on tryserver.chromium.perf, though we cannot - access this tryserver using host and port number directly, so we use another - tryserver URL for the perf tryserver. - - Args: - builder_type: Determines what type of builder is used, e.g. "perf". - - Returns: - URL of the buildbot as a string. - """ - if builder_type == fetch_build.PERF_BUILDER: - return PERF_TRY_SERVER_URL - if builder_type == fetch_build.FULL_BUILDER: - return LINUX_TRY_SERVER_URL - raise NotImplementedError('Unsupported builder type "%s".' % builder_type) - - -def GetBuildStatus(build_num, bot_name, builder_type): +def GetBuildStatus(build_num, bot_name, server_url): """Gets build status from the buildbot status page for a given build number. Args: build_num: A build number on tryserver to determine its status. bot_name: Name of the bot where the build information is scanned. - builder_type: Type of builder, e.g. "perf". + server_url: URL of the buildbot. Returns: A pair which consists of build status (SUCCESS, FAILED or PENDING) and a link to build status page on the waterfall. """ - # TODO(prasadv, qyearsley): Make this a method of BuildArchive - # (which may be renamed to BuilderTryBot or Builder). results_url = None if build_num: # Get the URL for requesting JSON data with status information. - server_url = _GetBuildBotUrl(builder_type) buildbot_url = BUILDER_JSON_URL % { 'server_url': server_url, 'bot_name': bot_name, @@ -210,7 +183,7 @@ def GetBuildStatus(build_num, bot_name, builder_type): return (PENDING, results_url) -def GetBuildNumFromBuilder(build_reason, bot_name, builder_type): +def GetBuildNumFromBuilder(build_reason, bot_name, server_url): """Gets build number on build status page for a given 'build reason'. This function parses the JSON data from buildbot page and collects basic @@ -223,15 +196,11 @@ def GetBuildNumFromBuilder(build_reason, bot_name, builder_type): Args: build_reason: A unique build name set to build on tryserver. bot_name: Name of the bot where the build information is scanned. - builder_type: Type of builder, e.g. "perf". + server_url: URL of the buildbot. Returns: A build number as a string if found, otherwise None. """ - # TODO(prasadv, qyearsley): Make this a method of BuildArchive - # (which may be renamed to BuilderTryBot or Builder). - # Gets the buildbot url for the given host and port. - server_url = _GetBuildBotUrl(builder_type) buildbot_url = BUILDER_JSON_URL % { 'server_url': server_url, 'bot_name': bot_name, |