diff options
author | Mike Williams <mike.williams@codethink.co.uk> | 2015-06-11 12:59:50 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-09-17 15:01:52 +0000 |
commit | 519a6460930c5ae08a9591035f72e88fd4db9b71 (patch) | |
tree | 27f12a4f8b0b1cbe0a82fc3cbb2a86cc33777d5e /check | |
parent | 07df32fbd57477e5808cdbace965edcd0a81348f (diff) | |
download | morph-519a6460930c5ae08a9591035f72e88fd4db9b71.tar.gz |
Force test suite to observe morph.conf tempdir
This change, suggested in story #16, causes the testing suite to use
the user-defined tempdir in /etc/morph.conf if it exists or continue
using /tmp if not. This will prevent the test suite from filling drives
that are not intended to be used for development work.
Change-Id: I94edabe4ea1eca7a55ece7424ece7bbd4b68c513
Diffstat (limited to 'check')
-rwxr-xr-x | check | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -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 |