diff options
author | Vijay Pai <vpai@google.com> | 2017-10-11 10:10:23 -0700 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2017-10-11 10:10:23 -0700 |
commit | 1ba537069ca8ac3b97502f66e815f9e84a73acbc (patch) | |
tree | f8167fbb8af26823dc7c535ecaa2b3f65781c1fd /src | |
parent | 58e5d90e20e6b5f93748f3b5a32c64e86f00e0c6 (diff) |
Sanity check that tests declared non-polling actually don't poll
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lib/iomgr/ev_posix.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc index e4033fab1d..369baa621f 100644 --- a/src/core/lib/iomgr/ev_posix.cc +++ b/src/core/lib/iomgr/ev_posix.cc @@ -61,12 +61,30 @@ typedef struct { event_engine_factory_fn factory; } event_engine_factory; +namespace { +extern "C" { +int dummypoll(struct pollfd fds[], nfds_t nfds, int timeout) { + gpr_log(GPR_ERROR, "Attempted to poll despite declaring non-polling."); + GPR_ASSERT(false); + return -1; +} +} // extern "C" + +const grpc_event_engine_vtable *init_non_polling(bool explicit_request) { + // return the simplest engine as a dummy but also override the poller + auto ret = grpc_init_poll_posix(explicit_request); + grpc_poll_function = dummypoll; + return ret; +} +} // namespace + static const event_engine_factory g_factories[] = { {"epoll1", grpc_init_epoll1_linux}, {"epollsig", grpc_init_epollsig_linux}, {"poll", grpc_init_poll_posix}, {"poll-cv", grpc_init_poll_cv_posix}, {"epollex", grpc_init_epollex_linux}, + {"none", init_non_polling}, }; static void add(const char *beg, const char *end, char ***ss, size_t *ns) { |