2011-09-29 14:08:16 -07:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# aslts - execute ASL test suite
|
|
|
|
#
|
|
|
|
|
|
|
|
# Will build temporary versions of iASL and acpiexec
|
|
|
|
postfix=`date +%H%M%S`
|
|
|
|
tmp_iasl=/tmp/iasl-$postfix
|
|
|
|
tmp_acpiexec=/tmp/acpiexec-$postfix
|
2017-09-27 15:36:28 -07:00
|
|
|
tmp_acpibin=/tmp/acpibin-$postfix
|
2011-09-29 14:08:16 -07:00
|
|
|
|
2013-11-07 13:50:02 -08:00
|
|
|
TEST_CASES=
|
|
|
|
TEST_MODES=
|
2013-11-14 08:50:43 -08:00
|
|
|
REBUILD_TOOLS=yes
|
2017-02-28 12:09:22 -08:00
|
|
|
BINCOMPONLY=no
|
2019-08-26 10:40:58 -07:00
|
|
|
DATATABLEONLY=no
|
2017-02-28 11:34:33 -08:00
|
|
|
EXECONLY=no
|
2013-11-07 13:50:02 -08:00
|
|
|
|
|
|
|
usage() {
|
|
|
|
|
|
|
|
echo "Usage:"
|
2013-11-14 08:50:43 -08:00
|
|
|
echo "`basename $0` [-c case] [-m mode] [-u]"
|
2013-11-07 13:50:02 -08:00
|
|
|
echo "Where:"
|
2013-11-14 08:50:43 -08:00
|
|
|
echo " -c: Specify individual test cases (can be used multiple times)"
|
|
|
|
echo " -m: Specify individual test modes (can be used multiple times)"
|
|
|
|
echo " -u: Do not force rebuilding of ACPICA utilities (acpiexec, iasl)"
|
2017-02-28 12:02:49 -08:00
|
|
|
echo " -e: Perform the execution of aml files and omit binary comparison of regular aml and disassembled aml file."
|
2017-02-28 12:09:22 -08:00
|
|
|
echo " -b: Only perform binary comparison of regular aml and disasssembled aml file"
|
2019-08-26 10:40:58 -07:00
|
|
|
echo " -d: Only execute data table compiler/disassembler test"
|
2013-11-07 13:50:02 -08:00
|
|
|
echo ""
|
|
|
|
|
2013-11-14 08:50:43 -08:00
|
|
|
echo "Available test modes:"
|
2017-02-28 12:02:49 -08:00
|
|
|
echo " n32 32-bit unoptimized code (tests are compiled with iasl -oa -r 1 and other flags)"
|
|
|
|
echo " n64 64-bit unoptimized code (tests are compiled with iasl -oa -r 2 and other flags)"
|
|
|
|
echo " o32 32-bit optimized code (tests are compiled with iasl -r 1 and other flags)"
|
|
|
|
echo " o64 64-bit optimized code (tests are compiled with iasl -r 2 and other flags)"
|
2013-11-07 13:50:02 -08:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
Do 3
|
|
|
|
exit 1
|
|
|
|
}
|
2011-09-29 14:08:16 -07:00
|
|
|
|
|
|
|
# Setup environment and variables.
|
|
|
|
# Need a path to ASLTS and iasl,acpiexec generation dir
|
|
|
|
setup_environment() {
|
|
|
|
|
|
|
|
aslts_dir=$1
|
|
|
|
generation_dir=$2
|
|
|
|
|
|
|
|
if [ -z "$generation_dir" ] ; then
|
|
|
|
echo "missing generation directory argument"
|
|
|
|
exit
|
|
|
|
elif [ -z "$aslts_dir" ] ; then
|
|
|
|
echo "missing aslts directory argument"
|
|
|
|
exit
|
|
|
|
elif [ ! -d "$generation_dir" ] ; then
|
|
|
|
echo $generation_dir is not a dir
|
|
|
|
exit
|
|
|
|
elif [ ! -d "$aslts_dir" ] ; then
|
|
|
|
echo $aslts_dir is not a dir
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Variables required by ASLTS
|
|
|
|
unset ASL
|
|
|
|
unset acpiexec
|
|
|
|
unset ASLTSDIR
|
|
|
|
|
|
|
|
export ASL=$tmp_iasl
|
|
|
|
export acpiexec=$tmp_acpiexec
|
2017-09-27 15:36:28 -07:00
|
|
|
export acpibin=$tmp_acpibin
|
2011-09-29 14:08:16 -07:00
|
|
|
export ASLTSDIR=$aslts_dir
|
|
|
|
export PATH=$ASLTSDIR/bin:$PATH
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Generate both iASL and acpiexec from source
|
|
|
|
build_acpi_tools() {
|
|
|
|
|
|
|
|
restore_dir=$PWD
|
|
|
|
cd ${generation_dir}
|
2017-09-27 15:36:28 -07:00
|
|
|
rm -f $tmp_iasl $tmp_acpiexec $tmp_acpibin
|
2011-09-29 14:08:16 -07:00
|
|
|
|
2011-10-21 08:38:51 -07:00
|
|
|
# Build native-width iASL compiler and acpiexec
|
2013-11-07 13:50:02 -08:00
|
|
|
if [ ! -e bin/iasl -o ! -e bin/acpiexec ]; then
|
|
|
|
REBUILD_TOOLS=yes
|
|
|
|
fi
|
|
|
|
if [ "x$REBUILD_TOOLS" = "xyes" ]; then
|
2018-08-16 13:01:10 -07:00
|
|
|
jobs=`nproc`
|
2013-11-07 13:50:02 -08:00
|
|
|
make clean
|
2018-08-16 13:01:10 -07:00
|
|
|
make iasl ASLTS=TRUE -j$jobs
|
|
|
|
make acpibin ASLTS=TRUE -j$jobs
|
|
|
|
make acpiexec ASLTS=TRUE -j$jobs
|
2013-11-07 13:50:02 -08:00
|
|
|
fi
|
2011-10-21 08:38:51 -07:00
|
|
|
|
2013-05-09 09:21:59 -07:00
|
|
|
if [ -d "bin" ] && [ -f "bin/iasl" ]; then
|
|
|
|
echo "Installing ACPICA tools"
|
|
|
|
cp bin/iasl $tmp_iasl
|
|
|
|
cp bin/acpiexec $tmp_acpiexec
|
2017-09-27 15:36:28 -07:00
|
|
|
cp bin/acpibin $tmp_acpibin
|
2011-10-21 08:38:51 -07:00
|
|
|
else
|
|
|
|
echo "Could not find iASL/acpiexec tools"
|
|
|
|
exit
|
|
|
|
fi
|
2011-09-29 14:08:16 -07:00
|
|
|
|
2011-10-21 08:38:51 -07:00
|
|
|
# Ensure that the tools are available
|
2011-09-29 14:08:16 -07:00
|
|
|
if [ ! -f $tmp_iasl ] ; then
|
|
|
|
echo "iasl compiler not found"
|
|
|
|
exit
|
|
|
|
elif [ ! -f $tmp_acpiexec ] ; then
|
|
|
|
echo "acpiexec utility not found"
|
|
|
|
exit
|
2017-09-27 15:36:28 -07:00
|
|
|
elif [ ! -f $tmp_acpibin ] ; then
|
|
|
|
echo "acpibin utility not found"
|
|
|
|
exit
|
2011-09-29 14:08:16 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
cd $restore_dir
|
|
|
|
}
|
|
|
|
|
2019-08-06 13:03:13 -07:00
|
|
|
# Run a simple compiler test.
|
|
|
|
# This test does the following:
|
|
|
|
# 1 generate all sample tables in the compiler
|
|
|
|
# 2 compile all tables (.asl -> .aml)
|
|
|
|
# 3 disassembles all tables (.aml -> .dsl)
|
|
|
|
# 4 recompiles all all tables (.dsl -> recomp.aml)
|
|
|
|
# 5 runs binary comparison between .aml and recomp.aml
|
|
|
|
run_compiler_template_test()
|
|
|
|
{
|
|
|
|
pushd templates
|
|
|
|
|
|
|
|
rm -f *.asl *.aml *.dsl
|
|
|
|
|
2019-08-23 13:45:42 -07:00
|
|
|
$ASL -T all 2> /dev/null
|
2019-08-06 13:03:13 -07:00
|
|
|
for filename in *.asl
|
|
|
|
do
|
|
|
|
make -s NAME=$(basename "$filename" .asl)
|
|
|
|
done
|
|
|
|
|
|
|
|
rm -f *.asl *.aml *.dsl
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
2011-09-29 14:08:16 -07:00
|
|
|
|
|
|
|
# Compile and run the ASLTS suite
|
|
|
|
run_aslts() {
|
|
|
|
|
|
|
|
# Remove a previous version of the AML test code
|
|
|
|
version=`$ASL | grep version | awk '{print $5}'`
|
|
|
|
rm -rf $ASLTSDIR/tmp/aml/$version
|
|
|
|
|
2019-08-06 13:03:13 -07:00
|
|
|
# run templates test
|
|
|
|
|
|
|
|
run_compiler_template_test
|
|
|
|
|
2019-08-26 10:40:58 -07:00
|
|
|
if [ "x$DATATABLEONLY" = "xyes" ]; then
|
|
|
|
return 0
|
|
|
|
fi;
|
|
|
|
|
2017-08-28 22:31:07 +08:00
|
|
|
if [ "x$TEST_MODES" = "x" ]; then
|
|
|
|
TEST_MODES="n32 n64 o32 o64"
|
|
|
|
fi
|
|
|
|
Do 0 $TEST_MODES $TEST_CASES $EXECONLY
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "ASLTS Compile Failure"
|
|
|
|
exit 1
|
2013-11-07 13:50:02 -08:00
|
|
|
fi
|
2011-09-29 14:08:16 -07:00
|
|
|
|
|
|
|
# Execute the test suite
|
2017-03-14 11:20:23 -07:00
|
|
|
if [ "x$BINCOMPONLY" = "xno" ]; then
|
2017-02-28 12:09:22 -08:00
|
|
|
echo ""
|
|
|
|
echo "ASL Test Suite Started: `date`"
|
|
|
|
start_time=$(date)
|
2013-11-07 13:50:02 -08:00
|
|
|
|
2017-02-28 12:09:22 -08:00
|
|
|
if [ "x$TEST_MODES" = "x" ]; then
|
|
|
|
TEST_MODES="n32 n64 o32 o64"
|
|
|
|
fi
|
|
|
|
Do 1 $TEST_MODES $TEST_CASES
|
2013-11-07 13:50:02 -08:00
|
|
|
|
2017-02-28 12:09:22 -08:00
|
|
|
echo ""
|
|
|
|
echo "ASL Test Suite Finished: `date`"
|
|
|
|
echo " Started: $start_time"
|
2011-09-29 14:08:16 -07:00
|
|
|
|
2017-09-27 15:36:28 -07:00
|
|
|
rm -f $tmp_iasl $tmp_acpiexec $tmp_acpibin
|
2017-02-28 12:09:22 -08:00
|
|
|
fi;
|
2011-09-29 14:08:16 -07:00
|
|
|
}
|
|
|
|
|
2013-11-07 13:50:02 -08:00
|
|
|
SRCDIR=`(cd \`dirname $0\`; cd ..; pwd)`
|
|
|
|
setup_environment $SRCDIR/tests/aslts $SRCDIR/generate/unix
|
|
|
|
|
|
|
|
# To use common utilities
|
2013-11-08 08:11:48 -08:00
|
|
|
. $SRCDIR/tests/aslts/bin/common
|
|
|
|
. $SRCDIR/tests/aslts/bin/settings
|
2013-11-07 13:50:02 -08:00
|
|
|
RESET_SETTINGS
|
|
|
|
INIT_ALL_AVAILABLE_CASES
|
|
|
|
INIT_ALL_AVAILABLE_MODES
|
|
|
|
|
2019-08-26 10:40:58 -07:00
|
|
|
while getopts "c:m:uebd" opt
|
2013-11-07 13:50:02 -08:00
|
|
|
do
|
|
|
|
case $opt in
|
2017-02-28 12:09:22 -08:00
|
|
|
b)
|
|
|
|
BINCOMPONLY=yes
|
|
|
|
echo "Running only binary comparisons"
|
|
|
|
;;
|
2013-11-07 13:50:02 -08:00
|
|
|
c)
|
|
|
|
get_collection_opcode "$OPTARG"
|
|
|
|
if [ $? -eq $COLLS_NUM ]; then
|
|
|
|
echo "Invalid test case: $OPTARG"
|
|
|
|
usage
|
|
|
|
else
|
|
|
|
TEST_CASES="$OPTARG $TEST_CASES"
|
|
|
|
fi
|
|
|
|
;;
|
2019-08-26 10:40:58 -07:00
|
|
|
d)
|
|
|
|
DATATABLEONLY=yes
|
|
|
|
echo "Running only data table test"
|
|
|
|
;;
|
2017-02-28 11:34:33 -08:00
|
|
|
e)
|
|
|
|
EXECONLY=yes
|
2017-02-28 12:09:22 -08:00
|
|
|
echo "Running tests without binary comparisons"
|
2017-02-28 11:34:33 -08:00
|
|
|
;;
|
2013-11-07 13:50:02 -08:00
|
|
|
m)
|
|
|
|
check_mode_id "$OPTARG"
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
echo "Invalid test mode: $OPTARG"
|
|
|
|
usage
|
|
|
|
else
|
|
|
|
TEST_MODES="$OPTARG $TEST_MODES"
|
|
|
|
fi
|
|
|
|
;;
|
2013-11-14 08:50:43 -08:00
|
|
|
u)
|
|
|
|
REBUILD_TOOLS=no
|
2013-11-07 13:50:02 -08:00
|
|
|
;;
|
|
|
|
?)
|
|
|
|
echo "Invalid argument: $opt"
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
2011-10-21 08:38:51 -07:00
|
|
|
|
2011-09-29 14:08:16 -07:00
|
|
|
build_acpi_tools
|
|
|
|
run_aslts
|