# Early initialization of LLVM source-based coverage. # # Needs to run before defining any targets. add_project_arguments( '-fprofile-instr-generate', '-fcoverage-mapping', # TODO: -mllvm -runtime-counter-relocation may fix problems with tests with # nix run/fmt/etc that execvp, bypassing atexit. need to confirm that's real. language : 'cpp', ) # N.B. This is a link argument because it needs to link the LLVM profiling runtime, I believe. add_project_link_arguments( '-fprofile-instr-generate', language: 'cpp', ) add_project_arguments( '-Cinstrument-coverage', language : 'rust', ) coverage_profraw_dir = meson.project_build_root() / 'profraw' run_command('mkdir', '-p', coverage_profraw_dir, check : true) coverage_test_env = { # TODO: may need %c, but that may only work if you set runtime counter relocation, need to find that out # # See: https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program # %20m -> use 20 raw profiles and merge at runtime, so that our large number of # invocations of lix in the test suite don't create unreasonable numbers of # files. This, I think, also limits the test concurrency. 'LLVM_PROFILE_FILE': coverage_profraw_dir / '%20m.profraw' } llvm_profdata = find_program('llvm-profdata', required : true) llvm_cov = find_program('llvm-cov', required : true)