From f36495a0f1dab97c18be17a36c1a4391df5eeeba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= <dkochmanski@common-lisp.net>
Date: Fri, 15 Mar 2019 18:55:49 +0000
Subject: [PATCH] cleanup: don't use logical pathnames for auxiliary files

While clever it is undesired to have all tests depend on auxiliary
files. We fix that by introducing compile-and-load* function which
merges the pathname with the auxiliary directory (*AUX-DIR*).
---
 arrays/load.lsp                |  4 ++--
 auxiliary/hash-table-aux.lsp   |  2 +-
 auxiliary/numbers-aux.lsp      |  2 +-
 auxiliary/printer-aux.lsp      |  2 +-
 auxiliary/string-aux.lsp       |  2 +-
 characters/load.lsp            |  2 +-
 cl-test-package.lsp            |  3 ++-
 compile-and-load.lsp           |  3 +++
 conditions/load.lsp            |  4 ++--
 cons/load.lsp                  |  2 +-
 data-and-control-flow/load.lsp |  6 +++---
 gclload1.lsp                   | 17 ++++++++---------
 hash-tables/load.lsp           |  2 +-
 numbers/load.lsp               | 30 +++++++++++++++---------------
 objects/load.lsp               |  2 +-
 packages/load.lsp              |  4 ++--
 pathnames/load.lsp             |  2 +-
 printer/load.lsp               |  4 ++--
 rctest/load.lsp                |  2 +-
 rctest/rctest-package.lsp      |  2 +-
 reader/load.lsp                |  2 +-
 sequences/load.lsp             |  8 ++++----
 strings/load.lsp               |  2 +-
 symbols/load.lsp               |  2 +-
 types-and-classes/load.lsp     |  2 +-
 25 files changed, 58 insertions(+), 55 deletions(-)

diff --git a/arrays/load.lsp b/arrays/load.lsp
index d5f97568..46c225d8 100644
--- a/arrays/load.lsp
+++ b/arrays/load.lsp
@@ -1,6 +1,6 @@
 ;;; Tests on arrays
-(compile-and-load "ANSI-TESTS:AUX;array-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;bit-aux.lsp")
+(compile-and-load* "array-aux.lsp")
+(compile-and-load* "bit-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/auxiliary/hash-table-aux.lsp b/auxiliary/hash-table-aux.lsp
index 0d4f96e8..7ebff96c 100644
--- a/auxiliary/hash-table-aux.lsp
+++ b/auxiliary/hash-table-aux.lsp
@@ -6,7 +6,7 @@
 
 
 (eval-when (:load-toplevel :compile-toplevel :execute)
-  (compile-and-load "ANSI-TESTS:AUX;random-aux.lsp"))
+  (compile-and-load* "random-aux.lsp"))
 
 (defparameter *hash-table-test-iters* 1000)
 
diff --git a/auxiliary/numbers-aux.lsp b/auxiliary/numbers-aux.lsp
index eaa5d5b8..06764846 100644
--- a/auxiliary/numbers-aux.lsp
+++ b/auxiliary/numbers-aux.lsp
@@ -6,7 +6,7 @@
 
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
-  (compile-and-load "ANSI-TESTS:AUX;random-aux.lsp"))
+  (compile-and-load* "random-aux.lsp"))
 
 ;;; Binary search on reals
 
