Beispiel #1
0
 def install_apk_local_cmd(self):
     url = getvaule(configPath, "config", "apk_url")
     UUID = url.split("/")[-1]
     download_path = os.path.join(getpropath()[0], "res", "apk")
     file_path = os.path.join(download_path, UUID)
     print(self.adb + " -s " + self.device_connect_url + " install -r -g " +
           file_path)
     os.system(self.adb + " -s " + self.device_connect_url +
               " install -r -g " + file_path)
Beispiel #2
0
def main():
    values = sys.argv
    device = values[1]
    action = values[2]
    if action == "install":
        os.system("python3 -u " +
                  os.path.join(project_path, "core", "install_main.py ") +
                  device)
    elif action == "start_per":
        os.system("chmod 777 -R " + os.path.join(getpropath()[0]))
        os.system("python3 -u " +
                  os.path.join(project_path, "core", "PerfServiceMain.py ") +
                  device)
    else:
        print("action failed")
Beispiel #3
0
    def __init__(self, device):

        self.air_adb = ADB()
        self.adb = self.air_adb.adb_path
        self.device = device
        self.device_connect_url = get_device_source_info(
            self.device)["device"]["source"]["remoteConnectAddress"]
        connect_device("Android://127.0.0.1:5037/" + self.device_connect_url)
        self.model = str(shell("getprop ro.product.model")).replace(
            " ", "_").strip("\n").strip("\r")
        self.serialno = str(shell("getprop ro.serialno")).strip("\n")

        self.main_configPath = os.path.join(getpropath()[0], "cfg",
                                            "config.ini")
        self.build_type = getvaule(self.main_configPath, "config",
                                   "build_type")
        self.package = getvaule(self.main_configPath, "active_config",
                                self.build_type)
Beispiel #4
0
    def download_apk_to_local(self):
        url = getvaule(configPath, "config", "apk_url")
        UUID = url.split("/")[-1]
        download_path = os.path.join(getpropath()[0], "res", "apk")
        file_path = os.path.join(download_path, UUID)
        r1 = requests.get(url, stream=True, verify=False)
        total_size = int(r1.headers['Content-Length'])

        # 删除所有本地apk缓存
        os.system("rm -f " + os.path.join(download_path, "*.apk"))

        # 若本地本地文件已下载过,检测大小,未下载则0
        if os.path.exists(file_path):
            temp_size = os.path.getsize(file_path)  # 本地已经下载的文件大小
        else:
            temp_size = 0

        print("已存在文件大小(未存在为0)" + str(temp_size))
        print("下载文件预计大小" + str(total_size))

        # 核心部分,这个是请求下载时,从本地文件已经下载过的后面下载
        headers = {'Range': 'bytes=%d-' % temp_size}
        # 重新请求网址,加入新的请求头的
        r = requests.get(url, stream=True, verify=False, headers=headers)

        # "ab"表示追加形式写入文件
        with open(file_path, "ab") as f:
            for chunk in r.iter_content(chunk_size=1024):
                if chunk:
                    temp_size += len(chunk)
                    f.write(chunk)
                    f.flush()
                    ###这是下载实现进度显示####
                    # done = int(50 * temp_size / total_size)
                    # sys.stdout.write("\r[%s%s] %d%%" % ('█' * done, ' ' * (50 - done), 100 * temp_size / total_size))
                    # sys.stdout.flush()
        print()  # 避免上面\r 回车符
        print("下载完毕!!!")
Beispiel #5
0
from queue import Empty
import PerfDogService_Linux.demo.python.perfdog_pb2_grpc as perfdog_pb2_grpc
import PerfDogService_Linux.demo.python.perfdog_pb2 as perfdog_pb2
from airtest.core.api import *
from airtest.core.android.adb import ADB
from tools.atx_api.atx2_api import get_device_source_info
from tools.sofunny.autoBattlePerf import AutoBattlePerf
from poco.drivers.unity3d import UnityPoco
from tools.sofunny.command import Command
from setup import getpropath
from MyConfigParser import MyConfigParser, getvaule, setvaule

system = platform.system()

if system == "Windows":
    PerfDogService_exe_path = os.path.join(getpropath()[0], "PerfDogService",
                                           "PerfDogService.exe")
else:
    PerfDogService_exe_path = os.path.join(getpropath()[0],
                                           "PerfDogService_Linux",
                                           "PerfDogService")

