Tests: tweak test build script

Do a rebuild from scratch only if requested. This allows fast local testing of new or changes test cases.
Don't need to call gcov ourselves as this is done by codecov too.
This commit is contained in:
Christian Beer 2019-04-27 16:43:58 +02:00
parent db60c1ea7a
commit 1cff4939b8
1 changed files with 12 additions and 6 deletions

View File

@ -20,9 +20,11 @@
# Script to execute googletest based unit tests for BOINC # Script to execute googletest based unit tests for BOINC
# Usage: # Usage:
# ./tests/executeUnitTests.sh [--report-coverage] # ./tests/executeUnitTests.sh [--report-coverage] [--clean]
# #
# if --report-coverage is given the test coverage will be reported to codecov.io # if --report-coverage is given the test coverage will be reported to codecov.io
# if --clean is given the tests will be rebuild from scratch otherwise an existing
# build directory is used
# check working directory because the script needs to be called like: ./tests/executeUnitTests.sh # check working directory because the script needs to be called like: ./tests/executeUnitTests.sh
if [ ! -d "tests" ]; then if [ ! -d "tests" ]; then
@ -33,12 +35,16 @@ fi
ROOTDIR=$(pwd) ROOTDIR=$(pwd)
CI_RUN="${TRAVIS:-false}" CI_RUN="${TRAVIS:-false}"
report="" report=""
doclean=""
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
key="$1" key="$1"
case $key in case $key in
--report-coverage) --report-coverage)
report="yes" report="yes"
;; ;;
--clean)
doclean="yes"
;;
*) *)
echo "unrecognized option $key" echo "unrecognized option $key"
;; ;;
@ -54,11 +60,11 @@ if [ "${report}" = "yes" ]; then
fi fi
cd tests || exit 1 cd tests || exit 1
if [ -d "gtest" ]; then if [[ "$doclean" = "yes" && -d "gtest" ]]; then
rm -rf gtest rm -rf gtest
if [ $? -ne 0 ]; then cd ..; exit 1; fi if [ $? -ne 0 ]; then cd ..; exit 1; fi
fi fi
mkdir gtest mkdir -p gtest
if [ $? -ne 0 ]; then cd ..; exit 1; fi if [ $? -ne 0 ]; then cd ..; exit 1; fi
cd gtest cd gtest
cmake ../unit-tests cmake ../unit-tests
@ -72,8 +78,8 @@ done
cd ../.. cd ../..
if [ "${report}" = "yes" ]; then if [ "${report}" = "yes" ]; then
for T in lib sched; do #for T in lib sched; do
[ -d "${T}" ] && gcov -lp *.o >/dev/null; # [ -d "${T}" ] && gcov -lp *.o >/dev/null;
done #done
codecov codecov
fi fi