diff --git a/auxiliary/printer-aux.lsp b/auxiliary/printer-aux.lsp
index b90c3d51..839c0529 100644
--- a/auxiliary/printer-aux.lsp
+++ b/auxiliary/printer-aux.lsp
@@ -6,7 +6,7 @@
 
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
-  (compile-and-load "ANSI-TESTS:AUX;random-aux.lsp"))
+  (compile-and-load* "random-aux.lsp"))
 
 (defmacro def-print-test (name form result &rest bindings)
   `(deftest ,name
diff --git a/auxiliary/string-aux.lsp b/auxiliary/string-aux.lsp
index c7f16c42..ca3720e3 100644
--- a/auxiliary/string-aux.lsp
+++ b/auxiliary/string-aux.lsp
@@ -6,7 +6,7 @@
 
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
-  (compile-and-load "ANSI-TESTS:AUX;random-aux.lsp"))
+  (compile-and-load* "random-aux.lsp"))
 
 (defun my-string-compare (string1 string2 comparison
                                   &key (start1 0) end1 (start2 0) end2 case
diff --git a/characters/load.lsp b/characters/load.lsp
index 232d8b1b..8a820936 100644
--- a/characters/load.lsp
+++ b/characters/load.lsp
@@ -1,5 +1,5 @@
 ;;;; Character tests
-(compile-and-load "ANSI-TESTS:AUX;char-aux.lsp")
+(compile-and-load* "char-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/cl-test-package.lsp b/cl-test-package.lsp
index c0b14878..7f2b7406 100644
--- a/cl-test-package.lsp
+++ b/cl-test-package.lsp
@@ -8,7 +8,8 @@
   (unless pkg (setq pkg (make-package name :use '(:cl :regression-test))))
   (let ((*package* pkg))
     (shadow '(#:handler-case #:handler-bind))
-    (import '(common-lisp-user::compile-and-load)
+    (import '(common-lisp-user::compile-and-load
+              common-lisp-user::compile-and-load*)
             pkg)
     (export (mapcar #'intern
                     (mapcar #'symbol-name
diff --git a/compile-and-load.lsp b/compile-and-load.lsp
index 838e859a..4bdc293c 100644
--- a/compile-and-load.lsp
+++ b/compile-and-load.lsp
@@ -19,6 +19,9 @@
   "List containing pathname, creation times for files that have already
    been loaded.")
 
+(defun compile-and-load* (pathspec &key force)
+  (compile-and-load (merge-pathnames pathspec *aux-dir*) :force force))
+
 (defun compile-and-load (pathspec &key force)
   "Find the file indicated by PATHSPEC, compiling it first if
    the associated compiled file is out of date."
diff --git a/conditions/load.lsp b/conditions/load.lsp
index 736452e5..83891361 100644
--- a/conditions/load.lsp
+++ b/conditions/load.lsp
@@ -1,6 +1,6 @@
 ;;; Tests of conditions
-(compile-and-load "ANSI-TESTS:AUX;types-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;define-condition-aux.lsp")
+(compile-and-load* "types-aux.lsp")
+(compile-and-load* "define-condition-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/cons/load.lsp b/cons/load.lsp
index b3b496b5..120ccd48 100644
--- a/cons/load.lsp
+++ b/cons/load.lsp
@@ -1,5 +1,5 @@
 ;;; Tests of conses
-(compile-and-load "ANSI-TESTS:AUX;cons-aux.lsp")
+(compile-and-load* "cons-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/data-and-control-flow/load.lsp b/data-and-control-flow/load.lsp
index 7e956730..6b82118e 100644
--- a/data-and-control-flow/load.lsp
+++ b/data-and-control-flow/load.lsp
@@ -1,7 +1,7 @@
 ;;; Tests of data and control flow
-(compile-and-load "ANSI-TESTS:AUX;cons-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;random-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;types-aux.lsp")
+(compile-and-load* "cons-aux.lsp")
+(compile-and-load* "random-aux.lsp")
+(compile-and-load* "types-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/gclload1.lsp b/gclload1.lsp
index 1404afc0..d5019163 100644
--- a/gclload1.lsp
+++ b/gclload1.lsp
@@ -23,12 +23,11 @@
 #+clisp (setq custom::*warn-on-floating-point-contagion* nil)
 
 ;;; Configure logical pathnames
-(setf (logical-pathname-translations "ANSI-TESTS")
-      `(("AUX;*.*.*"
-         ,(merge-pathnames "auxiliary/"
-                           (make-pathname
-                            :directory
-                            (pathname-directory *load-truename*))))))
+(defvar *aux-dir*
+  (merge-pathnames "auxiliary/"
+                   (make-pathname
+                    :directory
+                    (pathname-directory *load-truename*))))
 
 (let (*load-verbose* *load-print* *compile-verbose* *compile-print*)
   (load "compile-and-load.lsp"))
