1. Tracing PCs with guards 开启Clang代码覆盖率检查功能,需要配置-fsanitize-coverage编译参数,你可以创建一个iOS模板工程做测试,在Build Settings->Apple Clang - Custom Complier Flags->Other C Flags下面配置。如图: trace-pc-guard模式下,所有代码块首部都会被插入如下回调函数: void __sanitizer_cov_trace_pc...
使用clang编译器编译源代码时,添加"-fprofile-instr-generate -fcoverage-mapping"参数,启用代码覆盖率功能。 运行生成的可执行文件,执行各种测试用例。 执行完测试用例后,会生成一个覆盖率数据文件(.profraw或.profdata)。 使用llvm-cov工具分析覆盖率数据文件,生成代码覆盖率报告。
make coverage SHOW=1 make upload-cov SHOW=1 no_output_timeout: 30m 7 changes: 7 additions & 0 deletions 7 Makefile Original file line numberDiff line numberDiff line change @@ -234,6 +234,13 @@ upload-artifacts: #--- clang-install: ./sbin/install_clang.sh .PHONY: clang-install ...
% clang++ -g cov.cc -fsanitize=address -fsanitize-coverage=trace-pc-guard % ASAN_OPTIONS=coverage=1 ./a.out; wc -c *.sancov main SanitizerCoverage: ./a.out.7312.sancov 2 PCs written 24 a.out.7312.sancov % ASAN_OPTIONS=coverage=1 ./a.out foo ; wc -c *.sancov foo main San...
开启Clang代码覆盖率检查功能,需要配置-fsanitize-coverage编译参数,你可以创建一个iOS模板工程做测试,在Build Settings->Apple Clang - Custom Complier Flags->Other C Flags下面配置。如图: trace-pc-guard模式下,所有代码块首部都会被插入如下回调函数:
开启Clang代码覆盖率检查功能,需要配置-fsanitize-coverage编译参数,你可以创建一个iOS模板工程做测试,在Build Settings->Apple Clang - Custom Complier Flags->Other C Flags下面配置。如图: trace-pc-guard模式下,所有代码块首部都会被插入如下回调函数:
未设置 最少人数 0 优先级 不指定 标签 静态检查成功 dco检查成功 编译成功 冒烟测试成功 格式化检查成功 merged 关联Issue IAG6NW [Bug]: native_hook:unittest use_clang_coverage编译参数报错 Pull Request 合并后将关闭上述关联 Issue 参与者(2)
coverage: name: "Analyze Test Coverage" runs-on: ubuntu-latest container: docker.io/ogdf/clang:15 container: docker.io/ncoder/clang:18 needs: [ style, dirs, self-sufficiency, docs ] env: CCACHE_COMPILERCHECK: "%compiler% -v" 0 comments on commit 5dfd1d0 Please sign in to comment. ...
CodeGenModule::CodeGenModule(ASTContext&C,constHeaderSearchOptions&HSO,constPreprocessorOptions&PPO,constCodeGenOptions&CGO,llvm::Module&M,DiagnosticsEngine&diags,CoverageSourceInfo*CoverageInfo):Context(C),LangOpts(C.getLangOpts()),HeaderSearchOpts(HSO),PreprocessorOpts(PPO),CodeGenOpts(CGO),TheModule(...
CMAKE_CXX_COMPILER) // target i686-pc-windows-gnu for 32bit set(CLANG_COVERAGE_COMPILE_FLAGS"-v -target x86_64-pc-windows-gnu -Wall -Wextra -std=gnu++17") set(CMAKE_CXX_FLAGS"${CMAKE_CXX_FLAGS} ${CLANG_COVERAGE_COMPILE_FLAGS}") ...