diff --git a/config/user_config.xml b/config/user_config.xml index 9dc434465974c5d55cc441a2e9992ebaa19026c3..5482d81d1b1d607453eb2da66ba3cf35f40c1be1 100755 --- a/config/user_config.xml +++ b/config/user_config.xml @@ -29,8 +29,8 @@ - - + 172.25.64.1 + 2233 diff --git a/localCoverage/codeCoverage/mutilProcess_CodeCoverage.py b/localCoverage/codeCoverage/mutilProcess_CodeCoverage.py index 4fde91aabc80fb0b3231584a5ba599c33ae09563..b12c046141955f558e88eab21cb6a357b45a0d73 100644 --- a/localCoverage/codeCoverage/mutilProcess_CodeCoverage.py +++ b/localCoverage/codeCoverage/mutilProcess_CodeCoverage.py @@ -191,7 +191,7 @@ def gen_subsystem_trace_info(subsystem, data_dir, test_dir, lcovrc_path): print(f"Sours path {src_dir} not exists!") return - cmd = "lcov -c -b {} -d {} --gcov-tool {} --config-file {} -o {} --ignore-errors source,gcov".format( + cmd = "lcov --rc lcov_branch_coverage=1 -c -b {} -d {} --gcov-tool {} --config-file {} -o {} --ignore-errors source,gcov".format( src_dir, data_dir, os.path.join(CODEPATH, LLVM_GCOV), lcovrc_path, output_name) print("single_test**##father_pid:%s##child_pid:%s cmd:%s config file:%s" % ( os.getpid(), os.getppid(), cmd, lcovrc_path @@ -209,13 +209,13 @@ def cut_info(subsystem, test_dir): test_dir, f"{subsystem}_strip.info" ) - remove = r"'*/third_party/*' '*/prebuilts/*' '*/unittest/*' " \ + remove = r"'*/third_party/*' '*/prebuilts/*' '*/unittest/*' '*/test/*' " \ r"'*/moduletest/*' '*/systemtest/*' '*.h*'" if not os.path.exists(trace_file): print(f"Error: trace file {trace_file} not exists!") return - cmd = "lcov --remove {} {} -o {}".format(trace_file, remove, output_name) + cmd = "lcov --rc lcov_branch_coverage=1 --remove {} {} -o {}".format(trace_file, remove, output_name) execute_command(cmd) @@ -278,6 +278,8 @@ def merge_subsystem_info_from_all_test(subsystem): subsystem_info_path_tmp = os.path.join( single_test_info_path, root, file ) + if os.path.getsize(subsystem_info_path_tmp) == 0: + continue print(f"##{subsystem_info_path_tmp}") subsystem_info_list.append(subsystem_info_path_tmp) @@ -287,7 +289,7 @@ def merge_subsystem_info_from_all_test(subsystem): info_output_name = os.path.join( CODEPATH, REPORT_PATH, subsystem_info_name ) - cmd = "lcov -a {} -o {}".format( + cmd = "lcov --rc lcov_branch_coverage=1 -a {} -o {}".format( " -a ".join(subsystem_info_list), info_output_name ) execute_command(cmd) @@ -322,7 +324,7 @@ def merge_info(report_dir): trace_file_name = os.path.join(report_dir, subsystem) trace_file_list.append(trace_file_name) - cmd = "lcov -a {} -o {}".format( + cmd = "lcov --rc lcov_branch_coverage=1 -a {} -o {}".format( " -a ".join(trace_file_list), os.path.join(report_dir, "ohos_codeCoverage.info") ) execute_command(cmd) @@ -339,7 +341,7 @@ def gen_html(cov_path): print(f"Error: the trace file {tracefile} not exists!") return - cmd = "genhtml --branch-coverage --demangle-cpp -o {} -p {} --ignore-errors source {}".format( + cmd = "genhtml --rc lcov_branch_coverage=1 --branch-coverage --demangle-cpp -o {} -p {} --ignore-errors source {}".format( os.path.join(CODEPATH, REPORT_PATH, "html"), CODEPATH, tracefile) execute_command(cmd) diff --git a/localCoverage/restore_comment/build_before_generate.py b/localCoverage/restore_comment/build_before_generate.py index 6a4cb34e87ae4cae489e4ecc2bce110c29803b99..44059cb07d4ac701d8ba4c82bae42ecb0bddd4df 100644 --- a/localCoverage/restore_comment/build_before_generate.py +++ b/localCoverage/restore_comment/build_before_generate.py @@ -89,11 +89,7 @@ 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): - 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/localCoverage/restore_comment/restore_source_code.py b/localCoverage/restore_comment/restore_source_code.py index d6b543c69c48e10c98c637265bcef293454197d3..372e678780d7a2bdb958f51744992bf68ebc3b03 100644 --- a/localCoverage/restore_comment/restore_source_code.py +++ b/localCoverage/restore_comment/restore_source_code.py @@ -35,12 +35,5 @@ if __name__ == '__main__': if "path" in value.keys(): for path_str in value["path"]: file_path = os.path.join(root_path, path_str) - if os.path.exists(file_path): - if os.path.exists(f"{file_path}_primal"): - subprocess.Popen("rm -rf %s" % file_path, shell=True).communicate() - subprocess.Popen("mv %s %s" % ( - f"{file_path}_primal", file_path), shell=True).communicate() - else: - print("The directory does not exist.", file_path) except(FileNotFoundError, AttributeError, ValueError, KeyError): print("restore source code Error")