summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck28
-rwxr-xr-xtests.branching/setup1
-rwxr-xr-xtests.build/setup1
-rw-r--r--yarns/implementations.yarn4
4 files changed, 31 insertions, 3 deletions
diff --git a/check b/check
index e3af5992..5aea6f55 100755
--- a/check
+++ b/check
@@ -86,6 +86,31 @@ do
shift
done
+# Find and set tempdir from morph.conf or use /tmp if it does not
+# exist. Since the config file can be quite complicated, we use the
+# Python ConfigParser module to find TMPDIR. We append a folder called
+# testSuite to this so any existing files are not removed.
+
+TMPDIR=$(
+ morph --dump-config | python -c '
+import sys, ConfigParser
+cp = ConfigParser.RawConfigParser()
+cp.readfp(sys.stdin)
+try:
+ print cp.get("config", "tempdir")
+except ConfigParser.NoOptionError:
+ print "/tmp"'
+)
+
+if [ "$TMPDIR" == "None" ]; then
+ TMPDIR="/tmp"
+fi
+
+TMPDIR="$TMPDIR/testSuite"
+
+mkdir -p "$TMPDIR"
+TMPDIR=$(mktemp -d -p "$TMPDIR")
+export TMPDIR
# Set PYTHONPATH to start with the current directory so that we always
# find the right version of it for the test suite.
@@ -138,7 +163,8 @@ fi
if "$run_yarns" && command -v yarn > /dev/null
then
- yarn --env "PYTHONPATH=$PYTHONPATH" $snapshot -s yarns/morph.shell-lib \
+ yarn --env "PYTHONPATH=$PYTHONPATH" --env "TMPDIR=$TMPDIR" $snapshot \
+ --tempdir "$TMPDIR" -s yarns/morph.shell-lib \
yarns/*.yarn
fi
diff --git a/tests.branching/setup b/tests.branching/setup
index 59979ca8..50a95e22 100755
--- a/tests.branching/setup
+++ b/tests.branching/setup
@@ -31,6 +31,7 @@ cat <<EOF > "$DATADIR/morph.conf"
repo-alias = test=file://$DATADIR/%s#file://$DATADIR/%s
cachedir = $DATADIR/cache
log = $DATADIR/morph.log
+tempdir = $TMPDIR
no-distcc = true
quiet = true
EOF
diff --git a/tests.build/setup b/tests.build/setup
index b7dc5074..054bdc3e 100755
--- a/tests.build/setup
+++ b/tests.build/setup
@@ -114,6 +114,7 @@ cat <<EOF > "$DATADIR/morph.conf"
repo-alias = test=file://$DATADIR/%s#file://$DATADIR/%s
cachedir = $DATADIR/cache
log = $DATADIR/morph.log
+tempdir = $TMPDIR
no-distcc = true
quiet = true
EOF
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index 3bef0374..ae9c2fae 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -411,14 +411,14 @@ another to hold a chunk.
[config]
repo-alias = test=git://127.0.0.1:$GIT_DAEMON_PORT/%s#git://127.0.0.1:$GIT_DAEMON_PORT/%s
cachedir = $DATADIR/cache
- tempdir = $DATADIR/tmp
+ tempdir = $TMPDIR
trove-host = 127.0.0.1
trove-id = testtrove
build-ref-prefix = testtrove/builds
EOF
mkdir "$DATADIR/cache"
- mkdir "$DATADIR/tmp"
+ mkdir -p "$TMPDIR"
Some resources are cleaned up by yarn, forked processes aren't one of
these, so need to shut down the git daemon after we finish.