diff options
author | mescalinum <mescalinum@users.sourceforge.net> | 2011-11-17 10:36:08 +0000 |
---|---|---|
committer | mescalinum <mescalinum@users.sourceforge.net> | 2011-11-17 10:36:08 +0000 |
commit | 6e70f33a440fe6c7420c7406af83981be8691ef7 (patch) | |
tree | e31f6c13601a3ad71c95e5977729a767e5b71b3e /tests/runtest.sh | |
parent | 74ec984c0b4c7b009d103f1e7169a8c862d78ccb (diff) |
minimal test system. more testcases to come.
svn path=/trunk/externals/loaders/tclpd/; revision=15783
Diffstat (limited to 'tests/runtest.sh')
-rw-r--r-- | tests/runtest.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/runtest.sh b/tests/runtest.sh new file mode 100644 index 0000000..8998b21 --- /dev/null +++ b/tests/runtest.sh @@ -0,0 +1,36 @@ +if [ -z "$1" ]; then + # no argument - run all tests found in current dir + set -e + for i in *.ref; do sh $0 "${i/.ref/}"; done + exit 0 +fi +KEEP_OUTPUT=0 +if [ "x$1" = "x-k" ]; then + KEEP_OUTPUT=1 + shift +fi +if [ ! -f "$1.pd" ]; then + echo -e "error: $1.pd does not exist" 1>&2 + exit 1 +fi +if [ ! -f "$1.ref" ]; then + echo -e "error: $1.ref does not exist" 1>&2 + exit 1 +fi +sed -e "s|%TESTCASE%|$1|" -e "s|%OUTPUT%|$1.out|" runtest.pd.in > "runtest-$1.pd" || exit 1 +echo -n "Running test '$1'... "; +"$PD_PATH/bin/pd" -noprefs -nogui -path .. -lib tclpd "runtest-$1.pd" +diff --strip-trailing-cr "$1.ref" "$1.out" 1>/dev/null 2>&1 +RESULT=$? +if [ $RESULT -eq 0 ]; then + echo "OK" +else + echo "FAIL" + # show differences: + diff -u --strip-trailing-cr "$1.ref" "$1.out" +fi +rm -f "runtest-$1.pd" +if [ $KEEP_OUTPUT -eq 0 ]; then + rm -f "$1.out" +fi +exit $RESULT |