• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python base.MachCommandConditions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mozbuild.base.MachCommandConditions的典型用法代码示例。如果您正苦于以下问题:Python MachCommandConditions类的具体用法?Python MachCommandConditions怎么用?Python MachCommandConditions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了MachCommandConditions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, environment):
        if not MachCommandConditions.is_android(environment):
            raise Exception(
                'The Android Eclipse backend is not available with this '
                'configuration.')

        super(AndroidEclipseBackend, self).__init__(environment)
开发者ID:MekliCZ,项目名称:positron,代码行数:7,代码来源:android_eclipse.py


示例2: config_status


#.........这里部分代码省略.........
    if 'CONFIG_FILES' in os.environ:
        raise Exception('Using the CONFIG_FILES environment variable is not '
            'supported.')
    if 'CONFIG_HEADERS' in os.environ:
        raise Exception('Using the CONFIG_HEADERS environment variable is not '
            'supported.')

    if not os.path.isabs(topsrcdir):
        raise Exception('topsrcdir must be defined as an absolute directory: '
            '%s' % topsrcdir)

    default_backends = ['RecursiveMake']
    default_backends = (substs or {}).get('BUILD_BACKENDS', ['RecursiveMake'])

    parser = ArgumentParser()
    parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
                        help='display verbose output')
    parser.add_argument('-n', dest='not_topobjdir', action='store_true',
                        help='do not consider current directory as top object directory')
    parser.add_argument('-d', '--diff', action='store_true',
                        help='print diffs of changed files.')
    parser.add_argument('-b', '--backend', nargs='+', choices=sorted(backends),
                        default=default_backends,
                        help='what backend to build (default: %s).' %
                        ' '.join(default_backends))
    parser.add_argument('--dry-run', action='store_true',
                        help='do everything except writing files out.')
    options = parser.parse_args()

    # Without -n, the current directory is meant to be the top object directory
    if not options.not_topobjdir:
        topobjdir = os.path.abspath('.')

    env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
            non_global_defines=non_global_defines, substs=substs,
            source=source, mozconfig=mozconfig)

    # mozinfo.json only needs written if configure changes and configure always
    # passes this environment variable.
    if 'WRITE_MOZINFO' in os.environ:
        write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)

    cpu_start = time.clock()
    time_start = time.time()

    # Make appropriate backend instances, defaulting to RecursiveMakeBackend,
    # or what is in BUILD_BACKENDS.
    selected_backends = [get_backend_class(b)(env) for b in options.backend]

    if options.dry_run:
        for b in selected_backends:
            b.dry_run = True

    reader = BuildReader(env)
    emitter = TreeMetadataEmitter(env)
    # This won't actually do anything because of the magic of generators.
    definitions = emitter.emit(reader.read_topsrcdir())

    log_level = logging.DEBUG if options.verbose else logging.INFO
    log_manager.add_terminal_logging(level=log_level)
    log_manager.enable_unstructured()

    print('Reticulating splines...', file=sys.stderr)
    if len(selected_backends) > 1:
        definitions = list(definitions)

    for the_backend in selected_backends:
        the_backend.consume(definitions)

    execution_time = 0.0
    for obj in chain((reader, emitter), selected_backends):
        summary = obj.summary()
        print(summary, file=sys.stderr)
        execution_time += summary.execution_time

    cpu_time = time.clock() - cpu_start
    wall_time = time.time() - time_start
    efficiency = cpu_time / wall_time if wall_time else 100
    untracked = wall_time - execution_time

    print(
        'Total wall time: {:.2f}s; CPU time: {:.2f}s; Efficiency: '
        '{:.0%}; Untracked: {:.2f}s'.format(
            wall_time, cpu_time, efficiency, untracked),
        file=sys.stderr
    )

    if options.diff:
        for the_backend in selected_backends:
            for path, diff in sorted(the_backend.file_diffs.items()):
                print('\n'.join(diff))

    # Advertise Visual Studio if appropriate.
    if os.name == 'nt' and 'VisualStudio' not in options.backend:
        print(VISUAL_STUDIO_ADVERTISEMENT)

    # Advertise Eclipse if it is appropriate.
    if MachCommandConditions.is_android(env):
        if 'AndroidEclipse' not in options.backend:
            print(ANDROID_IDE_ADVERTISEMENT)
