Changeset 13313


Ignore:
Timestamp:
06/08/11 16:03:16 (10 years ago)
Author:
Mark Evenson
Message:

Use directory derived from java.io.File.createTempFile() to write tests.

*TMP-DIRECTORY* now names the location used by the JAR-PATHNAME tests
to create and load tests.

Move the forms to compile into special variables.

Location:
trunk/abcl/test/lisp/abcl
Files:
3 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/test/lisp/abcl/jar-pathname.lisp

    r13086 r13313  
    33(defvar *jar-file-init* nil)
    44
     5(defparameter *tmp-directory*
     6  (make-pathname
     7   :directory (append
     8               (pathname-directory (pathname
     9                                    (java:jcall "getAbsolutePath"
     10                                                (java:jstatic "createTempFile" "java.io.File"
     11                                                              "jar" "tmp"))))
     12               '("jar-pathname-tests"))))
     13
     14
     15(defvar *foo.lisp*
     16  `((defun foo ()
     17      (labels ((output ()
     18                 (format t "FOO here.")))
     19        (output)))))
     20
     21(defvar *bar.lisp*
     22  `((defvar *pathname* *load-pathname*)
     23    (defvar *truename* *load-truename*)
     24
     25    (defun bar ()
     26      (labels
     27          ((output ()
     28             (format t "Some BAR~%*load-pathname* ~S~%*load-truename* ~S~%"
     29                     *pathname* *truename*)))
     30        (output)))
     31    (defvar *bar* t)
     32
     33    (defun baz ()
     34      (format t "Some BAZ"))))
     35
     36(defvar *eek.lisp*
     37  `((defun eek ()
     38      (format t "Another EEK."))
     39    (defun ook ()
     40      (let ((*load-verbose* t))
     41        (load (merge-pathnames #p"bar" *load-truename*))))
     42    (defun aak ()
     43      (format t "*LOAD-TRUENAME* is '~A'" *load-truename*))))
     44
     45(defun write-forms (forms path)
     46  (with-open-file (s path :direction :output :if-exists :supersede)
     47    (with-standard-io-syntax
     48      (dolist (form forms)
     49        (print form s)))))
     50
    551(defun jar-file-init ()
    6   (let* ((*default-pathname-defaults*  *abcl-test-directory*)
     52  (format t "~&Using ~A to create files for testing jar-pathnames.~%" *tmp-directory*)
     53  (ensure-directories-exist *tmp-directory*)
     54  (let* ((*default-pathname-defaults*  *tmp-directory*)
    755         (asdf::*verbose-out* *standard-output*))
     56    (write-forms *foo.lisp* "foo.lisp")
    857    (compile-file "foo.lisp")
     58    (write-forms *bar.lisp* "bar.lisp")
    959    (compile-file "bar.lisp")
     60    (write-forms *eek.lisp* "eek.lisp")
    1061    (compile-file "eek.lisp")
    11     (let* ((tmpdir (merge-pathnames "tmp/" *abcl-test-directory*))
     62    (let* ((tmpdir (merge-pathnames "tmp/" *tmp-directory*))
    1263           (subdirs
    1364            (mapcar (lambda (p) (merge-pathnames p tmpdir))
     
    3889
    3990(defmacro with-jar-file-init (&rest body)
    40   `(let ((*default-pathname-defaults* *abcl-test-directory*))
     91  `(let ((*default-pathname-defaults* *tmp-directory*))
    4192     (progn
    4293       (unless *jar-file-init*
     
    159210        (probe-file "jar:file:baz.jar!/a/b/bar.abcl"))
    160211  #p#.(format nil "jar:file:~A/baz.jar!/a/b/bar.abcl"
    161               (namestring *abcl-test-directory*)))
     212              (namestring *tmp-directory*)))
    162213
    163214(deftest jar-pathname.probe-file.3
     
    165216        (probe-file "jar:jar:file:baz.jar!/a/b/bar.abcl!/bar._"))
    166217   #p#.(format nil "jar:jar:file:~Abaz.jar!/a/b/bar.abcl!/bar._"
    167                        (namestring *abcl-test-directory*)))
     218                       (namestring *tmp-directory*)))
    168219
    169220(push 'jar-pathname.probe-file.4 *expected-failures*)
     
    172223        (probe-file "jar:file:baz.jar!/a/b"))
    173224  #p#.(format nil "jar:file:~Abaz.jar!/a/b/"
    174                        (namestring *abcl-test-directory*)))
     225                       (namestring *tmp-directory*)))
    175226
    176227(push 'jar-pathname.probe-file.5 *expected-failures*)
     
    179230        (probe-file "jar:file:baz.jar!/a/b/"))
    180231  #p#.(format nil "jar:file:~Abaz.jar!/a/b/"
    181                        (namestring *abcl-test-directory*)))
     232                       (namestring *tmp-directory*)))
    182233
    183234(deftest jar-pathname.probe-file.6
     
    185236        (probe-file "jar:file:baz.jar!/d/e+f/bar.abcl"))
    186237  #p#.(format nil "jar:file:~Abaz.jar!/d/e+f/bar.abcl"
    187                        (namestring *abcl-test-directory*)))
     238                       (namestring *tmp-directory*)))
    188239
    189240(deftest jar-pathname.merge-pathnames.1
Note: See TracChangeset for help on using the changeset viewer.