mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Bug 996443: carry emulator arch automatically for mach commands. r=ahal
This commit is contained in:
parent
bff5181942
commit
d97ffaef80
@ -336,10 +336,6 @@ def B2GCommand(func):
|
||||
help='Emulator resolution of the format \'<width>x<height>\'')
|
||||
func = emulator_res(func)
|
||||
|
||||
emulator = CommandArgument('--emulator', default='arm',
|
||||
help='Architecture of emulator to use: x86 or arm')
|
||||
func = emulator(func)
|
||||
|
||||
marionette = CommandArgument('--marionette', default=None,
|
||||
help='host:port to use when connecting to Marionette')
|
||||
func = marionette(func)
|
||||
@ -396,7 +392,7 @@ class MachCommands(MachCommandBase):
|
||||
# they should be modified to work with all devices.
|
||||
def is_emulator(cls):
|
||||
"""Emulator needs to be configured."""
|
||||
return cls.device_name.find('emulator') == 0
|
||||
return cls.device_name.startswith('emulator')
|
||||
|
||||
|
||||
@CommandProvider
|
||||
@ -429,6 +425,13 @@ class B2GCommands(MachCommandBase):
|
||||
return self._run_reftest(test_file, suite='crashtest', **kwargs)
|
||||
|
||||
def _run_reftest(self, test_file=None, suite=None, **kwargs):
|
||||
if self.device_name:
|
||||
if self.device_name.startswith('emulator'):
|
||||
emulator = 'arm'
|
||||
if 'x86' in self.device_name:
|
||||
emulator = 'x86'
|
||||
kwargs['emulator'] = emulator
|
||||
|
||||
reftest = self._spawn(ReftestRunner)
|
||||
return reftest.run_b2g_test(self.b2g_home, self.xre_path,
|
||||
test_file, suite=suite, **kwargs)
|
||||
|
@ -69,16 +69,18 @@ class B2GCommands(MachCommandBase):
|
||||
@Command('marionette-webapi', category='testing',
|
||||
description='Run a Marionette webapi test',
|
||||
conditions=[conditions.is_b2g])
|
||||
@CommandArgument('--emulator', choices=['x86', 'arm'],
|
||||
help='Run an emulator of the specified architecture.')
|
||||
@CommandArgument('--type', dest='testtype',
|
||||
help='Test type, usually one of: browser, b2g, b2g-qemu.',
|
||||
default='b2g')
|
||||
@CommandArgument('tests', nargs='*', metavar='TESTS',
|
||||
help='Path to test(s) to run.')
|
||||
def run_marionette_webapi(self, tests, emulator=None, testtype=None):
|
||||
if not emulator and self.device_name.find('emulator') == 0:
|
||||
emulator='arm'
|
||||
def run_marionette_webapi(self, tests, testtype=None):
|
||||
emulator = None
|
||||
if self.device_name:
|
||||
if self.device_name.startswith('emulator'):
|
||||
emulator = 'arm'
|
||||
if 'x86' in self.device_name:
|
||||
emulator = 'x86'
|
||||
|
||||
if self.substs.get('ENABLE_MARIONETTE') != '1':
|
||||
print(MARIONETTE_DISABLED_B2G % 'marionette-webapi')
|
||||
|
@ -552,10 +552,6 @@ def B2GCommand(func):
|
||||
help='Define size of sdcard: 1MB, 50MB...etc')
|
||||
func = sdcard(func)
|
||||
|
||||
emulator = CommandArgument('--emulator', default='arm',
|
||||
help='Architecture of emulator to use: x86 or arm')
|
||||
func = emulator(func)
|
||||
|
||||
marionette = CommandArgument('--marionette', default=None,
|
||||
help='host:port to use when connecting to Marionette')
|
||||
func = marionette(func)
|
||||
@ -659,7 +655,7 @@ class MachCommands(MachCommandBase):
|
||||
# they should be modified to work with all devices.
|
||||
def is_emulator(cls):
|
||||
"""Emulator needs to be configured."""
|
||||
return cls.device_name.find('emulator') == 0
|
||||
return cls.device_name.startswith('emulator')
|
||||
|
||||
|
||||
@CommandProvider
|
||||
@ -681,6 +677,12 @@ class B2GCommands(MachCommandBase):
|
||||
def run_mochitest_remote(self, test_paths, **kwargs):
|
||||
from mozbuild.controller.building import BuildDriver
|
||||
|
||||
if self.device_name.startswith('emulator'):
|
||||
emulator = 'arm'
|
||||
if 'x86' in self.device_name:
|
||||
emulator = 'x86'
|
||||
kwargs['emulator'] = emulator
|
||||
|
||||
self._ensure_state_subdir_exists('.')
|
||||
|
||||
driver = self._spawn(BuildDriver)
|
||||
|
@ -34,7 +34,10 @@ If you have a B2G build, this can be found in
|
||||
'%s/out/host/<platform>/bin'.
|
||||
'''.lstrip()
|
||||
|
||||
BUSYBOX_URL = 'http://www.busybox.net/downloads/binaries/latest/busybox-armv7l'
|
||||
BUSYBOX_URLS = {
|
||||
'arm': 'http://www.busybox.net/downloads/binaries/latest/busybox-armv7l',
|
||||
'x86': 'http://www.busybox.net/downloads/binaries/latest/busybox-i686'
|
||||
}
|
||||
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
@ -303,8 +306,11 @@ class B2GXPCShellRunner(MozbuildObject):
|
||||
self.xpcshell_dir = os.path.join(self.tests_dir, 'xpcshell')
|
||||
self.bin_dir = os.path.join(self.distdir, 'bin')
|
||||
|
||||
def _download_busybox(self, b2g_home):
|
||||
system_bin = os.path.join(b2g_home, 'out', 'target', 'product', 'generic', 'system', 'bin')
|
||||
def _download_busybox(self, b2g_home, emulator):
|
||||
target_device = 'generic'
|
||||
if emulator == 'x86':
|
||||
target_device = 'generic_x86'
|
||||
system_bin = os.path.join(b2g_home, 'out', 'target', 'product', target_device, 'system', 'bin')
|
||||
busybox_path = os.path.join(system_bin, 'busybox')
|
||||
|
||||
if os.path.isfile(busybox_path):
|
||||
@ -314,7 +320,7 @@ class B2GXPCShellRunner(MozbuildObject):
|
||||
os.makedirs(system_bin)
|
||||
|
||||
try:
|
||||
data = urllib2.urlopen(BUSYBOX_URL)
|
||||
data = urllib2.urlopen(BUSYBOX_URLS[emulator])
|
||||
except urllib2.URLError:
|
||||
print('There was a problem downloading busybox. Proceeding without it,' \
|
||||
'initial setup will be slow.')
|
||||
@ -324,7 +330,7 @@ class B2GXPCShellRunner(MozbuildObject):
|
||||
f.write(data.read())
|
||||
return busybox_path
|
||||
|
||||
def run_test(self, test_paths, b2g_home=None, busybox=None,
|
||||
def run_test(self, test_paths, b2g_home=None, busybox=None, device_name=None,
|
||||
# ignore parameters from other platforms' options
|
||||
**kwargs):
|
||||
try:
|
||||
@ -348,7 +354,6 @@ class B2GXPCShellRunner(MozbuildObject):
|
||||
|
||||
options.b2g_path = b2g_home
|
||||
options.busybox = busybox or os.environ.get('BUSYBOX')
|
||||
options.emulator = 'arm'
|
||||
options.localLib = self.bin_dir
|
||||
options.localBin = self.bin_dir
|
||||
options.logcat_dir = self.xpcshell_dir
|
||||
@ -361,8 +366,13 @@ class B2GXPCShellRunner(MozbuildObject):
|
||||
options.testPath = test_path
|
||||
options.use_device_libs = True
|
||||
|
||||
options.emulator = 'arm'
|
||||
if device_name.startswith('emulator'):
|
||||
if 'x86' in device_name:
|
||||
options.emulator = 'x86'
|
||||
|
||||
if not options.busybox:
|
||||
options.busybox = self._download_busybox(b2g_home)
|
||||
options.busybox = self._download_busybox(b2g_home, options.emulator)
|
||||
|
||||
return runtestsb2g.run_remote_xpcshell(parser, options, args)
|
||||
|
||||
@ -436,6 +446,7 @@ class MachCommands(MachCommandBase):
|
||||
elif conditions.is_b2g(self):
|
||||
xpcshell = self._spawn(B2GXPCShellRunner)
|
||||
params['b2g_home'] = self.b2g_home
|
||||
params['device_name'] = self.device_name
|
||||
else:
|
||||
xpcshell = self._spawn(XPCShellRunner)
|
||||
xpcshell.cwd = self._mach_context.cwd
|
||||
|
Loading…
Reference in New Issue
Block a user