From 2b226adf60eac113e6c2780aa551c775e72511d6 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 11 Jan 2018 16:11:35 -0800 Subject: Remove alarm from core, implement in C++ layer only --- BUILD | 3 +- CMakeLists.txt | 47 +---- Makefile | 75 ++------ build.yaml | 18 +- config.m4 | 1 - config.w32 | 1 - gRPC-Core.podspec | 3 - grpc.def | 4 - grpc.gemspec | 2 - grpc.gyp | 6 +- include/grpc++/alarm.h | 51 ++---- include/grpc/grpc.h | 19 -- package.xml | 2 - src/core/lib/surface/alarm.cc | 137 --------------- src/core/lib/surface/alarm_internal.h | 40 ----- src/core/lib/surface/init.cc | 1 - src/cpp/common/alarm.cc | 129 ++++++++++++++ src/python/grpcio/grpc_core_dependencies.py | 1 - src/ruby/ext/grpc/rb_grpc_imports.generated.c | 8 - src/ruby/ext/grpc/rb_grpc_imports.generated.h | 12 -- test/core/surface/BUILD | 12 -- test/core/surface/public_headers_must_be_c89.c | 4 - test/cpp/common/BUILD | 4 +- test/cpp/common/alarm_cpp_test.cc | 192 --------------------- test/cpp/common/alarm_test.cc | 192 +++++++++++++++++++++ tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core.internal | 2 - tools/run_tests/generated/sources_and_headers.json | 25 +-- tools/run_tests/generated/tests.json | 26 +-- 29 files changed, 374 insertions(+), 645 deletions(-) delete mode 100644 src/core/lib/surface/alarm.cc delete mode 100644 src/core/lib/surface/alarm_internal.h create mode 100644 src/cpp/common/alarm.cc delete mode 100644 test/cpp/common/alarm_cpp_test.cc create mode 100644 test/cpp/common/alarm_test.cc diff --git a/BUILD b/BUILD index 6ed4a5a0ae..cd70722fc5 100644 --- a/BUILD +++ b/BUILD @@ -117,6 +117,7 @@ GRPCXX_SRCS = [ "src/cpp/client/create_channel_posix.cc", "src/cpp/client/credentials_cc.cc", "src/cpp/client/generic_stub.cc", + "src/cpp/common/alarm.cc", "src/cpp/common/channel_arguments.cc", "src/cpp/common/channel_filter.cc", "src/cpp/common/completion_queue_cc.cc", @@ -721,7 +722,6 @@ grpc_cc_library( "src/core/lib/slice/slice_hash_table.cc", "src/core/lib/slice/slice_intern.cc", "src/core/lib/slice/slice_string_helpers.cc", - "src/core/lib/surface/alarm.cc", "src/core/lib/surface/api_trace.cc", "src/core/lib/surface/byte_buffer.cc", "src/core/lib/surface/byte_buffer_reader.cc", @@ -845,7 +845,6 @@ grpc_cc_library( "src/core/lib/slice/slice_hash_table.h", "src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_string_helpers.h", - "src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/api_trace.h", "src/core/lib/surface/call.h", "src/core/lib/surface/call_test_only.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index b679fb85ab..c018ca122f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,7 +209,6 @@ add_custom_target(tools if (gRPC_BUILD_TESTS) add_custom_target(buildtests_c) -add_dependencies(buildtests_c alarm_test) add_dependencies(buildtests_c algorithm_test) add_dependencies(buildtests_c alloc_test) add_dependencies(buildtests_c alpn_test) @@ -463,7 +462,7 @@ add_dependencies(buildtests_c ssl_server_fuzzer_one_entry) add_dependencies(buildtests_c uri_fuzzer_test_one_entry) add_custom_target(buildtests_cxx) -add_dependencies(buildtests_cxx alarm_cpp_test) +add_dependencies(buildtests_cxx alarm_test) add_dependencies(buildtests_cxx async_end2end_test) add_dependencies(buildtests_cxx auth_property_iterator_test) add_dependencies(buildtests_cxx backoff_test) @@ -893,7 +892,6 @@ add_library(grpc src/core/lib/slice/slice_hash_table.cc src/core/lib/slice/slice_intern.cc src/core/lib/slice/slice_string_helpers.cc - src/core/lib/surface/alarm.cc src/core/lib/surface/api_trace.cc src/core/lib/surface/byte_buffer.cc src/core/lib/surface/byte_buffer_reader.cc @@ -1233,7 +1231,6 @@ add_library(grpc_cronet src/core/lib/slice/slice_hash_table.cc src/core/lib/slice/slice_intern.cc src/core/lib/slice/slice_string_helpers.cc - src/core/lib/surface/alarm.cc src/core/lib/surface/api_trace.cc src/core/lib/surface/byte_buffer.cc src/core/lib/surface/byte_buffer_reader.cc @@ -1556,7 +1553,6 @@ add_library(grpc_test_util src/core/lib/slice/slice_hash_table.cc src/core/lib/slice/slice_intern.cc src/core/lib/slice/slice_string_helpers.cc - src/core/lib/surface/alarm.cc src/core/lib/surface/api_trace.cc src/core/lib/surface/byte_buffer.cc src/core/lib/surface/byte_buffer_reader.cc @@ -1823,7 +1819,6 @@ add_library(grpc_test_util_unsecure src/core/lib/slice/slice_hash_table.cc src/core/lib/slice/slice_intern.cc src/core/lib/slice/slice_string_helpers.cc - src/core/lib/surface/alarm.cc src/core/lib/surface/api_trace.cc src/core/lib/surface/byte_buffer.cc src/core/lib/surface/byte_buffer_reader.cc @@ -2073,7 +2068,6 @@ add_library(grpc_unsecure src/core/lib/slice/slice_hash_table.cc src/core/lib/slice/slice_intern.cc src/core/lib/slice/slice_string_helpers.cc - src/core/lib/surface/alarm.cc src/core/lib/surface/api_trace.cc src/core/lib/surface/byte_buffer.cc src/core/lib/surface/byte_buffer_reader.cc @@ -2371,6 +2365,7 @@ add_library(grpc++ src/cpp/client/create_channel_posix.cc src/cpp/client/credentials_cc.cc src/cpp/client/generic_stub.cc + src/cpp/common/alarm.cc src/cpp/common/channel_arguments.cc src/cpp/common/channel_filter.cc src/cpp/common/completion_queue_cc.cc @@ -2658,6 +2653,7 @@ add_library(grpc++_cronet src/cpp/client/create_channel_posix.cc src/cpp/client/credentials_cc.cc src/cpp/client/generic_stub.cc + src/cpp/common/alarm.cc src/cpp/common/channel_arguments.cc src/cpp/common/channel_filter.cc src/cpp/common/completion_queue_cc.cc @@ -2811,7 +2807,6 @@ add_library(grpc++_cronet src/core/lib/slice/slice_hash_table.cc src/core/lib/slice/slice_intern.cc src/core/lib/slice/slice_string_helpers.cc - src/core/lib/surface/alarm.cc src/core/lib/surface/api_trace.cc src/core/lib/surface/byte_buffer.cc src/core/lib/surface/byte_buffer_reader.cc @@ -3582,6 +3577,7 @@ add_library(grpc++_unsecure src/cpp/client/create_channel_posix.cc src/cpp/client/credentials_cc.cc src/cpp/client/generic_stub.cc + src/cpp/common/alarm.cc src/cpp/common/channel_arguments.cc src/cpp/common/channel_filter.cc src/cpp/common/completion_queue_cc.cc @@ -4729,33 +4725,6 @@ endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) -add_executable(alarm_test - test/core/surface/alarm_test.cc -) - - -target_include_directories(alarm_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} -) - -target_link_libraries(alarm_test - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc_test_util - grpc - gpr_test_util - gpr -) - -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - add_executable(algorithm_test test/core/compression/algorithm_test.cc ) @@ -8299,14 +8268,14 @@ endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) -add_executable(alarm_cpp_test - test/cpp/common/alarm_cpp_test.cc +add_executable(alarm_test + test/cpp/common/alarm_test.cc third_party/googletest/googletest/src/gtest-all.cc third_party/googletest/googlemock/src/gmock-all.cc ) -target_include_directories(alarm_cpp_test +target_include_directories(alarm_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${_gRPC_SSL_INCLUDE_DIR} @@ -8322,7 +8291,7 @@ target_include_directories(alarm_cpp_test PRIVATE ${_gRPC_PROTO_GENS_DIR} ) -target_link_libraries(alarm_cpp_test +target_link_libraries(alarm_test ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} grpc++_test_util_unsecure diff --git a/Makefile b/Makefile index ada461fb37..540c8c86d8 100644 --- a/Makefile +++ b/Makefile @@ -950,7 +950,6 @@ systemtap_dep_error: stop: @false -alarm_test: $(BINDIR)/$(CONFIG)/alarm_test algorithm_test: $(BINDIR)/$(CONFIG)/algorithm_test alloc_test: $(BINDIR)/$(CONFIG)/alloc_test alpn_test: $(BINDIR)/$(CONFIG)/alpn_test @@ -1095,7 +1094,7 @@ udp_server_test: $(BINDIR)/$(CONFIG)/udp_server_test uri_fuzzer_test: $(BINDIR)/$(CONFIG)/uri_fuzzer_test uri_parser_test: $(BINDIR)/$(CONFIG)/uri_parser_test wakeup_fd_cv_test: $(BINDIR)/$(CONFIG)/wakeup_fd_cv_test -alarm_cpp_test: $(BINDIR)/$(CONFIG)/alarm_cpp_test +alarm_test: $(BINDIR)/$(CONFIG)/alarm_test async_end2end_test: $(BINDIR)/$(CONFIG)/async_end2end_test auth_property_iterator_test: $(BINDIR)/$(CONFIG)/auth_property_iterator_test backoff_test: $(BINDIR)/$(CONFIG)/backoff_test @@ -1355,7 +1354,6 @@ endif buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c \ - $(BINDIR)/$(CONFIG)/alarm_test \ $(BINDIR)/$(CONFIG)/algorithm_test \ $(BINDIR)/$(CONFIG)/alloc_test \ $(BINDIR)/$(CONFIG)/alpn_test \ @@ -1545,7 +1543,7 @@ buildtests_c: privatelibs_c \ ifeq ($(EMBED_OPENSSL),true) buildtests_cxx: privatelibs_cxx \ - $(BINDIR)/$(CONFIG)/alarm_cpp_test \ + $(BINDIR)/$(CONFIG)/alarm_test \ $(BINDIR)/$(CONFIG)/async_end2end_test \ $(BINDIR)/$(CONFIG)/auth_property_iterator_test \ $(BINDIR)/$(CONFIG)/backoff_test \ @@ -1677,7 +1675,7 @@ buildtests_cxx: privatelibs_cxx \ else buildtests_cxx: privatelibs_cxx \ - $(BINDIR)/$(CONFIG)/alarm_cpp_test \ + $(BINDIR)/$(CONFIG)/alarm_test \ $(BINDIR)/$(CONFIG)/async_end2end_test \ $(BINDIR)/$(CONFIG)/auth_property_iterator_test \ $(BINDIR)/$(CONFIG)/backoff_test \ @@ -1777,8 +1775,6 @@ test: test_c test_cxx flaky_test: flaky_test_c flaky_test_cxx test_c: buildtests_c - $(E) "[RUN] Testing alarm_test" - $(Q) $(BINDIR)/$(CONFIG)/alarm_test || ( echo test alarm_test failed ; exit 1 ) $(E) "[RUN] Testing algorithm_test" $(Q) $(BINDIR)/$(CONFIG)/algorithm_test || ( echo test algorithm_test failed ; exit 1 ) $(E) "[RUN] Testing alloc_test" @@ -2045,8 +2041,8 @@ flaky_test_c: buildtests_c test_cxx: buildtests_cxx - $(E) "[RUN] Testing alarm_cpp_test" - $(Q) $(BINDIR)/$(CONFIG)/alarm_cpp_test || ( echo test alarm_cpp_test failed ; exit 1 ) + $(E) "[RUN] Testing alarm_test" + $(Q) $(BINDIR)/$(CONFIG)/alarm_test || ( echo test alarm_test failed ; exit 1 ) $(E) "[RUN] Testing async_end2end_test" $(Q) $(BINDIR)/$(CONFIG)/async_end2end_test || ( echo test async_end2end_test failed ; exit 1 ) $(E) "[RUN] Testing auth_property_iterator_test" @@ -3091,7 +3087,6 @@ LIBGRPC_SRC = \ src/core/lib/slice/slice_hash_table.cc \ src/core/lib/slice/slice_intern.cc \ src/core/lib/slice/slice_string_helpers.cc \ - src/core/lib/surface/alarm.cc \ src/core/lib/surface/api_trace.cc \ src/core/lib/surface/byte_buffer.cc \ src/core/lib/surface/byte_buffer_reader.cc \ @@ -3433,7 +3428,6 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/slice/slice_hash_table.cc \ src/core/lib/slice/slice_intern.cc \ src/core/lib/slice/slice_string_helpers.cc \ - src/core/lib/surface/alarm.cc \ src/core/lib/surface/api_trace.cc \ src/core/lib/surface/byte_buffer.cc \ src/core/lib/surface/byte_buffer_reader.cc \ @@ -3757,7 +3751,6 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/slice/slice_hash_table.cc \ src/core/lib/slice/slice_intern.cc \ src/core/lib/slice/slice_string_helpers.cc \ - src/core/lib/surface/alarm.cc \ src/core/lib/surface/api_trace.cc \ src/core/lib/surface/byte_buffer.cc \ src/core/lib/surface/byte_buffer_reader.cc \ @@ -4017,7 +4010,6 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ src/core/lib/slice/slice_hash_table.cc \ src/core/lib/slice/slice_intern.cc \ src/core/lib/slice/slice_string_helpers.cc \ - src/core/lib/surface/alarm.cc \ src/core/lib/surface/api_trace.cc \ src/core/lib/surface/byte_buffer.cc \ src/core/lib/surface/byte_buffer_reader.cc \ @@ -4247,7 +4239,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/slice/slice_hash_table.cc \ src/core/lib/slice/slice_intern.cc \ src/core/lib/slice/slice_string_helpers.cc \ - src/core/lib/surface/alarm.cc \ src/core/lib/surface/api_trace.cc \ src/core/lib/surface/byte_buffer.cc \ src/core/lib/surface/byte_buffer_reader.cc \ @@ -4532,6 +4523,7 @@ LIBGRPC++_SRC = \ src/cpp/client/create_channel_posix.cc \ src/cpp/client/credentials_cc.cc \ src/cpp/client/generic_stub.cc \ + src/cpp/common/alarm.cc \ src/cpp/common/channel_arguments.cc \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ @@ -4825,6 +4817,7 @@ LIBGRPC++_CRONET_SRC = \ src/cpp/client/create_channel_posix.cc \ src/cpp/client/credentials_cc.cc \ src/cpp/client/generic_stub.cc \ + src/cpp/common/alarm.cc \ src/cpp/common/channel_arguments.cc \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ @@ -4978,7 +4971,6 @@ LIBGRPC++_CRONET_SRC = \ src/core/lib/slice/slice_hash_table.cc \ src/core/lib/slice/slice_intern.cc \ src/core/lib/slice/slice_string_helpers.cc \ - src/core/lib/surface/alarm.cc \ src/core/lib/surface/api_trace.cc \ src/core/lib/surface/byte_buffer.cc \ src/core/lib/surface/byte_buffer_reader.cc \ @@ -5736,6 +5728,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/client/create_channel_posix.cc \ src/cpp/client/credentials_cc.cc \ src/cpp/client/generic_stub.cc \ + src/cpp/common/alarm.cc \ src/cpp/common/channel_arguments.cc \ src/cpp/common/channel_filter.cc \ src/cpp/common/completion_queue_cc.cc \ @@ -8733,38 +8726,6 @@ endif # All of the test targets, and protoc plugins -ALARM_TEST_SRC = \ - test/core/surface/alarm_test.cc \ - -ALARM_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(ALARM_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/alarm_test: openssl_dep_error - -else - - - -$(BINDIR)/$(CONFIG)/alarm_test: $(ALARM_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) $(ALARM_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)/alarm_test - -endif - -$(OBJDIR)/$(CONFIG)/test/core/surface/alarm_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a - -deps_alarm_test: $(ALARM_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(ALARM_TEST_OBJS:.o=.dep) -endif -endif - - ALGORITHM_TEST_SRC = \ test/core/compression/algorithm_test.cc \ @@ -13385,15 +13346,15 @@ endif endif -ALARM_CPP_TEST_SRC = \ - test/cpp/common/alarm_cpp_test.cc \ +ALARM_TEST_SRC = \ + test/cpp/common/alarm_test.cc \ -ALARM_CPP_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(ALARM_CPP_TEST_SRC)))) +ALARM_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(ALARM_TEST_SRC)))) ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL. -$(BINDIR)/$(CONFIG)/alarm_cpp_test: openssl_dep_error +$(BINDIR)/$(CONFIG)/alarm_test: openssl_dep_error else @@ -13404,26 +13365,26 @@ ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/alarm_cpp_test: protobuf_dep_error +$(BINDIR)/$(CONFIG)/alarm_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/alarm_cpp_test: $(PROTOBUF_DEP) $(ALARM_CPP_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(BINDIR)/$(CONFIG)/alarm_test: $(PROTOBUF_DEP) $(ALARM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(ALARM_CPP_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/alarm_cpp_test + $(Q) $(LDXX) $(LDFLAGS) $(ALARM_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/alarm_test endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/common/alarm_cpp_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/test/cpp/common/alarm_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a -deps_alarm_cpp_test: $(ALARM_CPP_TEST_OBJS:.o=.dep) +deps_alarm_test: $(ALARM_TEST_OBJS:.o=.dep) ifneq ($(NO_SECURE),true) ifneq ($(NO_DEPS),true) --include $(ALARM_CPP_TEST_OBJS:.o=.dep) +-include $(ALARM_TEST_OBJS:.o=.dep) endif endif diff --git a/build.yaml b/build.yaml index 61f76f205c..588263e646 100644 --- a/build.yaml +++ b/build.yaml @@ -251,7 +251,6 @@ filegroups: - src/core/lib/slice/slice_hash_table.cc - src/core/lib/slice/slice_intern.cc - src/core/lib/slice/slice_string_helpers.cc - - src/core/lib/surface/alarm.cc - src/core/lib/surface/api_trace.cc - src/core/lib/surface/byte_buffer.cc - src/core/lib/surface/byte_buffer_reader.cc @@ -401,7 +400,6 @@ filegroups: - src/core/lib/slice/slice_hash_table.h - src/core/lib/slice/slice_internal.h - src/core/lib/slice/slice_string_helpers.h - - src/core/lib/surface/alarm_internal.h - src/core/lib/surface/api_trace.h - src/core/lib/surface/call.h - src/core/lib/surface/call_test_only.h @@ -1074,6 +1072,7 @@ filegroups: - src/cpp/client/create_channel_posix.cc - src/cpp/client/credentials_cc.cc - src/cpp/client/generic_stub.cc + - src/cpp/common/alarm.cc - src/cpp/common/channel_arguments.cc - src/cpp/common/channel_filter.cc - src/cpp/common/completion_queue_cc.cc @@ -1706,17 +1705,6 @@ libs: - winsock - global targets: -- name: alarm_test - cpu_cost: 0.1 - build: test - language: c - src: - - test/core/surface/alarm_test.cc - deps: - - grpc_test_util - - grpc - - gpr_test_util - - gpr - name: algorithm_test build: test language: c @@ -3407,12 +3395,12 @@ targets: - mac - linux - posix -- name: alarm_cpp_test +- name: alarm_test gtest: true build: test language: c++ src: - - test/cpp/common/alarm_cpp_test.cc + - test/cpp/common/alarm_test.cc deps: - grpc++_test_util_unsecure - grpc_test_util_unsecure diff --git a/config.m4 b/config.m4 index 54e29cc41d..5615cffad6 100644 --- a/config.m4 +++ b/config.m4 @@ -185,7 +185,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/slice/slice_hash_table.cc \ src/core/lib/slice/slice_intern.cc \ src/core/lib/slice/slice_string_helpers.cc \ - src/core/lib/surface/alarm.cc \ src/core/lib/surface/api_trace.cc \ src/core/lib/surface/byte_buffer.cc \ src/core/lib/surface/byte_buffer_reader.cc \ diff --git a/config.w32 b/config.w32 index c8003140d8..2272f0dc1b 100644 --- a/config.w32 +++ b/config.w32 @@ -162,7 +162,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\slice\\slice_hash_table.cc " + "src\\core\\lib\\slice\\slice_intern.cc " + "src\\core\\lib\\slice\\slice_string_helpers.cc " + - "src\\core\\lib\\surface\\alarm.cc " + "src\\core\\lib\\surface\\api_trace.cc " + "src\\core\\lib\\surface\\byte_buffer.cc " + "src\\core\\lib\\surface\\byte_buffer_reader.cc " + diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index ca072602a9..e16e7fd624 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -424,7 +424,6 @@ Pod::Spec.new do |s| 'src/core/lib/slice/slice_hash_table.h', 'src/core/lib/slice/slice_internal.h', 'src/core/lib/slice/slice_string_helpers.h', - 'src/core/lib/surface/alarm_internal.h', 'src/core/lib/surface/api_trace.h', 'src/core/lib/surface/call.h', 'src/core/lib/surface/call_test_only.h', @@ -571,7 +570,6 @@ Pod::Spec.new do |s| 'src/core/lib/slice/slice_hash_table.cc', 'src/core/lib/slice/slice_intern.cc', 'src/core/lib/slice/slice_string_helpers.cc', - 'src/core/lib/surface/alarm.cc', 'src/core/lib/surface/api_trace.cc', 'src/core/lib/surface/byte_buffer.cc', 'src/core/lib/surface/byte_buffer_reader.cc', @@ -906,7 +904,6 @@ Pod::Spec.new do |s| 'src/core/lib/slice/slice_hash_table.h', 'src/core/lib/slice/slice_internal.h', 'src/core/lib/slice/slice_string_helpers.h', - 'src/core/lib/surface/alarm_internal.h', 'src/core/lib/surface/api_trace.h', 'src/core/lib/surface/call.h', 'src/core/lib/surface/call_test_only.h', diff --git a/grpc.def b/grpc.def index d4a18ccefc..f24e9a37b9 100644 --- a/grpc.def +++ b/grpc.def @@ -28,10 +28,6 @@ EXPORTS grpc_completion_queue_destroy grpc_completion_queue_thread_local_cache_init grpc_completion_queue_thread_local_cache_flush - grpc_alarm_create - grpc_alarm_set - grpc_alarm_cancel - grpc_alarm_destroy grpc_channel_check_connectivity_state grpc_channel_num_external_connectivity_watchers grpc_channel_watch_connectivity_state diff --git a/grpc.gemspec b/grpc.gemspec index 35b2776eba..fc50ab6942 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -350,7 +350,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/slice/slice_hash_table.h ) s.files += %w( src/core/lib/slice/slice_internal.h ) s.files += %w( src/core/lib/slice/slice_string_helpers.h ) - s.files += %w( src/core/lib/surface/alarm_internal.h ) s.files += %w( src/core/lib/surface/api_trace.h ) s.files += %w( src/core/lib/surface/call.h ) s.files += %w( src/core/lib/surface/call_test_only.h ) @@ -501,7 +500,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/slice/slice_hash_table.cc ) s.files += %w( src/core/lib/slice/slice_intern.cc ) s.files += %w( src/core/lib/slice/slice_string_helpers.cc ) - s.files += %w( src/core/lib/surface/alarm.cc ) s.files += %w( src/core/lib/surface/api_trace.cc ) s.files += %w( src/core/lib/surface/byte_buffer.cc ) s.files += %w( src/core/lib/surface/byte_buffer_reader.cc ) diff --git a/grpc.gyp b/grpc.gyp index 49dcdf93a2..620f374bda 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -326,7 +326,6 @@ 'src/core/lib/slice/slice_hash_table.cc', 'src/core/lib/slice/slice_intern.cc', 'src/core/lib/slice/slice_string_helpers.cc', - 'src/core/lib/surface/alarm.cc', 'src/core/lib/surface/api_trace.cc', 'src/core/lib/surface/byte_buffer.cc', 'src/core/lib/surface/byte_buffer_reader.cc', @@ -620,7 +619,6 @@ 'src/core/lib/slice/slice_hash_table.cc', 'src/core/lib/slice/slice_intern.cc', 'src/core/lib/slice/slice_string_helpers.cc', - 'src/core/lib/surface/alarm.cc', 'src/core/lib/surface/api_trace.cc', 'src/core/lib/surface/byte_buffer.cc', 'src/core/lib/surface/byte_buffer_reader.cc', @@ -832,7 +830,6 @@ 'src/core/lib/slice/slice_hash_table.cc', 'src/core/lib/slice/slice_intern.cc', 'src/core/lib/slice/slice_string_helpers.cc', - 'src/core/lib/surface/alarm.cc', 'src/core/lib/surface/api_trace.cc', 'src/core/lib/surface/byte_buffer.cc', 'src/core/lib/surface/byte_buffer_reader.cc', @@ -1026,7 +1023,6 @@ 'src/core/lib/slice/slice_hash_table.cc', 'src/core/lib/slice/slice_intern.cc', 'src/core/lib/slice/slice_string_helpers.cc', - 'src/core/lib/surface/alarm.cc', 'src/core/lib/surface/api_trace.cc', 'src/core/lib/surface/byte_buffer.cc', 'src/core/lib/surface/byte_buffer_reader.cc', @@ -1195,6 +1191,7 @@ 'src/cpp/client/create_channel_posix.cc', 'src/cpp/client/credentials_cc.cc', 'src/cpp/client/generic_stub.cc', + 'src/cpp/common/alarm.cc', 'src/cpp/common/channel_arguments.cc', 'src/cpp/common/channel_filter.cc', 'src/cpp/common/completion_queue_cc.cc', @@ -1340,6 +1337,7 @@ 'src/cpp/client/create_channel_posix.cc', 'src/cpp/client/credentials_cc.cc', 'src/cpp/client/generic_stub.cc', + 'src/cpp/common/alarm.cc', 'src/cpp/common/channel_arguments.cc', 'src/cpp/common/channel_filter.cc', 'src/cpp/common/completion_queue_cc.cc', diff --git a/include/grpc++/alarm.h b/include/grpc++/alarm.h index b43425e224..4660b04cfa 100644 --- a/include/grpc++/alarm.h +++ b/include/grpc++/alarm.h @@ -28,17 +28,20 @@ #include #include -struct grpc_alarm; - namespace grpc { -class CompletionQueue; +namespace internal { +class AlarmImpl; +} /// A thin wrapper around \a grpc_alarm (see / \a / src/core/surface/alarm.h). class Alarm : private GrpcLibraryCodegen { public: /// Create an unset completion queue alarm - Alarm() : tag_(nullptr), alarm_(grpc_alarm_create(nullptr)) {} + Alarm(); + + /// Destroy the given completion queue alarm, cancelling it in the process. + ~Alarm(); /// DEPRECATED: Create and set a completion queue alarm instance associated to /// \a cq. @@ -48,10 +51,8 @@ class Alarm : private GrpcLibraryCodegen { /// internal::GrpcLibraryInitializer instance would need to be introduced /// here. \endinternal. template - Alarm(CompletionQueue* cq, const T& deadline, void* tag) - : tag_(tag), alarm_(grpc_alarm_create(nullptr)) { - grpc_alarm_set(alarm_, cq->cq(), TimePoint(deadline).raw_time(), - static_cast(&tag_), nullptr); + Alarm(CompletionQueue* cq, const T& deadline, void* tag) : Alarm() { + SetInternal(cq, TimePoint(deadline).raw_time(), tag); } /// Trigger an alarm instance on completion queue \a cq at the specified time. @@ -60,9 +61,7 @@ class Alarm : private GrpcLibraryCodegen { /// event's success bit will be true, false otherwise (ie, upon cancellation). template void Set(CompletionQueue* cq, const T& deadline, void* tag) { - tag_.Set(tag); - grpc_alarm_set(alarm_, cq->cq(), TimePoint(deadline).raw_time(), - static_cast(&tag_), nullptr); + SetInternal(cq, TimePoint(deadline).raw_time(), tag); } /// Alarms aren't copyable. @@ -70,43 +69,21 @@ class Alarm : private GrpcLibraryCodegen { Alarm& operator=(const Alarm&) = delete; /// Alarms are movable. - Alarm(Alarm&& rhs) : tag_(rhs.tag_), alarm_(rhs.alarm_) { - rhs.alarm_ = nullptr; - } + Alarm(Alarm&& rhs) : alarm_(rhs.alarm_) { rhs.alarm_ = nullptr; } Alarm& operator=(Alarm&& rhs) { - tag_ = rhs.tag_; alarm_ = rhs.alarm_; rhs.alarm_ = nullptr; return *this; } - /// Destroy the given completion queue alarm, cancelling it in the process. - ~Alarm() { - if (alarm_ != nullptr) grpc_alarm_destroy(alarm_, nullptr); - } - /// Cancel a completion queue alarm. Calling this function over an alarm that /// has already fired has no effect. - void Cancel() { - if (alarm_ != nullptr) grpc_alarm_cancel(alarm_, nullptr); - } + void Cancel(); private: - class AlarmEntry : public internal::CompletionQueueTag { - public: - AlarmEntry(void* tag) : tag_(tag) {} - void Set(void* tag) { tag_ = tag; } - bool FinalizeResult(void** tag, bool* status) override { - *tag = tag_; - return true; - } - - private: - void* tag_; - }; + void SetInternal(CompletionQueue* cq, gpr_timespec deadline, void* tag); - AlarmEntry tag_; - grpc_alarm* alarm_; // owned + internal::AlarmImpl* alarm_; }; } // namespace grpc diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index f083bc591e..47d749c728 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -160,25 +160,6 @@ GRPCAPI void grpc_completion_queue_thread_local_cache_init( GRPCAPI int grpc_completion_queue_thread_local_cache_flush( grpc_completion_queue* cq, void** tag, int* ok); -/** Create a completion queue alarm instance */ -GRPCAPI grpc_alarm* grpc_alarm_create(void* reserved); - -/** Set a completion queue alarm instance associated to \a cq. - * - * Once the alarm expires (at \a deadline) or it's cancelled (see \a - * grpc_alarm_cancel), an event with tag \a tag will be added to \a cq. If the - * alarm expired, the event's success bit will be true, false otherwise (ie, - * upon cancellation). */ -GRPCAPI void grpc_alarm_set(grpc_alarm* alarm, grpc_completion_queue* cq, - gpr_timespec deadline, void* tag, void* reserved); - -/** Cancel a completion queue alarm. Calling this function over an alarm that - * has already fired has no effect. */ -GRPCAPI void grpc_alarm_cancel(grpc_alarm* alarm, void* reserved); - -/** Destroy the given completion queue alarm, cancelling it in the process. */ -GRPCAPI void grpc_alarm_destroy(grpc_alarm* alarm, void* reserved); - /** Check the connectivity state of a channel. */ GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state( grpc_channel* channel, int try_to_connect); diff --git a/package.xml b/package.xml index 1b099a8dad..f5b1aec60d 100644 --- a/package.xml +++ b/package.xml @@ -357,7 +357,6 @@ - @@ -508,7 +507,6 @@ - diff --git a/src/core/lib/surface/alarm.cc b/src/core/lib/surface/alarm.cc deleted file mode 100644 index f6ea016c33..0000000000 --- a/src/core/lib/surface/alarm.cc +++ /dev/null @@ -1,137 +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 - -#include - -#include "src/core/lib/surface/alarm_internal.h" - -#include -#include -#include -#include "src/core/lib/iomgr/timer.h" -#include "src/core/lib/surface/completion_queue.h" - -grpc_core::DebugOnlyTraceFlag grpc_trace_alarm_refcount(false, - "alarm_refcount"); - -struct grpc_alarm { - gpr_refcount refs; - grpc_timer alarm; - grpc_closure on_alarm; - grpc_cq_completion completion; - /** completion queue where events about this alarm will be posted */ - grpc_completion_queue* cq; - /** user supplied tag */ - void* tag; -}; - -static void alarm_ref(grpc_alarm* alarm) { gpr_ref(&alarm->refs); } - -static void alarm_unref(grpc_alarm* alarm) { - if (gpr_unref(&alarm->refs)) { - grpc_core::ExecCtx exec_ctx; - if (alarm->cq != nullptr) { - GRPC_CQ_INTERNAL_UNREF(alarm->cq, "alarm"); - } - - gpr_free(alarm); - } -} - -#ifndef NDEBUG -static void alarm_ref_dbg(grpc_alarm* alarm, const char* reason, - const char* file, int line) { - if (grpc_trace_alarm_refcount.enabled()) { - gpr_atm val = gpr_atm_no_barrier_load(&alarm->refs.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "Alarm:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", alarm, val, - val + 1, reason); - } - - alarm_ref(alarm); -} - -static void alarm_unref_dbg(grpc_alarm* alarm, const char* reason, - const char* file, int line) { - if (grpc_trace_alarm_refcount.enabled()) { - gpr_atm val = gpr_atm_no_barrier_load(&alarm->refs.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "Alarm:%p Unref %" PRIdPTR " -> %" PRIdPTR " %s", alarm, val, - val - 1, reason); - } - - alarm_unref(alarm); -} -#endif - -static void alarm_end_completion(void* arg, grpc_cq_completion* c) { - grpc_alarm* alarm = (grpc_alarm*)arg; - GRPC_ALARM_UNREF(alarm, "dequeue-end-op"); -} - -static void alarm_cb(void* arg, grpc_error* error) { - grpc_alarm* alarm = (grpc_alarm*)arg; - - /* We are queuing an op on completion queue. This means, the alarm's structure - cannot be destroyed until the op is dequeued. Adding an extra ref - here and unref'ing when the op is dequeued will achieve this */ - GRPC_ALARM_REF(alarm, "queue-end-op"); - grpc_cq_end_op(alarm->cq, alarm->tag, error, alarm_end_completion, - (void*)alarm, &alarm->completion); -} - -grpc_alarm* grpc_alarm_create(void* reserved) { - grpc_alarm* alarm = (grpc_alarm*)gpr_malloc(sizeof(grpc_alarm)); - -#ifndef NDEBUG - if (grpc_trace_alarm_refcount.enabled()) { - gpr_log(GPR_DEBUG, "Alarm:%p created (ref: 1)", alarm); - } -#endif - - gpr_ref_init(&alarm->refs, 1); - grpc_timer_init_unset(&alarm->alarm); - alarm->cq = nullptr; - GRPC_CLOSURE_INIT(&alarm->on_alarm, alarm_cb, alarm, - grpc_schedule_on_exec_ctx); - return alarm; -} - -void grpc_alarm_set(grpc_alarm* alarm, grpc_completion_queue* cq, - gpr_timespec deadline, void* tag, void* reserved) { - grpc_core::ExecCtx exec_ctx; - - GRPC_CQ_INTERNAL_REF(cq, "alarm"); - alarm->cq = cq; - alarm->tag = tag; - - GPR_ASSERT(grpc_cq_begin_op(cq, tag)); - grpc_timer_init(&alarm->alarm, grpc_timespec_to_millis_round_up(deadline), - &alarm->on_alarm); -} - -void grpc_alarm_cancel(grpc_alarm* alarm, void* reserved) { - grpc_core::ExecCtx exec_ctx; - grpc_timer_cancel(&alarm->alarm); -} - -void grpc_alarm_destroy(grpc_alarm* alarm, void* reserved) { - grpc_alarm_cancel(alarm, reserved); - GRPC_ALARM_UNREF(alarm, "alarm_destroy"); -} diff --git a/src/core/lib/surface/alarm_internal.h b/src/core/lib/surface/alarm_internal.h deleted file mode 100644 index 99e981234d..0000000000 --- a/src/core/lib/surface/alarm_internal.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright 2015-2017 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_SURFACE_ALARM_INTERNAL_H -#define GRPC_CORE_LIB_SURFACE_ALARM_INTERNAL_H - -#include -#include "src/core/lib/debug/trace.h" - -extern grpc_core::DebugOnlyTraceFlag grpc_trace_alarm_refcount; - -#ifndef NDEBUG - -#define GRPC_ALARM_REF(a, reason) alarm_ref_dbg(a, reason, __FILE__, __LINE__) -#define GRPC_ALARM_UNREF(a, reason) \ - alarm_unref_dbg(a, reason, __FILE__, __LINE__) - -#else /* !defined(NDEBUG) */ - -#define GRPC_ALARM_REF(a, reason) alarm_ref(a) -#define GRPC_ALARM_UNREF(a, reason) alarm_unref(a) - -#endif /* defined(NDEBUG) */ - -#endif /* GRPC_CORE_LIB_SURFACE_ALARM_INTERNAL_H */ diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index 70329b09f4..89440d7a15 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -42,7 +42,6 @@ #include "src/core/lib/iomgr/timer_manager.h" #include "src/core/lib/profiling/timers.h" #include "src/core/lib/slice/slice_internal.h" -#include "src/core/lib/surface/alarm_internal.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/call.h" #include "src/core/lib/surface/channel_init.h" diff --git a/src/cpp/common/alarm.cc b/src/cpp/common/alarm.cc new file mode 100644 index 0000000000..a4c54ed8a3 --- /dev/null +++ b/src/cpp/common/alarm.cc @@ -0,0 +1,129 @@ +/* + * Copyright 2018 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 + +#include + +#include +#include +#include +#include +#include +#include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/iomgr/timer.h" +#include "src/core/lib/surface/completion_queue.h" + +#include +#include "src/core/lib/debug/trace.h" + +namespace grpc { + +namespace internal { +class AlarmImpl { + public: + AlarmImpl() : cq_(nullptr), tag_(nullptr) { + gpr_ref_init(&refs_, 1); + grpc_timer_init_unset(&timer_); + GRPC_CLOSURE_INIT(&on_alarm_, + [](void* arg, grpc_error* error) { + // queue the op on the completion queue + AlarmImpl* alarm = static_cast(arg); + alarm->Ref(); + grpc_cq_end_op( + alarm->cq_, &alarm->tag_, error, + [](void* arg, grpc_cq_completion* completion) { + AlarmImpl* alarm = static_cast(arg); + alarm->Unref(); + }, + arg, &alarm->completion_); + }, + this, grpc_schedule_on_exec_ctx); + } + ~AlarmImpl() { + grpc_core::ExecCtx exec_ctx; + if (cq_ != nullptr) { + GRPC_CQ_INTERNAL_UNREF(cq_, "alarm"); + } + } + void Set(CompletionQueue* cq, gpr_timespec deadline, void* tag) { + grpc_core::ExecCtx exec_ctx; + GRPC_CQ_INTERNAL_REF(cq->cq(), "alarm"); + cq_ = cq->cq(); + tag_.Set(tag); + GPR_ASSERT(grpc_cq_begin_op(cq_, &tag_)); + grpc_timer_init(&timer_, grpc_timespec_to_millis_round_up(deadline), + &on_alarm_); + } + void Cancel() { + grpc_core::ExecCtx exec_ctx; + grpc_timer_cancel(&timer_); + } + void Destroy() { + Cancel(); + Unref(); + } + + private: + class AlarmEntry : public internal::CompletionQueueTag { + public: + AlarmEntry(void* tag) : tag_(tag) {} + void Set(void* tag) { tag_ = tag; } + bool FinalizeResult(void** tag, bool* status) override { + *tag = tag_; + return true; + } + + private: + void* tag_; + }; + + void Ref() { gpr_ref(&refs_); } + void Unref() { + if (gpr_unref(&refs_)) { + delete this; + } + } + + grpc_timer timer_; + gpr_refcount refs_; + grpc_closure on_alarm_; + grpc_cq_completion completion_; + // completion queue where events about this alarm will be posted + grpc_completion_queue* cq_; + AlarmEntry tag_; +}; +} // namespace internal + +static internal::GrpcLibraryInitializer g_gli_initializer; + +Alarm::Alarm() : alarm_(new internal::AlarmImpl()) { + g_gli_initializer.summon(); +} + +void Alarm::SetInternal(CompletionQueue* cq, gpr_timespec deadline, void* tag) { + alarm_->Set(cq, deadline, tag); +} + +Alarm::~Alarm() { + if (alarm_ != nullptr) { + alarm_->Destroy(); + } +} + +void Alarm::Cancel() { alarm_->Cancel(); } +} // namespace grpc diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 9debb22249..1cea838df0 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -161,7 +161,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/slice/slice_hash_table.cc', 'src/core/lib/slice/slice_intern.cc', 'src/core/lib/slice/slice_string_helpers.cc', - 'src/core/lib/surface/alarm.cc', 'src/core/lib/surface/api_trace.cc', 'src/core/lib/surface/byte_buffer.cc', 'src/core/lib/surface/byte_buffer_reader.cc', diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 56f1d4c93f..40fc069580 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -51,10 +51,6 @@ grpc_completion_queue_shutdown_type grpc_completion_queue_shutdown_import; grpc_completion_queue_destroy_type grpc_completion_queue_destroy_import; grpc_completion_queue_thread_local_cache_init_type grpc_completion_queue_thread_local_cache_init_import; grpc_completion_queue_thread_local_cache_flush_type grpc_completion_queue_thread_local_cache_flush_import; -grpc_alarm_create_type grpc_alarm_create_import; -grpc_alarm_set_type grpc_alarm_set_import; -grpc_alarm_cancel_type grpc_alarm_cancel_import; -grpc_alarm_destroy_type grpc_alarm_destroy_import; grpc_channel_check_connectivity_state_type grpc_channel_check_connectivity_state_import; grpc_channel_num_external_connectivity_watchers_type grpc_channel_num_external_connectivity_watchers_import; grpc_channel_watch_connectivity_state_type grpc_channel_watch_connectivity_state_import; @@ -323,10 +319,6 @@ void grpc_rb_load_imports(HMODULE library) { grpc_completion_queue_destroy_import = (grpc_completion_queue_destroy_type) GetProcAddress(library, "grpc_completion_queue_destroy"); grpc_completion_queue_thread_local_cache_init_import = (grpc_completion_queue_thread_local_cache_init_type) GetProcAddress(library, "grpc_completion_queue_thread_local_cache_init"); grpc_completion_queue_thread_local_cache_flush_import = (grpc_completion_queue_thread_local_cache_flush_type) GetProcAddress(library, "grpc_completion_queue_thread_local_cache_flush"); - grpc_alarm_create_import = (grpc_alarm_create_type) GetProcAddress(library, "grpc_alarm_create"); - grpc_alarm_set_import = (grpc_alarm_set_type) GetProcAddress(library, "grpc_alarm_set"); - grpc_alarm_cancel_import = (grpc_alarm_cancel_type) GetProcAddress(library, "grpc_alarm_cancel"); - grpc_alarm_destroy_import = (grpc_alarm_destroy_type) GetProcAddress(library, "grpc_alarm_destroy"); grpc_channel_check_connectivity_state_import = (grpc_channel_check_connectivity_state_type) GetProcAddress(library, "grpc_channel_check_connectivity_state"); grpc_channel_num_external_connectivity_watchers_import = (grpc_channel_num_external_connectivity_watchers_type) GetProcAddress(library, "grpc_channel_num_external_connectivity_watchers"); grpc_channel_watch_connectivity_state_import = (grpc_channel_watch_connectivity_state_type) GetProcAddress(library, "grpc_channel_watch_connectivity_state"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 6377008a3b..b18827fd19 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -132,18 +132,6 @@ extern grpc_completion_queue_thread_local_cache_init_type grpc_completion_queue_ typedef int(*grpc_completion_queue_thread_local_cache_flush_type)(grpc_completion_queue* cq, void** tag, int* ok); extern grpc_completion_queue_thread_local_cache_flush_type grpc_completion_queue_thread_local_cache_flush_import; #define grpc_completion_queue_thread_local_cache_flush grpc_completion_queue_thread_local_cache_flush_import -typedef grpc_alarm*(*grpc_alarm_create_type)(void* reserved); -extern grpc_alarm_create_type grpc_alarm_create_import; -#define grpc_alarm_create grpc_alarm_create_import -typedef void(*grpc_alarm_set_type)(grpc_alarm* alarm, grpc_completion_queue* cq, gpr_timespec deadline, void* tag, void* reserved); -extern grpc_alarm_set_type grpc_alarm_set_import; -#define grpc_alarm_set grpc_alarm_set_import -typedef void(*grpc_alarm_cancel_type)(grpc_alarm* alarm, void* reserved); -extern grpc_alarm_cancel_type grpc_alarm_cancel_import; -#define grpc_alarm_cancel grpc_alarm_cancel_import -typedef void(*grpc_alarm_destroy_type)(grpc_alarm* alarm, void* reserved); -extern grpc_alarm_destroy_type grpc_alarm_destroy_import; -#define grpc_alarm_destroy grpc_alarm_destroy_import typedef grpc_connectivity_state(*grpc_channel_check_connectivity_state_type)(grpc_channel* channel, int try_to_connect); extern grpc_channel_check_connectivity_state_type grpc_channel_check_connectivity_state_import; #define grpc_channel_check_connectivity_state grpc_channel_check_connectivity_state_import diff --git a/test/core/surface/BUILD b/test/core/surface/BUILD index 6cec7feabc..d27123d1a3 100644 --- a/test/core/surface/BUILD +++ b/test/core/surface/BUILD @@ -18,18 +18,6 @@ licenses(["notice"]) # Apache v2 grpc_package(name = "test/core/surface") -grpc_cc_test( - name = "alarm_test", - srcs = ["alarm_test.cc"], - language = "C++", - deps = [ - "//:gpr", - "//:grpc", - "//test/core/util:gpr_test_util", - "//test/core/util:grpc_test_util", - ], -) - grpc_cc_test( name = "grpc_byte_buffer_reader_test", srcs = ["byte_buffer_reader_test.cc"], diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index 7fd36a241a..bedfcceea6 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -95,10 +95,6 @@ int main(int argc, char **argv) { printf("%lx", (unsigned long) grpc_completion_queue_destroy); printf("%lx", (unsigned long) grpc_completion_queue_thread_local_cache_init); printf("%lx", (unsigned long) grpc_completion_queue_thread_local_cache_flush); - printf("%lx", (unsigned long) grpc_alarm_create); - printf("%lx", (unsigned long) grpc_alarm_set); - printf("%lx", (unsigned long) grpc_alarm_cancel); - printf("%lx", (unsigned long) grpc_alarm_destroy); printf("%lx", (unsigned long) grpc_channel_check_connectivity_state); printf("%lx", (unsigned long) grpc_channel_num_external_connectivity_watchers); printf("%lx", (unsigned long) grpc_channel_watch_connectivity_state); diff --git a/test/cpp/common/BUILD b/test/cpp/common/BUILD index e2b6365b13..2cf3ad669f 100644 --- a/test/cpp/common/BUILD +++ b/test/cpp/common/BUILD @@ -19,8 +19,8 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package") grpc_package(name = "test/cpp/common") grpc_cc_test( - name = "alarm_cpp_test", - srcs = ["alarm_cpp_test.cc"], + name = "alarm_test", + srcs = ["alarm_test.cc"], deps = [ "//:grpc++_unsecure", "//test/core/util:gpr_test_util", diff --git a/test/cpp/common/alarm_cpp_test.cc b/test/cpp/common/alarm_cpp_test.cc deleted file mode 100644 index 7adc3102f4..0000000000 --- a/test/cpp/common/alarm_cpp_test.cc +++ /dev/null @@ -1,192 +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 -#include -#include - -#include - -#include "test/core/util/test_config.h" - -namespace grpc { -namespace { - -TEST(AlarmTest, RegularExpiry) { - CompletionQueue cq; - void* junk = reinterpret_cast(1618033); - Alarm alarm; - alarm.Set(&cq, grpc_timeout_seconds_to_deadline(1), junk); - - void* output_tag; - bool ok; - const CompletionQueue::NextStatus status = cq.AsyncNext( - (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); - - EXPECT_EQ(status, CompletionQueue::GOT_EVENT); - EXPECT_TRUE(ok); - EXPECT_EQ(junk, output_tag); -} - -TEST(AlarmTest, MultithreadedRegularExpiry) { - CompletionQueue cq; - void* junk = reinterpret_cast(1618033); - void* output_tag; - bool ok; - CompletionQueue::NextStatus status; - Alarm alarm; - - std::thread t1([&alarm, &cq, &junk] { - alarm.Set(&cq, grpc_timeout_seconds_to_deadline(1), junk); - }); - - std::thread t2([&cq, &ok, &output_tag, &status] { - status = cq.AsyncNext((void**)&output_tag, &ok, - grpc_timeout_seconds_to_deadline(2)); - }); - - t1.join(); - t2.join(); - EXPECT_EQ(status, CompletionQueue::GOT_EVENT); - EXPECT_TRUE(ok); - EXPECT_EQ(junk, output_tag); -} - -TEST(AlarmTest, DeprecatedRegularExpiry) { - CompletionQueue cq; - void* junk = reinterpret_cast(1618033); - Alarm alarm(&cq, grpc_timeout_seconds_to_deadline(1), junk); - - void* output_tag; - bool ok; - const CompletionQueue::NextStatus status = cq.AsyncNext( - (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); - - EXPECT_EQ(status, CompletionQueue::GOT_EVENT); - EXPECT_TRUE(ok); - EXPECT_EQ(junk, output_tag); -} - -TEST(AlarmTest, MoveConstructor) { - CompletionQueue cq; - void* junk = reinterpret_cast(1618033); - Alarm first; - first.Set(&cq, grpc_timeout_seconds_to_deadline(1), junk); - Alarm second(std::move(first)); - void* output_tag; - bool ok; - const CompletionQueue::NextStatus status = cq.AsyncNext( - (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); - EXPECT_EQ(status, CompletionQueue::GOT_EVENT); - EXPECT_TRUE(ok); - EXPECT_EQ(junk, output_tag); -} - -TEST(AlarmTest, MoveAssignment) { - CompletionQueue cq; - void* junk = reinterpret_cast(1618033); - Alarm first; - first.Set(&cq, grpc_timeout_seconds_to_deadline(1), junk); - Alarm second(std::move(first)); - first = std::move(second); - - void* output_tag; - bool ok; - const CompletionQueue::NextStatus status = cq.AsyncNext( - (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); - - EXPECT_EQ(status, CompletionQueue::GOT_EVENT); - EXPECT_TRUE(ok); - EXPECT_EQ(junk, output_tag); -} - -TEST(AlarmTest, RegularExpiryChrono) { - CompletionQueue cq; - void* junk = reinterpret_cast(1618033); - std::chrono::system_clock::time_point one_sec_deadline = - std::chrono::system_clock::now() + std::chrono::seconds(1); - Alarm alarm; - alarm.Set(&cq, one_sec_deadline, junk); - - void* output_tag; - bool ok; - const CompletionQueue::NextStatus status = cq.AsyncNext( - (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); - - EXPECT_EQ(status, CompletionQueue::GOT_EVENT); - EXPECT_TRUE(ok); - EXPECT_EQ(junk, output_tag); -} - -TEST(AlarmTest, ZeroExpiry) { - CompletionQueue cq; - void* junk = reinterpret_cast(1618033); - Alarm alarm; - alarm.Set(&cq, grpc_timeout_seconds_to_deadline(0), junk); - - void* output_tag; - bool ok; - const CompletionQueue::NextStatus status = cq.AsyncNext( - (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(1)); - - EXPECT_EQ(status, CompletionQueue::GOT_EVENT); - EXPECT_TRUE(ok); - EXPECT_EQ(junk, output_tag); -} - -TEST(AlarmTest, NegativeExpiry) { - CompletionQueue cq; - void* junk = reinterpret_cast(1618033); - Alarm alarm; - alarm.Set(&cq, grpc_timeout_seconds_to_deadline(-1), junk); - - void* output_tag; - bool ok; - const CompletionQueue::NextStatus status = cq.AsyncNext( - (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(1)); - - EXPECT_EQ(status, CompletionQueue::GOT_EVENT); - EXPECT_TRUE(ok); - EXPECT_EQ(junk, output_tag); -} - -TEST(AlarmTest, Cancellation) { - CompletionQueue cq; - void* junk = reinterpret_cast(1618033); - Alarm alarm; - alarm.Set(&cq, grpc_timeout_seconds_to_deadline(2), junk); - alarm.Cancel(); - - void* output_tag; - bool ok; - const CompletionQueue::NextStatus status = cq.AsyncNext( - (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(1)); - - EXPECT_EQ(status, CompletionQueue::GOT_EVENT); - EXPECT_FALSE(ok); - EXPECT_EQ(junk, output_tag); -} - -} // namespace -} // namespace grpc - -int main(int argc, char** argv) { - grpc_test_init(argc, argv); - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/cpp/common/alarm_test.cc b/test/cpp/common/alarm_test.cc new file mode 100644 index 0000000000..7adc3102f4 --- /dev/null +++ b/test/cpp/common/alarm_test.cc @@ -0,0 +1,192 @@ +/* + * + * 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 +#include +#include + +#include + +#include "test/core/util/test_config.h" + +namespace grpc { +namespace { + +TEST(AlarmTest, RegularExpiry) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm alarm; + alarm.Set(&cq, grpc_timeout_seconds_to_deadline(1), junk); + + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); + + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, MultithreadedRegularExpiry) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + void* output_tag; + bool ok; + CompletionQueue::NextStatus status; + Alarm alarm; + + std::thread t1([&alarm, &cq, &junk] { + alarm.Set(&cq, grpc_timeout_seconds_to_deadline(1), junk); + }); + + std::thread t2([&cq, &ok, &output_tag, &status] { + status = cq.AsyncNext((void**)&output_tag, &ok, + grpc_timeout_seconds_to_deadline(2)); + }); + + t1.join(); + t2.join(); + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, DeprecatedRegularExpiry) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm alarm(&cq, grpc_timeout_seconds_to_deadline(1), junk); + + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); + + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, MoveConstructor) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm first; + first.Set(&cq, grpc_timeout_seconds_to_deadline(1), junk); + Alarm second(std::move(first)); + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, MoveAssignment) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm first; + first.Set(&cq, grpc_timeout_seconds_to_deadline(1), junk); + Alarm second(std::move(first)); + first = std::move(second); + + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); + + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, RegularExpiryChrono) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + std::chrono::system_clock::time_point one_sec_deadline = + std::chrono::system_clock::now() + std::chrono::seconds(1); + Alarm alarm; + alarm.Set(&cq, one_sec_deadline, junk); + + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(2)); + + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, ZeroExpiry) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm alarm; + alarm.Set(&cq, grpc_timeout_seconds_to_deadline(0), junk); + + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(1)); + + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, NegativeExpiry) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm alarm; + alarm.Set(&cq, grpc_timeout_seconds_to_deadline(-1), junk); + + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(1)); + + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_TRUE(ok); + EXPECT_EQ(junk, output_tag); +} + +TEST(AlarmTest, Cancellation) { + CompletionQueue cq; + void* junk = reinterpret_cast(1618033); + Alarm alarm; + alarm.Set(&cq, grpc_timeout_seconds_to_deadline(2), junk); + alarm.Cancel(); + + void* output_tag; + bool ok; + const CompletionQueue::NextStatus status = cq.AsyncNext( + (void**)&output_tag, &ok, grpc_timeout_seconds_to_deadline(1)); + + EXPECT_EQ(status, CompletionQueue::GOT_EVENT); + EXPECT_FALSE(ok); + EXPECT_EQ(junk, output_tag); +} + +} // namespace +} // namespace grpc + +int main(int argc, char** argv) { + grpc_test_init(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 1165dc6897..04c1acbbc7 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1048,7 +1048,6 @@ src/core/lib/slice/percent_encoding.h \ src/core/lib/slice/slice_hash_table.h \ src/core/lib/slice/slice_internal.h \ src/core/lib/slice/slice_string_helpers.h \ -src/core/lib/surface/alarm_internal.h \ src/core/lib/surface/api_trace.h \ src/core/lib/surface/call.h \ src/core/lib/surface/call_test_only.h \ @@ -1089,6 +1088,7 @@ src/cpp/client/insecure_credentials.cc \ src/cpp/client/secure_credentials.cc \ src/cpp/client/secure_credentials.h \ src/cpp/codegen/codegen_init.cc \ +src/cpp/common/alarm.cc \ src/cpp/common/auth_property_iterator.cc \ src/cpp/common/channel_arguments.cc \ src/cpp/common/channel_filter.cc \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index f3e624ba72..861ef5b669 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1338,8 +1338,6 @@ src/core/lib/slice/slice_internal.h \ src/core/lib/slice/slice_string_helpers.cc \ src/core/lib/slice/slice_string_helpers.h \ src/core/lib/surface/README.md \ -src/core/lib/surface/alarm.cc \ -src/core/lib/surface/alarm_internal.h \ src/core/lib/surface/api_trace.cc \ src/core/lib/surface/api_trace.h \ src/core/lib/surface/byte_buffer.cc \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 362effd7d2..f63bae9903 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -1,23 +1,6 @@ [ - { - "deps": [ - "gpr", - "gpr_test_util", - "grpc", - "grpc_test_util" - ], - "headers": [], - "is_filegroup": false, - "language": "c", - "name": "alarm_test", - "src": [ - "test/core/surface/alarm_test.cc" - ], - "third_party": false, - "type": "target" - }, { "deps": [ "gpr", @@ -2435,9 +2418,9 @@ "headers": [], "is_filegroup": false, "language": "c++", - "name": "alarm_cpp_test", + "name": "alarm_test", "src": [ - "test/cpp/common/alarm_cpp_test.cc" + "test/cpp/common/alarm_test.cc" ], "third_party": false, "type": "target" @@ -8158,7 +8141,6 @@ "src/core/lib/slice/slice_hash_table.cc", "src/core/lib/slice/slice_intern.cc", "src/core/lib/slice/slice_string_helpers.cc", - "src/core/lib/surface/alarm.cc", "src/core/lib/surface/api_trace.cc", "src/core/lib/surface/byte_buffer.cc", "src/core/lib/surface/byte_buffer_reader.cc", @@ -8309,7 +8291,6 @@ "src/core/lib/slice/slice_hash_table.h", "src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_string_helpers.h", - "src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/api_trace.h", "src/core/lib/surface/call.h", "src/core/lib/surface/call_test_only.h", @@ -8450,7 +8431,6 @@ "src/core/lib/slice/slice_hash_table.h", "src/core/lib/slice/slice_internal.h", "src/core/lib/slice/slice_string_helpers.h", - "src/core/lib/surface/alarm_internal.h", "src/core/lib/surface/api_trace.h", "src/core/lib/surface/call.h", "src/core/lib/surface/call_test_only.h", @@ -9702,6 +9682,7 @@ "src/cpp/client/create_channel_posix.cc", "src/cpp/client/credentials_cc.cc", "src/cpp/client/generic_stub.cc", + "src/cpp/common/alarm.cc", "src/cpp/common/channel_arguments.cc", "src/cpp/common/channel_filter.cc", "src/cpp/common/channel_filter.h", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 7b23cab506..9e5d647f71 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -1,30 +1,6 @@ [ - { - "args": [], - "benchmark": false, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 0.1, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": false, - "language": "c", - "name": "alarm_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "uses_polling": true - }, { "args": [], "benchmark": false, @@ -2878,7 +2854,7 @@ "flaky": false, "gtest": true, "language": "c++", - "name": "alarm_cpp_test", + "name": "alarm_test", "platforms": [ "linux", "mac", -- cgit v1.2.3