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

Python autoexec.shell_command函数代码示例

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

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



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

示例1: _get_device_ids

def _get_device_ids():
    """get tizen deivce list of ids"""
    result = []
    exit_code, ret = shell_command("sdb start-server")
    exit_code, ret = shell_command("sdb devices")
    for line in ret:
        if str.find(line, "\tdevice") != -1:
            result.append(line.split("\t")[0])
    return result
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:9,代码来源:tizenmobile.py


示例2: get_device_info

    def get_device_info(self):
        """get tizen deivce inforamtion"""
        device_info = {}
        resolution_str = ""
        screen_size_str = ""
        device_model_str = ""
        device_name_str = ""
        build_id_str = ""
        os_version_str = ""

        # get resolution and screen size
        exit_code, ret = shell_command(
            "sdb -s %s shell xrandr" % self.deviceid)
        pattern = re.compile("connected (\d+)x(\d+).* (\d+mm) x (\d+mm)")
        for line in ret:
            match = pattern.search(line)
            if match:
                resolution_str = "%s x %s" % (match.group(1), match.group(2))
                screen_size_str = "%s x %s" % (match.group(3), match.group(4))

        # get architecture
        exit_code, ret = shell_command(
            "sdb -s %s shell uname -m" % self.deviceid)
        if len(ret) > 0:
            device_model_str = ret[0]

        # get hostname
        exit_code, ret = shell_command(
            "sdb -s %s shell uname -n" % self.deviceid)
        if len(ret) > 0:
            device_name_str = ret[0]

        # get os version
        exit_code, ret = shell_command(
            "sdb -s %s shell cat /etc/issue" % self.deviceid)
        for line in ret:
            if len(line) > 1:
                os_version_str = "%s %s" % (os_version_str, line)

        # get build id
        exit_code, ret = shell_command(
            "sdb -s %s shell cat /etc/os-release" % self.deviceid)
        for line in ret:
            if line.find("BUILD_ID=") != -1:
                build_id_str = line.split('=')[1].strip('\"\r\n')

        os_version_str = os_version_str[0:-1]
        device_info["device_id"] = self.deviceid
        device_info["resolution"] = resolution_str
        device_info["screen_size"] = screen_size_str
        device_info["device_model"] = device_model_str
        device_info["device_name"] = device_name_str
        device_info["os_version"] = os_version_str
        device_info["build_id"] = build_id_str
        return device_info
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:55,代码来源:tizenmobile.py


示例3: kill_app

 def kill_app(self, wgt_name):
     if self._wrt:
         cmdline = WRT_STOP_STR % (wgt_name)
         exit_code, ret = shell_command(cmdline)
     elif self._xwalk:
         cmd = APP_QUERY_STR % (wgt_name)
         exit_code, ret = shell_command(cmd)
         for line in ret:
             cmd = APP_KILL_STR % (line.strip('\r\n'))
             exit_code, ret = shell_command(cmd)
     return True
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:11,代码来源:deepin.py


示例4: kill_stub

 def kill_stub(self):
     #add this function to avoid webdriver issue, [email protected],2015.01.15
     wgt_name = "testkit.stub/.TestkitStub"
     pkg_name = wgt_name.split('/')[0]
     cmdline = APP_STOP % (self.deviceid, pkg_name)
     exit_code, ret = shell_command(cmdline)
     cmd = "adb -s %s shell ps aux | grep testkit | grep -v grep| awk '{ print $2}'" 
     ext_code, ret = shell_command(cmd)
     if exit_code ==0 and len(ret) > 0:
         cmd = "adb -s %s shell kill -9 %s" %(self.deviceid, ret[0].strip())
         exit_code,ret = shell_command(cmd)   
开发者ID:JeonghoHan,项目名称:testkit-lite,代码行数:11,代码来源:androidmobile.py


示例5: launch_stub

 def launch_stub(self, stub_app, stub_port="8000", debug_opt=""):
     wgt_name = "testkit.stub/.TestkitStub"
     pkg_name = wgt_name.split('/')[0]
     cmdline = APP_STOP % (self.deviceid, pkg_name)
     exit_code, ret = shell_command(cmdline)
     cmdline = APP_START % (self.deviceid, wgt_name)
     debug_ext = " -e debug on" if debug_opt != "" else " -e debug off"
     port_ext = " -e port " + stub_port
     exit_code, ret = shell_command(cmdline + port_ext + debug_ext)
     time.sleep(2)
     return True
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:11,代码来源:androidmobile.py


