@@ -216,6 +216,23 @@ let test_unix_exceptions = bracket
216216 Zmq.Context. terminate ctx
217217 )
218218
219+ (* * Simple test to test eagain is raised when reading nonblocking from an empty queue *)
220+ let test_zmq_eagain = bracket
221+ (fun () ->
222+ let ctx = Zmq.Context. create () in
223+ let s = Zmq.Socket. create ctx pull in
224+ (ctx, s)
225+ )
226+ (fun (_ , s ) ->
227+ assert_raises ~msg: " Failed to raise EAGAIN" Unix. (Unix_error (EAGAIN , " zmq_msg_recv" , " " )) (fun _ -> Zmq.Socket. recv ~block: false s);
228+ ()
229+ )
230+ (fun (ctx , s ) ->
231+ Zmq.Socket. close s;
232+ Zmq.Context. terminate ctx
233+ )
234+
235+
219236(* * Test a Zmq specific exception *)
220237let test_zmq_exception = bracket
221238 (fun () ->
@@ -233,6 +250,8 @@ let test_zmq_exception = bracket
233250 Zmq.Context. terminate ctx;
234251 )
235252
253+
254+
236255let test_socket_gc () =
237256 let sock =
238257 let ctx = Zmq.Context. create () in
@@ -369,7 +388,8 @@ let suite =
369388 " monitor" > :: test_monitor;
370389 " z85 encoding/decoding" > :: test_z85;
371390 " unix exceptions" > :: test_unix_exceptions;
372- " zmq exceptions" > :: test_zmq_exception;
391+ " zmq exception intr" > :: test_zmq_exception;
392+ " zmq exception eagain" > :: test_zmq_eagain;
373393 (* Gc tests disabled, as resources will not be freed through finalisers
374394 "socket gc" >:: test_socket_gc;
375395 "context gc" >:: test_context_gc;
0 commit comments