0.9.1.27: (truename "symlink-to-dir") === (truename "symlink-to-dir/")
[sbcl.git] / tests / filesys.test.sh
index 62f900a..76f6338 100644 (file)
 # more information.
 
 # Test DIRECTORY and TRUENAME.
-testdir=`pwd`"/filesys-test-$$"
+testdir=`/bin/pwd`"/filesys-test-$$"
 mkdir $testdir
 echo this is a test > $testdir/test-1.tmp
 echo this is a test > $testdir/test-2.tmp
+echo this is a test > $testdir/wild\?test.tmp
 cd $testdir
+ln -s $testdir dirlinktest
 ln -s test-1.tmp link-1
 ln -s `pwd`/test-2.tmp link-2
 ln -s i-do-not-exist link-3
@@ -24,12 +26,14 @@ ln -s link-4 link-4
 ln -s link-5 link-6
 ln -s `pwd`/link-6 link-5
 expected_truenames=\
-"'(#p\"$testdir/link-3\"\
+"'(#p\"$testdir/\"\
+   #p\"$testdir/link-3\"\
    #p\"$testdir/link-4\"\
    #p\"$testdir/link-5\"\
    #p\"$testdir/link-6\"\
    #p\"$testdir/test-1.tmp\"\
-   #p\"$testdir/test-2.tmp\")"
+   #p\"$testdir/test-2.tmp\"\
+   #p\"$testdir/wild\\\\?test.tmp\")"
 $SBCL <<EOF
   (in-package :cl-user)
   (let* ((directory (directory "./*.*"))
@@ -37,6 +41,8 @@ $SBCL <<EOF
     (format t "~&TRUENAMES=~S~%" truenames)
     (finish-output)
     (assert (equal truenames $expected_truenames)))
+  (assert (equal (truename "dirlinktest") #p"$testdir/"))
+  (assert (equal (truename "dirlinktest/") #p"$testdir/"))
   (assert (equal (truename "test-1.tmp") #p"$testdir/test-1.tmp"))
   (assert (equal (truename "link-1")     #p"$testdir/test-1.tmp"))
   (assert (equal (truename "link-2")     #p"$testdir/test-2.tmp"))
@@ -86,6 +92,8 @@ mkdir animal/vertebrate/mammal/bear
 mkdir animal/vertebrate/mammal/mythical
 mkdir animal/vertebrate/mammal/rodent
 mkdir animal/vertebrate/mammal/ruminant
+touch animal/vertebrate/mammal/platypus
+touch animal/vertebrate/mammal/walrus
 touch animal/vertebrate/mammal/bear/grizzly
 touch animal/vertebrate/mammal/mythical/mermaid
 touch animal/vertebrate/mammal/mythical/unicorn
@@ -143,10 +151,8 @@ Lisp filename syntax idiosyncrasies)."
   ;; "/usr/bin" instead of the CMU-CL-style "/usr/bin/". In that case,
   ;; s:/":": in most or all the NEED-MATCHes here.
   (need-match "./*.*" '("animal/" "dirt" "plant/" "water"))
-  ;; FIXME: (DIRECTORY "*.*") doesn't work (bug 139). And it looks as
-  ;; though the same problem affects (DIRECTORY "animal") too.
-  #+nil (need-match "*.*" '("animal/" "dirt" "plant/" "water"))
-  #+nil (need-match "animal" '("animal/"))
+  (need-match "*.*" '("animal/" "dirt" "plant/" "water"))
+  (need-match "animal" '("animal/"))
   (need-match "./animal" '("animal/"))
   (need-match "animal/*.*" '("animal/invertebrate/" "animal/vertebrate/"))
   (need-match "animal/*/*.*"
@@ -173,22 +179,23 @@ Lisp filename syntax idiosyncrasies)."
                               "mammal/walrus"
                               "snake/" "snake/python"))))
     (need-match "animal/vertebrate/**/*.*" vertebrates)
-    ;; FIXME: In sbcl-0.pre7.109, DIRECTORY got confused on (I think...)
-    ;; absolute pathnames containing "../*" stuff. If I understood
-    ;; and remember correctly, CR's patch will fix this.
-    #|
     (need-match "animal/vertebrate/mammal/../**/*.*" vertebrates)
     (need-match "animal/vertebrate/mammal/../**/**/*.*" vertebrates)
+    #+nil
     (need-match "animal/vertebrate/mammal/mythical/../**/../**/*.*"
-               vertebrates)
-    |#
-    )
+               vertebrates))
   (need-match "animal/vertebrate/**/robot.*" nil)
   (need-match "animal/vertebrate/mammal/../**/*.robot" nil)
   (need-match "animal/vertebrate/mammal/../**/robot/*.*" nil)
+  #+nil
   (need-match "animal/vertebrate/mammal/robot/../**/../**/*.*" nil))
 (need-matches)
+(sb-ext:quit :unix-status 52)
 EOF
+if [ $? != 52 ]; then
+    echo DIRECTORY/TRUENAME test part 1 failed, unexpected SBCL return code=$?
+    exit 1
+fi
 cd ..
 rm -r $testdir