2012-06-06 15:25:48 +02:00
|
|
|
#!/bin/sh
|
2013-12-06 12:04:52 +01:00
|
|
|
# Id: run_test.sh,v 1.8 2012/01/15 11:50:35 tom Exp
|
2012-06-06 15:25:48 +02:00
|
|
|
# vi:ts=4 sw=4:
|
|
|
|
|
|
|
|
if test $# = 1
|
|
|
|
then
|
|
|
|
PROG_DIR=`pwd`
|
|
|
|
TEST_DIR=$1
|
|
|
|
else
|
|
|
|
PROG_DIR=..
|
|
|
|
TEST_DIR=.
|
|
|
|
fi
|
|
|
|
|
|
|
|
YACC=$PROG_DIR/yacc
|
|
|
|
|
|
|
|
tmpfile=temp$$
|
2013-12-06 12:04:52 +01:00
|
|
|
rm -f test-*
|
2012-06-06 15:25:48 +02:00
|
|
|
|
|
|
|
echo '** '`date`
|
2013-12-06 12:04:52 +01:00
|
|
|
for input in ${TEST_DIR}/*.y
|
2012-06-06 15:25:48 +02:00
|
|
|
do
|
2013-12-06 12:04:52 +01:00
|
|
|
case $input in
|
2012-06-06 15:25:48 +02:00
|
|
|
test*)
|
2013-12-06 12:04:52 +01:00
|
|
|
echo "?? ignored $input"
|
2012-06-06 15:25:48 +02:00
|
|
|
;;
|
|
|
|
*)
|
2013-12-06 12:04:52 +01:00
|
|
|
root=`basename $input .y`
|
2012-06-06 15:25:48 +02:00
|
|
|
ROOT="test-$root"
|
|
|
|
prefix=${root}_
|
|
|
|
|
|
|
|
OPTS=
|
2013-12-06 12:04:52 +01:00
|
|
|
OPT2=
|
2012-06-06 15:25:48 +02:00
|
|
|
TYPE=".output .tab.c .tab.h"
|
2013-12-06 12:04:52 +01:00
|
|
|
case $input in
|
2012-06-06 15:25:48 +02:00
|
|
|
${TEST_DIR}/code_*)
|
|
|
|
OPTS="$OPTS -r"
|
|
|
|
TYPE="$TYPE .code.c"
|
|
|
|
prefix=`echo "$prefix" | sed -e 's/^code_//'`
|
|
|
|
;;
|
|
|
|
${TEST_DIR}/pure_*)
|
|
|
|
OPTS="$OPTS -P"
|
|
|
|
prefix=`echo "$prefix" | sed -e 's/^pure_//'`
|
|
|
|
;;
|
2013-12-06 12:04:52 +01:00
|
|
|
${TEST_DIR}/quote_*)
|
|
|
|
OPT2="-s"
|
|
|
|
;;
|
2012-06-06 15:25:48 +02:00
|
|
|
esac
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
for opt2 in "" $OPT2
|
2012-06-06 15:25:48 +02:00
|
|
|
do
|
2013-12-06 12:04:52 +01:00
|
|
|
$YACC $OPTS $opt2 -v -d -p $prefix -b $ROOT${opt2} $input
|
|
|
|
for type in $TYPE
|
|
|
|
do
|
|
|
|
REF=${TEST_DIR}/${root}${opt2}${type}
|
|
|
|
CMP=${ROOT}${opt2}${type}
|
|
|
|
if test ! -f $CMP
|
|
|
|
then
|
|
|
|
echo "...not found $CMP"
|
|
|
|
else
|
|
|
|
sed -e s,$CMP,$REF, \
|
|
|
|
-e /YYPATCH/d \
|
|
|
|
-e 's,#line \([1-9][0-9]*\) "'$TEST_DIR'/,#line \1 ",' \
|
|
|
|
< $CMP >$tmpfile \
|
|
|
|
&& mv $tmpfile $CMP
|
|
|
|
if test ! -f $REF
|
|
|
|
then
|
|
|
|
mv $CMP $REF
|
|
|
|
echo "...saved $REF"
|
|
|
|
elif ( cmp -s $REF $CMP )
|
|
|
|
then
|
|
|
|
echo "...ok $REF"
|
|
|
|
rm -f $CMP
|
|
|
|
else
|
|
|
|
echo "...diff $REF"
|
|
|
|
diff -u $REF $CMP
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2012-06-06 15:25:48 +02:00
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|