开发者ID:brendandahl,项目名称:positron,代码行数:101,代码来源:config_status.py


示例3: config_status

def config_status(topobjdir='.', topsrcdir='.',
        defines=[], non_global_defines=[], substs=[], source=None):
    '''Main function, providing config.status functionality.

    Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
    variables.

    Without the -n option, this program acts as config.status and considers
    the current directory as the top object directory, even when config.status
    is in a different directory. It will, however, treat the directory
    containing config.status as the top object directory with the -n option.

    The --recheck option, like with the original config.status, runs configure
    again, with the options given in the "ac_configure_args" subst.

    The options to this function are passed when creating the
    ConfigEnvironment. These lists, as well as the actual wrapper script
    around this function, are meant to be generated by configure.
    See build/autoconf/config.status.m4.
    '''

    if 'CONFIG_FILES' in os.environ:
        raise Exception('Using the CONFIG_FILES environment variable is not '
            'supported.')
    if 'CONFIG_HEADERS' in os.environ:
        raise Exception('Using the CONFIG_HEADERS environment variable is not '
            'supported.')

    if not os.path.isabs(topsrcdir):
        raise Exception('topsrcdir must be defined as an absolute directory: '
            '%s' % topsrcdir)

    default_backends = ['RecursiveMake']
    # We have a chicken/egg problem, where we only have a dict for substs after
    # creating the ConfigEnvironment, which requires argument parsing to have
    # occurred.
    for name, value in substs:
        if name == 'BUILD_BACKENDS':
            default_backends = value
            break

    parser = ArgumentParser()
    parser.add_argument('--recheck', dest='recheck', action='store_true',
                        help='update config.status by reconfiguring in the same conditions')
    parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
                        help='display verbose output')
    parser.add_argument('-n', dest='not_topobjdir', action='store_true',
                        help='do not consider current directory as top object directory')
    parser.add_argument('-d', '--diff', action='store_true',
                        help='print diffs of changed files.')
    parser.add_argument('-b', '--backend', nargs='+',
                        choices=['RecursiveMake', 'AndroidEclipse', 'CppEclipse',
                                 'VisualStudio', 'FasterMake', 'CompileDB'],
                        default=default_backends,
                        help='what backend to build (default: %s).' %
                        ' '.join(default_backends))
    options = parser.parse_args()

    # Without -n, the current directory is meant to be the top object directory
    if not options.not_topobjdir:
        topobjdir = os.path.abspath('.')

    env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
            non_global_defines=non_global_defines, substs=substs, source=source)

    # mozinfo.json only needs written if configure changes and configure always
    # passes this environment variable.
    if 'WRITE_MOZINFO' in os.environ:
        write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)

    # Make an appropriate backend instance, defaulting to RecursiveMakeBackend.
    backends_cls = []
    for backend in options.backend:
        if backend == 'AndroidEclipse':
            from mozbuild.backend.android_eclipse import AndroidEclipseBackend
            if not MachCommandConditions.is_android(env):
                raise Exception('The Android Eclipse backend is not available with this configuration.')
            backends_cls.append(AndroidEclipseBackend)
        elif backend == 'CppEclipse':
            from mozbuild.backend.cpp_eclipse import CppEclipseBackend
            backends_cls.append(CppEclipseBackend)
            if os.name == 'nt':
              raise Exception('Eclipse is not supported on Windows. Consider using Visual Studio instead.')
        elif backend == 'VisualStudio':
            from mozbuild.backend.visualstudio import VisualStudioBackend
            backends_cls.append(VisualStudioBackend)
        elif backend == 'FasterMake':
            from mozbuild.backend.fastermake import FasterMakeBackend
            backends_cls.append(FasterMakeBackend)
        elif backend == 'CompileDB':
            from mozbuild.compilation.database import CompileDBBackend
            backends_cls.append(CompileDBBackend)
        else:
            backends_cls.append(RecursiveMakeBackend)

    cpu_start = time.clock()
    time_start = time.time()

    backends = [cls(env) for cls in backends_cls]

