[arch-projects] [dbscripts] [PATCH 05/11] test/: make TMPDIR configurable via config.testing
Luke Shumaker
lukeshu at sbcglobal.net
Sun May 17 23:44:13 UTC 2015
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.
---
config.testing | 5 +++++
test/lib/common.inc | 7 +++----
2 files changed, 8 insertions(+), 4 deletions(-)
create mode 100644 config.testing
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')
--
2.4.1
More information about the arch-projects
mailing list