From d3f58f8aee3f286ec0565d15758acbcf65f69ae0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 23 Nov 2017 14:03:23 +0100 Subject: [PATCH] tests: rename --memcheck to --memcheck-valgrind Signed-off-by: Karel Zak --- tests/functions.sh | 27 ++++++++++++++++++--------- tests/run.sh | 22 +++++++++++----------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/tests/functions.sh b/tests/functions.sh index 58db7475f6..7152a4e33a 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -280,7 +280,7 @@ function ts_init_env { TS_PARSABLE=$(ts_has_option "parsable" "$*") [ "$TS_PARSABLE" = "yes" ] || TS_PARSABLE="$TS_PARALLEL" - tmp=$( ts_has_option "memcheck" "$*") + tmp=$( ts_has_option "memcheck-valgrind" "$*") if [ "$tmp" == "yes" -a -f /usr/bin/valgrind ]; then TS_VALGRIND_CMD="/usr/bin/valgrind" fi @@ -377,12 +377,19 @@ function ts_init_py { } function ts_run { - if [ -z "$TS_VALGRIND_CMD" ]; then - "$@" - else + # + # valgrind mode + # + if [ -n "$TS_VALGRIND_CMD" ]; then $TS_VALGRIND_CMD --tool=memcheck --leak-check=full \ --leak-resolution=high --num-callers=20 \ --log-file="$TS_VGDUMP" "$@" + + # + # Default mode + # + else + "$@" fi } @@ -415,11 +422,13 @@ function ts_gen_diff { } function tt_gen_mem_report { - [ -z "$TS_VALGRIND_CMD" ] && echo "$1" - - grep -q -E 'ERROR SUMMARY: [1-9]' $TS_VGDUMP &> /dev/null - if [ $? -eq 0 ]; then - echo "mem-error detected!" + if [ -n "$TS_VALGRIND_CMD" ]; then + grep -q -E 'ERROR SUMMARY: [1-9]' $TS_VGDUMP &> /dev/null + if [ $? -eq 0 ]; then + echo "mem-error detected!" + fi + else + echo "$1" fi } diff --git a/tests/run.sh b/tests/run.sh index 071fb8f5ff..1d4cc9d218 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -45,7 +45,7 @@ while [ -n "$1" ]; do case "$1" in --force |\ --fake |\ - --memcheck |\ + --memcheck-valgrind |\ --show-diff |\ --verbose |\ --skip-loopdevs |\ @@ -79,16 +79,16 @@ while [ -n "$1" ]; do echo "Usage: " echo " $(basename $0) [options] [ ...]" echo "Options:" - echo " --force execute demanding tests" - echo " --fake do not run, setup tests only" - echo " --memcheck run with valgrind" - echo " --verbose verbose mode" - echo " --show-diff show diff from failed tests" - echo " --nonroot ignore test suite if user is root" - echo " --srcdir= autotools top source directory" - echo " --builddir= autotools top build directory" - echo " --parallel= number of parallel test jobs, default: num cpus" - echo " --exclude= exclude tests by list '/ ..'" + echo " --force execute demanding tests" + echo " --fake do not run, setup tests only" + echo " --memcheck-valgrind run with valgrind" + echo " --verbose verbose mode" + echo " --show-diff show diff from failed tests" + echo " --nonroot ignore test suite if user is root" + echo " --srcdir= autotools top source directory" + echo " --builddir= autotools top build directory" + echo " --parallel= number of parallel test jobs, default: num cpus" + echo " --exclude= exclude tests by list '/ ..'" echo exit 1 ;; -- 2.47.3