Files
panda-meb/tests/safety/test_coverage.sh
Shane Smiskol cf108cd4cc safety: full coverage (#1750)
* stash

* if x > xy.x[0], then subsequent x < xy.x[i+1] enforces it is monotonic, or uses last y

* rm

* test safety tick

* coverage: include safety.h

* car-only test

* MAX

* op

* add safety_config_valid
2023-12-09 02:27:29 -08:00

28 lines
765 B
Bash
Executable File

#!/usr/bin/env bash
set -e
# reset coverage data and generate gcc note file
rm -f ../libpanda/*.gcda
scons -j$(nproc) -D --coverage
# run safety tests to generate coverage data
./test.sh
# generate and open report
if [ "$1" == "--report" ]; then
geninfo ../libpanda/ -o coverage.info
genhtml coverage.info -o coverage-out
browse coverage-out/index.html
fi
# test coverage
GCOV_OUTPUT=$(gcov -n ../libpanda/panda.c)
INCOMPLETE_COVERAGE=$(echo "$GCOV_OUTPUT" | paste -s -d' \n' | grep -E "File.*(safety\/safety_.*)|(safety)\.h" | grep -v "100.00%" || true)
if [ -n "$INCOMPLETE_COVERAGE" ]; then
echo "FAILED: Some files have less than 100% coverage:"
echo "$INCOMPLETE_COVERAGE"
exit 1
else
echo "SUCCESS: All checked files have 100% coverage!"
fi