rewriting the testing infrastructure
authorVictor Grishchenko <victor.grishchenko@gmail.com>
Wed, 20 Jan 2010 15:58:50 +0000 (16:58 +0100)
committerVictor Grishchenko <victor.grishchenko@gmail.com>
Wed, 20 Jan 2010 15:58:50 +0000 (16:58 +0100)
mfold/build.default.sh [new file with mode: 0644]
mfold/docmd.sh [new file with mode: 0755]
mfold/doseq.sh [new file with mode: 0755]

diff --git a/mfold/build.default.sh b/mfold/build.default.sh
new file mode 100644 (file)
index 0000000..a2fb0f9
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+if ! which git || ! which g++ || ! which scons || ! which make ; then
+    sudo apt-get -y install make g++ scons git-core || exit -4
+fi
+
+if [ ! -e ~/include/gtest/gtest.h ]; then
+    mkdir tmp
+    cd tmp || exit -3
+    wget -c http://googletest.googlecode.com/files/gtest-1.4.0.tar.bz2 || exit -2
+    rm -rf gtest-1.4.0
+    tar -xjf gtest-1.4.0.tar.bz2 || exit -1
+    cd gtest-1.4.0 || exit 1
+    ./configure --prefix=$HOME || exit 2
+    make || exit 3
+    make install || exit 4
+fi
+
+if [ ! -e swift ]; then
+    git clone git://github.com/gritzko/swift.git || exit 6
+fi
+cd swift
+git pull || exit 5
+
+CPPPATH=~/include LIBPATH=~/lib scons -j4 || exit 7
+tests/connecttest || exit 8
+
diff --git a/mfold/docmd.sh b/mfold/docmd.sh
new file mode 100755 (executable)
index 0000000..e0a2963
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+HOST=$1
+CMD=$2
+
+if [ -e $CMD.$HOST.sh ] ; then 
+    SHSC=$CMD.$HOST.sh ;
+else 
+    SHSC=$CMD.default.sh ;
+fi
+
+if ( cat $SHSC | ssh $HOST ) > .$HOST.$CMD.out 2> .$HOST.$CMD.err; then
+    echo $HOST  $CMD    OK
+    exit 0
+else
+    echo $HOST  $CMD    FAIL
+    cat .$HOST.$CMD.out .$HOST.$CMD.err
+    exit 1
+fi
diff --git a/mfold/doseq.sh b/mfold/doseq.sh
new file mode 100755 (executable)
index 0000000..30e0461
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+# This script executes a chain of commands
+# on all the member servers, in parallel.
+# Commands are defined in .sh files (see
+# docmd.sh); all failed executions are
+# put to the FAILURES file
+rm -f FAILURES
+for srv in `cat servers.txt`; do
+    ( for cmd in $@; do
+        if ! ./docmd.sh $srv $cmd; then
+            echo $srv >> FAILURES
+            echo $src FAILED
+            break
+        fi
+    done ) &
+done
+
+wait
+echo DONE