0.8.8.8:
[sbcl.git] / contrib / sb-posix / posix-tests.lisp
index 4761a22..469b739 100644 (file)
   (sb-posix:chdir *current-directory*)
   0)
 
+(deftest chdir.6
+  (sb-posix:chdir "/../")
+  0)
+
+(deftest chdir.7
+  (sb-posix:chdir #p"/../")
+  0)
+
+(deftest chdir.8
+  (sb-posix:chdir (make-pathname :directory '(:absolute :up)))
+  0)
+
 (deftest chdir.error.1
   (let ((dne (make-pathname :directory '(:relative "chdir.does-not-exist"))))
     (handler-case
     (< (- atime unix-now) 10))
   t)
 
+(deftest stat.2
+  (let* ((stat (sb-posix:stat (make-pathname :directory '(:absolute :up))))
+        (mode (sb-posix::stat-mode stat)))
+    ;; it's logically possible for / to be writeable by others... but
+    ;; if it is, either someone is playing with strange security
+    ;; modules or they want to know about it anyway.
+    (logand mode sb-posix::s-iwoth))
+  0)
+
 ;;; FIXME: add tests for carrying a stat structure around in the
 ;;; optional argument to SB-POSIX:STAT
 
     (let ((*default-pathname-defaults* *test-directory*))
       (sb-posix:unlink (car (directory "*.txt")))))
   0)
-                        
+\f
+(deftest open.1
+  (let ((fd (sb-posix:open *test-directory* sb-posix::o-rdonly)))
+    (ignore-errors (sb-posix:close fd))
+    (< fd 0))
+  nil)
+
+(deftest open.error.1
+  (handler-case (sb-posix:open *test-directory* sb-posix::o-wronly)
+    (sb-posix:syscall-error (c)
+      (sb-posix:syscall-errno c)))
+  #.sb-posix::eisdir)
+
+(deftest fcntl.1
+  (let ((fd (sb-posix:open "/dev/null" sb-posix::o-nonblock)))
+    (= (sb-posix:fcntl fd sb-posix::f-getfl) sb-posix::o-nonblock))
+  t)