#.........这里部分代码省略.........
开发者ID:kilikkuo,项目名称:gecko-dev,代码行数:101,代码来源:config_status.py


示例4: config_status

def config_status(topobjdir='.', topsrcdir='.',
        defines=[], non_global_defines=[], substs=[], source=None):
    '''Main function, providing config.status functionality.

    Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
    variables.

    Without the -n option, this program acts as config.status and considers
    the current directory as the top object directory, even when config.status
    is in a different directory. It will, however, treat the directory
    containing config.status as the top object directory with the -n option.

    The --recheck option, like with the original config.status, runs configure
    again, with the options given in the "ac_configure_args" subst.

    The options to this function are passed when creating the
    ConfigEnvironment. These lists, as well as the actual wrapper script
    around this function, are meant to be generated by configure.
    See build/autoconf/config.status.m4.
    '''

    if 'CONFIG_FILES' in os.environ:
        raise Exception('Using the CONFIG_FILES environment variable is not '
            'supported.')
    if 'CONFIG_HEADERS' in os.environ:
        raise Exception('Using the CONFIG_HEADERS environment variable is not '
            'supported.')

    if not os.path.isabs(topsrcdir):
        raise Exception('topsrcdir must be defined as an absolute directory: '
            '%s' % topsrcdir)

    parser = OptionParser()
    parser.add_option('--recheck', dest='recheck', action='store_true',
                      help='update config.status by reconfiguring in the same conditions')
    parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
                      help='display verbose output')
    parser.add_option('-n', dest='not_topobjdir', action='store_true',
                      help='do not consider current directory as top object directory')
    parser.add_option('-d', '--diff', action='store_true',
                      help='print diffs of changed files.')
    parser.add_option('-b', '--backend',
                      choices=['RecursiveMake', 'AndroidEclipse', 'CppEclipse', 'VisualStudio'],
                      default='RecursiveMake',
                      help='what backend to build (default: RecursiveMake).')
    options, args = parser.parse_args()

    # Without -n, the current directory is meant to be the top object directory
    if not options.not_topobjdir:
        topobjdir = os.path.abspath('.')

    env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
            non_global_defines=non_global_defines, substs=substs, source=source)

    # mozinfo.json only needs written if configure changes and configure always
    # passes this environment variable.
    if 'WRITE_MOZINFO' in os.environ:
        write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)

    # Make an appropriate backend instance, defaulting to RecursiveMakeBackend.
    backend_cls = RecursiveMakeBackend
    if options.backend == 'AndroidEclipse':
        from mozbuild.backend.android_eclipse import AndroidEclipseBackend
        if not MachCommandConditions.is_android(env):
            raise Exception('The Android Eclipse backend is not available with this configuration.')
        backend_cls = AndroidEclipseBackend
    elif options.backend == 'CppEclipse':
        from mozbuild.backend.cpp_eclipse import CppEclipseBackend
        backend_cls = CppEclipseBackend
        if os.name == 'nt':
          raise Exception('Eclipse is not supported on Windows. Consider using Visual Studio instead.')
    elif options.backend == 'VisualStudio':
        from mozbuild.backend.visualstudio import VisualStudioBackend
        backend_cls = VisualStudioBackend

    the_backend = backend_cls(env)

    reader = BuildReader(env)
    emitter = TreeMetadataEmitter(env)
    # This won't actually do anything because of the magic of generators.
    definitions = emitter.emit(reader.read_topsrcdir())

    if options.recheck:
        # Execute configure from the top object directory
        os.chdir(topobjdir)
        os.execlp('sh', 'sh', '-c', ' '.join([os.path.join(topsrcdir, 'configure'), env.substs['ac_configure_args'], '--no-create', '--no-recursion']))

    log_level = logging.DEBUG if options.verbose else logging.INFO
    log_manager.add_terminal_logging(level=log_level)
    log_manager.enable_unstructured()

    print('Reticulating splines...', file=sys.stderr)
    summary = the_backend.consume(definitions)

    for line in summary.summaries():
        print(line, file=sys.stderr)

    if options.diff:
        for path, diff in sorted(summary.file_diffs.items()):
            print('\n'.join(diff))
