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