summaryrefslogtreecommitdiff
path: root/test/test.sh
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-10-06 12:44:10 +0000
committerEvan Huus <eapache@gmail.com>2013-10-06 12:44:10 +0000
commite0cc11c92b16e3128cfa93c6fab07540e785f018 (patch)
treec7c740c52cec6004400ee1bbcf0fd5c91fb76975 /test/test.sh
parentf5cebd0ef9c446eea4b4bce871a0af9160d37390 (diff)
downloadwireshark-e0cc11c92b16e3128cfa93c6fab07540e785f018.tar.gz
From Peter Wu via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9174
Support running most tests out-of-tree. Use case is to have a source tree and use a semi-unprivileged user to perform tests (to rule out interference). From me: - fix unit-test suite, it has to build the binaries it runs so it must more-or-less ignore the out-of-tree stuff - fix name-res suite, just missing a path qualifier svn path=/trunk/; revision=52397
Diffstat (limited to 'test/test.sh')
-rwxr-xr-xtest/test.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test.sh b/test/test.sh
index af8ae075a1..47e2465655 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -73,6 +73,25 @@ source suite-fileformats.sh
source suite-decryption.sh
source suite-nameres.sh
+# needed by some tests
+TEST_OUTDIR=$(mktemp -d)
+TEST_OUTDIR_CLEAN=${TEST_OUTDIR_CLEAN:-1}
+if [ -z "$TEST_OUTDIR" ] || ! cd "$TEST_OUTDIR"; then
+ # If for any reason the temporary tests output directory cannot be created...
+ TEST_OUTDIR=.
+ TEST_OUTDIR_CLEAN=0
+fi
+
+test_cleanup() {
+ if [ $TEST_OUTDIR_CLEAN = 1 ]; then
+ # display contents of test outputs
+ grep -r . .
+ rm -rf "$TEST_OUTDIR"
+ else
+ echo "Test results are available in $TEST_OUTDIR"
+ fi
+}
+trap test_cleanup EXIT
#check prerequisites
test_step_prerequisites() {