aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2015-06-02 08:46:41 -0700
committerGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2015-06-02 08:46:41 -0700
commit206e6e844140a3a477d65767d4a92e19d9893e56 (patch)
treef449c379b044399e84e2d3e3b2095bc1e9df75be /test/core
parent86686746f6b3fc095cdf94868b4d9d82a86275c8 (diff)
parentc0c484481f2824b11f59c1c2bb77c9af07e15378 (diff)
Merge pull request #1864 from ctiller/cq-says-what
Add a completion queue test
Diffstat (limited to 'test/core')
-rw-r--r--test/core/surface/completion_queue_test.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c
index e26f379bfc..9e7b2ea1df 100644
--- a/test/core/surface/completion_queue_test.c
+++ b/test/core/surface/completion_queue_test.c
@@ -94,6 +94,26 @@ static void test_cq_end_op(void) {
shutdown_and_destroy(cc);
}
+static void test_shutdown_then_next_polling(void) {
+ grpc_completion_queue *cc;
+ LOG_TEST("test_shutdown_then_next_polling");
+
+ cc = grpc_completion_queue_create();
+ grpc_completion_queue_shutdown(cc);
+ GPR_ASSERT(grpc_completion_queue_next(cc, gpr_inf_past).type == GRPC_QUEUE_SHUTDOWN);
+ grpc_completion_queue_destroy(cc);
+}
+
+static void test_shutdown_then_next_with_timeout(void) {
+ grpc_completion_queue *cc;
+ LOG_TEST("test_shutdown_then_next_with_timeout");
+
+ cc = grpc_completion_queue_create();
+ grpc_completion_queue_shutdown(cc);
+ GPR_ASSERT(grpc_completion_queue_next(cc, gpr_inf_future).type == GRPC_QUEUE_SHUTDOWN);
+ grpc_completion_queue_destroy(cc);
+}
+
static void test_pluck(void) {
grpc_event ev;
grpc_completion_queue *cc;
@@ -291,6 +311,8 @@ int main(int argc, char **argv) {
grpc_iomgr_init();
test_no_op();
test_wait_empty();
+ test_shutdown_then_next_polling();
+ test_shutdown_then_next_with_timeout();
test_cq_end_op();
test_pluck();
test_threading(1, 1);