aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/iomgr
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-01-27 11:37:37 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-01-27 11:37:37 -0800
commitcda759d658980346eb6a5673a36cda7f1906da3e (patch)
tree1780af79c602f6996e3fee01e9964a5d292a1e94 /test/core/iomgr
parent46357c882df1afc28f7a5228c40fde522093fa32 (diff)
Add an error to fd_shutdown (and recursively)
Allows diagnosing WHY a file descriptor was shutdown prematurely.
Diffstat (limited to 'test/core/iomgr')
-rw-r--r--test/core/iomgr/endpoint_tests.c12
-rw-r--r--test/core/iomgr/ev_epoll_linux_test.c3
-rw-r--r--test/core/iomgr/fd_posix_test.c3
-rw-r--r--test/core/iomgr/tcp_client_posix_test.c3
-rw-r--r--test/core/iomgr/tcp_server_posix_test.c2
5 files changed, 15 insertions, 8 deletions
diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c
index df5dd20903..bbc5f383f6 100644
--- a/test/core/iomgr/endpoint_tests.c
+++ b/test/core/iomgr/endpoint_tests.c
@@ -233,9 +233,11 @@ static void read_and_write_test(grpc_endpoint_test_config config,
if (shutdown) {
gpr_log(GPR_DEBUG, "shutdown read");
- grpc_endpoint_shutdown(&exec_ctx, state.read_ep);
+ grpc_endpoint_shutdown(&exec_ctx, state.read_ep,
+ GRPC_ERROR_CREATE("Test Shutdown"));
gpr_log(GPR_DEBUG, "shutdown write");
- grpc_endpoint_shutdown(&exec_ctx, state.write_ep);
+ grpc_endpoint_shutdown(&exec_ctx, state.write_ep,
+ GRPC_ERROR_CREATE("Test Shutdown"));
}
grpc_exec_ctx_flush(&exec_ctx);
@@ -296,7 +298,8 @@ static void multiple_shutdown_test(grpc_endpoint_test_config config) {
grpc_closure_create(inc_on_failure, &fail_count,
grpc_schedule_on_exec_ctx));
wait_for_fail_count(&exec_ctx, &fail_count, 0);
- grpc_endpoint_shutdown(&exec_ctx, f.client_ep);
+ grpc_endpoint_shutdown(&exec_ctx, f.client_ep,
+ GRPC_ERROR_CREATE("Test Shutdown"));
wait_for_fail_count(&exec_ctx, &fail_count, 1);
grpc_endpoint_read(&exec_ctx, f.client_ep, &slice_buffer,
grpc_closure_create(inc_on_failure, &fail_count,
@@ -307,7 +310,8 @@ static void multiple_shutdown_test(grpc_endpoint_test_config config) {
grpc_closure_create(inc_on_failure, &fail_count,
grpc_schedule_on_exec_ctx));
wait_for_fail_count(&exec_ctx, &fail_count, 3);
- grpc_endpoint_shutdown(&exec_ctx, f.client_ep);
+ grpc_endpoint_shutdown(&exec_ctx, f.client_ep,
+ GRPC_ERROR_CREATE("Test Shutdown"));
wait_for_fail_count(&exec_ctx, &fail_count, 3);
grpc_slice_buffer_destroy_internal(&exec_ctx, &slice_buffer);
diff --git a/test/core/iomgr/ev_epoll_linux_test.c b/test/core/iomgr/ev_epoll_linux_test.c
index a10be7f81b..5b05ea3338 100644
--- a/test/core/iomgr/ev_epoll_linux_test.c
+++ b/test/core/iomgr/ev_epoll_linux_test.c
@@ -89,7 +89,8 @@ static void test_fd_cleanup(grpc_exec_ctx *exec_ctx, test_fd *tfds,
int i;
for (i = 0; i < num_fds; i++) {
- grpc_fd_shutdown(exec_ctx, tfds[i].fd);
+ grpc_fd_shutdown(exec_ctx, tfds[i].fd,
+ GRPC_ERROR_CREATE("test_fd_cleanup"));
grpc_exec_ctx_flush(exec_ctx);
grpc_fd_orphan(exec_ctx, tfds[i].fd, NULL, &release_fd, "test_fd_cleanup");
diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c
index a617bfc646..4726e935d8 100644
--- a/test/core/iomgr/fd_posix_test.c
+++ b/test/core/iomgr/fd_posix_test.c
@@ -132,7 +132,8 @@ static void session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */
grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, "a");
gpr_free(se);
/* Start to shutdown listen fd. */
- grpc_fd_shutdown(exec_ctx, sv->em_fd);
+ grpc_fd_shutdown(exec_ctx, sv->em_fd,
+ GRPC_ERROR_CREATE("session_shutdown_cb"));
}
/* Called when data become readable in a session. */
diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c
index 0ea7a000eb..6bb00bc787 100644
--- a/test/core/iomgr/tcp_client_posix_test.c
+++ b/test/core/iomgr/tcp_client_posix_test.c
@@ -72,7 +72,8 @@ static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
GPR_ASSERT(g_connecting != NULL);
GPR_ASSERT(error == GRPC_ERROR_NONE);
- grpc_endpoint_shutdown(exec_ctx, g_connecting);
+ grpc_endpoint_shutdown(exec_ctx, g_connecting,
+ GRPC_ERROR_CREATE("must_succeed called"));
grpc_endpoint_destroy(exec_ctx, g_connecting);
g_connecting = NULL;
finish_connection();
diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c
index 020f005980..417bc5111a 100644
--- a/test/core/iomgr/tcp_server_posix_test.c
+++ b/test/core/iomgr/tcp_server_posix_test.c
@@ -121,7 +121,7 @@ static void server_weak_ref_set(server_weak_ref *weak_ref,
static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
grpc_pollset *pollset,
grpc_tcp_server_acceptor *acceptor) {
- grpc_endpoint_shutdown(exec_ctx, tcp);
+ grpc_endpoint_shutdown(exec_ctx, tcp, GRPC_ERROR_CREATE("Connected"));
grpc_endpoint_destroy(exec_ctx, tcp);
on_connect_result temp_result;