Exemplo n.º 1
0
    def run_test(self, **kwargs):
        # TODO Bug 794506 remove once mach integrates with virtualenv.
        build_path = os.path.join(self.topobjdir, 'build')
        if build_path not in sys.path:
            sys.path.append(build_path)

        import remotexpcshelltests

        dm = self.get_devicemanager(kwargs["dm_trans"], kwargs["deviceIP"], kwargs["devicePort"],
                                    kwargs["remoteTestRoot"])

        log = kwargs.pop("log")
        self.log_manager.enable_unstructured()

        if kwargs["xpcshell"] is None:
            kwargs["xpcshell"] = "xpcshell"

        if not kwargs["objdir"]:
            kwargs["objdir"] = self.topobjdir

        if not kwargs["localLib"]:
            kwargs["localLib"] = os.path.join(self.topobjdir, 'dist/fennec')

        if not kwargs["localBin"]:
            kwargs["localBin"] = os.path.join(self.topobjdir, 'dist/bin')

        if not kwargs["testingModulesDir"]:
            kwargs["testingModulesDir"] = os.path.join(self.topobjdir, '_tests/modules')

        if not kwargs["mozInfo"]:
            kwargs["mozInfo"] = os.path.join(self.topobjdir, 'mozinfo.json')

        if not kwargs["manifest"]:
            kwargs["manifest"] = os.path.join(self.topobjdir, '_tests/xpcshell/xpcshell.ini')

        if not kwargs["symbolsPath"]:
            kwargs["symbolsPath"] = os.path.join(self.distdir, 'crashreporter-symbols')

        if not kwargs["localAPK"]:
            for file_name in os.listdir(os.path.join(kwargs["objdir"], "dist")):
                if file_name.endswith(".apk") and file_name.startswith("fennec"):
                    kwargs["localAPK"] = os.path.join(kwargs["objdir"], "dist", file_name)
                    print ("using APK: %s" % kwargs["localAPK"])
                    break
            else:
                raise Exception("APK not found in objdir. You must specify an APK.")

        if not kwargs["sequential"]:
            kwargs["sequential"] = True

        options = argparse.Namespace(**kwargs)
        xpcshell = remotexpcshelltests.XPCShellRemote(dm, options, log)

        result = xpcshell.runTests(testClass=remotexpcshelltests.RemoteXPCShellTestThread,
                                   mobileArgs=xpcshell.mobileArgs,
                                   **vars(options))

        self.log_manager.disable_unstructured()

        return int(not result)
Exemplo n.º 2
0
    def run_test(self, **kwargs):
        # TODO Bug 794506 remove once mach integrates with virtualenv.
        build_path = os.path.join(self.topobjdir, 'build')
        if build_path not in sys.path:
            sys.path.append(build_path)

        import remotexpcshelltests

        log = kwargs.pop("log")
        self.log_manager.enable_unstructured()

        if kwargs["xpcshell"] is None:
            kwargs["xpcshell"] = "xpcshell"

        if not kwargs["objdir"]:
            kwargs["objdir"] = self.topobjdir

        if not kwargs["localBin"]:
            kwargs["localBin"] = os.path.join(self.topobjdir, 'dist/bin')

        if not kwargs["testingModulesDir"]:
            kwargs["testingModulesDir"] = os.path.join(self.topobjdir, '_tests/modules')

        if not kwargs["mozInfo"]:
            kwargs["mozInfo"] = os.path.join(self.topobjdir, 'mozinfo.json')

        if not kwargs["manifest"]:
            kwargs["manifest"] = os.path.join(self.topobjdir, '_tests/xpcshell/xpcshell.ini')

        if not kwargs["symbolsPath"]:
            kwargs["symbolsPath"] = os.path.join(self.distdir, 'crashreporter-symbols')

        if self.substs.get('MOZ_BUILD_APP') == 'b2g':
            kwargs["localAPK"] = None
        elif not kwargs["localAPK"]:
            for root, _, paths in os.walk(os.path.join(kwargs["objdir"], "gradle")):
                for file_name in paths:
                    if (file_name.endswith(".apk") and
                        file_name.startswith("geckoview-withGeckoBinaries")):
                        kwargs["localAPK"] = os.path.join(root, file_name)
                        print("using APK: %s" % kwargs["localAPK"])
                        break
                if kwargs["localAPK"]:
                    break
            else:
                raise Exception("APK not found in objdir. You must specify an APK.")

        if not kwargs["sequential"]:
            kwargs["sequential"] = True

        xpcshell = remotexpcshelltests.XPCShellRemote(kwargs, log)

        result = xpcshell.runTests(kwargs, testClass=remotexpcshelltests.RemoteXPCShellTestThread,
                                   mobileArgs=xpcshell.mobileArgs)

        self.log_manager.disable_unstructured()

        return int(not result)
