Go to the documentation of this file.
26 #include <gtest/gtest.h>
28 #include "absl/time/time.h"
49 const char* argv[] = {
const_cast<const char*
>(
"sh"),
50 const_cast<const char*
>(
"-c"),
cmd,
nullptr};
53 status = posix_spawn(&pid,
const_cast<const char*
>(
"/bin/sh"),
nullptr,
54 nullptr,
const_cast<char**
>(argv),
environ);
56 if (waitpid(pid, &
status, 0) == -1) {
76 run_cmd(
"sudo sntp -sS pool.ntp.org");
85 return {
"-1M",
"+1M",
"-1H",
"+1H",
"-1d",
"+1d",
"-1y",
"+1y"};
100 nullptr, grpc_schedule_on_exec_ctx));
102 std::ostringstream
cmd;
103 cmd <<
"sudo date `date -v" << GetParam() <<
" \"+%m%d%H%M%y\"`";
120 std::ostringstream
cmd;
121 cmd <<
"sudo date `date -v" << GetParam() <<
" \"+%m%d%H%M%y\"`";
144 int main(
int argc,
char** argv) {
INSTANTIATE_TEST_SUITE_P(TimeJump, TimeJumpTest, ::testing::ValuesIn(CreateTestScenarios()))
GPRAPI int gpr_time_similar(gpr_timespec a, gpr_timespec b, gpr_timespec threshold)
TEST_P(TimeJumpTest, TimerRunning)
#define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler)
#define GRPC_ERROR_CANCELLED
IntBeforeRegisterTypedTestSuiteP before
int main(int argc, char **argv)
constexpr Duration Milliseconds(T n)
void run_cmd(const char *cmd)
GPRAPI gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b)
gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms)
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
GPRAPI void gpr_sleep_until(gpr_timespec until)
int64_t grpc_test_slowdown_factor()
GPRAPI int32_t gpr_time_to_millis(gpr_timespec timespec)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
GPRAPI gpr_timespec gpr_now(gpr_clock_type clock)
IntAfterTypedTestSuiteP after
void grpc_timer_cancel(grpc_timer *timer)
ABSL_NAMESPACE_BEGIN Time Now()
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
grpc_core::ExecCtx exec_ctx
static constexpr Duration Seconds(int64_t seconds)
std::vector< std::string > CreateTestScenarios()
void grpc_timer_init(grpc_timer *timer, grpc_core::Timestamp deadline, grpc_closure *closure)
GPRAPI gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type clock_type)
internal::ParamGenerator< typename std::iterator_traits< ForwardIterator >::value_type > ValuesIn(ForwardIterator begin, ForwardIterator end)
GRPCAPI void grpc_init(void)
GRPCAPI void grpc_shutdown(void)
static uv_thread_t thread
uint64_t grpc_timer_manager_get_wakeups_testonly(void)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:36