]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: rename --memcheck to --memcheck-valgrind
authorKarel Zak <kzak@redhat.com>
Thu, 23 Nov 2017 13:03:23 +0000 (14:03 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 23 Nov 2017 13:03:23 +0000 (14:03 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/functions.sh
tests/run.sh

index 58db7475f63c934edb7e51678abe2a3ffb661434..7152a4e33a25295ccab33eaef1ce20bf82cc8f87 100644 (file)
@@ -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
 }
 
index 071fb8f5ffb5e43990c4038c442ce1aec38eb3d5..1d4cc9d218a1f960d29130aef39b0a358b6bf7c3 100755 (executable)
@@ -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] [<component> ...]"
                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=<path>   autotools top source directory"
-               echo "  --builddir=<path> autotools top build directory"
-               echo "  --parallel=<num>  number of parallel test jobs, default: num cpus"
-               echo "  --exclude=<list>  exclude tests by list '<utilname>/<testname> ..'"
+               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=<path>      autotools top source directory"
+               echo "  --builddir=<path>    autotools top build directory"
+               echo "  --parallel=<num>     number of parallel test jobs, default: num cpus"
+               echo "  --exclude=<list>     exclude tests by list '<utilname>/<testname> ..'"
                echo
                exit 1
                ;;