2019-08-11 22:08:55 -03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# EXECUTE enough code via the autotest tool to see coverage results
|
|
|
|
# afterwards, but don't build/rebuild anything our aim here is to try
|
|
|
|
# to execute as many code path/s as we have available to us, and we'll
|
|
|
|
# afterward report on the percentage of code executed and not executed
|
|
|
|
# etc.
|
|
|
|
|
|
|
|
export CCFLAGS="$CCFLAGS -fprofile-arcs -ftest-coverage"
|
|
|
|
export CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
|
|
|
|
export LINKFLAGS="$LINKFLAGS -lgcov -coverage"
|
|
|
|
|
2019-11-07 21:32:47 -04:00
|
|
|
SPEEDUP=5
|
|
|
|
TIMEOUT=14400
|
|
|
|
|
|
|
|
OPTS="--speedup=$SPEEDUP --timeout=$TIMEOUT --debug --no-clean"
|
|
|
|
|
2020-01-04 19:31:52 -04:00
|
|
|
rm -rf build
|
|
|
|
|
2019-08-11 22:08:55 -03:00
|
|
|
# Run examples
|
2019-11-07 21:32:47 -04:00
|
|
|
./waf configure --board=linux --debug
|
2019-08-11 22:08:55 -03:00
|
|
|
./waf examples
|
2019-11-07 21:32:47 -04:00
|
|
|
./Tools/autotest/autotest.py $OPTS run.examples
|
2019-08-11 22:08:55 -03:00
|
|
|
|
|
|
|
# Run unit tests
|
2019-11-07 21:32:47 -04:00
|
|
|
./Tools/autotest/autotest.py $OPTS build.unit_tests run.unit_tests
|
2019-08-11 22:08:55 -03:00
|
|
|
|
|
|
|
# Run main vehicle tests
|
2020-03-26 23:46:12 -03:00
|
|
|
./Tools/autotest/autotest.py $OPTS build.Plane test.Plane test.QuadPlane
|
|
|
|
./Tools/autotest/autotest.py $OPTS build.Sub test.Sub
|
|
|
|
./Tools/autotest/autotest.py $OPTS build.Copter test.Copter
|
|
|
|
./Tools/autotest/autotest.py $OPTS build.Helicopter test.Helicopter
|
|
|
|
./Tools/autotest/autotest.py $OPTS build.Tracker test.Tracker
|
|
|
|
./Tools/autotest/autotest.py $OPTS build.Rover test.Rover
|
2019-08-11 22:08:55 -03:00
|
|
|
|
|
|
|
#TODO add any other execution path/s we can to maximise the actually
|
|
|
|
# used code, can we run other tests or things? Replay, perhaps?
|
|
|
|
|
|
|
|
REPORT_DIR="reports/lcov-report"
|
|
|
|
rm -rf "$REPORT_DIR"
|
|
|
|
mkdir -p "$REPORT_DIR"
|
|
|
|
|
|
|
|
INFO_FILE="$REPORT_DIR/lcov.info"
|
|
|
|
|
|
|
|
LCOV_LOG="GCOV_lcov.log"
|
|
|
|
GENHTML_LOG="GCOV_genhtml.log"
|
|
|
|
|
|
|
|
lcov --no-external --capture --directory $PWD -o "$INFO_FILE" 2>&1 | tee $LCOV_LOG
|
2020-01-12 23:49:53 -04:00
|
|
|
# remove files we do not intentionally test:
|
2019-08-11 22:08:55 -03:00
|
|
|
lcov --remove "$INFO_FILE" ".waf*" -o "$INFO_FILE" 2>&1 | tee -a $LCOV_LOG
|
2020-01-12 23:49:53 -04:00
|
|
|
lcov --remove "$INFO_FILE" "$PWD/modules/gtest/*" -o "$INFO_FILE" 2>&1 | tee -a $LCOV_LOG
|
|
|
|
lcov --remove "$INFO_FILE" "$PWD/build/linux/libraries/*" -o "$INFO_FILE" 2>&1 | tee -a $LCOV_LOG
|
2019-08-11 22:08:55 -03:00
|
|
|
|
|
|
|
genhtml "$INFO_FILE" -o "$REPORT_DIR" 2>&1 | tee $GENHTML_LOG
|
|
|
|
|
|
|
|
echo "Coverage successful. Open $REPORT_DIR/index.html"
|