From 458298a4336477d1d6c2b1fe838e0e85a7464dc1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 6 Oct 2023 11:42:19 +0200 Subject: tests/shell: preserve result directory with NFT_TEST_FAIL_ON_SKIP On a successful run, the result directory will be deleted (unless run with "-k|--keep-logs" option or NFT_TEST_KEEP_LOGS=y). With NFT_TEST_FAIL_ON_SKIP=y, when there are no failures but skipped tests, also preserve the result. Signed-off-by: Thomas Haller Signed-off-by: Pablo Neira Ayuso --- tests/shell/run-tests.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh index 4ff0b55a..7672b2fe 100755 --- a/tests/shell/run-tests.sh +++ b/tests/shell/run-tests.sh @@ -850,7 +850,12 @@ echo "" kmemleak_found=0 check_kmemleak_force -if [ "$failed" -gt 0 ] || [ "$NFT_TEST_FAIL_ON_SKIP" = y -a "$skipped" -gt 0 ] ; then +failed_total="$failed" +if [ "$NFT_TEST_FAIL_ON_SKIP" = y ] ; then + failed_total="$((failed_total + skipped))" +fi + +if [ "$failed_total" -gt 0 ] ; then RR="$RED" elif [ "$skipped" -gt 0 ] ; then RR="$YELLOW" @@ -875,7 +880,7 @@ END_TIME="$(cut -d ' ' -f1 /proc/uptime)" WALL_TIME="$(awk -v start="$START_TIME" -v end="$END_TIME" "BEGIN { print(end - start) }")" printf "%s\n" "$WALL_TIME" "$START_TIME" "$END_TIME" > "$NFT_TEST_TMPDIR/times" -if [ "$failed" -gt 0 -o "$NFT_TEST_KEEP_LOGS" = y ] ; then +if [ "$failed_total" -gt 0 -o "$NFT_TEST_KEEP_LOGS" = y ] ; then msg_info "check the temp directory \"$NFT_TEST_TMPDIR\" (\"$NFT_TEST_LATEST\")" msg_info " ls -lad \"$NFT_TEST_LATEST\"/*/*" msg_info " grep -R ^ \"$NFT_TEST_LATEST\"/" -- cgit v1.2.3