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