mirror of
https://gitee.com/openharmony/testfwk_developer_test
synced 2025-02-17 05:57:47 +00:00
commit
cc58d33d16
@ -1227,6 +1227,12 @@
|
||||
"path": [
|
||||
"vendor/huawei/virt_service/container_manager"
|
||||
]
|
||||
},
|
||||
"container_comm": {
|
||||
"name": "container_comm",
|
||||
"path": [
|
||||
"vendor/huawei/virt_service/container_comm"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,9 +24,6 @@ import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
# 代码根目录
|
||||
root_path = os.getcwd()
|
||||
CODEPATH = root_path.split("/test/testfwk/developer_test")[0]
|
||||
# 子系统json目录
|
||||
SYSTEM_JSON = "build/subsystem_config.json"
|
||||
# 覆盖率gcda
|
||||
@ -286,6 +283,7 @@ def gen_final_report(cov_path):
|
||||
|
||||
if __name__ == "__main__":
|
||||
current_path = os.path.abspath(os.path.dirname(__name__))
|
||||
CODEPATH = current_path.split("/test/testfwk/developer_test")[0]
|
||||
_init_sys_config()
|
||||
from localCoverage.utils import get_product_name
|
||||
# 编译生成的out路径
|
||||
|
@ -24,9 +24,7 @@ import subprocess
|
||||
import multiprocessing
|
||||
import sys
|
||||
from multiprocessing import Process
|
||||
# 根代码目录
|
||||
root_path = os.getcwd()
|
||||
CODEPATH = root_path.split("/test/testfwk/developer_test")[0]
|
||||
|
||||
# 子系统json目录
|
||||
SYSTEM_JSON = "test/testfwk/developer_test/localCoverage/codeCoverage/subsystem_config.json"
|
||||
# 覆盖率gcda
|
||||
@ -35,11 +33,8 @@ COVERAGE_GCDA_RESULTS = "test/testfwk/developer_test/localCoverage/codeCoverage/
|
||||
REPORT_PATH = "test/testfwk/developer_test/localCoverage/codeCoverage/results/coverage/reports/cxx"
|
||||
# llvm-gcov.sh
|
||||
LLVM_GCOV = "test/testfwk/developer_test/localCoverage/codeCoverage/llvm-gcov.sh"
|
||||
|
||||
# 测试套划分步长
|
||||
STEP_SIZE = 10
|
||||
# lcovrc配置文件集合
|
||||
LCOVRC_SET = f"{CODEPATH}/test/testfwk/developer_test/localCoverage/codeCoverage/coverage_rc"
|
||||
|
||||
|
||||
def _init_sys_config():
|
||||
@ -350,6 +345,9 @@ def gen_final_report(cov_path):
|
||||
|
||||
if __name__ == '__main__':
|
||||
current_path = os.path.abspath(os.path.dirname(__name__))
|
||||
CODEPATH = current_path.split("/test/testfwk/developer_test")[0]
|
||||
# lcovrc配置文件集合
|
||||
LCOVRC_SET = f"{CODEPATH}/test/testfwk/developer_test/localCoverage/codeCoverage/coverage_rc"
|
||||
_init_sys_config()
|
||||
from localCoverage.utils import get_product_name
|
||||
# 编译生成的out路径
|
||||
|
@ -171,6 +171,10 @@ if __name__ == '__main__':
|
||||
|
||||
# 执行代码覆盖率
|
||||
execute_code_cov_tools(developer_test_path)
|
||||
# 报备
|
||||
keyword_path = os.path.join(
|
||||
developer_test_path, "localCoverage/keyword_registration/keyword_filter.py")
|
||||
subprocess.run("python3 %s" % keyword_path, shell=True)
|
||||
|
||||
# 执行接口覆盖率
|
||||
if len(test_part_list) > 0:
|
||||
@ -187,10 +191,6 @@ if __name__ == '__main__':
|
||||
developer_test_path, "localCoverage/restore_comment/restore_source_code.py")
|
||||
subprocess.run("python3 %s" % restore_source_code_path, shell=True)
|
||||
|
||||
keyword_path = os.path.join(
|
||||
developer_test_path, "localCoverage/keyword_registration/keyword_filter.py")
|
||||
subprocess.run("python3 %s" % keyword_path, shell=True)
|
||||
|
||||
print(r"See the code coverage report in: "
|
||||
r"/test/testfwk/developer_test/localCoverage/codeCoverage/results/coverage/reports/cxx/html")
|
||||
print(r"See the interface coverage report in: "
|
||||
|
@ -26,13 +26,6 @@ import CppHeaderParser
|
||||
import get_innerkits_json
|
||||
import make_report
|
||||
|
||||
root_path = os.getcwd()
|
||||
CODEPATH = root_path.split("/test/testfwk/developer_test")[0]
|
||||
SUB_SYSTEM_INFO_PATH = os.path.join(
|
||||
CODEPATH, "test/testfwk/developer_test/localCoverage/codeCoverage/results/coverage/reports/cxx")
|
||||
OUTPUT_REPORT_PATH = os.path.join(
|
||||
CODEPATH, "test/testfwk/developer_test/localCoverage/interfaceCoverage/results/coverage/interface_kits"
|
||||
)
|
||||
filter_file_name_list = [
|
||||
"appexecfwk/libjnikit/include/jni.h",
|
||||
]
|
||||
@ -442,6 +435,12 @@ def make_interface_coverage_result(part_list):
|
||||
|
||||
if __name__ == "__main__":
|
||||
current_path = os.getcwd()
|
||||
CODEPATH = current_path.split("/test/testfwk/developer_test")[0]
|
||||
SUB_SYSTEM_INFO_PATH = os.path.join(
|
||||
CODEPATH, "test/testfwk/developer_test/localCoverage/codeCoverage/results/coverage/reports/cxx")
|
||||
OUTPUT_REPORT_PATH = os.path.join(
|
||||
CODEPATH, "test/testfwk/developer_test/localCoverage/interfaceCoverage/results/coverage/interface_kits"
|
||||
)
|
||||
_init_sys_config()
|
||||
from localCoverage.utils import get_product_name, get_target_cpu
|
||||
product_name = get_product_name(CODEPATH)
|
||||
|
@ -43,6 +43,7 @@ def get_subsystem_name(partname: str) -> str:
|
||||
return json_obj[partname]
|
||||
return ""
|
||||
|
||||
|
||||
def find_part_so_dest_path(test_part: str) -> str:
|
||||
"""
|
||||
获取指定部件的obj目录
|
||||
|
@ -45,12 +45,12 @@ def get_file_list_by_postfix(path, postfix=""):
|
||||
return file_list
|
||||
|
||||
|
||||
def recover_source_file(cpp_arr_list, keys):
|
||||
if not cpp_arr_list:
|
||||
def recover_source_file(cpp_list, keys):
|
||||
if not cpp_list:
|
||||
print("no any .cpp file here")
|
||||
return
|
||||
|
||||
for path in cpp_arr_list:
|
||||
for path in cpp_list:
|
||||
if not os.path.exists(path):
|
||||
return
|
||||
for key in keys:
|
||||
|
@ -114,25 +114,25 @@ def add_lcov(subsystem_config_path):
|
||||
rewrite_source_file(source_file_path)
|
||||
else:
|
||||
print("The directory does not exist.", file_path)
|
||||
except:
|
||||
except(FileNotFoundError, AttributeError, ValueError, KeyError):
|
||||
print("add LCOV_EXCL_BR_LINE Error")
|
||||
|
||||
|
||||
def get_part_config_json(part_name_list, all_system_info_path, part_info_path):
|
||||
if os.path.exists(all_system_info_path):
|
||||
def get_part_config_json(part_list, system_info_path, part_path):
|
||||
if os.path.exists(system_info_path):
|
||||
new_json_text = {}
|
||||
for part in part_name_list:
|
||||
with open(all_system_info_path, "r") as system_text:
|
||||
for part in part_list:
|
||||
with open(system_info_path, "r") as system_text:
|
||||
system_text_json = json.load(system_text)
|
||||
if part in system_text_json:
|
||||
new_json_text[part] = system_text_json[part]
|
||||
else:
|
||||
print("part not in all_subsystem_config.json")
|
||||
new_json = json.dumps(new_json_text, indent=4)
|
||||
with open(part_info_path, "w") as out_file:
|
||||
with open(part_path, "w") as out_file:
|
||||
out_file.write(new_json)
|
||||
else:
|
||||
print("%s not exists.", all_system_info_path)
|
||||
print("%s not exists.", system_info_path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -42,5 +42,5 @@ if __name__ == '__main__':
|
||||
f"{file_path}_primal", file_path), shell=True).communicate()
|
||||
else:
|
||||
print("The directory does not exist.", file_path)
|
||||
except:
|
||||
except(FileNotFoundError, AttributeError, ValueError, KeyError):
|
||||
print("restore source code Error")
|
||||
|
@ -78,7 +78,7 @@ class Run(object):
|
||||
init_gcov_path = os.path.join(sys.framework_root_dir, "localCoverage/resident_service/init_gcov.py")
|
||||
if os.path.exists(init_gcov_path):
|
||||
subprocess.run("python3 %s command_str=%s" % (
|
||||
init_gcov_path, current_raw_cmd),shell=True)
|
||||
init_gcov_path, current_raw_cmd), shell=True)
|
||||
else:
|
||||
print(f"{init_gcov_path} not exists.")
|
||||
|
||||
@ -422,7 +422,7 @@ class Run(object):
|
||||
xts_test_case_path = self.get_xts_tests_out_path(options.productform, options.testtype)
|
||||
if not os.path.exists(xts_test_case_path):
|
||||
LOG.error("%s is not exist." % xts_test_case_path)
|
||||
return None
|
||||
return
|
||||
xts_test_dict = TestCaseManager().get_xts_test_files(xts_test_case_path, options)
|
||||
return xts_test_dict
|
||||
|
||||
|
@ -505,8 +505,9 @@ class ResultManager(object):
|
||||
subprocess.Popen("tar -zxf %s -C %s > /dev/null 2>&1" %
|
||||
(tar_path, cxx_cov_path), shell=True).communicate()
|
||||
subprocess.Popen("rm -rf %s" % tar_path, shell=True).communicate()
|
||||
subprocess.Popen("mv %s %s" % (os.path.join(cxx_cov_path, target_name),
|
||||
os.path.join(cxx_cov_path, OBJ)), shell=True).communicate()
|
||||
if target_name != OBJ:
|
||||
subprocess.Popen("mv %s %s" % (os.path.join(cxx_cov_path, target_name),
|
||||
os.path.join(cxx_cov_path, OBJ)), shell=True).communicate()
|
||||
|
||||
|
||||
##############################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user