当前位置: 首页>>代码示例>>Python>>正文


Python ProcessHandler.wait方法代码示例

本文整理汇总了Python中mozprocess.ProcessHandler.wait方法的典型用法代码示例。如果您正苦于以下问题:Python ProcessHandler.wait方法的具体用法?Python ProcessHandler.wait怎么用?Python ProcessHandler.wait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mozprocess.ProcessHandler的用法示例。


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

示例1: setup_avds

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
    def setup_avds(self):
        '''
        If tooltool cache mechanism is enabled, the cached version is used by
        the fetch command. If the manifest includes an "unpack" field, tooltool
        will unpack all compressed archives mentioned in the manifest.
        '''
        c = self.config
        dirs = self.query_abs_dirs()

        # Always start with a clean AVD: AVD includes Android images
        # which can be stateful.
        self.rmtree(dirs['abs_avds_dir'])
        self.mkdir_p(dirs['abs_avds_dir'])
        if 'avd_url' in c:
            # Intended for experimental setups to evaluate an avd prior to
            # tooltool deployment.
            url = c['avd_url']
            self.download_unpack(url, dirs['abs_avds_dir'])
        else:
            url = self._get_repo_url(c["tooltool_manifest_path"])
            self._tooltool_fetch(url, dirs['abs_avds_dir'])

        avd_home_dir = self.abs_dirs['abs_avds_dir']
        if avd_home_dir != "/home/cltbld/.android":
            # Modify the downloaded avds to point to the right directory.
            cmd = [
                'bash', '-c',
                'sed -i "s|/home/cltbld/.android|%s|" %s/test-*.ini' %
                (avd_home_dir, os.path.join(avd_home_dir, 'avd'))
            ]
            proc = ProcessHandler(cmd)
            proc.run()
            proc.wait()
开发者ID:luke-chang,项目名称:gecko-1,代码行数:35,代码来源:android_emulator_unittest.py

示例2: _run_profile

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
    def _run_profile(self):
        command_args = utils.GenerateBrowserCommandLine(
            self.browser_config["browser_path"],
            self.browser_config["extra_args"],
            self.profile_dir,
            self.browser_config["init_url"]
        )

        def browser_log(line):
            logging.debug('BROWSER_OUTPUT: %s', line)

        browser = ProcessHandler(command_args, env=self.env,
                                 processOutputLine=browser_log)
        browser.run()
        try:
            browser.wait()
        except KeyboardInterrupt:
            browser.kill()
            raise

        results_raw = '\n'.join(browser.output)

        if not self.PROFILE_REGEX.search(results_raw):
            logging.info("Could not find %s in browser output",
                         self.PROFILE_REGEX.pattern)
            logging.info("Raw results:%s", results_raw)
            raise TalosError("browser failed to close after being initialized")
开发者ID:kleopatra999,项目名称:system-addons,代码行数:29,代码来源:ffsetup.py

示例3: test_relative_path

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
    def test_relative_path(self):
        tempdir = tempfile.mkdtemp()

        # make a dummy profile
        profile = FirefoxProfile(os.path.join(tempdir, 'testprofilepath'),
                                 restore=False)
        self.assertTrue(os.path.exists(os.path.join(tempdir,
                                                    'testprofilepath',
                                                    'user.js')))

        # make a dummy test
        test = """function test() { };"""
        f = file(os.path.join(tempdir, 'test_dummy.js'), 'w')
        f.write(test)
        f.close()

        # run mozmill on it
        process = ProcessHandler(['mozmill',
                                  '-t', 'test_dummy.js',
                                  '--profile=testprofilepath'],
                                 cwd=tempdir,
                                 # stop mozmill from printing output to console
                                 processOutputLine=[lambda line: None])
        process.run()
        process.wait()

        self.assertNotEqual(process.proc.poll(), None)

        # cleanup
        shutil.rmtree(tempdir)
开发者ID:EricRahm,项目名称:mozmill,代码行数:32,代码来源:test_profile_relative_path.py

示例4: lint

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
def lint(files, config, **kwargs):
    tests_dir = os.path.join(kwargs['root'], 'testing', 'web-platform', 'tests')

    def process_line(line):
        try:
            data = json.loads(line)
        except ValueError:
            return
        data["level"] = "error"
        data["path"] = os.path.relpath(os.path.join(tests_dir, data["path"]), kwargs['root'])
        results.append(result.from_config(config, **data))

    if files == [tests_dir]:
        print >> sys.stderr, ("No specific files specified, running the full wpt lint"
                              " (this is slow)")
        files = ["--all"]
    cmd = [os.path.join(tests_dir, 'wpt'), 'lint', '--json'] + files
    if platform.system() == 'Windows':
        cmd.insert(0, sys.executable)

    proc = ProcessHandler(cmd, env=os.environ, processOutputLine=process_line)
    proc.run()
    try:
        proc.wait()
        if proc.returncode != 0:
            results.append(
                result.from_config(config,
                                   message="Lint process exited with return code %s" %
                                   proc.returncode))
    except KeyboardInterrupt:
        proc.kill()

    return results
