Al Stone 69fdad
#!/bin/bash
Al Stone 69fdad
#
Al Stone 69fdad
#       run the misc tests: we need to do this in a script since
Al Stone 69fdad
#       these are expected to fail which would normally cause %check
Al Stone 69fdad
#       to stop.  however, this is expected behavior.  we are running
Al Stone 69fdad
#       iasl precisely because we expect it to stop when presented with
Al Stone 69fdad
#       faulty ASL.
Al Stone 69fdad
#
Al Stone 69fdad
#       this script assumes it is in the source 'tests' directory at
Al Stone 69fdad
#       start.
Al Stone 69fdad
#
Al Stone 69fdad
Al Stone 69fdad
PWD=$(pwd)
Al Stone 69fdad
BINDIR="/usr/bin"
Al Stone 69fdad
VERSION=$($BINDIR/iasl -v | grep Optimizing | cut -d" " -f5)
Al Stone 69fdad
Al Stone 69fdad
# create file to compare against
Al Stone 69fdad
pushd ./grammar > /dev/null
Al Stone 69fdad
sed -e "s/VVVVVVVV/$VERSION/" \
Al Stone 69fdad
    grammar.asl.result > grammar.asl.expected
Al Stone 69fdad
Al Stone 69fdad
# see if grammar.asl failed as expected
Al Stone 69fdad
# NB: the -f option is required so we can see all of the errors
Al Stone 69fdad
$BINDIR/iasl -f grammar.asl > grammar.asl.actual 2>&1
Al Stone 69fdad
diff grammar.asl.actual grammar.asl.expected >/dev/null 2>&1
Al Stone 69fdad
RET=$?
Al Stone 69fdad
popd > /dev/null
Al Stone 69fdad
Al Stone 69fdad
if [ $RET -eq 0 ]
Al Stone 69fdad
then
Al Stone 69fdad
	echo PASS grammar
Al Stone 69fdad
else
Al Stone 69fdad
	echo FAIL grammar
Al Stone 69fdad
fi
Al Stone 69fdad
exit $RET