aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/end2end/end2end_test.cc5
-rw-r--r--test/cpp/end2end/thread_stress_test.cc2
-rw-r--r--test/cpp/util/time_test.cc9
3 files changed, 10 insertions, 6 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index f0d9f75214..403fffed5c 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -75,7 +75,7 @@ const char* kServerCancelAfterReads = "cancel_after_reads";
void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request,
EchoResponse* response) {
if (request->has_param() && request->param().echo_deadline()) {
- gpr_timespec deadline = gpr_inf_future;
+ gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_REALTIME);
if (context->deadline() != system_clock::time_point::max()) {
Timepoint2Timespec(context->deadline(), &deadline);
}
@@ -373,7 +373,8 @@ TEST_F(End2endTest, EchoDeadlineForNoDeadlineRpc) {
Status s = stub_->Echo(&context, request, &response);
EXPECT_EQ(response.message(), request.message());
EXPECT_TRUE(s.ok());
- EXPECT_EQ(response.param().request_deadline(), gpr_inf_future.tv_sec);
+ EXPECT_EQ(response.param().request_deadline(),
+ gpr_inf_future(GPR_CLOCK_REALTIME).tv_sec);
}
TEST_F(End2endTest, UnimplementedRpc) {
diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc
index 0b4d942566..cae34455b9 100644
--- a/test/cpp/end2end/thread_stress_test.cc
+++ b/test/cpp/end2end/thread_stress_test.cc
@@ -71,7 +71,7 @@ namespace {
void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request,
EchoResponse* response) {
if (request->has_param() && request->param().echo_deadline()) {
- gpr_timespec deadline = gpr_inf_future;
+ gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_REALTIME);
if (context->deadline() != system_clock::time_point::max()) {
Timepoint2Timespec(context->deadline(), &deadline);
}
diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc
index a3cfb1c961..1770a80574 100644
--- a/test/cpp/util/time_test.cc
+++ b/test/cpp/util/time_test.cc
@@ -47,6 +47,7 @@ class TimeTest : public ::testing::Test {};
TEST_F(TimeTest, AbsolutePointTest) {
long us = 10000000L;
gpr_timespec ts = gpr_time_from_micros(us);
+ ts.clock_type = GPR_CLOCK_REALTIME;
system_clock::time_point tp{microseconds(us)};
system_clock::time_point tp_converted = Timespec2Timepoint(ts);
gpr_timespec ts_converted;
@@ -61,15 +62,17 @@ TEST_F(TimeTest, AbsolutePointTest) {
// gpr_inf_future is treated specially and mapped to/from time_point::max()
TEST_F(TimeTest, InfFuture) {
EXPECT_EQ(system_clock::time_point::max(),
- Timespec2Timepoint(gpr_inf_future));
+ Timespec2Timepoint(gpr_inf_future(GPR_CLOCK_REALTIME)));
gpr_timespec from_time_point_max;
Timepoint2Timespec(system_clock::time_point::max(), &from_time_point_max);
- EXPECT_EQ(0, gpr_time_cmp(gpr_inf_future, from_time_point_max));
+ EXPECT_EQ(
+ 0, gpr_time_cmp(gpr_inf_future(GPR_CLOCK_REALTIME), from_time_point_max));
// This will cause an overflow
Timepoint2Timespec(
std::chrono::time_point<system_clock, std::chrono::seconds>::max(),
&from_time_point_max);
- EXPECT_EQ(0, gpr_time_cmp(gpr_inf_future, from_time_point_max));
+ EXPECT_EQ(
+ 0, gpr_time_cmp(gpr_inf_future(GPR_CLOCK_REALTIME), from_time_point_max));
}
} // namespace