#.........这里部分代码省略.........
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:101,代码来源:config_status.py


示例5: run_mochitest_chrome

 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)
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:7,代码来源:mach_commands.py


示例6: run_xpcshell_test

    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
开发者ID:html-shell,项目名称:mozbuild,代码行数:31,代码来源:mach_commands.py


示例7: run_xpcshell_test

    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
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:25,代码来源:mach_commands.py


示例8: get_parser

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()
开发者ID:npark-mozilla,项目名称:gecko-dev,代码行数:8,代码来源:mach_commands.py


示例9: get_parser

def get_parser():
    here = os.path.abspath(os.path.dirname(__file__))
    build_obj = MozbuildObject.from_environment(cwd=here)
    if conditions.is_android(build_obj):
        return reftestcommandline.RemoteArgumentsParser()
    elif conditions.is_mulet(build_obj):
        return reftestcommandline.B2GArgumentParser()
    else:
        return reftestcommandline.DesktopArgumentsParser()
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:9,代码来源:mach_commands.py


示例10: run_mochitest_plain

 def run_mochitest_plain(self, test_paths, **kwargs):
     if is_platform_in('firefox', 'mulet')(self):
         return self.run_mochitest(test_paths, 'plain', **kwargs)
     elif conditions.is_emulator(self):
         return self.run_mochitest_remote(test_paths, **kwargs)
     elif conditions.is_b2g_desktop(self):
         return self.run_mochitest_b2g_desktop(test_paths, **kwargs)
     elif conditions.is_android(self):
         return self.run_mochitest_android(test_paths, **kwargs)
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:9,代码来源:mach_commands.py


示例11: _run_reftest

 def _run_reftest(self, **kwargs):
     process_test_objects(kwargs)
     reftest = self._spawn(ReftestRunner)
     if conditions.is_android(self):
         from mozrunner.devices.android_device import verify_android_device
         verify_android_device(self, install=True, xre=True)
         return reftest.run_android_test(**kwargs)
     elif conditions.is_mulet(self):
         return reftest.run_mulet_test(**kwargs)
     return reftest.run_desktop_test(**kwargs)
开发者ID:kitcambridge,项目名称:gecko-dev,代码行数:10,代码来源:mach_commands.py


示例12: test_info

    def test_info(self, **params):

        import which
        from mozbuild.base import MozbuildObject

        self.branches = params['branches']
        self.start = params['start']
        self.end = params['end']
        self.show_info = params['show_info']
        self.show_results = params['show_results']
        self.show_durations = params['show_durations']
        self.show_bugs = params['show_bugs']
        self.verbose = params['verbose']

        if (not self.show_info and
            not self.show_results and
            not self.show_durations and
                not self.show_bugs):
            # by default, show everything
            self.show_info = True
            self.show_results = True
            self.show_durations = True
            self.show_bugs = True

        here = os.path.abspath(os.path.dirname(__file__))
        build_obj = MozbuildObject.from_environment(cwd=here)

        self._hg = None
        if conditions.is_hg(build_obj):
            if self._is_windows():
                self._hg = which.which('hg.exe')
            else:
                self._hg = which.which('hg')

        self._git = None
        if conditions.is_git(build_obj):
            if self._is_windows():
                self._git = which.which('git.exe')
            else:
                self._git = which.which('git')

        for test_name in params['test_names']:
            print("===== %s =====" % test_name)
            self.test_name = test_name
            if len(self.test_name) < 6:
                print("'%s' is too short for a test name!" % self.test_name)
                continue
            if self.show_info:
                self.set_test_name()
            if self.show_results:
                self.report_test_results()
            if self.show_durations:
                self.report_test_durations()
            if self.show_bugs:
                self.report_bugs()
