Enhance test system

- Tests are now named
- Testlogs are preserved between runs
- Tests can be run through Valgrind Memcheck tool
This commit is contained in:
Petri Lehtinen
2009-07-26 22:44:11 +03:00
parent d3b3055a34
commit f60c563bab
9 changed files with 170 additions and 137 deletions

View File

@@ -1,20 +1,20 @@
#!/bin/sh
TESTFILES="${srcdir}/testdata/invalid ${srcdir}/testdata/invalid-unicode"
TMPDIR="tmp"
run_test() {
local prog=$1
local input=$2
local output=$3
run_testprog $prog $TMPDIR/$input
if ! cmp $TMPDIR/$output $TMPDIR/error >/dev/null; then
echo "### $input ($prog) failed:" >&2
cat $TMPDIR/$input >&2
local prefix=$2
run_testprog $prog $prefix
if ! cmp $prefix.out $prefix.$prog.stderr >/dev/null; then
echo >&2
echo "### $prefix ($prog) failed:" >&2
cat $prefix.in >&2
echo "### expected output:" >&2
cat $TMPDIR/$output >&2
cat $prefix.out >&2
echo "### actual output:" >&2
cat $TMPDIR/error >&2
cat $prefix.$prog.stderr >&2
exit 1
fi
}