4dc3d8a554d94a0d8375e7fd3bfd940eba1db256
[sbcl.git] / tests / side-effectful-pathnames.test.sh
1 #!/bin/sh
2
3 sbcl="$1"
4
5 # LOADing and COMPILEing files with logical pathnames
6 testdir=`pwd`"/side-effectful-pathnames-test-$$"
7 testfilestem="load-test"
8 StudlyCapsStem="Load-Test"
9 testfilename="$testdir/$testfilestem.lisp"
10 mkdir $testdir
11 cat >$testfilename <<EOF
12   (in-package :cl-user)
13   (defparameter *loaded* :yes)
14 EOF
15 $sbcl <<EOF
16   (in-package :cl-user)
17   (setf (logical-pathname-translations "TEST")
18         (list (list "**;*.*.*" "$testdir/**/*.*")))
19   (format t "/translations=~S~%" (logical-pathname-translations "TEST"))
20   (let* ((untranslated "test:$StudlyCapsStem.lisp")
21          (ignore-me (format t "untranslated=~S~%" untranslated))
22          (translation (namestring (translate-logical-pathname untranslated)))
23          (expected-translation "$testdir/$testfilestem.lisp"))
24     (format t "translation=~S~%" translation)
25     (format t "expected-translation=~S~%" expected-translation)
26     (assert (string= translation expected-translation)))
27   (load "TEST:$StudlyCapsStem")
28   (assert (eq *loaded* :yes))
29   (let ((compiled-file-name (namestring (compile-file "TEST:$StudlyCapsStem")))
30         (expected-file-name "$testdir/$testfilestem.x86f"))
31     (format t "compiled-file-name=~S~%" compiled-file-name)
32     (format t "expected-file-name=~S~%" expected-file-name)
33     (assert (string= compiled-file-name expected-file-name)))
34   (sb-ext:quit :unix-status 52)
35 EOF
36 if [ $? != 52 ]; then
37     echo test failed: $?
38     exit 1
39 fi
40 rm -r $testdir
41
42 # success
43 exit 104