diff --git a/src/test/RUNTESTS.sh b/src/test/RUNTESTS.sh index ca40b1f815f..5a60c024b30 100755 --- a/src/test/RUNTESTS.sh +++ b/src/test/RUNTESTS.sh @@ -315,10 +315,8 @@ runtest() { do export RUNTEST_DIR=$1 export RUNTEST_PARAMS="TEST=$ttype FS=$fs BUILD=$build" - # FORCE_CHECK_TYPE is required for easy force-enable condition failure detection. - # Please see require_valgrind() for details. export RUNTEST_EXTRA="CHECK_TYPE=$checktype \ - FORCE_CHECK_TYPE=$checktype \ + DISABLE_VALGRIND_TESTS=$disable_valgrind_tests \ CHECK_POOL=$check_pool \ $special_params" export RUNTEST_SCRIPT="$runscript" @@ -369,6 +367,7 @@ testfile=all testseq=all check_pool=0 checktype="none" +disable_valgrind_tests=0 skip_dir="" keep_going=n keep_going_skip=n @@ -456,15 +455,15 @@ do case "$receivetype" in none) - forcechecktype=$receivetype + disable_valgrind_tests=1 ;; memcheck|pmemcheck|helgrind|drd) + checktype=$receivetype ;; *) usage "bad force-enable: $receivetype" ;; esac - checktype=$receivetype ;; -k) skip_dir="$skip_dir $2" diff --git a/src/test/unittest/unittest.sh b/src/test/unittest/unittest.sh index 2b1ade6b8e5..00cef128631 100644 --- a/src/test/unittest/unittest.sh +++ b/src/test/unittest/unittest.sh @@ -46,6 +46,10 @@ fi . ../testconfig.sh . ../envconfig.sh +# Required for easy force-enable condition failure detection. +# Please see require_valgrind() for details. +FORCED_CHECK_TYPE=$CHECK_TYPE + if [ -t 1 ]; then IS_TERMINAL_STDOUT=YES fi @@ -1441,8 +1445,9 @@ function valgrind_version_no_check() { # valgrind package is installed # function require_valgrind() { - if [ "$FORCE_CHECK_TYPE" == "none" ]; then - msg "$UNITTEST_NAME: SKIP valgrind test" + if [ "$DISABLE_VALGRIND_TESTS" == "1" ]; then + msg=$(interactive_yellow STDOUT "SKIP:") + echo -e "$UNITTEST_NAME: $msg all Valgrind tests are disabled" exit 0 fi # bc is used inside valgrind_version_no_check @@ -1453,17 +1458,18 @@ function require_valgrind() { local ret=$? restore_exit_on_error if [ $ret -ne 0 ]; then - # FORCE_CHECK_TYPE is basically a copy of CHECK_TYPE as it is provided by force-enable. + # FORCED_CHECK_TYPE is a copy of CHECK_TYPE as it is provided by force-enable. # This copy allowed us to workaround the overcomplicated legacy Valgrind processing logic # and here just check whether any Valgrind tool has been force-enabled or not. # Lack of Valgrind when it is force-enabled causes test failure. # Lack of Valgrind, when it was just required by the given test, causes a skip. - if [ "$FORCE_CHECK_TYPE" != "none" ]; then + if [ "$FORCED_CHECK_TYPE" != "none" ]; then msg=$(interactive_red STDOUT "FAIL:") - echo -e "$UNITTEST_NAME: $msg valgrind not installed" + echo -e "$UNITTEST_NAME: $msg Valgrind not installed" exit 1 else - msg "$UNITTEST_NAME: SKIP valgrind required" + msg=$(interactive_yellow STDOUT "SKIP:") + echo -e "$UNITTEST_NAME: $msg Valgrind required" exit 0 fi fi