示例6: start_debug

 def start_debug(self, dlogfile):
     global debug_flag, metux
     debug_flag = True
     metux = threading.Lock()
     logcat_cmd = LOGCAT_CLEAR % self.deviceid
     exit_code, ret = shell_command(logcat_cmd)
     dmesg_cmd = DMESG_CLEAR % self.deviceid
     exit_code, ret = shell_command(logcat_cmd)
     logcat_cmd = LOGCAT_START % self.deviceid
     dmesg_cmd = DMESG_START % self.deviceid
     threading.Thread(target=debug_trace, args=(logcat_cmd, dlogfile+'.logcat')).start()
     threading.Thread(target=debug_trace, args=(dmesg_cmd, dlogfile+'.dmesg')).start()
开发者ID:JeonghoHan,项目名称:testkit-lite,代码行数:12,代码来源:androidmobile.py


示例7: install_package

 def install_package(self, pkgname):
     """
        install a package on tizenivi device
     """
     cmd = RPM_UNINSTALL % (self.deviceid, pkgname)
     exit_code, ret = shell_command(cmd)
     return ret
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:7,代码来源:tizenivi.py


示例8: kill_stub

 def kill_stub(self):
     #add this function to avoid webdriver issue if stub runnning on device, [email protected]
     cmdline = APP_QUERY_STR % (self.deviceid, "testkit-stub")
     exit_code, ret_lines = shell_command(cmdline)
     if exit_code ==0 and len(ret_lines) > 0:
         cmdline = "kill -9 %s" %ret_lines[0]
         ret_lines = self._ssh.ssh_command(cmdline)
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:7,代码来源:tizenivi.py


示例9: install_package

 def install_package(self, pkgpath):
     """
        install a package on tizenpc device
     """
     cmd = RPM_INSTALL % pkgpath
     exit_code, ret = shell_command(cmd)
     return ret
开发者ID:JeonghoHan,项目名称:testkit-lite,代码行数:7,代码来源:tizenlocal.py


示例10: kill_stub

 def kill_stub(self):
     #add this function to avoid webdriver issue if stub exists running on device,[email protected]
     cmdline = APP_QUERY_STR % (self.deviceid, 'testkit-stub')
     exit_code, ret = shell_command(cmdline)
     if exit_code == 0 and len(ret) >0:
         cmdline = "kill -9 %s" %ret[0]
         exit_code, ret = self.shell_cmd(cmdline)
开发者ID:JeonghoHan,项目名称:testkit-lite,代码行数:7,代码来源:tizenmobile.py


示例11: get_server_url

    def get_server_url(self, remote_port="8000"):
        """forward request a host tcp port to targe tcp port"""
        if remote_port is None:
            return None

        os.environ['no_proxy'] = LOCAL_HOST_NS
        host = LOCAL_HOST_NS
        inner_port = 9000
        time_out = 2
        bflag = False
        while True:
            sock_inner = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock_inner.settimeout(time_out)
            try:
                sock_inner.bind((host, inner_port))
                sock_inner.close()
                bflag = False
            except socket.error as error:
                if error.errno == 98 or error.errno == 13:
                    bflag = True
            if bflag:
                inner_port += 1
            else:
                break
        host_port = str(inner_port)
        cmd = "sdb -s %s forward tcp:%s tcp:%s" % \
            (self.deviceid, host_port, remote_port)
        exit_code, ret = shell_command(cmd)
        url_forward = "http://%s:%s" % (host, host_port)
        return url_forward
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:30,代码来源:tizenmobile.py


示例12: _get_wrt_app

    def _get_wrt_app(self, test_suite, test_set, fuzzy_match, auto_iu):
        test_app_id = None
        if auto_iu:
            test_wgt = test_set
            test_wgt_path = WRT_LOCATION % (test_suite, test_wgt)
            if not self.install_app(test_wgt_path):
                LOGGER.info("[ failed to install widget \"%s\" in target ]"
                            % test_wgt)
                return None
        else:
            test_wgt = test_suite

        # check if widget installed already
        cmd = WRT_QUERY_STR % (self.deviceid, test_wgt)
        exit_code, ret = shell_command(cmd)
        if exit_code == -1:
            return None
        for line in ret:
            items = line.split(':')
            if len(items) < 1:
                continue
            if (fuzzy_match and items[0].find(test_wgt) != -1) or items[0] == test_wgt:
                test_app_id = items[1].strip('\r\n')
                break

        if test_app_id is None:
            LOGGER.info("[ test widget \"%s\" not found in target ]"
                        % test_wgt)
            return None

        return test_app_id
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:31,代码来源:tizenmobile.py


