Bug 1249166 - Part 1: Add post-build mach commands to mozharness. r=jlund
authorNick Alexander <nalexander@mozilla.com>
Wed, 17 Feb 2016 19:58:35 -0800 (2016-02-18)
changeset 285327 b7f1dac8306fcc18328a9147f151212fc4321cab
parent 285326 b93cdb44b64b2bf8267698669b5548fc9ab613ec
child 285328 057c0e7cf189ada0745d58b3d83b326bf1cb3ffb
push id17799
push usernalexander@mozilla.com
push dateWed, 24 Feb 2016 19:23:01 +0000 (2016-02-24)
treeherderfx-team@057c0e7cf189 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlund
bugs1249166
milestone47.0a1
Bug 1249166 - Part 1: Add post-build mach commands to mozharness. r=jlund This allows to run |mach gradle COMMAND| after the initial |mach build|. MozReview-Commit-ID: 8XrTopFvLl0
testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_frontend.py
testing/mozharness/mozharness/mozilla/building/buildbase.py
--- a/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_frontend.py
+++ b/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_frontend.py
@@ -1,8 +1,12 @@
 config = {
     'base_name': 'Android armv7 API 15+ frontend %(branch)s',
     'stage_platform': 'android-api-15-frontend',
     'build_type': 'api-15-opt',
     'src_mozconfig': 'mobile/android/config/mozconfigs/android-api-15-frontend/nightly',
     'tooltool_manifest_src': 'mobile/android/config/tooltool-manifests/android-frontend/releng.manifest',
     'multi_locale_config_platform': 'android',
+    'postflight_build_mach_commands': [
+        ['gradle', 'app:lintAutomationDebug'],
+        ['gradle', 'app:testAutomationDebugUnitTest'],
+    ],
 }
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -1876,16 +1876,36 @@ or run without that action (ie: --no-{ac
 
     def postflight_build(self, console_output=True):
         """grabs properties from post build and calls ccache -s"""
         self.generate_build_props(console_output=console_output,
                                   halt_on_failure=True)
         if self.config.get('enable_ccache'):
             self._ccache_s()
 
+        # A list of argument lists.  Better names gratefully accepted!
+        mach_commands = self.config.get('postflight_build_mach_commands', [])
+        for mach_command in mach_commands:
+            self._execute_postflight_build_mach_command(mach_command)
+
+    def _execute_postflight_build_mach_command(self, mach_command_args):
+        env = self.query_build_env()
+        env.update(self.query_mach_build_env())
+        python = self.query_exe('python2.7')
+
+        command = [python, 'mach', '--log-no-times']
+        command.extend(mach_command_args)
+
+        self.run_command_m(
+            command=command,
+            cwd=self.query_abs_dirs()['abs_src_dir'],
+            env=env, output_timeout=self.config.get('max_build_output_timeout', 60 * 20),
+            halt_on_failure=True,
+        )
+
     def preflight_package_source(self):
         self._get_mozconfig()
 
     def package_source(self):
         """generates source archives and uploads them"""
         env = self.query_build_env()
         env.update(self.query_mach_build_env())
         python = self.query_exe('python2.7')