Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix CHECK_TYPE behaviour #5868

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/test/RUNTESTS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
18 changes: 12 additions & 6 deletions src/test/unittest/unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading