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 ./badcode > /dev/null
Al Stone 69fdad
sed -e "s/VVVVVVVV/$VERSION/" \
Al Stone 69fdad
    badcode.asl.result > badcode.asl.expected
Al Stone 69fdad
Al Stone 69fdad
# see if badcode.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 badcode.asl > badcode.asl.actual 2>&1
Al Stone 69fdad
diff badcode.asl.actual badcode.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 badcode
Al Stone 69fdad
else
Al Stone 69fdad
	echo FAIL badcode
Al Stone 69fdad
fi
Al Stone 69fdad
exit $RET