aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/iomgr
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/iomgr')
-rw-r--r--test/core/iomgr/resource_quota_test.cc60
-rw-r--r--test/core/iomgr/tcp_posix_test.cc1
-rw-r--r--test/core/iomgr/tcp_server_posix_test.cc1
-rw-r--r--test/core/iomgr/timer_list_test.cc12
-rw-r--r--test/core/iomgr/udp_server_test.cc2
5 files changed, 39 insertions, 37 deletions
diff --git a/test/core/iomgr/resource_quota_test.cc b/test/core/iomgr/resource_quota_test.cc
index b44e8ce1be..7d793937b2 100644
--- a/test/core/iomgr/resource_quota_test.cc
+++ b/test/core/iomgr/resource_quota_test.cc
@@ -154,7 +154,7 @@ static void test_simple_async_alloc(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
}
@@ -177,7 +177,7 @@ static void test_async_alloc_blocked_by_size(void) {
{
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(
&ev, grpc_timeout_milliseconds_to_deadline(100)) == nullptr);
}
@@ -204,7 +204,7 @@ static void test_scavenge(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr1, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
;
@@ -218,7 +218,7 @@ static void test_scavenge(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr2, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
;
@@ -243,7 +243,7 @@ static void test_scavenge_blocked(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr1, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
;
@@ -252,14 +252,14 @@ static void test_scavenge_blocked(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr2, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(
&ev, grpc_timeout_milliseconds_to_deadline(100)) == nullptr);
}
{
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr1, 1024);
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
;
@@ -284,7 +284,7 @@ static void test_blocked_until_scheduled_reclaim(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
;
@@ -301,7 +301,7 @@ static void test_blocked_until_scheduled_reclaim(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaim_done,
grpc_timeout_seconds_to_deadline(5)) != nullptr);
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
@@ -328,7 +328,7 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr1, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
;
@@ -345,7 +345,7 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr2, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaim_done,
grpc_timeout_seconds_to_deadline(5)) != nullptr);
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
@@ -372,7 +372,7 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
;
@@ -389,7 +389,7 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaim_done,
grpc_timeout_seconds_to_deadline(5)) != nullptr);
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
@@ -420,7 +420,7 @@ static void test_unused_reclaim_is_cancelled(void) {
usr, false, make_unused_reclaimer(set_event(&benign_done)));
grpc_resource_user_post_reclaimer(
usr, true, make_unused_reclaimer(set_event(&destructive_done)));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr);
@@ -451,7 +451,7 @@ static void test_benign_reclaim_is_preferred(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
;
@@ -462,7 +462,7 @@ static void test_benign_reclaim_is_preferred(void) {
usr, false, make_reclaimer(usr, 1024, set_event(&benign_done)));
grpc_resource_user_post_reclaimer(
usr, true, make_unused_reclaimer(set_event(&destructive_done)));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr);
@@ -475,7 +475,7 @@ static void test_benign_reclaim_is_preferred(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_seconds_to_deadline(5)) != nullptr);
GPR_ASSERT(gpr_event_wait(&destructive_done,
@@ -511,7 +511,7 @@ static void test_multiple_reclaims_can_be_triggered(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
;
@@ -522,7 +522,7 @@ static void test_multiple_reclaims_can_be_triggered(void) {
usr, false, make_reclaimer(usr, 512, set_event(&benign_done)));
grpc_resource_user_post_reclaimer(
usr, true, make_reclaimer(usr, 512, set_event(&destructive_done)));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr);
@@ -535,7 +535,7 @@ static void test_multiple_reclaims_can_be_triggered(void) {
gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_seconds_to_deadline(5)) != nullptr);
GPR_ASSERT(gpr_event_wait(&destructive_done,
@@ -597,7 +597,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_post_reclaimer(
usr, false, make_unused_reclaimer(set_event(&reclaimer_cancelled)));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr);
@@ -607,7 +607,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
gpr_event_init(&allocated);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&allocated));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&allocated,
grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
@@ -617,7 +617,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
{
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_unref(usr);
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr);
@@ -625,7 +625,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
{
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024);
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_seconds_to_deadline(5)) !=
nullptr);
@@ -645,7 +645,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
gpr_event_init(&allocated);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&allocated));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&allocated,
grpc_timeout_seconds_to_deadline(5)) != nullptr);
}
@@ -656,7 +656,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_post_reclaimer(
usr, false, make_reclaimer(usr, 1024, set_event(&reclaimer_done)));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaimer_done,
grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr);
@@ -666,7 +666,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
gpr_event_init(&allocated);
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&allocated));
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&allocated,
grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&reclaimer_done,
@@ -701,7 +701,7 @@ static void test_one_slice(void) {
const int start_allocs = num_allocs;
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
-
+ grpc_core::ExecCtx::Get()->Flush();
assert_counter_becomes(&num_allocs, start_allocs + 1);
}
@@ -733,7 +733,7 @@ static void test_one_slice_deleted_late(void) {
const int start_allocs = num_allocs;
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
-
+ grpc_core::ExecCtx::Get()->Flush();
assert_counter_becomes(&num_allocs, start_allocs + 1);
}
@@ -775,7 +775,7 @@ static void test_negative_rq_free_pool(void) {
const int start_allocs = num_allocs;
grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
-
+ grpc_core::ExecCtx::Get()->Flush();
assert_counter_becomes(&num_allocs, start_allocs + 1);
}
diff --git a/test/core/iomgr/tcp_posix_test.cc b/test/core/iomgr/tcp_posix_test.cc
index 4018fe50bd..614ceaa02d 100644
--- a/test/core/iomgr/tcp_posix_test.cc
+++ b/test/core/iomgr/tcp_posix_test.cc
@@ -549,6 +549,7 @@ int main(int argc, char** argv) {
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
+ grpc_core::ExecCtx::Get()->Flush();
grpc_shutdown();
gpr_free(g_pollset);
diff --git a/test/core/iomgr/tcp_server_posix_test.cc b/test/core/iomgr/tcp_server_posix_test.cc
index ba9fe92c9c..a4dfa9e772 100644
--- a/test/core/iomgr/tcp_server_posix_test.cc
+++ b/test/core/iomgr/tcp_server_posix_test.cc
@@ -411,6 +411,7 @@ static void test_connect(size_t num_connects,
GPR_ASSERT(grpc_tcp_server_port_fd(s, 0, 0) >= 0);
grpc_tcp_server_unref(s);
+ grpc_core::ExecCtx::Get()->Flush();
/* Weak ref lost. */
GPR_ASSERT(weak_ref.server == nullptr);
diff --git a/test/core/iomgr/timer_list_test.cc b/test/core/iomgr/timer_list_test.cc
index a4a53a0e46..329b767f32 100644
--- a/test/core/iomgr/timer_list_test.cc
+++ b/test/core/iomgr/timer_list_test.cc
@@ -72,7 +72,7 @@ static void add_test(void) {
/* collect timers. Only the first batch should be ready. */
grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 500);
GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_FIRED);
-
+ grpc_core::ExecCtx::Get()->Flush();
for (i = 0; i < 20; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 10));
GPR_ASSERT(cb_called[i][0] == 0);
@@ -80,7 +80,7 @@ static void add_test(void) {
grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 600);
GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_CHECKED_AND_EMPTY);
-
+ grpc_core::ExecCtx::Get()->Flush();
for (i = 0; i < 30; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 10));
GPR_ASSERT(cb_called[i][0] == 0);
@@ -89,7 +89,7 @@ static void add_test(void) {
/* collect the rest of the timers */
grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 1500);
GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_FIRED);
-
+ grpc_core::ExecCtx::Get()->Flush();
for (i = 0; i < 30; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 20));
GPR_ASSERT(cb_called[i][0] == 0);
@@ -135,16 +135,16 @@ void destruction_test(void) {
GRPC_CLOSURE_CREATE(cb, (void*)(intptr_t)4, grpc_schedule_on_exec_ctx));
grpc_core::ExecCtx::Get()->TestOnlySetNow(2);
GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_FIRED);
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(1 == cb_called[4][1]);
grpc_timer_cancel(&timers[0]);
grpc_timer_cancel(&timers[3]);
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(1 == cb_called[0][0]);
GPR_ASSERT(1 == cb_called[3][0]);
grpc_timer_list_shutdown();
-
+ grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(1 == cb_called[1][0]);
GPR_ASSERT(1 == cb_called[2][0]);
}
diff --git a/test/core/iomgr/udp_server_test.cc b/test/core/iomgr/udp_server_test.cc
index 2c5719f4ae..e271acbeef 100644
--- a/test/core/iomgr/udp_server_test.cc
+++ b/test/core/iomgr/udp_server_test.cc
@@ -308,7 +308,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed);
-
+ grpc_core::ExecCtx::Get()->Flush();
gpr_free(g_pollset);
grpc_shutdown();
return 0;