How do I filter files in the llvm-cov code coverage report?
From the llvm-cov docs :
llvm-cov show [options] -instr-profile PROFILE BIN [-object BIN,...] [[-object BIN]] [SOURCES]
The show llvm-cov command shows the linear coverage of BIN binaries, ... using the PROFILE profile. It can be filtered to show only coverage for files listed in SOURCES.
I am using the following command:
xcrun llvm-cov show -instr-profile "${PROFDATA}" "${BINARY}" codecov_source_files > Coverage.report
Where codecov_source_files
is the file with this line:
*Router.swift
So, basically I want the report to only contain files with the suffix: Router.swift
But I am getting Coverage.report with all classes in the project.
What am I missing?
source to share
It is poorly worded, but SOURCES
it is actually a list of filenames, not a filename containing a list of filenames.
These must be paths to the actual source files on disk. Unfortunately it doesn't support wildcards or regex.
Edit: Reading the source code, I found that you can also list directories as SOURCES
, and it will overwrite them. There is also an undocumented option -dump-collected-paths
that prints signed files SOURCES
.
source to share