Delete epollsig poller and tests using it

pull/16679/head
Vijay Pai 7 years ago
parent 4b1aa50e37
commit be18cedf90
  1. 2
      BUILD
  2. 74
      CMakeLists.txt
  3. 78
      Makefile
  4. 2
      bazel/grpc_build_system.bzl
  5. 31
      build.yaml
  6. 1
      config.m4
  7. 1
      config.w32
  8. 2
      gRPC-C++.podspec
  9. 3
      gRPC-Core.podspec
  10. 2
      grpc.gemspec
  11. 4
      grpc.gyp
  12. 2
      package.xml
  13. 1743
      src/core/lib/iomgr/ev_epollsig_linux.cc
  14. 35
      src/core/lib/iomgr/ev_epollsig_linux.h
  15. 15
      src/core/lib/iomgr/ev_posix.cc
  16. 2
      src/core/lib/iomgr/port.h
  17. 1
      src/python/grpcio/grpc_core_dependencies.py
  18. 2
      test/core/end2end/generate_tests.bzl
  19. 32
      test/core/iomgr/BUILD
  20. 321
      test/core/iomgr/ev_epollsig_linux_test.cc
  21. 447
      test/core/iomgr/pollset_set_test.cc
  22. 1
      tools/doxygen/Doxyfile.c++.internal
  23. 2
      tools/doxygen/Doxyfile.core.internal
  24. 37
      tools/run_tests/generated/sources_and_headers.json
  25. 40
      tools/run_tests/generated/tests.json
  26. 4
      tools/run_tests/run_tests.py

