Beispiel #1
0
 def run_mochitest_chrome(self, test_paths, **kwargs):
     if conditions.is_firefox(self):
         return self.run_mochitest(test_paths, 'chrome', **kwargs)
     elif conditions.is_b2g(self) and conditions.is_emulator(self):
         return self.run_mochitest_remote(test_paths, chrome=True, **kwargs)
     elif conditions.is_android(self):
         return self.run_mochitest_android(test_paths, chrome=True, **kwargs)
Beispiel #2
0
    def run_xpcshell_test(self, **params):
        from mozbuild.controller.building import BuildDriver

        # 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('.')

        driver = self._spawn(BuildDriver)
        driver.install_tests(remove=False)

        structured.commandline.formatter_option_defaults['verbose'] = True
        params['log'] = structured.commandline.setup_logging("XPCShellTests",
                                                             params,
                                                             {"mach": sys.stdout})

        if conditions.is_android(self):
            xpcshell = self._spawn(AndroidXPCShellRunner)
        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

        try:
            return xpcshell.run_test(**params)
        except InvalidTestPathError as e:
            print(e.message)
            return 1
Beispiel #3
0
    def run_xpcshell_test(self, **params):
        from mozbuild.controller.building import BuildDriver

        # 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('.')

        driver = self._spawn(BuildDriver)
        driver.install_tests(remove=False)

        if conditions.is_android(self):
            xpcshell = self._spawn(AndroidXPCShellRunner)
        elif conditions.is_b2g(self):
            xpcshell = self._spawn(B2GXPCShellRunner)
            params['b2g_home'] = self.b2g_home
        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 get_parser():
    build_obj = MozbuildObject.from_environment(cwd=here)
    if conditions.is_android(build_obj):
        return parser_remote()
    elif conditions.is_b2g(build_obj):
        return parser_b2g()
    else:
        return parser_desktop()
Beispiel #5
0
    def run_luciddream_test(self, browser_path, b2g_desktop_path, test_paths, consoles, **params):
        # import luciddream lazily as its marionette dependency make ./mach clobber fails
        # early on TBPL
        import luciddream.runluciddream

        # get_binary_path is going to throw if we haven't built any product
        # but luciddream can still be run if we provide both binaries...
        binary_path = False
        try:
            binary_path = self.get_binary_path()
        except Exception:
            pass

        # otherwise, if we have a build, automatically fetch the binary
        if conditions.is_b2g(self):
            if not b2g_desktop_path and binary_path:
                b2g_desktop_path = binary_path
        else:
            if not browser_path and binary_path:
                browser_path = binary_path

        if not browser_path:
            print "Need firefox binary path via --browser_path argument"
            return 1
        elif not os.path.exists(browser_path):
            print "Firefox binary doesn't exists: " + browser_path
            return 1

        if not b2g_desktop_path:
            print "Need b2g desktop binary path via --b2g-desktop argument"
            return 1
        elif not os.path.exists(b2g_desktop_path):
            print "B2G desktop binary doesn't exists: " + b2g_desktop_path
            return 1

        if not test_paths or len(test_paths) == 0:
            print "Please specify a test manifest to run"
            return 1

        browser_args = None
        if consoles:
            browser_args = ["-jsconsole"]
            if "app_args" in params and isinstance(params["app_args"], list):
                params["app_args"].append("-jsconsole")
            else:
                params["app_args"] = ["-jsconsole"]

        for test in test_paths:
            luciddream.runluciddream.run(
                browser_path=browser_path,
                b2g_desktop_path=b2g_desktop_path,
                manifest=test,
                browser_args=browser_args,
                **params
            )
    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('.')


        params['log'] = structured.commandline.setup_logging("XPCShellTests",
                                                             params,
                                                             {"mach": sys.stdout},
                                                             {"verbose": True})

        if conditions.is_android(self):
            from mozrunner.devices.android_device import verify_android_device
            verify_android_device(self)
            xpcshell = self._spawn(AndroidXPCShellRunner)
        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

        try:
            return xpcshell.run_test(**params)
        except InvalidTestPathError as e:
            print(e.message)
            return 1
    def __init__(self, app=None, **kwargs):
        ArgumentParser.__init__(self, usage=self.__doc__, conflict_handler='resolve', **kwargs)

        self.oldcwd = os.getcwd()
        self.app = app
        if not self.app and build_obj:
            if conditions.is_android(build_obj):
                self.app = 'android'
            elif conditions.is_b2g(build_obj) or conditions.is_b2g_desktop(build_obj):
                self.app = 'b2g'
        if not self.app:
            # platform can't be determined and app wasn't specified explicitly,
            # so just use generic arguments and hope for the best
            self.app = 'generic'

        if self.app not in container_map:
            self.error("Unrecognized app '{}'! Must be one of: {}".format(
                self.app, ', '.join(container_map.keys())))

        defaults = {}
        for container in self.containers:
            defaults.update(container.defaults)
            group = self.add_argument_group(container.__class__.__name__, container.__doc__)

            for cli, kwargs in container.args:
                # Allocate new lists so references to original don't get mutated.
                # allowing multiple uses within a single process.
                if "default" in kwargs and isinstance(kwargs['default'], list):
                    kwargs["default"] = []

                if 'suppress' in kwargs:
                    if kwargs['suppress']:
                        kwargs['help'] = SUPPRESS
                    del kwargs['suppress']

                group.add_argument(*cli, **kwargs)

        self.set_defaults(**defaults)
        structured.commandline.add_logging_group(self)
Beispiel #8
0
    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

        # 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('.')

        driver = self._spawn(BuildDriver)
        driver.install_tests(remove=False)

        params['log'] = structured.commandline.setup_logging(
            "XPCShellTests", params, {"mach": sys.stdout}, {"verbose": True})

        if conditions.is_android(self):
            from mozrunner.devices.android_device import verify_android_device
            verify_android_device(self)
            xpcshell = self._spawn(AndroidXPCShellRunner)
        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

        try:
            return xpcshell.run_test(**params)
        except InvalidTestPathError as e:
            print(e.message)
            return 1
Beispiel #9
0
def is_platform_supported(cls):
    """Must have a Firefox, Android or B2G build."""
    return conditions.is_android(cls) or \
           conditions.is_b2g(cls) or \
           conditions.is_firefox(cls)
Beispiel #10
0
 def run_mochitest_chrome(self, test_paths, **kwargs):
     if conditions.is_firefox(self):
         return self.run_mochitest(test_paths, 'chrome', **kwargs)
     elif conditions.is_b2g(self) and conditions.is_emulator(self):
         return self.run_mochitest_remote(test_paths, chrome=True, **kwargs)
Beispiel #11
0
def is_platform_supported(cls):
    """Must have a Firefox, Android or B2G build."""
    return conditions.is_android(cls) or \
           conditions.is_b2g(cls) or \
           conditions.is_firefox(cls)