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