fa2344
#!/bin/bash
fa2344
#
fa2344
#       run the misc tests: we need to do this in a script since
fa2344
#       these are expected to fail which would normally cause %check
fa2344
#       to stop.  however, this is expected behavior.  we are running
fa2344
#       iasl precisely because we expect it to stop when presented with
fa2344
#       faulty ASL.
fa2344
#
fa2344
#       this script assumes it is in the source 'tests' directory at
fa2344
#       start.
fa2344
#
fa2344
fa2344
set -x
fa2344
fa2344
BINDIR="$1"
fa2344
VERSION="$2"
fa2344
fa2344
# create files to compare against
fa2344
$BINDIR/iasl -h
fa2344
fa2344
m=`uname -m`
fa2344
case $m in
fa2344
    s390x | \
fa2344
    *64le | \
fa2344
    *64) BITS=64
fa2344
         ;;
fa2344
    *)   BITS=32
fa2344
         ;;
fa2344
esac
fa2344
fa2344
# if a build starts before midnight, but ends after midnight, this
fa2344
# test can get confused.  grab the date from the iasl file we just
fa2344
# built so they match regardless.
fa2344
FDATE=`stat --format="%Y" $BINDIR/iasl | cut -d" " -f1`
fa2344
WHEN=`date --date="@$FDATE" +"%b %_d %Y"`
fa2344
fa2344
sed -e "s/XXXXXXXXXXX/$WHEN/" \
fa2344
    -e "s/YYYY/$BITS/" \
fa2344
    -e "s/VVVVVVVV/$VERSION/" \
fa2344
    ../badcode.asl.result > misc/badcode.asl.result
fa2344
sed -e "s/XXXXXXXXXXX/$WHEN/" \
fa2344
    -e "s/YYYY/$BITS/" \
fa2344
    -e "s/VVVVVVVV/$VERSION/" \
fa2344
    ../grammar.asl.result > misc/grammar.asl.result
fa2344
fa2344
cd misc
fa2344
fa2344
# see if badcode.asl failed as expected
fa2344
# NB: the -f option is required so we can see all of the errors
fa2344
$BINDIR/iasl -f badcode.asl 2>&1 | tee badcode
fa2344
diff badcode badcode.asl.result >/dev/null 2>&1
fa2344
[ $? -eq 0 ] || exit 1
fa2344
fa2344
# see if grammar.asl failed as expected
fa2344
# NB: the -f option is required so we can see all of the errors
fa2344
$BINDIR/iasl -f -of grammar.asl 2>&1 | tee grammar
fa2344
diff grammar grammar.asl.result >/dev/null 2>&1
fa2344
[ $? -eq 0 ] || exit 1
fa2344
fa2344
exit 0