Chromium Code Reviews| Index: tools/bisect-perf-regression.py |
| diff --git a/tools/bisect-perf-regression.py b/tools/bisect-perf-regression.py |
| index 83a75d0a1c01a9274e5aed3bb8e771bb4ca5b90c..7564bc8ee74cb10e90edc842432baac2e1381686 100755 |
| --- a/tools/bisect-perf-regression.py |
| +++ b/tools/bisect-perf-regression.py |
| @@ -362,6 +362,52 @@ class DesktopBuilder(Builder): |
| return build_success |
| +class AndroidBuilder(Builder): |
| + """AndroidBuilder is used to build on android.""" |
| + def InstallAPK(self, opts): |
| + """Installs apk to device. |
| + |
| + Args: |
| + opts: The options parsed from the command line. |
| + |
| + Returns: |
| + True if successful. |
| + """ |
| + path_to_tool = os.path.join('build', 'android', 'adb_install_apk.py') |
| + cmd = [path_to_tool, '--apk', 'ContentShell.apk', '--apk_package', |
| + 'org.chromium.content_shell_apk', '--release'] |
| + (_, return_code) = RunProcess(cmd, opts.output_buildbot_annotations) |
| + return not return_code |
| + |
| + def Build(self, depot, opts): |
| + """Builds the android content shell and other necessary tools using options |
| + passed into the script. |
| + |
| + Args: |
| + depot: Current depot being bisected. |
| + opts: The options parsed from the command line. |
| + |
| + Returns: |
| + True if build was successful. |
| + """ |
| + targets = ['content_shell_apk', 'forwarder2', 'md5sum'] |
| + threads = 16 |
| + if opts.use_goma: |
| + threads = 64 |
| + |
| + build_success = False |
| + if opts.build_preference == 'ninja': |
| + build_success = BuildWithNinja(threads, targets, |
| + opts.output_buildbot_annotations) |
| + else: |
| + assert False, 'No build system defined.' |
| + |
| + if build_success: |
| + build_success = self.InstallAPK(opts) |
| + |
| + return build_success |
| + |
| + |
| class CrosBuilder(Builder): |
| """CrosBuilder is used to build and image ChromeOS/Chromium when cros is the |
| target platform.""" |
| @@ -728,6 +774,8 @@ class BisectPerformanceMetrics(object): |
| if opts.target_platform == 'cros': |
| self.builder = CrosBuilder() |
| + elif opts.target_platform == 'android': |
| + self.builder = AndroidBuilder() |
| else: |
| self.builder = DesktopBuilder() |
| @@ -1297,7 +1345,7 @@ class BisectPerformanceMetrics(object): |
| return depot_revision_list |
| - def GatherReferenceValues(self, good_rev, bad_rev, cmd, metric): |
| + def GatherReferenceValues(self, good_rev, bad_rev, cmd, metric, tgt_depot): |
|
tonyg
2013/06/07 21:02:26
The style guide frowns on abbreviations like this.
shatch
2013/06/07 21:57:39
Done.
|
| """Gathers reference values by running the performance tests on the |
| known good and bad revisions. |
| @@ -1312,7 +1360,7 @@ class BisectPerformanceMetrics(object): |
| A tuple with the results of building and running each revision. |
| """ |
| bad_run_results = self.SyncBuildAndRunRevision(bad_rev, |
| - self.opts.target_platform, |
| + tgt_depot, |
| cmd, |
| metric) |
| @@ -1320,7 +1368,7 @@ class BisectPerformanceMetrics(object): |
| if not bad_run_results[1]: |
| good_run_results = self.SyncBuildAndRunRevision(good_rev, |
| - self.opts.target_platform, |
| + tgt_depot, |
| cmd, |
| metric) |
| @@ -1536,7 +1584,8 @@ class BisectPerformanceMetrics(object): |
| (bad_results, good_results) = self.GatherReferenceValues(good_revision, |
| bad_revision, |
| command_to_run, |
| - metric) |
| + metric, |
| + target_depot) |
| if self.opts.output_buildbot_annotations: |
| bisect_utils.OutputAnnotationStepClosed() |
| @@ -2076,11 +2125,12 @@ def main(): |
| 'are msvs/ninja.') |
| parser.add_option('--target_platform', |
| type='choice', |
| - choices=['chromium', 'cros'], |
| + choices=['chromium', 'cros', 'android'], |
| default='chromium', |
| - help='The target platform. Choices are "default" (current ' |
| - 'platform, or "cros". If choosing "cros", you ' |
| - 'must be properly set up to build.') |
| + help='The target platform. Choices are "chromium" (current ' |
| + 'platform, "cros", or "android". If you specify something ' |
|
tonyg
2013/06/07 21:02:26
I think there should be a ) after platform
shatch
2013/06/07 21:57:39
Done.
|
| + 'other than "chromium", you must be properly set up to ' |
| + 'build that platform.') |
| parser.add_option('--cros_board', |
| type='str', |
| help='The cros board type to build.') |
| @@ -2157,6 +2207,8 @@ def main(): |
| opts.truncate_percent = min(max(opts.truncate_percent, 0), 25) |
| opts.truncate_percent = opts.truncate_percent / 100.0 |
| + path_to_file = os.path.abspath(os.path.dirname(sys.argv[0])) |
| + |
| metric_values = opts.metric.split('/') |
| if len(metric_values) != 2: |
| print "Invalid metric specified: [%s]" % (opts.metric,) |
| @@ -2167,11 +2219,10 @@ def main(): |
| if bisect_utils.CreateBisectDirectoryAndSetupDepot(opts): |
| return 1 |
| - if opts.target_platform == 'cros': |
| - if not bisect_utils.SetupCrosRepo(): |
| - print 'Error: Failed to grab cros source.' |
| - return 1 |
| + if not bisect_utils.SetupPlatformBuildEnvironment(opts, path_to_file): |
| + print 'Error: Failed to set platform environment.' |
| + return 1 |
| os.chdir(os.path.join(os.getcwd(), 'src')) |