开发者ID:luke-chang,项目名称:gecko-1,代码行数:55,代码来源:mach_commands.py


示例13: run_xpcshell_test

    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)
        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
开发者ID:lazyparser,项目名称:gecko-dev,代码行数:35,代码来源:mach_commands.py


示例14: emulator

    def emulator(self, version, wait=False, force_update=False, verbose=False):
        from mozrunner.devices.android_device import AndroidEmulator

        emulator = AndroidEmulator(version, verbose, substs=self.substs, device_serial='emulator-5554')
        if emulator.is_running():
            # It is possible to run multiple emulators simultaneously, but:
            #  - if more than one emulator is using the same avd, errors may
            #    occur due to locked resources;
            #  - additional parameters must be specified when running tests,
            #    to select a specific device.
            # To avoid these complications, allow just one emulator at a time.
            self.log(logging.ERROR, "emulator", {},
                     "An Android emulator is already running.\n"
                     "Close the existing emulator and re-run this command.")
            return 1

        if not emulator.is_available():
            self.log(logging.WARN, "emulator", {},
                     "Emulator binary not found.\n"
                     "Install the Android SDK and make sure 'emulator' is in your PATH.")
            return 2

        if not emulator.check_avd(force_update):
            self.log(logging.INFO, "emulator", {},
                     "Fetching and installing AVD. This may take a few minutes...")
            emulator.update_avd(force_update)

        self.log(logging.INFO, "emulator", {},
                 "Starting Android emulator running %s..." %
                 emulator.get_avd_description())
        emulator.start()
        if emulator.wait_for_start():
            self.log(logging.INFO, "emulator", {},
                     "Android emulator is running.")
        else:
            # This is unusual but the emulator may still function.
            self.log(logging.WARN, "emulator", {},
                     "Unable to verify that emulator is running.")

        if conditions.is_android(self):
            self.log(logging.INFO, "emulator", {},
                     "Use 'mach install' to install or update Firefox on your emulator.")
        else:
            self.log(logging.WARN, "emulator", {},
                     "No Firefox for Android build detected.\n"
                     "Switch to a Firefox for Android build context or use 'mach bootstrap'\n"
                     "to setup an Android build environment.")

        if wait:
            self.log(logging.INFO, "emulator", {},
                     "Waiting for Android emulator to close...")
            rc = emulator.wait()
            if rc is not None:
                self.log(logging.INFO, "emulator", {},
                         "Android emulator completed with return code %d." % rc)
            else:
                self.log(logging.WARN, "emulator", {},
                         "Unable to retrieve Android emulator return code.")
        return 0
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:59,代码来源:mach_commands.py


示例15: run_marionette_test

    def run_marionette_test(self, tests, **kwargs):
        if 'test_objects' in kwargs:
            tests = []
            for obj in kwargs['test_objects']:
                tests.append(obj['file_relpath'])
            del kwargs['test_objects']

        if not kwargs.get('binary') and conditions.is_firefox(self):
            kwargs['binary'] = self.get_binary_path('app')
        return run_marionette(tests, topsrcdir=self.topsrcdir, **kwargs)
开发者ID:lazyparser,项目名称:gecko-dev,代码行数:10,代码来源:mach_commands.py


示例16: run_luciddream_test

    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
            )
开发者ID:weinrank,项目名称:gecko-dev,代码行数:55,代码来源:mach_commands.py


