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 | \
32dd66
    *64) BITS=64
32dd66
         ;;
32dd66
    *)   BITS=32
32dd66
         ;;
32dd66
esac
32dd66
WHEN=`date +"%b %_d %Y"`
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