提交 f9cd29f2 编写于 作者: D deveco_test

fix codecheck bug

Signed-off-by: Ndeveco_test <liguangjie1@huawei.com>
上级 d7902098
......@@ -508,13 +508,13 @@ class Device(IDevice):
def _sync_device_time(self):
# 先同步PC和设备的时间
SHA_TZ = timezone(
sha_tz = timezone(
timedelta(hours=8),
name='Asia/Shanghai',
)
ISOTIMEFORMAT = '%Y-%m-%d %H:%M:%S'
cur_time = datetime.now(tz=timezone.utc).astimezone(SHA_TZ)\
.strftime(ISOTIMEFORMAT)
iso_time_format = '%Y-%m-%d %H:%M:%S'
cur_time = datetime.now(tz=timezone.utc).astimezone(sha_tz)\
.strftime(iso_time_format)
self.execute_shell_command("date '{}'".format(cur_time))
self.execute_shell_command("hwclock --systohc")
......@@ -627,18 +627,15 @@ class Device(IDevice):
raise Exception("harmony rpc not running")
def stop_harmony_rpc(self):
# 先杀掉uitest和devicetest
if self.is_harmony_rpc_running():
self.kill_all_uitest()
self.kill_devicetest_agent()
else:
self.log.debug("stop_harmony_rpc, devicetest rpc is not running.")
# 杀掉uitest和devicetest
self.kill_all_uitest()
self.kill_devicetest_agent()
def is_harmony_rpc_running(self):
cmd = 'ps -ef | grep %s' % DEVICETEST_HAP_PACKAGE_NAME
cmd = 'ps -A | grep %s' % DEVICETEST_HAP_PACKAGE_NAME
rpc_running = self.execute_shell_command(cmd).strip()
self.log.debug('is_rpc_running out:{}'.format(rpc_running))
cmd = 'ps -ef | grep %s' % UITEST_NAME
cmd = 'ps -A | grep %s' % UITEST_NAME
uitest_running = self.execute_shell_command(cmd).strip()
self.log.debug('is_uitest_running out:{}'.format(uitest_running))
if DEVICETEST_HAP_PACKAGE_NAME in rpc_running and UITEST_NAME in uitest_running:
......@@ -646,24 +643,26 @@ class Device(IDevice):
return False
def kill_all_uitest(self):
cmd = 'ps -ef | grep %s' % UITEST_NAME
cmd = 'ps -A | grep %s' % UITEST_NAME
out = self.execute_shell_command(cmd).strip()
self.log.debug('is_rpc_running out:{}'.format(out))
out = out.split("\n")
for str in out:
if "start-daemon" in str:
str = str.split()
cmd = 'kill %s' % str[1]
for data in out:
if UITEST_NAME in data:
data = data.split()
cmd = 'kill %s' % data[1]
self.execute_shell_command(cmd).strip()
return
def kill_devicetest_agent(self):
cmd = 'ps -ef | grep %s' % DEVICETEST_HAP_PACKAGE_NAME
cmd = 'ps -A | grep %s' % DEVICETEST_HAP_PACKAGE_NAME
out = self.execute_shell_command(cmd).strip()
self.log.debug('is_rpc_running out:{}'.format(out))
out = out.split("\n")
for str in out:
if DEVICETEST_HAP_PACKAGE_NAME in str:
str = str.split()
cmd = 'kill %s' % str[1]
for data in out:
if DEVICETEST_HAP_PACKAGE_NAME in data:
data = data.split()
data = 'kill %s' % data[1]
self.execute_shell_command(cmd).strip()
self.log.debug('stop devicetest ability success.')
return
......
......@@ -41,7 +41,6 @@ from xdevice import DeviceError
from xdevice import HdcError
from xdevice import HdcCommandRejectedException
from xdevice import ShellCommandUnresponsiveException
from xdevice import UsbConst
from xdevice import DeviceState
from xdevice import DeviceConnectorType
from xdevice import convert_serial
......@@ -116,9 +115,6 @@ class HdcMonitor:
try:
LOG.debug("HdcMonitor usb type is %s" % self.server.usb_type)
connector_name = "hdc_std" if HdcHelper.is_hdc_std() else "hdc"
# 先停止ADB,因为ADB与HDC有冲突
# if shutil.which(UsbConst.connector) is not None:
# self.stop_hdc(UsbConst.connector)
self.init_hdc(connector_name)
server_thread = threading.Thread(target=self.loop_monitor,
name="HdcMonitor", args=())
......@@ -153,26 +149,6 @@ class HdcMonitor:
"port", port))
time.sleep(1)
@staticmethod
def stop_hdc(connector="hdc"):
"""
Starts the hdc host side server.
"""
if connector.startswith("hdc"):
if is_proc_running(connector):
try:
LOG.debug("HdcMonitor %s kill" % connector)
exec_cmd([connector, "kill"])
except ParamError as error:
LOG.debug("HdcMonitor hdc kill error:%s" % error)
except FileNotFoundError as _:
LOG.warning('Cannot kill hdc process, '
'please close it manually!')
else:
if is_proc_running(UsbConst.connector):
LOG.debug("HdcMonitor %s" % UsbConst.kill_server)
exec_cmd([UsbConst.connector, "kill-server"])
def stop(self):
"""
Stops the monitoring.
......@@ -329,7 +305,6 @@ class HdcMonitor:
if kill:
LOG.debug("HdcMonitor hdc kill")
exec_cmd([connector, "kill"])
# self.stop_hdc(UsbConst.connector)
LOG.debug("HdcMonitor hdc start")
exec_cmd(
[connector, "start"],
......@@ -567,13 +542,8 @@ class SyncService:
"""
mode = self.read_mode(remote)
self.device.log.debug("Remote file %s mode is %d" % (remote, mode))
if self.device.usb_type == DeviceConnectorType.hdc:
self.device.log.debug("%s execute command: hdc push %s %s" % (
convert_serial(self.device.device_sn), local, remote))
else:
self.device.log.debug("%s execute command: %s %s %s" % (
convert_serial(self.device.device_sn), UsbConst.push, local,
remote))
self.device.log.debug("%s execute command: hdc push %s %s" % (
convert_serial(self.device.device_sn), local, remote))
if str(mode).startswith("168"):
remote = "%s/%s" % (remote, os.path.basename(local))
......
......@@ -61,8 +61,6 @@ def check_open_source_test(result_output):
def check_read_test_end(result=None, input_command=None):
temp_result = result.replace("\n", "")
# if input_command not in temp_result:
# return False
index = result.find(input_command) + len(input_command)
result_output = result[index:]
if input_command.startswith("./"):
......@@ -188,14 +186,6 @@ class LiteHelper:
result = ""
status = True
from xdevice import Scheduler
# while time.time() - start_time < timeout:
# data = com.readline().decode('gbk', errors='ignore')
# data = PATTERN.sub('', data).replace("\r", "")
# result = "{}{}".format(result, data)
# if command in result or linux_end_command in result:
# break
while time.time() - start_time < timeout:
if not Scheduler.is_execute:
raise ExecuteTerminate("Execute terminate", error_no="00300")
......
......@@ -27,7 +27,6 @@ from xdevice import platform_logger
from xdevice import ParamError
from xdevice import ConfigConst
from xdevice import HdcCommandRejectedException
from xdevice import UsbConst
from xdevice import DeviceEvent
from xdevice import TestDeviceState
from xdevice import DeviceState
......@@ -94,7 +93,7 @@ class ManagerDevice(IDeviceManager):
device.get("usb_type"), error))
self.device_connector = DeviceConnector(
device.get("ip"), device.get("port"),
UsbConst.connector_type)
"usb-hdc")
self.device_connector.add_device_change_listener(
self.managed_device_listener)
self.device_connector.start()
......
......@@ -41,8 +41,6 @@ from xdevice import ConfigConst
from xdevice import DeviceTestType
from xdevice import FilePermission
from xdevice import AppInstallError
from xdevice import UsbConst
from xdevice import AppConst
from xdevice import DeviceConnectorType
from xdevice import convert_serial
from xdevice import check_path_legal
......@@ -325,183 +323,6 @@ class PushKit(ITestKit):
self.pushed_file.append(dst)
@Plugin(type=Plugin.TEST_KIT, id=CKit.install)
class ApkInstallKit(ITestKit):
def __init__(self):
self.app_list = ""
self.app_list_name = ""
self.is_clean = ""
self.alt_dir = ""
self.ex_args = ""
self.installed_app = set()
self.paths = ""
self.is_pri_app = ""
self.pushed_hap_file = set()
self.env_index_list = None
def __check_config__(self, options):
self.app_list = get_config_value('test-file-name', options)
self.app_list_name = get_config_value('test-file-packName', options)
self.is_clean = get_config_value('cleanup-apks', options, False)
self.alt_dir = get_config_value('alt-dir', options, False)
if self.alt_dir and self.alt_dir.startswith("resource/"):
self.alt_dir = self.alt_dir[len("resource/"):]
self.ex_args = get_config_value('install-arg', options)
self.installed_app = set()
self.paths = get_config_value('paths', options)
self.is_pri_app = get_config_value('install-as-privapp', options,
False, default=False)
self.env_index_list = get_config_value('env-index', options)
def __setup__(self, device, **kwargs):
del kwargs
LOG.debug("ApkInstallKit setup, device:{}".format(device.device_sn))
if len(self.app_list) == 0:
LOG.info("No app to install, skipping!")
return
# to disable app install alert
device.execute_shell_command("setprop persist.sys.platformautotest 1")
for app in self.app_list:
if self.alt_dir:
app_file = get_file_absolute_path(app, self.paths,
self.alt_dir)
else:
app_file = get_file_absolute_path(app, self.paths)
if app_file is None:
LOG.error("The app file {} does not exist".format(app))
continue
if app_file.endswith(".hap"):
self.install_hap(device, app_file)
else:
result = device.install_package(
app_file, get_install_args(
device, app_file, self.ex_args))
if not result.startswith("Success") or "successfully" not in result:
raise AppInstallError(
"Failed to install %s on %s. Reason:%s" %
(app_file, device.__get_serial__(), result))
self.installed_app.add(app_file)
def __teardown__(self, device):
LOG.debug("ApkInstallKit teardown: device:{}".format(device.device_sn))
if self.is_clean and str(self.is_clean).lower() == "true":
if self.app_list_name and len(self.app_list_name) > 0:
for app_name in self.app_list_name:
result = device.uninstall_package(app_name)
if result and (result.startswith("Success") or "successfully" in result):
LOG.debug("uninstalling package Success. result is %s" %
result)
else:
LOG.warning("Error uninstalling package %s %s" %
(device.__get_serial__(), result))
else:
for app in self.installed_app:
if app.endswith(".hap"):
app_name = get_app_name(app)
else:
app_name = get_app_name_by_tool(app, self.paths)
if app_name:
result = device.uninstall_package(app_name)
if result and (result.startswith("Success") or "successfully" in result):
LOG.debug("uninstalling package Success. result is %s" %
result)
else:
LOG.warning("Error uninstalling package %s %s" %
(device.__get_serial__(), result))
else:
LOG.warning("Can't find app name for %s" % app)
if self.is_pri_app:
remount(device)
for pushed_file in self.pushed_hap_file:
device.execute_shell_command("rm -r %s" % pushed_file)
def install_hap(self, device, hap_file):
if self.is_pri_app:
LOG.info("Install hap as privileged app {}".format(hap_file))
hap_name = os.path.basename(hap_file).replace(".hap", "")
try:
with TemporaryDirectory(prefix=hap_name) as temp_dir:
zif_file = zipfile.ZipFile(hap_file)
zif_file.extractall(path=temp_dir)
entry_app = os.path.join(temp_dir, AppConst.entry_app)
push_dest_dir = os.path.join("/system/priv-app/", hap_name)
device.execute_shell_command("rm -rf " + push_dest_dir,
output_flag=False)
device.push_file(entry_app, os.path.join(
push_dest_dir + os.path.basename(entry_app)))
device.push_file(hap_file, os.path.join(
push_dest_dir + os.path.basename(hap_file)))
self.pushed_hap_file.add(os.path.join(
push_dest_dir + os.path.basename(hap_file)))
device.reboot()
except RuntimeError as exception:
msg = "Install hap app failed withe error {}".format(exception)
LOG.error(msg)
raise Exception(msg)
except Exception as exception:
msg = "Install hap app failed withe exception {}".format(
exception)
LOG.error(msg)
raise Exception(msg)
finally:
zif_file.close()
else:
push_dest = "/%s" % "sdcard"
push_dest = "%s/%s" % (push_dest, os.path.basename(hap_file))
device.push_file(hap_file, push_dest)
self.pushed_hap_file.add(push_dest)
output = device.execute_shell_command("bm install -p " + push_dest)
if not output.startswith("Success"):
output = output.strip()
if "[ERROR_GET_BUNDLE_INSTALLER_FAILED]" not in output.upper():
raise AppInstallError(
"Failed to install %s on %s. Reason:%s" %
(push_dest, device.__get_serial__(), output))
else:
LOG.info("'[ERROR_GET_BUNDLE_INSTALLER_FAILED]' occurs, "
"retry install hap")
exec_out = self.retry_install_hap(
device, "bm install -p " + push_dest)
if not exec_out.startswith("Success"):
raise AppInstallError(
"Retry failed,Can't install %s on %s. Reason:%s" %
(push_dest, device.__get_serial__(), exec_out))
else:
LOG.debug("Install %s success" % push_dest)
@classmethod
def retry_install_hap(cls, device, command):
if device.usb_type == DeviceConnectorType.hdc:
if hasattr(device, "is_harmony") and device.is_harmony:
real_command = ["hdc_std", "-t", str(device.device_sn), "-s",
"tcp:%s:%s" % (str(device.host), str(device.port)),
"shell", command]
else:
# hdc -t UID -s tcp:IP:PORT
real_command = ["hdc", "-t", str(device.device_sn), "-s",
"tcp:%s:%s" % (str(device.host), str(device.port)),
"shell", command]
else:
real_command = [UsbConst.connector, "-s", str(device.device_sn),
"-H", str(device.host), "-P", str(device.port),
"shell", command]
message = "%s execute command: %s" % \
(convert_serial(device.device_sn), " ".join(real_command))
LOG.info(message)
exec_out = ""
for wait_count in range(1, MAX_WAIT_COUNT):
LOG.debug("Retry times:%s, wait %ss" %
(wait_count, (wait_count * 10)))
time.sleep(wait_count * 10)
exec_out = exec_cmd(real_command)
if exec_out and exec_out.startswith("Success"):
break
if not exec_out:
exec_out = "System is not in %s" % ["Windows", "Linux", "Darwin"]
LOG.info("Retry install hap result is: [%s]" % exec_out.strip())
return exec_out
@Plugin(type=Plugin.TEST_KIT, id=CKit.propertycheck)
class PropertyCheckKit(ITestKit):
def __init__(self):
......@@ -577,8 +398,8 @@ class ShellKit(ITestKit):
@Plugin(type=Plugin.TEST_KIT, id=CKit.wifi)
class WifiKit(ITestKit):
def __init__(self):
self.certfilename =""
self.certpassword= ""
self.certfilename = ""
self.certpassword = ""
self.wifiname = ""
self.paths = ""
......@@ -665,7 +486,7 @@ class Props:
@dataclass
class Paths:
system_build_prop_path = "/%s/%s" % ("system", "build.prop")
service_wifi_app_path = "tools/wifi/%s" % AppConst.wifi_app
service_wifi_app_path = "tools/wifi/%s" % "Service-wifi.app"
dest_root = "/%s/%s/" % ("data", "data")
mnt_external_storage = "EXTERNAL_STORAGE"
......@@ -817,8 +638,12 @@ class ConfigKit(ITestKit):
temp_cust_file = NamedTemporaryFile(prefix='cust', suffix='.prop',
delete=False).name
self.local_cust_prop_file[cust_file] = temp_cust_file
prop_changed = modify_props(device, temp_cust_file, cust_file,
new_props[name]) or prop_changed
try:
prop_changed = modify_props(device, temp_cust_file, cust_file,
new_props[name]) or prop_changed
except KeyError:
LOG.error("Get props error.")
continue
return prop_changed
......@@ -868,7 +693,6 @@ class AppInstallKit(ITestKit):
LOG.error("The app file {} does not exist".format(app))
continue
if app_file.endswith(".hap"):
# OpenHarmony device
if hasattr(device, "is_harmony") and device.is_harmony:
device.connector_command("install {}".format(app_file))
else:
......@@ -925,7 +749,7 @@ class AppInstallKit(ITestKit):
with TemporaryDirectory(prefix=hap_name) as temp_dir:
zif_file = zipfile.ZipFile(hap_file)
zif_file.extractall(path=temp_dir)
entry_app = os.path.join(temp_dir, AppConst.entry_app)
entry_app = os.path.join(temp_dir, "Entry.app")
push_dest_dir = os.path.join("/system/priv-app/", hap_name)
device.execute_shell_command("rm -rf " + push_dest_dir,
output_flag=False)
......@@ -973,19 +797,14 @@ class AppInstallKit(ITestKit):
@classmethod
def retry_install_hap(cls, device, command):
if device.usb_type == DeviceConnectorType.hdc:
if hasattr(device, "is_harmony") and device.is_harmony:
real_command = ["hdc_std", "-t", str(device.device_sn), "-s",
"tcp:%s:%s" % (str(device.host), str(device.port)),
"shell", command]
else:
# hdc -t UID -s tcp:IP:PORT
real_command = ["hdc", "-t", str(device.device_sn), "-s",
"tcp:%s:%s" % (str(device.host), str(device.port)),
"shell", command]
if hasattr(device, "is_harmony") and device.is_harmony:
real_command = ["hdc_std", "-t", str(device.device_sn), "-s",
"tcp:%s:%s" % (str(device.host), str(device.port)),
"shell", command]
else:
real_command = [UsbConst.connector, "-s", str(device.device_sn),
"-H", str(device.host), "-P", str(device.port),
# hdc -t UID -s tcp:IP:PORT
real_command = ["hdc", "-t", str(device.device_sn), "-s",
"tcp:%s:%s" % (str(device.host), str(device.port)),
"shell", command]
message = "%s execute command: %s" % \
(convert_serial(device.device_sn), " ".join(real_command))
......
#!/usr/bin/env sh
# Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved.
#!/bin/bash
#
# Copyright (C) 2020-2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -e
error()
{
......@@ -44,3 +59,4 @@ do
done
$PYTHON -m xdevice "$@"
exit 0
......@@ -34,9 +34,7 @@ def main():
'xdevice._core.environment',
'xdevice._core.executor',
'xdevice._core.report',
'xdevice._core.testkit',
'xdevice.adapter',
'xdevice.adapter.xdevice_adapter',
'xdevice._core.testkit'
],
package_data={
'xdevice._core': [
......
......@@ -18,7 +18,6 @@
import pkg_resources
from .variables import Variables
from _core.plugin import Plugin
from _core.plugin import get_plugin
from _core.logger import platform_logger
......@@ -115,9 +114,8 @@ from _core.report.result_reporter import ResultReporter
from _core.report.reporter_helper import DataHelper
from _core.report.__main__ import main_report
from _core.command.console import Console
from adapter.xdevice_adapter.constants import UsbConst
from adapter.xdevice_adapter.constants import AppConst
from adapter.xdevice_adapter.constants import AppConst
from .variables import Variables
__all__ = [
"Variables",
"Console",
......@@ -213,9 +211,7 @@ __all__ = [
"ExecInfo",
"ResultReporter",
"DataHelper",
"main_report",
"UsbConst",
"AppConst"
"main_report"
]
......
......@@ -17,12 +17,14 @@
#
import os
import sys
srcpath = os.path.dirname(os.path.dirname(__file__))
sys.path.append(srcpath)
from xdevice import Console
from xdevice import platform_logger
from _core.utils import get_version
srcpath = os.path.dirname(os.path.dirname(__file__))
sys.path.append(srcpath)
LOG = platform_logger("Main")
......
......@@ -23,7 +23,6 @@ from dataclasses import dataclass
from _core.exception import ParamError
from _core.logger import platform_logger
from _core.utils import get_local_ip
from adapter.xdevice_adapter.constants import UsbConst
__all__ = ["UserConfigManager"]
LOG = platform_logger("ConfigManager")
......@@ -193,8 +192,7 @@ class UserConfigManager(object):
def get_device(self, target_name):
for node in self.config_content.findall(target_name):
data_dic = {}
if node.attrib["type"] != "usb-hdc" and \
node.attrib["type"] != UsbConst.connector_type:
if node.attrib["type"] != "usb-hdc":
continue
data_dic["usb_type"] = node.attrib["type"]
for sub in node:
......
......@@ -287,4 +287,3 @@ class FilePermission(object):
@dataclass
class DeviceConnectorType:
hdc = "usb-hdc"
adb = "usb-adb"
......@@ -166,7 +166,8 @@ class EnvironmentManager(object):
if not support_labels:
continue
if device_option.label is None:
if manager_type != "ManagerDevice" and manager_type != "ManagerAospDevice":
if manager_type != "ManagerDevice" and \
manager_type != "ManagerAospDevice":
continue
else:
if support_labels and \
......@@ -205,7 +206,8 @@ class EnvironmentManager(object):
if device_option.required_manager not in support_types:
continue
if device_option.label is None:
if manager_type != "ManagerDevice":
if manager_type != "ManagerDevice" and \
manager_type != "ManagerAospDevice":
continue
else:
if support_labels and \
......
......@@ -613,7 +613,6 @@ class Scheduler(object):
SuiteReporter.append_report_result(
(virtual_report_path, report_result))
else:
import shutil
history_execute_result = report_data_dict.get(module_name, "")
LOG.info("Start copy %s" % history_execute_result)
file_name = get_filename_extension(history_execute_result)[0]
......
......@@ -32,7 +32,6 @@ from _core.logger import platform_logger
from _core.utils import get_filename_extension
from _core.utils import is_config_str
from _core.utils import unique_id
from adapter.xdevice_adapter.constants import AppConst
__all__ = ["TestSetSource", "TestSource", "find_test_descriptors",
"find_testdict_descriptors", "TestDictSource"]
......@@ -43,14 +42,14 @@ TestSource = namedtuple('TestSource', 'source_file source_string config_file '
TEST_TYPE_DICT = {"DEX": DeviceTestType.dex_test,
"HAP": DeviceTestType.hap_test,
AppConst.app_name: DeviceTestType.hap_test,
"APK": DeviceTestType.hap_test,
"PYT": HostDrivenTestType.device_test,
"JST": DeviceTestType.jsunit_test,
"CXX": DeviceTestType.cpp_test,
"BIN": DeviceTestType.lite_cpp_test}
EXT_TYPE_DICT = {".dex": DeviceTestType.dex_test,
".hap": DeviceTestType.hap_test,
AppConst.app_ext: DeviceTestType.hap_test,
".apk": DeviceTestType.hap_test,
".py": HostDrivenTestType.device_test,
".js": DeviceTestType.jsunit_test,
".bin": DeviceTestType.lite_cpp_test,
......@@ -452,7 +451,7 @@ def _get_test_type(config_file, test_driver, ext):
if ext in [".py", ".js", ".dex", ".hap", ".bin"] \
and ext in TestDictSource.exe_type.keys():
test_type = TestDictSource.exe_type[ext]
elif ext in [AppConst.app_ext] and ext in TestDictSource.exe_type.keys():
elif ext in [".apk"] and ext in TestDictSource.exe_type.keys():
test_type = DeviceTestType.hap_test
else:
test_type = DeviceTestType.cpp_test
......
xDevice-v2.8.0.1074
1.fix bug
xDevice-v2.7.0.1072
1.fix bug
xDevice-v2.6.0.1064
1.修复gitee上XTS测试套执行异常的bug
xDevice-v2.5.0.1062
1.优化调整xdevice目录
xDevice-v2.3.0.3045
1.修改判断是否是OpenHarmony的系统的方式
2.修改DeviceTest Driver的hilog日志抓取方式,改用hilog任务落盘机制
xDevice-v2.2.0.3044
1.增加适配OpenHarmony下fport获取端口
xDeviceTest-v2.1.0.3041
1.融合版本基础版本,增加适配OpenHarmony
2.DeviceTest driver增加抓hilog日志
3.user.config文件中增加配置日志开关
xDeviceTest-v2.0.2.1211
1.handle the issue that garbled words occurs when execute command by hdc_std
2.extended the timeout of socket to read and write
3.support dynamically change elements to specify a driver
4.support specify the sn of device in retry command
5.support white space characters in session parameter
6.change the command in the testsuite runner of DexJunitDriver
7.change the execution process of JSUnitTestDriver
8.handle the uninstall error when testsuite add the package name repeatedly
9.support the exemption list in JunitTestDriver,DexJunitTestDriver,CppTestDriver
10.support the test of pyd file that contains no json file by DeviceTest in factory mode
xDeviceTest-v2.0.1.1131
1.support new protocol of hdc
2.support third-party device's product label
3.support new package name in JUnitTestDriver
4.add agent proxy to communicate with factory server
5.restrict the execution of the test case when the number of device mounting
failures reaches three
6.configure the IP address after the device is restarted
xDeviceTest-v2.0.1.1041
1.support getting default devices when device's label value that in suite json is empty
2.change the commands and logic in TestBundleKit
3.if the use case execution detects the Execute: I/O error message, ping nfs
4.support DeployToolKit driver
5.support check bin exist before run
6.support umount fail,try again
7.run the next test case when the message "Test Stop, not mount properly" is displayed.
xDeviceTest-v1.1.0.1131
1.handle the issue that wifi kit can't find wifi app in the resource path
which was assigned by user
2.the mounting failure is rectified, and the retry mechanism is added.
xDeviceTest-v1.1.0.1121
1.handle the issue that testcase's status what was marked as not run shows in report.
2.handle the issue that error of get local ip occurs when local environment's network
settings is incorrect.
3.fix BuildOnlyTestLite filepath
xDeviceTest-v1.1.0.1111
1.fix the issue that due to print error, task is interrupted when device reboot
2.remove versionId check in the version verification about lightweight device
xDeviceTest-v1.1.0.1101
1.fix the issue that the number can't be show when collect tests' count
2.fix report statistics ignore cases
xDeviceTest-v1.1.0.1091
1.handle the issue that not json file exists when the task is executing in factory
2.fix the issue that runner can't be found in AndroidJunitTest
3.parse all logfile in the log_path directory when the driver type is BuildOnlyTestLite
4.handle the issue that empty test occurs in JunitTest when run all test cases
in specific task mode
xDeviceTest-v1.1.0.1051
1.fix the issue that during system startup, device monitor keeps waiting since
one device closed response after it was pulled out
2.replace all what relate to ApkInstallKit in the testcases directory
3.add the new format of log level settings
4.modify "LiteApkInstallKit" to "LiteAppInstallKit" and
"cleanup-apks" to "cleanup-apps"
5.change baund_rate in the user_config.xml file to baud_rate.
xDeviceTest-v1.1.0.1041
1.delete the hap files that were pushed to device
2.add hilog command to catch log in the device whose version is Harmony branch
3.fix the issue that device's recover state is invalid when reconnect
4.fix failed to copy the bin file to the NFS directory
xDeviceTest-v1.1.0.1032
1.add the spt check in the version verification about lightweight device
2.fix the issue that the hap file cannot install when specific error occurs
3.fix run ssts device offline execution takes a long time
4.fix the issue that local device can't be find if use local ip
xDeviceTest-v1.1.0.1021
1.add the repeat parameter
2.supports the Linux kernel
3.add pause to run.bat
4.generate report zip file in factory mode
xDeviceTest-v1.1.0.1011
1.add AppInstallKit
2.fix L0 multiple testsuites fail testcase parse issue
xDeviceTest-v1.0.3.1131
1.add more display of help
2.reset junit parameters in AndroidJunitTestDriver and JunitTestDriver
xDeviceTest-v1.0.3.1121:
1.check device name in kit config
2.process the blocked state when a case is executed in AndroidJunitTestDriver,
CppTestDriver,JUnitTestDriver,DexJunitDriver
3.handle the ConnectionResetError what occurs in DexJunitDriver when it execute
shell command
4.adapt the command about check package in JUnitTestDriver
xDeviceTest-v1.0.3.1111:
1.add the execute permission for the aapt tool in linux
2.upload log path to factory when module result is unavailable
3.support to run phone script through DeviceTest driver
xDeviceTest-v1.0.3.1104:
1.add include-tests in JunitTest and AndroidJunitTest
2.upload case result with log path
xDeviceTest-v1.0.3.1092:
1.add parameter -c(--config) to specify config file path
2.support abort-on-push-failure item in PushKit
3.modify supported rsa key format to pkcs8
4.fix adb reboot error issue under connect situation
xDeviceTest-v1.0.3.1082:
1.support encryption and decryption of framework logs
2.support public key string
3.add uninstall .hap in JSUnitTestLite driver
4.add device lite recover function
5.modify device lite label watchGT
6.support custom username/password/certification configuration of wifi kit.
xDeviceTest-v1.0.3.1071:
1.add testBundleKit
2.change DeviceError and retry pass log output
3.support checking hdc in process environment.
4.adapt bm and aa execution path for JSUnitParserLite
5.modify device recover for device disconnection
6.handle the scene that module not need to retry
xDeviceTest-v1.0.3.1061:
1.implement retry function in decc mode.
2.fix testsuit runtime is 0 in OpenSourceTest
3.add check_device parameter for run action commond
4.modify CppTestDriver to execute Android GTest testsuites.
5.adapt for the xdevice-devicetest modification
xDeviceTest-v1.0.3.1052:
1.add usb-type attribute to Device class
2.modify parameters display order, change --pass_through to --passthrough(-pt)
3.delete Log Path in vision reports
4.fix testsuit runtime is 0 in AndroidJUnitTest and JUnitTest and DexJUnit
5.modify CppTestLiteDriver result message when the xml is empty
xDeviceTest-v1.0.3.1041:
1.fix the issue that the log level cannot be restored after being dynamically modified.
2.support set device name in json config file
3.config kit for the specific device through device_name field
(JUnitTest and AndroidJUnitTest supported by now)
4.modify CppTestLiteDriver code when setting encryption
5.add CTestLiteDriver suites end sign
6.add reboot-per-module for run
xDeviceTest-v1.0.3.1032:
1.modify xml result format
2.support run -l xxx -tc xxx for DeviceTestDriver
3.modify device retry behaviour when execute dex driver
4.remove hdc temporily.
5.add check xml exist function for CppTestDriver
6.allocate device in sn order
7.modify user_config processing for phone
xDeviceTest-v1.0.3.1022:
1.add new state unusable for L0 device
2.adapt retry function for L1 CppTest
3.add hdc support for both Windows and Linux
4.use [] to split log segment, add ErrorNo for error log
5.add data reports into task_info.record file
6.change failures_report.html table style to top alignment
7.modify exclude-annotation and include-annotation parameter
xDeviceTest-v1.0.2.1141:
1.support -tc parameter to execute python script
2.add the setting of log level in user config
3.fix ignored case counting issue for JUnit and AndroidJUnit
4.add JSUnitTestLite driver
5.modify L1 execution log output real time
xDeviceTest-v1.0.2.1132:
1.add a dry run command for list retry cases
2.add specific file to record the information about unsuccessful cases
3.add LiteShellKit and reset function for DeviceLite
4.delete support_device for user_config.xml
5.change details report Test title to Testcase
6.show -t(--testtype) value to vision report
7.support DexJunitDriver
8.add a session param for retry command to retry specific session task
xDeviceTest-v1.0.2.1123:
1.add test case error information for OpenSourceTest driver
2.modify get test cases function by parsing XML for CppTest driver
3.add run parameter for AndroidJUnitTest
4.Socket buffer size was adjusted in order to reduce echo time.
xDeviceTest-v1.0.2.1112:
1.upload results of remaining modules to decc when the current task is terminated.
2.upload results of device error modules to decc
3.add QueryKit and get L1 device information
4.add version for L1 and L0 device
5.fix AndroidGTestDriver testcases counting issue.
6.add IGNORE status code in AndroidJUnitTest and JUnitTest
7.JunitParser's counting issue was fixed.
xDeviceTest-v1.0.2.1101:
1.change egg file to tar.gz file
2.upload empty result report to decc when error occurs under decc mode
3.adapt JUnit driver test case modification
4.add BuildOnlyTestLite driver
5.output error log when adb not exists
6.fix rerun and xml-output params
xDeviceTest-v1.0.2.1091:
1.divide phone device related code and package it to xdevice-extension.egg
2.support to execute phone related driver by installing xdevice-extension.egg
3.move _core directory to xdevice directory
4.fix lite device list not clear issue
5.modify device_test driver to support execute and module name parameter
6.add L1 and L0 execution log information
xDeviceTest-v1.0.2.1081:
1.keep command execution when aapt not exists
2.adapt retry command under decc mode
3.modify LogListener to display device and progress
4.modify user_config.xml and test case xxx.json file to adapt new mount kit
xDeviceTest-v1.0.2.1072:
1.modify config file extension from .config to .json
2.add RootFsKit for ipcamera
3.support rsa encryption for Lite, JUnit, JSUnit and android drivers
4.add compressed zip and hash file to report folder
5.modify mount kit to support local device
6.add exception when CppTestLit mount failed
xDeviceTest-v1.0.2.1061:
1.change CTest, CppTest for lite module to CTestLite and CppTestLite
2.dynamically add product params to vision report for CTestLite and CppTestLite driver
3.search task file in config folder
4.fix char1(SOH) issue
5.fix DeviceTest to support tcpath parameter
6.add log information for remote lite test case execution
xDeviceTest-v1.0.2.1051:
1.change driver name, remove harmony and harmonylite prefix
2.add ignored data to report
3.add OpenSourceTest driver
4.supports paths with spaces
5.add CTest error message
6.remove wrong config file during execution
7.remove python test driver
xDeviceTest-v1.0.2.1041:
1.support terminating execution by inputting ctrl+c at terminal window
2.add "Execution Time" and "Modules Done" to vision report, modify "Test Type" display content
3.support ui test for lite device:watch
4.plan_log record debug level log output
5.modify retry test cases one by one for AndroidGTest, AndroidJUnitTest and JUnitTest
xDeviceTest-v1.0.2.1031:
1.add unavailable message to failures report
2.add rerun by testFile for AndroidJUnitTest
3.add hap installation package failed exception
xDeviceTest-v1.0.2.1021:
1.add device_hilog_xxx and modify device_log to device_android_log_xxx for JSUnitTest and JUnitTest
2.add test case execution progress for AndroidGTest, AndroidJUnitTest and JUnitTest
3.add uninstall hap for ApkInstallKit
4.add dryrun, rerun and retry functions for CppTest
5.run -l xxx can input config string (CppTest and CTest support config string input)
6.generate summary.ini including execution information in report path
7.modify JunitParser to solve the error report problem
xDeviceTest-v1.0.0.171:
1.add rerun function for AndroidJUnitTest
2.add device_hilog_xxx and modify device_log to device_android_log_xxx for AndroidJUnitTest
3.modify resource path and "resource" is not required
4.change JUnitTest driver name to JUnitTest
5.adapt the modification of xml report file generation path in JUnitTest
6.support to display details in multiple lines at failures_report.html
xDeviceTest-v1.0.0.162:
1.add list history and list <plan id> command to show history plan info,
includes plan id, command, report path
2.add --retry parameter to run command
(AndroidJunitTest, JUnitTest supports retry parameter by now).
command 'run --retry' retry previous command;
command 'run --retry <plan id>' retry specified plan id command;
-rp parameter is valid for retry command, like 'run --retry <plan id> -rp xxx'
3.AndroidJunitTest and JUnitTest support to run specified classes and methods under the same module
4.fix vision report test case result judgement issue
5.modify wait available device information and time interval to check L0 and L1 available device
6.raise exception if install apk failed, record log information if uninstall apk failed
xDeviceTest-v1.0.0.161:
1.support JUnitTest
2.support JSUnitTest
3.support xml-output option in config file and command line for JUnitTest and JSUnitTest
4.add environment parameter processing for config file for L0 and L1
5.fix xml 0x02, 0x0F, 0x10 char transfer issue
6.fix mount same file failed issue
7.fix L1 wait timeout to generate report issue
8.add check and give prompt for wrong device config for L0 and L1
9.modify L0 burn time from millisecond to ms
10.add AndroidBackGroundTestDriver to test android test background execution
xDeviceTest-v20.06.10:
1. add run parameter tcpath to specify testcases path
2. modify run parameter res to respath
3. add execute_shell_command_background for USB disconnection
4. generate failures report when failed test cases exist
5. support module discovery in the testcases subfolders
6. add startup.bat and startup.sh
7. fix the device log is not recorded when the device reboots or reconnects
8. fix android junit test time style transfer issue when the time exceeds 1000ms
xDeviceTest-v20.06.03:
1. support empty report for android test
2. add test case execution time in CTest data report
3. add version in CTest data report
4. add device log in CTest and CPPTest
5. support error report for CTest
6. remove burn tool from test suit config file for CTest
7. fix reboot command failed to get log error for CPPTest
8. fix android reboot operation, wait for device recovery
9. fix certain factory result upload issues
xDeviceTest-v20.05.27:
1. support upload factory pythontest task result
2. support factory task terminate
3. support run as python module
4. support error report for android test
5. add devicetest driver for lite
6. fix execution direction error
7. fix command kit
\ No newline at end of file
xDevice-v2.8.0.1074
\ No newline at end of file
#!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2013 The Android Open Source Project
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from dataclasses import dataclass
__all__ = ["UsbConst", "AppConst"]
@dataclass
class UsbConst:
connector = "adb"
connector_type = "usb-adb"
push = "adb push"
pull = "adb pull"
shell = "adb shell"
server_port = "ANDROID_ADB_SERVER_PORT"
kill_server = "adb kill-server"
start_server = "adb start-server"
reboot = "adb reboot"
@dataclass
class AppConst:
entry_app = "Entry.apk"
app_ext = ".apk"
app_name = "APK"
wifi_app = "xDeviceService-wifi.apk"
......@@ -23,16 +23,12 @@ from dataclasses import dataclass
__all__ = ["Variables"]
SRC_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
SRC_ADAPTER_DIR = os.path.abspath(os.path.join(SRC_DIR, "adapter"))
MODULES_DIR = os.path.abspath(os.path.dirname(__file__))
TOP_DIR = os.path.abspath(
os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
TOP_ADAPTER_DIR = os.path.abspath(os.path.join(TOP_DIR, "adapter"))
sys.path.insert(0, SRC_DIR)
sys.path.insert(1, MODULES_DIR)
sys.path.insert(2, TOP_DIR)
sys.path.insert(3, SRC_ADAPTER_DIR)
sys.path.insert(4, TOP_ADAPTER_DIR)
@dataclass
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册