示例17: run_marionette_test

    def run_marionette_test(self, tests, **kwargs):
        if 'test_objects' in kwargs:
            tests = []
            for obj in kwargs['test_objects']:
                tests.append(obj['file_relpath'])
            del kwargs['test_objects']

        if conditions.is_firefox(self):
            bin_path = self.get_binary_path('app')
            if kwargs.get('binary') is not None:
                print "Warning: ignoring '--binary' option, using binary at " + bin_path
            kwargs['binary'] = bin_path
        return run_marionette(tests, topsrcdir=self.topsrcdir, **kwargs)
开发者ID:brendandahl,项目名称:positron,代码行数:13,代码来源:mach_commands.py


示例18: __init__

    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)
开发者ID:nafis-sadik,项目名称:gecko-dev,代码行数:39,代码来源:mochitest_options.py


示例19: Exception

    def run_b2g_test(self, b2g_home=None, xre_path=None, **kwargs):
        """Runs a b2g reftest.

        filter is a regular expression (in JS syntax, as could be passed to the
        RegExp constructor) to select which reftests to run from the manifest.

        test_file is a path to a test file. It can be a relative path from the
        top source directory, an absolute filename, or a directory containing
        test files.

        suite is the type of reftest to run. It can be one of ('reftest',
        'crashtest').
        """
        if kwargs["suite"] not in ('reftest', 'crashtest'):
            raise Exception('None or unrecognized reftest suite type.')

        sys.path.insert(0, self.reftest_dir)

        test_subdir = {"reftest": os.path.join('layout', 'reftests'),
                       "crashtest": os.path.join('layout', 'crashtest')}[kwargs["suite"]]

        # Find the manifest file
        if not kwargs["tests"]:
            if not os.path.exists(os.path.join(self.topsrcdir, test_subdir)):
                test_file = mozpath.relpath(os.path.abspath(test_subdir),
                                            self.topsrcdir)
            kwargs["tests"] = [test_subdir]

        tests = os.path.join(self.reftest_dir, 'tests')
        if not os.path.isdir(tests):
            os.symlink(self.topsrcdir, tests)

        for i, path in enumerate(kwargs["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))
            kwargs["tests"][i] = os.path.join('tests', path)

        if conditions.is_b2g_desktop(self):
            return self.run_b2g_desktop(**kwargs)

        return self.run_b2g_remote(b2g_home, xre_path, **kwargs)
开发者ID:carriercomm,项目名称:system-addons,代码行数:43,代码来源:mach_commands.py


示例20: run_awsy_test

    def run_awsy_test(self, tests, **kwargs):
        """mach awsy-test runs the in-tree version of the Are We Slim Yet
        (AWSY) tests.

        awsy-test is implemented as a marionette test and marionette
        test arguments also apply although they are not necessary
        since reasonable defaults will be chosen.

        The AWSY specific arguments can be found in the Command
        Arguments for AWSY section below.

        awsy-test will automatically download the tp5n.zip talos
        pageset from tooltool and install it under
        topobjdir/_tests/awsy/html. You can specify your own page set
        by specifying --web-root and --page-manifest.

        The results of the test will be placed in the results
        directory specified by the --results argument.

        On Windows, you may experience problems due to path length
        errors when extracting the tp5n.zip file containing the
        test pages or when attempting to write checkpoints to the
        results directory. In that case, you should specify both
        the --web-root and --results arguments pointing to a location
        with a short path. For example:

        --web-root=c:\\\\tmp\\\\html --results=c:\\\\tmp\\\\results

        Note that the double backslashes are required.
        """
        kwargs['logger_name'] = 'Awsy Tests'
        if 'test_objects' in kwargs:
            tests = []
            for obj in kwargs['test_objects']:
                tests.append(obj['file_relpath'])
            del kwargs['test_objects']

        if not kwargs.get('binary') and conditions.is_firefox(self):
            kwargs['binary'] = self.get_binary_path('app')
        return self.run_awsy(tests, **kwargs)
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:40,代码来源:mach_commands.py



注:本文中的mozbuild.base.MachCommandConditions类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.MozbuildObject类代码示例发布时间:2022-05-27
下一篇:
Python base.MachCommandBase类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap