* tests/ports.test (non-blocking-I/O): a couple more details:
authorGary Houston <ghouston@arglist.com>
Fri, 31 Mar 2000 19:23:52 +0000 (19:23 +0000)
committerGary Houston <ghouston@arglist.com>
Fri, 31 Mar 2000 19:23:52 +0000 (19:23 +0000)
a) combine the O_NONBLOCK flag with the default flags instead
of replacing them.  b) check EWOULDBLOCK as well as EAGAIN.

test-suite/tests/ports.test

index 5c508a9..6a4357f 100644 (file)
                                    (string=? (read-line) "moon")))))
 
 ;;; non-blocking mode on a port.  create a pipe and set O_NONBLOCK on
-;;; the reading end.  try to read a byte: should get EAGAIN error.
+;;; the reading end.  try to read a byte: should get EAGAIN or
+;;; EWOULDBLOCK error.
 (catch-test-errors
  (let* ((p (pipe))
        (r (car p)))
-   (fcntl r F_SETFL O_NONBLOCK)
+   (fcntl r F_SETFL (logior (fcntl r F_GETFL) O_NONBLOCK))
    (pass-if "non-blocking-I/O"
            (catch 'system-error
                   (lambda () (read-char r) #f)
                   (lambda (key . args)
                     (and (eq? key 'system-error)
-                         (= (car (list-ref args 3)) EAGAIN)))))))
-
+                         (let ((errno (car (list-ref args 3))))
+                           (or (= errno EAGAIN)
+                               (= errno EWOULDBLOCK)))))))))
 \f
 ;;;; Pipe (popen) ports.