1999-09-14 Gary Houston <ghouston@freewire.co.uk>

* tests/ports.test: test non-blocking I/O.
This commit is contained in:
Gary Houston 1999-09-14 20:48:00 +00:00
commit 6e822cce6a
2 changed files with 18 additions and 1 deletions

View file

@ -1,3 +1,7 @@
1999-09-14 Gary Houston <ghouston@freewire.co.uk>
* tests/ports.test: test non-blocking I/O.
1999-09-11 Jim Blandy <jimb@savonarola.red-bean.com>
* tests/strings.test: Add test for substring-move! argument checking.

View file

@ -167,8 +167,21 @@
(pass-if "unread residue"
(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.
(catch-test-errors
(let* ((p (pipe))
(r (car p)))
(fcntl r F_SETFL O_NONBLOCK)
(pass-if "non-blocking-I/O"
(catch 'system-error
(lambda () (read-char r))
(lambda (key . args)
(and (eq? key 'system-error)
(= (car (list-ref args 3)) EAGAIN)))))))
;;;; Pipe ports.
;;;; Pipe (popen) ports.
;;; Run a command, and read its output.
(catch-test-errors