lib.c (config_set_var_n): Return a pointer even if we don't change the var.
[runlisp] / tests.at
index 3eee970..8c5d0c6 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
+[SETUP_RUNLISP_ENV
+lisp=$1
 LISP=$m4_translit(m4_bregexp([$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!~%")'],,
@@ -251,8 +250,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
@@ -282,10 +280,9 @@ echo Bad Lisp = $badlisp
 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])
+[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
@@ -309,33 +306,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