diff options
Diffstat (limited to 'coverage.sh')
| -rwxr-xr-x | coverage.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/coverage.sh b/coverage.sh new file mode 100755 index 0000000..7532015 --- /dev/null +++ b/coverage.sh @@ -0,0 +1,22 @@ +#/usr/bin/env bash +LLVM_PROFILE_FILE=default_%m_%p.profraw + +_output=`RUSTFLAGS="$RUSTFLAGS -C instrument-coverage" cargo test --message-format=json` +_cmd="$1"; shift +llvm-profdata merge -sparse default_*.profraw -o default.profdata + +llvm-cov $_cmd \ + $( \ + for file in \ + $( \ + echo $_output \ + | jq -r "select(.profile.test == true) | .filenames[]" \ + | grep -v dSYM - \ + ); \ + do \ + printf "%s %s " -object $file; \ + done \ + ) --instr-profile=default.profdata --use-color --ignore-filename-regex='/.cargo/registry' $@ # and/or other options + +rm default.profdata +rm default_*.profraw |
