Newer
Older
# do_tests {lisp invocation} {scripts-regex}
Gary King
committed
# - read lisp forms one at a time from standard input
# - quit with exit status 0 on getting eof
# - quit with exit status >0 if an unhandled error occurs
usage () {
echo "$0 [lisp invocation] [scripts-regex]"
echo " - read lisp forms one at a time from matching scripts"
echo " - quit with exit status 0 on getting eof"
echo " - quit with exit status >0 if an unhandled error occurs"
echo " you need to supply the .script in the second argument"
echo " lisps include abcl, allegro, allegromodern, ccl (clozure),"
Francois-Rene Rideau
committed
echo " clisp, cmucl, ecl, gcl, gclcvs, sbcl, scl and xcl."
echo "OPTIONS:"
echo " -d -- debug mode"
echo " -u -h -- show this message."
}
unset DEBUG_ASDF_TEST
export DEBUG_ASDF_TEST=t
;;
u)
usage
exit 1
;;
h)
usage
exit 1
;;
esac
done
shift $(($OPTIND - 1))
if [ x"$1" = "xhelp" ]; then
if [ -z "$*" ]; then
scripts="$*"
sok=1
command="$1" eval="$2"
Francois-Rene Rideau
committed
rm -f ~/.cache/common-lisp/"`pwd`"/* || true
( cd .. && DO $command $eval '(load "test/compile-asdf.lisp")' )
if [ $? -ne 0 ] ; then
echo "Compilation FAILED" >&2
else
echo "Compiled OK" >&2
test_count=0
test_pass=0
test_fail=0
failed_list=""
Francois-Rene Rideau
committed
for i in $scripts ;
do
echo "Testing: $i" >&2
test_count=`expr "$test_count" + 1`
Francois-Rene Rideau
committed
rm -f ~/.cache/common-lisp/"`pwd`"/* || true
test_pass=`expr "$test_pass" + 1`
else
test_fail=`expr "$test_fail" + 1`
failed_list="$failed_list $i"
sok=0
fi
Francois-Rene Rideau
committed
echo >&2
echo >&2
done
echo >&2
echo "-#---------------------------------------" >&2
echo "Ran $test_count tests: " >&2
echo " $test_pass passing and $test_fail failing" >&2
if [ $test_fail -eq 0 ] ; then
echo "all tests apparently successful" >&2
echo success > ../build/results/status
else
echo "failing test(s): $failed_list" >&2
fi
echo "-#---------------------------------------" >&2
echo >&2
}
# terminate on error
set -e
command= flags= nodebug= eval=
abcl)
command="${ABCL:-abcl}"
flags="--noinit --nosystem --noinform"
Francois-Rene Rideau
committed
eval="--eval" ;;
Francois-Rene Rideau
committed
flags="-q"
nodebug="-batch"
eval="-e" ;;
Francois-Rene Rideau
committed
flags="-q"
nodebug="-batch"
eval="-e" ;;
Francois-Rene Rideau
committed
flags="--no-init --quiet"
nodebug="--batch"
eval="--eval" ;;
clisp)
command="${CLISP:-clisp}"
flags="-norc -ansi -I "
nodebug="-on-error exit"
eval="-x" ;;
# cmucl likes to have its executable called lisp, but so does scl
# Please use a symlink or an exec ... "$@" trampoline script.
command="${CMUCL:-cmucl}"
Francois-Rene Rideau
committed
flags="-noinit"
nodebug="-batch"
eval="-eval" ;;
flags="-norc -load sys:cmp"
eval="-eval" ;;
ecl_bytecodes)
command="${ECL:-ecl}"
flags="-norc -eval (ext::install-bytecodes-compiler)"
Francois-Rene Rideau
committed
eval="-eval" ;;
Francois-Rene Rideau
committed
gcl)
export GCL_ANSI=t
command="${GCL:-gcl}"
flags="-batch"
eval="-eval" ;;
gclcvs)
export GCL_ANSI=t
Francois-Rene Rideau
committed
command="${GCLCVS:-gclcvs}"
flags="-batch"
eval="-eval" ;;
Francois-Rene Rideau
committed
lispworks)
# If you have a licensed copy of lispworks,
# you can obtain the "lispworks" binary with, e.g.
# echo '(hcl:save-image "/lispworks" :environment nil)' > /tmp/build.lisp ;
# ./lispworks-6-0-0-x86-linux -siteinit - -init - -build /tmp/build.lisp
Francois-Rene Rideau
committed
flags="-siteinit - -init -"
eval="-eval" ;;
mkcl)
command="${MKCL:-mkcl}"
flags="-norc"
eval="-eval" ;;
sbcl)
command="${SBCL:-sbcl}"
flags="--noinform --userinit /dev/null --sysinit /dev/null" # --eval (require'asdf)
nodebug="--disable-debugger"
scl)
command="${SCL:-scl}"
flags="-noinit"
nodebug="-batch"
eval="-eval" ;;
xcl)
command="${XCL:-xcl}"
flags="--no-userinit --no-siteinit"
eval="--eval" ;;
Francois-Rene Rideau
committed
*)
echo "Unsupported lisp: $1" >&2
echo "Please add support to run-tests.sh" >&2
exit 42 ;;
Francois-Rene Rideau
committed
if ! type "$command" ; then
echo "lisp implementation not found: $command" >&2
Francois-Rene Rideau
committed
exit 43
fi
ASDFDIR="$(cd .. ; /bin/pwd)"
export CL_SOURCE_REGISTRY="${ASDFDIR}"
export ASDF_OUTPUT_TRANSLATIONS="(:output-translations (\"${ASDFDIR}\" (\"${ASDFDIR}/build/fasls\" :implementation)) :ignore-inherited-configuration)"
if [ -z "${DEBUG_ASDF_TEST}" ] ; then
command="$command $nodebug"
fi
Francois-Rene Rideau
committed
create_config () {
mkdir -p ../build/test-source-registry-conf.d ../build/test-asdf-output-translations-conf.d
rm -rf ../build/test-source-registry-conf.d ../build/test-asdf-output-translations-conf.d
if [ -z "$command" ] ; then
echo "Error: cannot find or do not know how to run Lisp named $lisp"
else
Francois-Rene Rideau
committed
create_config
mkdir -p ../build/results
echo failure > ../build/results/status
Francois-Rene Rideau
committed
do_tests "$command" "$eval" 2>&1 | \
tee "../build/results/${lisp}.text" "../build/results/${lisp}-${thedate}.save"
read a < ../build/results/status
[ success = "$a" ] ## exit code