q = Queue(1)
adb = ADB().adb_path
configPath = os.path.join(getpropath()[0], "cfg", "config.ini")
build_type = getvaule(configPath, "config", "build_type")
package = getvaule(configPath, "active_config", build_type)
report_output_path = os.path.join(getpropath()[1], "perfdog_service_output",
                                  "AutoPerformance_Report_" + str(time.time()))

personal_token = "866cdeec9743460abd3f1d7e2075300eddfeb964d481e387682361754f582b7c"
Beispiel #6
0
#!/bin/bash
# -*- coding: utf-8 -*-
import os
import sys

rootPath = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                        ".."))  # 当前文件所在的目录
sys.path.append(rootPath)
print(rootPath)

import platform

system = platform.system()
from setup import getpropath

project_path = getpropath()[0]


def main():
    values = sys.argv
    device = values[1]
    action = values[2]
    if action == "install":
        os.system("python3 -u " +
                  os.path.join(project_path, "core", "install_main.py ") +
                  device)
    elif action == "start_per":
        os.system("chmod 777 -R " + os.path.join(getpropath()[0]))
        os.system("python3 -u " +
                  os.path.join(project_path, "core", "PerfServiceMain.py ") +
                  device)
Beispiel #7
0
rootPath = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                        ".."))  # 当前文件所在的目录
sys.path.append(rootPath)
print(rootPath)

import platform
import requests
import urllib.parse
from tools.atx_api.atx2_api import get_device_source_info
from MyConfigParser import MyConfigParser, getvaule, setvaule
from airtest.core.api import *
from airtest.core.android.adb import ADB
from setup import getpropath

system = platform.system()
configPath = os.path.join(getpropath()[0], "tools", "apk_install",
                          "config.ini")
res_ui_path = os.path.join(getpropath()[0], "tools", "apk_install", "res_ui")
print(configPath)
print(res_ui_path)


class Install_api(object):
    def __init__(self, device):

        self.air_adb = ADB()
        self.adb = self.air_adb.adb_path
        self.device = device
        self.device_connect_url = get_device_source_info(
            self.device)["device"]["source"]["remoteConnectAddress"]
        connect_device("Android://127.0.0.1:5037/" + self.device_connect_url)
Beispiel #8
0
# -*- coding: utf-8 -*-
import os
import sys

rootPath = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))  # 当前文件所在的目录
sys.path.append(rootPath)
print(rootPath)

from setup import getpropath
from tools.apk_install.install_api import Install_api
from MyConfigParser import MyConfigParser, getvaule, setvaule

config_path = os.path.join(getpropath()[0], "tools", "apk_install", "config.ini")


class Install_apk(object):
    def __init__(self, device):
        self.device = device
        self.install_act = Install_api(self.device)
        self.model = self.install_act.model
        self.phone_install = True if getvaule(config_path, "phone_install", self.model) == "1" else False
        self.command_install = True if getvaule(config_path, "command_install", self.model) == "1" else False
        self.is_need_to_mv_apk = True if getvaule(config_path, "is_need_to_mv_apk", self.model) == "1" else False

    def main(self):
        if self.phone_install:
            if self.command_install:
                try:
                    self.install_act.clear_background_activities()
                    self.install_act.clear_phone_apk()
                    self.install_act.clear_apk_and_uninstall()
Beispiel #9
0
sys.path.append(rootPath)
print(rootPath)

import platform

system = platform.system()

import sys
import tools.atx_api.atx2_api as atx
from multiprocessing import Process, Manager
from docker_core.DockerOperation_Linux import DockerOperation

from MyConfigParser import getvaule, setvaule, MyConfigParser
from setup import getpropath

install_config_path = os.path.join(getpropath()[0], "tools", "apk_install",
                                   "config.ini")
cfg_config_path = os.path.join(getpropath()[0], "cfg", "config.ini")
python3_win_path = os.path.join(getpropath()[0], "venv_windows", "bin",
                                "python3 ")
python3_linux_path = os.path.join(getpropath()[0], "venv_linux", "bin",
                                  "python3 ")


def main():
    values = sys.argv
    apk_url = values[1]
    url_head = "http://soft.f.xmfunny.com:8888/sausage/apk"
    apk_build_type = apk_url.split("_")[0]
    url = ""
    if apk_build_type == "dev":