Exemplo n.º 3
0
    def run_test(
            self,
            test_paths,
            keep_going,
            devicemanager,
            ip,
            port,
            remote_test_root,
            no_setup,
            local_apk,
            test_objects=None,
            # ignore parameters from other platforms' options
            **kwargs):
        # TODO Bug 794506 remove once mach integrates with virtualenv.
        build_path = os.path.join(self.topobjdir, 'build')
        if build_path not in sys.path:
            sys.path.append(build_path)

        import remotexpcshelltests

        dm = self.get_devicemanager(devicemanager, ip, port, remote_test_root)

        options = remotexpcshelltests.RemoteXPCShellOptions()
        options.shuffle = False
        options.sequential = True
        options.interactive = False
        options.debugger = None
        options.debuggerArgs = None
        options.setup = not no_setup
        options.keepGoing = keep_going
        options.objdir = self.topobjdir
        options.localLib = os.path.join(self.topobjdir, 'dist/fennec')
        options.localBin = os.path.join(self.topobjdir, 'dist/bin')
        options.testingModulesDir = os.path.join(self.topobjdir,
                                                 '_tests/modules')
        options.mozInfo = os.path.join(self.topobjdir, 'mozinfo.json')
        options.manifest = os.path.join(
            self.topobjdir, '_tests/xpcshell/xpcshell_android.ini')
        options.symbolsPath = os.path.join(self.distdir,
                                           'crashreporter-symbols')
        if local_apk:
            options.localAPK = local_apk
        else:
            for file in os.listdir(os.path.join(options.objdir, "dist")):
                if file.endswith(".apk") and file.startswith("fennec"):
                    options.localAPK = os.path.join(options.objdir, "dist")
                    options.localAPK = os.path.join(options.localAPK, file)
                    print("using APK: " + options.localAPK)
                    break
            else:
                raise Exception("You must specify an APK")

        if test_paths == ['all']:
            testdirs = []
            options.testPath = None
            options.verbose = False
        elif test_objects:
            if len(test_objects) > 1:
                print('Warning: only the first test will be used.')
            testdirs = test_objects[0]['dir_relpath']
            options.testPath = test_objects[0]['path']
            options.verbose = True
        else:
            if len(test_paths) > 1:
                print(
                    'Warning: only the first test path argument will be used.')
            testdirs = test_paths[0]
            options.testPath = test_paths[0]
            options.verbose = True
        dummy_log = StringIO()
        xpcshell = remotexpcshelltests.XPCShellRemote(dm,
                                                      options,
                                                      args=testdirs,
                                                      log=dummy_log)
        self.log_manager.enable_unstructured()

        xpcshell_filter = TestStartFilter()
        self.log_manager.terminal_handler.addFilter(xpcshell_filter)

        result = xpcshell.runTests(
            xpcshell='xpcshell',
            testClass=remotexpcshelltests.RemoteXPCShellTestThread,
            testdirs=testdirs,
            mobileArgs=xpcshell.mobileArgs,
            **options.__dict__)

        self.log_manager.terminal_handler.removeFilter(xpcshell_filter)
        self.log_manager.disable_unstructured()

        return int(not result)