Adjust wait timeout according to test slowdown factor

pull/22836/head
yang-g 5 years ago
parent b179868110
commit 88e43d9901
  1. 6
      test/core/util/test_config.cc

@ -18,6 +18,7 @@
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
#include <grpc/impl/codegen/gpr_types.h>
#include <inttypes.h> #include <inttypes.h>
#include <signal.h> #include <signal.h>
#include <stdbool.h> #include <stdbool.h>
@ -402,13 +403,12 @@ TestEnvironment::TestEnvironment(int argc, char** argv) {
TestEnvironment::~TestEnvironment() { TestEnvironment::~TestEnvironment() {
// This will wait until gRPC shutdown has actually happened to make sure // This will wait until gRPC shutdown has actually happened to make sure
// no gRPC resources (such as thread) are active. (timeout = 10s) // no gRPC resources (such as thread) are active. (timeout = 10s)
gpr_timespec timeout = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10);
gpr_time_from_seconds(10, GPR_TIMESPAN));
while (grpc_is_initialized()) { while (grpc_is_initialized()) {
grpc_maybe_wait_for_async_shutdown(); grpc_maybe_wait_for_async_shutdown();
gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_millis(1, GPR_TIMESPAN))); gpr_time_from_millis(1, GPR_TIMESPAN)));
if (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), timeout) > 0) { if (gpr_time_cmp(gpr_now(GPR_CLOCK_MONOTONIC), deadline) > 0) {
gpr_log(GPR_ERROR, "Timeout in waiting for gRPC shutdown"); gpr_log(GPR_ERROR, "Timeout in waiting for gRPC shutdown");
break; break;
} }

Loading…
Cancel
Save