summaryrefslogtreecommitdiff
path: root/coverage.sh
diff options
context:
space:
mode:
authorJakub Stachurski <jakub@wilkuu.nl>2026-08-14 22:14:08 +0200
committerJakub Stachurski <jakub@wilkuu.nl>2026-08-14 22:14:08 +0200
commitaf0b5d6ce4e5b9901afe50656f0016e1db72f2c5 (patch)
treef27bf0a825fdcd35e1a653fdad407f0dc039ca6b /coverage.sh
parent4d1cb750d5b2f26f5257cacc74a70476349d1c9e (diff)
Initial commitmaster
Diffstat (limited to '')
-rwxr-xr-xcoverage.sh22
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