提交 4118fa6d 编写于 作者: W wanggang

告警处理

Signed-off-by: Nwanggang <wanggang@kaihongdigi.com>
上级 2f4b13fb
......@@ -203,7 +203,7 @@ class BuildTestcases(object):
build_result = False
acts_build_command = []
current_path = os.getcwd()
# acts_rootpath = ~/OpenHarmony/test/xts/acts
# 路径 acts_rootpath = ~/OpenHarmony/test/xts/acts
os.chdir(self.xts_project_rootpath)
acts_build_command.append(BUILD_PRODUCT_NAME % para.productform)
acts_build_command.append("system_size=standard")
......
......@@ -183,19 +183,20 @@ def select_user_input(data_list):
sys.exit(0)
return select_item_value, select_item_index
# 选择productform
def select_productform():
select_value = "phone"
# scan_support_product() = [DAYU,Hi3516,ohos_arm64,ohos_sdk,rk3568]
# 列表注释 scan_support_product() = [DAYU,Hi3516,ohos_arm64,ohos_sdk,rk3568]
scan_product_list = scan_support_product()
# 从framework_config.xml里取productform节点的value:ipcamera_hispark_aries、ipcamera_hispark_taurus、wifiiot_hispark_pegasus
config_product_list = \
FrameworkConfigManager().get_framework_config("productform")
# productform_list = [DAYU,Hi3516,ohos_arm64,ohos_sdk,rk3568,
# ipcamera_hispark_aries、ipcamera_hispark_taurus、wifiiot_hispark_pegasus]
# 列表注释 productform_list = [DAYU,Hi3516,ohos_arm64,ohos_sdk,rk3568,
# 列表注释 ipcamera_hispark_aries、ipcamera_hispark_taurus、wifiiot_hispark_pegasus]
productform_list = scan_product_list + config_product_list
if len(productform_list) != 0:
......@@ -268,6 +269,7 @@ def show_product_list():
else:
print("No category specified.")
def show_testtype_list():
print("List of currently supported test types:")
testtype_list = FrameworkConfigManager().get_framework_config(
......@@ -278,6 +280,7 @@ def show_testtype_list():
else:
print("No category specified.")
# 从OpenHarmony/out/rk3568/build_configs/infos_for_testfwk.json里的subsystem_infos中subsystem_infos下获取subsystemlist
def show_subsystem_list(product_form):
print("List of currently supported subsystem names:")
......@@ -290,6 +293,7 @@ def show_subsystem_list(product_form):
for index, element in enumerate(subsystem_name_list):
print(" %d. %s" % (index + 1, element))
def show_acts_subsystem_list():
print("List of currently supported acts subsystem names:")
sub_list = ['global','security','useriam','multimedia','appexecfwk','account','communication','notification',
......@@ -300,11 +304,13 @@ def show_acts_subsystem_list():
for index, element in enumerate(sub_list):
print(" %d. %s" % (index + 1, element.strip()))
# 从OpenHarmony/out/rk3568/build_configs/infos_for_testfwk.json里的subsystem_infos中subsystem_infos下获取partlist
def show_partname_list(product_form):
print("List of currently supported part names:")
parser = ParsePartsConfig(product_form)
subsystem_name_list = parser.get_subsystem_name_list()
if len(subsystem_name_list) == 0:
return
......@@ -317,6 +323,7 @@ def show_partname_list(product_form):
for index, element in enumerate(part_name_list):
print(" %d. %s" % (index + 1, element))
def display_help_command_info(command):
if command == ToolCommandType.TOOLCMD_KEY_SHOW:
print(SUPPORT_COMMAND_SHOW)
......
......@@ -29,6 +29,7 @@ LOG = platform_logger("config_manager")
# 变量注释 CONFIG_PATH = OpenHarmony/test/developertest/config
CONFIG_PATH = os.path.join(sys.framework_res_dir, "config")
# framework_config.xml
class FrameworkConfigManager(object):
def __init__(self, filepath=""):
......@@ -40,6 +41,7 @@ class FrameworkConfigManager(object):
else:
self.filepath = filepath
# 获取framework_config.xml中所有name的value,返回列表
def get_framework_config(self, target_name):
data_list = []
......@@ -125,6 +127,7 @@ class FilterConfigManager(object):
def get_filter_config_path(self):
return self.filepath
# 这里的filepath不存在
class ResourceConfigManager(object):
def __init__(self, filepath=""):
......@@ -307,6 +310,7 @@ class BuildConfigManager(object):
def get_build_path(self):
return self.filepath
class FuzzerConfigManager(object):
def __init__(self, config_path=""):
if config_path == "":
......
......@@ -673,12 +673,9 @@ class JSUnitTestDriver(IDriver):
timeout = ResourceManager.get_nodeattrib_data(resource_data_dic)
else:
timeout = ResourceManager.get_nodeattrib_data(resource_data_dic)
resource_manager.process_preparer_data(resource_data_dic, resource_dir,
self.config.device)
resource_manager.process_preparer_data(resource_data_dic, resource_dir,self.config.device)
main_result = self._install_hap(suite_file)
result = ResultManager(suite_file, self.config)
if main_result:
self._execute_hapfile_jsunittest()
try:
......@@ -688,8 +685,7 @@ class JSUnitTestDriver(IDriver):
if timeout:
actiontime = timeout
times = 1
device_log_file_open = os.open(device_log_file, os.O_RDONLY,
stat.S_IWUSR | stat.S_IRUSR)
device_log_file_open = os.open(device_log_file, os.O_RDONLY,stat.S_IWUSR | stat.S_IRUSR)
with os.fdopen(device_log_file_open, "r", encoding='utf-8') \
as file_read_pipe:
for i in range(0, times):
......@@ -706,7 +702,6 @@ class JSUnitTestDriver(IDriver):
break
if int(time.time()) - start_time > 5:
break
finally:
_lock_screen(self.config.device)
self._uninstall_hap(self.package_name)
......@@ -714,8 +709,7 @@ class JSUnitTestDriver(IDriver):
self.result = result.get_test_results("Error: install hap failed")
LOG.error("Error: install hap failed")
resource_manager.process_cleaner_data(resource_data_dic, resource_dir,
self.config.device)
resource_manager.process_cleaner_data(resource_data_dic, resource_dir,self.config.device)
def generate_console_output(self, device_log_file, request):
result_message = self.read_device_log(device_log_file)
......@@ -848,12 +842,14 @@ class JSUnitTestDriver(IDriver):
return test_timeout
except JSONDecodeError:
return test_timeout
finally:
print(" get json shell timeout finally")
@staticmethod
def _get_package_and_ability_name(hap_filepath):
package_name = ""
ability_name = ""
if os.path.exists(hap_filepath):
filename = os.path.basename(hap_filepath)
......@@ -887,7 +883,6 @@ class JSUnitTestDriver(IDriver):
package_name = profile.get("package")
if not package_name:
continue
abilities = profile.get("abilities")
for abilitie in abilities:
abilities_name = abilitie.get("name")
......@@ -904,5 +899,4 @@ class JSUnitTestDriver(IDriver):
shutil.rmtree(hap_bak_path)
else:
print("file %s not exist" % hap_filepath)
return package_name, ability_name
......@@ -189,6 +189,7 @@ class TestCaseManager(object):
break
return is_valid_status
@classmethod
def check_python_test_file(cls, suite_file):
if suite_file.endswith(".py"):
......@@ -197,6 +198,7 @@ class TestCaseManager(object):
return True
return False
@classmethod
def check_hap_test_file(cls, hap_file_path):
try:
......@@ -221,3 +223,5 @@ class TestCaseManager(object):
return False
except JSONDecodeError:
return False
finally:
print(" check hap test file finally")
......@@ -49,6 +49,7 @@ def get_file_list(find_path, postfix=""):
file_list.append(file_name)
return file_list
# 获取目录下每一个文件,并放到一个列表里
def get_file_list_by_postfix(path, postfix=""):
file_list = []
......@@ -102,7 +103,7 @@ def get_build_output_path(product_form):
def scan_support_product():
# scan standard and large system info
# product_form_dir = OpenHarmony/productdefine/common/products/
# 路径注释 product_form_dir = OpenHarmony/productdefine/common/products/
product_form_dir = os.path.join(sys.source_code_root_path,
"productdefine",
"common",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册