From 1cff4939b8509326751f9d0485d67c74c68fa37a Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Sat, 27 Apr 2019 16:43:58 +0200 Subject: [PATCH] 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. --- tests/executeUnitTests.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/executeUnitTests.sh b/tests/executeUnitTests.sh index 5d7b506562..97f60f70e8 100755 --- a/tests/executeUnitTests.sh +++ b/tests/executeUnitTests.sh @@ -20,9 +20,11 @@ # Script to execute googletest based unit tests for BOINC # 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 --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 if [ ! -d "tests" ]; then @@ -33,12 +35,16 @@ fi ROOTDIR=$(pwd) CI_RUN="${TRAVIS:-false}" report="" +doclean="" while [[ $# -gt 0 ]]; do key="$1" case $key in --report-coverage) report="yes" ;; + --clean) + doclean="yes" + ;; *) echo "unrecognized option $key" ;; @@ -54,11 +60,11 @@ if [ "${report}" = "yes" ]; then fi cd tests || exit 1 -if [ -d "gtest" ]; then +if [[ "$doclean" = "yes" && -d "gtest" ]]; then rm -rf gtest if [ $? -ne 0 ]; then cd ..; exit 1; fi fi -mkdir gtest +mkdir -p gtest if [ $? -ne 0 ]; then cd ..; exit 1; fi cd gtest cmake ../unit-tests @@ -72,8 +78,8 @@ done cd ../.. if [ "${report}" = "yes" ]; then - for T in lib sched; do - [ -d "${T}" ] && gcov -lp *.o >/dev/null; - done + #for T in lib sched; do + # [ -d "${T}" ] && gcov -lp *.o >/dev/null; + #done codecov fi