-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcoverage.sh
executable file
·43 lines (35 loc) · 1.09 KB
/
coverage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
set -e
# Cargo target directory
TARGET="${TARGET:-target}"
# Generate coverage for coupe and tools
# We need to call this before coverage for ffi, because cargo-llvm-cov removes
# all previous profraw files before runs.
# No default features to avoid linking to SCOTCH and METIS.
cargo +nightly llvm-cov \
--doctests \
--no-report \
--no-default-features \
--workspace
# Building on nightly since we used nightly for cargo-llvm-cov.
RUSTFLAGS="-Cinstrument-coverage $RUSTFLAGS" cargo +nightly build -p coupe-ffi
mkdir -p "$TARGET/ffi-examples"
for f in ffi/examples/*.c
do
example="$(basename "$f" .c)"
clang "$f" \
-o "$TARGET/ffi-examples/$example" \
-L"$TARGET/debug" \
-lcoupe \
-g -Wall -Wextra -Werror
LLVM_PROFILE_FILE="$TARGET/llvm-cov-target/coupe-$example.profraw" \
LD_LIBRARY_PATH="$TARGET/debug" \
"$TARGET/ffi-examples/$example"
done
# Feed ffi objects to cargo-llvm-cov
mv "$TARGET/debug/libcoupe.so" "$TARGET/llvm-cov-target/debug/"
mv "$TARGET/debug/libcoupe.a" "$TARGET/llvm-cov-target/debug/"
cargo +nightly llvm-cov \
report \
--lcov \
--output-path lcov.info