]> scripts.mit.edu Git - wizard.git/blobdiff - tests/setup
Make phpBB installer more friendly for restricted envs.
[wizard.git] / tests / setup
index 396969d7475e33b8ab05de3371cd107f1265d974..5ad70ccbad46267174b50604b9f51635a5bc6e07 100644 (file)
@@ -1,9 +1,40 @@
 # this file is meant to be source'd by any test script
+# we expect the source script to have specified:
+#   VERSION = version number to apply the test to
+#   TESTNAME = name of the test
+# we produce $TESTDIR and $TESTID for config and test script to use.
 
-TMPNAME="testdir_$TMPID"
-export WIZARD_ADMIN_NAME="admin"
-export WIZARD_ADMIN_PASSWORD="wizard"
+VERSION="$1"
+if [ "$VERSION" == "" ]; then
+    if [ "$DEFAULT_HEAD" == "1" ]; then
+        VERSION="head"
+    else
+        echo "Must specify version"
+        exit 1
+    fi
+fi
+
+UVERSION=`echo "$VERSION" | sed s/[-.]/_/g`
+TESTID="${TESTNAME}_$UVERSION"
+echo "$TESTID"
+TESTDIR="testdir_${TESTNAME}_$VERSION"
+if [ "$WIZARD_ADMIN_NAME" == "" ]; then
+    export WIZARD_ADMIN_NAME="admin"
+fi
+if [ "$WIZARD_ADMIN_PASSWORD" == "" ]; then
+    export WIZARD_ADMIN_PASSWORD="wizard"
+fi
 
 if [ -e "config" ]; then
-    source config
+    source ./config
 fi
+
+if [ -e "$TESTDIR" ]; then
+    echo "Removing previous $TESTDIR folder..."
+    wizard remove "$TESTDIR" || rm -Rf "$TESTDIR"
+fi
+
+if [ -e "prepare" ]; then
+    source ./prepare
+fi
+