Bug 1496627 - Make sure fennec is granted all the permissions it needs to run wpt r=gbrown
authorWes Kocher <wkocher@mozilla.com>
Thu, 11 Oct 2018 22:07:45 +0000
changeset 496522 facb6f18068e502530ea84492166826d3c88d4f5
parent 496521 c58e52e69803f3892fd1812694b6da1918906c35
child 496523 0c9456c0ba9afcb7bcd5b9ee3f6cf99e4d745fae
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1496627
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1496627 - Make sure fennec is granted all the permissions it needs to run wpt r=gbrown Without this, the user must manually install fennec with expanded permissions with `adb install -g <apk>`. With this patch, `./mach wpt` on its own handles everything from emulator setup to test running. Differential Revision: https://phabricator.services.mozilla.com/D8333
testing/web-platform/mach_commands.py
--- a/testing/web-platform/mach_commands.py
+++ b/testing/web-platform/mach_commands.py
@@ -22,25 +22,32 @@ from mach.decorators import (
 
 from mach_commands_base import WebPlatformTestsRunner, create_parser_wpt
 
 
 class WebPlatformTestsRunnerSetup(MozbuildObject):
     default_log_type = "mach"
 
     def kwargs_common(self, kwargs):
-        from mozrunner.devices.android_device import verify_android_device
+        from mozrunner.devices.android_device import verify_android_device, grant_runtime_permissions
         build_path = os.path.join(self.topobjdir, 'build')
         here = os.path.split(__file__)[0]
         tests_src_path = os.path.join(here, "tests")
         if build_path not in sys.path:
             sys.path.append(build_path)
 
         if kwargs["product"] == "fennec":
             verify_android_device(self, install=True, verbose=False, xre=True)
+
+            # package_name may be non-fennec in the future
+            package_name = kwargs["package_name"]
+            if not package_name:
+                package_name = self.substs["ANDROID_PACKAGE_NAME"]
+
+            grant_runtime_permissions(self, package_name, kwargs["device_serial"])
             if kwargs["certutil_binary"] is None:
                 kwargs["certutil_binary"] = os.path.join(os.environ.get('MOZ_HOST_BIN'), "certutil")
 
         if kwargs["config"] is None:
             kwargs["config"] = os.path.join(self.topobjdir, '_tests', 'web-platform', 'wptrunner.local.ini')
 
         if kwargs["prefs_root"] is None:
             kwargs["prefs_root"] = os.path.join(self.topsrcdir, 'testing', 'profiles')