aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-06-28 00:34:07 +0200
committerPeter Wu <peter@lekensteyn.nl>2016-06-27 22:42:01 +0000
commit9b91e64fee7dfdbeef3d8602a8af6c8d0d8a788c (patch)
tree26ebcfa797104782ef1e4b1532266919d7abdd27 /test
parente69194ae6513aa0bbf2728df09ec9133ae379714 (diff)
test: ensure temporary directory outside source tree
The whole point of using mktemp is to get a temporary directory outside the source tree. Commit v2.1.0rc0-1027-ge01f8fb tried to fix the invocation for *BSD (including OS X), but by adding a template it dropped the implicit --tmpdir option for GNU mktemp on Linux.. Use the GNU mktemp invocation and if it fails (for example, because a template is expected for BSD/OS X), provide a template. Change-Id: I77bbc7dc2045e4fa756e102afa080860b0857713 Reviewed-on: https://code.wireshark.org/review/16178 Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'test')
-rwxr-xr-xtest/test.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/test.sh b/test/test.sh
index 323293b33f..d4fcc762ff 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -77,7 +77,7 @@ source $MYDIR/test-backend.sh
source $MYDIR/config.sh
# needed by some tests
-TEST_OUTDIR="$PWD/$(mktemp -d wstest.XXXXXXXXXX)"
+TEST_OUTDIR="$(mktemp -d 2>/dev/null || mktemp -d ${TMPDIR:-/tmp}/wstest.XXXXXXXXXX)"
if [ $? -ne 0 ] || [ ! -d "$TEST_OUTDIR" ] || ! cd "$TEST_OUTDIR"; then
# Error out if TEST_OUTDIR cannot be created
echo "Failed to create directory '$TEST_OUTDIR'"