示例13: _get_xwalk_app

    def _get_xwalk_app(self, test_suite, test_set, fuzzy_match, auto_iu):
        test_app_id = None
        if auto_iu:
            test_wgt = test_set
            test_wgt_path = XWALK_LOCATION % (test_suite, test_wgt)
            if not self.install_app(test_wgt_path):
                LOGGER.info("[ failed to install widget \"%s\" in target ]"
                            % test_wgt)
                return None
        else:
            test_wgt = test_suite

        # check if widget installed already
        cmd = XWALK_QUERY_STR % (self.deviceid, test_wgt)
        exit_code, ret = shell_command(cmd)
        if exit_code == -1:
            return None
        for line in ret:
            test_app_id = line.strip('\r\n')

        if test_app_id is None:
            LOGGER.info("[ test widget \"%s\" not found in target ]"
                        % test_wgt)
            return None

        return test_app_id
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:26,代码来源:tizenmobile.py


示例14: install_package

 def install_package(self, pkgpath):
     """
        install a package on tizen device
     """
     cmd = "dpkg -i %s" % pkgpath
     exit_code, ret = shell_command(cmd)
     return ret
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:7,代码来源:deepin.py


示例15: _get_xwalk_app

    def _get_xwalk_app(self, test_suite, test_set, fuzzy_match, auto_iu):
        test_app_id = ""
        if auto_iu:
            test_wgt = test_set
            test_wgt_path = XWALK_LOCATION % (DEEPIN_USER, test_suite, test_wgt)
            if not self.install_app(test_wgt_path):
                LOGGER.info("[ failed to install widget \"%s\" in target ]"
                            % test_wgt)
                return None
        else:
            test_wgt = test_suite

        arr = test_wgt.split('-')
        for item in arr:
            test_app_id += item

        test_wgt = test_app_id 
        # check if widget installed already
        cmd = XWALK_QUERY_STR % (test_wgt)
        exit_code, ret = shell_command(cmd)
       
        if exit_code == -1:
            return None
     #   for line in ret:
     #       test_app_id = line.strip('\r\n')

        if test_app_id is None:
            LOGGER.info("[ test widget \"%s\" not found in target ]"
                        % test_wgt)
            return None

        return test_app_id
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:32,代码来源:deepin.py


示例16: install_package

 def install_package(self, pkgpath):
     """install a package on android device:
     push package and install with shell command
     """
     cmd = APK_INSTALL % (self.deviceid, pkgpath)
     exit_code, ret = shell_command(cmd)
     return ret
开发者ID:JeonghoHan,项目名称:testkit-lite,代码行数:7,代码来源:androidmobile.py


示例17: uninstall_package

 def uninstall_package(self, pkgname):
     """install a package on tizen device:
     push package and install with shell command
     """
     cmd = RPM_UNINSTALL % (self.deviceid, pkgname)
     exit_code, ret = shell_command(cmd)
     return ret
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:7,代码来源:tizenmobile.py


示例18: start_debug

 def start_debug(self, dlogfile):
     global debug_flag, metux
     debug_flag = True
     metux = threading.Lock()
     cmdline = DLOG_CLEAR % self.deviceid
     exit_code, ret = shell_command(cmdline)
     cmdline = DLOG_WRT % self.deviceid
     threading.Thread(target=debug_trace, args=(cmdline, dlogfile+'.dlog')).start()
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:8,代码来源:tizenmobile.py


示例19: install_app

 def install_app(self, wgt_path="", timeout=90):
     if self._wrt:
         cmd = WRT_INSTALL_STR % (self.deviceid, wgt_path)
     elif self._xwalk:
         cmd = XWALK_INSTALL_STR % (self.deviceid, wgt_path)
     else:
         return True
     exit_code, ret = shell_command(cmd, timeout)
     if exit_code == -1:
         cmd = APP_QUERY_STR % (self.deviceid, wgt_path)
         exit_code, ret = shell_command(cmd)
         for line in ret:
             cmd = APP_KILL_STR % (self.deviceid, line.strip('\r\n'))
             exit_code, ret = shell_command(cmd)
         return False
     else:
         return True
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:17,代码来源:tizenmobile.py


示例20: uninstall_app

 def uninstall_app(self, wgt_name):
     if self._wrt:
         cmd = WRT_UNINSTL_STR % (self.deviceid, wgt_name)
     elif self._xwalk:
         cmd = XWALK_UNINSTL_STR % (self.deviceid, TIZEN_USER, self.port, wgt_name)
     else:
         return True
     exit_code, ret = shell_command(cmd)
     return True
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:9,代码来源:tizenivi.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python log.LOGGER类代码示例发布时间:2022-05-27
下一篇:
Python testingtools.set_circular_orbit函数代码示例发布时间: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