2009-07-10 02:01:40 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2009-07-18 20:59:55 +08:00
|
|
|
TESTFILES="${srcdir}/testdata/valid"
|
2009-07-10 02:01:40 +08:00
|
|
|
TMPDIR="tmp"
|
|
|
|
|
|
|
|
run_test() {
|
|
|
|
local prog=$1
|
|
|
|
local input=$2
|
|
|
|
local output=$3
|
|
|
|
run_testprog $prog $TMPDIR/$input
|
|
|
|
if ! ${srcdir}/json-compare.py $TMPDIR/$input $TMPDIR/output \
|
|
|
|
>$TMPDIR/cmp-output
|
|
|
|
then
|
|
|
|
echo "### $input ($prog) failed:" >&2
|
|
|
|
cat $TMPDIR/$input >&2
|
|
|
|
if [ -f $TMPDIR/output ]; then
|
|
|
|
echo "### output:" >&2
|
|
|
|
cat $TMPDIR/output >&2
|
|
|
|
fi
|
|
|
|
if [ -s $TMPDIR/cmp-output ]; then
|
|
|
|
echo "### compare output:" >&2
|
|
|
|
cat $TMPDIR/cmp-output >&2
|
|
|
|
fi
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
rm -f $TMPDIR/output
|
|
|
|
rm -f $TMPDIR/cmp-output
|
|
|
|
}
|
|
|
|
|
|
|
|
. ${srcdir}/run-test
|