]> git.stg.codes - stg.git/blobdiff - functest/do.sh
Added functional test framework.
[stg.git] / functest / do.sh
diff --git a/functest/do.sh b/functest/do.sh
new file mode 100755 (executable)
index 0000000..77d928a
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+MKTEMP=/usr/bin/mktemp
+RM=/bin/rm
+
+printf "Creating temporary dir... "
+DIR=`$MKTEMP -d`
+
+if [ "$DIR" == "" ]
+then
+    printf "Failed.\nTemporary dir is empty.\n"
+    exit -1
+fi
+
+if [ ! -d "$DIR" ]
+then
+    printf "Failed.\nTemporary dir '$DIR' does not exist or not a directory.\n"
+    exit -1
+fi
+
+LOGFILE=`date "+%Y-%m-%d-%H%M%S.log"`
+
+printf "Ok.\nCloning... "
+./clone.sh "$DIR" >> "$LOGFILE" 2>&1
+if [ "$?" != "0" ]
+then
+    printf "Failed.\n"
+    exit -1
+else
+    printf "Ok.\nBuilding... "
+fi
+./build.sh "$DIR" >> "$LOGFILE" 2>&1
+if [ "$?" != "0" ]
+then
+    printf "Failed.\n"
+    exit -1
+else
+    printf "Ok.\nTesting... "
+fi
+./test.sh "$DIR" # >> "$LOGFILE" 2>&1
+if [ "$?" != "0" ]
+then
+    printf "Failed.\n"
+    exit -1
+else
+    printf "Ok.\nCleaning up... "
+fi
+
+$RM -rf $DIR
+if [ "$?" != "0" ]
+then
+    printf "Failed.\n"
+    exit -1
+else
+    printf "Ok.\n"
+fi