6.2.2.Gcov的基本使用流程 1编译代码时启用Gcov 使用-fprofile-arcs-ftest-coverage编译选项(GCC): bash gcc -f profile-arcs -f test-coverage -f test-coverage:生成.gcno文件(用于后续分析)。 2运行程序,生成.gcda文件 bash ./my_program 运行后,会生成.gcda文件(记录实际执行情况)。 6.3.2Lcov的基本使用流程 1编译代码时启用Gcov bash gcc -f profile-arcs -f test-coverage -o my_programmy_program.c -fprofile-arcs
我们只需要在 build.zig 中添加一个新的标志来生成覆盖率报告: const coverage = b.option(bool, "test-coverage", "Generate test coverage