1.0.10.36: support for Darwin versions that support __DARWIN_UNIX03
[sbcl.git] / contrib / sb-bsd-sockets / tests.lisp
index 420c123..de2a441 100644 (file)
     ;; way to check the condition stuff on its own, which is a shame
     (handler-case
         (make-instance 'inet-socket :type :stream :protocol (get-protocol-by-name "udp"))
-      ((or socket-type-not-supported-error protocol-not-supported-error) (c)
+      ;; CLH FIXME! some versions of darwin just return a socket error
+      ;; here, not socket-type-not-supported-error or
+      ;; protocol-not-supported-error.
+      ((or #+darwin socket-error
+        socket-type-not-supported-error
+        protocol-not-supported-error)
+          (c)
         (declare (ignorable c)) t)
       (:no-error nil))
   t)
     ;; same again with keywords
     (handler-case
         (make-instance 'inet-socket :type :stream :protocol :udp)
-      ((or protocol-not-supported-error socket-type-not-supported-error) (c)
+      ;; CLH FIXME! some versions of darwin just return a socket error
+      ;; here, not socket-type-not-supported-error or
+      ;; protocol-not-supported-error.
+      ((or
+        #+darwin socket-error
+        protocol-not-supported-error
+        socket-type-not-supported-error)
+          (c)
         (declare (ignorable c)) t)
       (:no-error nil))
   t)
       ;; something, so don't fail this test just because the file is
       ;; unavailable, or if it's a symlink to some weird character
       ;; device.
-      (when (and (probe-file "/dev/log")
-                 (sb-posix:s-issock
-                  (sb-posix::stat-mode (sb-posix:stat "/dev/log"))))
+      (when (block nil
+              (handler-bind ((sb-posix:syscall-error
+                              (lambda (e)
+                                (declare (ignore e))
+                                (return nil))))
+                (sb-posix:s-issock
+                 (sb-posix::stat-mode (sb-posix:stat "/dev/log")))))
         (let ((s (make-instance 'local-socket :type :datagram)))
           (format t "Connecting ~A... " s)
           (finish-output)