开发者ID:luke-chang,项目名称:gecko-1,代码行数:35,代码来源:wpt.py

示例5: run_process

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
def run_process():
    path = os.path.join(tests_dir, "lint")
    proc = ProcessHandler([path, "--json"], env=os.environ,
                          processOutputLine=process_line)
    proc.run()
    try:
        proc.wait()
    except KeyboardInterrupt:
        proc.kill()
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:11,代码来源:wpt.lint.py

示例6: _isLocalZipAvailable

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
 def _isLocalZipAvailable(self):
     def _noOutput(line):
         # suppress output from zip ProcessHandler
         pass
     try:
         proc = ProcessHandler(["zip", "-?"], storeOutput=False, processOutputLine=_noOutput)
         proc.run()
         proc.wait()
     except:
         return False
     return True
开发者ID:kilikkuo,项目名称:gecko-dev,代码行数:13,代码来源:devicemanagerADB.py

示例7: pushDir

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
 def pushDir(self, localDir, remoteDir, retryLimit=None, timeout=None):
     # adb "push" accepts a directory as an argument, but if the directory
     # contains symbolic links, the links are pushed, rather than the linked
     # files; we either zip/unzip or re-copy the directory into a temporary
     # one to get around this limitation
     retryLimit = retryLimit or self.retryLimit
     if self._useZip:
         self.removeDir(remoteDir)
         self.mkDirs(remoteDir + "/x")
         try:
             localZip = tempfile.mktemp() + ".zip"
             remoteZip = remoteDir + "/adbdmtmp.zip"
             proc = ProcessHandler(["zip", "-r", localZip, '.'], cwd=localDir,
                                   processOutputLine=self._log)
             proc.run()
             proc.wait()
             self.pushFile(localZip, remoteZip, retryLimit=retryLimit, createDir=False)
             mozfile.remove(localZip)
             data = self._runCmd(["shell", "unzip", "-o", remoteZip,
                                  "-d", remoteDir]).output[0]
             self._checkCmd(["shell", "rm", remoteZip],
                            retryLimit=retryLimit, timeout=self.short_timeout)
             if re.search("unzip: exiting", data) or re.search("Operation not permitted", data):
                 raise Exception("unzip failed, or permissions error")
         except Exception:
             self._logger.warning(traceback.format_exc())
             self._logger.warning("zip/unzip failure: falling back to normal push")
             self._useZip = False
             self.pushDir(localDir, remoteDir, retryLimit=retryLimit, timeout=timeout)
     else:
         localDir = os.path.normpath(localDir)
         remoteDir = os.path.normpath(remoteDir)
         tempParent = tempfile.mkdtemp()
         remoteName = os.path.basename(remoteDir)
         newLocal = os.path.join(tempParent, remoteName)
         dir_util.copy_tree(localDir, newLocal)
         # See do_sync_push in
         # https://android.googlesource.com/platform/system/core/+/master/adb/file_sync_client.cpp
         # Work around change in behavior in adb 1.0.36 where if
         # the remote destination directory exists, adb push will
         # copy the source directory *into* the destination
         # directory otherwise it will copy the source directory
         # *onto* the destination directory.
         if self._adb_version >= '1.0.36':
             remoteDir = '/'.join(remoteDir.rstrip('/').split('/')[:-1])
         try:
             if self._checkCmd(["push", newLocal, remoteDir],
                               retryLimit=retryLimit, timeout=timeout):
                 raise DMError("failed to push %s (copy of %s) to %s" %
                               (newLocal, localDir, remoteDir))
         except BaseException:
             raise
         finally:
             mozfile.remove(tempParent)
开发者ID:luke-chang,项目名称:gecko-1,代码行数:56,代码来源:devicemanagerADB.py

示例8: _tooltool_fetch

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
    def _tooltool_fetch(self):
        def outputHandler(line):
            self._log_debug(line)

        command = ["python", "tooltool.py", "fetch", "-m", "releng.manifest"]
        proc = ProcessHandler(command, processOutputLine=outputHandler, storeOutput=False, cwd=EMULATOR_HOME_DIR)
        proc.run()
        try:
            proc.wait()
        except:
            if proc.poll() is None:
                proc.kill(signal.SIGTERM)
开发者ID:Jinwoo-Song,项目名称:gecko-dev,代码行数:14,代码来源:android_device.py

