-
Notifications
You must be signed in to change notification settings - Fork 220
/
Copy pathrun.sh
51 lines (38 loc) · 1.44 KB
/
run.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
44
45
46
47
48
49
50
51
#!/bin/bash
set -e
CLEAN_BUILD=true
if [ $1 = "no-clean" ]; then
echo "INFO: clean build is NOT going to be performed."
CLEAN_BUILD=false
find /app/target/debug/deps -name *.gcda -exec rm {} \;
fi
if $CLEAN_BUILD ; then
rm -rf /app/target/ || true
fi
rm /app/*.profraw || true
rm /app/pgcat.profdata || true
rm -rf /app/cov || true
export LLVM_PROFILE_FILE="/app/pgcat-%m-%p.profraw"
export RUSTC_BOOTSTRAP=1
export CARGO_INCREMENTAL=0
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort -Cinstrument-coverage"
export RUSTDOCFLAGS="-Cpanic=abort"
cd /app/
if $CLEAN_BUILD ; then
cargo clean
fi
cargo build
cargo test --tests
bash .circleci/run_tests.sh
TEST_OBJECTS=$( \
for file in $(cargo test --no-run 2>&1 | grep "target/debug/deps/pgcat-[[:alnum:]]\+" -o); \
do \
printf "%s %s " --object $file; \
done \
)
echo "Generating coverage report"
rust-profdata merge -sparse /app/pgcat-*.profraw -o /app/pgcat.profdata
bash -c "rust-cov export -ignore-filename-regex='rustc|registry' -Xdemangler=rustfilt -instr-profile=/app/pgcat.profdata $TEST_OBJECTS --object ./target/debug/pgcat --format lcov > ./lcov.info"
genhtml lcov.info --title "PgCat Code Coverage" --css-file ./cov-style.css --highlight --no-function-coverage --ignore-errors source --legend --output-directory cov --prefix $(pwd)
rm /app/*.profraw
rm /app/pgcat.profdata