summaryrefslogtreecommitdiffstats
path: root/tests/shell/helpers/test-wrapper.sh
blob: f811b44aab0dbdb759d2755c6cc3a753f7f71578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash -e

# This wrapper wraps the invocation of the test. It is called by run-tests.sh,
# and already in the unshared namespace.
#
# For some printf debugging, you can also patch this file.

TEST="$1"

printf '%s\n' "$TEST" > "$NFT_TEST_TESTTMPDIR/name"

rc_test=0
"$TEST" |& tee "$NFT_TEST_TESTTMPDIR/testout.log" || rc_test=$?

if [ "$rc_test" -eq 0 ] ; then
	echo "$rc_test" > "$NFT_TEST_TESTTMPDIR/rc_test-ok"
else
	echo "$rc_test" > "$NFT_TEST_TESTTMPDIR/rc_test-failed"
fi

$NFT list ruleset > "$NFT_TEST_TESTTMPDIR/ruleset-after"

exit "$rc_test"