Commit 4842b6bd authored by hitstergtd's avatar hitstergtd

Problem: No coverage for ctx termination errors

Solution:
- Add error state coverage for zmq_ctx_term(), zmq_term() and
  zmq_ctx_shutdown(); zmq_ctx_destroy() is already covered since it only
  calls zmq_ctx_term()
- Add coverage for zmq_term()
parent f8c93d50
...@@ -50,7 +50,13 @@ void test_ctx_destroy() ...@@ -50,7 +50,13 @@ void test_ctx_destroy()
// Close the socket // Close the socket
rc = zmq_close (socket); rc = zmq_close (socket);
assert (rc == 0); assert (rc == 0);
// Test error - API has multiple ways to kill Contexts
rc = zmq_ctx_term (NULL);
assert (rc == -1 && errno == EFAULT);
rc = zmq_term (NULL);
assert (rc == -1 && errno == EFAULT);
// Destroy the context // Destroy the context
rc = zmq_ctx_destroy (ctx); rc = zmq_ctx_destroy (ctx);
assert (rc == 0); assert (rc == 0);
...@@ -73,6 +79,10 @@ void test_ctx_shutdown() ...@@ -73,6 +79,10 @@ void test_ctx_shutdown()
// Wait for thread to start up and block // Wait for thread to start up and block
msleep (SETTLE_TIME); msleep (SETTLE_TIME);
// Test error - Shutdown context
rc = zmq_ctx_shutdown (NULL);
assert (rc == -1 && errno == EFAULT);
// Shutdown context, if we used destroy here we would deadlock. // Shutdown context, if we used destroy here we would deadlock.
rc = zmq_ctx_shutdown (ctx); rc = zmq_ctx_shutdown (ctx);
assert (rc == 0); assert (rc == 0);
......
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