summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-03-18 11:23:10 -0400
committerTavian Barnes <tavianator@tavianator.com>2018-03-18 12:34:08 -0400
commitc6d88ba2bd43db9a3bcc19f27bf803921835c549 (patch)
treea042ae5192a382e4e84c90a38d26ea33ae755553
parentc3b43840431b059266df6c8fcc051598e38457ef (diff)
downloadbfs-c6d88ba2bd43db9a3bcc19f27bf803921835c549.tar.xz
tests: Add a --noclean option to preserve the test directory
Useful for debugging testsuite failures.
-rwxr-xr-xtests.sh16
1 files 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[@]}"