1.0.12.15: PPC/Darwin fixes
[sbcl.git] / contrib / sb-posix / posix-tests.lisp
index a0c17b7..98687c2 100644 (file)
     (logand mode sb-posix::s-iwoth))
   0)
 
+;; Test that stat can take a second argument.
+#-win32
+(deftest stat.5
+    (let* ((stat-1 (sb-posix:stat "/"))
+           (inode-1 (sb-posix:stat-ino stat-1))
+           (stat-2 (sb-posix:stat "/bin/sh"
+                                   stat-1))
+           (inode-2 (sb-posix:stat-ino stat-2)))
+      (values
+       (eq stat-1 stat-2)
+       (/= inode-1 inode-2)))
+  t
+  t)
+
+#+win32
+(deftest stat.5
+    (let* ((stat-1 (sb-posix:stat "/"))
+           (mode-1 (sb-posix:stat-mode stat-1))
+           (stat-2 (sb-posix:stat "C:\\CONFIG.SYS"
+                                   stat-1))
+           (mode-2 (sb-posix:stat-mode stat-2)))
+      (values
+       (eq stat-1 stat-2)
+       (/= mode-1 mode-2)))
+  t
+  t)
+
 ;;; FIXME: add tests for carrying a stat structure around in the
 ;;; optional argument to SB-POSIX:STAT
 
   (not (sb-posix:getpwnam "root"))
   nil)
 
+#-win32
+(deftest pwent.non-existing
+    ;; make sure that we get something sensible, not an error
+    (handler-case (progn (sb-posix:getpwnam "almost-certainly-does-not-exist")
+                         nil)
+      (t (cond) t))
+  nil)
+
+#-win32
+(deftest grent.1
+  ;; make sure that we found something
+  (not (sb-posix:getgrgid 0))
+  nil)
+
+#-win32
+(deftest grent.2
+  ;; make sure that we found something
+  (not (sb-posix:getgrnam "sys"))
+  nil)
+
+#-win32
+(deftest grent.non-existing
+    ;; make sure that we get something sensible, not an error
+    (handler-case (progn (sb-posix:getgrnam "almost-certainly-does-not-exist")
+                         nil)
+      (t (cond) t))
+  nil)
+
 #+nil
 ;; Requires root or special group + plus a sensible thing on the port
 (deftest cfget/setispeed.1
             (sb-posix:unlink non-link-pathname))))
     #.sb-posix:enotdir)
   )
+
+(deftest getcwd.1
+    ;; FIXME: something saner, please
+    (equal (sb-unix::posix-getcwd) (sb-posix:getcwd))
+  t)