#!/bin/sh # $Id: check.sh,v 1.7 2003/12/04 06:36:52 fp010 Exp $ # hacked up by hvr inspired by fptest if [ -z "$1" -o -z "$2" -o "$#" -gt 2 ]; then echo "usage: $0 " exit 1 fi TESTNAME=$1 INPUTS=$2 if [ ! -f "$INPUTS" ]; then echo "test-file '$INPUTS' not found!" exit 2 fi echo "True" | hugs $TESTNAME > tmp.true N=1 cat "$INPUTS" | sed 's/\\/\\\\/g;s/^[ ]*//;s/[ ]*$//' | while read; do [ -z "${REPLY}" ] && continue echo "${REPLY}" | grep '^--' && continue # since "${REPLY}" is not an empty line... go for it! echo -n "Test $N => $REPLY" echo "${REPLY}" |hugs $TESTNAME > tmp.testout if cmp -s tmp.true tmp.testout; then echo " : OK" else echo " : FAILED; output was:" echo "/---------------------------------------------------------------------------" #cat tmp.testout # output only the significant part diff tmp.true tmp.testout | grep '^>' echo "\\---------------------------------------------------------------------------" echo "** Test $N FAILED! :-( **" let RC=N exit $N fi let N=N+1 done RC=$? rm -f tmp.true tmp.testout exit $RC