tools/llvm: Do not build with symbols
[minix3.git] / external / bsd / byacc / dist / test / run_test.sh
blobf96c1c3e27bb05266f7b9842a90d6400fb4c4c5a
1 #!/bin/sh
2 # Id: run_test.sh,v 1.8 2012/01/15 11:50:35 tom Exp
3 # vi:ts=4 sw=4:
5 if test $# = 1
6 then
7 PROG_DIR=`pwd`
8 TEST_DIR=$1
9 else
10 PROG_DIR=..
11 TEST_DIR=.
14 YACC=$PROG_DIR/yacc
16 tmpfile=temp$$
17 rm -f test-*
19 echo '** '`date`
20 for input in ${TEST_DIR}/*.y
22 case $input in
23 test*)
24 echo "?? ignored $input"
27 root=`basename $input .y`
28 ROOT="test-$root"
29 prefix=${root}_
31 OPTS=
32 OPT2=
33 TYPE=".output .tab.c .tab.h"
34 case $input in
35 ${TEST_DIR}/code_*)
36 OPTS="$OPTS -r"
37 TYPE="$TYPE .code.c"
38 prefix=`echo "$prefix" | sed -e 's/^code_//'`
40 ${TEST_DIR}/pure_*)
41 OPTS="$OPTS -P"
42 prefix=`echo "$prefix" | sed -e 's/^pure_//'`
44 ${TEST_DIR}/quote_*)
45 OPT2="-s"
47 esac
49 for opt2 in "" $OPT2
51 $YACC $OPTS $opt2 -v -d -p $prefix -b $ROOT${opt2} $input
52 for type in $TYPE
54 REF=${TEST_DIR}/${root}${opt2}${type}
55 CMP=${ROOT}${opt2}${type}
56 if test ! -f $CMP
57 then
58 echo "...not found $CMP"
59 else
60 sed -e s,$CMP,$REF, \
61 -e /YYPATCH/d \
62 -e 's,#line \([1-9][0-9]*\) "'$TEST_DIR'/,#line \1 ",' \
63 < $CMP >$tmpfile \
64 && mv $tmpfile $CMP
65 if test ! -f $REF
66 then
67 mv $CMP $REF
68 echo "...saved $REF"
69 elif ( cmp -s $REF $CMP )
70 then
71 echo "...ok $REF"
72 rm -f $CMP
73 else
74 echo "...diff $REF"
75 diff -u $REF $CMP
78 done
79 done
81 esac
82 done