diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-05-17 18:00:00 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-17 14:46:09 -0400 |
commit | 6c36c3fac724435328d1ba3df47b435087ef9795 (patch) | |
tree | d73fbad6f41edd62b1dafc47e054c04235ae5d9a | |
parent | d6e88e1a3fcddb4ef1717174e88d9a9f0a386357 (diff) |
test/: make TMPDIR configurable via config.testing
Because common.inc is included in nested calls, to prevent later calls
from overriding earlier calls, we export MASTER_TMPDIR to signal the
top-level value.
Calls to mktemp have also bee adjusted to obey TMPDIR.
-rw-r--r-- | config.testing | 5 | ||||
-rw-r--r-- | test/lib/common.inc | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/config.testing b/config.testing new file mode 100644 index 0000000..a7ec4d1 --- /dev/null +++ b/config.testing @@ -0,0 +1,5 @@ +#!/hint/bash + +# override the default TMPDIR +[[ -n $MASTER_TMPDIR ]] || export MASTER_TMPDIR="$(mktemp -dt "${0##*/}.XXXXXXXXXX")" +TMPDIR=$MASTER_TMPDIR diff --git a/test/lib/common.inc b/test/lib/common.inc index bb3db5b..9a7e4d9 100644 --- a/test/lib/common.inc +++ b/test/lib/common.inc @@ -1,8 +1,7 @@ set -E . "$(dirname "${BASH_SOURCE[0]}")/../../config" -# override the default TMPDIR -TMPDIR="$(mktemp -d "/tmp/${0##*/}.XXXXXXXXXX")" +. "$(dirname "${BASH_SOURCE[0]}")/../../config.testing" . "$(dirname "${BASH_SOURCE[0]}")/../../db-functions" signpkg() { @@ -28,7 +27,7 @@ oneTimeSetUp() { local pkgarch local pkgversion local build - pkgdir="$(mktemp -d "/tmp/${0##*/}.XXXXXXXXXX")" + pkgdir="$(mktemp -dt "${0##*/}.XXXXXXXXXX")" cp -Lr "$(dirname "${BASH_SOURCE[0]}")"/../packages/* "${pkgdir}" msg 'Building packages...' for d in "${pkgdir}"/*; do @@ -73,7 +72,7 @@ setUp() { local a [ -f "$(dirname "${BASH_SOURCE[0]}")/../../config.local" ] && die "$(dirname "${BASH_SOURCE[0]}")/../../config.local exists" - TMP="$(mktemp -d "/tmp/${0##*/}.XXXXXXXXXX")" + TMP="$(mktemp -dt "${0##*/}.XXXXXXXXXX")" #msg "Using ${TMP}" PKGREPOS=('core' 'extra' 'testing') |