From c6d88ba2bd43db9a3bcc19f27bf803921835c549 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 18 Mar 2018 11:23:10 -0400 Subject: tests: Add a --noclean option to preserve the test directory Useful for debugging testsuite failures. --- tests.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests.sh b/tests.sh index de0afb7..0809226 100755 --- a/tests.sh +++ b/tests.sh @@ -24,10 +24,15 @@ export TZ=UTC # The temporary directory that will hold our test data TMP="$(mktemp -d "${TMPDIR:-/tmp}"/bfs.XXXXXXXXXX)" -chown "$(id -u)":"$(id -g)" "$TMP" +chown "$(id -u):$(id -g)" "$TMP" # Clean up temporary directories on exit +CLEAN=yes function cleanup() { + if [ ! "$CLEAN" ]; then + return + fi + rm -rf "$TMP" } trap cleanup EXIT @@ -440,6 +445,9 @@ for arg; do GNU=yes ALL=yes ;; + --noclean) + CLEAN= + ;; --update) UPDATE=yes ;; @@ -457,7 +465,11 @@ for arg; do esac done -if [ -z "$EXPLICIT" ]; then +if [ ! "$CLEAN" ]; then + echo "Test files saved to $TMP" +fi + +if [ ! "$EXPLICIT" ]; then enable_tests "${posix_tests[@]}" [ "$BSD" ] && enable_tests "${bsd_tests[@]}" [ "$GNU" ] && enable_tests "${gnu_tests[@]}" -- cgit v1.2.3