1*3ee4fc2aSCody Peter Mello#!/bin/bash 2*3ee4fc2aSCody Peter Mello 3*3ee4fc2aSCody Peter Melloif [[ -z "$AWK" || -z "$WORKDIR" ]]; then 4*3ee4fc2aSCody Peter Mello printf '$AWK and $WORKDIR must be set\n' >&2 5*3ee4fc2aSCody Peter Mello exit 1 6*3ee4fc2aSCody Peter Mellofi 7*3ee4fc2aSCody Peter Mello 8*3ee4fc2aSCody Peter MelloTEMP0=$WORKDIR/test.temp.0 9*3ee4fc2aSCody Peter MelloTEMP1=$WORKDIR/test.temp.1 10*3ee4fc2aSCody Peter MelloTEMP2=$WORKDIR/test.temp.2 11*3ee4fc2aSCody Peter MelloTEMP3=$WORKDIR/test.temp.3 12*3ee4fc2aSCody Peter Mello 13*3ee4fc2aSCody Peter MelloRESULT=0 14*3ee4fc2aSCody Peter Mello 15*3ee4fc2aSCody Peter Mellofail() { 16*3ee4fc2aSCody Peter Mello echo "$1" >&2 17*3ee4fc2aSCody Peter Mello RESULT=1 18*3ee4fc2aSCody Peter Mello} 19*3ee4fc2aSCody Peter Mello 20*3ee4fc2aSCody Peter Melloecho T.lilly: miscellaneous RE tests from Bruce Lilly 21*3ee4fc2aSCody Peter Mello 22*3ee4fc2aSCody Peter Mellocat > $TEMP0 <<EOF 23*3ee4fc2aSCody Peter Mellofoo=bar 24*3ee4fc2aSCody Peter Mellofoo==bar 25*3ee4fc2aSCody Peter Mellofoo+bar 26*3ee4fc2aSCody Peter Mellofoo+=bar 27*3ee4fc2aSCody Peter Mellofoo-=bar 28*3ee4fc2aSCody Peter Mellofoo*=bar 29*3ee4fc2aSCody Peter Mellofoo/=bar 30*3ee4fc2aSCody Peter Mellofoo^=bar 31*3ee4fc2aSCody Peter Mellofoo%=bar 32*3ee4fc2aSCody Peter Mellofoo!=bar 33*3ee4fc2aSCody Peter Mellofoo<=bar 34*3ee4fc2aSCody Peter Mellofoo>=bar 35*3ee4fc2aSCody Peter Mellofoo bar 36*3ee4fc2aSCody Peter Mellofoo/bar 37*3ee4fc2aSCody Peter Mellofoo=bar=fribble 38*3ee4fc2aSCody Peter Mello=foo=bar 39*3ee4fc2aSCody Peter MelloEOF 40*3ee4fc2aSCody Peter Mello 41*3ee4fc2aSCody Peter Mellorm -f $TEMP2 42*3ee4fc2aSCody Peter Mello$AWK ' 43*3ee4fc2aSCody Peter Mello/./ { 44*3ee4fc2aSCody Peter Mello print $0 >"'$TEMP2'" 45*3ee4fc2aSCody Peter Mello print "###", NR, $0 46*3ee4fc2aSCody Peter Mello system(ENVIRON["AWK"] " -f '$TEMP2' <\"'$TEMP0'\" ") 47*3ee4fc2aSCody Peter Mello close "'$TEMP2'" 48*3ee4fc2aSCody Peter Mello}' < lilly.progs > $TEMP1 2>&1 49*3ee4fc2aSCody Peter Mello 50*3ee4fc2aSCody Peter Melloecho `wc -l lilly.progs` tests 51*3ee4fc2aSCody Peter Mello 52*3ee4fc2aSCody Peter Mellodiff $TEMP1 lilly.ok > $WORKDIR/lilly.diff || fail 'bad: T.lilly is different' 53*3ee4fc2aSCody Peter Mello 54*3ee4fc2aSCody Peter Melloexit $RESULT 55