diff options
author | 2017-12-08 10:19:56 -0800 | |
---|---|---|
committer | 2017-12-08 10:19:56 -0800 | |
commit | ca398ee74a7aed2a45ae58e3c5753c4c99e4d683 (patch) | |
tree | 0e49ba3759a117b66c598158d6ba745178a8ffce /test/core/iomgr/fd_conservation_posix_test.cc | |
parent | 54961bb9e16f84d193077277f7d2d8269f57a411 (diff) | |
parent | 94e676e10f8c739289924b8458a246699e3623ce (diff) |
Merge branch 'master' into cv-wait-monotonic
Diffstat (limited to 'test/core/iomgr/fd_conservation_posix_test.cc')
-rw-r--r-- | test/core/iomgr/fd_conservation_posix_test.cc | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/test/core/iomgr/fd_conservation_posix_test.cc b/test/core/iomgr/fd_conservation_posix_test.cc index f46430c611..aaa14010f8 100644 --- a/test/core/iomgr/fd_conservation_posix_test.cc +++ b/test/core/iomgr/fd_conservation_posix_test.cc @@ -31,26 +31,27 @@ int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - - /* set max # of file descriptors to a low value, and - verify we can create and destroy many more than this number - of descriptors */ - rlim.rlim_cur = rlim.rlim_max = 10; - GPR_ASSERT(0 == setrlimit(RLIMIT_NOFILE, &rlim)); - grpc_resource_quota* resource_quota = - grpc_resource_quota_create("fd_conservation_posix_test"); - - for (i = 0; i < 100; i++) { - p = grpc_iomgr_create_endpoint_pair("test", nullptr); - grpc_endpoint_destroy(&exec_ctx, p.client); - grpc_endpoint_destroy(&exec_ctx, p.server); - grpc_exec_ctx_flush(&exec_ctx); + { + grpc_core::ExecCtx exec_ctx; + + /* set max # of file descriptors to a low value, and + verify we can create and destroy many more than this number + of descriptors */ + rlim.rlim_cur = rlim.rlim_max = 10; + GPR_ASSERT(0 == setrlimit(RLIMIT_NOFILE, &rlim)); + grpc_resource_quota* resource_quota = + grpc_resource_quota_create("fd_conservation_posix_test"); + + for (i = 0; i < 100; i++) { + p = grpc_iomgr_create_endpoint_pair("test", NULL); + grpc_endpoint_destroy(p.client); + grpc_endpoint_destroy(p.server); + grpc_core::ExecCtx::Get()->Flush(); + } + + grpc_resource_quota_unref(resource_quota); } - grpc_resource_quota_unref(resource_quota); - - grpc_exec_ctx_finish(&exec_ctx); grpc_shutdown(); return 0; } |