-# run all of the tests, building rmr before the first one.
-set -e
-ksh run_app_test.ksh -B
-ksh run_multi_test.ksh
-ksh run_rr_test.ksh
-ksh run_rts_test.ksh -s 20
+# run all of the tests, building rmr before the first one if -B is on the command line.
+
+function run_test {
+ if [[ -n $capture_file ]]
+ then
+ if ! ksh $@ >>$capture_file 2>&1
+ then
+ echo "[FAIL] test failed; see $capture_file"
+ (( errors++ ))
+ fi
+ else
+ if ! ksh $@
+ then
+ (( errors++ ))
+ fi
+ fi
+}
+
+build=""
+errors=0
+
+while [[ $1 == "-"* ]]
+do
+ case $1 in
+ -B) build="-B";;
+ -e) capture_file=$2; >$capture_file; shift;;
+ -i) installed="-i";;
+
+ *) echo "'$1' is not a recognised option and is ignored";;
+ esac
+
+ shift
+done
+
+echo "----- app --------------------"
+run_test run_app_test.ksh -v $installed $build
+
+echo "----- multi ------------------"
+run_test run_multi_test.ksh
+
+echo "----- round robin -----------"
+run_test run_rr_test.ksh
+
+echo "----- rts -------------------"
+run_test run_rts_test.ksh -s 20
+
+echo "----- extended payload ------"
+run_test run_exrts_test.ksh -d 10 -n 1000
+
+if (( errors == 0 ))
+then
+ echo "[PASS] all test pass"
+else
+ echo "[FAIL] one or more application to application tests failed"
+fi
+
+exit $(( !! errors ))