summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtests/shell/helpers/nft-valgrind-wrapper.sh15
-rwxr-xr-xtests/shell/helpers/test-wrapper.sh13
-rwxr-xr-xtests/shell/run-tests.sh4
3 files changed, 26 insertions, 6 deletions
diff --git a/tests/shell/helpers/nft-valgrind-wrapper.sh b/tests/shell/helpers/nft-valgrind-wrapper.sh
index 9da50d4d..ad8cc74b 100755
--- a/tests/shell/helpers/nft-valgrind-wrapper.sh
+++ b/tests/shell/helpers/nft-valgrind-wrapper.sh
@@ -1,6 +1,6 @@
#!/bin/bash -e
-SUFFIX="$(date '+%Y%m%d-%H%M%S.%6N')"
+SUFFIX="$(date "+%Y%m%d-%H%M%S.%6N.$$")"
rc=0
libtool \
@@ -10,8 +10,21 @@ libtool \
--trace-children=yes \
--leak-check=full \
--show-leak-kinds=all \
+ --num-callers=100 \
+ --error-exitcode=122 \
+ $NFT_TEST_VALGRIND_OPTS \
"$NFT_REAL" \
"$@" \
|| rc=$?
+if [ "$rc" -eq 122 ] ; then
+ shopt -s nullglob
+ FILES=( "$NFT_TEST_TESTTMPDIR/valgrind.$SUFFIX."*".log" )
+ shopt -u nullglob
+ (
+ printf '%s\n' "args: $*"
+ printf '%s\n' "${FILES[*]}"
+ ) >> "$NFT_TEST_TESTTMPDIR/rc-failed-valgrind"
+fi
+
exit $rc
diff --git a/tests/shell/helpers/test-wrapper.sh b/tests/shell/helpers/test-wrapper.sh
index f8b27b1e..405e70c8 100755
--- a/tests/shell/helpers/test-wrapper.sh
+++ b/tests/shell/helpers/test-wrapper.sh
@@ -78,13 +78,18 @@ if [ "$rc_dump" -ne 0 ] ; then
echo "$DUMPFILE" > "$NFT_TEST_TESTTMPDIR/rc-failed-dump"
fi
+rc_valgrind=0
+[ -f "$NFT_TEST_TESTTMPDIR/rc-failed-valgrind" ] && rc_valgrind=122
+
rc_tainted=0
if [ "$tainted_before" != "$tainted_after" ] ; then
echo "$tainted_after" > "$NFT_TEST_TESTTMPDIR/rc-failed-tainted"
rc_tainted=123
fi
-if [ "$rc_tainted" -ne 0 ] ; then
+if [ "$rc_valgrind" -ne 0 ] ; then
+ rc_exit="$rc_valgrind"
+elif [ "$rc_tainted" -ne 0 ] ; then
rc_exit="$rc_tainted"
elif [ "$rc_test" -ge 118 -a "$rc_test" -le 124 ] ; then
# Special exit codes are reserved. Coerce them.
@@ -101,9 +106,9 @@ fi
# We always write the real exit code of the test ($rc_test) to one of the files
# rc-{ok,skipped,failed}, depending on which it is.
#
-# Note that there might be other rc-failed-{dump,tainted} files with additional
-# errors. Note that if such files exist, the overall state will always be
-# failed too (and an "rc-failed" file exists).
+# Note that there might be other rc-failed-{dump,tainted,valgrind} files with
+# additional errors. Note that if such files exist, the overall state will
+# always be failed too (and an "rc-failed" file exists).
#
# On failure, we also write the combined "$rc_exit" code from "test-wrapper.sh"
# to "rc-failed-exit" file.
diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
index c8688587..ab91fd4d 100755
--- a/tests/shell/run-tests.sh
+++ b/tests/shell/run-tests.sh
@@ -527,7 +527,9 @@ print_test_result() {
else
((failed++))
result_msg_level="W"
- if [ "$rc_got" -eq 123 ] ; then
+ if [ "$rc_got" -eq 122 ] ; then
+ result_msg_status="VALGRIND"
+ elif [ "$rc_got" -eq 123 ] ; then
result_msg_status="TAINTED"
elif [ "$rc_got" -eq 124 ] ; then
result_msg_status="DUMP FAIL"