зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1555479 - Update wrench mozharness script to support running on a device as well. r=gbrown
The presence or absence of the DEVICE_SERIAL environment variable is sufficient to control this. Differential Revision: https://phabricator.services.mozilla.com/D33407 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6d682927cb
Коммит
a001de8d97
|
@ -59,8 +59,8 @@ Release mode:
|
||||||
should be signed and installable (you may need to uninstall the debug APK first if you
|
should be signed and installable (you may need to uninstall the debug APK first if you
|
||||||
have that installed).
|
have that installed).
|
||||||
|
|
||||||
Running reftests like a boss:
|
Running reftests like a boss (on a local emulator):
|
||||||
-----------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
First, compile wrench as described above (debug mode).
|
First, compile wrench as described above (debug mode).
|
||||||
Then, from the root gecko source dir, run:
|
Then, from the root gecko source dir, run:
|
||||||
|
@ -84,3 +84,13 @@ Running reftests like a boss:
|
||||||
to point to it:
|
to point to it:
|
||||||
export WRENCH_APK=gfx/wr/target/android-artifacts/app/build/outputs/apk/app-release-unsigned.apk
|
export WRENCH_APK=gfx/wr/target/android-artifacts/app/build/outputs/apk/app-release-unsigned.apk
|
||||||
./mach python testing/mozharness/scripts/android_wrench.py --config testing/mozharness/configs/android/wrench.py
|
./mach python testing/mozharness/scripts/android_wrench.py --config testing/mozharness/configs/android/wrench.py
|
||||||
|
|
||||||
|
Running reftests like a boss (on a local device):
|
||||||
|
-------------------------------------------------
|
||||||
|
|
||||||
|
Same steps as running on a local emulator, except you need to do this:
|
||||||
|
export DEVICE_SERIAL=<your device's serial>
|
||||||
|
before running the `./mach python` command. You can get the serial of
|
||||||
|
your device by running `adb devices` with the device plugged in. When running
|
||||||
|
on a device, the android_emulator_wrench.py script will skip the steps to
|
||||||
|
download the AVDs and start the emulator.
|
||||||
|
|
|
@ -20,7 +20,6 @@ config = {
|
||||||
"emulator_process_name": "emulator64-x86",
|
"emulator_process_name": "emulator64-x86",
|
||||||
"emulator_extra_args": "-gpu swiftshader_indirect -skip-adb-auth -verbose -show-kernel -use-system-libs -ranchu -selinux permissive -memory 3072 -cores 4",
|
"emulator_extra_args": "-gpu swiftshader_indirect -skip-adb-auth -verbose -show-kernel -use-system-libs -ranchu -selinux permissive -memory 3072 -cores 4",
|
||||||
"exes": {
|
"exes": {
|
||||||
'adb': '%(abs_work_dir)s/android-sdk-linux/platform-tools/adb',
|
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"DISPLAY": ":0.0",
|
"DISPLAY": ":0.0",
|
||||||
|
|
|
@ -26,11 +26,37 @@ from mozharness.mozilla.testing.testbase import TestingMixin
|
||||||
|
|
||||||
class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin):
|
class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin):
|
||||||
def __init__(self, require_config_file=False):
|
def __init__(self, require_config_file=False):
|
||||||
|
# code in BaseScript.__init__ iterates all the properties to attach
|
||||||
|
# pre- and post-flight listeners, so we need _is_emulator be defined
|
||||||
|
# before that happens. Doesn't need to be a real value though.
|
||||||
|
self._is_emulator = None
|
||||||
|
|
||||||
super(AndroidWrench, self).__init__()
|
super(AndroidWrench, self).__init__()
|
||||||
self.device_serial = 'emulator-5554'
|
if self.device_serial is None:
|
||||||
self.use_gles3 = True
|
# Running on an emulator. Need absolute path to adb
|
||||||
|
# to satisfy android.py's start_emulator function.
|
||||||
|
self._is_emulator = True
|
||||||
|
self.device_serial = 'emulator-5554'
|
||||||
|
self._adb_path = os.path.join(
|
||||||
|
self.query_abs_dirs()['abs_work_dir'],
|
||||||
|
'android-sdk-linux',
|
||||||
|
'platform-tools',
|
||||||
|
'adb')
|
||||||
|
self.use_gles3 = True
|
||||||
|
else:
|
||||||
|
# Running on a device, ensure self.is_emulator returns False.
|
||||||
|
# Also don't set the adb path explicitly, since it should be
|
||||||
|
# on the $PATH anyway and we don't have an easy way to get the
|
||||||
|
# absolute path in automation (it's preinstalled on the bitbar
|
||||||
|
# image).
|
||||||
|
self._is_emulator = False
|
||||||
self._errored = False
|
self._errored = False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_emulator(self):
|
||||||
|
"""Overrides the is_emulator property on AndroidMixin."""
|
||||||
|
return self._is_emulator
|
||||||
|
|
||||||
def query_abs_dirs(self):
|
def query_abs_dirs(self):
|
||||||
if self.abs_dirs:
|
if self.abs_dirs:
|
||||||
return self.abs_dirs
|
return self.abs_dirs
|
||||||
|
@ -96,7 +122,10 @@ class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin):
|
||||||
args_file = os.path.join(
|
args_file = os.path.join(
|
||||||
self.query_abs_dirs()['abs_work_dir'], "wrench_args")
|
self.query_abs_dirs()['abs_work_dir'], "wrench_args")
|
||||||
with open(args_file, 'w') as argfile:
|
with open(args_file, 'w') as argfile:
|
||||||
argfile.write("env: WRENCH_REFTEST_CONDITION_EMULATOR=1\n")
|
if self.is_emulator:
|
||||||
|
argfile.write("env: WRENCH_REFTEST_CONDITION_EMULATOR=1\n")
|
||||||
|
else:
|
||||||
|
argfile.write("env: WRENCH_REFTEST_CONDITION_DEVICE=1\n")
|
||||||
argfile.write("reftest")
|
argfile.write("reftest")
|
||||||
self.device.push(args_file, '/sdcard/wrench/args')
|
self.device.push(args_file, '/sdcard/wrench/args')
|
||||||
|
|
||||||
|
@ -158,7 +187,7 @@ class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin):
|
||||||
self.info("=== end scraped logcat output ===")
|
self.info("=== end scraped logcat output ===")
|
||||||
self.info("(see logcat artifact for full logcat")
|
self.info("(see logcat artifact for full logcat")
|
||||||
|
|
||||||
def do_test(self):
|
def setup_emulator(self):
|
||||||
# Running setup_avds will clobber the existing AVD and redownload it.
|
# Running setup_avds will clobber the existing AVD and redownload it.
|
||||||
# For local testing that's kinda expensive, so we omit that if we
|
# For local testing that's kinda expensive, so we omit that if we
|
||||||
# already have that dir.
|
# already have that dir.
|
||||||
|
@ -188,8 +217,11 @@ class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin):
|
||||||
return
|
return
|
||||||
self._launch_emulator()
|
self._launch_emulator()
|
||||||
|
|
||||||
self.verify_device()
|
def do_test(self):
|
||||||
|
if self.is_emulator:
|
||||||
|
self.setup_emulator()
|
||||||
|
|
||||||
|
self.verify_device()
|
||||||
self.info('Installing APK...')
|
self.info('Installing APK...')
|
||||||
self.install_apk(self.query_abs_dirs()['abs_apk_path'], replace=True)
|
self.install_apk(self.query_abs_dirs()['abs_apk_path'], replace=True)
|
||||||
self.info('Setting up SD card...')
|
self.info('Setting up SD card...')
|
||||||
|
|
Загрузка…
Ссылка в новой задаче