From 1627b6c5944804f1be7b0e70763d418ca3c12e36 Mon Sep 17 00:00:00 2001 From: Teacher_Dong Date: Tue, 19 Dec 2023 16:50:27 +0800 Subject: [PATCH 1/2] Signed-off-by:Teacher_Dong --- localCoverage/all_subsystem_config.json | 6 +-- .../restore_comment/build_before_generate.py | 40 +++++-------------- src/core/driver/drivers.py | 12 ++++-- 3 files changed, 21 insertions(+), 37 deletions(-) diff --git a/localCoverage/all_subsystem_config.json b/localCoverage/all_subsystem_config.json index a07be74..6682da9 100644 --- a/localCoverage/all_subsystem_config.json +++ b/localCoverage/all_subsystem_config.json @@ -1217,10 +1217,10 @@ "vendor/huawei/base/hiviewdfx/hiview_plugins/boot_detector_plugin" ] }, - "bundle_adapter": { - "name": "bundle_adapter", + "bundle_framework_ext": { + "name": "bundle_framework_ext", "path": [ - "vendor/huawei/foundation/bundlemanager/bundle_adapter" + "vendor/huawei/foundation/bundlemanager/bundle_framework_ext" ] }, "advanced_ui_component": { diff --git a/localCoverage/restore_comment/build_before_generate.py b/localCoverage/restore_comment/build_before_generate.py index d5dbfeb..b13f32e 100644 --- a/localCoverage/restore_comment/build_before_generate.py +++ b/localCoverage/restore_comment/build_before_generate.py @@ -21,31 +21,6 @@ import subprocess import json -def get_file_list(find_path, postfix=""): - file_names = os.listdir(find_path) - file_list = [] - if len(file_names) > 0: - for fn in file_names: - if postfix != "": - if fn.find(postfix) != -1 and fn[-len(postfix):] == postfix: - file_list.append(fn) - else: - file_list.append(fn) - return - - -def get_file_list_by_postfix(path, postfix=""): - file_list = [] - for dirs in os.walk(path): - files = get_file_list(find_path=dirs[0], postfix=postfix) - for file_name in files: - if "" != file_name and -1 == file_name.find(__file__): - file_name = os.path.join(dirs[0], file_name) - if os.path.isfile(file_name): - file_list.append(file_name) - return file_list - - def get_source_file_list(path): """ 获取path路径下源文件路径列表 @@ -56,7 +31,7 @@ def get_source_file_list(path): for file_name in files: file_path = os.path.join(root, file_name) _, suffix = os.path.splitext(file_name) - if suffix in [".c", ".h", ".cpp"]: + if suffix in [".c", ".cpp"]: file_path_list_append(file_path) return file_path_list @@ -81,15 +56,18 @@ def rewrite_source_file(source_path_list: list): encoding="utf-8", errors="ignore") as write_fp: for line in code_lines: + sign_number = 0 for key in keys: + sign_number += 1 if key in line and line.strip().startswith(key): write_fp.write(line) break - elif " //LCOV_EXCL_BR_LINE" not in line and not line.strip().endswith("\\"): + elif " //LCOV_EXCL_BR_LINE" not in line and not line.strip().endswith("\\") \ + and sign_number == len(keys): write_fp.write(line.strip("\n").strip("\n\r") + " //LCOV_EXCL_BR_LINE") write_fp.write("\n") break - elif key == keys[-1]: + elif sign_number == len(keys): write_fp.write(line) break @@ -107,9 +85,11 @@ def add_lcov(subsystem_config_path): if "path" in value.keys(): for path_str in value["path"]: file_path = os.path.join(root_path, path_str) + primal_path = f"{file_path}_primal" if os.path.exists(file_path): - subprocess.Popen("cp -r %s %s" % ( - file_path, f"{file_path}_primal"), shell=True).communicate() + if not os.path.exists(primal_path): + subprocess.Popen("cp -r %s %s" % ( + file_path, primal_path), shell=True).communicate() source_file_path = get_source_file_list(file_path) rewrite_source_file(source_file_path) else: diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py index 3fa60f0..9da4366 100644 --- a/src/core/driver/drivers.py +++ b/src/core/driver/drivers.py @@ -101,8 +101,7 @@ class DisplayOutputReceiver: lines = self._process_output(output) for line in lines: line = line.strip() - if "[ RUN ]" in line or "[ OK ]" in line or "[==========]" in line or \ - "[----------]" in line or "[ PASSED ]" in line or "[ FAILED ]" in line: + if line: LOG.info(get_decode(line)) def __error__(self, message): @@ -567,7 +566,8 @@ class CppTestDriver(IDriver): serial = "{}_{}".format(str(request.config.device.__get_serial__()), time.time_ns()) log_tar_file_name = "{}_{}".format(request.get_module_name(), str(serial).replace( ":", "_")) - self.config.device.device_log_collector.stop_hilog_task(log_tar_file_name) + self.config.device.device_log_collector.stop_hilog_task( + log_tar_file_name, module_name=request.get_module_name()) def _init_gtest(self): self.config.device.connector_command("target mount") @@ -1198,9 +1198,13 @@ class OHRustTestDriver(IDriver): log_tar_file_name = "{}_{}".format( request.get_module_name(), str(serial).replace(":", "_")) self.config.device.device_log_collector.stop_hilog_task( - log_tar_file_name) + log_tar_file_name, module_name=request.get_module_name()) self.result = check_result_report( request.config.report_path, self.result, self.error_message) + result_save_path = get_result_savepath( + request.root.source.source_file, self.config.report_path) + shutil.move(self.result, result_save_path) + def _init_oh_rust(self): self.config.device.connector_command("target mount") -- Gitee From 413e6541f72c2b019fc326a7c6557e8c237f696b Mon Sep 17 00:00:00 2001 From: Teacher_Dong Date: Wed, 20 Dec 2023 16:18:51 +0800 Subject: [PATCH 2/2] Signed-off-by:Teacher_Dong --- localCoverage/all_subsystem_config.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/localCoverage/all_subsystem_config.json b/localCoverage/all_subsystem_config.json index 6682da9..a07be74 100644 --- a/localCoverage/all_subsystem_config.json +++ b/localCoverage/all_subsystem_config.json @@ -1217,10 +1217,10 @@ "vendor/huawei/base/hiviewdfx/hiview_plugins/boot_detector_plugin" ] }, - "bundle_framework_ext": { - "name": "bundle_framework_ext", + "bundle_adapter": { + "name": "bundle_adapter", "path": [ - "vendor/huawei/foundation/bundlemanager/bundle_framework_ext" + "vendor/huawei/foundation/bundlemanager/bundle_adapter" ] }, "advanced_ui_component": { -- Gitee