]> scripts.mit.edu Git - wizard.git/blobdiff - tests/setup
Set admin e-mail address properly on MediaWiki >= 1.18.0
[wizard.git] / tests / setup
index e5a39c68926ded41ff4ebf425ab2787ffc9bbb72..c8c21ef707178a45f2f3ea4d4ebd4e9209751b4d 100644 (file)
@@ -1,8 +1,48 @@
 # 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
+#   APP = name of the application being tested
+# we produce $TESTDIR, $TESTID, $UVERSION and $APPVERSION
+# for config and test script to use.
 
-export WIZARD_ADMIN_NAME="admin"
-export WIZARD_ADMIN_PASSWORD="wizard"
+export PATH="`pwd`/../bin:$PATH"
+
+VERSION="$1"
+if [ "$VERSION" == "" ]; then
+    if [ "$DEFAULT_HEAD" == "1" ]; then
+        VERSION="head"
+    else
+        echo "Must specify version"
+        exit 1
+    fi
+fi
+
+# APPVERSION is directly interpolated into bash, so it can represent
+# 0 arguments.
+if [ "$VERSION" == "head" ]; then
+    APPVERSION="$APP"
+else
+    APPVERSION="$APP-$VERSION-scripts" # XXX incorrect if a -scripts2 version exists
+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
+