diff --git a/test/run-tests.sh b/test/run-tests.sh index 1cb499cefd246ccee305cce36333e29ff2186ed0..50df5aaf6f6bb3c2080a44c987d7ecb9444af715 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -6,15 +6,29 @@ # - quit with exit status >0 if an unhandled error occurs export CL_SOURCE_REGISTRY="$PWD" +export ASDF_DEBUG= + +while getopts "duh" OPTION +do + case OPTION in + d) + ASDF_DEBUG = 1 + ;; + u) + usage + exit 1 + ;; + h) + usage + exit 1 + ;; + esac +done +shift $(($OPTIND - 1)) if [ x"$1" = "xhelp" ]; then - 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 sbcl, clisp, allegro and allegromodern" - exit -1 + usage + exit 1 fi if [ -z "$2" ]; then @@ -25,6 +39,18 @@ fi sok=1 +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 sbcl, clisp, allegro and allegromodern" + echo "OPTIONS:" + echo " -d -- debug mode" + echo " -u -h -- show this message." +} + do_tests() { command=$1 eval=$2 fasl_ext=$3 rm -f *.$fasl_ext ~/.cache/common-lisp/"`pwd`"/*.$fasl_ext || true diff --git a/test/script-support.lisp b/test/script-support.lisp index defb7e3756ca5af2cfea3135610a22c005b46eeb..c0c23f5fb9f5d27cb178e0e4cd53838644325d68 100644 --- a/test/script-support.lisp +++ b/test/script-support.lisp @@ -24,13 +24,23 @@ (ccl::quit return) #+sbcl (sb-ext:quit :unix-status return) - (error "Don't know how to quit Lisp; wanting to use exit code ~a" return)) + + +(defparameter *asdf-test-debug* + (test-getenv "ASDF_DEBUG") + "Global variable initialized from ASDF_DEBUG environment variable. +Controls whether errors are muffled and dumped to the shell.") + (defmacro quit-on-error (&body body) `(call-quitting-on-error (lambda () ,@body))) (defun call-quitting-on-error (thunk) + "Unless the global *asdf-test-debug* is true, +write a message and exit on an error. If +*asdf-test-debug* is true, enter the debugger +as normal." (handler-case (progn (funcall thunk) (leave-lisp "~&Script succeeded~%" 0))