@ -707,7 +707,6 @@ grpc_cc_library(
"src/core/lib/iomgr/error.cc",
"src/core/lib/iomgr/ev_epoll1_linux.cc",
"src/core/lib/iomgr/ev_epollex_linux.cc",
"src/core/lib/iomgr/ev_epollsig_linux.cc",
"src/core/lib/iomgr/ev_poll_posix.cc",
"src/core/lib/iomgr/ev_posix.cc",
"src/core/lib/iomgr/ev_windows.cc",
@ -859,7 +858,6 @@ grpc_cc_library(
"src/core/lib/iomgr/error_internal.h",
"src/core/lib/iomgr/ev_epoll1_linux.h",
"src/core/lib/iomgr/ev_epollex_linux.h",
"src/core/lib/iomgr/ev_epollsig_linux.h",
"src/core/lib/iomgr/ev_poll_posix.h",
"src/core/lib/iomgr/ev_posix.h",
"src/core/lib/iomgr/exec_ctx.h",

@ -253,9 +253,6 @@ add_dependencies(buildtests_c error_test)
if(_gRPC_PLATFORM_LINUX)
add_dependencies(buildtests_c ev_epollex_linux_test)
endif()
if(_gRPC_PLATFORM_LINUX)
add_dependencies(buildtests_c ev_epollsig_linux_test)
endif()
add_dependencies(buildtests_c fake_resolver_test)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_c fake_transport_security_test)
@ -355,9 +352,6 @@ add_dependencies(buildtests_c no_server_test)
add_dependencies(buildtests_c num_external_connectivity_watchers_test)
add_dependencies(buildtests_c parse_address_test)
add_dependencies(buildtests_c percent_encoding_test)
if(_gRPC_PLATFORM_LINUX)
add_dependencies(buildtests_c pollset_set_test)
endif()
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_c resolve_address_posix_test)
endif()
@ -974,7 +968,6 @@ add_library(grpc
src/core/lib/iomgr/error.cc
src/core/lib/iomgr/ev_epoll1_linux.cc
src/core/lib/iomgr/ev_epollex_linux.cc
src/core/lib/iomgr/ev_epollsig_linux.cc
src/core/lib/iomgr/ev_poll_posix.cc
src/core/lib/iomgr/ev_posix.cc
src/core/lib/iomgr/ev_windows.cc
@ -1383,7 +1376,6 @@ add_library(grpc_cronet
src/core/lib/iomgr/error.cc
src/core/lib/iomgr/ev_epoll1_linux.cc
src/core/lib/iomgr/ev_epollex_linux.cc
src/core/lib/iomgr/ev_epollsig_linux.cc
src/core/lib/iomgr/ev_poll_posix.cc
src/core/lib/iomgr/ev_posix.cc
src/core/lib/iomgr/ev_windows.cc
@ -1778,7 +1770,6 @@ add_library(grpc_test_util
src/core/lib/iomgr/error.cc
src/core/lib/iomgr/ev_epoll1_linux.cc
src/core/lib/iomgr/ev_epollex_linux.cc
src/core/lib/iomgr/ev_epollsig_linux.cc
src/core/lib/iomgr/ev_poll_posix.cc
src/core/lib/iomgr/ev_posix.cc
src/core/lib/iomgr/ev_windows.cc
@ -2089,7 +2080,6 @@ add_library(grpc_test_util_unsecure
src/core/lib/iomgr/error.cc
src/core/lib/iomgr/ev_epoll1_linux.cc
src/core/lib/iomgr/ev_epollex_linux.cc
src/core/lib/iomgr/ev_epollsig_linux.cc
src/core/lib/iomgr/ev_poll_posix.cc
src/core/lib/iomgr/ev_posix.cc
src/core/lib/iomgr/ev_windows.cc
@ -2379,7 +2369,6 @@ add_library(grpc_unsecure
src/core/lib/iomgr/error.cc
src/core/lib/iomgr/ev_epoll1_linux.cc
src/core/lib/iomgr/ev_epollex_linux.cc
src/core/lib/iomgr/ev_epollsig_linux.cc
src/core/lib/iomgr/ev_poll_posix.cc
src/core/lib/iomgr/ev_posix.cc
src/core/lib/iomgr/ev_windows.cc
@ -3226,7 +3215,6 @@ add_library(grpc++_cronet
src/core/lib/iomgr/error.cc
src/core/lib/iomgr/ev_epoll1_linux.cc
src/core/lib/iomgr/ev_epollex_linux.cc
src/core/lib/iomgr/ev_epollsig_linux.cc
src/core/lib/iomgr/ev_poll_posix.cc
src/core/lib/iomgr/ev_posix.cc
src/core/lib/iomgr/ev_windows.cc
@ -6393,37 +6381,6 @@ target_link_libraries(ev_epollex_linux_test
gpr
)
endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX)
add_executable(ev_epollsig_linux_test
test/core/iomgr/ev_epollsig_linux_test.cc
)
target_include_directories(ev_epollsig_linux_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR}
)
target_link_libraries(ev_epollsig_linux_test
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
grpc
gpr_test_util
gpr
)
endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
@ -8509,37 +8466,6 @@ target_link_libraries(percent_encoding_test
gpr
)
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX)
add_executable(pollset_set_test
test/core/iomgr/pollset_set_test.cc
)
target_include_directories(pollset_set_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR}
)
target_link_libraries(pollset_set_test
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
grpc
gpr_test_util
gpr
)
endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)

@ -998,7 +998,6 @@ dualstack_socket_test: $(BINDIR)/$(CONFIG)/dualstack_socket_test
endpoint_pair_test: $(BINDIR)/$(CONFIG)/endpoint_pair_test
error_test: $(BINDIR)/$(CONFIG)/error_test
ev_epollex_linux_test: $(BINDIR)/$(CONFIG)/ev_epollex_linux_test
ev_epollsig_linux_test: $(BINDIR)/$(CONFIG)/ev_epollsig_linux_test
fake_resolver_test: $(BINDIR)/$(CONFIG)/fake_resolver_test
fake_transport_security_test: $(BINDIR)/$(CONFIG)/fake_transport_security_test
fd_conservation_posix_test: $(BINDIR)/$(CONFIG)/fd_conservation_posix_test
@ -1080,7 +1079,6 @@ parse_address_test: $(BINDIR)/$(CONFIG)/parse_address_test
percent_decode_fuzzer: $(BINDIR)/$(CONFIG)/percent_decode_fuzzer
percent_encode_fuzzer: $(BINDIR)/$(CONFIG)/percent_encode_fuzzer
percent_encoding_test: $(BINDIR)/$(CONFIG)/percent_encoding_test
pollset_set_test: $(BINDIR)/$(CONFIG)/pollset_set_test
resolve_address_posix_test: $(BINDIR)/$(CONFIG)/resolve_address_posix_test
resolve_address_using_ares_resolver_test: $(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test
resolve_address_using_native_resolver_test: $(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test
@ -1455,7 +1453,6 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/endpoint_pair_test \
$(BINDIR)/$(CONFIG)/error_test \
$(BINDIR)/$(CONFIG)/ev_epollex_linux_test \
$(BINDIR)/$(CONFIG)/ev_epollsig_linux_test \
$(BINDIR)/$(CONFIG)/fake_resolver_test \
$(BINDIR)/$(CONFIG)/fake_transport_security_test \
$(BINDIR)/$(CONFIG)/fd_conservation_posix_test \
@ -1525,7 +1522,6 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/num_external_connectivity_watchers_test \
$(BINDIR)/$(CONFIG)/parse_address_test \
$(BINDIR)/$(CONFIG)/percent_encoding_test \
$(BINDIR)/$(CONFIG)/pollset_set_test \
$(BINDIR)/$(CONFIG)/resolve_address_posix_test \
$(BINDIR)/$(CONFIG)/resolve_address_using_ares_resolver_test \
$(BINDIR)/$(CONFIG)/resolve_address_using_native_resolver_test \
@ -1992,8 +1988,6 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/error_test || ( echo test error_test failed ; exit 1 )
$(E) "[RUN] Testing ev_epollex_linux_test"
$(Q) $(BINDIR)/$(CONFIG)/ev_epollex_linux_test || ( echo test ev_epollex_linux_test failed ; exit 1 )
$(E) "[RUN] Testing ev_epollsig_linux_test"
$(Q) $(BINDIR)/$(CONFIG)/ev_epollsig_linux_test || ( echo test ev_epollsig_linux_test failed ; exit 1 )
$(E) "[RUN] Testing fake_resolver_test"
$(Q) $(BINDIR)/$(CONFIG)/fake_resolver_test || ( echo test fake_resolver_test failed ; exit 1 )
$(E) "[RUN] Testing fake_transport_security_test"
@ -2120,8 +2114,6 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/parse_address_test || ( echo test parse_address_test failed ; exit 1 )
$(E) "[RUN] Testing percent_encoding_test"
$(Q) $(BINDIR)/$(CONFIG)/percent_encoding_test || ( echo test percent_encoding_test failed ; exit 1 )
$(E) "[RUN] Testing pollset_set_test"
$(Q) $(BINDIR)/$(CONFIG)/pollset_set_test || ( echo test pollset_set_test failed ; exit 1 )
$(E) "[RUN] Testing resolve_address_posix_test"
$(Q) $(BINDIR)/$(CONFIG)/resolve_address_posix_test || ( echo test resolve_address_posix_test failed ; exit 1 )
$(E) "[RUN] Testing resolve_address_using_ares_resolver_test"
@ -3484,7 +3476,6 @@ LIBGRPC_SRC = \
src/core/lib/iomgr/error.cc \
src/core/lib/iomgr/ev_epoll1_linux.cc \
src/core/lib/iomgr/ev_epollex_linux.cc \
src/core/lib/iomgr/ev_epollsig_linux.cc \
src/core/lib/iomgr/ev_poll_posix.cc \
src/core/lib/iomgr/ev_posix.cc \
src/core/lib/iomgr/ev_windows.cc \
@ -3892,7 +3883,6 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/iomgr/error.cc \
src/core/lib/iomgr/ev_epoll1_linux.cc \
src/core/lib/iomgr/ev_epollex_linux.cc \
src/core/lib/iomgr/ev_epollsig_linux.cc \
src/core/lib/iomgr/ev_poll_posix.cc \
src/core/lib/iomgr/ev_posix.cc \
src/core/lib/iomgr/ev_windows.cc \
@ -4285,7 +4275,6 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/iomgr/error.cc \
src/core/lib/iomgr/ev_epoll1_linux.cc \
src/core/lib/iomgr/ev_epollex_linux.cc \
src/core/lib/iomgr/ev_epollsig_linux.cc \
src/core/lib/iomgr/ev_poll_posix.cc \
src/core/lib/iomgr/ev_posix.cc \
src/core/lib/iomgr/ev_windows.cc \
@ -4587,7 +4576,6 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
src/core/lib/iomgr/error.cc \
src/core/lib/iomgr/ev_epoll1_linux.cc \
src/core/lib/iomgr/ev_epollex_linux.cc \
src/core/lib/iomgr/ev_epollsig_linux.cc \
src/core/lib/iomgr/ev_poll_posix.cc \
src/core/lib/iomgr/ev_posix.cc \
src/core/lib/iomgr/ev_windows.cc \
@ -4855,7 +4843,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/iomgr/error.cc \
src/core/lib/iomgr/ev_epoll1_linux.cc \
src/core/lib/iomgr/ev_epollex_linux.cc \
src/core/lib/iomgr/ev_epollsig_linux.cc \
src/core/lib/iomgr/ev_poll_posix.cc \
src/core/lib/iomgr/ev_posix.cc \
src/core/lib/iomgr/ev_windows.cc \
@ -5690,7 +5677,6 @@ LIBGRPC++_CRONET_SRC = \
src/core/lib/iomgr/error.cc \
src/core/lib/iomgr/ev_epoll1_linux.cc \
src/core/lib/iomgr/ev_epollex_linux.cc \
src/core/lib/iomgr/ev_epollsig_linux.cc \
src/core/lib/iomgr/ev_poll_posix.cc \
src/core/lib/iomgr/ev_posix.cc \
src/core/lib/iomgr/ev_windows.cc \
@ -11354,38 +11340,6 @@ endif
endif
EV_EPOLLSIG_LINUX_TEST_SRC = \
test/core/iomgr/ev_epollsig_linux_test.cc \
EV_EPOLLSIG_LINUX_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(EV_EPOLLSIG_LINUX_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/ev_epollsig_linux_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/ev_epollsig_linux_test: $(EV_EPOLLSIG_LINUX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(EV_EPOLLSIG_LINUX_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/ev_epollsig_linux_test
endif
$(OBJDIR)/$(CONFIG)/test/core/iomgr/ev_epollsig_linux_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_ev_epollsig_linux_test: $(EV_EPOLLSIG_LINUX_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(EV_EPOLLSIG_LINUX_TEST_OBJS:.o=.dep)
endif
endif
FAKE_RESOLVER_TEST_SRC = \
test/core/client_channel/resolvers/fake_resolver_test.cc \
@ -13996,38 +13950,6 @@ endif
endif
POLLSET_SET_TEST_SRC = \
test/core/iomgr/pollset_set_test.cc \
POLLSET_SET_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(POLLSET_SET_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/pollset_set_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/pollset_set_test: $(POLLSET_SET_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(POLLSET_SET_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/pollset_set_test
endif
$(OBJDIR)/$(CONFIG)/test/core/iomgr/pollset_set_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_pollset_set_test: $(POLLSET_SET_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(POLLSET_SET_TEST_OBJS:.o=.dep)
endif
endif
RESOLVE_ADDRESS_POSIX_TEST_SRC = \
test/core/iomgr/resolve_address_posix_test.cc \

@ -24,7 +24,7 @@
#
# The set of pollers to test against if a test exercises polling
POLLERS = ["epollex", "epollsig", "epoll1", "poll", "poll-cv"]
POLLERS = ["epollex", "epoll1", "poll", "poll-cv"]
def if_not_windows(a):
return select({

@ -266,7 +266,6 @@ filegroups:
- src/core/lib/iomgr/error.cc
- src/core/lib/iomgr/ev_epoll1_linux.cc
- src/core/lib/iomgr/ev_epollex_linux.cc
- src/core/lib/iomgr/ev_epollsig_linux.cc
- src/core/lib/iomgr/ev_poll_posix.cc
- src/core/lib/iomgr/ev_posix.cc
- src/core/lib/iomgr/ev_windows.cc
@ -446,7 +445,6 @@ filegroups:
- src/core/lib/iomgr/error_internal.h
- src/core/lib/iomgr/ev_epoll1_linux.h
- src/core/lib/iomgr/ev_epollex_linux.h
- src/core/lib/iomgr/ev_epollsig_linux.h
- src/core/lib/iomgr/ev_poll_posix.h
- src/core/lib/iomgr/ev_posix.h
- src/core/lib/iomgr/exec_ctx.h
@ -2372,21 +2370,6 @@ targets:
- uv
platforms:
- linux
- name: ev_epollsig_linux_test
cpu_cost: 3
build: test
language: c
src:
- test/core/iomgr/ev_epollsig_linux_test.cc
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
exclude_iomgrs:
- uv
platforms:
- linux
- name: fake_resolver_test
build: test
language: c
@ -3338,20 +3321,6 @@ targets:
- gpr_test_util
- gpr
uses_polling: false
- name: pollset_set_test
build: test
language: c
src:
- test/core/iomgr/pollset_set_test.cc
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
exclude_iomgrs:
- uv
platforms:
- linux
- name: resolve_address_posix_test
build: test
language: c

@ -118,7 +118,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/iomgr/error.cc \
src/core/lib/iomgr/ev_epoll1_linux.cc \
src/core/lib/iomgr/ev_epollex_linux.cc \
src/core/lib/iomgr/ev_epollsig_linux.cc \
src/core/lib/iomgr/ev_poll_posix.cc \
src/core/lib/iomgr/ev_posix.cc \
src/core/lib/iomgr/ev_windows.cc \

@ -93,7 +93,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\iomgr\\error.cc " +
"src\\core\\lib\\iomgr\\ev_epoll1_linux.cc " +
"src\\core\\lib\\iomgr\\ev_epollex_linux.cc " +
"src\\core\\lib\\iomgr\\ev_epollsig_linux.cc " +
"src\\core\\lib\\iomgr\\ev_poll_posix.cc " +
"src\\core\\lib\\iomgr\\ev_posix.cc " +
"src\\core\\lib\\iomgr\\ev_windows.cc " +

@ -396,7 +396,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/error_internal.h',
'src/core/lib/iomgr/ev_epoll1_linux.h',
'src/core/lib/iomgr/ev_epollex_linux.h',
'src/core/lib/iomgr/ev_epollsig_linux.h',
'src/core/lib/iomgr/ev_poll_posix.h',
'src/core/lib/iomgr/ev_posix.h',
'src/core/lib/iomgr/exec_ctx.h',
@ -586,7 +585,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/error_internal.h',
'src/core/lib/iomgr/ev_epoll1_linux.h',
'src/core/lib/iomgr/ev_epollex_linux.h',
'src/core/lib/iomgr/ev_epollsig_linux.h',
'src/core/lib/iomgr/ev_poll_posix.h',
'src/core/lib/iomgr/ev_posix.h',
'src/core/lib/iomgr/exec_ctx.h',

@ -405,7 +405,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/error_internal.h',
'src/core/lib/iomgr/ev_epoll1_linux.h',
'src/core/lib/iomgr/ev_epollex_linux.h',
'src/core/lib/iomgr/ev_epollsig_linux.h',
'src/core/lib/iomgr/ev_poll_posix.h',
'src/core/lib/iomgr/ev_posix.h',
'src/core/lib/iomgr/exec_ctx.h',
@ -551,7 +550,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/error.cc',
'src/core/lib/iomgr/ev_epoll1_linux.cc',
'src/core/lib/iomgr/ev_epollex_linux.cc',
'src/core/lib/iomgr/ev_epollsig_linux.cc',
'src/core/lib/iomgr/ev_poll_posix.cc',
'src/core/lib/iomgr/ev_posix.cc',
'src/core/lib/iomgr/ev_windows.cc',
@ -1010,7 +1008,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/error_internal.h',
'src/core/lib/iomgr/ev_epoll1_linux.h',
'src/core/lib/iomgr/ev_epollex_linux.h',
'src/core/lib/iomgr/ev_epollsig_linux.h',
'src/core/lib/iomgr/ev_poll_posix.h',
'src/core/lib/iomgr/ev_posix.h',
'src/core/lib/iomgr/exec_ctx.h',

@ -341,7 +341,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/error_internal.h )
s.files += %w( src/core/lib/iomgr/ev_epoll1_linux.h )
s.files += %w( src/core/lib/iomgr/ev_epollex_linux.h )
s.files += %w( src/core/lib/iomgr/ev_epollsig_linux.h )
s.files += %w( src/core/lib/iomgr/ev_poll_posix.h )
s.files += %w( src/core/lib/iomgr/ev_posix.h )
s.files += %w( src/core/lib/iomgr/exec_ctx.h )
@ -487,7 +486,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/error.cc )
s.files += %w( src/core/lib/iomgr/ev_epoll1_linux.cc )
s.files += %w( src/core/lib/iomgr/ev_epollex_linux.cc )
s.files += %w( src/core/lib/iomgr/ev_epollsig_linux.cc )
s.files += %w( src/core/lib/iomgr/ev_poll_posix.cc )
s.files += %w( src/core/lib/iomgr/ev_posix.cc )
s.files += %w( src/core/lib/iomgr/ev_windows.cc )

@ -310,7 +310,6 @@
'src/core/lib/iomgr/error.cc',
'src/core/lib/iomgr/ev_epoll1_linux.cc',
'src/core/lib/iomgr/ev_epollex_linux.cc',
'src/core/lib/iomgr/ev_epollsig_linux.cc',
'src/core/lib/iomgr/ev_poll_posix.cc',
'src/core/lib/iomgr/ev_posix.cc',
'src/core/lib/iomgr/ev_windows.cc',
@ -673,7 +672,6 @@
'src/core/lib/iomgr/error.cc',
'src/core/lib/iomgr/ev_epoll1_linux.cc',
'src/core/lib/iomgr/ev_epollex_linux.cc',
'src/core/lib/iomgr/ev_epollsig_linux.cc',
'src/core/lib/iomgr/ev_poll_posix.cc',
'src/core/lib/iomgr/ev_posix.cc',
'src/core/lib/iomgr/ev_windows.cc',
@ -909,7 +907,6 @@
'src/core/lib/iomgr/error.cc',
'src/core/lib/iomgr/ev_epoll1_linux.cc',
'src/core/lib/iomgr/ev_epollex_linux.cc',
'src/core/lib/iomgr/ev_epollsig_linux.cc',
'src/core/lib/iomgr/ev_poll_posix.cc',
'src/core/lib/iomgr/ev_posix.cc',
'src/core/lib/iomgr/ev_windows.cc',
@ -1123,7 +1120,6 @@
'src/core/lib/iomgr/error.cc',
'src/core/lib/iomgr/ev_epoll1_linux.cc',
'src/core/lib/iomgr/ev_epollex_linux.cc',
'src/core/lib/iomgr/ev_epollsig_linux.cc',
'src/core/lib/iomgr/ev_poll_posix.cc',
'src/core/lib/iomgr/ev_posix.cc',
'src/core/lib/iomgr/ev_windows.cc',

@ -346,7 +346,6 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/error_internal.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_epoll1_linux.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_epollex_linux.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_epollsig_linux.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_poll_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/exec_ctx.h" role="src" />
@ -492,7 +491,6 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/error.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_epoll1_linux.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_epollex_linux.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_epollsig_linux.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_poll_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_windows.cc" role="src" />

File diff suppressed because it is too large Load Diff

@ -1,35 +0,0 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_CORE_LIB_IOMGR_EV_EPOLLSIG_LINUX_H
#define GRPC_CORE_LIB_IOMGR_EV_EPOLLSIG_LINUX_H
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/port.h"
const grpc_event_engine_vtable* grpc_init_epollsig_linux(bool explicit_request);
#ifdef GRPC_LINUX_EPOLL_CREATE1
void* grpc_fd_get_polling_island(grpc_fd* fd);
void* grpc_pollset_get_polling_island(grpc_pollset* ps);
bool grpc_are_polling_islands_equal(void* p, void* q);
#endif /* defined(GRPC_LINUX_EPOLL_CREATE1) */
#endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLLSIG_LINUX_H */

@ -35,7 +35,6 @@
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/ev_epoll1_linux.h"
#include "src/core/lib/iomgr/ev_epollex_linux.h"
#include "src/core/lib/iomgr/ev_epollsig_linux.h"
#include "src/core/lib/iomgr/ev_poll_posix.h"
grpc_core::TraceFlag grpc_polling_trace(false,
@ -123,13 +122,13 @@ const grpc_event_engine_vtable* init_non_polling(bool explicit_request) {
// environment variable if that variable is set (which should be a
// comma-separated list of one or more event engine names)
static event_engine_factory g_factories[] = {
{ENGINE_HEAD_CUSTOM, nullptr}, {ENGINE_HEAD_CUSTOM, nullptr},
{ENGINE_HEAD_CUSTOM, nullptr}, {ENGINE_HEAD_CUSTOM, nullptr},
{"epollex", grpc_init_epollex_linux}, {"epoll1", grpc_init_epoll1_linux},
{"epollsig", grpc_init_epollsig_linux}, {"poll", grpc_init_poll_posix},
{"poll-cv", grpc_init_poll_cv_posix}, {"none", init_non_polling},
{ENGINE_TAIL_CUSTOM, nullptr}, {ENGINE_TAIL_CUSTOM, nullptr},
{ENGINE_TAIL_CUSTOM, nullptr}, {ENGINE_TAIL_CUSTOM, nullptr},
{ENGINE_HEAD_CUSTOM, nullptr}, {ENGINE_HEAD_CUSTOM, nullptr},
{ENGINE_HEAD_CUSTOM, nullptr}, {ENGINE_HEAD_CUSTOM, nullptr},
{"epollex", grpc_init_epollex_linux}, {"epoll1", grpc_init_epoll1_linux},
{"poll", grpc_init_poll_posix}, {"poll-cv", grpc_init_poll_cv_posix},
{"none", init_non_polling}, {ENGINE_TAIL_CUSTOM, nullptr},
{ENGINE_TAIL_CUSTOM, nullptr}, {ENGINE_TAIL_CUSTOM, nullptr},
{ENGINE_TAIL_CUSTOM, nullptr},
};
static void add(const char* beg, const char* end, char*** ss, size_t* ns) {

@ -115,7 +115,6 @@
#define GRPC_POSIX_SOCKET_EV 1
#define GRPC_POSIX_SOCKET_EV_EPOLL1 1
#define GRPC_POSIX_SOCKET_EV_EPOLLEX 1
#define GRPC_POSIX_SOCKET_EV_EPOLLSIG 1
#define GRPC_POSIX_SOCKET_EV_POLL 1
#define GRPC_POSIX_SOCKET_RESOLVE_ADDRESS 1
#define GRPC_POSIX_SOCKET_SOCKADDR 1
@ -183,7 +182,6 @@
#define GRPC_POSIX_SOCKET_ARES_EV_DRIVER 1
#define GRPC_POSIX_SOCKET_EV 1
#define GRPC_POSIX_SOCKET_EV_EPOLLEX 1
#define GRPC_POSIX_SOCKET_EV_EPOLLSIG 1
#define GRPC_POSIX_SOCKET_EV_POLL 1
#define GRPC_POSIX_SOCKET_EV_EPOLL1 1
#define GRPC_POSIX_SOCKET_IOMGR 1

@ -92,7 +92,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/iomgr/error.cc',
'src/core/lib/iomgr/ev_epoll1_linux.cc',
'src/core/lib/iomgr/ev_epollex_linux.cc',
'src/core/lib/iomgr/ev_epollsig_linux.cc',
'src/core/lib/iomgr/ev_poll_posix.cc',
'src/core/lib/iomgr/ev_posix.cc',
'src/core/lib/iomgr/ev_windows.cc',

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
POLLERS = ['epollex', 'epollsig', 'epoll1', 'poll', 'poll-cv']
POLLERS = ['epollex', 'epoll1', 'poll', 'poll-cv']
load("//bazel:grpc_build_system.bzl", "grpc_sh_test", "grpc_cc_binary", "grpc_cc_library")

@ -40,6 +40,7 @@ grpc_cc_library(
grpc_cc_test(
name = "combiner_test",
srcs = ["combiner_test.cc"],
data = ["//third_party/toolchains:RBE_USE_MACHINE_TYPE_LARGE"],
language = "C++",
deps = [
"//:gpr",
@ -47,7 +48,6 @@ grpc_cc_test(
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
data = ["//third_party/toolchains:RBE_USE_MACHINE_TYPE_LARGE"],
)
grpc_cc_test(
@ -88,18 +88,6 @@ grpc_cc_test(
],
)
grpc_cc_test(
name = "ev_epollsig_linux_test",
srcs = ["ev_epollsig_linux_test.cc"],
language = "C++",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
grpc_cc_test(
name = "fd_conservation_posix_test",
srcs = ["fd_conservation_posix_test.cc"],
@ -136,7 +124,6 @@ grpc_cc_test(
],
)
grpc_cc_test(
name = "load_file_test",
srcs = ["load_file_test.cc"],
@ -149,18 +136,6 @@ grpc_cc_test(
],
)
grpc_cc_test(
name = "pollset_set_test",
srcs = ["pollset_set_test.cc"],
language = "C++",
deps = [
"//:gpr",
"//:grpc",
"//test/core/util:gpr_test_util",
"//test/core/util:grpc_test_util",
],
)
grpc_cc_test(
name = "resolve_address_posix_test",
srcs = ["resolve_address_posix_test.cc"],
@ -176,10 +151,10 @@ grpc_cc_test(
grpc_cc_test(
name = "resolve_address_using_ares_resolver_test",
srcs = ["resolve_address_test.cc"],
language = "C++",
args = [
"--resolver=ares",
],
language = "C++",
deps = [
"//:gpr",
"//:grpc",
@ -191,10 +166,10 @@ grpc_cc_test(
grpc_cc_test(
name = "resolve_address_using_native_resolver_test",
srcs = ["resolve_address_test.cc"],
language = "C++",
args = [
"--resolver=native",
],
language = "C++",
deps = [
"//:gpr",
"//:grpc",
@ -276,7 +251,6 @@ grpc_cc_test(
],
)
grpc_cc_test(
name = "tcp_server_posix_test",
srcs = ["tcp_server_posix_test.cc"],

@ -1,321 +0,0 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "src/core/lib/iomgr/port.h"
/* This test only relevant on linux systems where epoll() is available */
#ifdef GRPC_LINUX_EPOLL_CREATE1
#include "src/core/lib/iomgr/ev_epollsig_linux.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "test/core/util/test_config.h"
typedef struct test_pollset {
grpc_pollset* pollset;
gpr_mu* mu;
} test_pollset;
typedef struct test_fd {
int inner_fd;
grpc_fd* fd;
} test_fd;
/* num_fds should be an even number */
static void test_fd_init(test_fd* tfds, int* fds, int num_fds) {
int i;
int r;
/* Create some dummy file descriptors. Currently using pipe file descriptors
* for this test but we could use any other type of file descriptors. Also,
* since pipe() used in this test creates two fds in each call, num_fds should
* be an even number */
GPR_ASSERT((num_fds % 2) == 0);
for (i = 0; i < num_fds; i = i + 2) {
r = pipe(fds + i);
if (r != 0) {
gpr_log(GPR_ERROR, "Error in creating pipe. %d (%s)", errno,
strerror(errno));
return;
}
}
for (i = 0; i < num_fds; i++) {
tfds[i].inner_fd = fds[i];
tfds[i].fd = grpc_fd_create(fds[i], "test_fd", false);
}
}
static void test_fd_cleanup(test_fd* tfds, int num_fds) {
int release_fd;
int i;
for (i = 0; i < num_fds; i++) {
grpc_fd_shutdown(tfds[i].fd,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("test_fd_cleanup"));
grpc_core::ExecCtx::Get()->Flush();
grpc_fd_orphan(tfds[i].fd, nullptr, &release_fd, "test_fd_cleanup");
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(release_fd == tfds[i].inner_fd);
close(tfds[i].inner_fd);
}
}
static void test_pollset_init(test_pollset* pollsets, int num_pollsets) {
int i;
for (i = 0; i < num_pollsets; i++) {
pollsets[i].pollset =
static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(pollsets[i].pollset, &pollsets[i].mu);
}
}
static void destroy_pollset(void* p, grpc_error* error) {
grpc_pollset_destroy(static_cast<grpc_pollset*>(p));
}
static void test_pollset_cleanup(test_pollset* pollsets, int num_pollsets) {
grpc_closure destroyed;
int i;
for (i = 0; i < num_pollsets; i++) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, pollsets[i].pollset,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(pollsets[i].pollset, &destroyed);
grpc_core::ExecCtx::Get()->Flush();
gpr_free(pollsets[i].pollset);
}
}
/*
* Cases to test:
* case 1) Polling islands of both fd and pollset are NULL
* case 2) Polling island of fd is NULL but that of pollset is not-NULL
* case 3) Polling island of fd is not-NULL but that of pollset is NULL
* case 4) Polling islands of both fd and pollset are not-NULL and:
* case 4.1) Polling islands of fd and pollset are equal
* case 4.2) Polling islands of fd and pollset are NOT-equal (This results
* in a merge)
* */
#define NUM_FDS 8
#define NUM_POLLSETS 4
static void test_add_fd_to_pollset() {
grpc_core::ExecCtx exec_ctx;
test_fd tfds[NUM_FDS];
int fds[NUM_FDS];
test_pollset pollsets[NUM_POLLSETS];
void* expected_pi = nullptr;
int i;
test_fd_init(tfds, fds, NUM_FDS);
test_pollset_init(pollsets, NUM_POLLSETS);
/*Step 1.
* Create three polling islands (This will exercise test case 1 and 2) with
* the following configuration:
* polling island 0 = { fds:0,1,2, pollsets:0}
* polling island 1 = { fds:3,4, pollsets:1}
* polling island 2 = { fds:5,6,7 pollsets:2}
*
*Step 2.
* Add pollset 3 to polling island 0 (by adding fds 0 and 1 to pollset 3)
* (This will exercise test cases 3 and 4.1). The configuration becomes:
* polling island 0 = { fds:0,1,2, pollsets:0,3} <<< pollset 3 added here
* polling island 1 = { fds:3,4, pollsets:1}
* polling island 2 = { fds:5,6,7 pollsets:2}
*
*Step 3.
* Merge polling islands 0 and 1 by adding fd 0 to pollset 1 (This will
* exercise test case 4.2). The configuration becomes:
* polling island (merged) = {fds: 0,1,2,3,4, pollsets: 0,1,3}
* polling island 2 = {fds: 5,6,7 pollsets: 2}
*
*Step 4.
* Finally do one more merge by adding fd 3 to pollset 2.
* polling island (merged) = {fds: 0,1,2,3,4,5,6,7, pollsets: 0,1,2,3}
*/
/* == Step 1 == */
for (i = 0; i <= 2; i++) {
grpc_pollset_add_fd(pollsets[0].pollset, tfds[i].fd);
grpc_core::ExecCtx::Get()->Flush();
}
for (i = 3; i <= 4; i++) {
grpc_pollset_add_fd(pollsets[1].pollset, tfds[i].fd);
grpc_core::ExecCtx::Get()->Flush();
}
for (i = 5; i <= 7; i++) {
grpc_pollset_add_fd(pollsets[2].pollset, tfds[i].fd);
grpc_core::ExecCtx::Get()->Flush();
}
/* == Step 2 == */
for (i = 0; i <= 1; i++) {
grpc_pollset_add_fd(pollsets[3].pollset, tfds[i].fd);
grpc_core::ExecCtx::Get()->Flush();
}
/* == Step 3 == */
grpc_pollset_add_fd(pollsets[1].pollset, tfds[0].fd);
grpc_core::ExecCtx::Get()->Flush();
/* == Step 4 == */
grpc_pollset_add_fd(pollsets[2].pollset, tfds[3].fd);
grpc_core::ExecCtx::Get()->Flush();
/* All polling islands are merged at this point */
/* Compare Fd:0's polling island with that of all other Fds */
expected_pi = grpc_fd_get_polling_island(tfds[0].fd);
for (i = 1; i < NUM_FDS; i++) {
GPR_ASSERT(grpc_are_polling_islands_equal(
expected_pi, grpc_fd_get_polling_island(tfds[i].fd)));
}
/* Compare Fd:0's polling island with that of all other pollsets */
for (i = 0; i < NUM_POLLSETS; i++) {
GPR_ASSERT(grpc_are_polling_islands_equal(
expected_pi, grpc_pollset_get_polling_island(pollsets[i].pollset)));
}
test_fd_cleanup(tfds, NUM_FDS);
test_pollset_cleanup(pollsets, NUM_POLLSETS);
}
#undef NUM_FDS
#undef NUM_POLLSETS
typedef struct threading_shared {
gpr_mu* mu;
grpc_pollset* pollset;
grpc_wakeup_fd* wakeup_fd;
grpc_fd* wakeup_desc;
grpc_closure on_wakeup;
int wakeups;
} threading_shared;
static __thread int thread_wakeups = 0;
static void test_threading_loop(void* arg) {
threading_shared* shared = static_cast<threading_shared*>(arg);
while (thread_wakeups < 1000000) {
grpc_core::ExecCtx exec_ctx;
grpc_pollset_worker* worker;
gpr_mu_lock(shared->mu);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work",
grpc_pollset_work(shared->pollset, &worker, GRPC_MILLIS_INF_FUTURE)));
gpr_mu_unlock(shared->mu);
}
}
static void test_threading_wakeup(void* arg, grpc_error* error) {
threading_shared* shared = static_cast<threading_shared*>(arg);
++shared->wakeups;
++thread_wakeups;
if (error == GRPC_ERROR_NONE) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"consume_wakeup", grpc_wakeup_fd_consume_wakeup(shared->wakeup_fd)));
grpc_fd_notify_on_read(shared->wakeup_desc, &shared->on_wakeup);
GPR_ASSERT(GRPC_LOG_IF_ERROR("wakeup_next",
grpc_wakeup_fd_wakeup(shared->wakeup_fd)));
}
}
static void test_threading(void) {
threading_shared shared;
shared.pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(shared.pollset, &shared.mu);
grpc_core::Thread thds[10];
for (auto& th : thds) {
th = grpc_core::Thread("test_thread", test_threading_loop, &shared);
th.Start();
}
grpc_wakeup_fd fd;
GPR_ASSERT(GRPC_LOG_IF_ERROR("wakeup_fd_init", grpc_wakeup_fd_init(&fd)));
shared.wakeup_fd = &fd;
shared.wakeup_desc = grpc_fd_create(fd.read_fd, "wakeup", false);
shared.wakeups = 0;
{
grpc_core::ExecCtx exec_ctx;
grpc_pollset_add_fd(shared.pollset, shared.wakeup_desc);
grpc_fd_notify_on_read(
shared.wakeup_desc,
GRPC_CLOSURE_INIT(&shared.on_wakeup, test_threading_wakeup, &shared,
grpc_schedule_on_exec_ctx));
}
GPR_ASSERT(GRPC_LOG_IF_ERROR("wakeup_first",
grpc_wakeup_fd_wakeup(shared.wakeup_fd)));
for (auto& th : thds) {
th.Join();
}
fd.read_fd = 0;
grpc_wakeup_fd_destroy(&fd);
{
grpc_core::ExecCtx exec_ctx;
grpc_fd_shutdown(shared.wakeup_desc, GRPC_ERROR_CANCELLED);
grpc_fd_orphan(shared.wakeup_desc, nullptr, nullptr, "done");
grpc_pollset_shutdown(shared.pollset,
GRPC_CLOSURE_CREATE(destroy_pollset, shared.pollset,
grpc_schedule_on_exec_ctx));
}
gpr_free(shared.pollset);
}
int main(int argc, char** argv) {
const char* poll_strategy = nullptr;
grpc_test_init(argc, argv);
grpc_init();
{
grpc_core::ExecCtx exec_ctx;
poll_strategy = grpc_get_poll_strategy_name();
if (poll_strategy != nullptr && strcmp(poll_strategy, "epollsig") == 0) {
test_add_fd_to_pollset();
test_threading();
} else {
gpr_log(GPR_INFO,
"Skipping the test. The test is only relevant for 'epollsig' "
"strategy. and the current strategy is: '%s'",
poll_strategy);
}
}
grpc_shutdown();
return 0;
}
#else /* defined(GRPC_LINUX_EPOLL_CREATE1) */
int main(int argc, char** argv) { return 0; }
#endif /* !defined(GRPC_LINUX_EPOLL_CREATE1) */

@ -1,447 +0,0 @@
/*
*
* Copyright 2016 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "src/core/lib/iomgr/port.h"
/* This test only relevant on linux systems where epoll is available */
#ifdef GRPC_LINUX_EPOLL_CREATE1
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "test/core/util/test_config.h"
/*******************************************************************************
* test_pollset_set
*/
typedef struct test_pollset_set {
grpc_pollset_set* pss;
} test_pollset_set;
void init_test_pollset_sets(test_pollset_set* pollset_sets, const int num_pss) {
for (int i = 0; i < num_pss; i++) {
pollset_sets[i].pss = grpc_pollset_set_create();
}
}
void cleanup_test_pollset_sets(test_pollset_set* pollset_sets,
const int num_pss) {
for (int i = 0; i < num_pss; i++) {
grpc_pollset_set_destroy(pollset_sets[i].pss);
pollset_sets[i].pss = nullptr;
}
}
/*******************************************************************************
* test_pollset
*/
typedef struct test_pollset {
grpc_pollset* ps;
gpr_mu* mu;
} test_pollset;
static void init_test_pollsets(test_pollset* pollsets, const int num_pollsets) {
for (int i = 0; i < num_pollsets; i++) {
pollsets[i].ps =
static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(pollsets[i].ps, &pollsets[i].mu);
}
}
static void destroy_pollset(void* p, grpc_error* error) {
grpc_pollset_destroy(static_cast<grpc_pollset*>(p));
}
static void cleanup_test_pollsets(test_pollset* pollsets,
const int num_pollsets) {
grpc_closure destroyed;
for (int i = 0; i < num_pollsets; i++) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, pollsets[i].ps,
grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(pollsets[i].ps, &destroyed);
grpc_core::ExecCtx::Get()->Flush();
gpr_free(pollsets[i].ps);
pollsets[i].ps = nullptr;
}
}
/*******************************************************************************
* test_fd
*/
typedef struct test_fd {
grpc_fd* fd;
grpc_wakeup_fd wakeup_fd;
bool is_on_readable_called; /* Is on_readable closure is called ? */
grpc_closure on_readable; /* Closure to call when this fd is readable */
} test_fd;
void on_readable(void* tfd, grpc_error* error) {
(static_cast<test_fd*>(tfd))->is_on_readable_called = true;
}
static void reset_test_fd(test_fd* tfd) {
tfd->is_on_readable_called = false;
GRPC_CLOSURE_INIT(&tfd->on_readable, on_readable, tfd,
grpc_schedule_on_exec_ctx);
grpc_fd_notify_on_read(tfd->fd, &tfd->on_readable);
}
static void init_test_fds(test_fd* tfds, const int num_fds) {
for (int i = 0; i < num_fds; i++) {
GPR_ASSERT(GRPC_ERROR_NONE == grpc_wakeup_fd_init(&tfds[i].wakeup_fd));
tfds[i].fd = grpc_fd_create(GRPC_WAKEUP_FD_GET_READ_FD(&tfds[i].wakeup_fd),
"test_fd", false);
reset_test_fd(&tfds[i]);
}
}
static void cleanup_test_fds(test_fd* tfds, const int num_fds) {
int release_fd;
for (int i = 0; i < num_fds; i++) {
grpc_fd_shutdown(tfds[i].fd,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("fd cleanup"));
grpc_core::ExecCtx::Get()->Flush();
/* grpc_fd_orphan frees the memory allocated for grpc_fd. Normally it also
* calls close() on the underlying fd. In our case, we are using
* grpc_wakeup_fd and we would like to destroy it ourselves (by calling
* grpc_wakeup_fd_destroy). To prevent grpc_fd from calling close() on the
* underlying fd, call it with a non-NULL 'release_fd' parameter */
grpc_fd_orphan(tfds[i].fd, nullptr, &release_fd, "test_fd_cleanup");
grpc_core::ExecCtx::Get()->Flush();
grpc_wakeup_fd_destroy(&tfds[i].wakeup_fd);
}
}
static void make_test_fds_readable(test_fd* tfds, const int num_fds) {
for (int i = 0; i < num_fds; i++) {
GPR_ASSERT(GRPC_ERROR_NONE == grpc_wakeup_fd_wakeup(&tfds[i].wakeup_fd));
}
}
static void verify_readable_and_reset(test_fd* tfds, const int num_fds) {
for (int i = 0; i < num_fds; i++) {
/* Verify that the on_readable callback was called */
GPR_ASSERT(tfds[i].is_on_readable_called);
/* Reset the tfd[i] structure */
GPR_ASSERT(GRPC_ERROR_NONE ==
grpc_wakeup_fd_consume_wakeup(&tfds[i].wakeup_fd));
reset_test_fd(&tfds[i]);
}
}
/*******************************************************************************
* Main tests
*/
/* Test some typical scenarios in pollset_set */
static void pollset_set_test_basic() {
/* We construct the following structure for this test:
*
* +---> FD0 (Added before PSS1, PS1 and PS2 are added to PSS0)
* |
* +---> FD5 (Added after PSS1, PS1 and PS2 are added to PSS0)
* |
* |
* | +---> FD1 (Added before PSS1 is added to PSS0)
* | |
* | +---> FD6 (Added after PSS1 is added to PSS0)
* | |
* +---> PSS1--+ +--> FD2 (Added before PS0 is added to PSS1)
* | | |
* | +---> PS0---+
* | |
* PSS0---+ +--> FD7 (Added after PS0 is added to PSS1)
* |
* |
* | +---> FD3 (Added before PS1 is added to PSS0)
* | |
* +---> PS1---+
* | |
* | +---> FD8 (Added after PS1 added to PSS0)
* |
* |
* | +---> FD4 (Added before PS2 is added to PSS0)
* | |
* +---> PS2---+
* |
* +---> FD9 (Added after PS2 is added to PSS0)
*/
grpc_core::ExecCtx exec_ctx;
grpc_pollset_worker* worker;
grpc_millis deadline;
test_fd tfds[10];
test_pollset pollsets[3];
test_pollset_set pollset_sets[2];
const int num_fds = GPR_ARRAY_SIZE(tfds);
const int num_ps = GPR_ARRAY_SIZE(pollsets);
const int num_pss = GPR_ARRAY_SIZE(pollset_sets);
init_test_fds(tfds, num_fds);
init_test_pollsets(pollsets, num_ps);
init_test_pollset_sets(pollset_sets, num_pss);
/* Construct the pollset_set/pollset/fd tree (see diagram above) */
grpc_pollset_set_add_fd(pollset_sets[0].pss, tfds[0].fd);
grpc_pollset_set_add_fd(pollset_sets[1].pss, tfds[1].fd);
grpc_pollset_add_fd(pollsets[0].ps, tfds[2].fd);
grpc_pollset_add_fd(pollsets[1].ps, tfds[3].fd);
grpc_pollset_add_fd(pollsets[2].ps, tfds[4].fd);
grpc_pollset_set_add_pollset_set(pollset_sets[0].pss, pollset_sets[1].pss);
grpc_pollset_set_add_pollset(pollset_sets[1].pss, pollsets[0].ps);
grpc_pollset_set_add_pollset(pollset_sets[0].pss, pollsets[1].ps);
grpc_pollset_set_add_pollset(pollset_sets[0].pss, pollsets[2].ps);
grpc_pollset_set_add_fd(pollset_sets[0].pss, tfds[5].fd);
grpc_pollset_set_add_fd(pollset_sets[1].pss, tfds[6].fd);
grpc_pollset_add_fd(pollsets[0].ps, tfds[7].fd);
grpc_pollset_add_fd(pollsets[1].ps, tfds[8].fd);
grpc_pollset_add_fd(pollsets[2].ps, tfds[9].fd);
grpc_core::ExecCtx::Get()->Flush();
/* Test that if any FD in the above structure is readable, it is observable by
* doing grpc_pollset_work on any pollset
*
* For every pollset, do the following:
* - (Ensure that all FDs are in reset state)
* - Make all FDs readable
* - Call grpc_pollset_work() on the pollset
* - Flush the exec_ctx
* - Verify that on_readable call back was called for all FDs (and
* reset the FDs)
* */
for (int i = 0; i < num_ps; i++) {
make_test_fds_readable(tfds, num_fds);
gpr_mu_lock(pollsets[i].mu);
deadline = grpc_timespec_to_millis_round_up(
grpc_timeout_milliseconds_to_deadline(2));
GPR_ASSERT(GRPC_ERROR_NONE ==
grpc_pollset_work(pollsets[i].ps, &worker, deadline));
gpr_mu_unlock(pollsets[i].mu);
grpc_core::ExecCtx::Get()->Flush();
verify_readable_and_reset(tfds, num_fds);
grpc_core::ExecCtx::Get()->Flush();
}
/* Test tear down */
grpc_pollset_set_del_fd(pollset_sets[0].pss, tfds[0].fd);
grpc_pollset_set_del_fd(pollset_sets[0].pss, tfds[5].fd);
grpc_pollset_set_del_fd(pollset_sets[1].pss, tfds[1].fd);
grpc_pollset_set_del_fd(pollset_sets[1].pss, tfds[6].fd);
grpc_core::ExecCtx::Get()->Flush();
grpc_pollset_set_del_pollset(pollset_sets[1].pss, pollsets[0].ps);
grpc_pollset_set_del_pollset(pollset_sets[0].pss, pollsets[1].ps);
grpc_pollset_set_del_pollset(pollset_sets[0].pss, pollsets[2].ps);
grpc_pollset_set_del_pollset_set(pollset_sets[0].pss, pollset_sets[1].pss);
grpc_core::ExecCtx::Get()->Flush();
cleanup_test_fds(tfds, num_fds);
cleanup_test_pollsets(pollsets, num_ps);
cleanup_test_pollset_sets(pollset_sets, num_pss);
}
/* Same FD added multiple times to the pollset_set tree */
void pollset_set_test_dup_fds() {
/* We construct the following structure for this test:
*
* +---> FD0
* |
* |
* PSS0---+
* | +---> FD0 (also under PSS0)
* | |
* +---> PSS1--+ +--> FD1 (also under PSS1)
* | |
* +---> PS ---+
* | |
* | +--> FD2
* +---> FD1
*/
grpc_core::ExecCtx exec_ctx;
grpc_pollset_worker* worker;
grpc_millis deadline;
test_fd tfds[3];
test_pollset pollset;
test_pollset_set pollset_sets[2];
const int num_fds = GPR_ARRAY_SIZE(tfds);
const int num_ps = 1;
const int num_pss = GPR_ARRAY_SIZE(pollset_sets);
init_test_fds(tfds, num_fds);
init_test_pollsets(&pollset, num_ps);
init_test_pollset_sets(pollset_sets, num_pss);
/* Construct the structure */
grpc_pollset_set_add_fd(pollset_sets[0].pss, tfds[0].fd);
grpc_pollset_set_add_fd(pollset_sets[1].pss, tfds[0].fd);
grpc_pollset_set_add_fd(pollset_sets[1].pss, tfds[1].fd);
grpc_pollset_add_fd(pollset.ps, tfds[1].fd);
grpc_pollset_add_fd(pollset.ps, tfds[2].fd);
grpc_pollset_set_add_pollset(pollset_sets[1].pss, pollset.ps);
grpc_pollset_set_add_pollset_set(pollset_sets[0].pss, pollset_sets[1].pss);
/* Test. Make all FDs readable and make sure that can be observed by doing a
* grpc_pollset_work on the pollset 'PS' */
make_test_fds_readable(tfds, num_fds);
gpr_mu_lock(pollset.mu);
deadline = grpc_timespec_to_millis_round_up(
grpc_timeout_milliseconds_to_deadline(2));
GPR_ASSERT(GRPC_ERROR_NONE ==
grpc_pollset_work(pollset.ps, &worker, deadline));
gpr_mu_unlock(pollset.mu);
grpc_core::ExecCtx::Get()->Flush();
verify_readable_and_reset(tfds, num_fds);
grpc_core::ExecCtx::Get()->Flush();
/* Tear down */
grpc_pollset_set_del_fd(pollset_sets[0].pss, tfds[0].fd);
grpc_pollset_set_del_fd(pollset_sets[1].pss, tfds[0].fd);
grpc_pollset_set_del_fd(pollset_sets[1].pss, tfds[1].fd);
grpc_pollset_set_del_pollset(pollset_sets[1].pss, pollset.ps);
grpc_pollset_set_del_pollset_set(pollset_sets[0].pss, pollset_sets[1].pss);
grpc_core::ExecCtx::Get()->Flush();
cleanup_test_fds(tfds, num_fds);
cleanup_test_pollsets(&pollset, num_ps);
cleanup_test_pollset_sets(pollset_sets, num_pss);
}
/* Pollset_set with an empty pollset */
void pollset_set_test_empty_pollset() {
/* We construct the following structure for this test:
*
* +---> PS0 (EMPTY)
* |
* +---> FD0
* |
* PSS0---+
* | +---> FD1
* | |
* +---> PS1--+
* |
* +---> FD2
*/
grpc_core::ExecCtx exec_ctx;
grpc_pollset_worker* worker;
grpc_millis deadline;
test_fd tfds[3];
test_pollset pollsets[2];
test_pollset_set pollset_set;
const int num_fds = GPR_ARRAY_SIZE(tfds);
const int num_ps = GPR_ARRAY_SIZE(pollsets);
const int num_pss = 1;
init_test_fds(tfds, num_fds);
init_test_pollsets(pollsets, num_ps);
init_test_pollset_sets(&pollset_set, num_pss);
/* Construct the structure */
grpc_pollset_set_add_fd(pollset_set.pss, tfds[0].fd);
grpc_pollset_add_fd(pollsets[1].ps, tfds[1].fd);
grpc_pollset_add_fd(pollsets[1].ps, tfds[2].fd);
grpc_pollset_set_add_pollset(pollset_set.pss, pollsets[0].ps);
grpc_pollset_set_add_pollset(pollset_set.pss, pollsets[1].ps);
/* Test. Make all FDs readable and make sure that can be observed by doing
* grpc_pollset_work on the empty pollset 'PS0' */
make_test_fds_readable(tfds, num_fds);
gpr_mu_lock(pollsets[0].mu);
deadline = grpc_timespec_to_millis_round_up(
grpc_timeout_milliseconds_to_deadline(2));
GPR_ASSERT(GRPC_ERROR_NONE ==
grpc_pollset_work(pollsets[0].ps, &worker, deadline));
gpr_mu_unlock(pollsets[0].mu);
grpc_core::ExecCtx::Get()->Flush();
verify_readable_and_reset(tfds, num_fds);
grpc_core::ExecCtx::Get()->Flush();
/* Tear down */
grpc_pollset_set_del_fd(pollset_set.pss, tfds[0].fd);
grpc_pollset_set_del_pollset(pollset_set.pss, pollsets[0].ps);
grpc_pollset_set_del_pollset(pollset_set.pss, pollsets[1].ps);
grpc_core::ExecCtx::Get()->Flush();
cleanup_test_fds(tfds, num_fds);
cleanup_test_pollsets(pollsets, num_ps);
cleanup_test_pollset_sets(&pollset_set, num_pss);
}
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
grpc_init();
{
grpc_core::ExecCtx exec_ctx;
const char* poll_strategy = grpc_get_poll_strategy_name();
if (poll_strategy != nullptr &&
(strcmp(poll_strategy, "epollsig") == 0 ||
strcmp(poll_strategy, "epoll-threadpool") == 0)) {
pollset_set_test_basic();
pollset_set_test_dup_fds();
pollset_set_test_empty_pollset();
} else {
gpr_log(GPR_INFO,
"Skipping the test. The test is only relevant for 'epoll' "
"strategy. and the current strategy is: '%s'",
poll_strategy);
}
}
grpc_shutdown();
return 0;
}
#else /* defined(GRPC_LINUX_EPOLL_CREATE1) */
int main(int argc, char** argv) { return 0; }
#endif /* !defined(GRPC_LINUX_EPOLL_CREATE1) */

@ -1080,7 +1080,6 @@ src/core/lib/iomgr/error.h \
src/core/lib/iomgr/error_internal.h \
src/core/lib/iomgr/ev_epoll1_linux.h \
src/core/lib/iomgr/ev_epollex_linux.h \
src/core/lib/iomgr/ev_epollsig_linux.h \
src/core/lib/iomgr/ev_poll_posix.h \
src/core/lib/iomgr/ev_posix.h \
src/core/lib/iomgr/exec_ctx.h \

@ -1181,8 +1181,6 @@ src/core/lib/iomgr/ev_epoll1_linux.cc \
src/core/lib/iomgr/ev_epoll1_linux.h \
src/core/lib/iomgr/ev_epollex_linux.cc \
src/core/lib/iomgr/ev_epollex_linux.h \
src/core/lib/iomgr/ev_epollsig_linux.cc \
src/core/lib/iomgr/ev_epollsig_linux.h \
src/core/lib/iomgr/ev_poll_posix.cc \
src/core/lib/iomgr/ev_poll_posix.h \
src/core/lib/iomgr/ev_posix.cc \

@ -483,23 +483,6 @@
"third_party": false,
"type": "target"
},
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"is_filegroup": false,
"language": "c",
"name": "ev_epollsig_linux_test",
"src": [
"test/core/iomgr/ev_epollsig_linux_test.cc"
],
"third_party": false,
"type": "target"
},
{
"deps": [
"gpr",
@ -1853,23 +1836,6 @@
"third_party": false,
"type": "target"
},
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"is_filegroup": false,
"language": "c",
"name": "pollset_set_test",
"src": [
"test/core/iomgr/pollset_set_test.cc"
],
"third_party": false,
"type": "target"
},
{
"deps": [
"gpr",
@ -9551,7 +9517,6 @@
"src/core/lib/iomgr/error.cc",
"src/core/lib/iomgr/ev_epoll1_linux.cc",
"src/core/lib/iomgr/ev_epollex_linux.cc",
"src/core/lib/iomgr/ev_epollsig_linux.cc",
"src/core/lib/iomgr/ev_poll_posix.cc",
"src/core/lib/iomgr/ev_posix.cc",
"src/core/lib/iomgr/ev_windows.cc",
@ -9732,7 +9697,6 @@
"src/core/lib/iomgr/error_internal.h",
"src/core/lib/iomgr/ev_epoll1_linux.h",
"src/core/lib/iomgr/ev_epollex_linux.h",
"src/core/lib/iomgr/ev_epollsig_linux.h",
"src/core/lib/iomgr/ev_poll_posix.h",
"src/core/lib/iomgr/ev_posix.h",
"src/core/lib/iomgr/exec_ctx.h",
@ -9884,7 +9848,6 @@
"src/core/lib/iomgr/error_internal.h",
"src/core/lib/iomgr/ev_epoll1_linux.h",
"src/core/lib/iomgr/ev_epollex_linux.h",
"src/core/lib/iomgr/ev_epollsig_linux.h",
"src/core/lib/iomgr/ev_poll_posix.h",
"src/core/lib/iomgr/ev_posix.h",
"src/core/lib/iomgr/exec_ctx.h",

@ -601,26 +601,6 @@
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux"
],
"cpu_cost": 3,
"exclude_configs": [],
"exclude_iomgrs": [
"uv"
],
"flaky": false,
"gtest": false,
"language": "c",
"name": "ev_epollsig_linux_test",
"platforms": [
"linux"
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,
@ -2101,26 +2081,6 @@
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [
"uv"
],
"flaky": false,
"gtest": false,
"language": "c",
"name": "pollset_set_test",
"platforms": [
"linux"
],
"uses_polling": true
},
{
"args": [],
"benchmark": false,

@ -61,7 +61,7 @@ _FORCE_ENVIRON_FOR_WRAPPERS = {
}
_POLLING_STRATEGIES = {
'linux': ['epollex', 'epollsig', 'epoll1', 'poll', 'poll-cv'],
'linux': ['epollex', 'epoll1', 'poll', 'poll-cv'],
'mac': ['poll'],
}
@ -1430,7 +1430,7 @@ argp.add_argument(
default=None,
type=str,
help='Only use the specified comma-delimited list of polling engines. '
'Example: --force_use_pollers epollsig,poll '
'Example: --force_use_pollers epoll1,poll '
' (This flag has no effect if --force_default_poller flag is also used)')
argp.add_argument(
'--max_time', default=-1, type=int, help='Maximum test runtime in seconds')

Loading…
Cancel
Save