@@ -38,13 +37,13 @@
   (compile-and-load "rt.lsp")
   (load "cl-test-package.lsp")
   (in-package :cl-test)
-  (compile-and-load "ANSI-TESTS:AUX;ansi-aux-macros.lsp")
+  (compile-and-load* "ansi-aux-macros.lsp")
   (handler-bind
    #-sbcl ()
    #+sbcl ((sb-ext:code-deletion-note #'muffle-warning))
    (load "universe.lsp"))
-  (compile-and-load "ANSI-TESTS:AUX;random-aux.lsp")
-  (compile-and-load "ANSI-TESTS:AUX;ansi-aux.lsp")
+  (compile-and-load* "random-aux.lsp")
+  (compile-and-load* "ansi-aux.lsp")
   
   (load "cl-symbol-names.lsp")
   (load "notes.lsp"))
diff --git a/hash-tables/load.lsp b/hash-tables/load.lsp
index b5780d6d..eab70a68 100644
--- a/hash-tables/load.lsp
+++ b/hash-tables/load.lsp
@@ -1,4 +1,4 @@
-(compile-and-load "ANSI-TESTS:AUX;hash-table-aux.lsp")
+(compile-and-load* "hash-table-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/numbers/load.lsp b/numbers/load.lsp
index 619e4656..4317ead7 100644
--- a/numbers/load.lsp
+++ b/numbers/load.lsp
@@ -3,21 +3,21 @@
 ;;;; Created:  Mon Apr  7 07:16:44 2003
 ;;;; Contains: Forms to load files containing tests of number concepts
 
-(compile-and-load "ANSI-TESTS:AUX;numbers-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;random-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;floor-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;ffloor-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;ceiling-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;fceiling-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;truncate-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;ftruncate-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;round-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;fround-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;times-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;division-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;exp-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;gcd-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;types-aux.lsp")
+(compile-and-load* "numbers-aux.lsp")
+(compile-and-load* "random-aux.lsp")
+(compile-and-load* "floor-aux.lsp")
+(compile-and-load* "ffloor-aux.lsp")
+(compile-and-load* "ceiling-aux.lsp")
+(compile-and-load* "fceiling-aux.lsp")
+(compile-and-load* "truncate-aux.lsp")
+(compile-and-load* "ftruncate-aux.lsp")
+(compile-and-load* "round-aux.lsp")
+(compile-and-load* "fround-aux.lsp")
+(compile-and-load* "times-aux.lsp")
+(compile-and-load* "division-aux.lsp")
+(compile-and-load* "exp-aux.lsp")
+(compile-and-load* "gcd-aux.lsp")
+(compile-and-load* "types-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/objects/load.lsp b/objects/load.lsp
index 8c7692c5..fbfdce17 100644
--- a/objects/load.lsp
+++ b/objects/load.lsp
@@ -3,7 +3,7 @@
 ;;;; Created:  Mon Mar 24 03:39:09 2003
 ;;;; Contains: Loader for CLOS-related test files
 
-(compile-and-load "ANSI-TESTS:AUX;defclass-aux.lsp")
+(compile-and-load* "defclass-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/packages/load.lsp b/packages/load.lsp
index 9245c97d..fdc468db 100644
--- a/packages/load.lsp
+++ b/packages/load.lsp
@@ -3,8 +3,8 @@
 ;;;; Created:  Sun Oct  6 00:32:56 2002
 ;;;; Contains: Loader for files containing package tests
 
-(compile-and-load "ANSI-TESTS:AUX;packages00-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;package-aux.lsp")
+(compile-and-load* "packages00-aux.lsp")
+(compile-and-load* "package-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/pathnames/load.lsp b/pathnames/load.lsp
index 0bd8aa8c..54424879 100644
--- a/pathnames/load.lsp
+++ b/pathnames/load.lsp
@@ -1,5 +1,5 @@
 ;;;; Tests for pathnames and logical pathnames
-(compile-and-load "ANSI-TESTS:AUX;pathnames-aux.lsp")
+(compile-and-load* "pathnames-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/printer/load.lsp b/printer/load.lsp
index 4a65cc39..02940cf3 100644
--- a/printer/load.lsp
+++ b/printer/load.lsp
@@ -1,6 +1,6 @@
 ;;;; Tests of the lisp printer
-(compile-and-load "ANSI-TESTS:AUX;printer-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;backquote-aux.lsp")
+(compile-and-load* "printer-aux.lsp")
+(compile-and-load* "backquote-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/rctest/load.lsp b/rctest/load.lsp
index 16867853..554d9e5c 100644
--- a/rctest/load.lsp
+++ b/rctest/load.lsp
@@ -4,7 +4,7 @@
 (load "../rt-package.lsp")
 (compile-and-load "../rt.lsp")
 (load "../cl-test-package.lsp")
-(compile-and-load "ANSI-TESTS:AUX;random-aux.lsp")
+(compile-and-load* "random-aux.lsp")
 (load "rctest-package.lsp")
 (compile-and-load "rctest-util.lsp")
 (compile-and-load "generator.lsp")
diff --git a/rctest/rctest-package.lsp b/rctest/rctest-package.lsp
index f1660291..4d354f77 100644
--- a/rctest/rctest-package.lsp
+++ b/rctest/rctest-package.lsp
@@ -5,7 +5,7 @@
 
 (defpackage :rctest
   (:use :cl :cl-test)
-  (:import-from "COMMON-LISP-USER" #:compile-and-load)
+  (:import-from "COMMON-LISP-USER" #:compile-and-load #:compile-and-load*)
   (:export
    #:generate
    ))
diff --git a/reader/load.lsp b/reader/load.lsp
index de2bf595..0b4efb3b 100644
--- a/reader/load.lsp
+++ b/reader/load.lsp
@@ -1,5 +1,5 @@
 ;;;; Tests of the reader
-(compile-and-load "ANSI-TESTS:AUX;reader-aux.lsp")
+(compile-and-load* "reader-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/sequences/load.lsp b/sequences/load.lsp
index ea22f233..07ec2a79 100644
--- a/sequences/load.lsp
+++ b/sequences/load.lsp
@@ -1,8 +1,8 @@
 ;;; Tests of sequences
-(compile-and-load "ANSI-TESTS:AUX;search-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;subseq-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;remove-aux.lsp")
-(compile-and-load "ANSI-TESTS:AUX;remove-duplicates-aux.lsp")
+(compile-and-load* "search-aux.lsp")
+(compile-and-load* "subseq-aux.lsp")
+(compile-and-load* "remove-aux.lsp")
+(compile-and-load* "remove-duplicates-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/strings/load.lsp b/strings/load.lsp
index 3647cb69..2ac95fff 100644
--- a/strings/load.lsp
+++ b/strings/load.lsp
@@ -1,5 +1,5 @@
 ;;; Tests of strings
-(compile-and-load "ANSI-TESTS:AUX;string-aux.lsp")
+(compile-and-load* "string-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/symbols/load.lsp b/symbols/load.lsp
index 5ff13d07..e0a57034 100644
--- a/symbols/load.lsp
+++ b/symbols/load.lsp
@@ -1,5 +1,5 @@
 ;;; Tests of symbols
-(compile-and-load "ANSI-TESTS:AUX;cl-symbols-aux.lsp")
+(compile-and-load* "cl-symbols-aux.lsp")
 
 (in-package #:cl-test)
 
diff --git a/types-and-classes/load.lsp b/types-and-classes/load.lsp
index 94ed31df..704148cc 100644
--- a/types-and-classes/load.lsp
+++ b/types-and-classes/load.lsp
@@ -1,5 +1,5 @@
 ;;; Tests of types and classes
-(compile-and-load "ANSI-TESTS:AUX;types-aux.lsp")
+(compile-and-load* "types-aux.lsp")
 
 (in-package #:cl-test)
 
-- 
GitLab