sb-bsd-sockets: check for MAKE-ALIEN success in GET-PROTOCOL-BY-NAME
[sbcl.git] / contrib / sb-bsd-sockets / tests.lisp
index 66f8707..6f22017 100644 (file)
   (integerp (get-protocol-by-name "udp"))
   t)
 
+;;; See https://bugs.launchpad.net/sbcl/+bug/659857
+;;; Apparently getprotobyname_r on FreeBSD says -1 and EINTR
+;;; for unknown protocols...
+#-(and freebsd sb-thread)
 (deftest get-protocol-by-name/error
   (handler-case (get-protocol-by-name "nonexistent-protocol")
     (unknown-protocol ()
     ;; 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)