3 # This software is part of the SBCL system. See the README file for
6 # While most of SBCL is derived from the CMU CL system, the test
7 # files (like this one) were written from scratch after the fork
10 # This software is in the public domain and is provided with
11 # absolutely no warranty. See the COPYING and CREDITS files for
17 testdir="`pwd -P`" # resolve symbolic links in the directory.
19 # LOADing and COMPILEing files with logical pathnames
20 testfilestem="load-test"
21 StudlyCapsStem="Load-Test"
22 testfilename="$testfilestem.lisp"
23 cat >$testfilename <<EOF
25 (defparameter *loaded* :yes)
29 (setf (logical-pathname-translations "TEST")
30 (list (list "**;*.*.*" "$testdir/**/*.*")))
31 (format t "/translations=~S~%" (logical-pathname-translations "TEST"))
32 (let* ((untranslated "test:$StudlyCapsStem.lisp")
33 (ignore-me (format t "untranslated=~S~%" untranslated))
34 (translation (namestring (translate-logical-pathname untranslated)))
35 (expected-translation "$testdir/$testfilestem.lisp"))
36 (format t "translation=~S~%" translation)
37 (format t "expected-translation=~S~%" expected-translation)
38 (assert (string= translation expected-translation)))
39 (format t "about to LOAD ~S~%" "TEST:$StudlyCapsStem")
40 (load "TEST:$StudlyCapsStem")
41 (assert (eq *loaded* :yes))
42 (let ((compiled-file-name (namestring (compile-file "TEST:$StudlyCapsStem")))
43 (expected-file-name "$testdir/$testfilestem.fasl"))
44 (format t "compiled-file-name=~S~%" compiled-file-name)
45 (format t "expected-file-name=~S~%" expected-file-name)
46 (assert (string= compiled-file-name expected-file-name)))
47 (sb-ext:quit :unix-status $EXIT_LISP_WIN)
49 check_status_maybe_lose "LOAD/COMPILE" $?
51 # In the flaky1 branch, Dan Barlow pointed out that
52 # ENSURE-DIRECTORIES-EXIST failed for these relative pathname
53 # operations when the mysterious special case handling of "" pathnames
54 # was removed from UNIX-STAT. Let's make sure that it works now.
56 # Set up an empty directory to work with.
57 testdir="${TMPDIR:-/tmp}/sbcl-mkdir-test-$$"
58 if ! rm -rf "$testdir" ; then
59 echo "$testdir already exists and could not be deleted"
67 (let ((rel-name #p"foo/bar/")
68 (abs-name (merge-pathnames #p"baz/quux/" (truename "."))))
70 (equalp (ensure-directories-exist abs-name) abs-name)
71 (equalp (ensure-directories-exist rel-name) rel-name)
72 (sb-ext:quit :unix-status 52)))
74 check_status_maybe_lose "ENSURE-DIRECTORIES-EXIST" $?
75 if [ ! -d "$testdir/foo/bar" ] ; then
76 echo test failed: "$testdir/foo/bar" is not a directory
77 find "$testdir" -print
80 if [ ! -d "$testdir/baz/quux" ] ; then
81 echo test failed: "$testdir/baz/quux" is not a directory
82 find "$testdir" -print
86 # We succeeded, life is good. Now we don't need the test directory
87 # any more; and come back home.