From 3a73624eddefb7eca2a9af957e90c3c382f5faf7 Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <tunes@google.com>
Date: Tue, 15 Jan 2013 00:53:02 -0500
Subject: [PATCH] Frob tests

---
 test/static-and-serial.asd            | 12 --------
 test/test-compile-file-failure.script |  2 --
 test/test-encodings.script            | 33 +++++++++-----------
 test/test-static-and-serial.script    | 44 +++++++++++++++++----------
 4 files changed, 43 insertions(+), 48 deletions(-)
 delete mode 100644 test/static-and-serial.asd

diff --git a/test/static-and-serial.asd b/test/static-and-serial.asd
deleted file mode 100644
index 2e4842aa0..000000000
--- a/test/static-and-serial.asd
+++ /dev/null
@@ -1,12 +0,0 @@
-#|
-make sure that serial t and static-files don't cause full rebuilds all
-the time...
-|#
-
-(defsystem static-and-serial
-  :version "0.1"
-  :serial t
-  :components
-  ((:static-file "file2.lisp")
-   (:static-file "run-tests.sh")
-   (:file "file1")))
diff --git a/test/test-compile-file-failure.script b/test/test-compile-file-failure.script
index 525a63b1e..668fd8f70 100644
--- a/test/test-compile-file-failure.script
+++ b/test/test-compile-file-failure.script
@@ -2,8 +2,6 @@
 (load "script-support.lisp")
 (load-asdf)
 
-(trace d:match-any-condition-p)
-
 (with-test ()
  #-gcl<2.7
  (assert (handler-case
diff --git a/test/test-encodings.script b/test/test-encodings.script
index cc62fbb0b..6ccd11e52 100644
--- a/test/test-encodings.script
+++ b/test/test-encodings.script
@@ -46,14 +46,10 @@
   #-asdf-unicode
   (leave-test "No Unicode support to test on this lisp implementation" 0)
 
-  (unless (find-system :asdf-encodings nil)
-    (leave-test "ASDF-ENCODINGS is not installed next to ASDF. Skipping the rest the test." 0))
-
   ;; NB: recent clozure can autodetect without asdf-encodings with :default (!)
 
-  #+(and asdf-unicode sbcl)
+  #+sbcl
   (progn
-    #+clozure (setf ccl:*default-external-format* :latin3)
     #+sbcl (setf sb-impl::*default-external-format* :latin-3)
     (with-encoding-test (:default)
       (defsystem :test-encoding-explicit-default
@@ -62,19 +58,20 @@
       (defsystem :test-encoding-implicit-default
         :components ((:file "lambda")))))
 
-  #+asdf-unicode
-  (progn
-    ;; BEWARE: For testing purposes, we assume ASDF-ENCODINGS is under the same root as ASDF.
-    (pushnew (asdf::subpathname *asdf-directory* "../asdf-encodings/") asdf:*central-registry*)
-    (asdf:load-system :asdf-encodings)
-    #-lispworks
-    (with-encoding-test (:latin-2)
-      (defsystem :test-encoding-implicit-autodetect
-        :components ((:file "lambda"))))
-    #+sbcl
-    (with-encoding-test (:koi8-r)
-      (defsystem :test-encoding-explicit-koi8-r
-        :components ((:file "lambda" :encoding :koi8-r)))))
+  ;; BEWARE: For testing purposes, we assume ASDF-ENCODINGS is under the same root as ASDF.
+  (pushnew (asdf::subpathname *asdf-directory* "../asdf-encodings/") asdf:*central-registry*)
+  (unless (find-system :asdf-encodings nil)
+    (leave-test "ASDF-ENCODINGS is not installed next to ASDF. Skipping the rest the test." 0))
+
+  (asdf:load-system :asdf-encodings)
+  #-lispworks
+  (with-encoding-test (:latin-2)
+    (defsystem :test-encoding-implicit-autodetect
+      :components ((:file "lambda"))))
+  #+sbcl
+  (with-encoding-test (:koi8-r)
+    (defsystem :test-encoding-explicit-koi8-r
+      :components ((:file "lambda" :encoding :koi8-r))))
 
   (with-encoding-test (:utf-8)
     (defsystem :test-file-encoding-u8
diff --git a/test/test-static-and-serial.script b/test/test-static-and-serial.script
index 027666484..79a33d503 100644
--- a/test/test-static-and-serial.script
+++ b/test/test-static-and-serial.script
@@ -10,22 +10,34 @@ don't cause full rebuilds all the time...
 
 (with-test ()
 
- (load-test-system 'static-and-serial)
+  (let ((s '(defsystem static-and-serial
+              :version "0.1"
+              :serial t
+              :components
+              ((:static-file "file2.lisp")
+               (:static-file "run-tests.sh")
+               (:file "file1")))))
+    (eval s)
+    (load-test-system 'static-and-serial)
 
- (let* ((file1 (asdf:compile-file-pathname* "file1.lisp"))
-        (file1-date (file-write-date file1))
-        (date1 (- file1-date 600))
-        (date2 (- file1-date 300))
-        (date3 (- file1-date 150)))
+    (let* ((file1 (asdf:compile-file-pathname* "file1.lisp"))
+           (file1-date (file-write-date file1))
+           (date1 (- file1-date 600))
+           (date2 (- file1-date 300))
+           (date3 (- file1-date 150)))
 
-   (assert file1-date)
-   (format t "file: ~S~%date: ~S~%" file1 file1-date)
+      (assert file1-date)
+      (assert (symbol-value (find-symbol (symbol-name :*file1*) :test-package)))
+      (format t "file: ~S~%date: ~S~%" file1 file1-date)
 
-   ;; date should stay same
-   (clear-system 'static-and-serial)
-   (touch-file "static-and-serial.asd" :offset -10000)
-   (touch-file "file2.lisp" :timestamp date1)
-   (touch-file "file1.lisp" :timestamp date2)
-   (touch-file file1 :timestamp date3)
-   (DBG "load again" (oos 'load-op 'static-and-serial))
-   (assert-equal (file-write-date file1) date3)))
+      ;; date should stay same
+      (clear-system 'static-and-serial)
+      (delete-package :test-package)
+      (eval s)
+      (touch-file "file2.lisp" :timestamp date1)
+      (touch-file "run-tests.sh" :timestamp date1)
+      (touch-file "file1.lisp" :timestamp date2)
+      (touch-file file1 :timestamp date3)
+      (DBG "load again" (oos 'load-op 'static-and-serial))
+      (assert (symbol-value (find-symbol (symbol-name :*file1*) :test-package)))
+      (assert-equal (file-write-date file1) date3))))
-- 
GitLab