cmucl, cmucl/noimage,
abcl, abcl/noimage])
+m4_define([SETUP_RUNLISP_ENV],
+[RUNLISP_SYSCONFIG=$abs_top_srcdir/runlisp-base.conf; export RUNLISP_SYSCONFIG
+RUNLISP_SYSCONFIG_DIR=/notexist; export RUNLISP_SYSCONFIG_DIR
+RUNLISP_IMAGEDIR=$abs_top_builddir; export RUNLISP_IMAGEDIR
+RUNLISP_EVAL=$abs_top_srcdir/eval.lisp; export RUNLISP_EVAL
+unset RUNLISP_USERCONFIG
+])
+
m4_define([PREPARE_LISP_TEST],
-[lisp=$1
-LISP=$m4_translit(m4_bregexp([$1], [/.*$], []), [a-z], [A-Z])
+[SETUP_RUNLISP_ENV
+lisp=$1
+LISP=$m4_translit(m4_bpatsubst([$1], [/.*$], []), [a-z], [A-Z])
AT_SKIP_IF([test "x$LISP" = x])
case $lisp in
- */*) opt=${lisp#*/} lisp=${lisp%%/*} ;;
+ */*) opt=${lisp@%:@*/} lisp=${lisp%%/*} ;;
*) opt="" ;;
esac
-case /$opt/ in
- */noimage/*) RUNLISP_IMAGEDIR=./notexist ;;
- *) RUNLISP_IMAGEDIR=$abs_top_builddir ;;
-esac
-export RUNLISP_IMAGEDIR])
+case /$opt/ in */noimage/*) RUNLISP_IMAGEDIR=./notexist ;; esac])
m4_define([WHICH_LISP],
-[(or #+sbcl "sbcl" #+ccl "ccl" #+clisp "clisp"
- #+ecl "ecl" #+cmu "cmucl" #+abcl "abcl"
+[(or @%:@+sbcl "sbcl" @%:@+ccl "ccl" @%:@+clisp "clisp"
+ @%:@+ecl "ecl" @%:@+cmu "cmucl" @%:@+abcl "abcl"
"unknown")])
m4_define([NL], [
])
-m4_define([SETUP_RUNLISP_IMAGEDIR],
-[RUNLISP_IMAGEDIR=$abs_top_builddir; export RUNLISP_IMAGEDIR])
-
-m4_define([SETUP_RUNLISP_EVAL],
-[RUNLISP_EVAL=$abs_top_srcdir/eval.lisp; export RUNLISP_EVAL])
-
###--------------------------------------------------------------------------
### A basic smoke test.
## Prepare the script.
cat >test-script <<EOF
-[#!] RUNLISP_PATH -L$lisp
+@%:@! RUNLISP_PATH -L$lisp
;; Print a greeting to \`*standard-output*', identifying the Lisp system, so
;; that we can tell whether we called the right one.
(format t "Hello from ~A (~A)!~%" (lisp-implementation-type) WHICH_LISP)
-#! this should be a comment everywhere
+@%:@! this should be a comment everywhere
;; Make sure that \`*error-output*' is hooked up properly.
(format *error-output* "to stderr~%")
-;; Make sure that \`*standard-input*' is hooked up properly, by reading a line
-;; and echoing it.
+;; Make sure that \`*standard-input*' is hooked up properly, by reading a
+;; line and echoing it.
(format t "from stdin: ~S~%" (read-line))
;; Check that \`:runlisp-script' is set in \`*features*'. If not, \`assert'
;; Check that there are no symbols present (interned or imported) in the
;; \`common-lisp-user' package. Obviously, we must avoid interning any
;; ourselves. Alas, ABCL and ECL pollute \`cl-user' out of the box. (ECL
-;; does this deliberately; ABCL's ``adjoin.lisp' lacks an \`in-package' form.
-(let ((#1=#:syms (sort (loop :for #2=#:s :being :the :present-symbols
- :of *package*
- :collect #2#)
- #'string<)))
+;; does this deliberately; ABCL's ``adjoin.lisp' lacks an \`in-package'
+;; form.)
+(let ((@%:@1=@%:@:syms (sort (loop :for @%:@2=@%:@:s :being
+ :the :present-symbols :of *package*
+ :collect @%:@2@%:@)
+ @%:@'string<)))
(format t "package \`~A' [~:[ok~;has unexpected symbols ~:*~S~]]~%"
- (package-name *package*) #1#))
+ (package-name *package*) @%:@1@%:@))
;; Print the program name and command-line arguments.
(format t "program name = ~S~%~
## A simple script which signals an error without catching it.
cat >test <<EOF
-[#!] RUNLISP_PATH -L$lisp
+@%:@! RUNLISP_PATH -L$lisp
(error "just kill me now")
EOF
chmod +x test
AT_SETUP([eval mode])
AT_KEYWORDS([eval common])
-SETUP_RUNLISP_IMAGEDIR
-SETUP_RUNLISP_EVAL
+SETUP_RUNLISP_ENV
## A very basic smoke test.
AT_CHECK([RUNLISP_PATH -e '(format t "Just another Lisp hacker!~%")'],,
## The `:runlisp-script' keyword should /not/ be in `*features*'.
traceon
-AT_CHECK([RUNLISP_PATH -p '(find :runlisp-script *features*)'],, [NIL
+AT_CHECK([RUNLISP_PATH -d '(find :runlisp-script *features*)'],, [NIL
])
## Check a mixture of all the kinds of evaluation. We'll need a stunt script
## evaluated one at a time, so that each one can affect the way the reader
## interprets the next.
cat >script.lisp <<EOF
-#! just want to check that Lisp doesn't choke on a shebang line here
+@%:@! just want to check that Lisp doesn't choke on a shebang line here
(format t "And we're running the script...~%~
Command-line arguments: ~:S~%~
Symbols in package \`~A': ~:S~%"
uiop:*command-line-arguments*
(package-name *package*)
- (sort (loop :for #2=#:s :being :the :present-symbols :of *package*
- :collect #2#)
- #'string<))
+ (sort (loop :for @%:@2=@%:@:s :being
+ :the :present-symbols :of *package*
+ :collect @%:@2@%:@)
+ @%:@'string<))
EOF
AT_CHECK([RUNLISP_PATH \
- -e '(defpackage [#:]runlisp-test (:export [#:]foo))
- (defvar runlisp-test:foo 1)' \
- -p runlisp-test:foo \
+ -e '(defpackage @%:@:runlisp-test (:export @%:@:foo @%:@:bar))
+ (defvar runlisp-test:foo 1)
+ (defvar runlisp-test:bar "stoat!")' \
+ -d runlisp-test:foo \
+ -d runlisp-test:bar \
+ -p runlisp-test:bar \
-e '(incf runlisp-test:foo)' \
-l script.lisp \
- -p runlisp-test:foo \
+ -d runlisp-test:foo \
-- -e one two three],,
[1
+"stoat!"
+stoat!
And we're running the script...
Command-line arguments: ("-e" "one" "two" "three")
Symbols in package `COMMON-LISP-USER': ()
AT_SETUP([preferences])
AT_KEYWORDS([prefs common])
-SETUP_RUNLISP_IMAGEDIR
-SETUP_RUNLISP_EVAL
+SETUP_RUNLISP_ENV
## Before we can make this happen, we need to decide on three Lisp systems,
## two of which actually work, and one other. These are ordered by startup
unset lisp0 lisp1 badlisp; win=nil
set -- cmucl sbcl ccl clisp ecl abcl
while :; do
- case $# in 0) break ;; esac
+ case $@%:@ in 0) break ;; esac
lisp=$1; shift
if RUNLISP_PATH -L$lisp -enil 2>/dev/null; then good=t; else good=nil; fi
case ${lisp0+t},${badlisp+t},$good in
echo Bad Lisp = $badlisp
## Check that our selection worked.
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0 -p 'WHICH_LISP'],, ["$lisp0"NL])
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1 -p 'WHICH_LISP'],, ["$lisp1"NL])
-AT_CHECK([RUNLISP_PATH -L$badlisp -p 'WHICH_LISP'], [127],,
-[runlisp: no supported Lisp systems found[]NL])
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0 -d 'WHICH_LISP'],, ["$lisp0"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1 -d 'WHICH_LISP'],, ["$lisp1"NL])
+AT_CHECK([RUNLISP_PATH -L$badlisp -d 'WHICH_LISP'], [127],,
+ [runlisp: no acceptable Lisp systems found[]NL])
## Unset all of the user preference mechanisms.
-unset RUNLISP_OPTIONS
here=$(pwd)
mkdir HOME config
HOME=$here/HOME XDG_CONFIG_HOME=$here/config; export HOME XDG_CONFIG_HOME
## We generally take the first one listed that exists.
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0,$lisp1 -p 'WHICH_LISP'],, ["$lisp0"NL])
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1,$lisp0 -p 'WHICH_LISP'],, ["$lisp1"NL])
-AT_CHECK_UNQUOTED([RUNLISP_PATH -L$badlisp,$lisp0,$lisp1 -p 'WHICH_LISP'],,
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp0,$lisp1 -d 'WHICH_LISP'],, ["$lisp0"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$lisp1,$lisp0 -d 'WHICH_LISP'],, ["$lisp1"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PATH -L$badlisp,$lisp0,$lisp1 -d 'WHICH_LISP'],,
["$lisp0"NL])
## Check parsing of embedded options.
for i in 0 1; do
j=$(( 1 - $i )); eval lisp=\$lisp$i olisp=\$lisp$j
cat >script$i <<EOF
-[#!] RUNLISP_PATH
+@%:@! RUNLISP_PATH
;;; -z @RUNLISP: -L$lisp -*- -z -*- -L$olisp -- -z
(prin1 WHICH_LISP) (terpri)
EOF
done
## Preferences will override the order of acceptable implementations.
-AT_CHECK_UNQUOTED([RUNLISP_OPTIONS=-P$badlisp,$lisp0 ./script0],, ["$lisp0"NL])
-AT_CHECK_UNQUOTED([RUNLISP_OPTIONS=-P$badlisp,$lisp0 ./script1],, ["$lisp0"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PREFER=$badlisp,$lisp0 ./script0],, ["$lisp0"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PREFER=$badlisp,$lisp0 ./script1],, ["$lisp0"NL])
## But doesn't affect the preference order of unmentioned Lisps.
-AT_CHECK_UNQUOTED([RUNLISP_OPTIONS=-P$badlisp ./script0],, ["$lisp0"NL])
-AT_CHECK_UNQUOTED([RUNLISP_OPTIONS=-P$badlisp ./script1],, ["$lisp1"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PREFER=$badlisp ./script0],, ["$lisp0"NL])
+AT_CHECK_UNQUOTED([RUNLISP_PREFER=$badlisp ./script1],, ["$lisp1"NL])
## Test configuration files and interactions with the environment.
-for conf in HOME/.runlisprc config/runlisprc; do
+for conf in HOME/.runlisp.conf config/runlisp.conf; do
for i in 0 1; do
j=$(( 1 - $i )); eval lisp=\$lisp$i olisp=\$lisp$j
cat >$conf <<EOF
-### -*-conf-*-
--P$lisp
+;;; -*-conf-*-
+prefer = $lisp
EOF
## Basic check.
AT_CHECK_UNQUOTED([./script0],, ["$lisp"NL])
AT_CHECK_UNQUOTED([./script1],, ["$lisp"NL])
- ## Environment variable only appends.
- AT_CHECK_UNQUOTED([RUNLISP_OPTIONS=-P$olisp ./script0],, ["$lisp"NL])
- AT_CHECK_UNQUOTED([RUNLISP_OPTIONS=-P$olisp ./script1],, ["$lisp"NL])
-
- ## But we can clear the preferred list.
- AT_CHECK_UNQUOTED([RUNLISP_OPTIONS="-C -P$olisp" ./script0],, ["$olisp"NL])
- AT_CHECK_UNQUOTED([RUNLISP_OPTIONS="-C -P$olisp" ./script1],, ["$olisp"NL])
+ ## Environment variable overrides.
+ AT_CHECK_UNQUOTED([RUNLISP_PREFER=$olisp ./script0],, ["$olisp"NL])
+ AT_CHECK_UNQUOTED([RUNLISP_PREFER=$olisp ./script1],, ["$olisp"NL])
done
rm -f $conf
done
+AT_CLEANUP
+
+###--------------------------------------------------------------------------
+### Implementation-specific tests.
+
+AT_SETUP([specific sbcl])
+AT_KEYWORDS([specific sbcl])
+PREPARE_LISP_TEST([sbcl])
+AT_CHECK([RUNLISP_PATH -e"(require 'sb-bsd-sockets)"])
AT_CLEANUP