runlisp.c, etc.: Rename `-p' to `-d'. COMPAT
[runlisp] / tests.at
index 3eee970..73b13ae 100644 (file)
--- a/tests.at
+++ b/tests.at
@@ -40,19 +40,24 @@ m4_define([LISP_SYSTEMS],
    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="" ;;
 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"
@@ -62,12 +67,6 @@ m4_define([WHICH_LISP],
 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.
 
@@ -119,7 +118,8 @@ cat >test-script <<EOF
 ;; 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.
+;; 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#)
@@ -201,8 +201,7 @@ AT_CLEANUP])
 
 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!~%")'],,
@@ -211,7 +210,7 @@ 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
@@ -230,14 +229,17 @@ cat >script.lisp <<EOF
              #'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 \
            -e '(incf runlisp-test:foo)' \
            -l script.lisp \
-           -p runlisp-test:foo \
+           -d runlisp-test:foo \
            -- -e one two three],,
 [1
+"stoat!"
 And we're running the script...
 Command-line arguments: ("-e" "one" "two" "three")
 Symbols in package `COMMON-LISP-USER': ()
@@ -251,8 +253,7 @@ AT_CLEANUP
 
 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
@@ -279,21 +280,20 @@ echo Secondary Lisp = $lisp1
 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.
@@ -309,33 +309,29 @@ 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