Merge branch 'release-2.140.189'
[feisty_meow.git] / testkit / prepare_tools.sh
index 9186522eed70a00fcc94b18844ed2c3f4ab103a8..5fe1a2278281c375fb035262869c419c55a0068a 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Author: Chris Koeritz
 #
@@ -43,6 +43,16 @@ GRITTY_TESTING_TOP_LEVEL="$(echo "$GRITTY_TESTING_TOP_LEVEL" | sed -e 's/\/cygdr
 # the top-level directory for tests, i.e. the root of testing hierarchy.
 export TESTKIT_ROOT="$GRITTY_TESTING_TOP_LEVEL"
 
+# location needed for shunit temporary files.
+export TMPDIR="$HOME/.shunit-temp"
+if [ ! -d "$TMPDIR" ]; then
+  mkdir -p "$TMPDIR"
+  if [ $? -ne 0 ]; then
+    echo "Failure during creation of TMPDIR for shunit!"
+    exit 1
+  fi
+fi
+
 # a bit of a dance to not pull in code too early...
 export TESTKIT_BOOTSTRAPPING=true
 source "$TESTKIT_ROOT/library/establish_environment.sh"
@@ -72,7 +82,7 @@ fi
 # commonly used environment variables...
 
 # TEST_TEMP is a folder where we can generate a collection of junk files.
-export TEST_TEMP="$TMP/testkit_logs_${USER}"
+export TEST_TEMP="$TMP/testkit_logs_$(sanitized_username)"
 if [ ! -d "$TEST_TEMP" ]; then
   mkdir -p "$TEST_TEMP"
 fi