From 0fe1d450c7a7d45cf5c011dd3c6dc0878a2210d2 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 14 Jun 2023 20:01:46 +0200 Subject: tests: shell: Introduce valgrind mode Pass flag '-V' to run-tests.sh to run all 'nft' invocations in valgrind leak checking environment. Code copied from iptables' shell-testsuite where it proved to be useful already. Signed-off-by: Phil Sutter --- tests/shell/run-tests.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'tests/shell/run-tests.sh') diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh index 931bba96..1a699875 100755 --- a/tests/shell/run-tests.sh +++ b/tests/shell/run-tests.sh @@ -69,6 +69,11 @@ if [ "$1" == "-g" ] ; then shift fi +if [ "$1" == "-V" ] ; then + VALGRIND=y + shift +fi + for arg in "$@"; do SINGLE+=" $arg" VERBOSE=y @@ -106,6 +111,48 @@ find_tests() { ${FIND} ${TESTDIR} -type f -executable | sort } +printscript() { # (cmd, tmpd) + cat <${tmpd}/nft + trap "rm ${tmpd}/nft" EXIT + chmod a+x ${tmpd}/nft + + NFT="${tmpd}/nft" +fi + echo "" ok=0 failed=0 -- cgit v1.2.3