run_base_coverage.sh 993 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. set -e # 遇到错误立即退出
  3. xmake
  4. echo "xmake build success"
  5. # ================================
  6. # 1. 运行
  7. # ================================
  8. ./build/linux/x86/release/RyanJson
  9. # ================================
  10. # 2. 合并 profile 数据
  11. # ================================
  12. llvm-profdata merge -sparse default.profraw -o default.profdata
  13. # ================================
  14. # 3. 生成覆盖率报告(文本汇总)
  15. # ================================
  16. # 注意:llvm-cov report 只支持汇总统计,不支持行级参数
  17. llvm-cov report ./build/linux/x86/release/RyanJson \
  18. -instr-profile=default.profdata \
  19. -show-mcdc-summary \
  20. -sources ./RyanJson
  21. # ================================
  22. # 4. 生成覆盖率报告(HTML详细)
  23. # ================================
  24. llvm-cov show ./build/linux/x86/release/RyanJson \
  25. -instr-profile=default.profdata \
  26. -format=html \
  27. -output-dir=coverage/docs \
  28. -sources ./RyanJson
  29. # -sources ./test/fuzzer ./RyanJson