aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2011-09-29 11:12:48 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2011-09-29 11:12:48 +0000
commite1e822434c97cd7ccba63dd03463a80785182f96 (patch)
treea1c197674b97964972a53662a270f181e5877e51
parentfcd133b462400b8570e48bd36f8650aadf3729c6 (diff)
added "-nolog" option to prevent outut to a logfile
svn path=/trunk/externals/zexy/; revision=15401
-rwxr-xr-xtests/runtests.sh43
1 files changed, 39 insertions, 4 deletions
diff --git a/tests/runtests.sh b/tests/runtests.sh
index 4660d8d..8907ce9 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -9,12 +9,26 @@ then
PD=pd
fi
+if which ${PD} > /dev/null
+then
+ :
+else
+ echo "Pd is needed to run tests" 1>&2
+ echo "you can specify the full binary in the PD variable" 1>&2
+ exit 77
+fi
+
#SUFFIX="$$"
SUFFIX=$(date +%y%m%d-%H%M%S)
RUNTESTS_TXT=runtests.txt
-RUNTESTS_LOG=log-runtests.${SUFFIX}
+if which tempfile > /dev/null
+then
+ RUNTESTS_LOG=$(tempfile)
+else
+ RUNTESTS_LOG=tmp$$.log
+fi
LIBFLAGS="-path ../src/.libs/:../src/:../ -lib zexy -path ../abs/"
@@ -54,7 +68,9 @@ evaluate_tests() {
echo "regression-test: ${numpass} regression-tests passed" >> ${logfile}
echo "regression-test: ${numfail} regression-tests failed" >> ${logfile}
echo "regression-test: ======================================" >> ${logfile}
- echo "regression-test: failed tests: ${failtests}" >> ${logfile}
+ if [ "x${failtests}" != "x" ]; then
+ echo "regression-test: failed tests: ${failtests}" >> ${logfile}
+ fi
debug "show results"
cat ${logfile} | egrep "^regression-test: " | sed -e 's/^regression-test: //'
}
@@ -63,6 +79,7 @@ evaluate_tests() {
run_nogui() {
debug "running test without gui"
${PD} ${LIBFLAGS} -nogui runtests_nogui.pd > ${RUNTESTS_LOG} 2>&1
+ SUCCESS=$?
debug "testing done"
evaluate_tests ${RUNTESTS_TXT} ${RUNTESTS_LOG}
debug "testing finished"
@@ -71,6 +88,7 @@ run_nogui() {
run_withgui() {
debug "running test with gui"
${PD} ${LIBFLAGS} -stderr runtests.pd 2>&1 | tee ${RUNTESTS_LOG}
+ SUCCESS=$?
echo "testing completed, no evaluation will be done; see ${RUNTESTS_LOG} for results"
}
@@ -79,7 +97,7 @@ list_tests > ${RUNTESTS_TXT}
USEGUI=""
DEBUG=""
-while [ "$@" ]
+while [ "x$#" != "x0" ]
do
if test "x$1" = "x-gui"; then
USEGUI="yes"
@@ -90,13 +108,30 @@ do
if test "x$1" = "x-d"; then
DEBUG="yes"
fi
+ if test "x$1" = "x-nolog"; then
+ RUNTESTS_FINAL_LOG=
+ fi
shift
done
+SUCCESS=0
if [ "x${USEGUI}" = "xyes" ]; then
run_withgui
else
run_nogui
fi
-echo $@
+if [ "x${RUNTESTS_FINAL_LOG}" = "x" ]; then
+ :
+else
+ echo ${RUNTESTS_LOG} ... ${RUNTESTS_FINAL_LOG}
+ cat ${RUNTESTS_LOG} >> ${RUNTESTS_FINAL_LOG}
+fi
+
+if [ "x${RUNTESTS_FINAL_LOG}" = "x${RUNTESTS_LOG}" ]; then
+ :
+else
+ rm -f ${RUNTESTS_LOG}
+fi
+
+exit ${SUCCESS}