Commit 50d80d08 authored by sigiesec's avatar sigiesec Committed by Simon Giesecke

Problem: test_timeo frequently fails on travis, probably because of slow

execution

Solution: relax test assertion to what can be guaranteed
parent 88d8c768
......@@ -47,7 +47,8 @@ int main (void)
assert (zmq_errno () == EAGAIN);
// Check whether receive timeout is honored
int timeout = 250;
const int timeout = 250;
const int jitter = 50;
rc = zmq_setsockopt (frontend, ZMQ_RCVTIMEO, &timeout, sizeof (int));
assert (rc == 0);
......@@ -56,7 +57,14 @@ int main (void)
assert (rc == -1);
assert (zmq_errno () == EAGAIN);
unsigned int elapsed = zmq_stopwatch_stop (stopwatch) / 1000;
assert (elapsed > 200 && elapsed < 300);
assert (elapsed > timeout - jitter);
if (elapsed >= timeout + jitter) {
// we cannot assert this on a non-RT system
fprintf (stderr,
"zmq_recv took quite long, with a timeout of %i ms, it took "
"actually %i ms\n",
timeout, elapsed);
}
// Check that normal message flow works as expected
void *backend = zmq_socket (ctx, ZMQ_DEALER);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment