Blob Blame History Raw
#!/bin/sh
#
# smilint-FORMAT.test --
#
#       smilint test for various input formats.
#
# FORMAT=xxx : 
#   Check `smilint -l9' output for all TESTMIBS read from dumps/xxx/
#   against nominal dumps/smilint-xxx/ output files.
#

FORMAT=`echo $0 | sed -e 's/^.*smilint-\(.*\).test/\1/'`
ACTUALDIR=smilint-${FORMAT}.out
NOMINALDIR=dumps/smilint-${FORMAT}

rm -rf ${ACTUALDIR}
mkdir ${ACTUALDIR}

RC=0
FAILED=""
for mib in ${TESTMIBS} ; do
    echo "comparing \`smilint -l9 dumps/${FORMAT}/$mib' output with ${NOMINALDIR}/*."
    cd ${ACTUALDIR}
    ../../tools/smilint -c/dev/null -l9 ../dumps/${FORMAT}/$mib > $mib 2>&1
    cd ..
    @DIFF@ ${ACTUALDIR}/$mib ${NOMINALDIR}/$mib > ${ACTUALDIR}/$mib.diff
    if [ ! -s ${ACTUALDIR}/$mib.diff ] ; then
	rm ${ACTUALDIR}/$mib.diff
    else
	FAILED=1
    fi
done

if [ "$FAILED" ] ; then
    echo "*** smilint output differs, see ${ACTUALDIR}/*.diff"
    RC=1
fi

rm -f sync-dumps
cat > sync-dumps <<EOF
#
# sync-dumps
#
# This script copies test output files to the nominal files in the
# dumps/ directory. It MUST ONLY be executed after carefully ensuring
# that the current output files are valid. Otherwise the sense of
# this test suite would be dubious.
#

CMDPREFIX=echo
if [ "\$1" == "-f" ] ; then CMDPREFIX="" ; fi

EOF
chmod a+x sync-dumps

exit ${RC}