示例9: run_process

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
def run_process(cmdargs):
    # flake8 seems to handle SIGINT poorly. Handle it here instead
    # so we can kill the process without a cryptic traceback.
    orig = signal.signal(signal.SIGINT, signal.SIG_IGN)
    proc = ProcessHandler(cmdargs, env=os.environ,
                          processOutputLine=process_line)
    proc.run()
    signal.signal(signal.SIGINT, orig)

    try:
        proc.wait()
    except KeyboardInterrupt:
        proc.kill()
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:15,代码来源:flake8.lint.py

示例10: _tooltool_fetch

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
def _tooltool_fetch():
    def outputHandler(line):
        _log_debug(line)
    command = ['python', 'tooltool.py', 'fetch', '-o', '-m', 'releng.manifest']
    proc = ProcessHandler(
        command, processOutputLine=outputHandler, storeOutput=False,
        cwd=EMULATOR_HOME_DIR)
    proc.run()
    try:
        proc.wait()
    except:
        if proc.poll() is None:
            proc.kill(signal.SIGTERM)
开发者ID:psvramaraju,项目名称:gecko-dev,代码行数:15,代码来源:android_device.py

示例11: _tooltool_fetch

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
def _tooltool_fetch():
    def outputHandler(line):
        _log_debug(line)

    _download_file(TOOLTOOL_URL, "tooltool.py", EMULATOR_HOME_DIR)
    command = [sys.executable, "tooltool.py", "fetch", "-o", "-m", "releng.manifest"]
    proc = ProcessHandler(command, processOutputLine=outputHandler, storeOutput=False, cwd=EMULATOR_HOME_DIR)
    proc.run()
    try:
        proc.wait()
    except:
        if proc.poll() is None:
            proc.kill(signal.SIGTERM)
开发者ID:nwgh,项目名称:gecko-dev,代码行数:15,代码来源:android_device.py

示例12: test_no_option

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
    def test_no_option(self):
        process = ProcessHandler(['mozmill',
                                  '-b', os.environ['BROWSER_PATH'],
                                  '-t', os.path.join(testdir,
                                                     'useMozmill',
                                                     'testServerRoot.js')
                                  ],
                                 # stop mozmill from printing output to console
                                 processOutputLine=[lambda line: None])
        process.run()
        process.wait()

        self.assertEqual(process.proc.poll(), 1,
                         'Test failed')
开发者ID:EricRahm,项目名称:mozmill,代码行数:16,代码来源:test_server-root.py

示例13: test_option

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
    def test_option(self):
        process = ProcessHandler(['mozmill',
                                  '-b', os.environ['BROWSER_PATH'],
                                  '-t', os.path.join(testdir,
                                                     'useMozmill',
                                                     'testServerRoot.js'),
                                  '--server-root', os.path.join(testdir,
                                                                '../../data'),
                                  ],
                                 # stop mozmill from printing output to console
                                 processOutputLine=[lambda line: None])
        process.run()
        process.wait()

        self.assertEqual(process.proc.poll(), 0,
                         'Test was run successful')
开发者ID:EricRahm,项目名称:mozmill,代码行数:18,代码来源:test_server-root.py

示例14: flash

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
 def flash(self):
     command = os.path.join(self.b2g_home, 'flash.sh')
     p = ProcessHandler(command)
     if _is_device_attached():
         p.run()
         return p.wait()
     return 1
开发者ID:nhirata,项目名称:b2g-commands,代码行数:9,代码来源:build_commands.py

示例15: perform_build

# 需要导入模块: from mozprocess import ProcessHandler [as 别名]
# 或者: from mozprocess.ProcessHandler import wait [as 别名]
    def perform_build(self, history_line):
        import pdb
        pdb.set_trace()
        self.build_number += 1
        self.start_time = datetime.now()
        log.debug("Performing build %d on history line: %s" % (self.build_number, history_line))
        build_proc = ProcessHandler(cmd = ['/home/ctalbert/projects/b2g-hamachi/build.sh'],
                                    cwd = self.build_info['workdir'],
                                    env=self.build_info['env'],
                                    processOutputLine=[self.notify_status],
                                    kill_on_timeout=True,
                                    onTimeout=[self.notify_timeout],
                                    onFinish=[self.notify_finished],
                                    shell=True)

        try:
            sys.stdout.write("Starting Build %d:" % self.build_number)
            build_proc.run(timeout=7200)
            build_proc.processOutput()
            exitcode = build_proc.wait()
        except (KeyboardInterrupt, SystemExit):
            print "User Canceled Operation!"
            log.debug("Build canceled by user")
            raise
        finally:
            self.build_log.close()

        if exitcode == 0:
            print "Build %d Completed Successfully" % self.build_number
            log.debug("Build %d for history line: %s completed successfully" % (self.build_number, history_line))
        else:
            print "Build %d Failed" % self.build_number
            log.debug("Build %d for history line: %s FAILED" % (self.build_number, history_line))
开发者ID:ctalbert,项目名称:bisect_b2g,代码行数:35,代码来源:evaluator.py


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