def run_android_test(self, context, tests, **kwargs): host_ret = verify_host_bin() if host_ret != 0: return host_ret import imp path = os.path.join(self.mochitest_dir, 'runtestsremote.py') with open(path, 'r') as fh: imp.load_module('runtestsremote', fh, path, ('.py', 'r', imp.PY_SOURCE)) import runtestsremote from mozrunner.devices.android_device import get_adb_path if not kwargs['adbPath']: kwargs['adbPath'] = get_adb_path(self) options = Namespace(**kwargs) from manifestparser import TestManifest if tests and not options.manifestFile: manifest = TestManifest() manifest.tests.extend(tests) options.manifestFile = manifest # Firefox for Android doesn't use e10s if options.app is None or 'geckoview' not in options.app: options.e10s = False print("using e10s=False for non-geckoview app") return runtestsremote.run_test_harness(parser, options)
def run_junit(self, **kwargs): self._ensure_state_subdir_exists('.') from mozrunner.devices.android_device import ( grant_runtime_permissions, get_adb_path, verify_android_device) # verify installation app = kwargs.get('app') device_serial = kwargs.get('deviceSerial') verify_android_device(self, install=True, xre=False, app=app, device_serial=device_serial) grant_runtime_permissions(self, app, device_serial=device_serial) if not kwargs.get('adbPath'): kwargs['adbPath'] = get_adb_path(self) if not kwargs.get('log'): from mozlog.commandline import setup_logging format_args = { 'level': self._mach_context.settings['test']['level'] } default_format = self._mach_context.settings['test']['format'] kwargs['log'] = setup_logging('mach-mochitest', kwargs, {default_format: sys.stdout}, format_args) mochitest = self._spawn(MochitestRunner) return mochitest.run_geckoview_junit_test(self._mach_context, **kwargs)
def run_robocop(self, serve=False, **kwargs): if serve: kwargs['autorun'] = False if not kwargs.get('robocopIni'): kwargs['robocopIni'] = os.path.join(self.topobjdir, '_tests', 'testing', 'mochitest', 'robocop.ini') from mozbuild.controller.building import BuildDriver self._ensure_state_subdir_exists('.') test_paths = kwargs['test_paths'] kwargs['test_paths'] = [] from moztest.resolve import TestResolver resolver = self._spawn(TestResolver) tests = list(resolver.resolve_tests(paths=test_paths, cwd=self._mach_context.cwd, flavor='instrumentation', subsuite='robocop')) driver = self._spawn(BuildDriver) driver.install_tests(tests) if len(tests) < 1: print(ROBOCOP_TESTS_NOT_FOUND.format('\n'.join( sorted(list(test_paths))))) return 1 from mozrunner.devices.android_device import grant_runtime_permissions, get_adb_path grant_runtime_permissions(self) if not kwargs['adbPath']: kwargs['adbPath'] = get_adb_path(self) mochitest = self._spawn(MochitestRunner) return mochitest.run_robocop_test(self._mach_context, tests, 'robocop', **kwargs)
def run_android_test(self, tests, symbols_path, manifest_path, log): import remotecppunittests as remotecppunittests from mozlog import commandline parser = remotecppunittests.RemoteCPPUnittestOptions() commandline.add_logging_group(parser) options, args = parser.parse_args() if not options.adb_path: from mozrunner.devices.android_device import get_adb_path options.adb_path = get_adb_path(self) options.symbols_path = symbols_path options.manifest_path = manifest_path options.xre_path = self.bindir options.local_lib = self.bindir.replace('bin', 'fennec') for file in os.listdir(os.path.join(self.topobjdir, "dist")): if file.endswith(".apk") and file.startswith("fennec"): options.local_apk = os.path.join(self.topobjdir, "dist", file) log.info("using APK: " + options.local_apk) break try: result = remotecppunittests.run_test_harness(options, tests) except Exception as e: log.error("Caught exception running cpp unit tests: %s" % str(e)) result = False raise return 0 if result else 1
def run_android_test(self, tests, symbols_path, manifest_path, log): import remotecppunittests as remotecppunittests from mozlog import commandline parser = remotecppunittests.RemoteCPPUnittestOptions() commandline.add_logging_group(parser) options, args = parser.parse_args() if not options.adb_path: from mozrunner.devices.android_device import get_adb_path options.adb_path = get_adb_path(self) options.symbols_path = symbols_path options.manifest_path = manifest_path options.xre_path = self.bindir options.local_lib = self.bindir.replace('bin', 'fennec') for file in os.listdir(os.path.join(self.topobjdir, "dist")): if file.endswith(".apk") and file.startswith("fennec"): options.local_apk = os.path.join(self.topobjdir, "dist", file) log.info("using APK: " + options.local_apk) break try: result = remotecppunittests.run_test_harness(options, tests) except Exception as e: log.error("Caught exception running cpp unit tests: %s" % str(e)) result = False raise return 0 if result else 1
def run_android_test(self, context, tests, suite=None, **kwargs): host_ret = verify_host_bin() if host_ret != 0: return host_ret import imp path = os.path.join(self.mochitest_dir, 'runtestsremote.py') with open(path, 'r') as fh: imp.load_module('runtestsremote', fh, path, ('.py', 'r', imp.PY_SOURCE)) import runtestsremote from mozrunner.devices.android_device import get_adb_path if not kwargs['adbPath']: kwargs['adbPath'] = get_adb_path(self) options = Namespace(**kwargs) from manifestparser import TestManifest if tests and not options.manifestFile: manifest = TestManifest() manifest.tests.extend(tests) options.manifestFile = manifest return runtestsremote.run_test_harness(parser, options)
def run_android_test(self, context, tests, suite=None, **kwargs): host_ret = verify_host_bin() if host_ret != 0: return host_ret import imp path = os.path.join(self.mochitest_dir, 'runtestsremote.py') with open(path, 'r') as fh: imp.load_module('runtestsremote', fh, path, ('.py', 'r', imp.PY_SOURCE)) import runtestsremote from mozrunner.devices.android_device import get_adb_path if not kwargs['adbPath']: kwargs['adbPath'] = get_adb_path(self) options = Namespace(**kwargs) from manifestparser import TestManifest if tests and not options.manifestFile: manifest = TestManifest() manifest.tests.extend(tests) options.manifestFile = manifest return runtestsremote.run_test_harness(parser, options)
def run_robocop(self, serve=False, **kwargs): if serve: kwargs['autorun'] = False if not kwargs.get('robocopIni'): kwargs['robocopIni'] = os.path.join(self.topobjdir, '_tests', 'testing', 'mochitest', 'robocop.ini') from mozbuild.controller.building import BuildDriver self._ensure_state_subdir_exists('.') test_paths = kwargs['test_paths'] kwargs['test_paths'] = [] from moztest.resolve import TestResolver resolver = self._spawn(TestResolver) tests = list( resolver.resolve_tests(paths=test_paths, cwd=self._mach_context.cwd, flavor='instrumentation', subsuite='robocop')) driver = self._spawn(BuildDriver) driver.install_tests(tests) if len(tests) < 1: print( ROBOCOP_TESTS_NOT_FOUND.format('\n'.join( sorted(list(test_paths))))) return 1 from mozrunner.devices.android_device import grant_runtime_permissions, get_adb_path from mozrunner.devices.android_device import verify_android_device # verify installation app = kwargs.get('app') if not app: kwargs['app'] = app = self.substs["ANDROID_PACKAGE_NAME"] device_serial = kwargs.get('deviceSerial') # setup adb logging so that grant_runtime_permissions can log from mozlog.commandline import setup_logging format_args = {'level': self._mach_context.settings['test']['level']} default_format = self._mach_context.settings['test']['format'] setup_logging('adb', kwargs, {default_format: sys.stdout}, format_args) verify_android_device(self, install=True, xre=False, network=True, app=app, device_serial=device_serial) grant_runtime_permissions(self, app, device_serial=device_serial) if not kwargs['adbPath']: kwargs['adbPath'] = get_adb_path(self) mochitest = self._spawn(MochitestRunner) return mochitest.run_robocop_test(self._mach_context, tests, **kwargs)
def run_xpcshell_test(self, test_objects=None, **params): from mozbuild.controller.building import BuildDriver if test_objects is not None: from manifestparser import TestManifest m = TestManifest() m.tests.extend(test_objects) params["manifest"] = m driver = self._spawn(BuildDriver) driver.install_tests() # We should probably have a utility function to ensure the tree is # ready to run tests. Until then, we just create the state dir (in # case the tree wasn't built with mach). self._ensure_state_subdir_exists(".") if not params.get("log"): log_defaults = { self._mach_context.settings["test"]["format"]: sys.stdout } fmt_defaults = { "level": self._mach_context.settings["test"]["level"], "verbose": True, } params["log"] = structured.commandline.setup_logging( "XPCShellTests", params, log_defaults, fmt_defaults) if not params["threadCount"]: # pylint --py3k W1619 params["threadCount"] = int((cpu_count() * 3) / 2) if conditions.is_android(self) or self.substs.get( "MOZ_BUILD_APP") == "b2g": from mozrunner.devices.android_device import ( verify_android_device, get_adb_path, ) device_serial = params.get("deviceSerial") verify_android_device(self, network=True, device_serial=device_serial) if not params["adbPath"]: params["adbPath"] = get_adb_path(self) xpcshell = self._spawn(AndroidXPCShellRunner) else: xpcshell = self._spawn(XPCShellRunner) xpcshell.cwd = self._mach_context.cwd try: return xpcshell.run_test(**params) except InvalidTestPathError as e: print(str(e)) return 1
def run_xpcshell_test(self, test_objects=None, **params): from mozbuild.controller.building import BuildDriver if test_objects is not None: from manifestparser import TestManifest m = TestManifest() m.tests.extend(test_objects) params['manifest'] = m driver = self._spawn(BuildDriver) driver.install_tests(test_objects) # We should probably have a utility function to ensure the tree is # ready to run tests. Until then, we just create the state dir (in # case the tree wasn't built with mach). self._ensure_state_subdir_exists('.') if not params.get('log'): log_defaults = { self._mach_context.settings['test']['format']: sys.stdout } fmt_defaults = { "level": self._mach_context.settings['test']['level'], "verbose": True } params['log'] = structured.commandline.setup_logging( "XPCShellTests", params, log_defaults, fmt_defaults) if not params['threadCount']: params['threadCount'] = int((cpu_count() * 3) / 2) if conditions.is_android(self): from mozrunner.devices.android_device import verify_android_device, get_adb_path device_serial = params.get('deviceSerial') verify_android_device(self, network=True, device_serial=device_serial) if not params['adbPath']: params['adbPath'] = get_adb_path(self) xpcshell = self._spawn(AndroidXPCShellRunner) else: xpcshell = self._spawn(XPCShellRunner) xpcshell.cwd = self._mach_context.cwd try: return xpcshell.run_test(**params) except InvalidTestPathError as e: print(e.message) return 1
def run_robocop(self, serve=False, **kwargs): if serve: kwargs['autorun'] = False if not kwargs.get('robocopIni'): kwargs['robocopIni'] = os.path.join(self.topobjdir, '_tests', 'testing', 'mochitest', 'robocop.ini') from mozbuild.controller.building import BuildDriver self._ensure_state_subdir_exists('.') test_paths = kwargs['test_paths'] kwargs['test_paths'] = [] from moztest.resolve import TestResolver resolver = self._spawn(TestResolver) tests = list( resolver.resolve_tests(paths=test_paths, cwd=self._mach_context.cwd, flavor='instrumentation', subsuite='robocop')) driver = self._spawn(BuildDriver) driver.install_tests(tests) if len(tests) < 1: print( ROBOCOP_TESTS_NOT_FOUND.format('\n'.join( sorted(list(test_paths))))) return 1 from mozrunner.devices.android_device import grant_runtime_permissions, get_adb_path from mozrunner.devices.android_device import verify_android_device # verify installation app = kwargs.get('app') if not app: app = self.substs["ANDROID_PACKAGE_NAME"] verify_android_device(self, install=True, xre=False, app=app) grant_runtime_permissions(self, app) if not kwargs['adbPath']: kwargs['adbPath'] = get_adb_path(self) mochitest = self._spawn(MochitestRunner) return mochitest.run_robocop_test(self._mach_context, tests, 'robocop', **kwargs)
def run_xpcshell_test(self, test_objects=None, **params): from mozbuild.controller.building import BuildDriver if test_objects is not None: from manifestparser import TestManifest m = TestManifest() m.tests.extend(test_objects) params['manifest'] = m driver = self._spawn(BuildDriver) driver.install_tests(test_objects) # We should probably have a utility function to ensure the tree is # ready to run tests. Until then, we just create the state dir (in # case the tree wasn't built with mach). self._ensure_state_subdir_exists('.') if not params.get('log'): params['log'] = structured.commandline.setup_logging("XPCShellTests", params, {"mach": sys.stdout}, {"verbose": True}) if not params['threadCount']: params['threadCount'] = int((cpu_count() * 3) / 2) if conditions.is_android(self): from mozrunner.devices.android_device import verify_android_device, get_adb_path verify_android_device(self) if not params['adbPath']: params['adbPath'] = get_adb_path(self) xpcshell = self._spawn(AndroidXPCShellRunner) else: xpcshell = self._spawn(XPCShellRunner) xpcshell.cwd = self._mach_context.cwd try: return xpcshell.run_test(**params) except InvalidTestPathError as e: print(e.message) return 1
def run_junit(command_context, no_install, **kwargs): command_context._ensure_state_subdir_exists(".") from mozrunner.devices.android_device import ( get_adb_path, verify_android_device, InstallIntent, ) # verify installation app = kwargs.get("app") device_serial = kwargs.get("deviceSerial") verify_android_device( command_context, install=InstallIntent.NO if no_install else InstallIntent.YES, xre=False, app=app, device_serial=device_serial, ) if not kwargs.get("adbPath"): kwargs["adbPath"] = get_adb_path(command_context) if not kwargs.get("log"): from mozlog.commandline import setup_logging format_args = { "level": command_context._mach_context.settings["test"]["level"] } default_format = command_context._mach_context.settings["test"][ "format"] kwargs["log"] = setup_logging("mach-mochitest", kwargs, {default_format: sys.stdout}, format_args) mochitest = command_context._spawn(MochitestRunner) return mochitest.run_geckoview_junit_test(command_context._mach_context, **kwargs)
def run_android_test(self, **kwargs): """Runs a reftest, in Firefox for Android.""" args = Namespace(**kwargs) if args.suite not in ('reftest', 'crashtest', 'jstestbrowser'): raise Exception('None or unrecognized reftest suite type.') self._setup_objdir(args) import remotereftest default_manifest = { "reftest": (self.topsrcdir, "layout", "reftests", "reftest.list"), "crashtest": (self.topsrcdir, "testing", "crashtest", "crashtests.list"), "jstestbrowser": ("jsreftest", "tests", "jstests.list") } if not args.tests: args.tests = [os.path.join(*default_manifest[args.suite])] args.extraProfileFiles.append( os.path.join(self.topsrcdir, "mobile", "android", "fonts")) hyphenation_path = os.path.join(self.topsrcdir, "intl", "locales") for (dirpath, dirnames, filenames) in os.walk(hyphenation_path): for filename in filenames: if filename.endswith('.dic'): args.extraProfileFiles.append( os.path.join(dirpath, filename)) if not args.httpdPath: args.httpdPath = os.path.join(self.tests_dir, "modules") if not args.symbolsPath: args.symbolsPath = os.path.join(self.topobjdir, "crashreporter-symbols") if not args.xrePath: args.xrePath = os.environ.get("MOZ_HOST_BIN") if not args.app: args.app = self.substs["ANDROID_PACKAGE_NAME"] if not args.utilityPath: args.utilityPath = args.xrePath args.ignoreWindowSize = True args.printDeviceInfo = False from mozrunner.devices.android_device import grant_runtime_permissions, get_adb_path grant_runtime_permissions(self, args.app, device_serial=args.deviceSerial) if not args.adb_path: args.adb_path = get_adb_path(self) # A symlink and some path manipulations are required so that test # manifests can be found both locally and remotely (via a url) # using the same relative path. if args.suite == "jstestbrowser": staged_js_dir = os.path.join(self.topobjdir, "dist", "test-stage", "jsreftest") tests = os.path.join(self.reftest_dir, 'jsreftest') if not os.path.isdir(tests): os.symlink(staged_js_dir, tests) args.extraProfileFiles.append( os.path.join(staged_js_dir, "tests", "user.js")) else: tests = os.path.join(self.reftest_dir, "tests") if not os.path.isdir(tests): os.symlink(self.topsrcdir, tests) for i, path in enumerate(args.tests): # Non-absolute paths are relative to the packaged directory, which # has an extra tests/ at the start if os.path.exists(os.path.abspath(path)): path = os.path.relpath(path, os.path.join(self.topsrcdir)) args.tests[i] = os.path.join('tests', path) self.log_manager.enable_unstructured() try: rv = remotereftest.run_test_harness(parser, args) finally: self.log_manager.disable_unstructured() return rv
def run_mochitest_general(command_context, flavor=None, test_objects=None, resolve_tests=True, **kwargs): from mochitest_options import ALL_FLAVORS from mozlog.commandline import setup_logging from mozlog.handlers import StreamHandler from moztest.resolve import get_suite_definition # TODO: This is only strictly necessary while mochitest is using Python # 2 and can be removed once the command is migrated to Python 3. command_context.activate_virtualenv() buildapp = None for app in SUPPORTED_APPS: if conditions.is_buildapp_in(command_context, apps=[app]): buildapp = app break flavors = None if flavor: for fname, fobj in six.iteritems(ALL_FLAVORS): if flavor in fobj["aliases"]: if buildapp not in fobj["enabled_apps"]: continue flavors = [fname] break else: flavors = [ f for f, v in six.iteritems(ALL_FLAVORS) if buildapp in v["enabled_apps"] ] from mozbuild.controller.building import BuildDriver command_context._ensure_state_subdir_exists(".") test_paths = kwargs["test_paths"] kwargs["test_paths"] = [] if kwargs.get("debugger", None): import mozdebug if not mozdebug.get_debugger_info(kwargs.get("debugger")): sys.exit(1) mochitest = command_context._spawn(MochitestRunner) tests = [] if resolve_tests: tests = mochitest.resolve_tests(test_paths, test_objects, cwd=command_context._mach_context.cwd) if not kwargs.get("log"): # Create shared logger format_args = { "level": command_context._mach_context.settings["test"]["level"] } if len(tests) == 1: format_args["verbose"] = True format_args["compact"] = False default_format = command_context._mach_context.settings["test"][ "format"] kwargs["log"] = setup_logging("mach-mochitest", kwargs, {default_format: sys.stdout}, format_args) for handler in kwargs["log"].handlers: if isinstance(handler, StreamHandler): handler.formatter.inner.summary_on_shutdown = True driver = command_context._spawn(BuildDriver) driver.install_tests() subsuite = kwargs.get("subsuite") if subsuite == "default": kwargs["subsuite"] = None suites = defaultdict(list) is_webrtc_tag_present = False unsupported = set() for test in tests: # Check if we're running a webrtc test so we can enable webrtc # specific test logic later if needed. if "webrtc" in test.get("tags", ""): is_webrtc_tag_present = True # Filter out non-mochitests and unsupported flavors. if test["flavor"] not in ALL_FLAVORS: continue key = (test["flavor"], test.get("subsuite", "")) if test["flavor"] not in flavors: unsupported.add(key) continue if subsuite == "default": # "--subsuite default" means only run tests that don't have a subsuite if test.get("subsuite"): unsupported.add(key) continue elif subsuite and test.get("subsuite", "") != subsuite: unsupported.add(key) continue suites[key].append(test) # Only webrtc mochitests in the media suite need the websocketprocessbridge. if ("mochitest", "media") in suites and is_webrtc_tag_present: req = os.path.join( "testing", "tools", "websocketprocessbridge", "websocketprocessbridge_requirements_3.txt", ) command_context.virtualenv_manager.activate() command_context.virtualenv_manager.install_pip_requirements( req, require_hashes=False) # sys.executable is used to start the websocketprocessbridge, though for some # reason it doesn't get set when calling `activate_this.py` in the virtualenv. sys.executable = command_context.virtualenv_manager.python_path # This is a hack to introduce an option in mach to not send # filtered tests to the mochitest harness. Mochitest harness will read # the master manifest in that case. if not resolve_tests: for flavor in flavors: key = (flavor, kwargs.get("subsuite")) suites[key] = [] if not suites: # Make it very clear why no tests were found if not unsupported: print( TESTS_NOT_FOUND.format("\n".join( sorted(list(test_paths or test_objects))))) return 1 msg = [] for f, s in unsupported: fobj = ALL_FLAVORS[f] apps = fobj["enabled_apps"] name = fobj["aliases"][0] if s: name = "{} --subsuite {}".format(name, s) if buildapp not in apps: reason = "requires {}".format(" or ".join(apps)) else: reason = "excluded by the command line" msg.append(" mochitest -f {} ({})".format(name, reason)) print( SUPPORTED_TESTS_NOT_FOUND.format(buildapp, "\n".join(sorted(msg)))) return 1 if buildapp == "android": from mozrunner.devices.android_device import ( get_adb_path, verify_android_device, InstallIntent, ) app = kwargs.get("app") if not app: app = "org.mozilla.geckoview.test" device_serial = kwargs.get("deviceSerial") install = InstallIntent.NO if kwargs.get( "no_install") else InstallIntent.YES # verify installation verify_android_device( command_context, install=install, xre=False, network=True, app=app, device_serial=device_serial, ) if not kwargs["adbPath"]: kwargs["adbPath"] = get_adb_path(command_context) run_mochitest = mochitest.run_android_test else: run_mochitest = mochitest.run_desktop_test overall = None for (flavor, subsuite), tests in sorted(suites.items()): suite_name, suite = get_suite_definition(flavor, subsuite) if "test_paths" in suite["kwargs"]: del suite["kwargs"]["test_paths"] harness_args = kwargs.copy() harness_args.update(suite["kwargs"]) # Pass in the full suite name as defined in moztest/resolve.py in case # chunk-by-runtime is called, in which case runtime information for # specific mochitest suite has to be loaded. See Bug 1637463. harness_args.update({"suite_name": suite_name}) result = run_mochitest(command_context._mach_context, tests=tests, **harness_args) if result: overall = result # Halt tests on keyboard interrupt if result == -1: break # Only shutdown the logger if we created it if kwargs["log"].name == "mach-mochitest": kwargs["log"].shutdown() return overall
def run_android_test(self, **kwargs): """Runs a reftest, in an Android application.""" args = Namespace(**kwargs) if args.suite not in ("reftest", "crashtest", "jstestbrowser"): raise Exception("None or unrecognized reftest suite type.") self._setup_objdir(args) import remotereftest default_manifest = { "reftest": (self.topsrcdir, "layout", "reftests", "reftest.list"), "crashtest": (self.topsrcdir, "testing", "crashtest", "crashtests.list"), "jstestbrowser": ( self.topobjdir, "dist", "test-stage", "jsreftest", "tests", "js", "src", "tests", "jstests.list", ), } if not args.tests: args.tests = [os.path.join(*default_manifest[args.suite])] args.extraProfileFiles.append( os.path.join(self.topsrcdir, "mobile", "android", "fonts")) hyphenation_path = os.path.join(self.topsrcdir, "intl", "locales") for (dirpath, dirnames, filenames) in os.walk(hyphenation_path): for filename in filenames: if filename.endswith(".dic"): args.extraProfileFiles.append( os.path.join(dirpath, filename)) if not args.httpdPath: args.httpdPath = os.path.join(self.tests_dir, "modules") if not args.symbolsPath: args.symbolsPath = os.path.join(self.topobjdir, "crashreporter-symbols") if not args.xrePath: args.xrePath = os.environ.get("MOZ_HOST_BIN") if not args.app: args.app = "org.mozilla.geckoview.test" if not args.utilityPath: args.utilityPath = args.xrePath args.ignoreWindowSize = True from mozrunner.devices.android_device import get_adb_path if not args.adb_path: args.adb_path = get_adb_path(self) if "geckoview" not in args.app: args.e10s = False print("using e10s=False for non-geckoview app") # A symlink and some path manipulations are required so that test # manifests can be found both locally and remotely (via a url) # using the same relative path. if args.suite == "jstestbrowser": staged_js_dir = os.path.join(self.topobjdir, "dist", "test-stage", "jsreftest") tests = os.path.join(self.reftest_dir, "jsreftest") if not os.path.isdir(tests) and not os.path.islink(tests): os.symlink(staged_js_dir, tests) args.extraProfileFiles.append( os.path.join(staged_js_dir, "tests", "js", "src", "tests", "user.js")) else: tests = os.path.join(self.reftest_dir, "tests") if not os.path.isdir(tests) and not os.path.islink(tests): os.symlink(self.topsrcdir, tests) for i, path in enumerate(args.tests): # Non-absolute paths are relative to the packaged directory, which # has an extra tests/ at the start if os.path.exists(os.path.abspath(path)): path = os.path.relpath(path, os.path.join(self.topsrcdir)) args.tests[i] = os.path.join("tests", path) self.log_manager.enable_unstructured() try: rv = remotereftest.run_test_harness(parser, args) finally: self.log_manager.disable_unstructured() return rv
def kwargs_common(self, kwargs): """Setup kwargs relevant for all browser products""" tests_src_path = os.path.join(self._here, "tests") if ( kwargs["product"] in {"firefox", "firefox_android"} and kwargs["specialpowers_path"] is None ): kwargs["specialpowers_path"] = os.path.join( self.distdir, "xpi-stage", "*****@*****.**" ) if kwargs["product"] == "firefox_android": # package_name may be different in the future package_name = kwargs["package_name"] if not package_name: kwargs["package_name"] = package_name = "org.mozilla.geckoview.test" # Note that this import may fail in non-firefox-for-android trees from mozrunner.devices.android_device import ( get_adb_path, verify_android_device, InstallIntent, ) kwargs["adb_binary"] = get_adb_path(self) install = ( InstallIntent.NO if kwargs.pop("no_install") else InstallIntent.YES ) verify_android_device( self, install=install, verbose=False, xre=True, app=package_name ) if kwargs["certutil_binary"] is None: kwargs["certutil_binary"] = os.path.join( os.environ.get("MOZ_HOST_BIN"), "certutil" ) if kwargs["install_fonts"] is None: kwargs["install_fonts"] = True if kwargs["config"] is None: kwargs["config"] = os.path.join( self.topobjdir, "_tests", "web-platform", "wptrunner.local.ini" ) if ( kwargs["exclude"] is None and kwargs["include"] is None and not sys.platform.startswith("linux") ): kwargs["exclude"] = ["css"] if kwargs["ssl_type"] in (None, "pregenerated"): cert_root = os.path.join(tests_src_path, "tools", "certs") if kwargs["ca_cert_path"] is None: kwargs["ca_cert_path"] = os.path.join(cert_root, "cacert.pem") if kwargs["host_key_path"] is None: kwargs["host_key_path"] = os.path.join( cert_root, "web-platform.test.key" ) if kwargs["host_cert_path"] is None: kwargs["host_cert_path"] = os.path.join( cert_root, "web-platform.test.pem" ) if kwargs["reftest_screenshot"] is None: kwargs["reftest_screenshot"] = "fail" kwargs["capture_stdio"] = True return kwargs