summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorKarel Zak2017-11-23 14:03:23 +0100
committerKarel Zak2017-11-23 14:03:23 +0100
commitd3f58f8aee3f286ec0565d15758acbcf65f69ae0 (patch)
tree2b08075eec488ffe77c8b463b0391c2c04d0f0ed /tests/functions.sh
parenttests: rename ts_valgrind to ts_run (diff)
downloadkernel-qcow2-util-linux-d3f58f8aee3f286ec0565d15758acbcf65f69ae0.tar.gz
kernel-qcow2-util-linux-d3f58f8aee3f286ec0565d15758acbcf65f69ae0.tar.xz
kernel-qcow2-util-linux-d3f58f8aee3f286ec0565d15758acbcf65f69ae0.zip
tests: rename --memcheck to --memcheck-valgrind
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh27
1 files changed, 18 insertions, 9 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index 58db7475f..7152a4e33 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
}