diff --git a/BUILD b/BUILD index 894186b35f2..4d04c8d518e 100644 --- a/BUILD +++ b/BUILD @@ -823,6 +823,7 @@ grpc_cc_library( "avoid_dep", "nofixdeps", ], + visibility = ["@grpc:gpr_public_hdrs"], ) grpc_cc_library( @@ -885,6 +886,7 @@ grpc_cc_library( "avoid_dep", "nofixdeps", ], + visibility = ["@grpc:grpc_public_hdrs"], deps = [ "channel_arg_names", "gpr_public_hdrs", @@ -895,6 +897,7 @@ grpc_cc_library( name = "grpc++_public_hdrs", hdrs = GRPCXX_PUBLIC_HDRS, external_deps = [ + "absl/log:check", "absl/strings:cord", "absl/synchronization", "protobuf_headers", @@ -904,7 +907,7 @@ grpc_cc_library( "avoid_dep", "nofixdeps", ], - visibility = ["@grpc:public"], + visibility = ["@grpc:grpc++_public_hdrs"], deps = [ "grpc_public_hdrs", "//src/core:gpr_atm", @@ -1348,14 +1351,14 @@ grpc_cc_library( grpc_cc_library( name = "channelz", srcs = [ - "//src/core:lib/channel/channel_trace.cc", - "//src/core:lib/channel/channelz.cc", - "//src/core:lib/channel/channelz_registry.cc", + "//src/core:channelz/channel_trace.cc", + "//src/core:channelz/channelz.cc", + "//src/core:channelz/channelz_registry.cc", ], hdrs = [ - "//src/core:lib/channel/channel_trace.h", - "//src/core:lib/channel/channelz.h", - "//src/core:lib/channel/channelz_registry.h", + "//src/core:channelz/channel_trace.h", + "//src/core:channelz/channelz.h", + "//src/core:channelz/channelz_registry.h", ], external_deps = [ "absl/base:core_headers", @@ -1796,7 +1799,7 @@ grpc_cc_library( "ref_counted_ptr", "stats", "//src/core:arena", - "//src/core:call_size_estimator", + "//src/core:call_arena_allocator", "//src/core:channel_args", "//src/core:channel_fwd", "//src/core:channel_init", @@ -3532,7 +3535,6 @@ grpc_cc_library( "xds_orca_service_upb", "xds_orca_upb", "//src/core:backend_metric_parser", - "//src/core:client_channel_channelz", "//src/core:closure", "//src/core:error", "//src/core:grpc_backend_metric_data", @@ -3666,7 +3668,6 @@ grpc_cc_library( "//src/core:channel_init", "//src/core:channel_stack_type", "//src/core:client_channel_backup_poller", - "//src/core:client_channel_channelz", "//src/core:client_channel_internal_header", "//src/core:client_channel_service_config", "//src/core:closure", diff --git a/CMakeLists.txt b/CMakeLists.txt index bce2fd580fe..5c077beadd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,6 +109,7 @@ set(gRPC_ABSL_USED_TARGETS absl_bind_front absl_bits absl_charset + absl_check absl_city absl_civil_time absl_cleanup @@ -169,6 +170,8 @@ set(gRPC_ABSL_USED_TARGETS absl_log_entry absl_log_globals absl_log_internal_append_truncated + absl_log_internal_check_impl + absl_log_internal_check_op absl_log_internal_conditions absl_log_internal_config absl_log_internal_fnmatch @@ -1169,6 +1172,7 @@ if(gRPC_BUILD_TESTS) add_dependencies(buildtests_cxx insecure_security_connector_test) add_dependencies(buildtests_cxx inter_activity_latch_test) add_dependencies(buildtests_cxx inter_activity_pipe_test) + add_dependencies(buildtests_cxx interception_chain_test) add_dependencies(buildtests_cxx interceptor_list_test) add_dependencies(buildtests_cxx interop_client) add_dependencies(buildtests_cxx interop_server) @@ -1448,7 +1452,7 @@ if(gRPC_BUILD_TESTS) add_dependencies(buildtests_cxx tcp_server_posix_test) endif() add_dependencies(buildtests_cxx tcp_socket_utils_test) - add_dependencies(buildtests_cxx test_core_channel_channelz_test) + add_dependencies(buildtests_cxx test_core_channelz_channelz_test) add_dependencies(buildtests_cxx test_core_end2end_channelz_test) add_dependencies(buildtests_cxx test_core_event_engine_posix_timer_heap_test) add_dependencies(buildtests_cxx test_core_event_engine_posix_timer_list_test) @@ -1819,8 +1823,10 @@ endif() add_library(grpc + src/core/channelz/channel_trace.cc + src/core/channelz/channelz.cc + src/core/channelz/channelz_registry.cc src/core/client_channel/backup_poller.cc - src/core/client_channel/client_channel_channelz.cc src/core/client_channel/client_channel_factory.cc src/core/client_channel/client_channel_filter.cc src/core/client_channel/client_channel_plugin.cc @@ -2245,9 +2251,6 @@ add_library(grpc src/core/lib/channel/channel_stack_builder.cc src/core/lib/channel/channel_stack_builder_impl.cc src/core/lib/channel/channel_stack_trace.cc - src/core/lib/channel/channel_trace.cc - src/core/lib/channel/channelz.cc - src/core/lib/channel/channelz_registry.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/metrics.cc src/core/lib/channel/promise_based_filter.cc @@ -2515,9 +2518,9 @@ add_library(grpc src/core/lib/surface/wait_for_cq_end_op.cc src/core/lib/transport/batch_builder.cc src/core/lib/transport/bdp_estimator.cc + src/core/lib/transport/call_arena_allocator.cc src/core/lib/transport/call_filters.cc src/core/lib/transport/call_final_info.cc - src/core/lib/transport/call_size_estimator.cc src/core/lib/transport/call_spine.cc src/core/lib/transport/connectivity_state.cc src/core/lib/transport/endpoint_info_handshaker.cc @@ -2841,6 +2844,7 @@ target_link_libraries(grpc_test_util absl::failure_signal_handler absl::stacktrace absl::symbolize + absl::check grpc ) if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) @@ -2906,6 +2910,7 @@ target_link_libraries(grpc_test_util_unsecure absl::failure_signal_handler absl::stacktrace absl::symbolize + absl::check grpc_unsecure ) if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) @@ -2916,8 +2921,10 @@ endif() endif() add_library(grpc_unsecure + src/core/channelz/channel_trace.cc + src/core/channelz/channelz.cc + src/core/channelz/channelz_registry.cc src/core/client_channel/backup_poller.cc - src/core/client_channel/client_channel_channelz.cc src/core/client_channel/client_channel_factory.cc src/core/client_channel/client_channel_filter.cc src/core/client_channel/client_channel_plugin.cc @@ -3011,9 +3018,6 @@ add_library(grpc_unsecure src/core/lib/channel/channel_stack_builder.cc src/core/lib/channel/channel_stack_builder_impl.cc src/core/lib/channel/channel_stack_trace.cc - src/core/lib/channel/channel_trace.cc - src/core/lib/channel/channelz.cc - src/core/lib/channel/channelz_registry.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/metrics.cc src/core/lib/channel/promise_based_filter.cc @@ -3242,9 +3246,9 @@ add_library(grpc_unsecure src/core/lib/surface/wait_for_cq_end_op.cc src/core/lib/transport/batch_builder.cc src/core/lib/transport/bdp_estimator.cc + src/core/lib/transport/call_arena_allocator.cc src/core/lib/transport/call_filters.cc src/core/lib/transport/call_final_info.cc - src/core/lib/transport/call_size_estimator.cc src/core/lib/transport/call_spine.cc src/core/lib/transport/connectivity_state.cc src/core/lib/transport/endpoint_info_handshaker.cc @@ -4022,7 +4026,6 @@ target_include_directories(benchmark_helpers ) target_link_libraries(benchmark_helpers ${_gRPC_ALLTARGETS_LIBRARIES} - absl::check ${_gRPC_BENCHMARK_LIBRARIES} grpc++_unsecure grpc_test_util_unsecure @@ -4146,6 +4149,7 @@ target_include_directories(grpc++ ) target_link_libraries(grpc++ ${_gRPC_ALLTARGETS_LIBRARIES} + absl::check grpc ${_gRPC_PROTOBUF_LIBRARIES} ) @@ -4887,6 +4891,7 @@ target_include_directories(grpc++_unsecure ) target_link_libraries(grpc++_unsecure ${_gRPC_ALLTARGETS_LIBRARIES} + absl::check grpc_unsecure ${_gRPC_PROTOBUF_LIBRARIES} ) @@ -5113,6 +5118,9 @@ endif() add_library(grpc_authorization_provider + src/core/channelz/channel_trace.cc + src/core/channelz/channelz.cc + src/core/channelz/channelz_registry.cc src/core/ext/upb-gen/google/protobuf/any.upb_minitable.c src/core/ext/upb-gen/google/rpc/status.upb_minitable.c src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb_minitable.c @@ -5128,9 +5136,6 @@ add_library(grpc_authorization_provider src/core/lib/channel/channel_stack_builder.cc src/core/lib/channel/channel_stack_builder_impl.cc src/core/lib/channel/channel_stack_trace.cc - src/core/lib/channel/channel_trace.cc - src/core/lib/channel/channelz.cc - src/core/lib/channel/channelz_registry.cc src/core/lib/channel/connected_channel.cc src/core/lib/channel/metrics.cc src/core/lib/channel/promise_based_filter.cc @@ -5351,6 +5356,7 @@ add_library(grpc_authorization_provider src/core/lib/surface/version.cc src/core/lib/surface/wait_for_cq_end_op.cc src/core/lib/transport/batch_builder.cc + src/core/lib/transport/call_arena_allocator.cc src/core/lib/transport/call_filters.cc src/core/lib/transport/call_final_info.cc src/core/lib/transport/call_spine.cc @@ -5814,6 +5820,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(fd_conservation_posix_test ${_gRPC_ALLTARGETS_LIBRARIES} + absl::check grpc_test_util ) @@ -5899,7 +5906,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) add_executable(static_stride_scheduler_benchmark src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc - test/core/client_channel/lb_policy/static_stride_scheduler_benchmark.cc + test/core/load_balancing/static_stride_scheduler_benchmark.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -6127,6 +6134,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(address_sorting_test_unsecure ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc++_unsecure grpc_test_util_unsecure grpc++_test_config @@ -6608,7 +6616,6 @@ target_include_directories(alts_frame_protector_test target_link_libraries(alts_frame_protector_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -7113,7 +7120,6 @@ target_include_directories(async_end2end_test target_link_libraries(async_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -7456,7 +7462,6 @@ target_include_directories(backend_metrics_lb_policy_test target_link_libraries(backend_metrics_lb_policy_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++ grpc_test_util grpc++_test_config @@ -7562,7 +7567,6 @@ target_include_directories(bad_ping_test target_link_libraries(bad_ping_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -7764,7 +7768,6 @@ target_include_directories(bad_streaming_id_bad_client_test target_link_libraries(bad_streaming_id_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -7809,7 +7812,6 @@ target_include_directories(badreq_bad_client_test target_link_libraries(badreq_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -8041,7 +8043,6 @@ target_include_directories(binary_metadata_test target_link_libraries(binary_metadata_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -8052,7 +8053,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(binder_resolver_test - test/core/client_channel/resolvers/binder_resolver_test.cc + test/core/resolver/binder_resolver_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -8147,7 +8148,6 @@ target_include_directories(binder_server_test target_link_libraries(binder_server_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -8339,6 +8339,7 @@ target_include_directories(buffer_list_test target_link_libraries(buffer_list_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc_test_util ) @@ -8485,7 +8486,6 @@ target_include_directories(call_creds_test target_link_libraries(call_creds_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -8691,7 +8691,6 @@ target_include_directories(call_host_override_test target_link_libraries(call_host_override_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -8798,7 +8797,6 @@ target_include_directories(cancel_after_accept_test target_link_libraries(cancel_after_accept_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -8862,7 +8860,6 @@ target_include_directories(cancel_after_client_done_test target_link_libraries(cancel_after_client_done_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -8926,7 +8923,6 @@ target_include_directories(cancel_after_invoke_test target_link_libraries(cancel_after_invoke_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -8990,7 +8986,6 @@ target_include_directories(cancel_after_round_trip_test target_link_libraries(cancel_after_round_trip_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -9101,7 +9096,6 @@ target_include_directories(cancel_before_invoke_test target_link_libraries(cancel_before_invoke_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -9207,7 +9201,6 @@ target_include_directories(cancel_in_a_vacuum_test target_link_libraries(cancel_in_a_vacuum_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -9271,7 +9264,6 @@ target_include_directories(cancel_with_status_test target_link_libraries(cancel_with_status_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -9541,7 +9533,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(cf_engine_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -9591,7 +9582,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(cf_event_engine_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -9653,7 +9643,6 @@ target_include_directories(cfstream_test target_link_libraries(cfstream_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -9929,7 +9918,7 @@ add_executable(channel_trace_test ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.h - test/core/channel/channel_trace_test.cc + test/core/channelz/channel_trace_test.cc test/cpp/util/channel_trace_proto_helper.cc ) if(WIN32 AND MSVC) @@ -9974,7 +9963,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(channelz_registry_test - test/core/channel/channelz_registry_test.cc + test/core/channelz/channelz_registry_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -10071,7 +10060,6 @@ target_include_directories(channelz_service_test target_link_libraries(channelz_service_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpcpp_channelz grpc++_test_util ) @@ -10377,7 +10365,6 @@ target_include_directories(client_auth_filter_test target_link_libraries(client_auth_filter_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -10427,7 +10414,6 @@ target_include_directories(client_authority_filter_test target_link_libraries(client_authority_filter_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -10490,7 +10476,6 @@ target_include_directories(client_callback_end2end_test target_link_libraries(client_callback_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -10746,7 +10731,6 @@ target_include_directories(client_interceptors_end2end_test target_link_libraries(client_interceptors_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -10819,7 +10803,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(client_lb_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -10926,7 +10909,6 @@ target_include_directories(client_streaming_test target_link_libraries(client_streaming_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -11266,7 +11248,6 @@ target_include_directories(compressed_payload_test target_link_libraries(compressed_payload_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -11397,7 +11378,6 @@ target_include_directories(connection_prefix_bad_client_test target_link_libraries(connection_prefix_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -11553,7 +11533,6 @@ target_include_directories(connectivity_test target_link_libraries(connectivity_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -11616,7 +11595,6 @@ target_include_directories(context_allocator_end2end_test target_link_libraries(context_allocator_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -11836,7 +11814,6 @@ target_include_directories(crl_provider_test target_link_libraries(crl_provider_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -11881,7 +11858,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(crl_ssl_transport_security_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -11986,7 +11962,6 @@ target_include_directories(default_host_test target_link_libraries(default_host_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -12049,7 +12024,6 @@ target_include_directories(delegating_channel_test target_link_libraries(delegating_channel_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -12196,7 +12170,6 @@ target_include_directories(disappearing_server_test target_link_libraries(disappearing_server_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -12207,7 +12180,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(dns_resolver_cooldown_test - test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc + test/core/resolver/dns_resolver_cooldown_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -12249,7 +12222,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(dns_resolver_test - test/core/client_channel/resolvers/dns_resolver_test.cc + test/core/resolver/dns_resolver_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -12456,7 +12429,6 @@ target_include_directories(duplicate_header_bad_client_test target_link_libraries(duplicate_header_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -12518,7 +12490,6 @@ target_include_directories(empty_batch_test target_link_libraries(empty_batch_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -12584,7 +12555,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) target_link_libraries(end2end_binder_transport_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -12650,7 +12620,6 @@ target_include_directories(end2end_test target_link_libraries(end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} - absl::check grpc++_test grpc++_test_util ) @@ -12904,6 +12873,7 @@ target_include_directories(endpoint_pair_test target_link_libraries(endpoint_pair_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc_test_util ) @@ -13054,6 +13024,7 @@ target_include_directories(error_test target_link_libraries(error_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc_test_util ) @@ -13668,7 +13639,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(fake_resolver_test - test/core/client_channel/resolvers/fake_resolver_test.cc + test/core/resolver/fake_resolver_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -13745,7 +13716,6 @@ target_include_directories(fake_transport_security_test target_link_libraries(fake_transport_security_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -13902,7 +13872,6 @@ target_include_directories(filter_causes_close_test target_link_libraries(filter_causes_close_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -13966,7 +13935,6 @@ target_include_directories(filter_context_test target_link_libraries(filter_context_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -14030,7 +13998,6 @@ target_include_directories(filter_init_fails_test target_link_libraries(filter_init_fails_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -14081,7 +14048,6 @@ target_include_directories(filter_test_test target_link_libraries(filter_test_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_unsecure ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util @@ -14145,7 +14111,6 @@ target_include_directories(filtered_metadata_test target_link_libraries(filtered_metadata_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -14208,7 +14173,6 @@ target_include_directories(flaky_network_test target_link_libraries(flaky_network_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -14672,7 +14636,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) target_link_libraries(fuzzing_event_engine_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -14722,7 +14685,6 @@ target_include_directories(fuzzing_event_engine_unittest target_link_libraries(fuzzing_event_engine_unittest ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -14838,7 +14800,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(google_c2p_resolver_test - test/core/client_channel/resolvers/google_c2p_resolver_test.cc + test/core/resolver/google_c2p_resolver_test.cc test/core/util/fake_udp_and_tcp_server.cc ) if(WIN32 AND MSVC) @@ -14935,7 +14897,6 @@ target_include_directories(graceful_server_shutdown_test target_link_libraries(graceful_server_shutdown_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -14981,7 +14942,6 @@ target_include_directories(graceful_shutdown_test target_link_libraries(graceful_shutdown_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -15241,7 +15201,6 @@ target_include_directories(grpc_authz_end2end_test target_link_libraries(grpc_authz_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc++_test_util ) @@ -15304,7 +15263,6 @@ target_include_directories(grpc_authz_test target_link_libraries(grpc_authz_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -16066,7 +16024,6 @@ target_include_directories(grpc_tls_crl_provider_test target_link_libraries(grpc_tls_crl_provider_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -16185,7 +16142,6 @@ target_include_directories(grpclb_api_test target_link_libraries(grpclb_api_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -16255,7 +16211,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(grpclb_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_config grpc++_test_util ) @@ -16308,7 +16263,6 @@ target_include_directories(h2_ssl_cert_test target_link_libraries(h2_ssl_cert_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -16526,7 +16480,6 @@ target_include_directories(head_of_line_blocking_bad_client_test target_link_libraries(head_of_line_blocking_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -16571,7 +16524,6 @@ target_include_directories(headers_bad_client_test target_link_libraries(headers_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -16641,7 +16593,6 @@ target_include_directories(health_service_end2end_test target_link_libraries(health_service_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -16703,7 +16654,6 @@ target_include_directories(high_initial_seqno_test target_link_libraries(high_initial_seqno_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -17013,7 +16963,6 @@ target_include_directories(hpack_size_test target_link_libraries(hpack_size_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -17066,7 +17015,6 @@ target_include_directories(http2_client target_link_libraries(http2_client ${_gRPC_ALLTARGETS_LIBRARIES} - absl::check grpc++_test_config grpc++_test_util ) @@ -17171,7 +17119,6 @@ target_include_directories(http2_stats_test target_link_libraries(http2_stats_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -17182,7 +17129,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(http_proxy_mapper_test - test/core/client_channel/http_proxy_mapper_test.cc + test/core/handshake/http_proxy_mapper_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -17374,7 +17321,6 @@ target_include_directories(hybrid_end2end_test target_link_libraries(hybrid_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -17569,7 +17515,6 @@ target_include_directories(initial_settings_frame_bad_client_test target_link_libraries(initial_settings_frame_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -17625,7 +17570,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) target_link_libraries(inproc_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -17773,6 +17717,307 @@ target_link_libraries(inter_activity_pipe_test ) +endif() +if(gRPC_BUILD_TESTS) + +add_executable(interception_chain_test + src/core/channelz/channel_trace.cc + src/core/channelz/channelz.cc + src/core/channelz/channelz_registry.cc + src/core/ext/upb-gen/google/protobuf/any.upb_minitable.c + src/core/ext/upb-gen/google/rpc/status.upb_minitable.c + src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb_minitable.c + src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c + src/core/ext/upb-gen/src/proto/grpc/gcp/transport_security_common.upb_minitable.c + src/core/lib/address_utils/parse_address.cc + src/core/lib/address_utils/sockaddr_utils.cc + src/core/lib/backoff/backoff.cc + src/core/lib/channel/call_tracer.cc + src/core/lib/channel/channel_args.cc + src/core/lib/channel/channel_args_preconditioning.cc + src/core/lib/channel/channel_stack.cc + src/core/lib/channel/channel_stack_builder.cc + src/core/lib/channel/channel_stack_builder_impl.cc + src/core/lib/channel/channel_stack_trace.cc + src/core/lib/channel/connected_channel.cc + src/core/lib/channel/metrics.cc + src/core/lib/channel/promise_based_filter.cc + src/core/lib/channel/status_util.cc + src/core/lib/compression/compression.cc + src/core/lib/compression/compression_internal.cc + src/core/lib/compression/message_compress.cc + src/core/lib/config/core_configuration.cc + src/core/lib/debug/event_log.cc + src/core/lib/debug/histogram_view.cc + src/core/lib/debug/stats.cc + src/core/lib/debug/stats_data.cc + src/core/lib/debug/trace.cc + src/core/lib/event_engine/ares_resolver.cc + src/core/lib/event_engine/cf_engine/cf_engine.cc + src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc + src/core/lib/event_engine/cf_engine/dns_service_resolver.cc + src/core/lib/event_engine/channel_args_endpoint_config.cc + src/core/lib/event_engine/default_event_engine.cc + src/core/lib/event_engine/default_event_engine_factory.cc + src/core/lib/event_engine/event_engine.cc + src/core/lib/event_engine/forkable.cc + src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc + src/core/lib/event_engine/posix_engine/ev_poll_posix.cc + src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc + src/core/lib/event_engine/posix_engine/internal_errqueue.cc + src/core/lib/event_engine/posix_engine/lockfree_event.cc + src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc + src/core/lib/event_engine/posix_engine/posix_endpoint.cc + src/core/lib/event_engine/posix_engine/posix_engine.cc + src/core/lib/event_engine/posix_engine/posix_engine_listener.cc + src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc + src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc + src/core/lib/event_engine/posix_engine/timer.cc + src/core/lib/event_engine/posix_engine/timer_heap.cc + src/core/lib/event_engine/posix_engine/timer_manager.cc + src/core/lib/event_engine/posix_engine/traced_buffer_list.cc + src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc + src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc + src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.cc + src/core/lib/event_engine/resolved_address.cc + src/core/lib/event_engine/shim.cc + src/core/lib/event_engine/slice.cc + src/core/lib/event_engine/slice_buffer.cc + src/core/lib/event_engine/tcp_socket_utils.cc + src/core/lib/event_engine/thread_pool/thread_count.cc + src/core/lib/event_engine/thread_pool/thread_pool_factory.cc + src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc + src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc + src/core/lib/event_engine/time_util.cc + src/core/lib/event_engine/trace.cc + src/core/lib/event_engine/utils.cc + src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc + src/core/lib/event_engine/windows/iocp.cc + src/core/lib/event_engine/windows/native_windows_dns_resolver.cc + src/core/lib/event_engine/windows/win_socket.cc + src/core/lib/event_engine/windows/windows_endpoint.cc + src/core/lib/event_engine/windows/windows_engine.cc + src/core/lib/event_engine/windows/windows_listener.cc + src/core/lib/event_engine/work_queue/basic_work_queue.cc + src/core/lib/experiments/config.cc + src/core/lib/experiments/experiments.cc + src/core/lib/gprpp/load_file.cc + src/core/lib/gprpp/per_cpu.cc + src/core/lib/gprpp/ref_counted_string.cc + src/core/lib/gprpp/status_helper.cc + src/core/lib/gprpp/time.cc + src/core/lib/gprpp/time_averaged_stats.cc + src/core/lib/gprpp/validation_errors.cc + src/core/lib/gprpp/work_serializer.cc + src/core/lib/handshaker/proxy_mapper_registry.cc + src/core/lib/iomgr/buffer_list.cc + src/core/lib/iomgr/call_combiner.cc + src/core/lib/iomgr/cfstream_handle.cc + src/core/lib/iomgr/closure.cc + src/core/lib/iomgr/combiner.cc + src/core/lib/iomgr/dualstack_socket_posix.cc + src/core/lib/iomgr/endpoint.cc + src/core/lib/iomgr/endpoint_cfstream.cc + src/core/lib/iomgr/endpoint_pair_posix.cc + src/core/lib/iomgr/endpoint_pair_windows.cc + src/core/lib/iomgr/error.cc + src/core/lib/iomgr/error_cfstream.cc + src/core/lib/iomgr/ev_apple.cc + src/core/lib/iomgr/ev_epoll1_linux.cc + src/core/lib/iomgr/ev_poll_posix.cc + src/core/lib/iomgr/ev_posix.cc + src/core/lib/iomgr/ev_windows.cc + src/core/lib/iomgr/event_engine_shims/closure.cc + src/core/lib/iomgr/event_engine_shims/endpoint.cc + src/core/lib/iomgr/event_engine_shims/tcp_client.cc + src/core/lib/iomgr/exec_ctx.cc + src/core/lib/iomgr/executor.cc + src/core/lib/iomgr/fork_posix.cc + src/core/lib/iomgr/fork_windows.cc + src/core/lib/iomgr/gethostname_fallback.cc + src/core/lib/iomgr/gethostname_host_name_max.cc + src/core/lib/iomgr/gethostname_sysconf.cc + src/core/lib/iomgr/grpc_if_nametoindex_posix.cc + src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc + src/core/lib/iomgr/internal_errqueue.cc + src/core/lib/iomgr/iocp_windows.cc + src/core/lib/iomgr/iomgr.cc + src/core/lib/iomgr/iomgr_internal.cc + src/core/lib/iomgr/iomgr_posix.cc + src/core/lib/iomgr/iomgr_posix_cfstream.cc + src/core/lib/iomgr/iomgr_windows.cc + src/core/lib/iomgr/lockfree_event.cc + src/core/lib/iomgr/polling_entity.cc + src/core/lib/iomgr/pollset.cc + src/core/lib/iomgr/pollset_set.cc + src/core/lib/iomgr/pollset_set_windows.cc + src/core/lib/iomgr/pollset_windows.cc + src/core/lib/iomgr/resolve_address.cc + src/core/lib/iomgr/resolve_address_posix.cc + src/core/lib/iomgr/resolve_address_windows.cc + src/core/lib/iomgr/sockaddr_utils_posix.cc + src/core/lib/iomgr/socket_factory_posix.cc + src/core/lib/iomgr/socket_mutator.cc + src/core/lib/iomgr/socket_utils_common_posix.cc + src/core/lib/iomgr/socket_utils_linux.cc + src/core/lib/iomgr/socket_utils_posix.cc + src/core/lib/iomgr/socket_utils_windows.cc + src/core/lib/iomgr/socket_windows.cc + src/core/lib/iomgr/systemd_utils.cc + src/core/lib/iomgr/tcp_client.cc + src/core/lib/iomgr/tcp_client_cfstream.cc + src/core/lib/iomgr/tcp_client_posix.cc + src/core/lib/iomgr/tcp_client_windows.cc + src/core/lib/iomgr/tcp_posix.cc + src/core/lib/iomgr/tcp_server.cc + src/core/lib/iomgr/tcp_server_posix.cc + src/core/lib/iomgr/tcp_server_utils_posix_common.cc + src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc + src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc + src/core/lib/iomgr/tcp_server_windows.cc + src/core/lib/iomgr/tcp_windows.cc + src/core/lib/iomgr/timer.cc + src/core/lib/iomgr/timer_generic.cc + src/core/lib/iomgr/timer_heap.cc + src/core/lib/iomgr/timer_manager.cc + src/core/lib/iomgr/unix_sockets_posix.cc + src/core/lib/iomgr/unix_sockets_posix_noop.cc + src/core/lib/iomgr/vsock.cc + src/core/lib/iomgr/wakeup_fd_eventfd.cc + src/core/lib/iomgr/wakeup_fd_nospecial.cc + src/core/lib/iomgr/wakeup_fd_pipe.cc + src/core/lib/iomgr/wakeup_fd_posix.cc + src/core/lib/json/json_writer.cc + src/core/lib/promise/activity.cc + src/core/lib/promise/party.cc + src/core/lib/promise/trace.cc + src/core/lib/resource_quota/api.cc + src/core/lib/resource_quota/arena.cc + src/core/lib/resource_quota/connection_quota.cc + src/core/lib/resource_quota/memory_quota.cc + src/core/lib/resource_quota/periodic_update.cc + src/core/lib/resource_quota/resource_quota.cc + src/core/lib/resource_quota/thread_quota.cc + src/core/lib/resource_quota/trace.cc + src/core/lib/security/certificate_provider/certificate_provider_registry.cc + src/core/lib/security/credentials/alts/check_gcp_environment.cc + src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc + src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc + src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc + src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc + src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc + src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc + src/core/lib/slice/percent_encoding.cc + src/core/lib/slice/slice.cc + src/core/lib/slice/slice_buffer.cc + src/core/lib/slice/slice_refcount.cc + src/core/lib/slice/slice_string_helpers.cc + src/core/lib/surface/api_trace.cc + src/core/lib/surface/byte_buffer.cc + src/core/lib/surface/byte_buffer_reader.cc + src/core/lib/surface/call.cc + src/core/lib/surface/call_details.cc + src/core/lib/surface/call_log_batch.cc + src/core/lib/surface/channel.cc + src/core/lib/surface/channel_init.cc + src/core/lib/surface/channel_stack_type.cc + src/core/lib/surface/completion_queue.cc + src/core/lib/surface/completion_queue_factory.cc + src/core/lib/surface/event_string.cc + src/core/lib/surface/init_internally.cc + src/core/lib/surface/lame_client.cc + src/core/lib/surface/metadata_array.cc + src/core/lib/surface/validate_metadata.cc + src/core/lib/surface/version.cc + src/core/lib/surface/wait_for_cq_end_op.cc + src/core/lib/transport/batch_builder.cc + src/core/lib/transport/call_arena_allocator.cc + src/core/lib/transport/call_filters.cc + src/core/lib/transport/call_final_info.cc + src/core/lib/transport/call_spine.cc + src/core/lib/transport/connectivity_state.cc + src/core/lib/transport/error_utils.cc + src/core/lib/transport/handshaker_registry.cc + src/core/lib/transport/interception_chain.cc + src/core/lib/transport/message.cc + src/core/lib/transport/metadata.cc + src/core/lib/transport/metadata_batch.cc + src/core/lib/transport/parsed_metadata.cc + src/core/lib/transport/status_conversion.cc + src/core/lib/transport/timeout_encoding.cc + src/core/lib/transport/transport.cc + src/core/lib/transport/transport_op_string.cc + src/core/lib/uri/uri_parser.cc + src/core/load_balancing/lb_policy.cc + src/core/load_balancing/lb_policy_registry.cc + src/core/resolver/endpoint_addresses.cc + src/core/resolver/resolver.cc + src/core/resolver/resolver_registry.cc + src/core/service_config/service_config_parser.cc + src/core/tsi/alts/handshaker/transport_security_common_api.cc + test/core/transport/interception_chain_test.cc + third_party/upb/upb/mini_descriptor/build_enum.c + third_party/upb/upb/mini_descriptor/decode.c + third_party/upb/upb/mini_descriptor/internal/base92.c + third_party/upb/upb/mini_descriptor/internal/encode.c + third_party/upb/upb/mini_descriptor/link.c + third_party/upb/upb/wire/decode.c + third_party/upb/upb/wire/encode.c + third_party/upb/upb/wire/eps_copy_input_stream.c + third_party/upb/upb/wire/internal/decode_fast.c + third_party/upb/upb/wire/reader.c +) +if(WIN32 AND MSVC) + if(BUILD_SHARED_LIBS) + target_compile_definitions(interception_chain_test + PRIVATE + "GPR_DLL_IMPORTS" + ) + endif() +endif() +target_compile_features(interception_chain_test PUBLIC cxx_std_14) +target_include_directories(interception_chain_test + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + ${_gRPC_RE2_INCLUDE_DIR} + ${_gRPC_SSL_INCLUDE_DIR} + ${_gRPC_UPB_GENERATED_DIR} + ${_gRPC_UPB_GRPC_GENERATED_DIR} + ${_gRPC_UPB_INCLUDE_DIR} + ${_gRPC_XXHASH_INCLUDE_DIR} + ${_gRPC_ZLIB_INCLUDE_DIR} + third_party/googletest/googletest/include + third_party/googletest/googletest + third_party/googletest/googlemock/include + third_party/googletest/googlemock + ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(interception_chain_test + ${_gRPC_ALLTARGETS_LIBRARIES} + gtest + utf8_range_lib + upb_message_lib + ${_gRPC_ZLIB_LIBRARIES} + absl::config + absl::no_destructor + absl::cleanup + absl::flat_hash_map + absl::inlined_vector + absl::function_ref + absl::hash + absl::type_traits + absl::statusor + absl::span + absl::utility + ${_gRPC_CARES_LIBRARIES} + gpr + ${_gRPC_ADDRESS_SORTING_LIBRARIES} +) + + endif() if(gRPC_BUILD_TESTS) @@ -17907,7 +18152,6 @@ target_include_directories(interop_client target_link_libraries(interop_client ${_gRPC_ALLTARGETS_LIBRARIES} - absl::check grpc++_test_config grpc++_test_util ) @@ -17962,7 +18206,6 @@ target_include_directories(interop_server target_link_libraries(interop_server ${_gRPC_ALLTARGETS_LIBRARIES} - absl::check grpc++_test_config grpc++_test_util ) @@ -18068,7 +18311,6 @@ target_include_directories(invoke_large_request_test target_link_libraries(invoke_large_request_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -18115,7 +18357,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX OR _gRPC_PLATFORM_WINDOWS) target_link_libraries(iocp_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -18459,7 +18700,6 @@ target_include_directories(keepalive_timeout_test target_link_libraries(keepalive_timeout_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -18566,7 +18806,6 @@ target_include_directories(large_metadata_test target_link_libraries(large_metadata_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -19238,7 +19477,6 @@ target_include_directories(max_concurrent_streams_test target_link_libraries(max_concurrent_streams_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -19302,7 +19540,6 @@ target_include_directories(max_connection_age_test target_link_libraries(max_connection_age_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -19366,7 +19603,6 @@ target_include_directories(max_connection_idle_test target_link_libraries(max_connection_idle_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -19430,7 +19666,6 @@ target_include_directories(max_message_length_test target_link_libraries(max_message_length_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -19579,7 +19814,6 @@ target_include_directories(message_allocator_end2end_test target_link_libraries(message_allocator_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -20114,7 +20348,6 @@ target_include_directories(negative_deadline_test target_link_libraries(negative_deadline_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -20210,7 +20443,6 @@ target_include_directories(no_logging_test target_link_libraries(no_logging_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -20274,7 +20506,6 @@ target_include_directories(no_op_test target_link_libraries(no_op_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -20379,7 +20610,6 @@ target_include_directories(nonblocking_test target_link_libraries(nonblocking_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -20557,7 +20787,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(oracle_event_engine_posix_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -20751,7 +20980,6 @@ target_include_directories(otel_plugin_test target_link_libraries(otel_plugin_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check opentelemetry-cpp::api opentelemetry-cpp::metrics grpc++_test_util @@ -20798,7 +21026,6 @@ target_include_directories(out_of_bounds_bad_client_test target_link_libraries(out_of_bounds_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -20807,7 +21034,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(outlier_detection_lb_config_parser_test - test/core/client_channel/lb_policy/outlier_detection_lb_config_parser_test.cc + test/core/load_balancing/outlier_detection_lb_config_parser_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -20853,9 +21080,9 @@ add_executable(outlier_detection_test ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.h ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.h - test/core/client_channel/lb_policy/outlier_detection_test.cc test/core/event_engine/event_engine_test_utils.cc test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + test/core/load_balancing/outlier_detection_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -20889,7 +21116,6 @@ target_include_directories(outlier_detection_test target_link_libraries(outlier_detection_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -21209,7 +21435,6 @@ target_include_directories(payload_test target_link_libraries(payload_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -21340,9 +21565,9 @@ add_executable(pick_first_test ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.h ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.h - test/core/client_channel/lb_policy/pick_first_test.cc test/core/event_engine/event_engine_test_utils.cc test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + test/core/load_balancing/pick_first_test.cc test/core/util/fake_stats_plugin.cc ) if(WIN32 AND MSVC) @@ -21377,7 +21602,6 @@ target_include_directories(pick_first_test target_link_libraries(pick_first_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -21584,7 +21808,6 @@ target_include_directories(ping_pong_streaming_test target_link_libraries(ping_pong_streaming_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -21699,7 +21922,6 @@ target_include_directories(ping_test target_link_libraries(ping_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -21845,7 +22067,6 @@ target_include_directories(port_sharing_end2end_test target_link_libraries(port_sharing_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -21893,7 +22114,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(posix_endpoint_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -21985,7 +22205,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) target_link_libraries(posix_event_engine_connect_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -22038,7 +22257,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) target_link_libraries(posix_event_engine_native_dns_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -22094,7 +22312,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) target_link_libraries(posix_event_engine_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -22593,7 +22810,6 @@ target_include_directories(proto_server_reflection_test target_link_libraries(proto_server_reflection_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_reflection grpc++_test_util ) @@ -22700,7 +22916,6 @@ target_include_directories(proxy_auth_test target_link_libraries(proxy_auth_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -22782,7 +22997,6 @@ target_include_directories(qps_json_driver target_link_libraries(qps_json_driver ${_gRPC_ALLTARGETS_LIBRARIES} - absl::check grpc++_test_config grpc++_test_util ) @@ -22855,7 +23069,6 @@ target_include_directories(qps_worker target_link_libraries(qps_worker ${_gRPC_ALLTARGETS_LIBRARIES} - absl::check grpc++_test_config grpc++_test_util ) @@ -23040,7 +23253,6 @@ target_include_directories(raw_end2end_test target_link_libraries(raw_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -23280,7 +23492,6 @@ target_include_directories(registered_call_test target_link_libraries(registered_call_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -23326,7 +23537,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(remove_stream_from_stalled_lists_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -23389,7 +23599,6 @@ target_include_directories(request_with_flags_test target_link_libraries(request_with_flags_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -23453,7 +23662,6 @@ target_include_directories(request_with_payload_test target_link_libraries(request_with_payload_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -23561,6 +23769,7 @@ target_include_directories(resolve_address_using_ares_resolver_test target_link_libraries(resolve_address_using_ares_resolver_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc_test_util grpc++_test_config ) @@ -23667,6 +23876,7 @@ target_include_directories(resolve_address_using_native_resolver_test target_link_libraries(resolve_address_using_native_resolver_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc_test_util grpc++_test_config ) @@ -23788,7 +23998,6 @@ target_include_directories(resource_quota_server_test target_link_libraries(resource_quota_server_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -23894,7 +24103,6 @@ target_include_directories(retry_cancel_after_first_attempt_starts_test target_link_libraries(retry_cancel_after_first_attempt_starts_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -23958,7 +24166,6 @@ target_include_directories(retry_cancel_during_delay_test target_link_libraries(retry_cancel_during_delay_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24022,7 +24229,6 @@ target_include_directories(retry_cancel_with_multiple_send_batches_test target_link_libraries(retry_cancel_with_multiple_send_batches_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24086,7 +24292,6 @@ target_include_directories(retry_cancellation_test target_link_libraries(retry_cancellation_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24150,7 +24355,6 @@ target_include_directories(retry_disabled_test target_link_libraries(retry_disabled_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24214,7 +24418,6 @@ target_include_directories(retry_exceeds_buffer_size_in_delay_test target_link_libraries(retry_exceeds_buffer_size_in_delay_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24278,7 +24481,6 @@ target_include_directories(retry_exceeds_buffer_size_in_initial_batch_test target_link_libraries(retry_exceeds_buffer_size_in_initial_batch_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24342,7 +24544,6 @@ target_include_directories(retry_exceeds_buffer_size_in_subsequent_batch_test target_link_libraries(retry_exceeds_buffer_size_in_subsequent_batch_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24406,7 +24607,6 @@ target_include_directories(retry_lb_drop_test target_link_libraries(retry_lb_drop_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24470,7 +24670,6 @@ target_include_directories(retry_lb_fail_test target_link_libraries(retry_lb_fail_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24534,7 +24733,6 @@ target_include_directories(retry_non_retriable_status_before_trailers_test target_link_libraries(retry_non_retriable_status_before_trailers_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24598,7 +24796,6 @@ target_include_directories(retry_non_retriable_status_test target_link_libraries(retry_non_retriable_status_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24662,7 +24859,6 @@ target_include_directories(retry_per_attempt_recv_timeout_on_last_attempt_test target_link_libraries(retry_per_attempt_recv_timeout_on_last_attempt_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24726,7 +24922,6 @@ target_include_directories(retry_per_attempt_recv_timeout_test target_link_libraries(retry_per_attempt_recv_timeout_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24790,7 +24985,6 @@ target_include_directories(retry_recv_initial_metadata_test target_link_libraries(retry_recv_initial_metadata_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24854,7 +25048,6 @@ target_include_directories(retry_recv_message_replay_test target_link_libraries(retry_recv_message_replay_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24918,7 +25111,6 @@ target_include_directories(retry_recv_message_test target_link_libraries(retry_recv_message_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -24982,7 +25174,6 @@ target_include_directories(retry_recv_trailing_metadata_error_test target_link_libraries(retry_recv_trailing_metadata_error_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25046,7 +25237,6 @@ target_include_directories(retry_send_initial_metadata_refs_test target_link_libraries(retry_send_initial_metadata_refs_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25110,7 +25300,6 @@ target_include_directories(retry_send_op_fails_test target_link_libraries(retry_send_op_fails_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25174,7 +25363,6 @@ target_include_directories(retry_send_recv_batch_test target_link_libraries(retry_send_recv_batch_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25238,7 +25426,6 @@ target_include_directories(retry_server_pushback_delay_test target_link_libraries(retry_server_pushback_delay_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25302,7 +25489,6 @@ target_include_directories(retry_server_pushback_disabled_test target_link_libraries(retry_server_pushback_disabled_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25408,7 +25594,6 @@ target_include_directories(retry_streaming_after_commit_test target_link_libraries(retry_streaming_after_commit_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25472,7 +25657,6 @@ target_include_directories(retry_streaming_succeeds_before_replay_finished_test target_link_libraries(retry_streaming_succeeds_before_replay_finished_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25536,7 +25720,6 @@ target_include_directories(retry_streaming_test target_link_libraries(retry_streaming_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25600,7 +25783,6 @@ target_include_directories(retry_test target_link_libraries(retry_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25706,7 +25888,6 @@ target_include_directories(retry_throttled_test target_link_libraries(retry_throttled_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25770,7 +25951,6 @@ target_include_directories(retry_too_many_attempts_test target_link_libraries(retry_too_many_attempts_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25834,7 +26014,6 @@ target_include_directories(retry_transparent_goaway_test target_link_libraries(retry_transparent_goaway_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25898,7 +26077,6 @@ target_include_directories(retry_transparent_max_concurrent_streams_test target_link_libraries(retry_transparent_max_concurrent_streams_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -25962,7 +26140,6 @@ target_include_directories(retry_transparent_not_sent_on_wire_test target_link_libraries(retry_transparent_not_sent_on_wire_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -26026,7 +26203,6 @@ target_include_directories(retry_unref_before_finish_test target_link_libraries(retry_unref_before_finish_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -26090,7 +26266,6 @@ target_include_directories(retry_unref_before_recv_test target_link_libraries(retry_unref_before_recv_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -26105,9 +26280,9 @@ add_executable(ring_hash_test ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.h ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.h - test/core/client_channel/lb_policy/ring_hash_test.cc test/core/event_engine/event_engine_test_utils.cc test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + test/core/load_balancing/ring_hash_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -26141,7 +26316,6 @@ target_include_directories(ring_hash_test target_link_libraries(ring_hash_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -26214,7 +26388,6 @@ target_include_directories(rls_end2end_test target_link_libraries(rls_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_config grpc++_test_util ) @@ -26224,7 +26397,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(rls_lb_config_parser_test - test/core/client_channel/lb_policy/rls_lb_config_parser_test.cc + test/core/load_balancing/rls_lb_config_parser_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -26270,9 +26443,9 @@ add_executable(round_robin_test ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.h ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.h - test/core/client_channel/lb_policy/round_robin_test.cc test/core/event_engine/event_engine_test_utils.cc test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + test/core/load_balancing/round_robin_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -26306,7 +26479,6 @@ target_include_directories(round_robin_test target_link_libraries(round_robin_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -26445,6 +26617,7 @@ target_include_directories(secure_endpoint_test target_link_libraries(secure_endpoint_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc_test_util ) @@ -26647,7 +26820,6 @@ target_include_directories(server_builder_plugin_test target_link_libraries(server_builder_plugin_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -27079,7 +27251,6 @@ target_include_directories(server_finishes_request_test target_link_libraries(server_finishes_request_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -27143,7 +27314,6 @@ target_include_directories(server_interceptors_end2end_test target_link_libraries(server_interceptors_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -27188,7 +27358,6 @@ target_include_directories(server_registered_method_bad_client_test target_link_libraries(server_registered_method_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -27366,7 +27535,6 @@ target_include_directories(server_streaming_test target_link_libraries(server_streaming_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -27475,7 +27643,6 @@ target_include_directories(service_config_end2end_test target_link_libraries(service_config_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -27569,7 +27736,6 @@ target_include_directories(settings_timeout_test target_link_libraries(settings_timeout_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -27631,7 +27797,6 @@ target_include_directories(shutdown_finishes_calls_test target_link_libraries(shutdown_finishes_calls_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -27695,7 +27860,6 @@ target_include_directories(shutdown_finishes_tags_test target_link_libraries(shutdown_finishes_tags_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -27761,7 +27925,6 @@ target_include_directories(shutdown_test target_link_libraries(shutdown_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -27823,7 +27986,6 @@ target_include_directories(simple_delayed_request_test target_link_libraries(simple_delayed_request_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -27887,7 +28049,6 @@ target_include_directories(simple_metadata_test target_link_libraries(simple_metadata_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -27934,7 +28095,6 @@ target_include_directories(simple_request_bad_client_test target_link_libraries(simple_request_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -27996,7 +28156,6 @@ target_include_directories(simple_request_test target_link_libraries(simple_request_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -28179,7 +28338,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(sockaddr_resolver_test - test/core/client_channel/resolvers/sockaddr_resolver_test.cc + test/core/resolver/sockaddr_resolver_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -28307,6 +28466,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(socket_utils_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc_test_util ) @@ -28426,7 +28586,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(ssl_transport_security_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -28472,7 +28631,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(ssl_transport_security_utils_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -28569,7 +28727,7 @@ if(gRPC_BUILD_TESTS) add_executable(static_stride_scheduler_test src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc - test/core/client_channel/lb_policy/static_stride_scheduler_test.cc + test/core/load_balancing/static_stride_scheduler_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -28864,7 +29022,6 @@ target_include_directories(stream_leak_with_queued_flow_control_update_test target_link_libraries(stream_leak_with_queued_flow_control_update_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -28926,7 +29083,6 @@ target_include_directories(streaming_error_response_test target_link_libraries(streaming_error_response_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -29046,7 +29202,6 @@ target_include_directories(streams_not_seen_test target_link_libraries(streams_not_seen_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -29453,6 +29608,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) target_link_libraries(tcp_posix_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc_test_util ) @@ -29557,18 +29713,18 @@ target_link_libraries(tcp_socket_utils_test endif() if(gRPC_BUILD_TESTS) -add_executable(test_core_channel_channelz_test +add_executable(test_core_channelz_channelz_test ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.h - test/core/channel/channelz_test.cc + test/core/channelz/channelz_test.cc test/core/event_engine/event_engine_test_utils.cc test/cpp/util/channel_trace_proto_helper.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) - target_compile_definitions(test_core_channel_channelz_test + target_compile_definitions(test_core_channelz_channelz_test PRIVATE "GPR_DLL_IMPORTS" "GRPC_DLL_IMPORTS" @@ -29576,8 +29732,8 @@ if(WIN32 AND MSVC) ) endif() endif() -target_compile_features(test_core_channel_channelz_test PUBLIC cxx_std_14) -target_include_directories(test_core_channel_channelz_test +target_compile_features(test_core_channelz_channelz_test PUBLIC cxx_std_14) +target_include_directories(test_core_channelz_channelz_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include @@ -29596,10 +29752,9 @@ target_include_directories(test_core_channel_channelz_test ${_gRPC_PROTO_GENS_DIR} ) -target_link_libraries(test_core_channel_channelz_test +target_link_libraries(test_core_channelz_channelz_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++ grpc_test_util ) @@ -29662,7 +29817,6 @@ target_include_directories(test_core_end2end_channelz_test target_link_libraries(test_core_end2end_channelz_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -29999,7 +30153,6 @@ target_include_directories(test_core_security_credentials_test target_link_libraries(test_core_security_credentials_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -30197,7 +30350,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) target_link_libraries(test_core_transport_test_suite_chaotic_good_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -30244,6 +30396,7 @@ target_include_directories(test_cpp_client_credentials_test target_link_libraries(test_cpp_client_credentials_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc++ grpc_test_util ) @@ -30305,7 +30458,6 @@ target_include_directories(test_cpp_end2end_ssl_credentials_test target_link_libraries(test_cpp_end2end_ssl_credentials_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -30404,6 +30556,7 @@ target_include_directories(test_cpp_server_credentials_test target_link_libraries(test_cpp_server_credentials_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc++ grpc_test_util ) @@ -30778,7 +30931,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(thready_posix_event_engine_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -30824,6 +30976,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(time_jump_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc++ grpc_test_util ) @@ -30929,7 +31082,6 @@ target_include_directories(timeout_before_request_call_test target_link_libraries(timeout_before_request_call_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -31068,6 +31220,7 @@ target_include_directories(timer_test target_link_libraries(timer_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest + absl::check grpc++ grpc_test_util ) @@ -31174,7 +31327,6 @@ target_include_directories(tls_credentials_test target_link_libraries(tls_credentials_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -31234,7 +31386,6 @@ target_include_directories(tls_key_export_test target_link_libraries(tls_key_export_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -31330,7 +31481,6 @@ target_include_directories(too_many_pings_test target_link_libraries(too_many_pings_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_config grpc++_test_util ) @@ -31375,7 +31525,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(traced_buffer_list_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -31438,7 +31587,6 @@ target_include_directories(trailing_metadata_test target_link_libraries(trailing_metadata_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -31842,7 +31990,6 @@ target_include_directories(unknown_frame_bad_client_test target_link_libraries(unknown_frame_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -32141,7 +32288,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(weighted_round_robin_config_test - test/core/client_channel/lb_policy/weighted_round_robin_config_test.cc + test/core/load_balancing/weighted_round_robin_config_test.cc test/core/util/fake_stats_plugin.cc ) if(WIN32 AND MSVC) @@ -32188,9 +32335,9 @@ add_executable(weighted_round_robin_test ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.h ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.h - test/core/client_channel/lb_policy/weighted_round_robin_test.cc test/core/event_engine/event_engine_test_utils.cc test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + test/core/load_balancing/weighted_round_robin_test.cc test/core/util/fake_stats_plugin.cc ) if(WIN32 AND MSVC) @@ -32225,7 +32372,6 @@ target_include_directories(weighted_round_robin_test target_link_libraries(weighted_round_robin_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -32271,7 +32417,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX OR _gRPC_PLATFORM_WINDOWS) target_link_libraries(win_socket_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -32317,7 +32462,6 @@ target_include_directories(window_overflow_bad_client_test target_link_libraries(window_overflow_bad_client_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -32362,7 +32506,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX OR _gRPC_PLATFORM_WINDOWS) target_link_libraries(windows_endpoint_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -32624,7 +32767,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(work_serializer_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_test_util ) @@ -32687,7 +32829,6 @@ target_include_directories(write_buffering_at_end_test target_link_libraries(write_buffering_at_end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -32751,7 +32892,6 @@ target_include_directories(write_buffering_test target_link_libraries(write_buffering_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc_authorization_provider grpc_unsecure grpc_test_util @@ -32873,7 +33013,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(writes_per_rpc_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++ grpc_test_util ) @@ -33302,7 +33441,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_cluster_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -33598,7 +33736,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_cluster_type_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -33860,7 +33997,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_core_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -33922,7 +34058,6 @@ target_include_directories(xds_credentials_end2end_test target_link_libraries(xds_credentials_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -34156,7 +34291,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_csds_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -34352,7 +34486,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_config grpc++_test_util ) @@ -34592,7 +34725,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_fallback_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -34775,7 +34907,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_fault_injection_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -35352,7 +35483,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_outlier_detection_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -35539,7 +35669,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_override_host_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -35549,7 +35678,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(xds_override_host_lb_config_parser_test - test/core/client_channel/lb_policy/xds_override_host_lb_config_parser_test.cc + test/core/load_balancing/xds_override_host_lb_config_parser_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -35595,9 +35724,9 @@ add_executable(xds_override_host_test ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.h ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.h - test/core/client_channel/lb_policy/xds_override_host_test.cc test/core/event_engine/event_engine_test_utils.cc test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + test/core/load_balancing/xds_override_host_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) @@ -35631,7 +35760,6 @@ target_include_directories(xds_override_host_test target_link_libraries(xds_override_host_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check ${_gRPC_PROTOBUF_LIBRARIES} grpc_test_util ) @@ -35815,7 +35943,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_pick_first_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -35995,7 +36122,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_ring_hash_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -36179,7 +36305,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_rls_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -36484,7 +36609,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_routing_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -36561,7 +36685,6 @@ target_include_directories(xds_stats_watcher_test target_link_libraries(xds_stats_watcher_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_reflection grpcpp_channelz grpc_test_util @@ -36747,7 +36870,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) target_link_libraries(xds_wrr_end2end_test ${_gRPC_ALLTARGETS_LIBRARIES} gtest - absl::check grpc++_test_util ) @@ -36853,7 +36975,7 @@ generate_pkgconfig( "gRPC++" "C++ wrapper for gRPC" "${gRPC_CPP_VERSION}" - "absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc" + "absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc" "libcares openssl re2 zlib" "-lgrpc++" "-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib" @@ -36864,7 +36986,7 @@ generate_pkgconfig( "gRPC++ unsecure" "C++ wrapper for gRPC without SSL" "${gRPC_CPP_VERSION}" - "absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc_unsecure" + "absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc_unsecure" "libcares zlib" "-lgrpc++_unsecure" "-laddress_sorting -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib" diff --git a/Makefile b/Makefile index 30be778e03d..9d3d160f518 100644 --- a/Makefile +++ b/Makefile @@ -666,8 +666,10 @@ clean: # deps: ['cares', 'libssl', 'z'] # transitive_deps: ['cares', 'libssl', 'z'] LIBGRPC_SRC = \ + src/core/channelz/channel_trace.cc \ + src/core/channelz/channelz.cc \ + src/core/channelz/channelz_registry.cc \ src/core/client_channel/backup_poller.cc \ - src/core/client_channel/client_channel_channelz.cc \ src/core/client_channel/client_channel_factory.cc \ src/core/client_channel/client_channel_filter.cc \ src/core/client_channel/client_channel_plugin.cc \ @@ -1092,9 +1094,6 @@ LIBGRPC_SRC = \ src/core/lib/channel/channel_stack_builder.cc \ src/core/lib/channel/channel_stack_builder_impl.cc \ src/core/lib/channel/channel_stack_trace.cc \ - src/core/lib/channel/channel_trace.cc \ - src/core/lib/channel/channelz.cc \ - src/core/lib/channel/channelz_registry.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/metrics.cc \ src/core/lib/channel/promise_based_filter.cc \ @@ -1407,9 +1406,9 @@ LIBGRPC_SRC = \ src/core/lib/surface/wait_for_cq_end_op.cc \ src/core/lib/transport/batch_builder.cc \ src/core/lib/transport/bdp_estimator.cc \ + src/core/lib/transport/call_arena_allocator.cc \ src/core/lib/transport/call_filters.cc \ src/core/lib/transport/call_final_info.cc \ - src/core/lib/transport/call_size_estimator.cc \ src/core/lib/transport/call_spine.cc \ src/core/lib/transport/connectivity_state.cc \ src/core/lib/transport/endpoint_info_handshaker.cc \ diff --git a/Package.swift b/Package.swift index ce9e5e1bed5..7fab159ad58 100644 --- a/Package.swift +++ b/Package.swift @@ -23,8 +23,8 @@ let package = Package( ], dependencies: [ - .package(url: "https://github.com/firebase/abseil-cpp-SwiftPM.git", "0.20230802.0"..<"0.20230803.0"), - .package(url: "https://github.com/firebase/boringssl-SwiftPM.git", "0.9.0"..<"0.10.0"), + .package(url: "https://github.com/firebase/abseil-cpp-SwiftPM.git", "0.20240116.1"..<"0.20240117.0"), + .package(url: "https://github.com/firebase/boringssl-SwiftPM.git", "0.32.0"..<"0.33.0"), ], targets: [ @@ -117,10 +117,14 @@ let package = Package( "include/grpc/support/thd_id.h", "include/grpc/support/time.h", "include/grpc/support/workaround_list.h", + "src/core/channelz/channel_trace.cc", + "src/core/channelz/channel_trace.h", + "src/core/channelz/channelz.cc", + "src/core/channelz/channelz.h", + "src/core/channelz/channelz_registry.cc", + "src/core/channelz/channelz_registry.h", "src/core/client_channel/backup_poller.cc", "src/core/client_channel/backup_poller.h", - "src/core/client_channel/client_channel_channelz.cc", - "src/core/client_channel/client_channel_channelz.h", "src/core/client_channel/client_channel_factory.cc", "src/core/client_channel/client_channel_factory.h", "src/core/client_channel/client_channel_filter.cc", @@ -1144,12 +1148,6 @@ let package = Package( "src/core/lib/channel/channel_stack_builder_impl.h", "src/core/lib/channel/channel_stack_trace.cc", "src/core/lib/channel/channel_stack_trace.h", - "src/core/lib/channel/channel_trace.cc", - "src/core/lib/channel/channel_trace.h", - "src/core/lib/channel/channelz.cc", - "src/core/lib/channel/channelz.h", - "src/core/lib/channel/channelz_registry.cc", - "src/core/lib/channel/channelz_registry.h", "src/core/lib/channel/connected_channel.cc", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", @@ -1805,12 +1803,12 @@ let package = Package( "src/core/lib/transport/batch_builder.h", "src/core/lib/transport/bdp_estimator.cc", "src/core/lib/transport/bdp_estimator.h", + "src/core/lib/transport/call_arena_allocator.cc", + "src/core/lib/transport/call_arena_allocator.h", "src/core/lib/transport/call_filters.cc", "src/core/lib/transport/call_filters.h", "src/core/lib/transport/call_final_info.cc", "src/core/lib/transport/call_final_info.h", - "src/core/lib/transport/call_size_estimator.cc", - "src/core/lib/transport/call_size_estimator.h", "src/core/lib/transport/call_spine.cc", "src/core/lib/transport/call_spine.h", "src/core/lib/transport/connectivity_state.cc", diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 54bb074ab2e..b839af3e7d8 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -106,11 +106,14 @@ def _update_visibility(visibility): "debug_location": PRIVATE, "endpoint_tests": PRIVATE, "exec_ctx": PRIVATE, + "gpr_public_hdrs": PRIVATE, "grpclb": PRIVATE, "grpc_experiments": PRIVATE, "grpc_opencensus_plugin": PUBLIC, + "grpc_public_hdrs": PRIVATE, "grpcpp_gcp_observability": PUBLIC, "grpc_resolver_fake": PRIVATE, + "grpc++_public_hdrs": PUBLIC, "grpc++_test": PRIVATE, "http": PRIVATE, "httpcli": PRIVATE, diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 0418b6ae26a..e1fa1842c2b 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -221,8 +221,10 @@ libs: - include/grpc/support/time.h - include/grpc/support/workaround_list.h headers: + - src/core/channelz/channel_trace.h + - src/core/channelz/channelz.h + - src/core/channelz/channelz_registry.h - src/core/client_channel/backup_poller.h - - src/core/client_channel/client_channel_channelz.h - src/core/client_channel/client_channel_factory.h - src/core/client_channel/client_channel_filter.h - src/core/client_channel/client_channel_internal.h @@ -822,9 +824,6 @@ libs: - src/core/lib/channel/channel_stack_builder.h - src/core/lib/channel/channel_stack_builder_impl.h - src/core/lib/channel/channel_stack_trace.h - - src/core/lib/channel/channel_trace.h - - src/core/lib/channel/channelz.h - - src/core/lib/channel/channelz_registry.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - src/core/lib/channel/metrics.h @@ -1139,9 +1138,9 @@ libs: - src/core/lib/surface/wait_for_cq_end_op.h - src/core/lib/transport/batch_builder.h - src/core/lib/transport/bdp_estimator.h + - src/core/lib/transport/call_arena_allocator.h - src/core/lib/transport/call_filters.h - src/core/lib/transport/call_final_info.h - - src/core/lib/transport/call_size_estimator.h - src/core/lib/transport/call_spine.h - src/core/lib/transport/connectivity_state.h - src/core/lib/transport/custom_metadata.h @@ -1245,8 +1244,10 @@ libs: - third_party/upb/upb/generated_code_support.h - third_party/xxhash/xxhash.h src: + - src/core/channelz/channel_trace.cc + - src/core/channelz/channelz.cc + - src/core/channelz/channelz_registry.cc - src/core/client_channel/backup_poller.cc - - src/core/client_channel/client_channel_channelz.cc - src/core/client_channel/client_channel_factory.cc - src/core/client_channel/client_channel_filter.cc - src/core/client_channel/client_channel_plugin.cc @@ -1671,9 +1672,6 @@ libs: - src/core/lib/channel/channel_stack_builder.cc - src/core/lib/channel/channel_stack_builder_impl.cc - src/core/lib/channel/channel_stack_trace.cc - - src/core/lib/channel/channel_trace.cc - - src/core/lib/channel/channelz.cc - - src/core/lib/channel/channelz_registry.cc - src/core/lib/channel/connected_channel.cc - src/core/lib/channel/metrics.cc - src/core/lib/channel/promise_based_filter.cc @@ -1941,9 +1939,9 @@ libs: - src/core/lib/surface/wait_for_cq_end_op.cc - src/core/lib/transport/batch_builder.cc - src/core/lib/transport/bdp_estimator.cc + - src/core/lib/transport/call_arena_allocator.cc - src/core/lib/transport/call_filters.cc - src/core/lib/transport/call_final_info.cc - - src/core/lib/transport/call_size_estimator.cc - src/core/lib/transport/call_spine.cc - src/core/lib/transport/connectivity_state.cc - src/core/lib/transport/endpoint_info_handshaker.cc @@ -2100,6 +2098,7 @@ libs: - absl/debugging:failure_signal_handler - absl/debugging:stacktrace - absl/debugging:symbolize + - absl/log:check - grpc - name: grpc_test_util_unsecure build: private @@ -2128,6 +2127,7 @@ libs: - absl/debugging:failure_signal_handler - absl/debugging:stacktrace - absl/debugging:symbolize + - absl/log:check - grpc_unsecure - name: grpc_unsecure build: all @@ -2209,8 +2209,10 @@ libs: - include/grpc/support/time.h - include/grpc/support/workaround_list.h headers: + - src/core/channelz/channel_trace.h + - src/core/channelz/channelz.h + - src/core/channelz/channelz_registry.h - src/core/client_channel/backup_poller.h - - src/core/client_channel/client_channel_channelz.h - src/core/client_channel/client_channel_factory.h - src/core/client_channel/client_channel_filter.h - src/core/client_channel/client_channel_internal.h @@ -2327,9 +2329,6 @@ libs: - src/core/lib/channel/channel_stack_builder.h - src/core/lib/channel/channel_stack_builder_impl.h - src/core/lib/channel/channel_stack_trace.h - - src/core/lib/channel/channel_trace.h - - src/core/lib/channel/channelz.h - - src/core/lib/channel/channelz_registry.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - src/core/lib/channel/metrics.h @@ -2608,9 +2607,9 @@ libs: - src/core/lib/surface/wait_for_cq_end_op.h - src/core/lib/transport/batch_builder.h - src/core/lib/transport/bdp_estimator.h + - src/core/lib/transport/call_arena_allocator.h - src/core/lib/transport/call_filters.h - src/core/lib/transport/call_final_info.h - - src/core/lib/transport/call_size_estimator.h - src/core/lib/transport/call_spine.h - src/core/lib/transport/connectivity_state.h - src/core/lib/transport/custom_metadata.h @@ -2702,8 +2701,10 @@ libs: - third_party/upb/upb/wire/reader.h - third_party/upb/upb/wire/types.h src: + - src/core/channelz/channel_trace.cc + - src/core/channelz/channelz.cc + - src/core/channelz/channelz_registry.cc - src/core/client_channel/backup_poller.cc - - src/core/client_channel/client_channel_channelz.cc - src/core/client_channel/client_channel_factory.cc - src/core/client_channel/client_channel_filter.cc - src/core/client_channel/client_channel_plugin.cc @@ -2797,9 +2798,6 @@ libs: - src/core/lib/channel/channel_stack_builder.cc - src/core/lib/channel/channel_stack_builder_impl.cc - src/core/lib/channel/channel_stack_trace.cc - - src/core/lib/channel/channel_trace.cc - - src/core/lib/channel/channelz.cc - - src/core/lib/channel/channelz_registry.cc - src/core/lib/channel/connected_channel.cc - src/core/lib/channel/metrics.cc - src/core/lib/channel/promise_based_filter.cc @@ -3028,9 +3026,9 @@ libs: - src/core/lib/surface/wait_for_cq_end_op.cc - src/core/lib/transport/batch_builder.cc - src/core/lib/transport/bdp_estimator.cc + - src/core/lib/transport/call_arena_allocator.cc - src/core/lib/transport/call_filters.cc - src/core/lib/transport/call_final_info.cc - - src/core/lib/transport/call_size_estimator.cc - src/core/lib/transport/call_spine.cc - src/core/lib/transport/connectivity_state.cc - src/core/lib/transport/endpoint_info_handshaker.cc @@ -3623,7 +3621,6 @@ libs: - test/core/util/tracer_util.cc - test/cpp/microbenchmarks/helpers.cc deps: - - absl/log:check - benchmark - grpc++_unsecure - grpc_test_util_unsecure @@ -3940,6 +3937,7 @@ libs: - src/cpp/util/string_ref.cc - src/cpp/util/time_cc.cc deps: + - absl/log:check - grpc - protobuf baselib: true @@ -4313,6 +4311,7 @@ libs: - src/cpp/util/string_ref.cc - src/cpp/util/time_cc.cc deps: + - absl/log:check - grpc_unsecure - protobuf baselib: true @@ -4395,6 +4394,9 @@ libs: - include/grpc/support/time.h - include/grpc/support/workaround_list.h headers: + - src/core/channelz/channel_trace.h + - src/core/channelz/channelz.h + - src/core/channelz/channelz_registry.h - src/core/ext/upb-gen/google/protobuf/any.upb.h - src/core/ext/upb-gen/google/protobuf/any.upb_minitable.h - src/core/ext/upb-gen/google/rpc/status.upb.h @@ -4418,9 +4420,6 @@ libs: - src/core/lib/channel/channel_stack_builder.h - src/core/lib/channel/channel_stack_builder_impl.h - src/core/lib/channel/channel_stack_trace.h - - src/core/lib/channel/channel_trace.h - - src/core/lib/channel/channelz.h - - src/core/lib/channel/channelz_registry.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - src/core/lib/channel/metrics.h @@ -4620,7 +4619,6 @@ libs: - src/core/lib/promise/party.h - src/core/lib/promise/pipe.h - src/core/lib/promise/poll.h - - src/core/lib/promise/prioritized_race.h - src/core/lib/promise/promise.h - src/core/lib/promise/race.h - src/core/lib/promise/seq.h @@ -4688,6 +4686,7 @@ libs: - src/core/lib/surface/validate_metadata.h - src/core/lib/surface/wait_for_cq_end_op.h - src/core/lib/transport/batch_builder.h + - src/core/lib/transport/call_arena_allocator.h - src/core/lib/transport/call_filters.h - src/core/lib/transport/call_final_info.h - src/core/lib/transport/call_spine.h @@ -4747,6 +4746,9 @@ libs: - third_party/upb/upb/wire/reader.h - third_party/upb/upb/wire/types.h src: + - src/core/channelz/channel_trace.cc + - src/core/channelz/channelz.cc + - src/core/channelz/channelz_registry.cc - src/core/ext/upb-gen/google/protobuf/any.upb_minitable.c - src/core/ext/upb-gen/google/rpc/status.upb_minitable.c - src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb_minitable.c @@ -4762,9 +4764,6 @@ libs: - src/core/lib/channel/channel_stack_builder.cc - src/core/lib/channel/channel_stack_builder_impl.cc - src/core/lib/channel/channel_stack_trace.cc - - src/core/lib/channel/channel_trace.cc - - src/core/lib/channel/channelz.cc - - src/core/lib/channel/channelz_registry.cc - src/core/lib/channel/connected_channel.cc - src/core/lib/channel/metrics.cc - src/core/lib/channel/promise_based_filter.cc @@ -4985,6 +4984,7 @@ libs: - src/core/lib/surface/version.cc - src/core/lib/surface/wait_for_cq_end_op.cc - src/core/lib/transport/batch_builder.cc + - src/core/lib/transport/call_arena_allocator.cc - src/core/lib/transport/call_filters.cc - src/core/lib/transport/call_final_info.cc - src/core/lib/transport/call_spine.cc @@ -5142,6 +5142,7 @@ targets: - test/core/util/slice_splitter.cc - test/core/util/tracer_util.cc deps: + - absl/log:check - grpc_test_util platforms: - linux @@ -5174,7 +5175,7 @@ targets: - src/core/load_balancing/weighted_round_robin/static_stride_scheduler.h src: - src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc - - test/core/client_channel/lb_policy/static_stride_scheduler_benchmark.cc + - test/core/load_balancing/static_stride_scheduler_benchmark.cc deps: - absl/algorithm:container - absl/types:span @@ -5312,6 +5313,7 @@ targets: - test/cpp/util/subprocess.cc deps: - gtest + - absl/log:check - grpc++_unsecure - grpc_test_util_unsecure - grpc++_test_config @@ -5492,7 +5494,6 @@ targets: - test/core/tsi/transport_security_test_lib.cc deps: - gtest - - absl/log:check - grpc_test_util - name: alts_grpc_record_protocol_test gtest: true @@ -5645,7 +5646,6 @@ targets: - test/cpp/end2end/async_end2end_test.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: auth_context_test gtest: true @@ -5795,7 +5795,6 @@ targets: - test/cpp/interop/backend_metrics_lb_policy_test.cc deps: - gtest - - absl/log:check - grpc++ - grpc_test_util - grpc++_test_config @@ -5870,7 +5869,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -5977,7 +5975,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: badreq_bad_client_test gtest: true @@ -5992,7 +5989,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: basic_work_queue_test gtest: true @@ -6101,7 +6097,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -6111,7 +6106,7 @@ targets: language: c++ headers: [] src: - - test/core/client_channel/resolvers/binder_resolver_test.cc + - test/core/resolver/binder_resolver_test.cc deps: - gtest - grpc_test_util @@ -6132,7 +6127,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: binder_transport_test gtest: true @@ -6284,6 +6278,7 @@ targets: - test/core/util/tracer_util.cc deps: - gtest + - absl/log:check - grpc_test_util - name: byte_buffer_test gtest: true @@ -6367,7 +6362,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -6453,6 +6447,7 @@ targets: - src/core/lib/transport/simple_slice_based_metadata.h - src/core/lib/transport/status_conversion.h - src/core/lib/transport/timeout_encoding.h + - test/core/promise/poll_matcher.h - third_party/upb/upb/generated_code_support.h - third_party/upb/upb/mini_descriptor/build_enum.h - third_party/upb/upb/mini_descriptor/decode.h @@ -6608,7 +6603,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -6685,7 +6679,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -6749,7 +6742,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -6813,7 +6805,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -6877,7 +6868,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -6958,7 +6948,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -7037,7 +7026,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -7101,7 +7089,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -7437,7 +7424,6 @@ targets: - test/core/event_engine/cf/cf_engine_test.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -7462,7 +7448,6 @@ targets: - test/core/event_engine/test_suite/tests/timer_test.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -7484,7 +7469,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: channel_args_test gtest: true @@ -7579,7 +7563,7 @@ targets: - test/cpp/util/channel_trace_proto_helper.h src: - src/proto/grpc/channelz/channelz.proto - - test/core/channel/channel_trace_test.cc + - test/core/channelz/channel_trace_test.cc - test/cpp/util/channel_trace_proto_helper.cc deps: - gtest @@ -7591,7 +7575,7 @@ targets: language: c++ headers: [] src: - - test/core/channel/channelz_registry_test.cc + - test/core/channelz/channelz_registry_test.cc deps: - gtest - grpc++ @@ -7614,7 +7598,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpcpp_channelz - grpc++_test_util - name: check_gcp_environment_linux_test @@ -7845,7 +7828,6 @@ targets: - test/core/filters/filter_test.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util uses_polling: false @@ -7863,7 +7845,6 @@ targets: - test/core/filters/filter_test.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util uses_polling: false @@ -7884,7 +7865,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: client_channel_service_config_test gtest: true @@ -7956,7 +7936,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: client_lb_end2end_test gtest: true @@ -7981,7 +7960,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -8061,7 +8039,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -8238,7 +8215,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -8276,7 +8252,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: connection_refused_test gtest: true @@ -8380,7 +8355,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -8399,7 +8373,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: context_test gtest: true @@ -8464,7 +8437,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: crl_ssl_transport_security_test gtest: true @@ -8477,7 +8449,6 @@ targets: - test/core/tsi/transport_security_test_lib.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -8553,7 +8524,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -8572,7 +8542,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: destroy_grpclb_channel_with_active_connect_stress_test gtest: true @@ -8655,7 +8624,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -8665,7 +8633,7 @@ targets: language: c++ headers: [] src: - - test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc + - test/core/resolver/dns_resolver_cooldown_test.cc deps: - gtest - grpc_test_util @@ -8675,7 +8643,7 @@ targets: language: c++ headers: [] src: - - test/core/client_channel/resolvers/dns_resolver_test.cc + - test/core/resolver/dns_resolver_test.cc deps: - gtest - grpc_test_util @@ -8731,7 +8699,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: empty_batch_test gtest: true @@ -8793,7 +8760,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -8817,7 +8783,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -8840,7 +8805,6 @@ targets: - test/cpp/end2end/interceptors_util.cc - test/cpp/end2end/test_service_impl.cc deps: - - absl/log:check - grpc++_test - grpc++_test_util - name: endpoint_addresses_test @@ -9026,6 +8990,7 @@ targets: - test/core/util/tracer_util.cc deps: - gtest + - absl/log:check - grpc_test_util - name: env_test gtest: true @@ -9083,6 +9048,7 @@ targets: - test/core/util/tracer_util.cc deps: - gtest + - absl/log:check - grpc_test_util uses_polling: false - name: error_utils_test @@ -9463,7 +9429,7 @@ targets: language: c++ headers: [] src: - - test/core/client_channel/resolvers/fake_resolver_test.cc + - test/core/resolver/fake_resolver_test.cc deps: - gtest - grpc_test_util @@ -9478,7 +9444,6 @@ targets: - test/core/tsi/transport_security_test_lib.cc deps: - gtest - - absl/log:check - grpc_test_util - name: fd_posix_test gtest: true @@ -9585,7 +9550,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -9649,7 +9613,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -9713,7 +9676,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -9731,7 +9693,6 @@ targets: - test/core/filters/filter_test_test.cc deps: - gtest - - absl/log:check - grpc_unsecure - protobuf - grpc_test_util @@ -9796,7 +9757,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -9816,7 +9776,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: flow_control_test gtest: true @@ -10214,7 +10173,6 @@ targets: - test/core/event_engine/test_suite/tests/timer_test.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util platforms: @@ -10233,7 +10191,6 @@ targets: - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine_unittest.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util - name: generic_end2end_test @@ -10270,7 +10227,7 @@ targets: headers: - test/core/util/fake_udp_and_tcp_server.h src: - - test/core/client_channel/resolvers/google_c2p_resolver_test.cc + - test/core/resolver/google_c2p_resolver_test.cc - test/core/util/fake_udp_and_tcp_server.cc deps: - gtest @@ -10335,7 +10292,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -10350,7 +10306,6 @@ targets: - test/core/transport/chttp2/graceful_shutdown_test.cc deps: - gtest - - absl/log:check - grpc_test_util - name: grpc_alts_credentials_options_test gtest: true @@ -10473,7 +10428,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc++_test_util - name: grpc_authz_test @@ -10536,7 +10490,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -10839,7 +10792,6 @@ targets: - test/core/tsi/transport_security_test_lib.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util - name: grpc_tool_test @@ -10885,7 +10837,6 @@ targets: - test/cpp/grpclb/grpclb_api_test.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: grpclb_end2end_test gtest: true @@ -10906,7 +10857,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_config - grpc++_test_util platforms: @@ -10943,7 +10893,6 @@ targets: - test/core/event_engine/event_engine_test_utils.cc deps: - gtest - - absl/log:check - grpc_test_util - name: h2_ssl_session_reuse_test gtest: true @@ -11009,7 +10958,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: headers_bad_client_test gtest: true @@ -11024,7 +10972,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: health_service_end2end_test gtest: true @@ -11045,7 +10992,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: high_initial_seqno_test gtest: true @@ -11107,7 +11053,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -11306,7 +11251,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -11322,7 +11266,6 @@ targets: - src/proto/grpc/testing/test.proto - test/cpp/interop/http2_client.cc deps: - - absl/log:check - grpc++_test_config - grpc++_test_util - name: http2_settings_test @@ -11395,7 +11338,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -11406,7 +11348,7 @@ targets: headers: - test/core/util/scoped_env_var.h src: - - test/core/client_channel/http_proxy_mapper_test.cc + - test/core/handshake/http_proxy_mapper_test.cc deps: - gtest - grpc_test_util @@ -11463,7 +11405,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: idle_filter_state_test gtest: true @@ -11529,7 +11470,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: inproc_test gtest: true @@ -11552,7 +11492,6 @@ targets: - test/core/transport/test_suite/test_main.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util platforms: @@ -11631,14 +11570,607 @@ targets: - src/core/lib/debug/trace.cc - src/core/lib/promise/activity.cc - src/core/lib/promise/trace.cc - - test/core/promise/inter_activity_pipe_test.cc + - test/core/promise/inter_activity_pipe_test.cc + deps: + - gtest + - absl/base:config + - absl/hash:hash + - absl/meta:type_traits + - absl/status:statusor + - gpr + uses_polling: false +- name: interception_chain_test + gtest: true + build: test + language: c++ + headers: + - src/core/channelz/channel_trace.h + - src/core/channelz/channelz.h + - src/core/channelz/channelz_registry.h + - src/core/ext/upb-gen/google/protobuf/any.upb.h + - src/core/ext/upb-gen/google/protobuf/any.upb_minitable.h + - src/core/ext/upb-gen/google/rpc/status.upb.h + - src/core/ext/upb-gen/google/rpc/status.upb_minitable.h + - src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb.h + - src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb_minitable.h + - src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h + - src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.h + - src/core/ext/upb-gen/src/proto/grpc/gcp/transport_security_common.upb.h + - src/core/ext/upb-gen/src/proto/grpc/gcp/transport_security_common.upb_minitable.h + - src/core/lib/address_utils/parse_address.h + - src/core/lib/address_utils/sockaddr_utils.h + - src/core/lib/avl/avl.h + - src/core/lib/backoff/backoff.h + - src/core/lib/channel/call_finalization.h + - src/core/lib/channel/call_tracer.h + - src/core/lib/channel/channel_args.h + - src/core/lib/channel/channel_args_preconditioning.h + - src/core/lib/channel/channel_fwd.h + - src/core/lib/channel/channel_stack.h + - src/core/lib/channel/channel_stack_builder.h + - src/core/lib/channel/channel_stack_builder_impl.h + - src/core/lib/channel/channel_stack_trace.h + - src/core/lib/channel/connected_channel.h + - src/core/lib/channel/context.h + - src/core/lib/channel/metrics.h + - src/core/lib/channel/promise_based_filter.h + - src/core/lib/channel/status_util.h + - src/core/lib/channel/tcp_tracer.h + - src/core/lib/compression/compression_internal.h + - src/core/lib/compression/message_compress.h + - src/core/lib/config/core_configuration.h + - src/core/lib/debug/event_log.h + - src/core/lib/debug/histogram_view.h + - src/core/lib/debug/stats.h + - src/core/lib/debug/stats_data.h + - src/core/lib/debug/trace.h + - src/core/lib/event_engine/ares_resolver.h + - src/core/lib/event_engine/cf_engine/cf_engine.h + - src/core/lib/event_engine/cf_engine/cfstream_endpoint.h + - src/core/lib/event_engine/cf_engine/cftype_unique_ref.h + - src/core/lib/event_engine/cf_engine/dns_service_resolver.h + - src/core/lib/event_engine/channel_args_endpoint_config.h + - src/core/lib/event_engine/common_closures.h + - src/core/lib/event_engine/default_event_engine.h + - src/core/lib/event_engine/default_event_engine_factory.h + - src/core/lib/event_engine/event_engine_context.h + - src/core/lib/event_engine/extensions/can_track_errors.h + - src/core/lib/event_engine/extensions/chaotic_good_extension.h + - src/core/lib/event_engine/extensions/supports_fd.h + - src/core/lib/event_engine/forkable.h + - src/core/lib/event_engine/grpc_polled_fd.h + - src/core/lib/event_engine/handle_containers.h + - src/core/lib/event_engine/memory_allocator_factory.h + - src/core/lib/event_engine/nameser.h + - src/core/lib/event_engine/poller.h + - src/core/lib/event_engine/posix.h + - src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h + - src/core/lib/event_engine/posix_engine/ev_poll_posix.h + - src/core/lib/event_engine/posix_engine/event_poller.h + - src/core/lib/event_engine/posix_engine/event_poller_posix_default.h + - src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h + - src/core/lib/event_engine/posix_engine/internal_errqueue.h + - src/core/lib/event_engine/posix_engine/lockfree_event.h + - src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.h + - src/core/lib/event_engine/posix_engine/posix_endpoint.h + - src/core/lib/event_engine/posix_engine/posix_engine.h + - src/core/lib/event_engine/posix_engine/posix_engine_closure.h + - src/core/lib/event_engine/posix_engine/posix_engine_listener.h + - src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h + - src/core/lib/event_engine/posix_engine/tcp_socket_utils.h + - src/core/lib/event_engine/posix_engine/timer.h + - src/core/lib/event_engine/posix_engine/timer_heap.h + - src/core/lib/event_engine/posix_engine/timer_manager.h + - src/core/lib/event_engine/posix_engine/traced_buffer_list.h + - src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h + - src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h + - src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h + - src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h + - src/core/lib/event_engine/query_extensions.h + - src/core/lib/event_engine/ref_counted_dns_resolver_interface.h + - src/core/lib/event_engine/resolved_address_internal.h + - src/core/lib/event_engine/shim.h + - src/core/lib/event_engine/tcp_socket_utils.h + - src/core/lib/event_engine/thread_pool/thread_count.h + - src/core/lib/event_engine/thread_pool/thread_pool.h + - src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h + - src/core/lib/event_engine/thready_event_engine/thready_event_engine.h + - src/core/lib/event_engine/time_util.h + - src/core/lib/event_engine/trace.h + - src/core/lib/event_engine/utils.h + - src/core/lib/event_engine/windows/grpc_polled_fd_windows.h + - src/core/lib/event_engine/windows/iocp.h + - src/core/lib/event_engine/windows/native_windows_dns_resolver.h + - src/core/lib/event_engine/windows/win_socket.h + - src/core/lib/event_engine/windows/windows_endpoint.h + - src/core/lib/event_engine/windows/windows_engine.h + - src/core/lib/event_engine/windows/windows_listener.h + - src/core/lib/event_engine/work_queue/basic_work_queue.h + - src/core/lib/event_engine/work_queue/work_queue.h + - src/core/lib/experiments/config.h + - src/core/lib/experiments/experiments.h + - src/core/lib/gpr/spinlock.h + - src/core/lib/gprpp/atomic_utils.h + - src/core/lib/gprpp/bitset.h + - src/core/lib/gprpp/chunked_vector.h + - src/core/lib/gprpp/cpp_impl_of.h + - src/core/lib/gprpp/down_cast.h + - src/core/lib/gprpp/dual_ref_counted.h + - src/core/lib/gprpp/if_list.h + - src/core/lib/gprpp/load_file.h + - src/core/lib/gprpp/manual_constructor.h + - src/core/lib/gprpp/match.h + - src/core/lib/gprpp/notification.h + - src/core/lib/gprpp/orphanable.h + - src/core/lib/gprpp/overload.h + - src/core/lib/gprpp/packed_table.h + - src/core/lib/gprpp/per_cpu.h + - src/core/lib/gprpp/ref_counted.h + - src/core/lib/gprpp/ref_counted_ptr.h + - src/core/lib/gprpp/ref_counted_string.h + - src/core/lib/gprpp/sorted_pack.h + - src/core/lib/gprpp/status_helper.h + - src/core/lib/gprpp/table.h + - src/core/lib/gprpp/time.h + - src/core/lib/gprpp/time_averaged_stats.h + - src/core/lib/gprpp/type_list.h + - src/core/lib/gprpp/unique_type_name.h + - src/core/lib/gprpp/validation_errors.h + - src/core/lib/gprpp/work_serializer.h + - src/core/lib/handshaker/proxy_mapper.h + - src/core/lib/handshaker/proxy_mapper_registry.h + - src/core/lib/iomgr/block_annotate.h + - src/core/lib/iomgr/buffer_list.h + - src/core/lib/iomgr/call_combiner.h + - src/core/lib/iomgr/cfstream_handle.h + - src/core/lib/iomgr/closure.h + - src/core/lib/iomgr/combiner.h + - src/core/lib/iomgr/dynamic_annotations.h + - src/core/lib/iomgr/endpoint.h + - src/core/lib/iomgr/endpoint_cfstream.h + - src/core/lib/iomgr/endpoint_pair.h + - src/core/lib/iomgr/error.h + - src/core/lib/iomgr/error_cfstream.h + - src/core/lib/iomgr/ev_apple.h + - src/core/lib/iomgr/ev_epoll1_linux.h + - src/core/lib/iomgr/ev_poll_posix.h + - src/core/lib/iomgr/ev_posix.h + - src/core/lib/iomgr/event_engine_shims/closure.h + - src/core/lib/iomgr/event_engine_shims/endpoint.h + - src/core/lib/iomgr/event_engine_shims/tcp_client.h + - src/core/lib/iomgr/exec_ctx.h + - src/core/lib/iomgr/executor.h + - src/core/lib/iomgr/gethostname.h + - src/core/lib/iomgr/grpc_if_nametoindex.h + - src/core/lib/iomgr/internal_errqueue.h + - src/core/lib/iomgr/iocp_windows.h + - src/core/lib/iomgr/iomgr.h + - src/core/lib/iomgr/iomgr_fwd.h + - src/core/lib/iomgr/iomgr_internal.h + - src/core/lib/iomgr/lockfree_event.h + - src/core/lib/iomgr/nameser.h + - src/core/lib/iomgr/polling_entity.h + - src/core/lib/iomgr/pollset.h + - src/core/lib/iomgr/pollset_set.h + - src/core/lib/iomgr/pollset_set_windows.h + - src/core/lib/iomgr/pollset_windows.h + - src/core/lib/iomgr/port.h + - src/core/lib/iomgr/python_util.h + - src/core/lib/iomgr/resolve_address.h + - src/core/lib/iomgr/resolve_address_impl.h + - src/core/lib/iomgr/resolve_address_posix.h + - src/core/lib/iomgr/resolve_address_windows.h + - src/core/lib/iomgr/resolved_address.h + - src/core/lib/iomgr/sockaddr.h + - src/core/lib/iomgr/sockaddr_posix.h + - src/core/lib/iomgr/sockaddr_windows.h + - src/core/lib/iomgr/socket_factory_posix.h + - src/core/lib/iomgr/socket_mutator.h + - src/core/lib/iomgr/socket_utils.h + - src/core/lib/iomgr/socket_utils_posix.h + - src/core/lib/iomgr/socket_windows.h + - src/core/lib/iomgr/systemd_utils.h + - src/core/lib/iomgr/tcp_client.h + - src/core/lib/iomgr/tcp_client_posix.h + - src/core/lib/iomgr/tcp_posix.h + - src/core/lib/iomgr/tcp_server.h + - src/core/lib/iomgr/tcp_server_utils_posix.h + - src/core/lib/iomgr/tcp_windows.h + - src/core/lib/iomgr/timer.h + - src/core/lib/iomgr/timer_generic.h + - src/core/lib/iomgr/timer_heap.h + - src/core/lib/iomgr/timer_manager.h + - src/core/lib/iomgr/unix_sockets_posix.h + - src/core/lib/iomgr/vsock.h + - src/core/lib/iomgr/wakeup_fd_pipe.h + - src/core/lib/iomgr/wakeup_fd_posix.h + - src/core/lib/json/json.h + - src/core/lib/json/json_args.h + - src/core/lib/json/json_writer.h + - src/core/lib/promise/activity.h + - src/core/lib/promise/all_ok.h + - src/core/lib/promise/arena_promise.h + - src/core/lib/promise/context.h + - src/core/lib/promise/detail/basic_seq.h + - src/core/lib/promise/detail/join_state.h + - src/core/lib/promise/detail/promise_factory.h + - src/core/lib/promise/detail/promise_like.h + - src/core/lib/promise/detail/seq_state.h + - src/core/lib/promise/detail/status.h + - src/core/lib/promise/exec_ctx_wakeup_scheduler.h + - src/core/lib/promise/for_each.h + - src/core/lib/promise/if.h + - src/core/lib/promise/interceptor_list.h + - src/core/lib/promise/latch.h + - src/core/lib/promise/loop.h + - src/core/lib/promise/map.h + - src/core/lib/promise/party.h + - src/core/lib/promise/pipe.h + - src/core/lib/promise/poll.h + - src/core/lib/promise/promise.h + - src/core/lib/promise/race.h + - src/core/lib/promise/seq.h + - src/core/lib/promise/status_flag.h + - src/core/lib/promise/trace.h + - src/core/lib/promise/try_seq.h + - src/core/lib/resource_quota/api.h + - src/core/lib/resource_quota/arena.h + - src/core/lib/resource_quota/connection_quota.h + - src/core/lib/resource_quota/memory_quota.h + - src/core/lib/resource_quota/periodic_update.h + - src/core/lib/resource_quota/resource_quota.h + - src/core/lib/resource_quota/thread_quota.h + - src/core/lib/resource_quota/trace.h + - src/core/lib/security/certificate_provider/certificate_provider_factory.h + - src/core/lib/security/certificate_provider/certificate_provider_registry.h + - src/core/lib/security/credentials/alts/check_gcp_environment.h + - src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h + - src/core/lib/security/credentials/channel_creds_registry.h + - src/core/lib/slice/percent_encoding.h + - src/core/lib/slice/slice.h + - src/core/lib/slice/slice_buffer.h + - src/core/lib/slice/slice_internal.h + - src/core/lib/slice/slice_refcount.h + - src/core/lib/slice/slice_string_helpers.h + - src/core/lib/surface/api_trace.h + - src/core/lib/surface/call.h + - src/core/lib/surface/call_test_only.h + - src/core/lib/surface/call_trace.h + - src/core/lib/surface/channel.h + - src/core/lib/surface/channel_init.h + - src/core/lib/surface/channel_stack_type.h + - src/core/lib/surface/completion_queue.h + - src/core/lib/surface/completion_queue_factory.h + - src/core/lib/surface/event_string.h + - src/core/lib/surface/init.h + - src/core/lib/surface/init_internally.h + - src/core/lib/surface/lame_client.h + - src/core/lib/surface/server_interface.h + - src/core/lib/surface/validate_metadata.h + - src/core/lib/surface/wait_for_cq_end_op.h + - src/core/lib/transport/batch_builder.h + - src/core/lib/transport/call_arena_allocator.h + - src/core/lib/transport/call_destination.h + - src/core/lib/transport/call_filters.h + - src/core/lib/transport/call_final_info.h + - src/core/lib/transport/call_spine.h + - src/core/lib/transport/connectivity_state.h + - src/core/lib/transport/custom_metadata.h + - src/core/lib/transport/error_utils.h + - src/core/lib/transport/handshaker_factory.h + - src/core/lib/transport/handshaker_registry.h + - src/core/lib/transport/http2_errors.h + - src/core/lib/transport/interception_chain.h + - src/core/lib/transport/message.h + - src/core/lib/transport/metadata.h + - src/core/lib/transport/metadata_batch.h + - src/core/lib/transport/metadata_compression_traits.h + - src/core/lib/transport/parsed_metadata.h + - src/core/lib/transport/simple_slice_based_metadata.h + - src/core/lib/transport/status_conversion.h + - src/core/lib/transport/timeout_encoding.h + - src/core/lib/transport/transport.h + - src/core/lib/transport/transport_fwd.h + - src/core/lib/uri/uri_parser.h + - src/core/load_balancing/backend_metric_data.h + - src/core/load_balancing/lb_policy.h + - src/core/load_balancing/lb_policy_factory.h + - src/core/load_balancing/lb_policy_registry.h + - src/core/load_balancing/subchannel_interface.h + - src/core/resolver/endpoint_addresses.h + - src/core/resolver/resolver.h + - src/core/resolver/resolver_factory.h + - src/core/resolver/resolver_registry.h + - src/core/resolver/server_address.h + - src/core/service_config/service_config.h + - src/core/service_config/service_config_call_data.h + - src/core/service_config/service_config_parser.h + - src/core/tsi/alts/handshaker/transport_security_common_api.h + - test/core/promise/poll_matcher.h + - third_party/upb/upb/generated_code_support.h + - third_party/upb/upb/mini_descriptor/build_enum.h + - third_party/upb/upb/mini_descriptor/decode.h + - third_party/upb/upb/mini_descriptor/internal/base92.h + - third_party/upb/upb/mini_descriptor/internal/decoder.h + - third_party/upb/upb/mini_descriptor/internal/encode.h + - third_party/upb/upb/mini_descriptor/internal/encode.hpp + - third_party/upb/upb/mini_descriptor/internal/modifiers.h + - third_party/upb/upb/mini_descriptor/internal/wire_constants.h + - third_party/upb/upb/mini_descriptor/link.h + - third_party/upb/upb/wire/decode.h + - third_party/upb/upb/wire/encode.h + - third_party/upb/upb/wire/eps_copy_input_stream.h + - third_party/upb/upb/wire/internal/constants.h + - third_party/upb/upb/wire/internal/decode_fast.h + - third_party/upb/upb/wire/internal/decoder.h + - third_party/upb/upb/wire/internal/reader.h + - third_party/upb/upb/wire/reader.h + - third_party/upb/upb/wire/types.h + src: + - src/core/channelz/channel_trace.cc + - src/core/channelz/channelz.cc + - src/core/channelz/channelz_registry.cc + - src/core/ext/upb-gen/google/protobuf/any.upb_minitable.c + - src/core/ext/upb-gen/google/rpc/status.upb_minitable.c + - src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb_minitable.c + - src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c + - src/core/ext/upb-gen/src/proto/grpc/gcp/transport_security_common.upb_minitable.c + - src/core/lib/address_utils/parse_address.cc + - src/core/lib/address_utils/sockaddr_utils.cc + - src/core/lib/backoff/backoff.cc + - src/core/lib/channel/call_tracer.cc + - src/core/lib/channel/channel_args.cc + - src/core/lib/channel/channel_args_preconditioning.cc + - src/core/lib/channel/channel_stack.cc + - src/core/lib/channel/channel_stack_builder.cc + - src/core/lib/channel/channel_stack_builder_impl.cc + - src/core/lib/channel/channel_stack_trace.cc + - src/core/lib/channel/connected_channel.cc + - src/core/lib/channel/metrics.cc + - src/core/lib/channel/promise_based_filter.cc + - src/core/lib/channel/status_util.cc + - src/core/lib/compression/compression.cc + - src/core/lib/compression/compression_internal.cc + - src/core/lib/compression/message_compress.cc + - src/core/lib/config/core_configuration.cc + - src/core/lib/debug/event_log.cc + - src/core/lib/debug/histogram_view.cc + - src/core/lib/debug/stats.cc + - src/core/lib/debug/stats_data.cc + - src/core/lib/debug/trace.cc + - src/core/lib/event_engine/ares_resolver.cc + - src/core/lib/event_engine/cf_engine/cf_engine.cc + - src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc + - src/core/lib/event_engine/cf_engine/dns_service_resolver.cc + - src/core/lib/event_engine/channel_args_endpoint_config.cc + - src/core/lib/event_engine/default_event_engine.cc + - src/core/lib/event_engine/default_event_engine_factory.cc + - src/core/lib/event_engine/event_engine.cc + - src/core/lib/event_engine/forkable.cc + - src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc + - src/core/lib/event_engine/posix_engine/ev_poll_posix.cc + - src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc + - src/core/lib/event_engine/posix_engine/internal_errqueue.cc + - src/core/lib/event_engine/posix_engine/lockfree_event.cc + - src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc + - src/core/lib/event_engine/posix_engine/posix_endpoint.cc + - src/core/lib/event_engine/posix_engine/posix_engine.cc + - src/core/lib/event_engine/posix_engine/posix_engine_listener.cc + - src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc + - src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc + - src/core/lib/event_engine/posix_engine/timer.cc + - src/core/lib/event_engine/posix_engine/timer_heap.cc + - src/core/lib/event_engine/posix_engine/timer_manager.cc + - src/core/lib/event_engine/posix_engine/traced_buffer_list.cc + - src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc + - src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc + - src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.cc + - src/core/lib/event_engine/resolved_address.cc + - src/core/lib/event_engine/shim.cc + - src/core/lib/event_engine/slice.cc + - src/core/lib/event_engine/slice_buffer.cc + - src/core/lib/event_engine/tcp_socket_utils.cc + - src/core/lib/event_engine/thread_pool/thread_count.cc + - src/core/lib/event_engine/thread_pool/thread_pool_factory.cc + - src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc + - src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc + - src/core/lib/event_engine/time_util.cc + - src/core/lib/event_engine/trace.cc + - src/core/lib/event_engine/utils.cc + - src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc + - src/core/lib/event_engine/windows/iocp.cc + - src/core/lib/event_engine/windows/native_windows_dns_resolver.cc + - src/core/lib/event_engine/windows/win_socket.cc + - src/core/lib/event_engine/windows/windows_endpoint.cc + - src/core/lib/event_engine/windows/windows_engine.cc + - src/core/lib/event_engine/windows/windows_listener.cc + - src/core/lib/event_engine/work_queue/basic_work_queue.cc + - src/core/lib/experiments/config.cc + - src/core/lib/experiments/experiments.cc + - src/core/lib/gprpp/load_file.cc + - src/core/lib/gprpp/per_cpu.cc + - src/core/lib/gprpp/ref_counted_string.cc + - src/core/lib/gprpp/status_helper.cc + - src/core/lib/gprpp/time.cc + - src/core/lib/gprpp/time_averaged_stats.cc + - src/core/lib/gprpp/validation_errors.cc + - src/core/lib/gprpp/work_serializer.cc + - src/core/lib/handshaker/proxy_mapper_registry.cc + - src/core/lib/iomgr/buffer_list.cc + - src/core/lib/iomgr/call_combiner.cc + - src/core/lib/iomgr/cfstream_handle.cc + - src/core/lib/iomgr/closure.cc + - src/core/lib/iomgr/combiner.cc + - src/core/lib/iomgr/dualstack_socket_posix.cc + - src/core/lib/iomgr/endpoint.cc + - src/core/lib/iomgr/endpoint_cfstream.cc + - src/core/lib/iomgr/endpoint_pair_posix.cc + - src/core/lib/iomgr/endpoint_pair_windows.cc + - src/core/lib/iomgr/error.cc + - src/core/lib/iomgr/error_cfstream.cc + - src/core/lib/iomgr/ev_apple.cc + - src/core/lib/iomgr/ev_epoll1_linux.cc + - src/core/lib/iomgr/ev_poll_posix.cc + - src/core/lib/iomgr/ev_posix.cc + - src/core/lib/iomgr/ev_windows.cc + - src/core/lib/iomgr/event_engine_shims/closure.cc + - src/core/lib/iomgr/event_engine_shims/endpoint.cc + - src/core/lib/iomgr/event_engine_shims/tcp_client.cc + - src/core/lib/iomgr/exec_ctx.cc + - src/core/lib/iomgr/executor.cc + - src/core/lib/iomgr/fork_posix.cc + - src/core/lib/iomgr/fork_windows.cc + - src/core/lib/iomgr/gethostname_fallback.cc + - src/core/lib/iomgr/gethostname_host_name_max.cc + - src/core/lib/iomgr/gethostname_sysconf.cc + - src/core/lib/iomgr/grpc_if_nametoindex_posix.cc + - src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc + - src/core/lib/iomgr/internal_errqueue.cc + - src/core/lib/iomgr/iocp_windows.cc + - src/core/lib/iomgr/iomgr.cc + - src/core/lib/iomgr/iomgr_internal.cc + - src/core/lib/iomgr/iomgr_posix.cc + - src/core/lib/iomgr/iomgr_posix_cfstream.cc + - src/core/lib/iomgr/iomgr_windows.cc + - src/core/lib/iomgr/lockfree_event.cc + - src/core/lib/iomgr/polling_entity.cc + - src/core/lib/iomgr/pollset.cc + - src/core/lib/iomgr/pollset_set.cc + - src/core/lib/iomgr/pollset_set_windows.cc + - src/core/lib/iomgr/pollset_windows.cc + - src/core/lib/iomgr/resolve_address.cc + - src/core/lib/iomgr/resolve_address_posix.cc + - src/core/lib/iomgr/resolve_address_windows.cc + - src/core/lib/iomgr/sockaddr_utils_posix.cc + - src/core/lib/iomgr/socket_factory_posix.cc + - src/core/lib/iomgr/socket_mutator.cc + - src/core/lib/iomgr/socket_utils_common_posix.cc + - src/core/lib/iomgr/socket_utils_linux.cc + - src/core/lib/iomgr/socket_utils_posix.cc + - src/core/lib/iomgr/socket_utils_windows.cc + - src/core/lib/iomgr/socket_windows.cc + - src/core/lib/iomgr/systemd_utils.cc + - src/core/lib/iomgr/tcp_client.cc + - src/core/lib/iomgr/tcp_client_cfstream.cc + - src/core/lib/iomgr/tcp_client_posix.cc + - src/core/lib/iomgr/tcp_client_windows.cc + - src/core/lib/iomgr/tcp_posix.cc + - src/core/lib/iomgr/tcp_server.cc + - src/core/lib/iomgr/tcp_server_posix.cc + - src/core/lib/iomgr/tcp_server_utils_posix_common.cc + - src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc + - src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc + - src/core/lib/iomgr/tcp_server_windows.cc + - src/core/lib/iomgr/tcp_windows.cc + - src/core/lib/iomgr/timer.cc + - src/core/lib/iomgr/timer_generic.cc + - src/core/lib/iomgr/timer_heap.cc + - src/core/lib/iomgr/timer_manager.cc + - src/core/lib/iomgr/unix_sockets_posix.cc + - src/core/lib/iomgr/unix_sockets_posix_noop.cc + - src/core/lib/iomgr/vsock.cc + - src/core/lib/iomgr/wakeup_fd_eventfd.cc + - src/core/lib/iomgr/wakeup_fd_nospecial.cc + - src/core/lib/iomgr/wakeup_fd_pipe.cc + - src/core/lib/iomgr/wakeup_fd_posix.cc + - src/core/lib/json/json_writer.cc + - src/core/lib/promise/activity.cc + - src/core/lib/promise/party.cc + - src/core/lib/promise/trace.cc + - src/core/lib/resource_quota/api.cc + - src/core/lib/resource_quota/arena.cc + - src/core/lib/resource_quota/connection_quota.cc + - src/core/lib/resource_quota/memory_quota.cc + - src/core/lib/resource_quota/periodic_update.cc + - src/core/lib/resource_quota/resource_quota.cc + - src/core/lib/resource_quota/thread_quota.cc + - src/core/lib/resource_quota/trace.cc + - src/core/lib/security/certificate_provider/certificate_provider_registry.cc + - src/core/lib/security/credentials/alts/check_gcp_environment.cc + - src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc + - src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc + - src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc + - src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc + - src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc + - src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc + - src/core/lib/slice/percent_encoding.cc + - src/core/lib/slice/slice.cc + - src/core/lib/slice/slice_buffer.cc + - src/core/lib/slice/slice_refcount.cc + - src/core/lib/slice/slice_string_helpers.cc + - src/core/lib/surface/api_trace.cc + - src/core/lib/surface/byte_buffer.cc + - src/core/lib/surface/byte_buffer_reader.cc + - src/core/lib/surface/call.cc + - src/core/lib/surface/call_details.cc + - src/core/lib/surface/call_log_batch.cc + - src/core/lib/surface/channel.cc + - src/core/lib/surface/channel_init.cc + - src/core/lib/surface/channel_stack_type.cc + - src/core/lib/surface/completion_queue.cc + - src/core/lib/surface/completion_queue_factory.cc + - src/core/lib/surface/event_string.cc + - src/core/lib/surface/init_internally.cc + - src/core/lib/surface/lame_client.cc + - src/core/lib/surface/metadata_array.cc + - src/core/lib/surface/validate_metadata.cc + - src/core/lib/surface/version.cc + - src/core/lib/surface/wait_for_cq_end_op.cc + - src/core/lib/transport/batch_builder.cc + - src/core/lib/transport/call_arena_allocator.cc + - src/core/lib/transport/call_filters.cc + - src/core/lib/transport/call_final_info.cc + - src/core/lib/transport/call_spine.cc + - src/core/lib/transport/connectivity_state.cc + - src/core/lib/transport/error_utils.cc + - src/core/lib/transport/handshaker_registry.cc + - src/core/lib/transport/interception_chain.cc + - src/core/lib/transport/message.cc + - src/core/lib/transport/metadata.cc + - src/core/lib/transport/metadata_batch.cc + - src/core/lib/transport/parsed_metadata.cc + - src/core/lib/transport/status_conversion.cc + - src/core/lib/transport/timeout_encoding.cc + - src/core/lib/transport/transport.cc + - src/core/lib/transport/transport_op_string.cc + - src/core/lib/uri/uri_parser.cc + - src/core/load_balancing/lb_policy.cc + - src/core/load_balancing/lb_policy_registry.cc + - src/core/resolver/endpoint_addresses.cc + - src/core/resolver/resolver.cc + - src/core/resolver/resolver_registry.cc + - src/core/service_config/service_config_parser.cc + - src/core/tsi/alts/handshaker/transport_security_common_api.cc + - test/core/transport/interception_chain_test.cc + - third_party/upb/upb/mini_descriptor/build_enum.c + - third_party/upb/upb/mini_descriptor/decode.c + - third_party/upb/upb/mini_descriptor/internal/base92.c + - third_party/upb/upb/mini_descriptor/internal/encode.c + - third_party/upb/upb/mini_descriptor/link.c + - third_party/upb/upb/wire/decode.c + - third_party/upb/upb/wire/encode.c + - third_party/upb/upb/wire/eps_copy_input_stream.c + - third_party/upb/upb/wire/internal/decode_fast.c + - third_party/upb/upb/wire/reader.c deps: - gtest + - utf8_range_lib + - upb_message_lib + - z - absl/base:config + - absl/base:no_destructor + - absl/cleanup:cleanup + - absl/container:flat_hash_map + - absl/container:inlined_vector + - absl/functional:function_ref - absl/hash:hash - absl/meta:type_traits - absl/status:statusor + - absl/types:span + - absl/utility:utility + - cares - gpr + - address_sorting uses_polling: false - name: interceptor_list_test gtest: true @@ -11785,7 +12317,6 @@ targets: - test/cpp/interop/client_helper.cc - test/cpp/interop/interop_client.cc deps: - - absl/log:check - grpc++_test_config - grpc++_test_util - name: interop_server @@ -11803,7 +12334,6 @@ targets: - test/cpp/interop/interop_server_bootstrap.cc - test/cpp/interop/server_helper.cc deps: - - absl/log:check - grpc++_test_config - grpc++_test_util - name: invalid_call_argument_test @@ -11878,7 +12408,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -11893,7 +12422,6 @@ targets: - test/core/event_engine/windows/iocp_test.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -12082,7 +12610,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -12158,7 +12685,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -12569,7 +13095,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -12633,7 +13158,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -12697,7 +13221,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -12761,7 +13284,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -12806,7 +13328,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: message_compress_test gtest: true @@ -13048,7 +13569,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -13124,7 +13644,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -13188,7 +13707,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -13217,7 +13735,6 @@ targets: - test/cpp/end2end/nonblocking_test.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: notification_test gtest: true @@ -13262,6 +13779,7 @@ targets: - src/core/lib/promise/map.h - src/core/lib/promise/observable.h - src/core/lib/promise/poll.h + - test/core/promise/poll_matcher.h src: - src/core/lib/promise/activity.cc - test/core/promise/observable_test.cc @@ -13292,7 +13810,6 @@ targets: - test/core/event_engine/test_suite/tests/server_test.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -13359,7 +13876,6 @@ targets: - test/cpp/ext/otel/otel_test_library.cc deps: - gtest - - absl/log:check - opentelemetry-cpp::api - opentelemetry-cpp::metrics - grpc++_test_util @@ -13376,7 +13892,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: outlier_detection_lb_config_parser_test gtest: true @@ -13385,7 +13900,7 @@ targets: headers: - test/core/util/scoped_env_var.h src: - - test/core/client_channel/lb_policy/outlier_detection_lb_config_parser_test.cc + - test/core/load_balancing/outlier_detection_lb_config_parser_test.cc deps: - gtest - grpc_test_util @@ -13395,17 +13910,16 @@ targets: build: test language: c++ headers: - - test/core/client_channel/lb_policy/lb_policy_test_lib.h - test/core/event_engine/event_engine_test_utils.h - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h + - test/core/load_balancing/lb_policy_test_lib.h src: - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto - - test/core/client_channel/lb_policy/outlier_detection_test.cc - test/core/event_engine/event_engine_test_utils.cc - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + - test/core/load_balancing/outlier_detection_test.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util uses_polling: false @@ -13564,7 +14078,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -13672,20 +14185,19 @@ targets: build: test language: c++ headers: - - test/core/client_channel/lb_policy/lb_policy_test_lib.h - test/core/event_engine/event_engine_test_utils.h - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h + - test/core/load_balancing/lb_policy_test_lib.h - test/core/util/fake_stats_plugin.h - test/core/util/scoped_env_var.h src: - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto - - test/core/client_channel/lb_policy/pick_first_test.cc - test/core/event_engine/event_engine_test_utils.cc - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + - test/core/load_balancing/pick_first_test.cc - test/core/util/fake_stats_plugin.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util uses_polling: false @@ -13823,7 +14335,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -13918,7 +14429,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -13962,7 +14472,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: posix_endpoint_test gtest: true @@ -13981,7 +14490,6 @@ targets: - test/core/event_engine/test_suite/posix/oracle_event_engine_posix.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -14016,7 +14524,6 @@ targets: - test/core/event_engine/test_suite/posix/oracle_event_engine_posix.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -14044,7 +14551,6 @@ targets: - test/cpp/util/windows/manifest_file.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -14078,7 +14584,6 @@ targets: - test/cpp/util/windows/manifest_file.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -14269,7 +14774,6 @@ targets: - test/cpp/util/proto_reflection_descriptor_database.cc deps: - gtest - - absl/log:check - grpc++_reflection - grpc++_test_util - name: proto_utils_test @@ -14344,7 +14848,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -14388,7 +14891,6 @@ targets: - test/cpp/qps/server_sync.cc - test/cpp/qps/usage_timer.cc deps: - - absl/log:check - grpc++_test_config - grpc++_test_util - name: qps_worker @@ -14422,7 +14924,6 @@ targets: - test/cpp/qps/usage_timer.cc - test/cpp/qps/worker.cc deps: - - absl/log:check - grpc++_test_config - grpc++_test_util - name: query_extensions_test @@ -14482,7 +14983,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: rbac_service_config_parser_test gtest: true @@ -14606,7 +15106,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -14619,7 +15118,6 @@ targets: - test/core/transport/chttp2/remove_stream_from_stalled_lists_test.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -14685,7 +15183,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -14749,7 +15246,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -14820,6 +15316,7 @@ targets: - test/core/util/tracer_util.cc deps: - gtest + - absl/log:check - grpc_test_util - grpc++_test_config - name: resolve_address_using_native_resolver_posix_test @@ -14889,6 +15386,7 @@ targets: - test/core/util/tracer_util.cc deps: - gtest + - absl/log:check - grpc_test_util - grpc++_test_config - name: resource_quota_end2end_stress_test @@ -14965,7 +15463,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15040,7 +15537,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15104,7 +15600,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15168,7 +15663,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15232,7 +15726,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15296,7 +15789,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15360,7 +15852,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15424,7 +15915,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15488,7 +15978,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15552,7 +16041,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15616,7 +16104,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15680,7 +16167,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15744,7 +16230,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15808,7 +16293,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15872,7 +16356,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -15936,7 +16419,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16000,7 +16482,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16064,7 +16545,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16128,7 +16608,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16192,7 +16671,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16256,7 +16734,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16320,7 +16797,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16384,7 +16860,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16448,7 +16923,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16523,7 +16997,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16587,7 +17060,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16651,7 +17123,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16715,7 +17186,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16790,7 +17260,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16854,7 +17323,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16918,7 +17386,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -16982,7 +17449,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -17046,7 +17512,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -17110,7 +17575,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -17174,7 +17638,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -17183,17 +17646,16 @@ targets: build: test language: c++ headers: - - test/core/client_channel/lb_policy/lb_policy_test_lib.h - test/core/event_engine/event_engine_test_utils.h - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h + - test/core/load_balancing/lb_policy_test_lib.h src: - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto - - test/core/client_channel/lb_policy/ring_hash_test.cc - test/core/event_engine/event_engine_test_utils.cc - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + - test/core/load_balancing/ring_hash_test.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util uses_polling: false @@ -17222,7 +17684,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_config - grpc++_test_util - name: rls_lb_config_parser_test @@ -17231,7 +17692,7 @@ targets: language: c++ headers: [] src: - - test/core/client_channel/lb_policy/rls_lb_config_parser_test.cc + - test/core/load_balancing/rls_lb_config_parser_test.cc deps: - gtest - grpc_test_util @@ -17241,17 +17702,16 @@ targets: build: test language: c++ headers: - - test/core/client_channel/lb_policy/lb_policy_test_lib.h - test/core/event_engine/event_engine_test_utils.h - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h + - test/core/load_balancing/lb_policy_test_lib.h src: - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto - - test/core/client_channel/lb_policy/round_robin_test.cc - test/core/event_engine/event_engine_test_utils.cc - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + - test/core/load_balancing/round_robin_test.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util uses_polling: false @@ -17307,6 +17767,7 @@ targets: - test/core/util/tracer_util.cc deps: - gtest + - absl/log:check - grpc_test_util - name: security_connector_test gtest: true @@ -17387,7 +17848,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: server_builder_test gtest: true @@ -17583,7 +18043,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -17604,7 +18063,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: server_registered_method_bad_client_test gtest: true @@ -17619,7 +18077,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: server_request_call_test gtest: true @@ -17736,7 +18193,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -17766,7 +18222,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: service_config_test gtest: true @@ -17807,7 +18262,6 @@ targets: - test/core/util/tracer_util.cc deps: - gtest - - absl/log:check - grpc_test_util - name: shutdown_finishes_calls_test gtest: true @@ -17869,7 +18323,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -17933,7 +18386,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -17951,7 +18403,6 @@ targets: - test/cpp/end2end/shutdown_test.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: simple_delayed_request_test gtest: true @@ -18013,7 +18464,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -18077,7 +18527,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -18094,7 +18543,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: simple_request_test gtest: true @@ -18156,7 +18604,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -18223,7 +18670,7 @@ targets: language: c++ headers: [] src: - - test/core/client_channel/resolvers/sockaddr_resolver_test.cc + - test/core/resolver/sockaddr_resolver_test.cc deps: - gtest - grpc_test_util @@ -18266,6 +18713,7 @@ targets: - test/core/util/tracer_util.cc deps: - gtest + - absl/log:check - grpc_test_util platforms: - linux @@ -18305,7 +18753,6 @@ targets: - test/core/tsi/transport_security_test_lib.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -18322,7 +18769,6 @@ targets: - test/core/tsi/transport_security_test_lib.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -18362,7 +18808,7 @@ targets: - src/core/load_balancing/weighted_round_robin/static_stride_scheduler.h src: - src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc - - test/core/client_channel/lb_policy/static_stride_scheduler_test.cc + - test/core/load_balancing/static_stride_scheduler_test.cc deps: - gtest - absl/types:span @@ -18455,7 +18901,6 @@ targets: - test/core/transport/chttp2/stream_leak_with_queued_flow_control_update_test.cc deps: - gtest - - absl/log:check - grpc_test_util - name: streaming_error_response_test gtest: true @@ -18517,7 +18962,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -18571,7 +19015,6 @@ targets: - test/core/util/tracer_util.cc deps: - gtest - - absl/log:check - grpc_test_util - name: string_ref_test gtest: true @@ -18750,6 +19193,7 @@ targets: - test/core/util/tracer_util.cc deps: - gtest + - absl/log:check - grpc_test_util platforms: - linux @@ -18800,7 +19244,7 @@ targets: - absl/log:check - grpc uses_polling: false -- name: test_core_channel_channelz_test +- name: test_core_channelz_channelz_test gtest: true build: test language: c++ @@ -18809,12 +19253,11 @@ targets: - test/cpp/util/channel_trace_proto_helper.h src: - src/proto/grpc/channelz/channelz.proto - - test/core/channel/channelz_test.cc + - test/core/channelz/channelz_test.cc - test/core/event_engine/event_engine_test_utils.cc - test/cpp/util/channel_trace_proto_helper.cc deps: - gtest - - absl/log:check - grpc++ - grpc_test_util - name: test_core_end2end_channelz_test @@ -18877,7 +19320,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -19042,7 +19484,6 @@ targets: - test/core/util/tracer_util.cc deps: - gtest - - absl/log:check - grpc_test_util - name: test_core_security_ssl_credentials_test gtest: true @@ -19137,7 +19578,6 @@ targets: - test/core/transport/test_suite/test_main.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util platforms: @@ -19155,6 +19595,7 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest + - absl/log:check - grpc++ - grpc_test_util - name: test_cpp_end2end_ssl_credentials_test @@ -19172,7 +19613,6 @@ targets: - test/cpp/end2end/test_service_impl.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: test_cpp_ext_chaotic_good_test gtest: true @@ -19223,6 +19663,7 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest + - absl/log:check - grpc++ - grpc_test_util - name: test_cpp_util_slice_test @@ -19339,7 +19780,6 @@ targets: - test/core/event_engine/test_suite/thready_posix_event_engine_test.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -19355,6 +19795,7 @@ targets: - test/cpp/common/time_jump_test.cc deps: - gtest + - absl/log:check - grpc++ - grpc_test_util platforms: @@ -19432,7 +19873,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -19488,6 +19928,7 @@ targets: - test/cpp/common/timer_test.cc deps: - gtest + - absl/log:check - grpc++ - grpc_test_util - name: tls_certificate_verifier_test @@ -19518,7 +19959,6 @@ targets: - test/cpp/end2end/tls_credentials_test.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: tls_key_export_test gtest: true @@ -19533,7 +19973,6 @@ targets: - test/cpp/end2end/tls_key_export_test.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: tls_security_connector_test gtest: true @@ -19577,7 +20016,6 @@ targets: - test/core/transport/chttp2/too_many_pings_test.cc deps: - gtest - - absl/log:check - grpc++_test_config - grpc++_test_util - name: traced_buffer_list_test @@ -19589,7 +20027,6 @@ targets: - test/core/event_engine/posix/traced_buffer_list_test.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -19656,7 +20093,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -19875,7 +20311,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: uri_parser_test gtest: true @@ -19983,7 +20418,7 @@ targets: headers: - test/core/util/fake_stats_plugin.h src: - - test/core/client_channel/lb_policy/weighted_round_robin_config_test.cc + - test/core/load_balancing/weighted_round_robin_config_test.cc - test/core/util/fake_stats_plugin.cc deps: - gtest @@ -19994,19 +20429,18 @@ targets: build: test language: c++ headers: - - test/core/client_channel/lb_policy/lb_policy_test_lib.h - test/core/event_engine/event_engine_test_utils.h - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h + - test/core/load_balancing/lb_policy_test_lib.h - test/core/util/fake_stats_plugin.h src: - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto - - test/core/client_channel/lb_policy/weighted_round_robin_test.cc - test/core/event_engine/event_engine_test_utils.cc - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + - test/core/load_balancing/weighted_round_robin_test.cc - test/core/util/fake_stats_plugin.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util uses_polling: false @@ -20021,7 +20455,6 @@ targets: - test/core/event_engine/windows/win_socket_test.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -20041,7 +20474,6 @@ targets: - test/core/end2end/cq_verifier.cc deps: - gtest - - absl/log:check - grpc_test_util - name: windows_endpoint_test gtest: true @@ -20054,7 +20486,6 @@ targets: - test/core/event_engine/windows/windows_endpoint_test.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -20291,7 +20722,6 @@ targets: - test/core/gprpp/work_serializer_test.cc deps: - gtest - - absl/log:check - grpc_test_util platforms: - linux @@ -20357,7 +20787,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -20421,7 +20850,6 @@ targets: - test/core/util/test_lb_policies.cc deps: - gtest - - absl/log:check - grpc_authorization_provider - grpc_unsecure - grpc_test_util @@ -20479,7 +20907,6 @@ targets: - test/cpp/performance/writes_per_rpc_test.cc deps: - gtest - - absl/log:check - grpc++ - grpc_test_util platforms: @@ -20625,7 +21052,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -20718,7 +21144,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -20812,7 +21237,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -20833,7 +21257,6 @@ targets: - test/cpp/end2end/xds/xds_credentials_end2end_test.cc deps: - gtest - - absl/log:check - grpc++_test_util - name: xds_credentials_test gtest: true @@ -20920,7 +21343,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -20986,7 +21408,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_config - grpc++_test_util platforms: @@ -21064,7 +21485,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -21124,7 +21544,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -21319,7 +21738,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -21380,7 +21798,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -21392,7 +21809,7 @@ targets: language: c++ headers: [] src: - - test/core/client_channel/lb_policy/xds_override_host_lb_config_parser_test.cc + - test/core/load_balancing/xds_override_host_lb_config_parser_test.cc deps: - gtest - grpc_test_util @@ -21402,17 +21819,16 @@ targets: build: test language: c++ headers: - - test/core/client_channel/lb_policy/lb_policy_test_lib.h - test/core/event_engine/event_engine_test_utils.h - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h + - test/core/load_balancing/lb_policy_test_lib.h src: - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto - - test/core/client_channel/lb_policy/xds_override_host_test.cc - test/core/event_engine/event_engine_test_utils.cc - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc + - test/core/load_balancing/xds_override_host_test.cc deps: - gtest - - absl/log:check - protobuf - grpc_test_util uses_polling: false @@ -21472,7 +21888,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -21533,7 +21948,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -21595,7 +22009,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -21698,7 +22111,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux @@ -21727,7 +22139,6 @@ targets: - test/cpp/interop/xds_stats_watcher_test.cc deps: - gtest - - absl/log:check - grpc++_reflection - grpcpp_channelz - grpc_test_util @@ -21788,7 +22199,6 @@ targets: - test/cpp/util/tls_test_utils.cc deps: - gtest - - absl/log:check - grpc++_test_util platforms: - linux diff --git a/config.m4 b/config.m4 index d103e945a6b..2c5894bb9f5 100644 --- a/config.m4 +++ b/config.m4 @@ -41,8 +41,10 @@ if test "$PHP_GRPC" != "no"; then PHP_SUBST(GRPC_SHARED_LIBADD) PHP_NEW_EXTENSION(grpc, + src/core/channelz/channel_trace.cc \ + src/core/channelz/channelz.cc \ + src/core/channelz/channelz_registry.cc \ src/core/client_channel/backup_poller.cc \ - src/core/client_channel/client_channel_channelz.cc \ src/core/client_channel/client_channel_factory.cc \ src/core/client_channel/client_channel_filter.cc \ src/core/client_channel/client_channel_plugin.cc \ @@ -467,9 +469,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/channel/channel_stack_builder.cc \ src/core/lib/channel/channel_stack_builder_impl.cc \ src/core/lib/channel/channel_stack_trace.cc \ - src/core/lib/channel/channel_trace.cc \ - src/core/lib/channel/channelz.cc \ - src/core/lib/channel/channelz_registry.cc \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/metrics.cc \ src/core/lib/channel/promise_based_filter.cc \ @@ -782,9 +781,9 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/surface/wait_for_cq_end_op.cc \ src/core/lib/transport/batch_builder.cc \ src/core/lib/transport/bdp_estimator.cc \ + src/core/lib/transport/call_arena_allocator.cc \ src/core/lib/transport/call_filters.cc \ src/core/lib/transport/call_final_info.cc \ - src/core/lib/transport/call_size_estimator.cc \ src/core/lib/transport/call_spine.cc \ src/core/lib/transport/connectivity_state.cc \ src/core/lib/transport/endpoint_info_handshaker.cc \ @@ -1383,6 +1382,7 @@ if test "$PHP_GRPC" != "no"; then -DGRPC_XDS_USER_AGENT_NAME_SUFFIX='"\"PHP\""' \ -DGRPC_XDS_USER_AGENT_VERSION_SUFFIX='"\"1.64.0dev\""') + PHP_ADD_BUILD_DIR($ext_builddir/src/core/channelz) PHP_ADD_BUILD_DIR($ext_builddir/src/core/client_channel) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/backend_metrics) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/census) diff --git a/config.w32 b/config.w32 index f5fc445b434..5e407c53995 100644 --- a/config.w32 +++ b/config.w32 @@ -6,8 +6,10 @@ ARG_WITH("grpc", "grpc support", "no"); if (PHP_GRPC != "no") { EXTENSION("grpc", + "src\\core\\channelz\\channel_trace.cc " + + "src\\core\\channelz\\channelz.cc " + + "src\\core\\channelz\\channelz_registry.cc " + "src\\core\\client_channel\\backup_poller.cc " + - "src\\core\\client_channel\\client_channel_channelz.cc " + "src\\core\\client_channel\\client_channel_factory.cc " + "src\\core\\client_channel\\client_channel_filter.cc " + "src\\core\\client_channel\\client_channel_plugin.cc " + @@ -432,9 +434,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\channel\\channel_stack_builder.cc " + "src\\core\\lib\\channel\\channel_stack_builder_impl.cc " + "src\\core\\lib\\channel\\channel_stack_trace.cc " + - "src\\core\\lib\\channel\\channel_trace.cc " + - "src\\core\\lib\\channel\\channelz.cc " + - "src\\core\\lib\\channel\\channelz_registry.cc " + "src\\core\\lib\\channel\\connected_channel.cc " + "src\\core\\lib\\channel\\metrics.cc " + "src\\core\\lib\\channel\\promise_based_filter.cc " + @@ -747,9 +746,9 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\surface\\wait_for_cq_end_op.cc " + "src\\core\\lib\\transport\\batch_builder.cc " + "src\\core\\lib\\transport\\bdp_estimator.cc " + + "src\\core\\lib\\transport\\call_arena_allocator.cc " + "src\\core\\lib\\transport\\call_filters.cc " + "src\\core\\lib\\transport\\call_final_info.cc " + - "src\\core\\lib\\transport\\call_size_estimator.cc " + "src\\core\\lib\\transport\\call_spine.cc " + "src\\core\\lib\\transport\\connectivity_state.cc " + "src\\core\\lib\\transport\\endpoint_info_handshaker.cc " + @@ -1375,6 +1374,7 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\channelz"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\client_channel"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters"); diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 9114af3c0d9..0f4908c8e2b 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -225,7 +225,7 @@ Pod::Spec.new do |s| ss.dependency "#{s.name}/Privacy", version ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', version - abseil_version = '1.20240116.1' + abseil_version = '~> 1.20240116.2' ss.dependency 'abseil/algorithm/container', abseil_version ss.dependency 'abseil/base/base', abseil_version ss.dependency 'abseil/base/config', abseil_version @@ -242,6 +242,7 @@ Pod::Spec.new do |s| ss.dependency 'abseil/functional/bind_front', abseil_version ss.dependency 'abseil/functional/function_ref', abseil_version ss.dependency 'abseil/hash/hash', abseil_version + ss.dependency 'abseil/log/check', abseil_version ss.dependency 'abseil/log/log', abseil_version ss.dependency 'abseil/memory/memory', abseil_version ss.dependency 'abseil/meta/type_traits', abseil_version @@ -260,8 +261,10 @@ Pod::Spec.new do |s| ss.dependency 'abseil/types/variant', abseil_version ss.dependency 'abseil/utility/utility', abseil_version - ss.source_files = 'src/core/client_channel/backup_poller.h', - 'src/core/client_channel/client_channel_channelz.h', + ss.source_files = 'src/core/channelz/channel_trace.h', + 'src/core/channelz/channelz.h', + 'src/core/channelz/channelz_registry.h', + 'src/core/client_channel/backup_poller.h', 'src/core/client_channel/client_channel_factory.h', 'src/core/client_channel/client_channel_filter.h', 'src/core/client_channel/client_channel_internal.h', @@ -900,9 +903,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_stack_builder.h', 'src/core/lib/channel/channel_stack_builder_impl.h', 'src/core/lib/channel/channel_stack_trace.h', - 'src/core/lib/channel/channel_trace.h', - 'src/core/lib/channel/channelz.h', - 'src/core/lib/channel/channelz_registry.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/metrics.h', @@ -1242,9 +1242,9 @@ Pod::Spec.new do |s| 'src/core/lib/surface/wait_for_cq_end_op.h', 'src/core/lib/transport/batch_builder.h', 'src/core/lib/transport/bdp_estimator.h', + 'src/core/lib/transport/call_arena_allocator.h', 'src/core/lib/transport/call_filters.h', 'src/core/lib/transport/call_final_info.h', - 'src/core/lib/transport/call_size_estimator.h', 'src/core/lib/transport/call_spine.h', 'src/core/lib/transport/connectivity_state.h', 'src/core/lib/transport/custom_metadata.h', @@ -1550,8 +1550,10 @@ Pod::Spec.new do |s| 'third_party/zlib/zlib.h', 'third_party/zlib/zutil.h' - ss.private_header_files = 'src/core/client_channel/backup_poller.h', - 'src/core/client_channel/client_channel_channelz.h', + ss.private_header_files = 'src/core/channelz/channel_trace.h', + 'src/core/channelz/channelz.h', + 'src/core/channelz/channelz_registry.h', + 'src/core/client_channel/backup_poller.h', 'src/core/client_channel/client_channel_factory.h', 'src/core/client_channel/client_channel_filter.h', 'src/core/client_channel/client_channel_internal.h', @@ -2172,9 +2174,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_stack_builder.h', 'src/core/lib/channel/channel_stack_builder_impl.h', 'src/core/lib/channel/channel_stack_trace.h', - 'src/core/lib/channel/channel_trace.h', - 'src/core/lib/channel/channelz.h', - 'src/core/lib/channel/channelz_registry.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/metrics.h', @@ -2514,9 +2513,9 @@ Pod::Spec.new do |s| 'src/core/lib/surface/wait_for_cq_end_op.h', 'src/core/lib/transport/batch_builder.h', 'src/core/lib/transport/bdp_estimator.h', + 'src/core/lib/transport/call_arena_allocator.h', 'src/core/lib/transport/call_filters.h', 'src/core/lib/transport/call_final_info.h', - 'src/core/lib/transport/call_size_estimator.h', 'src/core/lib/transport/call_spine.h', 'src/core/lib/transport/connectivity_state.h', 'src/core/lib/transport/custom_metadata.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 1624bceaeb2..623acc21059 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -46,7 +46,7 @@ Pod::Spec.new do |s| s.requires_arc = false name = 'grpc' - abseil_version = '1.20240116.1' + abseil_version = '~> 1.20240116.2' # When creating a dynamic framework, name it grpc.framework instead of gRPC-Core.framework. # This lets users write their includes like `#include ` as opposed to `#include @@ -233,10 +233,14 @@ Pod::Spec.new do |s| ss.dependency 'abseil/utility/utility', abseil_version ss.compiler_flags = '-DBORINGSSL_PREFIX=GRPC -Wno-unreachable-code -Wno-shorten-64-to-32' - ss.source_files = 'src/core/client_channel/backup_poller.cc', + ss.source_files = 'src/core/channelz/channel_trace.cc', + 'src/core/channelz/channel_trace.h', + 'src/core/channelz/channelz.cc', + 'src/core/channelz/channelz.h', + 'src/core/channelz/channelz_registry.cc', + 'src/core/channelz/channelz_registry.h', + 'src/core/client_channel/backup_poller.cc', 'src/core/client_channel/backup_poller.h', - 'src/core/client_channel/client_channel_channelz.cc', - 'src/core/client_channel/client_channel_channelz.h', 'src/core/client_channel/client_channel_factory.cc', 'src/core/client_channel/client_channel_factory.h', 'src/core/client_channel/client_channel_filter.cc', @@ -1260,12 +1264,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_stack_builder_impl.h', 'src/core/lib/channel/channel_stack_trace.cc', 'src/core/lib/channel/channel_stack_trace.h', - 'src/core/lib/channel/channel_trace.cc', - 'src/core/lib/channel/channel_trace.h', - 'src/core/lib/channel/channelz.cc', - 'src/core/lib/channel/channelz.h', - 'src/core/lib/channel/channelz_registry.cc', - 'src/core/lib/channel/channelz_registry.h', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', @@ -1917,12 +1915,12 @@ Pod::Spec.new do |s| 'src/core/lib/transport/batch_builder.h', 'src/core/lib/transport/bdp_estimator.cc', 'src/core/lib/transport/bdp_estimator.h', + 'src/core/lib/transport/call_arena_allocator.cc', + 'src/core/lib/transport/call_arena_allocator.h', 'src/core/lib/transport/call_filters.cc', 'src/core/lib/transport/call_filters.h', 'src/core/lib/transport/call_final_info.cc', 'src/core/lib/transport/call_final_info.h', - 'src/core/lib/transport/call_size_estimator.cc', - 'src/core/lib/transport/call_size_estimator.h', 'src/core/lib/transport/call_spine.cc', 'src/core/lib/transport/call_spine.h', 'src/core/lib/transport/connectivity_state.cc', @@ -2351,8 +2349,10 @@ Pod::Spec.new do |s| 'third_party/zlib/zlib.h', 'third_party/zlib/zutil.c', 'third_party/zlib/zutil.h' - ss.private_header_files = 'src/core/client_channel/backup_poller.h', - 'src/core/client_channel/client_channel_channelz.h', + ss.private_header_files = 'src/core/channelz/channel_trace.h', + 'src/core/channelz/channelz.h', + 'src/core/channelz/channelz_registry.h', + 'src/core/client_channel/backup_poller.h', 'src/core/client_channel/client_channel_factory.h', 'src/core/client_channel/client_channel_filter.h', 'src/core/client_channel/client_channel_internal.h', @@ -2952,9 +2952,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_stack_builder.h', 'src/core/lib/channel/channel_stack_builder_impl.h', 'src/core/lib/channel/channel_stack_trace.h', - 'src/core/lib/channel/channel_trace.h', - 'src/core/lib/channel/channelz.h', - 'src/core/lib/channel/channelz_registry.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/metrics.h', @@ -3294,9 +3291,9 @@ Pod::Spec.new do |s| 'src/core/lib/surface/wait_for_cq_end_op.h', 'src/core/lib/transport/batch_builder.h', 'src/core/lib/transport/bdp_estimator.h', + 'src/core/lib/transport/call_arena_allocator.h', 'src/core/lib/transport/call_filters.h', 'src/core/lib/transport/call_final_info.h', - 'src/core/lib/transport/call_size_estimator.h', 'src/core/lib/transport/call_spine.h', 'src/core/lib/transport/connectivity_state.h', 'src/core/lib/transport/custom_metadata.h', diff --git a/grpc.gemspec b/grpc.gemspec index 3a986b6d65e..caebeafb099 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -123,10 +123,14 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/support/thd_id.h ) s.files += %w( include/grpc/support/time.h ) s.files += %w( include/grpc/support/workaround_list.h ) + s.files += %w( src/core/channelz/channel_trace.cc ) + s.files += %w( src/core/channelz/channel_trace.h ) + s.files += %w( src/core/channelz/channelz.cc ) + s.files += %w( src/core/channelz/channelz.h ) + s.files += %w( src/core/channelz/channelz_registry.cc ) + s.files += %w( src/core/channelz/channelz_registry.h ) s.files += %w( src/core/client_channel/backup_poller.cc ) s.files += %w( src/core/client_channel/backup_poller.h ) - s.files += %w( src/core/client_channel/client_channel_channelz.cc ) - s.files += %w( src/core/client_channel/client_channel_channelz.h ) s.files += %w( src/core/client_channel/client_channel_factory.cc ) s.files += %w( src/core/client_channel/client_channel_factory.h ) s.files += %w( src/core/client_channel/client_channel_filter.cc ) @@ -1150,12 +1154,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/channel/channel_stack_builder_impl.h ) s.files += %w( src/core/lib/channel/channel_stack_trace.cc ) s.files += %w( src/core/lib/channel/channel_stack_trace.h ) - s.files += %w( src/core/lib/channel/channel_trace.cc ) - s.files += %w( src/core/lib/channel/channel_trace.h ) - s.files += %w( src/core/lib/channel/channelz.cc ) - s.files += %w( src/core/lib/channel/channelz.h ) - s.files += %w( src/core/lib/channel/channelz_registry.cc ) - s.files += %w( src/core/lib/channel/channelz_registry.h ) s.files += %w( src/core/lib/channel/connected_channel.cc ) s.files += %w( src/core/lib/channel/connected_channel.h ) s.files += %w( src/core/lib/channel/context.h ) @@ -1807,12 +1805,12 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/transport/batch_builder.h ) s.files += %w( src/core/lib/transport/bdp_estimator.cc ) s.files += %w( src/core/lib/transport/bdp_estimator.h ) + s.files += %w( src/core/lib/transport/call_arena_allocator.cc ) + s.files += %w( src/core/lib/transport/call_arena_allocator.h ) s.files += %w( src/core/lib/transport/call_filters.cc ) s.files += %w( src/core/lib/transport/call_filters.h ) s.files += %w( src/core/lib/transport/call_final_info.cc ) s.files += %w( src/core/lib/transport/call_final_info.h ) - s.files += %w( src/core/lib/transport/call_size_estimator.cc ) - s.files += %w( src/core/lib/transport/call_size_estimator.h ) s.files += %w( src/core/lib/transport/call_spine.cc ) s.files += %w( src/core/lib/transport/call_spine.h ) s.files += %w( src/core/lib/transport/connectivity_state.cc ) diff --git a/include/grpcpp/client_context.h b/include/grpcpp/client_context.h index 7493f6a8601..2328e3e6fc6 100644 --- a/include/grpcpp/client_context.h +++ b/include/grpcpp/client_context.h @@ -38,6 +38,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -246,7 +248,7 @@ class ClientContext { /// \return A multimap of initial metadata key-value pairs from the server. const std::multimap& GetServerInitialMetadata() const { - GPR_ASSERT(initial_metadata_received_); + CHECK(initial_metadata_received_); return *recv_initial_metadata_.map(); } diff --git a/include/grpcpp/completion_queue.h b/include/grpcpp/completion_queue.h index 23c98e09749..bfd138b5945 100644 --- a/include/grpcpp/completion_queue.h +++ b/include/grpcpp/completion_queue.h @@ -34,6 +34,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -323,7 +325,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary { bool ok = ev.success != 0; void* ignored = tag; if (tag->FinalizeResult(&ignored, &ok)) { - GPR_ASSERT(ignored == tag); + CHECK(ignored == tag); return ok; } } @@ -344,7 +346,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary { bool ok = ev.success != 0; void* ignored = tag; // the tag must be swallowed if using TryPluck - GPR_ASSERT(!tag->FinalizeResult(&ignored, &ok)); + CHECK(!tag->FinalizeResult(&ignored, &ok)); } /// Performs a single polling pluck on \a tag. Calls tag->FinalizeResult if @@ -361,7 +363,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary { bool ok = ev.success != 0; void* ignored = tag; - GPR_ASSERT(!tag->FinalizeResult(&ignored, &ok)); + CHECK(!tag->FinalizeResult(&ignored, &ok)); } /// Manage state of avalanching operations : completion queue tags that diff --git a/include/grpcpp/impl/call_op_set.h b/include/grpcpp/impl/call_op_set.h index 48c958a96f6..56ce6289082 100644 --- a/include/grpcpp/impl/call_op_set.h +++ b/include/grpcpp/impl/call_op_set.h @@ -23,6 +23,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -316,7 +318,7 @@ class CallOpSendMessage { return; } if (msg_ != nullptr) { - GPR_ASSERT(serializer_(msg_).ok()); + CHECK(serializer_(msg_).ok()); } serializer_ = nullptr; grpc_op* op = &ops[(*nops)++]; @@ -795,7 +797,7 @@ class CallOpClientRecvStatus { if (recv_status_ == nullptr || hijacked_) return; if (static_cast(status_code_) == StatusCode::OK) { *recv_status_ = Status(); - GPR_DEBUG_ASSERT(debug_error_string_ == nullptr); + DCHECK_EQ(debug_error_string_, nullptr); } else { *recv_status_ = Status(static_cast(status_code_), @@ -974,7 +976,7 @@ class CallOpSet : public CallOpSetInterface, // WritesDone multiple times gpr_log(GPR_ERROR, "API misuse of type %s observed", grpc_call_error_to_string(err)); - GPR_ASSERT(false); + CHECK(false); } } @@ -984,8 +986,8 @@ class CallOpSet : public CallOpSetInterface, done_intercepting_ = true; // The following call_start_batch is internally-generated so no need for an // explanatory log on failure. - GPR_ASSERT(grpc_call_start_batch(call_.call(), nullptr, 0, core_cq_tag(), - nullptr) == GRPC_CALL_OK); + CHECK(grpc_call_start_batch(call_.call(), nullptr, 0, core_cq_tag(), + nullptr) == GRPC_CALL_OK); } private: diff --git a/include/grpcpp/impl/interceptor_common.h b/include/grpcpp/impl/interceptor_common.h index 81e66df4095..f8b104ba89c 100644 --- a/include/grpcpp/impl/interceptor_common.h +++ b/include/grpcpp/impl/interceptor_common.h @@ -22,6 +22,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -56,16 +58,15 @@ class InterceptorBatchMethodsImpl if (call_->client_rpc_info() != nullptr) { return ProceedClient(); } - GPR_ASSERT(call_->server_rpc_info() != nullptr); + CHECK_NE(call_->server_rpc_info(), nullptr); ProceedServer(); } void Hijack() override { // Only the client can hijack when sending down initial metadata - GPR_ASSERT(!reverse_ && ops_ != nullptr && - call_->client_rpc_info() != nullptr); + CHECK(!reverse_ && ops_ != nullptr && call_->client_rpc_info() != nullptr); // It is illegal to call Hijack twice - GPR_ASSERT(!ran_hijacking_interceptor_); + CHECK(!ran_hijacking_interceptor_); auto* rpc_info = call_->client_rpc_info(); rpc_info->hijacked_ = true; rpc_info->hijacked_interceptor_ = current_interceptor_index_; @@ -80,21 +81,21 @@ class InterceptorBatchMethodsImpl } ByteBuffer* GetSerializedSendMessage() override { - GPR_ASSERT(orig_send_message_ != nullptr); + CHECK_NE(orig_send_message_, nullptr); if (*orig_send_message_ != nullptr) { - GPR_ASSERT(serializer_(*orig_send_message_).ok()); + CHECK(serializer_(*orig_send_message_).ok()); *orig_send_message_ = nullptr; } return send_message_; } const void* GetSendMessage() override { - GPR_ASSERT(orig_send_message_ != nullptr); + CHECK_NE(orig_send_message_, nullptr); return *orig_send_message_; } void ModifySendMessage(const void* message) override { - GPR_ASSERT(orig_send_message_ != nullptr); + CHECK_NE(orig_send_message_, nullptr); *orig_send_message_ = message; } @@ -129,7 +130,7 @@ class InterceptorBatchMethodsImpl Status* GetRecvStatus() override { return recv_status_; } void FailHijackedSendMessage() override { - GPR_ASSERT(hooks_[static_cast( + CHECK(hooks_[static_cast( experimental::InterceptionHookPoints::PRE_SEND_MESSAGE)]); *fail_send_message_ = true; } @@ -192,7 +193,7 @@ class InterceptorBatchMethodsImpl } void FailHijackedRecvMessage() override { - GPR_ASSERT(hooks_[static_cast( + CHECK(hooks_[static_cast( experimental::InterceptionHookPoints::PRE_RECV_MESSAGE)]); *hijacked_recv_message_failed_ = true; } @@ -236,7 +237,7 @@ class InterceptorBatchMethodsImpl // ContinueFinalizeOpsAfterInterception will be called. Note that neither of // them is invoked if there were no interceptors registered. bool RunInterceptors() { - GPR_ASSERT(ops_); + CHECK(ops_); auto* client_rpc_info = call_->client_rpc_info(); if (client_rpc_info != nullptr) { if (client_rpc_info->interceptors_.empty()) { @@ -261,8 +262,8 @@ class InterceptorBatchMethodsImpl // SyncRequest. bool RunInterceptors(std::function f) { // This is used only by the server for initial call request - GPR_ASSERT(reverse_ == true); - GPR_ASSERT(call_->client_rpc_info() == nullptr); + CHECK_EQ(reverse_, true); + CHECK_EQ(call_->client_rpc_info(), nullptr); auto* server_rpc_info = call_->server_rpc_info(); if (server_rpc_info == nullptr || server_rpc_info->interceptors_.empty()) { return true; @@ -356,7 +357,7 @@ class InterceptorBatchMethodsImpl return ops_->ContinueFinalizeResultAfterInterception(); } } - GPR_ASSERT(callback_); + CHECK(callback_); callback_(); } @@ -422,112 +423,98 @@ class CancelInterceptorBatchMethods void Hijack() override { // Only the client can hijack when sending down initial metadata - GPR_ASSERT(false && - "It is illegal to call Hijack on a method which has a " - "Cancel notification"); + CHECK(false) << "It is illegal to call Hijack on a method which has a " + "Cancel notification"; } ByteBuffer* GetSerializedSendMessage() override { - GPR_ASSERT(false && - "It is illegal to call GetSendMessage on a method which " - "has a Cancel notification"); + CHECK(false) << "It is illegal to call GetSendMessage on a method which " + "has a Cancel notification"; return nullptr; } bool GetSendMessageStatus() override { - GPR_ASSERT(false && - "It is illegal to call GetSendMessageStatus on a method which " - "has a Cancel notification"); + CHECK(false) + << "It is illegal to call GetSendMessageStatus on a method which " + "has a Cancel notification"; return false; } const void* GetSendMessage() override { - GPR_ASSERT(false && - "It is illegal to call GetOriginalSendMessage on a method which " - "has a Cancel notification"); + CHECK(false) + << "It is illegal to call GetOriginalSendMessage on a method which " + "has a Cancel notification"; return nullptr; } void ModifySendMessage(const void* /*message*/) override { - GPR_ASSERT(false && - "It is illegal to call ModifySendMessage on a method which " - "has a Cancel notification"); + CHECK(false) << "It is illegal to call ModifySendMessage on a method which " + "has a Cancel notification"; } std::multimap* GetSendInitialMetadata() override { - GPR_ASSERT(false && - "It is illegal to call GetSendInitialMetadata on a " - "method which has a Cancel notification"); + CHECK(false) << "It is illegal to call GetSendInitialMetadata on a " + "method which has a Cancel notification"; return nullptr; } Status GetSendStatus() override { - GPR_ASSERT(false && - "It is illegal to call GetSendStatus on a method which " - "has a Cancel notification"); + CHECK(false) << "It is illegal to call GetSendStatus on a method which " + "has a Cancel notification"; return Status(); } void ModifySendStatus(const Status& /*status*/) override { - GPR_ASSERT(false && - "It is illegal to call ModifySendStatus on a method " - "which has a Cancel notification"); + CHECK(false) << "It is illegal to call ModifySendStatus on a method " + "which has a Cancel notification"; } std::multimap* GetSendTrailingMetadata() override { - GPR_ASSERT(false && - "It is illegal to call GetSendTrailingMetadata on a " - "method which has a Cancel notification"); + CHECK(false) << "It is illegal to call GetSendTrailingMetadata on a " + "method which has a Cancel notification"; return nullptr; } void* GetRecvMessage() override { - GPR_ASSERT(false && - "It is illegal to call GetRecvMessage on a method which " - "has a Cancel notification"); + CHECK(false) << "It is illegal to call GetRecvMessage on a method which " + "has a Cancel notification"; return nullptr; } std::multimap* GetRecvInitialMetadata() override { - GPR_ASSERT(false && - "It is illegal to call GetRecvInitialMetadata on a " - "method which has a Cancel notification"); + CHECK(false) << "It is illegal to call GetRecvInitialMetadata on a " + "method which has a Cancel notification"; return nullptr; } Status* GetRecvStatus() override { - GPR_ASSERT(false && - "It is illegal to call GetRecvStatus on a method which " - "has a Cancel notification"); + CHECK(false) << "It is illegal to call GetRecvStatus on a method which " + "has a Cancel notification"; return nullptr; } std::multimap* GetRecvTrailingMetadata() override { - GPR_ASSERT(false && - "It is illegal to call GetRecvTrailingMetadata on a " - "method which has a Cancel notification"); + CHECK(false) << "It is illegal to call GetRecvTrailingMetadata on a " + "method which has a Cancel notification"; return nullptr; } std::unique_ptr GetInterceptedChannel() override { - GPR_ASSERT(false && - "It is illegal to call GetInterceptedChannel on a " - "method which has a Cancel notification"); + CHECK(false) << "It is illegal to call GetInterceptedChannel on a " + "method which has a Cancel notification"; return std::unique_ptr(nullptr); } void FailHijackedRecvMessage() override { - GPR_ASSERT(false && - "It is illegal to call FailHijackedRecvMessage on a " - "method which has a Cancel notification"); + CHECK(false) << "It is illegal to call FailHijackedRecvMessage on a " + "method which has a Cancel notification"; } void FailHijackedSendMessage() override { - GPR_ASSERT(false && - "It is illegal to call FailHijackedSendMessage on a " - "method which has a Cancel notification"); + CHECK(false) << "It is illegal to call FailHijackedSendMessage on a " + "method which has a Cancel notification"; } }; } // namespace internal diff --git a/include/grpcpp/impl/proto_utils.h b/include/grpcpp/impl/proto_utils.h index c6240ffa84d..0cd4d1bdb4b 100644 --- a/include/grpcpp/impl/proto_utils.h +++ b/include/grpcpp/impl/proto_utils.h @@ -21,6 +21,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -51,8 +53,8 @@ Status GenericSerialize(const grpc::protobuf::MessageLite& msg, ByteBuffer* bb, if (static_cast(byte_size) <= GRPC_SLICE_INLINED_SIZE) { Slice slice(byte_size); // We serialize directly into the allocated slices memory - GPR_ASSERT(slice.end() == msg.SerializeWithCachedSizesToArray( - const_cast(slice.begin()))); + CHECK(slice.end() == msg.SerializeWithCachedSizesToArray( + const_cast(slice.begin()))); ByteBuffer tmp(&slice, 1); bb->Swap(&tmp); diff --git a/include/grpcpp/impl/rpc_service_method.h b/include/grpcpp/impl/rpc_service_method.h index 73694263cdd..0ce7d7b96fb 100644 --- a/include/grpcpp/impl/rpc_service_method.h +++ b/include/grpcpp/impl/rpc_service_method.h @@ -25,6 +25,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -75,7 +77,7 @@ class MethodHandler { // retained by the handler. Returns nullptr if deserialization failed. virtual void* Deserialize(grpc_call* /*call*/, grpc_byte_buffer* req, Status* /*status*/, void** /*handler_data*/) { - GPR_ASSERT(req == nullptr); + CHECK_EQ(req, nullptr); return nullptr; } }; diff --git a/include/grpcpp/impl/server_callback_handlers.h b/include/grpcpp/impl/server_callback_handlers.h index b49e17a2c16..f9839973fe9 100644 --- a/include/grpcpp/impl/server_callback_handlers.h +++ b/include/grpcpp/impl/server_callback_handlers.h @@ -18,6 +18,8 @@ #ifndef GRPCPP_IMPL_SERVER_CALLBACK_HANDLERS_H #define GRPCPP_IMPL_SERVER_CALLBACK_HANDLERS_H +#include "absl/log/check.h" + #include #include #include @@ -147,7 +149,7 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be marked inline because it // is directly invoking a user-controlled reaction @@ -335,7 +337,7 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be inlined because it invokes // a user-controlled reaction, but any resulting OnDone can be inlined in @@ -539,7 +541,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be inlined because it invokes // a user-controlled reaction, but any resulting OnDone can be inlined in @@ -577,7 +579,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler { ctx_->sent_initial_metadata_ = true; } // TODO(vjpai): don't assert - GPR_ASSERT(write_ops_.SendMessagePtr(resp, options).ok()); + CHECK(write_ops_.SendMessagePtr(resp, options).ok()); call_.PerformOps(&write_ops_); } @@ -585,7 +587,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler { grpc::Status s) override { // This combines the write into the finish callback // TODO(vjpai): don't assert - GPR_ASSERT(finish_ops_.SendMessagePtr(resp, options).ok()); + CHECK(finish_ops_.SendMessagePtr(resp, options).ok()); Finish(std::move(s)); } @@ -751,7 +753,7 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be inlined because it invokes // a user-controlled reaction, but any resulting OnDone can be inlined in @@ -789,14 +791,14 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler { ctx_->sent_initial_metadata_ = true; } // TODO(vjpai): don't assert - GPR_ASSERT(write_ops_.SendMessagePtr(resp, options).ok()); + CHECK(write_ops_.SendMessagePtr(resp, options).ok()); call_.PerformOps(&write_ops_); } void WriteAndFinish(const ResponseType* resp, grpc::WriteOptions options, grpc::Status s) override { // TODO(vjpai): don't assert - GPR_ASSERT(finish_ops_.SendMessagePtr(resp, options).ok()); + CHECK(finish_ops_.SendMessagePtr(resp, options).ok()); Finish(std::move(s)); } diff --git a/include/grpcpp/impl/service_type.h b/include/grpcpp/impl/service_type.h index 9699e2328d4..c284026a0f6 100644 --- a/include/grpcpp/impl/service_type.h +++ b/include/grpcpp/impl/service_type.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_IMPL_SERVICE_TYPE_H #define GRPCPP_IMPL_SERVICE_TYPE_H +#include "absl/log/check.h" + #include #include #include @@ -150,9 +152,9 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - GPR_ASSERT(methods_[idx].get() != nullptr && - "Cannot mark the method as 'async' because it has already been " - "marked as 'generic'."); + CHECK_NE(methods_[idx].get(), nullptr) + << "Cannot mark the method as 'async' because it has already been " + "marked as 'generic'."; methods_[idx]->SetServerApiType(internal::RpcServiceMethod::ApiType::ASYNC); } @@ -160,9 +162,9 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - GPR_ASSERT(methods_[idx].get() != nullptr && - "Cannot mark the method as 'raw' because it has already " - "been marked as 'generic'."); + CHECK_NE(methods_[idx].get(), nullptr) + << "Cannot mark the method as 'raw' because it has already " + "been marked as 'generic'."; methods_[idx]->SetServerApiType(internal::RpcServiceMethod::ApiType::RAW); } @@ -170,10 +172,9 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - GPR_ASSERT( - methods_[idx]->handler() != nullptr && - "Cannot mark the method as 'generic' because it has already been " - "marked as 'async' or 'raw'."); + CHECK_NE(methods_[idx]->handler(), nullptr) + << "Cannot mark the method as 'generic' because it has already been " + "marked as 'async' or 'raw'."; methods_[idx].reset(); } @@ -181,8 +182,8 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - GPR_ASSERT(methods_[idx] && methods_[idx]->handler() && - "Cannot mark an async or generic method Streamed"); + CHECK(methods_[idx] && methods_[idx]->handler()) + << "Cannot mark an async or generic method Streamed"; methods_[idx]->SetHandler(streamed_method); // From the server's point of view, streamed unary is a special @@ -196,10 +197,9 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - GPR_ASSERT( - methods_[idx].get() != nullptr && - "Cannot mark the method as 'callback' because it has already been " - "marked as 'generic'."); + CHECK_NE(methods_[idx].get(), nullptr) + << "Cannot mark the method as 'callback' because it has already been " + "marked as 'generic'."; methods_[idx]->SetHandler(handler); methods_[idx]->SetServerApiType( internal::RpcServiceMethod::ApiType::CALL_BACK); @@ -209,10 +209,9 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - GPR_ASSERT( - methods_[idx].get() != nullptr && - "Cannot mark the method as 'raw callback' because it has already " - "been marked as 'generic'."); + CHECK_NE(methods_[idx].get(), nullptr) + << "Cannot mark the method as 'raw callback' because it has already " + "been marked as 'generic'."; methods_[idx]->SetHandler(handler); methods_[idx]->SetServerApiType( internal::RpcServiceMethod::ApiType::RAW_CALL_BACK); diff --git a/include/grpcpp/impl/sync.h b/include/grpcpp/impl/sync.h index 2fadf6fab1c..9288459196a 100644 --- a/include/grpcpp/impl/sync.h +++ b/include/grpcpp/impl/sync.h @@ -27,6 +27,7 @@ #include +#include "absl/log/check.h" #include "absl/synchronization/mutex.h" #include @@ -105,7 +106,7 @@ class ABSL_SCOPED_LOCKABLE ReleasableMutexLock { ReleasableMutexLock& operator=(const ReleasableMutexLock&) = delete; void Release() ABSL_UNLOCK_FUNCTION() { - GPR_DEBUG_ASSERT(!released_); + DCHECK(!released_); released_ = true; mu_->Unlock(); } diff --git a/include/grpcpp/server_interface.h b/include/grpcpp/server_interface.h index 5f8f8b54b0f..129562016ac 100644 --- a/include/grpcpp/server_interface.h +++ b/include/grpcpp/server_interface.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_SERVER_INTERFACE_H #define GRPCPP_SERVER_INTERFACE_H +#include "absl/log/check.h" + #include #include #include @@ -318,7 +320,7 @@ class ServerInterface : public internal::CallHook { grpc::CompletionQueue* call_cq, grpc::ServerCompletionQueue* notification_cq, void* tag, Message* message) { - GPR_ASSERT(method); + CHECK(method); new PayloadAsyncRequest(method, this, context, stream, call_cq, notification_cq, tag, message); } @@ -329,7 +331,7 @@ class ServerInterface : public internal::CallHook { grpc::CompletionQueue* call_cq, grpc::ServerCompletionQueue* notification_cq, void* tag) { - GPR_ASSERT(method); + CHECK(method); new NoPayloadAsyncRequest(method, this, context, stream, call_cq, notification_cq, tag); } diff --git a/include/grpcpp/support/async_stream.h b/include/grpcpp/support/async_stream.h index 1bf67d301d5..ebc7aebcf51 100644 --- a/include/grpcpp/support/async_stream.h +++ b/include/grpcpp/support/async_stream.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_SUPPORT_ASYNC_STREAM_H #define GRPCPP_SUPPORT_ASYNC_STREAM_H +#include "absl/log/check.h" + #include #include #include @@ -200,7 +202,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - GPR_ASSERT(size == sizeof(ClientAsyncReader)); + CHECK_EQ(size, sizeof(ClientAsyncReader)); } // This operator should never be called as the memory should be freed as part @@ -208,10 +210,10 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { GPR_ASSERT(false); } + static void operator delete(void*, void*) { CHECK(false); } void StartCall(void* tag) override { - GPR_ASSERT(!started_); + CHECK(!started_); started_ = true; StartCallInternal(tag); } @@ -225,8 +227,8 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { /// calling code can access the received metadata through the /// \a ClientContext. void ReadInitialMetadata(void* tag) override { - GPR_ASSERT(started_); - GPR_ASSERT(!context_->initial_metadata_received_); + CHECK(started_); + CHECK(!context_->initial_metadata_received_); meta_ops_.set_output_tag(tag); meta_ops_.RecvInitialMetadata(context_); @@ -234,7 +236,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { } void Read(R* msg, void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); read_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { read_ops_.RecvInitialMetadata(context_); @@ -249,7 +251,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata received from the server. void Finish(grpc::Status* status, void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); finish_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { finish_ops_.RecvInitialMetadata(context_); @@ -265,12 +267,12 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { const W& request, bool start, void* tag) : context_(context), call_(call), started_(start) { // TODO(ctiller): don't assert - GPR_ASSERT(init_ops_.SendMessage(request).ok()); + CHECK(init_ops_.SendMessage(request).ok()); init_ops_.ClientSendClose(); if (start) { StartCallInternal(tag); } else { - GPR_ASSERT(tag == nullptr); + CHECK(tag == nullptr); } } @@ -348,7 +350,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - GPR_ASSERT(size == sizeof(ClientAsyncWriter)); + CHECK_EQ(size, sizeof(ClientAsyncWriter)); } // This operator should never be called as the memory should be freed as part @@ -356,10 +358,10 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { GPR_ASSERT(false); } + static void operator delete(void*, void*) { CHECK(false); } void StartCall(void* tag) override { - GPR_ASSERT(!started_); + CHECK(!started_); started_ = true; StartCallInternal(tag); } @@ -372,8 +374,8 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { /// associated with this call is updated, and the calling code can access /// the received metadata through the \a ClientContext. void ReadInitialMetadata(void* tag) override { - GPR_ASSERT(started_); - GPR_ASSERT(!context_->initial_metadata_received_); + CHECK(started_); + CHECK(!context_->initial_metadata_received_); meta_ops_.set_output_tag(tag); meta_ops_.RecvInitialMetadata(context_); @@ -381,27 +383,27 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { } void Write(const W& msg, void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); write_ops_.set_output_tag(tag); // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg).ok()); + CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } void Write(const W& msg, grpc::WriteOptions options, void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); write_ops_.set_output_tag(tag); if (options.is_last_message()) { options.set_buffer_hint(); write_ops_.ClientSendClose(); } // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg, options).ok()); + CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } void WritesDone(void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); write_ops_.set_output_tag(tag); write_ops_.ClientSendClose(); call_.PerformOps(&write_ops_); @@ -415,7 +417,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { /// - attempts to fill in the \a response parameter passed to this class's /// constructor with the server's response message. void Finish(grpc::Status* status, void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); finish_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { finish_ops_.RecvInitialMetadata(context_); @@ -435,7 +437,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { if (start) { StartCallInternal(tag); } else { - GPR_ASSERT(tag == nullptr); + CHECK(tag == nullptr); } } @@ -515,7 +517,7 @@ class ClientAsyncReaderWriter final public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - GPR_ASSERT(size == sizeof(ClientAsyncReaderWriter)); + CHECK_EQ(size, sizeof(ClientAsyncReaderWriter)); } // This operator should never be called as the memory should be freed as part @@ -523,10 +525,10 @@ class ClientAsyncReaderWriter final // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { GPR_ASSERT(false); } + static void operator delete(void*, void*) { CHECK(false); } void StartCall(void* tag) override { - GPR_ASSERT(!started_); + CHECK(!started_); started_ = true; StartCallInternal(tag); } @@ -539,8 +541,8 @@ class ClientAsyncReaderWriter final /// is updated with it, and then the receiving initial metadata can /// be accessed through this \a ClientContext. void ReadInitialMetadata(void* tag) override { - GPR_ASSERT(started_); - GPR_ASSERT(!context_->initial_metadata_received_); + CHECK(started_); + CHECK(!context_->initial_metadata_received_); meta_ops_.set_output_tag(tag); meta_ops_.RecvInitialMetadata(context_); @@ -548,7 +550,7 @@ class ClientAsyncReaderWriter final } void Read(R* msg, void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); read_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { read_ops_.RecvInitialMetadata(context_); @@ -558,27 +560,27 @@ class ClientAsyncReaderWriter final } void Write(const W& msg, void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); write_ops_.set_output_tag(tag); // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg).ok()); + CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } void Write(const W& msg, grpc::WriteOptions options, void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); write_ops_.set_output_tag(tag); if (options.is_last_message()) { options.set_buffer_hint(); write_ops_.ClientSendClose(); } // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg, options).ok()); + CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } void WritesDone(void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); write_ops_.set_output_tag(tag); write_ops_.ClientSendClose(); call_.PerformOps(&write_ops_); @@ -589,7 +591,7 @@ class ClientAsyncReaderWriter final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void Finish(grpc::Status* status, void* tag) override { - GPR_ASSERT(started_); + CHECK(started_); finish_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { finish_ops_.RecvInitialMetadata(context_); @@ -606,7 +608,7 @@ class ClientAsyncReaderWriter final if (start) { StartCallInternal(tag); } else { - GPR_ASSERT(tag == nullptr); + CHECK(tag == nullptr); } } @@ -706,7 +708,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface { /// - The initial metadata that will be sent to the client from this op will /// be taken from the \a ServerContext associated with the call. void SendInitialMetadata(void* tag) override { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); meta_ops_.set_output_tag(tag); meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -765,7 +767,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface { /// gRPC doesn't take ownership or a reference to \a status, so it is safe to /// to deallocate once FinishWithError returns. void FinishWithError(const grpc::Status& status, void* tag) override { - GPR_ASSERT(!status.ok()); + CHECK(!status.ok()); finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -855,7 +857,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { /// /// \param[in] tag Tag identifying this request. void SendInitialMetadata(void* tag) override { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); meta_ops_.set_output_tag(tag); meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -871,7 +873,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg).ok()); + CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } @@ -883,7 +885,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { EnsureInitialMetadataSent(&write_ops_); // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg, options).ok()); + CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } @@ -902,7 +904,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); options.set_buffer_hint(); - GPR_ASSERT(write_ops_.SendMessage(msg, options).ok()); + CHECK(write_ops_.SendMessage(msg, options).ok()); write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&write_ops_); } @@ -1021,7 +1023,7 @@ class ServerAsyncReaderWriter final /// /// \param[in] tag Tag identifying this request. void SendInitialMetadata(void* tag) override { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); meta_ops_.set_output_tag(tag); meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -1043,7 +1045,7 @@ class ServerAsyncReaderWriter final write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg).ok()); + CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } @@ -1053,7 +1055,7 @@ class ServerAsyncReaderWriter final options.set_buffer_hint(); } EnsureInitialMetadataSent(&write_ops_); - GPR_ASSERT(write_ops_.SendMessage(msg, options).ok()); + CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } @@ -1073,7 +1075,7 @@ class ServerAsyncReaderWriter final write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); options.set_buffer_hint(); - GPR_ASSERT(write_ops_.SendMessage(msg, options).ok()); + CHECK(write_ops_.SendMessage(msg, options).ok()); write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&write_ops_); } diff --git a/include/grpcpp/support/async_unary_call.h b/include/grpcpp/support/async_unary_call.h index a831d73f72f..787d3a56e3d 100644 --- a/include/grpcpp/support/async_unary_call.h +++ b/include/grpcpp/support/async_unary_call.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H #define GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H +#include "absl/log/check.h" + #include #include #include @@ -130,7 +132,7 @@ class ClientAsyncResponseReaderHelper { new (grpc_call_arena_alloc(call, sizeof(SingleBufType))) SingleBufType; *single_buf_ptr = single_buf; // TODO(ctiller): don't assert - GPR_ASSERT(single_buf->SendMessage(request).ok()); + CHECK(single_buf->SendMessage(request).ok()); single_buf->ClientSendClose(); // The purpose of the following functions is to type-erase the actual @@ -220,7 +222,7 @@ class ClientAsyncResponseReader final public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - GPR_ASSERT(size == sizeof(ClientAsyncResponseReader)); + CHECK_EQ(size, sizeof(ClientAsyncResponseReader)); } // This operator should never be called as the memory should be freed as part @@ -228,10 +230,10 @@ class ClientAsyncResponseReader final // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { GPR_ASSERT(false); } + static void operator delete(void*, void*) { CHECK(false); } void StartCall() override { - GPR_DEBUG_ASSERT(!started_); + DCHECK(!started_); started_ = true; internal::ClientAsyncResponseReaderHelper::StartCall(context_, single_buf_); } @@ -243,8 +245,8 @@ class ClientAsyncResponseReader final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void ReadInitialMetadata(void* tag) override { - GPR_DEBUG_ASSERT(started_); - GPR_DEBUG_ASSERT(!context_->initial_metadata_received_); + DCHECK(started_); + DCHECK(!context_->initial_metadata_received_); read_initial_metadata_(context_, &call_, single_buf_, tag); initial_metadata_read_ = true; } @@ -255,7 +257,7 @@ class ClientAsyncResponseReader final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void Finish(R* msg, grpc::Status* status, void* tag) override { - GPR_DEBUG_ASSERT(started_); + DCHECK(started_); finish_(context_, &call_, initial_metadata_read_, single_buf_, &finish_buf_, static_cast(msg), status, tag); } @@ -304,7 +306,7 @@ class ServerAsyncResponseWriter final /// /// \param[in] tag Tag identifying this request. void SendInitialMetadata(void* tag) override { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); meta_buf_.set_output_tag(tag); meta_buf_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -373,7 +375,7 @@ class ServerAsyncResponseWriter final /// deallocate them once the Finish operation is complete (i.e. a result /// arrives in the completion queue). void FinishWithError(const grpc::Status& status, void* tag) { - GPR_ASSERT(!status.ok()); + CHECK(!status.ok()); finish_buf_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_buf_.SendInitialMetadata(&ctx_->initial_metadata_, diff --git a/include/grpcpp/support/callback_common.h b/include/grpcpp/support/callback_common.h index 6ae8cfb946a..2868de0bd4d 100644 --- a/include/grpcpp/support/callback_common.h +++ b/include/grpcpp/support/callback_common.h @@ -21,6 +21,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -71,7 +73,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - GPR_ASSERT(size == sizeof(CallbackWithStatusTag)); + CHECK_EQ(size, sizeof(CallbackWithStatusTag)); } // This operator should never be called as the memory should be freed as part @@ -79,7 +81,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { GPR_ASSERT(false); } + static void operator delete(void*, void*) { CHECK(false); } CallbackWithStatusTag(grpc_call* call, std::function f, CompletionQueueTag* ops) @@ -118,7 +120,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor { // The tag was swallowed return; } - GPR_ASSERT(ignored == ops_); + CHECK(ignored == ops_); // Last use of func_ or status_, so ok to move them out auto func = std::move(func_); @@ -137,7 +139,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - GPR_ASSERT(size == sizeof(CallbackWithSuccessTag)); + CHECK_EQ(size, sizeof(CallbackWithSuccessTag)); } // This operator should never be called as the memory should be freed as part @@ -145,7 +147,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { GPR_ASSERT(false); } + static void operator delete(void*, void*) { CHECK(false); } CallbackWithSuccessTag() : call_(nullptr) {} @@ -162,7 +164,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { // callbacks. void Set(grpc_call* call, std::function f, CompletionQueueTag* ops, bool can_inline) { - GPR_ASSERT(call_ == nullptr); + CHECK_EQ(call_, nullptr); grpc_call_ref(call); call_ = call; func_ = std::move(f); @@ -208,7 +210,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { #endif bool do_callback = ops_->FinalizeResult(&ignored, &ok); #ifndef NDEBUG - GPR_DEBUG_ASSERT(ignored == ops); + DCHECK(ignored == ops); #endif if (do_callback) { diff --git a/include/grpcpp/support/client_callback.h b/include/grpcpp/support/client_callback.h index 1c420815de4..49e52bb37aa 100644 --- a/include/grpcpp/support/client_callback.h +++ b/include/grpcpp/support/client_callback.h @@ -22,6 +22,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -70,7 +72,7 @@ class CallbackUnaryCallImpl { const InputMessage* request, OutputMessage* result, std::function on_completion) { grpc::CompletionQueue* cq = channel->CallbackCQ(); - GPR_ASSERT(cq != nullptr); + CHECK_NE(cq, nullptr); grpc::internal::Call call(channel->CreateCall(method, context, cq)); using FullCallOpSet = grpc::internal::CallOpSet< @@ -304,7 +306,7 @@ class ClientBidiReactor : public internal::ClientReactor { /// The argument to AddMultipleHolds must be positive. void AddHold() { AddMultipleHolds(1); } void AddMultipleHolds(int holds) { - GPR_DEBUG_ASSERT(holds > 0); + DCHECK_GT(holds, 0); stream_->AddHold(holds); } void RemoveHold() { stream_->RemoveHold(); } @@ -368,7 +370,7 @@ class ClientReadReactor : public internal::ClientReactor { void AddHold() { AddMultipleHolds(1); } void AddMultipleHolds(int holds) { - GPR_DEBUG_ASSERT(holds > 0); + DCHECK_GT(holds, 0); reader_->AddHold(holds); } void RemoveHold() { reader_->RemoveHold(); } @@ -400,7 +402,7 @@ class ClientWriteReactor : public internal::ClientReactor { void AddHold() { AddMultipleHolds(1); } void AddMultipleHolds(int holds) { - GPR_DEBUG_ASSERT(holds > 0); + DCHECK_GT(holds, 0); writer_->AddHold(holds); } void RemoveHold() { writer_->RemoveHold(); } @@ -461,7 +463,7 @@ class ClientCallbackReaderWriterImpl public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - GPR_ASSERT(size == sizeof(ClientCallbackReaderWriterImpl)); + CHECK_EQ(size, sizeof(ClientCallbackReaderWriterImpl)); } // This operator should never be called as the memory should be freed as part @@ -469,7 +471,7 @@ class ClientCallbackReaderWriterImpl // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { GPR_ASSERT(false); } + static void operator delete(void*, void*) { CHECK(false); } void StartCall() ABSL_LOCKS_EXCLUDED(start_mu_) override { // This call initiates two batches, plus any backlog, each with a callback @@ -527,7 +529,7 @@ class ClientCallbackReaderWriterImpl write_ops_.ClientSendClose(); } // TODO(vjpai): don't assert - GPR_ASSERT(write_ops_.SendMessagePtr(msg, options).ok()); + CHECK(write_ops_.SendMessagePtr(msg, options).ok()); callbacks_outstanding_.fetch_add(1, std::memory_order_relaxed); if (GPR_UNLIKELY(corked_write_needed_)) { write_ops_.SendInitialMetadata(&context_->send_initial_metadata_, @@ -719,7 +721,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - GPR_ASSERT(size == sizeof(ClientCallbackReaderImpl)); + CHECK_EQ(size, sizeof(ClientCallbackReaderImpl)); } // This operator should never be called as the memory should be freed as part @@ -727,7 +729,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { GPR_ASSERT(false); } + static void operator delete(void*, void*) { CHECK(false); } void StartCall() override { // This call initiates two batches, plus any backlog, each with a callback @@ -804,7 +806,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader { : context_(context), call_(call), reactor_(reactor) { this->BindReactor(reactor); // TODO(vjpai): don't assert - GPR_ASSERT(start_ops_.SendMessagePtr(request).ok()); + CHECK(start_ops_.SendMessagePtr(request).ok()); start_ops_.ClientSendClose(); } @@ -880,7 +882,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - GPR_ASSERT(size == sizeof(ClientCallbackWriterImpl)); + CHECK_EQ(size, sizeof(ClientCallbackWriterImpl)); } // This operator should never be called as the memory should be freed as part @@ -888,7 +890,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { GPR_ASSERT(false); } + static void operator delete(void*, void*) { CHECK(false); } void StartCall() ABSL_LOCKS_EXCLUDED(start_mu_) override { // This call initiates two batches, plus any backlog, each with a callback @@ -929,7 +931,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter { write_ops_.ClientSendClose(); } // TODO(vjpai): don't assert - GPR_ASSERT(write_ops_.SendMessagePtr(msg, options).ok()); + CHECK(write_ops_.SendMessagePtr(msg, options).ok()); callbacks_outstanding_.fetch_add(1, std::memory_order_relaxed); if (GPR_UNLIKELY(corked_write_needed_)) { @@ -1110,7 +1112,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - GPR_ASSERT(size == sizeof(ClientCallbackUnaryImpl)); + CHECK_EQ(size, sizeof(ClientCallbackUnaryImpl)); } // This operator should never be called as the memory should be freed as part @@ -1118,7 +1120,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { GPR_ASSERT(false); } + static void operator delete(void*, void*) { CHECK(false); } void StartCall() override { // This call initiates two batches, each with a callback @@ -1157,7 +1159,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary { : context_(context), call_(call), reactor_(reactor) { this->BindReactor(reactor); // TODO(vjpai): don't assert - GPR_ASSERT(start_ops_.SendMessagePtr(request).ok()); + CHECK(start_ops_.SendMessagePtr(request).ok()); start_ops_.ClientSendClose(); finish_ops_.RecvMessage(response); finish_ops_.AllowNoMessage(); diff --git a/include/grpcpp/support/client_interceptor.h b/include/grpcpp/support/client_interceptor.h index b2b9dc76917..3bcb2f16256 100644 --- a/include/grpcpp/support/client_interceptor.h +++ b/include/grpcpp/support/client_interceptor.h @@ -22,6 +22,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -139,7 +141,7 @@ class ClientRpcInfo { // Runs interceptor at pos \a pos. void RunInterceptor( experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) { - GPR_ASSERT(pos < interceptors_.size()); + CHECK_LT(pos, interceptors_.size()); interceptors_[pos]->Intercept(interceptor_methods); } diff --git a/include/grpcpp/support/method_handler.h b/include/grpcpp/support/method_handler.h index def30a0ad8c..51821c6da38 100644 --- a/include/grpcpp/support/method_handler.h +++ b/include/grpcpp/support/method_handler.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_SUPPORT_METHOD_HANDLER_H #define GRPCPP_SUPPORT_METHOD_HANDLER_H +#include "absl/log/check.h" + #include #include #include @@ -57,7 +59,7 @@ template template void UnaryRunHandlerHelper(const MethodHandler::HandlerParameter& param, ResponseType* rsp, grpc::Status& status) { - GPR_ASSERT(!param.server_context->sent_initial_metadata_); + CHECK(!param.server_context->sent_initial_metadata_); grpc::internal::CallOpSet diff --git a/include/grpcpp/support/proto_buffer_reader.h b/include/grpcpp/support/proto_buffer_reader.h index ffec8d76416..f5431d462e4 100644 --- a/include/grpcpp/support/proto_buffer_reader.h +++ b/include/grpcpp/support/proto_buffer_reader.h @@ -21,6 +21,7 @@ #include +#include "absl/log/check.h" #include "absl/strings/cord.h" #include @@ -75,7 +76,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { if (backup_count_ > 0) { *data = GRPC_SLICE_START_PTR(*slice_) + GRPC_SLICE_LENGTH(*slice_) - backup_count_; - GPR_ASSERT(backup_count_ <= INT_MAX); + CHECK_LE(backup_count_, INT_MAX); *size = static_cast(backup_count_); backup_count_ = 0; return true; @@ -86,7 +87,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { } *data = GRPC_SLICE_START_PTR(*slice_); // On win x64, int is only 32bit - GPR_ASSERT(GRPC_SLICE_LENGTH(*slice_) <= INT_MAX); + CHECK_LE(GRPC_SLICE_LENGTH(*slice_), static_cast(INT_MAX)); byte_count_ += * size = static_cast(GRPC_SLICE_LENGTH(*slice_)); return true; } @@ -98,7 +99,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { /// bytes that have already been returned by the last call of Next. /// So do the backup and have that ready for a later Next. void BackUp(int count) override { - GPR_ASSERT(count <= static_cast(GRPC_SLICE_LENGTH(*slice_))); + CHECK_LE(count, static_cast(GRPC_SLICE_LENGTH(*slice_))); backup_count_ = count; } @@ -174,7 +175,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { return true; } } - GPR_ASSERT(count == 0); + CHECK_EQ(count, 0); return true; } #endif // GRPC_PROTOBUF_CORD_SUPPORT_ENABLED diff --git a/include/grpcpp/support/proto_buffer_writer.h b/include/grpcpp/support/proto_buffer_writer.h index 83d81060e87..351b2b826d9 100644 --- a/include/grpcpp/support/proto_buffer_writer.h +++ b/include/grpcpp/support/proto_buffer_writer.h @@ -21,6 +21,7 @@ #include +#include "absl/log/check.h" #include "absl/strings/cord.h" #include @@ -64,7 +65,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { total_size_(total_size), byte_count_(0), have_backup_(false) { - GPR_ASSERT(!byte_buffer->Valid()); + CHECK(!byte_buffer->Valid()); /// Create an empty raw byte buffer and look at its underlying slice buffer grpc_byte_buffer* bp = grpc_raw_byte_buffer_create(nullptr, 0); byte_buffer->set_buffer(bp); @@ -81,7 +82,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { /// safe for the caller to write from data[0, size - 1]. bool Next(void** data, int* size) override { // Protobuf should not ask for more memory than total_size_. - GPR_ASSERT(byte_count_ < total_size_); + CHECK_LT(byte_count_, total_size_); // 1. Use the remaining backup slice if we have one // 2. Otherwise allocate a slice, up to the remaining length needed // or our maximum allocation size @@ -106,7 +107,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { } *data = GRPC_SLICE_START_PTR(slice_); // On win x64, int is only 32bit - GPR_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX); + CHECK(GRPC_SLICE_LENGTH(slice_) <= static_cast(INT_MAX)); byte_count_ += * size = static_cast(GRPC_SLICE_LENGTH(slice_)); // Using grpc_slice_buffer_add could modify slice_ and merge it with the // previous slice. Therefore, use grpc_slice_buffer_add_indexed method to @@ -131,7 +132,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { /// 2. Split it into the needed (if any) and unneeded part /// 3. Add the needed part back to the slice buffer /// 4. Mark that we still have the remaining part (for later use/unref) - GPR_ASSERT(count <= static_cast(GRPC_SLICE_LENGTH(slice_))); + CHECK_LE(count, static_cast(GRPC_SLICE_LENGTH(slice_))); grpc_slice_buffer_pop(slice_buffer_); if (static_cast(count) == GRPC_SLICE_LENGTH(slice_)) { backup_slice_ = slice_; diff --git a/include/grpcpp/support/server_interceptor.h b/include/grpcpp/support/server_interceptor.h index ecb4e342598..c30d0aee495 100644 --- a/include/grpcpp/support/server_interceptor.h +++ b/include/grpcpp/support/server_interceptor.h @@ -22,6 +22,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -100,7 +102,7 @@ class ServerRpcInfo { // Runs interceptor at pos \a pos. void RunInterceptor( experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) { - GPR_ASSERT(pos < interceptors_.size()); + CHECK_LT(pos, interceptors_.size()); interceptors_[pos]->Intercept(interceptor_methods); } diff --git a/include/grpcpp/support/sync_stream.h b/include/grpcpp/support/sync_stream.h index ce583f6ed7c..ab6ced7343b 100644 --- a/include/grpcpp/support/sync_stream.h +++ b/include/grpcpp/support/sync_stream.h @@ -19,6 +19,8 @@ #ifndef GRPCPP_SUPPORT_SYNC_STREAM_H #define GRPCPP_SUPPORT_SYNC_STREAM_H +#include "absl/log/check.h" + #include #include #include @@ -184,7 +186,7 @@ class ClientReader final : public ClientReaderInterface { /// the server will be accessible through the \a ClientContext used to /// construct this object. void WaitForInitialMetadata() override { - GPR_ASSERT(!context_->initial_metadata_received_); + CHECK(!context_->initial_metadata_received_); grpc::internal::CallOpSet ops; ops.RecvInitialMetadata(context_); @@ -230,7 +232,7 @@ class ClientReader final : public ClientReaderInterface { grpc::Status status; ops.ClientRecvStatus(context_, &status); call_.PerformOps(&ops); - GPR_ASSERT(cq_.Pluck(&ops)); + CHECK(cq_.Pluck(&ops)); return status; } @@ -259,7 +261,7 @@ class ClientReader final : public ClientReaderInterface { ops.SendInitialMetadata(&context->send_initial_metadata_, context->initial_metadata_flags()); // TODO(ctiller): don't assert - GPR_ASSERT(ops.SendMessagePtr(&request).ok()); + CHECK(ops.SendMessagePtr(&request).ok()); ops.ClientSendClose(); call_.PerformOps(&ops); cq_.Pluck(&ops); @@ -306,7 +308,7 @@ class ClientWriter : public ClientWriterInterface { /// Once complete, the initial metadata read from the server will be /// accessible through the \a ClientContext used to construct this object. void WaitForInitialMetadata() { - GPR_ASSERT(!context_->initial_metadata_received_); + CHECK(!context_->initial_metadata_received_); grpc::internal::CallOpSet ops; ops.RecvInitialMetadata(context_); @@ -364,7 +366,7 @@ class ClientWriter : public ClientWriterInterface { } finish_ops_.ClientRecvStatus(context_, &status); call_.PerformOps(&finish_ops_); - GPR_ASSERT(cq_.Pluck(&finish_ops_)); + CHECK(cq_.Pluck(&finish_ops_)); return status; } @@ -455,7 +457,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { /// Once complete, the initial metadata read from the server will be /// accessible through the \a ClientContext used to construct this object. void WaitForInitialMetadata() override { - GPR_ASSERT(!context_->initial_metadata_received_); + CHECK(!context_->initial_metadata_received_); grpc::internal::CallOpSet ops; ops.RecvInitialMetadata(context_); @@ -536,7 +538,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { grpc::Status status; ops.ClientRecvStatus(context_, &status); call_.PerformOps(&ops); - GPR_ASSERT(cq_.Pluck(&ops)); + CHECK(cq_.Pluck(&ops)); return status; } @@ -583,7 +585,7 @@ class ServerReader final : public ServerReaderInterface { /// for semantics. Note that initial metadata will be affected by the /// \a ServerContext associated with this call. void SendInitialMetadata() override { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); grpc::internal::CallOpSet ops; ops.SendInitialMetadata(&ctx_->initial_metadata_, @@ -640,7 +642,7 @@ class ServerWriter final : public ServerWriterInterface { /// Note that initial metadata will be affected by the /// \a ServerContext associated with this call. void SendInitialMetadata() override { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); grpc::internal::CallOpSet ops; ops.SendInitialMetadata(&ctx_->initial_metadata_, @@ -713,7 +715,7 @@ class ServerReaderWriterBody final { : call_(call), ctx_(ctx) {} void SendInitialMetadata() { - GPR_ASSERT(!ctx_->sent_initial_metadata_); + CHECK(!ctx_->sent_initial_metadata_); grpc::internal::CallOpSet ops; ops.SendInitialMetadata(&ctx_->initial_metadata_, diff --git a/package.xml b/package.xml index 6a184f74d73..8c820cd3fd0 100644 --- a/package.xml +++ b/package.xml @@ -105,10 +105,14 @@ + + + + + + - - @@ -1132,12 +1136,6 @@ - - - - - - @@ -1789,12 +1787,12 @@ + + - - diff --git a/src/core/BUILD b/src/core/BUILD index 23040cc5fe8..2381f637791 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -3309,29 +3309,6 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "client_channel_channelz", - srcs = [ - "client_channel/client_channel_channelz.cc", - ], - hdrs = [ - "client_channel/client_channel_channelz.h", - ], - external_deps = [ - "absl/base:core_headers", - "absl/strings", - ], - language = "c++", - deps = [ - "connectivity_state", - "json", - "//:channelz", - "//:gpr", - "//:grpc_public_hdrs", - "//:ref_counted_ptr", - ], -) - grpc_cc_library( name = "service_config_channel_arg_filter", srcs = [ @@ -5511,7 +5488,6 @@ grpc_cc_library( language = "c++", deps = [ "channel_args", - "client_channel_channelz", "client_channel_internal_header", "closure", "connectivity_state", @@ -7279,6 +7255,25 @@ grpc_cc_library( ], ) +grpc_cc_library( + name = "interception_chain", + srcs = [ + "lib/transport/interception_chain.cc", + ], + hdrs = [ + "lib/transport/interception_chain.h", + ], + deps = [ + "call_destination", + "call_filters", + "call_spine", + "match", + "metadata", + "ref_counted", + "//:gpr_platform", + ], +) + grpc_cc_library( name = "call_destination", hdrs = [ @@ -7355,17 +7350,19 @@ grpc_cc_library( ], deps = [ "1999", + "call_arena_allocator", + "call_filters", "for_each", "if", "latch", "message", "metadata", "pipe", - "prioritized_race", "promise_status", "status_flag", "try_seq", "//:gpr", + "//:legacy_context", "//:promise", ], ) @@ -7429,14 +7426,19 @@ grpc_cc_library( ) grpc_cc_library( - name = "call_size_estimator", + name = "call_arena_allocator", srcs = [ - "lib/transport/call_size_estimator.cc", + "lib/transport/call_arena_allocator.cc", ], hdrs = [ - "lib/transport/call_size_estimator.h", + "lib/transport/call_arena_allocator.h", + ], + deps = [ + "arena", + "memory_quota", + "ref_counted", + "//:gpr_platform", ], - deps = ["//:gpr_platform"], ) grpc_cc_library( diff --git a/src/core/lib/channel/channel_trace.cc b/src/core/channelz/channel_trace.cc similarity index 83% rename from src/core/lib/channel/channel_trace.cc rename to src/core/channelz/channel_trace.cc index 783a2f3b4b1..60b0a937c96 100644 --- a/src/core/lib/channel/channel_trace.cc +++ b/src/core/channelz/channel_trace.cc @@ -16,7 +16,7 @@ // // -#include "src/core/lib/channel/channel_trace.h" +#include "src/core/channelz/channel_trace.h" #include #include @@ -27,7 +27,7 @@ #include #include -#include "src/core/lib/channel/channelz.h" +#include "src/core/channelz/channelz.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/slice/slice.h" @@ -36,37 +36,68 @@ namespace grpc_core { namespace channelz { +// +// ChannelTrace::TraceEvent +// + ChannelTrace::TraceEvent::TraceEvent(Severity severity, const grpc_slice& data, RefCountedPtr referenced_entity) - : severity_(severity), + : timestamp_(Timestamp::Now().as_timespec(GPR_CLOCK_REALTIME)), + severity_(severity), data_(data), - timestamp_(Timestamp::Now().as_timespec(GPR_CLOCK_REALTIME)), - next_(nullptr), - referenced_entity_(std::move(referenced_entity)), - memory_usage_(sizeof(TraceEvent) + grpc_slice_memory_usage(data)) {} + memory_usage_(sizeof(TraceEvent) + grpc_slice_memory_usage(data)), + referenced_entity_(std::move(referenced_entity)) {} ChannelTrace::TraceEvent::TraceEvent(Severity severity, const grpc_slice& data) - : severity_(severity), - data_(data), - timestamp_(Timestamp::Now().as_timespec(GPR_CLOCK_REALTIME)), - next_(nullptr), - memory_usage_(sizeof(TraceEvent) + grpc_slice_memory_usage(data)) {} + : TraceEvent(severity, data, nullptr) {} ChannelTrace::TraceEvent::~TraceEvent() { CSliceUnref(data_); } -ChannelTrace::ChannelTrace(size_t max_event_memory) - : num_events_logged_(0), - event_list_memory_usage_(0), - max_event_memory_(max_event_memory), - head_trace_(nullptr), - tail_trace_(nullptr) { - if (max_event_memory_ == 0) { - return; // tracing is disabled if max_event_memory_ == 0 +namespace { + +const char* SeverityString(ChannelTrace::Severity severity) { + switch (severity) { + case ChannelTrace::Severity::Info: + return "CT_INFO"; + case ChannelTrace::Severity::Warning: + return "CT_WARNING"; + case ChannelTrace::Severity::Error: + return "CT_ERROR"; + default: + GPR_UNREACHABLE_CODE(return "CT_UNKNOWN"); + } +} + +} // anonymous namespace + +Json ChannelTrace::TraceEvent::RenderTraceEvent() const { + char* description = grpc_slice_to_c_string(data_); + Json::Object object = { + {"description", Json::FromString(description)}, + {"severity", Json::FromString(SeverityString(severity_))}, + {"timestamp", Json::FromString(gpr_format_timespec(timestamp_))}, + }; + gpr_free(description); + if (referenced_entity_ != nullptr) { + const bool is_channel = + (referenced_entity_->type() == BaseNode::EntityType::kTopLevelChannel || + referenced_entity_->type() == BaseNode::EntityType::kInternalChannel); + object[is_channel ? "channelRef" : "subchannelRef"] = Json::FromObject({ + {(is_channel ? "channelId" : "subchannelId"), + Json::FromString(absl::StrCat(referenced_entity_->uuid()))}, + }); } - gpr_mu_init(&tracer_mu_); - time_created_ = Timestamp::Now().as_timespec(GPR_CLOCK_REALTIME); + return Json::FromObject(std::move(object)); } +// +// ChannelTrace +// + +ChannelTrace::ChannelTrace(size_t max_event_memory) + : max_event_memory_(max_event_memory), + time_created_(Timestamp::Now().as_timespec(GPR_CLOCK_REALTIME)) {} + ChannelTrace::~ChannelTrace() { if (max_event_memory_ == 0) { return; // tracing is disabled if max_event_memory_ == 0 @@ -77,10 +108,10 @@ ChannelTrace::~ChannelTrace() { it = it->next(); delete to_free; } - gpr_mu_destroy(&tracer_mu_); } void ChannelTrace::AddTraceEventHelper(TraceEvent* new_trace_event) { + MutexLock lock(&mu_); ++num_events_logged_; // first event case if (head_trace_ == nullptr) { @@ -121,43 +152,6 @@ void ChannelTrace::AddTraceEventWithReference( new TraceEvent(severity, data, std::move(referenced_entity))); } -namespace { - -const char* severity_string(ChannelTrace::Severity severity) { - switch (severity) { - case ChannelTrace::Severity::Info: - return "CT_INFO"; - case ChannelTrace::Severity::Warning: - return "CT_WARNING"; - case ChannelTrace::Severity::Error: - return "CT_ERROR"; - default: - GPR_UNREACHABLE_CODE(return "CT_UNKNOWN"); - } -} - -} // anonymous namespace - -Json ChannelTrace::TraceEvent::RenderTraceEvent() const { - char* description = grpc_slice_to_c_string(data_); - Json::Object object = { - {"description", Json::FromString(description)}, - {"severity", Json::FromString(severity_string(severity_))}, - {"timestamp", Json::FromString(gpr_format_timespec(timestamp_))}, - }; - gpr_free(description); - if (referenced_entity_ != nullptr) { - const bool is_channel = - (referenced_entity_->type() == BaseNode::EntityType::kTopLevelChannel || - referenced_entity_->type() == BaseNode::EntityType::kInternalChannel); - object[is_channel ? "channelRef" : "subchannelRef"] = Json::FromObject({ - {(is_channel ? "channelId" : "subchannelId"), - Json::FromString(absl::StrCat(referenced_entity_->uuid()))}, - }); - } - return Json::FromObject(std::move(object)); -} - Json ChannelTrace::RenderJson() const { // Tracing is disabled if max_event_memory_ == 0. if (max_event_memory_ == 0) { @@ -167,6 +161,7 @@ Json ChannelTrace::RenderJson() const { {"creationTimestamp", Json::FromString(gpr_format_timespec(time_created_))}, }; + MutexLock lock(&mu_); if (num_events_logged_ > 0) { object["numEventsLogged"] = Json::FromString(absl::StrCat(num_events_logged_)); diff --git a/src/core/lib/channel/channel_trace.h b/src/core/channelz/channel_trace.h similarity index 83% rename from src/core/lib/channel/channel_trace.h rename to src/core/channelz/channel_trace.h index b4f40a68d38..b0465b5861a 100644 --- a/src/core/lib/channel/channel_trace.h +++ b/src/core/channelz/channel_trace.h @@ -16,18 +16,20 @@ // // -#ifndef GRPC_SRC_CORE_LIB_CHANNEL_CHANNEL_TRACE_H -#define GRPC_SRC_CORE_LIB_CHANNEL_CHANNEL_TRACE_H +#ifndef GRPC_SRC_CORE_CHANNELZ_CHANNEL_TRACE_H +#define GRPC_SRC_CORE_CHANNELZ_CHANNEL_TRACE_H #include #include +#include "absl/base/thread_annotations.h" + #include #include -#include #include #include "src/core/lib/gprpp/ref_counted_ptr.h" +#include "src/core/lib/gprpp/sync.h" #include "src/core/lib/json/json.h" namespace grpc_core { @@ -110,28 +112,29 @@ class ChannelTrace { size_t memory_usage() const { return memory_usage_; } private: - Severity severity_; - grpc_slice data_; - gpr_timespec timestamp_; - TraceEvent* next_; + const gpr_timespec timestamp_; + const Severity severity_; + const grpc_slice data_; + const size_t memory_usage_; // the tracer object for the (sub)channel that this trace event refers to. - RefCountedPtr referenced_entity_; - size_t memory_usage_; + const RefCountedPtr referenced_entity_; + TraceEvent* next_ = nullptr; }; // TraceEvent // Internal helper to add and link in a trace event void AddTraceEventHelper(TraceEvent* new_trace_event); - gpr_mu tracer_mu_; - uint64_t num_events_logged_; - size_t event_list_memory_usage_; - size_t max_event_memory_; - TraceEvent* head_trace_; - TraceEvent* tail_trace_; - gpr_timespec time_created_; + const size_t max_event_memory_; + const gpr_timespec time_created_; + + mutable Mutex mu_; + uint64_t num_events_logged_ ABSL_GUARDED_BY(mu_) = 0; + size_t event_list_memory_usage_ ABSL_GUARDED_BY(mu_) = 0; + TraceEvent* head_trace_ ABSL_GUARDED_BY(mu_) = nullptr; + TraceEvent* tail_trace_ ABSL_GUARDED_BY(mu_) = nullptr; }; } // namespace channelz } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_CHANNEL_CHANNEL_TRACE_H +#endif // GRPC_SRC_CORE_CHANNELZ_CHANNEL_TRACE_H diff --git a/src/core/lib/channel/channelz.cc b/src/core/channelz/channelz.cc similarity index 90% rename from src/core/lib/channel/channelz.cc rename to src/core/channelz/channelz.cc index d7ae044578e..bcfe0c6b3ea 100644 --- a/src/core/lib/channel/channelz.cc +++ b/src/core/channelz/channelz.cc @@ -16,7 +16,7 @@ // // -#include "src/core/lib/channel/channelz.h" +#include "src/core/channelz/channelz.h" #include #include @@ -32,10 +32,10 @@ #include #include +#include "src/core/channelz/channelz_registry.h" #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz_registry.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/resolved_address.h" @@ -262,6 +262,68 @@ void ChannelNode::RemoveChildSubchannel(intptr_t child_uuid) { child_subchannels_.erase(child_uuid); } +// +// SubchannelNode +// + +SubchannelNode::SubchannelNode(std::string target_address, + size_t channel_tracer_max_nodes) + : BaseNode(EntityType::kSubchannel, target_address), + target_(std::move(target_address)), + trace_(channel_tracer_max_nodes) {} + +SubchannelNode::~SubchannelNode() {} + +void SubchannelNode::UpdateConnectivityState(grpc_connectivity_state state) { + connectivity_state_.store(state, std::memory_order_relaxed); +} + +void SubchannelNode::SetChildSocket(RefCountedPtr socket) { + MutexLock lock(&socket_mu_); + child_socket_ = std::move(socket); +} + +Json SubchannelNode::RenderJson() { + // Create and fill the data child. + grpc_connectivity_state state = + connectivity_state_.load(std::memory_order_relaxed); + Json::Object data = { + {"state", Json::FromObject({ + {"state", Json::FromString(ConnectivityStateName(state))}, + })}, + {"target", Json::FromString(target_)}, + }; + // Fill in the channel trace if applicable + Json trace_json = trace_.RenderJson(); + if (trace_json.type() != Json::Type::kNull) { + data["trace"] = std::move(trace_json); + } + // Ask CallCountingHelper to populate call count data. + call_counter_.PopulateCallCounts(&data); + // Construct top-level object. + Json::Object object{ + {"ref", Json::FromObject({ + {"subchannelId", Json::FromString(absl::StrCat(uuid()))}, + })}, + {"data", Json::FromObject(std::move(data))}, + }; + // Populate the child socket. + RefCountedPtr child_socket; + { + MutexLock lock(&socket_mu_); + child_socket = child_socket_; + } + if (child_socket != nullptr && child_socket->uuid() != 0) { + object["socketRef"] = Json::FromArray({ + Json::FromObject({ + {"socketId", Json::FromString(absl::StrCat(child_socket->uuid()))}, + {"name", Json::FromString(child_socket->name())}, + }), + }); + } + return Json::FromObject(object); +} + // // ServerNode // diff --git a/src/core/lib/channel/channelz.h b/src/core/channelz/channelz.h similarity index 87% rename from src/core/lib/channel/channelz.h rename to src/core/channelz/channelz.h index cc83387c194..c7dd8561f57 100644 --- a/src/core/lib/channel/channelz.h +++ b/src/core/channelz/channelz.h @@ -16,8 +16,8 @@ // // -#ifndef GRPC_SRC_CORE_LIB_CHANNEL_CHANNELZ_H -#define GRPC_SRC_CORE_LIB_CHANNEL_CHANNELZ_H +#ifndef GRPC_SRC_CORE_CHANNELZ_CHANNELZ_H +#define GRPC_SRC_CORE_CHANNELZ_CHANNELZ_H #include @@ -28,6 +28,7 @@ #include #include +#include "absl/base/thread_annotations.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" @@ -36,7 +37,7 @@ #include #include -#include "src/core/lib/channel/channel_trace.h" +#include "src/core/channelz/channel_trace.h" #include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/per_cpu.h" @@ -245,6 +246,45 @@ class ChannelNode final : public BaseNode { std::set child_subchannels_; }; +// Handles channelz bookkeeping for subchannels +class SubchannelNode final : public BaseNode { + public: + SubchannelNode(std::string target_address, size_t channel_tracer_max_nodes); + ~SubchannelNode() override; + + // Sets the subchannel's connectivity state without health checking. + void UpdateConnectivityState(grpc_connectivity_state state); + + // Used when the subchannel's child socket changes. This should be set when + // the subchannel's transport is created and set to nullptr when the + // subchannel unrefs the transport. + void SetChildSocket(RefCountedPtr socket); + + Json RenderJson() override; + + // proxy methods to composed classes. + void AddTraceEvent(ChannelTrace::Severity severity, const grpc_slice& data) { + trace_.AddTraceEvent(severity, data); + } + void AddTraceEventWithReference(ChannelTrace::Severity severity, + const grpc_slice& data, + RefCountedPtr referenced_channel) { + trace_.AddTraceEventWithReference(severity, data, + std::move(referenced_channel)); + } + void RecordCallStarted() { call_counter_.RecordCallStarted(); } + void RecordCallFailed() { call_counter_.RecordCallFailed(); } + void RecordCallSucceeded() { call_counter_.RecordCallSucceeded(); } + + private: + std::atomic connectivity_state_{GRPC_CHANNEL_IDLE}; + Mutex socket_mu_; + RefCountedPtr child_socket_ ABSL_GUARDED_BY(socket_mu_); + std::string target_; + CallCountingHelper call_counter_; + ChannelTrace trace_; +}; + // Handles channelz bookkeeping for servers class ServerNode final : public BaseNode { public: @@ -380,4 +420,4 @@ class ListenSocketNode final : public BaseNode { } // namespace channelz } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_CHANNEL_CHANNELZ_H +#endif // GRPC_SRC_CORE_CHANNELZ_CHANNELZ_H diff --git a/src/core/lib/channel/channelz_registry.cc b/src/core/channelz/channelz_registry.cc similarity index 99% rename from src/core/lib/channel/channelz_registry.cc rename to src/core/channelz/channelz_registry.cc index e451b187d6b..04bf4a80903 100644 --- a/src/core/lib/channel/channelz_registry.cc +++ b/src/core/channelz/channelz_registry.cc @@ -16,7 +16,7 @@ // // -#include "src/core/lib/channel/channelz_registry.h" +#include "src/core/channelz/channelz_registry.h" #include #include @@ -30,7 +30,7 @@ #include #include -#include "src/core/lib/channel/channelz.h" +#include "src/core/channelz/channelz.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/json/json.h" diff --git a/src/core/lib/channel/channelz_registry.h b/src/core/channelz/channelz_registry.h similarity index 93% rename from src/core/lib/channel/channelz_registry.h rename to src/core/channelz/channelz_registry.h index b183d1690bf..39525597b4f 100644 --- a/src/core/lib/channel/channelz_registry.h +++ b/src/core/channelz/channelz_registry.h @@ -16,8 +16,8 @@ // // -#ifndef GRPC_SRC_CORE_LIB_CHANNEL_CHANNELZ_REGISTRY_H -#define GRPC_SRC_CORE_LIB_CHANNEL_CHANNELZ_REGISTRY_H +#ifndef GRPC_SRC_CORE_CHANNELZ_CHANNELZ_REGISTRY_H +#define GRPC_SRC_CORE_CHANNELZ_CHANNELZ_REGISTRY_H #include #include @@ -27,7 +27,7 @@ #include -#include "src/core/lib/channel/channelz.h" +#include "src/core/channelz/channelz.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/sync.h" @@ -99,4 +99,4 @@ class ChannelzRegistry final { } // namespace channelz } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_CHANNEL_CHANNELZ_REGISTRY_H +#endif // GRPC_SRC_CORE_CHANNELZ_CHANNELZ_REGISTRY_H diff --git a/src/core/client_channel/client_channel_channelz.cc b/src/core/client_channel/client_channel_channelz.cc deleted file mode 100644 index 29be8b0a29b..00000000000 --- a/src/core/client_channel/client_channel_channelz.cc +++ /dev/null @@ -1,93 +0,0 @@ -// -// -// 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 "src/core/client_channel/client_channel_channelz.h" - -#include "absl/strings/str_cat.h" - -#include - -#include "src/core/lib/transport/connectivity_state.h" - -// IWYU pragma: no_include - -namespace grpc_core { -namespace channelz { - -SubchannelNode::SubchannelNode(std::string target_address, - size_t channel_tracer_max_nodes) - : BaseNode(EntityType::kSubchannel, target_address), - target_(std::move(target_address)), - trace_(channel_tracer_max_nodes) {} - -SubchannelNode::~SubchannelNode() {} - -void SubchannelNode::UpdateConnectivityState(grpc_connectivity_state state) { - connectivity_state_.store(state, std::memory_order_relaxed); -} - -void SubchannelNode::SetChildSocket(RefCountedPtr socket) { - MutexLock lock(&socket_mu_); - child_socket_ = std::move(socket); -} - -Json SubchannelNode::RenderJson() { - // Create and fill the data child. - grpc_connectivity_state state = - connectivity_state_.load(std::memory_order_relaxed); - Json::Object data = { - {"state", Json::FromObject({ - {"state", Json::FromString(ConnectivityStateName(state))}, - })}, - {"target", Json::FromString(target_)}, - }; - // Fill in the channel trace if applicable - Json trace_json = trace_.RenderJson(); - if (trace_json.type() != Json::Type::kNull) { - data["trace"] = std::move(trace_json); - } - // Ask CallCountingHelper to populate call count data. - call_counter_.PopulateCallCounts(&data); - // Construct top-level object. - Json::Object object{ - {"ref", Json::FromObject({ - {"subchannelId", Json::FromString(absl::StrCat(uuid()))}, - })}, - {"data", Json::FromObject(std::move(data))}, - }; - // Populate the child socket. - RefCountedPtr child_socket; - { - MutexLock lock(&socket_mu_); - child_socket = child_socket_; - } - if (child_socket != nullptr && child_socket->uuid() != 0) { - object["socketRef"] = Json::FromArray({ - Json::FromObject({ - {"socketId", Json::FromString(absl::StrCat(child_socket->uuid()))}, - {"name", Json::FromString(child_socket->name())}, - }), - }); - } - return Json::FromObject(object); -} - -} // namespace channelz -} // namespace grpc_core diff --git a/src/core/client_channel/client_channel_channelz.h b/src/core/client_channel/client_channel_channelz.h deleted file mode 100644 index 8311b61356d..00000000000 --- a/src/core/client_channel/client_channel_channelz.h +++ /dev/null @@ -1,85 +0,0 @@ -// -// -// 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. -// -// - -#ifndef GRPC_SRC_CORE_CLIENT_CHANNEL_CLIENT_CHANNEL_CHANNELZ_H -#define GRPC_SRC_CORE_CLIENT_CHANNEL_CLIENT_CHANNEL_CHANNELZ_H - -#include - -#include - -#include -#include -#include - -#include "absl/base/thread_annotations.h" - -#include -#include - -#include "src/core/lib/channel/channel_trace.h" -#include "src/core/lib/channel/channelz.h" -#include "src/core/lib/gprpp/ref_counted_ptr.h" -#include "src/core/lib/gprpp/sync.h" -#include "src/core/lib/json/json.h" - -namespace grpc_core { -namespace channelz { - -class SubchannelNode final : public BaseNode { - public: - SubchannelNode(std::string target_address, size_t channel_tracer_max_nodes); - ~SubchannelNode() override; - - // Sets the subchannel's connectivity state without health checking. - void UpdateConnectivityState(grpc_connectivity_state state); - - // Used when the subchannel's child socket changes. This should be set when - // the subchannel's transport is created and set to nullptr when the - // subchannel unrefs the transport. - void SetChildSocket(RefCountedPtr socket); - - Json RenderJson() override; - - // proxy methods to composed classes. - void AddTraceEvent(ChannelTrace::Severity severity, const grpc_slice& data) { - trace_.AddTraceEvent(severity, data); - } - void AddTraceEventWithReference(ChannelTrace::Severity severity, - const grpc_slice& data, - RefCountedPtr referenced_channel) { - trace_.AddTraceEventWithReference(severity, data, - std::move(referenced_channel)); - } - void RecordCallStarted() { call_counter_.RecordCallStarted(); } - void RecordCallFailed() { call_counter_.RecordCallFailed(); } - void RecordCallSucceeded() { call_counter_.RecordCallSucceeded(); } - - private: - std::atomic connectivity_state_{GRPC_CHANNEL_IDLE}; - Mutex socket_mu_; - RefCountedPtr child_socket_ ABSL_GUARDED_BY(socket_mu_); - std::string target_; - CallCountingHelper call_counter_; - ChannelTrace trace_; -}; - -} // namespace channelz -} // namespace grpc_core - -#endif // GRPC_SRC_CORE_CLIENT_CHANNEL_CLIENT_CHANNEL_CHANNELZ_H diff --git a/src/core/client_channel/client_channel_filter.cc b/src/core/client_channel/client_channel_filter.cc index b7d4d6d4952..cfa5b3fd283 100644 --- a/src/core/client_channel/client_channel_filter.cc +++ b/src/core/client_channel/client_channel_filter.cc @@ -49,8 +49,8 @@ #include #include +#include "src/core/channelz/channel_trace.h" #include "src/core/client_channel/backup_poller.h" -#include "src/core/client_channel/client_channel_channelz.h" #include "src/core/client_channel/client_channel_internal.h" #include "src/core/client_channel/client_channel_service_config.h" #include "src/core/client_channel/config_selector.h" @@ -63,7 +63,6 @@ #include "src/core/ext/filters/deadline/deadline_filter.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" -#include "src/core/lib/channel/channel_trace.h" #include "src/core/lib/channel/status_util.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/trace.h" diff --git a/src/core/client_channel/client_channel_filter.h b/src/core/client_channel/client_channel_filter.h index 23819b33073..f9ae44b0d26 100644 --- a/src/core/client_channel/client_channel_filter.h +++ b/src/core/client_channel/client_channel_filter.h @@ -37,6 +37,7 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/client_channel/client_channel_factory.h" #include "src/core/client_channel/config_selector.h" #include "src/core/client_channel/dynamic_filters.h" @@ -46,7 +47,6 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/channel/context.h" #include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gprpp/orphanable.h" diff --git a/src/core/client_channel/connector.h b/src/core/client_channel/connector.h index 7b1e73f63fb..5c218dd7d41 100644 --- a/src/core/client_channel/connector.h +++ b/src/core/client_channel/connector.h @@ -19,8 +19,8 @@ #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" diff --git a/src/core/client_channel/subchannel.cc b/src/core/client_channel/subchannel.cc index 6e8d1c41507..29bf5e2b86e 100644 --- a/src/core/client_channel/subchannel.cc +++ b/src/core/client_channel/subchannel.cc @@ -37,14 +37,14 @@ #include #include +#include "src/core/channelz/channel_trace.h" +#include "src/core/channelz/channelz.h" #include "src/core/client_channel/subchannel_pool_interface.h" #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/backoff/backoff.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/channel_stack_builder_impl.h" -#include "src/core/lib/channel/channel_trace.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/stats_data.h" diff --git a/src/core/client_channel/subchannel.h b/src/core/client_channel/subchannel.h index 174e48df403..6fbe389da5c 100644 --- a/src/core/client_channel/subchannel.h +++ b/src/core/client_channel/subchannel.h @@ -31,7 +31,6 @@ #include #include -#include "src/core/client_channel/client_channel_channelz.h" #include "src/core/client_channel/connector.h" #include "src/core/client_channel/subchannel_pool_interface.h" #include "src/core/lib/backoff/backoff.h" diff --git a/src/core/ext/transport/binder/.clang-format b/src/core/ext/transport/binder/.clang-format index 64387e9e515..5f150ef6edb 100644 --- a/src/core/ext/transport/binder/.clang-format +++ b/src/core/ext/transport/binder/.clang-format @@ -5,9 +5,6 @@ DerivePointerAlignment: false PointerAlignment: Left IncludeBlocks: Regroup IncludeCategories: - # port_platform.h is before almost everything - - Regex: '^' - Priority: -100 # ruby.h is even more first if it's included - Regex: '^' Priority: -200 diff --git a/src/core/ext/transport/binder/client/binder_connector.h b/src/core/ext/transport/binder/client/binder_connector.h index 4a350251677..e054e3555c5 100644 --- a/src/core/ext/transport/binder/client/binder_connector.h +++ b/src/core/ext/transport/binder/client/binder_connector.h @@ -15,8 +15,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_BINDER_CONNECTOR_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_BINDER_CONNECTOR_H -#include - #include #include @@ -24,6 +22,7 @@ #include "absl/strings/strip.h" #include +#include #include #include diff --git a/src/core/ext/transport/binder/client/channel_create.cc b/src/core/ext/transport/binder/client/channel_create.cc index efae0104b28..484695537fb 100644 --- a/src/core/ext/transport/binder/client/channel_create.cc +++ b/src/core/ext/transport/binder/client/channel_create.cc @@ -34,13 +34,12 @@ #ifdef GPR_SUPPORT_BINDER_TRANSPORT -#include - #include "absl/memory/memory.h" #include "absl/strings/substitute.h" #include "absl/time/clock.h" #include "absl/time/time.h" +#include #include #include "src/core/client_channel/client_channel_filter.h" diff --git a/src/core/ext/transport/binder/client/channel_create_impl.cc b/src/core/ext/transport/binder/client/channel_create_impl.cc index d9d5208f9a9..3d80e329c7b 100644 --- a/src/core/ext/transport/binder/client/channel_create_impl.cc +++ b/src/core/ext/transport/binder/client/channel_create_impl.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/binder/client/channel_create_impl.h" +#include + #ifndef GRPC_NO_BINDER #include diff --git a/src/core/ext/transport/binder/client/channel_create_impl.h b/src/core/ext/transport/binder/client/channel_create_impl.h index 7f00a5e1e09..0cc87a5a62e 100644 --- a/src/core/ext/transport/binder/client/channel_create_impl.h +++ b/src/core/ext/transport/binder/client/channel_create_impl.h @@ -16,7 +16,6 @@ #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_CHANNEL_CREATE_IMPL_H #include - #include #include "src/core/ext/transport/binder/wire_format/binder.h" diff --git a/src/core/ext/transport/binder/client/connection_id_generator.cc b/src/core/ext/transport/binder/client/connection_id_generator.cc index f4b4954d8a4..8f434338be0 100644 --- a/src/core/ext/transport/binder/client/connection_id_generator.cc +++ b/src/core/ext/transport/binder/client/connection_id_generator.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/binder/client/connection_id_generator.h" +#include + #ifndef GRPC_NO_BINDER #include "absl/strings/str_cat.h" diff --git a/src/core/ext/transport/binder/client/connection_id_generator.h b/src/core/ext/transport/binder/client/connection_id_generator.h index de8c780a0a3..d756ec1ced3 100644 --- a/src/core/ext/transport/binder/client/connection_id_generator.h +++ b/src/core/ext/transport/binder/client/connection_id_generator.h @@ -15,12 +15,12 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_CONNECTION_ID_GENERATOR_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_CONNECTION_ID_GENERATOR_H -#include - #include #include "absl/strings/string_view.h" +#include + #include "src/core/lib/gprpp/sync.h" namespace grpc_binder { diff --git a/src/core/ext/transport/binder/client/endpoint_binder_pool.cc b/src/core/ext/transport/binder/client/endpoint_binder_pool.cc index 6ed85621339..4241ccd77fd 100644 --- a/src/core/ext/transport/binder/client/endpoint_binder_pool.cc +++ b/src/core/ext/transport/binder/client/endpoint_binder_pool.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/binder/client/endpoint_binder_pool.h" +#include + #ifndef GRPC_NO_BINDER #include "src/core/ext/transport/binder/client/jni_utils.h" diff --git a/src/core/ext/transport/binder/client/endpoint_binder_pool.h b/src/core/ext/transport/binder/client/endpoint_binder_pool.h index 8b1f27bd421..f3452009b67 100644 --- a/src/core/ext/transport/binder/client/endpoint_binder_pool.h +++ b/src/core/ext/transport/binder/client/endpoint_binder_pool.h @@ -15,13 +15,13 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_ENDPOINT_BINDER_POOL_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_ENDPOINT_BINDER_POOL_H -#include - #include #include #include "absl/container/flat_hash_map.h" +#include + #include "src/core/ext/transport/binder/wire_format/binder.h" #include "src/core/lib/gprpp/sync.h" diff --git a/src/core/ext/transport/binder/client/jni_utils.cc b/src/core/ext/transport/binder/client/jni_utils.cc index e0e3f59582b..698fb3242e7 100644 --- a/src/core/ext/transport/binder/client/jni_utils.cc +++ b/src/core/ext/transport/binder/client/jni_utils.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/binder/client/jni_utils.h" +#include + #ifndef GRPC_NO_BINDER #include diff --git a/src/core/ext/transport/binder/client/jni_utils.h b/src/core/ext/transport/binder/client/jni_utils.h index 40c76693d7d..1c809b127c8 100644 --- a/src/core/ext/transport/binder/client/jni_utils.h +++ b/src/core/ext/transport/binder/client/jni_utils.h @@ -17,8 +17,6 @@ #if defined(ANDROID) || defined(__ANDROID__) -#include - #include #include @@ -26,6 +24,8 @@ #include "absl/strings/string_view.h" +#include + namespace grpc_binder { // Finds NativeConnectionHelper Java class and caches it. This is useful because diff --git a/src/core/ext/transport/binder/client/security_policy_setting.h b/src/core/ext/transport/binder/client/security_policy_setting.h index d7621ff70f1..212603744b9 100644 --- a/src/core/ext/transport/binder/client/security_policy_setting.h +++ b/src/core/ext/transport/binder/client/security_policy_setting.h @@ -15,11 +15,10 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_SECURITY_POLICY_SETTING_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_CLIENT_SECURITY_POLICY_SETTING_H -#include - #include "absl/container/flat_hash_map.h" #include "absl/strings/string_view.h" +#include #include #include "src/core/lib/gprpp/sync.h" diff --git a/src/core/ext/transport/binder/server/binder_server.cc b/src/core/ext/transport/binder/server/binder_server.cc index 994d8f82cb8..3afbd2ef615 100644 --- a/src/core/ext/transport/binder/server/binder_server.cc +++ b/src/core/ext/transport/binder/server/binder_server.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/binder/server/binder_server.h" +#include + #ifndef GRPC_NO_BINDER #include diff --git a/src/core/ext/transport/binder/server/binder_server.h b/src/core/ext/transport/binder/server/binder_server.h index c5330d474ed..0a1a36e8ba3 100644 --- a/src/core/ext/transport/binder/server/binder_server.h +++ b/src/core/ext/transport/binder/server/binder_server.h @@ -15,13 +15,12 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_SERVER_BINDER_SERVER_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_SERVER_BINDER_SERVER_H -#include - #include #include "absl/container/flat_hash_map.h" #include "absl/status/status.h" +#include #include #include "src/core/ext/transport/binder/transport/binder_transport.h" diff --git a/src/core/ext/transport/binder/transport/binder_transport.cc b/src/core/ext/transport/binder/transport/binder_transport.cc index aad7b43f213..8491277517a 100644 --- a/src/core/ext/transport/binder/transport/binder_transport.cc +++ b/src/core/ext/transport/binder/transport/binder_transport.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/binder/transport/binder_transport.h" +#include + #ifndef GRPC_NO_BINDER #include diff --git a/src/core/ext/transport/binder/transport/binder_transport.h b/src/core/ext/transport/binder/transport/binder_transport.h index fe219ba98e9..64f8a28e1f9 100644 --- a/src/core/ext/transport/binder/transport/binder_transport.h +++ b/src/core/ext/transport/binder/transport/binder_transport.h @@ -15,8 +15,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_TRANSPORT_BINDER_TRANSPORT_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_TRANSPORT_BINDER_TRANSPORT_H -#include - #include #include #include @@ -26,6 +24,7 @@ #include "absl/container/flat_hash_map.h" #include +#include #include #include "src/core/ext/transport/binder/utils/transport_stream_receiver.h" @@ -42,8 +41,7 @@ struct grpc_binder_stream; // depends on what style we want to follow) // TODO(mingcl): Decide casing for this class name. Should we use C-style class // name here or just go with C++ style? -struct grpc_binder_transport final : public grpc_core::Transport, - public grpc_core::FilterStackTransport { +struct grpc_binder_transport final : public grpc_core::FilterStackTransport { explicit grpc_binder_transport( std::unique_ptr binder, bool is_client, std::shared_ptr diff --git a/src/core/ext/transport/binder/utils/ndk_binder.cc b/src/core/ext/transport/binder/utils/ndk_binder.cc index 20dd4908320..39e9e9771e5 100644 --- a/src/core/ext/transport/binder/utils/ndk_binder.cc +++ b/src/core/ext/transport/binder/utils/ndk_binder.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/binder/utils/ndk_binder.h" +#include + #ifndef GRPC_NO_BINDER #ifdef GPR_SUPPORT_BINDER_TRANSPORT diff --git a/src/core/ext/transport/binder/utils/transport_stream_receiver.h b/src/core/ext/transport/binder/utils/transport_stream_receiver.h index cbd6f6ae247..fa7dd21472d 100644 --- a/src/core/ext/transport/binder/utils/transport_stream_receiver.h +++ b/src/core/ext/transport/binder/utils/transport_stream_receiver.h @@ -15,14 +15,14 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_TRANSPORT_STREAM_RECEIVER_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_TRANSPORT_STREAM_RECEIVER_H -#include - #include #include #include #include "absl/status/statusor.h" +#include + #include "src/core/ext/transport/binder/wire_format/transaction.h" namespace grpc_binder { diff --git a/src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc b/src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc index d569d1fb614..23c9a4f4734 100644 --- a/src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc +++ b/src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h" +#include + #ifndef GRPC_NO_BINDER #include diff --git a/src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h b/src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h index be2676a56f9..6fe22df4692 100644 --- a/src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h +++ b/src/core/ext/transport/binder/utils/transport_stream_receiver_impl.h @@ -15,8 +15,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_TRANSPORT_STREAM_RECEIVER_IMPL_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_UTILS_TRANSPORT_STREAM_RECEIVER_IMPL_H -#include - #include #include #include @@ -24,6 +22,8 @@ #include #include +#include + #include "src/core/ext/transport/binder/utils/transport_stream_receiver.h" #include "src/core/lib/gprpp/sync.h" diff --git a/src/core/ext/transport/binder/wire_format/binder.h b/src/core/ext/transport/binder/wire_format/binder.h index 2dce384e102..ce79c1332e8 100644 --- a/src/core/ext/transport/binder/wire_format/binder.h +++ b/src/core/ext/transport/binder/wire_format/binder.h @@ -15,8 +15,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_BINDER_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_BINDER_H -#include - #include #include #include @@ -25,6 +23,8 @@ #include "absl/status/status.h" #include "absl/strings/string_view.h" +#include + #include "src/core/ext/transport/binder/wire_format/binder_constants.h" #include "src/core/lib/gprpp/orphanable.h" diff --git a/src/core/ext/transport/binder/wire_format/binder_constants.h b/src/core/ext/transport/binder/wire_format/binder_constants.h index 0dacaa742c0..562f248ec0d 100644 --- a/src/core/ext/transport/binder/wire_format/binder_constants.h +++ b/src/core/ext/transport/binder/wire_format/binder_constants.h @@ -15,12 +15,12 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_BINDER_CONSTANTS_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_BINDER_CONSTANTS_H -#include - #include #include "absl/base/attributes.h" +#include + using transaction_code_t = uint32_t; ABSL_CONST_INIT extern const int FIRST_CALL_TRANSACTION; diff --git a/src/core/ext/transport/binder/wire_format/transaction.h b/src/core/ext/transport/binder/wire_format/transaction.h index 93e0883c3f1..c4681d19cbc 100644 --- a/src/core/ext/transport/binder/wire_format/transaction.h +++ b/src/core/ext/transport/binder/wire_format/transaction.h @@ -15,14 +15,13 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_TRANSACTION_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_TRANSACTION_H -#include - #include #include #include "absl/strings/string_view.h" #include +#include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/ext/transport/binder/wire_format/wire_reader.h b/src/core/ext/transport/binder/wire_format/wire_reader.h index 5fa98512cca..2a4092d29d9 100644 --- a/src/core/ext/transport/binder/wire_format/wire_reader.h +++ b/src/core/ext/transport/binder/wire_format/wire_reader.h @@ -15,11 +15,11 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_WIRE_READER_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_WIRE_READER_H -#include - #include #include +#include + #include "src/core/ext/transport/binder/wire_format/binder.h" #include "src/core/ext/transport/binder/wire_format/wire_writer.h" #include "src/core/lib/gprpp/orphanable.h" diff --git a/src/core/ext/transport/binder/wire_format/wire_reader_impl.cc b/src/core/ext/transport/binder/wire_format/wire_reader_impl.cc index 3a9860a8ef1..607127400ae 100644 --- a/src/core/ext/transport/binder/wire_format/wire_reader_impl.cc +++ b/src/core/ext/transport/binder/wire_format/wire_reader_impl.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/binder/wire_format/wire_reader_impl.h" +#include + #ifndef GRPC_NO_BINDER #include diff --git a/src/core/ext/transport/binder/wire_format/wire_reader_impl.h b/src/core/ext/transport/binder/wire_format/wire_reader_impl.h index 23f0235cede..48e80f718f6 100644 --- a/src/core/ext/transport/binder/wire_format/wire_reader_impl.h +++ b/src/core/ext/transport/binder/wire_format/wire_reader_impl.h @@ -15,8 +15,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_WIRE_READER_IMPL_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_WIRE_READER_IMPL_H -#include - #include #include #include @@ -24,6 +22,7 @@ #include "absl/container/flat_hash_map.h" #include "absl/functional/any_invocable.h" +#include #include #include "src/core/ext/transport/binder/utils/transport_stream_receiver.h" diff --git a/src/core/ext/transport/binder/wire_format/wire_writer.cc b/src/core/ext/transport/binder/wire_format/wire_writer.cc index f1bfd19eb9a..1daef583ef5 100644 --- a/src/core/ext/transport/binder/wire_format/wire_writer.cc +++ b/src/core/ext/transport/binder/wire_format/wire_writer.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/binder/wire_format/wire_writer.h" +#include + #ifndef GRPC_NO_BINDER #include diff --git a/src/core/ext/transport/binder/wire_format/wire_writer.h b/src/core/ext/transport/binder/wire_format/wire_writer.h index eb00e9387cc..bb52c7385cc 100644 --- a/src/core/ext/transport/binder/wire_format/wire_writer.h +++ b/src/core/ext/transport/binder/wire_format/wire_writer.h @@ -15,14 +15,14 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_WIRE_WRITER_H #define GRPC_SRC_CORE_EXT_TRANSPORT_BINDER_WIRE_FORMAT_WIRE_WRITER_H -#include - #include #include #include #include "absl/container/flat_hash_map.h" +#include + #include "src/core/ext/transport/binder/wire_format/binder.h" #include "src/core/ext/transport/binder/wire_format/transaction.h" #include "src/core/lib/gprpp/sync.h" diff --git a/src/core/ext/transport/chaotic_good/client_transport.h b/src/core/ext/transport/chaotic_good/client_transport.h index 89acb5f8d47..d08929b0f73 100644 --- a/src/core/ext/transport/chaotic_good/client_transport.h +++ b/src/core/ext/transport/chaotic_good/client_transport.h @@ -65,8 +65,7 @@ namespace grpc_core { namespace chaotic_good { -class ChaoticGoodClientTransport final : public Transport, - public ClientTransport { +class ChaoticGoodClientTransport final : public ClientTransport { public: ChaoticGoodClientTransport( PromiseEndpoint control_endpoint, PromiseEndpoint data_endpoint, diff --git a/src/core/ext/transport/chaotic_good/server/chaotic_good_server.h b/src/core/ext/transport/chaotic_good/server/chaotic_good_server.h index ed90dd45d1d..64083d2cd76 100644 --- a/src/core/ext/transport/chaotic_good/server/chaotic_good_server.h +++ b/src/core/ext/transport/chaotic_good/server/chaotic_good_server.h @@ -29,10 +29,10 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/hpack_encoder.h" #include "src/core/ext/transport/chttp2/transport/hpack_parser.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/closure.h" diff --git a/src/core/ext/transport/chaotic_good/server_transport.h b/src/core/ext/transport/chaotic_good/server_transport.h index 94b6d5b4aae..acdc88ef9fd 100644 --- a/src/core/ext/transport/chaotic_good/server_transport.h +++ b/src/core/ext/transport/chaotic_good/server_transport.h @@ -78,8 +78,7 @@ namespace grpc_core { namespace chaotic_good { -class ChaoticGoodServerTransport final : public Transport, - public ServerTransport { +class ChaoticGoodServerTransport final : public ServerTransport { public: ChaoticGoodServerTransport( const ChannelArgs& args, PromiseEndpoint control_endpoint, diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.cc b/src/core/ext/transport/chttp2/client/chttp2_connector.cc index 4914ea75a78..c3796209c84 100644 --- a/src/core/ext/transport/chttp2/client/chttp2_connector.cc +++ b/src/core/ext/transport/chttp2/client/chttp2_connector.cc @@ -38,6 +38,7 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/client_channel/client_channel_factory.h" #include "src/core/client_channel/client_channel_filter.h" #include "src/core/client_channel/connector.h" @@ -46,7 +47,6 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args_preconditioning.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/event_engine/channel_args_endpoint_config.h" diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc index 2e97b207ed2..180dc9836d7 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.cc +++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc @@ -46,12 +46,12 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/ext/transport/chttp2/transport/legacy_frame.h" #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/event_engine/channel_args_endpoint_config.h" diff --git a/src/core/ext/transport/chttp2/transport/.clang-format b/src/core/ext/transport/chttp2/transport/.clang-format index 64387e9e515..5f150ef6edb 100644 --- a/src/core/ext/transport/chttp2/transport/.clang-format +++ b/src/core/ext/transport/chttp2/transport/.clang-format @@ -5,9 +5,6 @@ DerivePointerAlignment: false PointerAlignment: Left IncludeBlocks: Regroup IncludeCategories: - # port_platform.h is before almost everything - - Regex: '^' - Priority: -100 # ruby.h is even more first if it's included - Regex: '^' Priority: -200 diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.cc b/src/core/ext/transport/chttp2/transport/bin_decoder.cc index be22231b074..78a55b6cecc 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.cc +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.cc @@ -16,14 +16,13 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/bin_decoder.h" #include "absl/base/attributes.h" #include #include +#include #include "src/core/lib/slice/slice.h" diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.h b/src/core/ext/transport/chttp2/transport/bin_decoder.h index a8eacc134fa..fc87450d365 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.h +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.h @@ -19,12 +19,11 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H -#include - #include #include #include +#include struct grpc_base64_decode_context { // input/output: diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.cc b/src/core/ext/transport/chttp2/transport/bin_encoder.cc index 033b4cb2252..821006f2ce6 100644 --- a/src/core/ext/transport/chttp2/transport/bin_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/bin_encoder.cc @@ -16,14 +16,13 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/bin_encoder.h" #include #include #include +#include #include "src/core/ext/transport/chttp2/transport/huffsyms.h" diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.h b/src/core/ext/transport/chttp2/transport/bin_encoder.h index 1b43d017055..fbada017abc 100644 --- a/src/core/ext/transport/chttp2/transport/bin_encoder.h +++ b/src/core/ext/transport/chttp2/transport/bin_encoder.h @@ -19,11 +19,10 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H -#include - #include #include +#include // base64 encode a slice. Returns a new slice, does not take ownership of the // input diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index a1e490e44b6..dff513f47da 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -14,8 +14,6 @@ // limitations under the License. // -#include - #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include @@ -54,6 +52,7 @@ #include #include #include +#include #include #include "src/core/ext/transport/chttp2/transport/context_list_entry.h" diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/src/core/ext/transport/chttp2/transport/chttp2_transport.h index 5388c4a4737..d83b38e8c5c 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.h +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.h @@ -19,19 +19,18 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H -#include - #include #include #include "absl/types/optional.h" #include +#include +#include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/flow_control.h" #include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" diff --git a/src/core/ext/transport/chttp2/transport/context_list_entry.h b/src/core/ext/transport/chttp2/transport/context_list_entry.h index 8368d807a99..cf080874fe7 100644 --- a/src/core/ext/transport/chttp2/transport/context_list_entry.h +++ b/src/core/ext/transport/chttp2/transport/context_list_entry.h @@ -19,8 +19,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CONTEXT_LIST_ENTRY_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CONTEXT_LIST_ENTRY_H -#include - #include #include @@ -28,6 +26,8 @@ #include #include +#include + #include "src/core/lib/channel/tcp_tracer.h" namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/decode_huff.cc b/src/core/ext/transport/chttp2/transport/decode_huff.cc index cdbab5a4e12..8a2300dac4b 100644 --- a/src/core/ext/transport/chttp2/transport/decode_huff.cc +++ b/src/core/ext/transport/chttp2/transport/decode_huff.cc @@ -15,9 +15,9 @@ // This file is autogenerated: see // tools/codegen/core/gen_huffman_decompressor.cc -#include - #include "src/core/ext/transport/chttp2/transport/decode_huff.h" + +#include namespace grpc_core { const uint8_t HuffDecoderCommon::table2_0_emit_[10] = { 0x30, 0x31, 0x32, 0x61, 0x63, 0x65, 0x69, 0x6f, 0x73, 0x74}; diff --git a/src/core/ext/transport/chttp2/transport/decode_huff.h b/src/core/ext/transport/chttp2/transport/decode_huff.h index 21f087585c0..2562f9d0d97 100644 --- a/src/core/ext/transport/chttp2/transport/decode_huff.h +++ b/src/core/ext/transport/chttp2/transport/decode_huff.h @@ -17,10 +17,10 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_DECODE_HUFF_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_DECODE_HUFF_H -#include - #include #include + +#include namespace grpc_core { class HuffDecoderCommon { protected: diff --git a/src/core/ext/transport/chttp2/transport/flow_control.cc b/src/core/ext/transport/chttp2/transport/flow_control.cc index a24828e7a11..5f8ece36e63 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.cc +++ b/src/core/ext/transport/chttp2/transport/flow_control.cc @@ -16,8 +16,6 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/flow_control.h" #include @@ -34,6 +32,7 @@ #include "absl/strings/str_join.h" #include +#include #include "src/core/ext/transport/chttp2/transport/http2_settings.h" #include "src/core/lib/experiments/experiments.h" diff --git a/src/core/ext/transport/chttp2/transport/flow_control.h b/src/core/ext/transport/chttp2/transport/flow_control.h index 82dde68754f..60ac7686fe3 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.h +++ b/src/core/ext/transport/chttp2/transport/flow_control.h @@ -19,8 +19,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FLOW_CONTROL_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FLOW_CONTROL_H -#include - #include #include @@ -34,6 +32,7 @@ #include "absl/types/optional.h" #include +#include #include "src/core/ext/transport/chttp2/transport/http2_settings.h" #include "src/core/lib/debug/trace.h" diff --git a/src/core/ext/transport/chttp2/transport/frame.cc b/src/core/ext/transport/chttp2/transport/frame.cc index 4a297d546d1..e416c8d0352 100644 --- a/src/core/ext/transport/chttp2/transport/frame.cc +++ b/src/core/ext/transport/chttp2/transport/frame.cc @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/chttp2/transport/frame.h" #include @@ -25,6 +23,7 @@ #include "absl/strings/str_cat.h" #include +#include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/ext/transport/chttp2/transport/frame.h b/src/core/ext/transport/chttp2/transport/frame.h index be20ef4a0c0..ac6b9e771dd 100644 --- a/src/core/ext/transport/chttp2/transport/frame.h +++ b/src/core/ext/transport/chttp2/transport/frame.h @@ -15,8 +15,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H -#include - #include #include #include @@ -26,6 +24,8 @@ #include "absl/types/span.h" #include "absl/types/variant.h" +#include + #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_buffer.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_data.cc b/src/core/ext/transport/chttp2/transport/frame_data.cc index e10dea34134..551887779f2 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.cc +++ b/src/core/ext/transport/chttp2/transport/frame_data.cc @@ -16,8 +16,6 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/frame_data.h" #include @@ -27,6 +25,7 @@ #include #include +#include #include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/lib/experiments/experiments.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index a3327d38343..1e628d48ddf 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -21,13 +21,12 @@ // Parser for GRPC streams embedded in DATA frames -#include - #include #include "absl/status/status.h" #include +#include #include "src/core/ext/transport/chttp2/transport/legacy_frame.h" #include "src/core/lib/iomgr/error.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.cc b/src/core/ext/transport/chttp2/transport/frame_goaway.cc index e7d1c558d4f..7122d67901d 100644 --- a/src/core/ext/transport/chttp2/transport/frame_goaway.cc +++ b/src/core/ext/transport/chttp2/transport/frame_goaway.cc @@ -16,8 +16,6 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/frame_goaway.h" #include @@ -30,6 +28,7 @@ #include #include #include +#include #include "src/core/ext/transport/chttp2/transport/internal.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.h b/src/core/ext/transport/chttp2/transport/frame_goaway.h index e4384049df1..40f132721e7 100644 --- a/src/core/ext/transport/chttp2/transport/frame_goaway.h +++ b/src/core/ext/transport/chttp2/transport/frame_goaway.h @@ -19,11 +19,10 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H -#include - #include #include +#include #include "src/core/ext/transport/chttp2/transport/legacy_frame.h" #include "src/core/lib/iomgr/error.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.cc b/src/core/ext/transport/chttp2/transport/frame_ping.cc index f2e92a2829d..e973958a60b 100644 --- a/src/core/ext/transport/chttp2/transport/frame_ping.cc +++ b/src/core/ext/transport/chttp2/transport/frame_ping.cc @@ -16,8 +16,6 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/frame_ping.h" #include @@ -31,6 +29,7 @@ #include #include +#include #include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/ext/transport/chttp2/transport/ping_abuse_policy.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.h b/src/core/ext/transport/chttp2/transport/frame_ping.h index 82c477de2e8..6f4cd55ff41 100644 --- a/src/core/ext/transport/chttp2/transport/frame_ping.h +++ b/src/core/ext/transport/chttp2/transport/frame_ping.h @@ -19,11 +19,10 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H -#include - #include #include +#include #include "src/core/ext/transport/chttp2/transport/legacy_frame.h" #include "src/core/lib/iomgr/error.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc b/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc index 71e5cd7098f..635489c953e 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc @@ -16,8 +16,6 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/frame_rst_stream.h" #include @@ -29,6 +27,7 @@ #include #include +#include #include "src/core/ext/transport/chttp2/transport/http_trace.h" #include "src/core/ext/transport/chttp2/transport/internal.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h index 6c7f3b95d30..1da9c0e457a 100644 --- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h @@ -19,11 +19,10 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H -#include - #include #include +#include #include "src/core/ext/transport/chttp2/transport/legacy_frame.h" #include "src/core/lib/iomgr/error.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.cc b/src/core/ext/transport/chttp2/transport/frame_settings.cc index c0e24c336ee..eb3343d0c3d 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.cc +++ b/src/core/ext/transport/chttp2/transport/frame_settings.cc @@ -16,8 +16,6 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/frame_settings.h" #include @@ -30,6 +28,7 @@ #include #include +#include #include "src/core/ext/transport/chttp2/transport/flow_control.h" #include "src/core/ext/transport/chttp2/transport/frame_goaway.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.h b/src/core/ext/transport/chttp2/transport/frame_settings.h index 56dc5baae6a..ba653c6a11c 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.h +++ b/src/core/ext/transport/chttp2/transport/frame_settings.h @@ -19,12 +19,11 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H -#include - #include #include #include +#include #include "src/core/ext/transport/chttp2/transport/http2_settings.h" #include "src/core/ext/transport/chttp2/transport/legacy_frame.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.cc b/src/core/ext/transport/chttp2/transport/frame_window_update.cc index 45c122065f3..5ec5db8d0da 100644 --- a/src/core/ext/transport/chttp2/transport/frame_window_update.cc +++ b/src/core/ext/transport/chttp2/transport/frame_window_update.cc @@ -16,8 +16,6 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/frame_window_update.h" #include @@ -27,6 +25,7 @@ #include "absl/strings/str_format.h" #include +#include #include "src/core/ext/transport/chttp2/transport/flow_control.h" #include "src/core/ext/transport/chttp2/transport/internal.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.h b/src/core/ext/transport/chttp2/transport/frame_window_update.h index 66f1843befa..92ea1587010 100644 --- a/src/core/ext/transport/chttp2/transport/frame_window_update.h +++ b/src/core/ext/transport/chttp2/transport/frame_window_update.h @@ -19,11 +19,10 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H -#include - #include #include +#include #include "src/core/ext/transport/chttp2/transport/legacy_frame.h" #include "src/core/lib/iomgr/error.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_constants.h b/src/core/ext/transport/chttp2/transport/hpack_constants.h index d709e0ba278..739c57ba3e3 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_constants.h +++ b/src/core/ext/transport/chttp2/transport/hpack_constants.h @@ -15,11 +15,11 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_CONSTANTS_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_CONSTANTS_H -#include - #include #include +#include + namespace grpc_core { namespace hpack_constants { // Per entry overhead bytes as per the spec diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index ed615d5acd6..c359a4334a7 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -16,8 +16,6 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/hpack_encoder.h" #include @@ -26,6 +24,7 @@ #include #include #include +#include #include "src/core/ext/transport/chttp2/transport/bin_encoder.h" #include "src/core/ext/transport/chttp2/transport/hpack_constants.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h index 1ec60140151..94c520ae55b 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h @@ -19,8 +19,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H -#include - #include #include @@ -33,6 +31,7 @@ #include #include +#include #include "src/core/ext/transport/chttp2/transport/hpack_constants.h" #include "src/core/ext/transport/chttp2/transport/hpack_encoder_table.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc index 55d2e444dda..92ba2f644ba 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/chttp2/transport/hpack_encoder_table.h" #include #include +#include namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h b/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h index 9716333773d..1bde664d0fd 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h @@ -15,14 +15,14 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_TABLE_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_TABLE_H -#include - #include #include #include #include +#include + #include "src/core/ext/transport/chttp2/transport/hpack_constants.h" namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc b/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc index 4e87d291d8c..be7aebf28f5 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h" #include #include "absl/strings/str_format.h" +#include + #include "src/core/ext/transport/chttp2/transport/hpack_constants.h" #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/iomgr/error.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_parse_result.h b/src/core/ext/transport/chttp2/transport/hpack_parse_result.h index 4a551e94475..f5296f61041 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +++ b/src/core/ext/transport/chttp2/transport/hpack_parse_result.h @@ -15,8 +15,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSE_RESULT_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSE_RESULT_H -#include - #include #include @@ -29,6 +27,7 @@ #include "absl/types/optional.h" #include +#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 9cc98d7e204..57a9a1e157a 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -16,8 +16,6 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/hpack_parser.h" #include @@ -39,6 +37,7 @@ #include #include +#include #include "src/core/ext/transport/chttp2/transport/decode_huff.h" #include "src/core/ext/transport/chttp2/transport/hpack_constants.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.h b/src/core/ext/transport/chttp2/transport/hpack_parser.h index fe13dd7b4f1..95f752c3ba8 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.h +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.h @@ -19,8 +19,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H -#include - #include #include @@ -36,6 +34,7 @@ #include "absl/types/variant.h" #include +#include #include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h" #include "src/core/ext/transport/chttp2/transport/hpack_parser_table.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc b/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc index c5479186e5a..2796f9571e2 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc @@ -16,8 +16,6 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/hpack_parser_table.h" #include @@ -32,6 +30,7 @@ #include "absl/strings/string_view.h" #include +#include #include "src/core/ext/transport/chttp2/transport/hpack_constants.h" #include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser_table.h b/src/core/ext/transport/chttp2/transport/hpack_parser_table.h index f8684511f5f..d126b3eeb43 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +++ b/src/core/ext/transport/chttp2/transport/hpack_parser_table.h @@ -19,8 +19,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_TABLE_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_TABLE_H -#include - #include #include @@ -29,6 +27,8 @@ #include "absl/functional/function_ref.h" +#include + #include "src/core/ext/transport/chttp2/transport/hpack_constants.h" #include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h" #include "src/core/lib/gprpp/no_destruct.h" diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.cc b/src/core/ext/transport/chttp2/transport/http2_settings.cc index d9e43412502..b3a6ab25417 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.cc +++ b/src/core/ext/transport/chttp2/transport/http2_settings.cc @@ -18,12 +18,12 @@ // Automatically generated by tools/codegen/core/gen_settings_ids.py // -#include - #include "src/core/ext/transport/chttp2/transport/http2_settings.h" #include "absl/strings/str_cat.h" +#include + #include "src/core/ext/transport/chttp2/transport/frame.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/transport/http2_errors.h" diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.h b/src/core/ext/transport/chttp2/transport/http2_settings.h index 8578d913407..8d65aa91085 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.h +++ b/src/core/ext/transport/chttp2/transport/http2_settings.h @@ -17,8 +17,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H -#include - #include #include @@ -27,6 +25,8 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" +#include + #include "src/core/ext/transport/chttp2/transport/frame.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/transport/http2_errors.h" diff --git a/src/core/ext/transport/chttp2/transport/http_trace.cc b/src/core/ext/transport/chttp2/transport/http_trace.cc index 1033102373f..41c17a33d34 100644 --- a/src/core/ext/transport/chttp2/transport/http_trace.cc +++ b/src/core/ext/transport/chttp2/transport/http_trace.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/chttp2/transport/http_trace.h" +#include + grpc_core::TraceFlag grpc_http_trace(false, "http"); diff --git a/src/core/ext/transport/chttp2/transport/huffsyms.cc b/src/core/ext/transport/chttp2/transport/huffsyms.cc index 32f451e3913..e6ef22056d6 100644 --- a/src/core/ext/transport/chttp2/transport/huffsyms.cc +++ b/src/core/ext/transport/chttp2/transport/huffsyms.cc @@ -16,10 +16,10 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/huffsyms.h" +#include + // Constants pulled from the HPACK spec, and converted to C using the vim // command: // :%s/.* \([0-9a-f]\+\) \[ *\([0-9]\+\)\]/{0x\1, \2},/g diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 250de698f4c..4714d4c7370 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -19,8 +19,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_INTERNAL_H -#include - #include #include @@ -39,8 +37,10 @@ #include #include #include +#include #include +#include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/context_list_entry.h" #include "src/core/ext/transport/chttp2/transport/flow_control.h" #include "src/core/ext/transport/chttp2/transport/frame_goaway.h" @@ -59,7 +59,6 @@ #include "src/core/ext/transport/chttp2/transport/write_size_policy.h" #include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/bitset.h" @@ -225,8 +224,7 @@ typedef enum { } grpc_chttp2_keepalive_state; struct grpc_chttp2_transport final - : public grpc_core::Transport, - public grpc_core::FilterStackTransport, + : public grpc_core::FilterStackTransport, public grpc_core::RefCounted, public grpc_core::KeepsGrpcInitialized { diff --git a/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.cc b/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.cc index efe4c31011e..1479edf450a 100644 --- a/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.cc +++ b/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.cc @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h" #include #include +#include namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h b/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h index e8ec52eeef1..a2a56d2bfe5 100644 --- a/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h +++ b/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h @@ -15,11 +15,11 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_MAX_CONCURRENT_STREAMS_POLICY_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_MAX_CONCURRENT_STREAMS_POLICY_H -#include - #include #include +#include + namespace grpc_core { class Chttp2MaxConcurrentStreamsPolicy { diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index 8f0757c053e..3a7460392a8 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -16,8 +16,6 @@ // // -#include - #include #include @@ -41,7 +39,9 @@ #include #include #include +#include +#include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/flow_control.h" #include "src/core/ext/transport/chttp2/transport/frame_data.h" #include "src/core/ext/transport/chttp2/transport/frame_goaway.h" @@ -59,7 +59,6 @@ #include "src/core/ext/transport/chttp2/transport/ping_rate_policy.h" #include "src/core/lib/backoff/random_early_detection.h" #include "src/core/lib/channel/call_tracer.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/channel/context.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/experiments/experiments.h" diff --git a/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc b/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc index 48e7b43586d..d1f371537f7 100644 --- a/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +++ b/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/chttp2/transport/ping_abuse_policy.h" #include @@ -22,6 +20,7 @@ #include "absl/types/optional.h" #include +#include namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h b/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h index 9663d23bb32..3d834a8665e 100644 --- a/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h +++ b/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h @@ -15,10 +15,10 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_PING_ABUSE_POLICY_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_PING_ABUSE_POLICY_H -#include - #include +#include + #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/time.h" diff --git a/src/core/ext/transport/chttp2/transport/ping_callbacks.cc b/src/core/ext/transport/chttp2/transport/ping_callbacks.cc index 4081f22af79..4b52aa04bf2 100644 --- a/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +++ b/src/core/ext/transport/chttp2/transport/ping_callbacks.cc @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/chttp2/transport/ping_callbacks.h" #include @@ -22,6 +20,7 @@ #include "absl/random/distributions.h" #include +#include grpc_core::TraceFlag grpc_ping_trace(false, "http2_ping"); diff --git a/src/core/ext/transport/chttp2/transport/ping_callbacks.h b/src/core/ext/transport/chttp2/transport/ping_callbacks.h index f1d8b826725..58a762aa013 100644 --- a/src/core/ext/transport/chttp2/transport/ping_callbacks.h +++ b/src/core/ext/transport/chttp2/transport/ping_callbacks.h @@ -15,8 +15,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_PING_CALLBACKS_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_PING_CALLBACKS_H -#include - #include #include @@ -30,6 +28,7 @@ #include "absl/types/optional.h" #include +#include #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/time.h" diff --git a/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc b/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc index 3bf1cf634bc..fed8ca20371 100644 --- a/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +++ b/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/chttp2/transport/ping_rate_policy.h" #include @@ -23,6 +21,7 @@ #include "absl/types/optional.h" #include +#include #include "src/core/lib/experiments/experiments.h" #include "src/core/lib/gprpp/match.h" diff --git a/src/core/ext/transport/chttp2/transport/ping_rate_policy.h b/src/core/ext/transport/chttp2/transport/ping_rate_policy.h index bf95315c94f..b9501686d95 100644 --- a/src/core/ext/transport/chttp2/transport/ping_rate_policy.h +++ b/src/core/ext/transport/chttp2/transport/ping_rate_policy.h @@ -15,8 +15,6 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_PING_RATE_POLICY_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_PING_RATE_POLICY_H -#include - #include #include @@ -24,6 +22,8 @@ #include "absl/types/variant.h" +#include + #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/time.h" diff --git a/src/core/ext/transport/chttp2/transport/stream_lists.cc b/src/core/ext/transport/chttp2/transport/stream_lists.cc index 36c09e773b5..7ba1242a7ed 100644 --- a/src/core/ext/transport/chttp2/transport/stream_lists.cc +++ b/src/core/ext/transport/chttp2/transport/stream_lists.cc @@ -16,9 +16,8 @@ // // -#include - #include +#include #include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/ext/transport/chttp2/transport/legacy_frame.h" diff --git a/src/core/ext/transport/chttp2/transport/varint.cc b/src/core/ext/transport/chttp2/transport/varint.cc index db08fe054bf..7af77e772be 100644 --- a/src/core/ext/transport/chttp2/transport/varint.cc +++ b/src/core/ext/transport/chttp2/transport/varint.cc @@ -16,12 +16,12 @@ // // -#include - #include "src/core/ext/transport/chttp2/transport/varint.h" #include "absl/base/attributes.h" +#include + namespace grpc_core { size_t VarintLength(size_t tail_value) { diff --git a/src/core/ext/transport/chttp2/transport/varint.h b/src/core/ext/transport/chttp2/transport/varint.h index 72c151022fe..3dc97f5240a 100644 --- a/src/core/ext/transport/chttp2/transport/varint.h +++ b/src/core/ext/transport/chttp2/transport/varint.h @@ -19,12 +19,11 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_VARINT_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_VARINT_H -#include - #include #include #include +#include // Helpers for hpack varint encoding diff --git a/src/core/ext/transport/chttp2/transport/write_size_policy.cc b/src/core/ext/transport/chttp2/transport/write_size_policy.cc index 9aae5197e56..34ec3e23699 100644 --- a/src/core/ext/transport/chttp2/transport/write_size_policy.cc +++ b/src/core/ext/transport/chttp2/transport/write_size_policy.cc @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "src/core/ext/transport/chttp2/transport/write_size_policy.h" #include #include +#include namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/write_size_policy.h b/src/core/ext/transport/chttp2/transport/write_size_policy.h index a300dbd4c2e..a1eae8fec9e 100644 --- a/src/core/ext/transport/chttp2/transport/write_size_policy.h +++ b/src/core/ext/transport/chttp2/transport/write_size_policy.h @@ -15,11 +15,11 @@ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_WRITE_SIZE_POLICY_H #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_WRITE_SIZE_POLICY_H -#include - #include #include +#include + #include "src/core/lib/gprpp/time.h" namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc index 71e987b4ef7..e3da6d1d65a 100644 --- a/src/core/ext/transport/chttp2/transport/writing.cc +++ b/src/core/ext/transport/chttp2/transport/writing.cc @@ -16,8 +16,6 @@ // // -#include - #include #include @@ -34,8 +32,10 @@ #include #include #include +#include #include +#include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/ext/transport/chttp2/transport/context_list_entry.h" #include "src/core/ext/transport/chttp2/transport/flow_control.h" @@ -54,7 +54,6 @@ #include "src/core/ext/transport/chttp2/transport/ping_rate_policy.h" #include "src/core/ext/transport/chttp2/transport/write_size_policy.h" #include "src/core/lib/channel/call_tracer.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/stats_data.h" #include "src/core/lib/debug/trace.h" diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc index d215ed860c5..1b8c3d117cf 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.cc +++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc @@ -119,8 +119,7 @@ static bidirectional_stream_callback cronet_callbacks = { on_canceled}; // Cronet transport object -struct grpc_cronet_transport final : public grpc_core::Transport, - public grpc_core::FilterStackTransport { +struct grpc_cronet_transport final : public grpc_core::FilterStackTransport { FilterStackTransport* filter_stack_transport() override { return this; } grpc_core::ClientTransport* client_transport() override { return nullptr; } grpc_core::ServerTransport* server_transport() override { return nullptr; } diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc index d49dce8daf6..731ea4c8309 100644 --- a/src/core/ext/transport/inproc/inproc_transport.cc +++ b/src/core/ext/transport/inproc/inproc_transport.cc @@ -34,7 +34,6 @@ namespace grpc_core { namespace { class InprocServerTransport final : public RefCounted, - public Transport, public ServerTransport { public: void SetAcceptor(Acceptor* acceptor) override { @@ -108,7 +107,7 @@ class InprocServerTransport final : public RefCounted, "inproc_server_transport", GRPC_CHANNEL_CONNECTING}; }; -class InprocClientTransport final : public Transport, public ClientTransport { +class InprocClientTransport final : public ClientTransport { public: void StartCall(CallHandler call_handler) override { call_handler.SpawnGuarded( diff --git a/src/core/ext/transport/inproc/legacy_inproc_transport.cc b/src/core/ext/transport/inproc/legacy_inproc_transport.cc index 4106c7ade7c..b6f9a0517a8 100644 --- a/src/core/ext/transport/inproc/legacy_inproc_transport.cc +++ b/src/core/ext/transport/inproc/legacy_inproc_transport.cc @@ -42,9 +42,9 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args_preconditioning.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -101,8 +101,7 @@ struct shared_mu { gpr_refcount refs; }; -struct inproc_transport final : public grpc_core::Transport, - public grpc_core::FilterStackTransport { +struct inproc_transport final : public grpc_core::FilterStackTransport { inproc_transport(shared_mu* mu, bool is_client) : mu(mu), is_client(is_client), diff --git a/src/core/ext/xds/xds_cluster.cc b/src/core/ext/xds/xds_cluster.cc index 194a88d5e49..313d513bf74 100644 --- a/src/core/ext/xds/xds_cluster.cc +++ b/src/core/ext/xds/xds_cluster.cc @@ -116,6 +116,15 @@ std::string XdsClusterResource::ToString() const { absl::StrCat("max_concurrent_requests=", max_concurrent_requests)); contents.push_back(absl::StrCat("override_host_statuses=", override_host_statuses.ToString())); + if (!service_telemetry_label.as_string_view().empty()) { + contents.push_back(absl::StrCat("service_name_telemetry_label=", + service_telemetry_label.as_string_view())); + } + if (!namespace_telemetry_label.as_string_view().empty()) { + contents.push_back( + absl::StrCat("service_namespace_telemetry_label=", + namespace_telemetry_label.as_string_view())); + } return absl::StrCat("{", absl::StrJoin(contents, ", "), "}"); } diff --git a/src/core/lib/channel/promise_based_filter.h b/src/core/lib/channel/promise_based_filter.h index 491cbe9c144..32af82253f0 100644 --- a/src/core/lib/channel/promise_based_filter.h +++ b/src/core/lib/channel/promise_based_filter.h @@ -49,6 +49,7 @@ #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/event_engine/event_engine_context.h" // IWYU pragma: keep #include "src/core/lib/gprpp/debug_location.h" +#include "src/core/lib/gprpp/match.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/call_combiner.h" #include "src/core/lib/iomgr/closure.h" @@ -84,12 +85,21 @@ class ChannelFilter { class Args { public: Args() : Args(nullptr, nullptr) {} - explicit Args(grpc_channel_stack* channel_stack, - grpc_channel_element* channel_element) - : channel_stack_(channel_stack), channel_element_(channel_element) {} + Args(grpc_channel_stack* channel_stack, + grpc_channel_element* channel_element) + : impl_(ChannelStackBased{channel_stack, channel_element}) {} + // While we're moving to call-v3 we need to have access to + // grpc_channel_stack & friends here. That means that we can't rely on this + // type signature from interception_chain.h, which means that we need a way + // of constructing this object without naming it ===> implicit construction. + // TODO(ctiller): remove this once we're fully on call-v3 + // NOLINTNEXTLINE(google-explicit-constructor) + Args(size_t instance_id) : impl_(V3Based{instance_id}) {} ABSL_DEPRECATED("Direct access to channel stack is deprecated") - grpc_channel_stack* channel_stack() const { return channel_stack_; } + grpc_channel_stack* channel_stack() const { + return absl::get(impl_).channel_stack; + } // Get the instance id of this filter. // This id is unique amongst all filters /of the same type/ and densely @@ -99,14 +109,29 @@ class ChannelFilter { // This is useful for filters that need to store per-instance data in a // parallel data structure. size_t instance_id() const { - return grpc_channel_stack_filter_instance_number(channel_stack_, - channel_element_); + return Match( + impl_, + [](const ChannelStackBased& cs) { + return grpc_channel_stack_filter_instance_number( + cs.channel_stack, cs.channel_element); + }, + [](const V3Based& v3) { return v3.instance_id; }); } private: friend class ChannelFilter; - grpc_channel_stack* channel_stack_; - grpc_channel_element* channel_element_; + + struct ChannelStackBased { + grpc_channel_stack* channel_stack; + grpc_channel_element* channel_element; + }; + + struct V3Based { + size_t instance_id; + }; + + using Impl = absl::variant; + Impl impl_; }; // Perform post-initialization step (if any). diff --git a/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc b/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc index 0b14723e214..a2307fe36f9 100644 --- a/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +++ b/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc @@ -249,9 +249,9 @@ void CFStreamEndpointImpl::Shutdown() { read_event_.SetShutdown(shutdownStatus); write_event_.SetShutdown(shutdownStatus); - CFReadStreamSetClient(cf_read_stream_, kCFStreamEventNone, nullptr, nullptr); - CFWriteStreamSetClient(cf_write_stream_, kCFStreamEventNone, nullptr, - nullptr); + CFReadStreamSetDispatchQueue(cf_read_stream_, nullptr); + CFWriteStreamSetDispatchQueue(cf_write_stream_, nullptr); + CFReadStreamClose(cf_read_stream_); CFWriteStreamClose(cf_write_stream_); } diff --git a/src/core/lib/event_engine/query_extensions.h b/src/core/lib/event_engine/query_extensions.h index 677e5b22d8b..2b39214e635 100644 --- a/src/core/lib/event_engine/query_extensions.h +++ b/src/core/lib/event_engine/query_extensions.h @@ -68,6 +68,7 @@ T* QueryExtension(EventEngine::Endpoint* endpoint) { /// supported by the listener. template T* QueryExtension(EventEngine::Listener* listener) { + if (listener == nullptr) return nullptr; return static_cast(listener->QueryExtension(T::EndpointExtensionName())); } @@ -75,6 +76,7 @@ T* QueryExtension(EventEngine::Listener* listener) { /// supported by the EventEngine. template T* QueryExtension(EventEngine* engine) { + if (engine == nullptr) return nullptr; return static_cast(engine->QueryExtension(T::EndpointExtensionName())); } diff --git a/src/core/lib/promise/detail/seq_state.h b/src/core/lib/promise/detail/seq_state.h index 604114af4ed..f22b312aba4 100644 --- a/src/core/lib/promise/detail/seq_state.h +++ b/src/core/lib/promise/detail/seq_state.h @@ -143,14 +143,14 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/2", this); } auto result = prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/2 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -176,12 +176,12 @@ struct SeqState { default: case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/2", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/2 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -286,14 +286,14 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/3", this); } auto result = prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/3 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -318,14 +318,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/3", this); } auto result = prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/3 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -351,12 +351,12 @@ struct SeqState { default: case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/3", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/3 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -488,14 +488,14 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/4", this); } auto result = prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/4 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -520,14 +520,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/4", this); } auto result = prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/4 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -552,14 +552,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/4", this); } auto result = prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/4 gets %s", this, p != nullptr ? (PromiseResultTraits2::IsOk(*p) @@ -585,12 +585,12 @@ struct SeqState { default: case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 4/4", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 4/4 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -750,14 +750,14 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/5", this); } auto result = prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/5 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -782,14 +782,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/5", this); } auto result = prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/5 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -814,14 +814,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/5", this); } auto result = prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/5 gets %s", this, p != nullptr ? (PromiseResultTraits2::IsOk(*p) @@ -846,14 +846,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 4/5", this); } auto result = prior.current_promise(); PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 4/5 gets %s", this, p != nullptr ? (PromiseResultTraits3::IsOk(*p) @@ -879,12 +879,12 @@ struct SeqState { default: case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 5/5", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 5/5 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -1081,14 +1081,14 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/6", this); } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/6 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -1114,14 +1114,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/6", this); } auto result = prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/6 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -1146,14 +1146,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/6", this); } auto result = prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/6 gets %s", this, p != nullptr ? (PromiseResultTraits2::IsOk(*p) @@ -1178,14 +1178,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 4/6", this); } auto result = prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 4/6 gets %s", this, p != nullptr ? (PromiseResultTraits3::IsOk(*p) @@ -1210,14 +1210,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 5/6", this); } auto result = prior.current_promise(); PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 5/6 gets %s", this, p != nullptr ? (PromiseResultTraits4::IsOk(*p) @@ -1243,12 +1243,12 @@ struct SeqState { default: case State::kState5: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 6/6", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 6/6 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -1477,14 +1477,14 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/7", this); } auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/7 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -1510,14 +1510,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/7", this); } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/7 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -1543,14 +1543,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/7", this); } auto result = prior.prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/7 gets %s", this, p != nullptr ? (PromiseResultTraits2::IsOk(*p) @@ -1575,14 +1575,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 4/7", this); } auto result = prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 4/7 gets %s", this, p != nullptr ? (PromiseResultTraits3::IsOk(*p) @@ -1607,14 +1607,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 5/7", this); } auto result = prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 5/7 gets %s", this, p != nullptr ? (PromiseResultTraits4::IsOk(*p) @@ -1639,14 +1639,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState5: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 6/7", this); } auto result = prior.current_promise(); PromiseResult5* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 6/7 gets %s", this, p != nullptr ? (PromiseResultTraits5::IsOk(*p) @@ -1672,12 +1672,12 @@ struct SeqState { default: case State::kState6: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 7/7", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 7/7 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -1939,7 +1939,7 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/8", this); } auto result = @@ -1947,7 +1947,7 @@ struct SeqState { PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/8 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -1974,14 +1974,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/8", this); } auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/8 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -2007,14 +2007,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/8", this); } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/8 gets %s", this, p != nullptr ? (PromiseResultTraits2::IsOk(*p) @@ -2040,14 +2040,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 4/8", this); } auto result = prior.prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 4/8 gets %s", this, p != nullptr ? (PromiseResultTraits3::IsOk(*p) @@ -2072,14 +2072,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 5/8", this); } auto result = prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 5/8 gets %s", this, p != nullptr ? (PromiseResultTraits4::IsOk(*p) @@ -2104,14 +2104,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState5: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 6/8", this); } auto result = prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 6/8 gets %s", this, p != nullptr ? (PromiseResultTraits5::IsOk(*p) @@ -2136,14 +2136,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState6: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 7/8", this); } auto result = prior.current_promise(); PromiseResult6* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 7/8 gets %s", this, p != nullptr ? (PromiseResultTraits6::IsOk(*p) @@ -2169,12 +2169,12 @@ struct SeqState { default: case State::kState7: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 8/8", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 8/8 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -2470,7 +2470,7 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/9", this); } auto result = @@ -2478,7 +2478,7 @@ struct SeqState { PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/9 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -2506,7 +2506,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/9", this); } auto result = @@ -2514,7 +2514,7 @@ struct SeqState { PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/9 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -2541,14 +2541,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/9", this); } auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/9 gets %s", this, p != nullptr ? (PromiseResultTraits2::IsOk(*p) @@ -2574,14 +2574,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 4/9", this); } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 4/9 gets %s", this, p != nullptr ? (PromiseResultTraits3::IsOk(*p) @@ -2607,14 +2607,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 5/9", this); } auto result = prior.prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 5/9 gets %s", this, p != nullptr ? (PromiseResultTraits4::IsOk(*p) @@ -2639,14 +2639,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState5: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 6/9", this); } auto result = prior.prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 6/9 gets %s", this, p != nullptr ? (PromiseResultTraits5::IsOk(*p) @@ -2671,14 +2671,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState6: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 7/9", this); } auto result = prior.prior.current_promise(); PromiseResult6* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 7/9 gets %s", this, p != nullptr ? (PromiseResultTraits6::IsOk(*p) @@ -2703,14 +2703,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState7: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 8/9", this); } auto result = prior.current_promise(); PromiseResult7* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 8/9 gets %s", this, p != nullptr ? (PromiseResultTraits7::IsOk(*p) @@ -2736,12 +2736,12 @@ struct SeqState { default: case State::kState8: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 9/9", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 9/9 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -3076,7 +3076,7 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/10", this); } auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -3084,7 +3084,7 @@ struct SeqState { PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/10 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -3114,7 +3114,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/10", this); } auto result = @@ -3122,7 +3122,7 @@ struct SeqState { PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/10 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -3150,7 +3150,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/10", this); } auto result = @@ -3158,7 +3158,7 @@ struct SeqState { PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/10 gets %s", this, p != nullptr ? (PromiseResultTraits2::IsOk(*p) @@ -3185,14 +3185,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 4/10", this); } auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 4/10 gets %s", this, p != nullptr ? (PromiseResultTraits3::IsOk(*p) @@ -3218,14 +3218,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 5/10", this); } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 5/10 gets %s", this, p != nullptr ? (PromiseResultTraits4::IsOk(*p) @@ -3251,14 +3251,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState5: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 6/10", this); } auto result = prior.prior.prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 6/10 gets %s", this, p != nullptr ? (PromiseResultTraits5::IsOk(*p) @@ -3283,14 +3283,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState6: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 7/10", this); } auto result = prior.prior.prior.current_promise(); PromiseResult6* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 7/10 gets %s", this, p != nullptr ? (PromiseResultTraits6::IsOk(*p) @@ -3315,14 +3315,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState7: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 8/10", this); } auto result = prior.prior.current_promise(); PromiseResult7* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 8/10 gets %s", this, p != nullptr ? (PromiseResultTraits7::IsOk(*p) @@ -3347,14 +3347,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState8: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 9/10", this); } auto result = prior.current_promise(); PromiseResult8* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 9/10 gets %s", this, p != nullptr ? (PromiseResultTraits8::IsOk(*p) @@ -3380,12 +3380,12 @@ struct SeqState { default: case State::kState9: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 10/10", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 10/10 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -3758,7 +3758,7 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/11", this); } auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -3766,7 +3766,7 @@ struct SeqState { PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/11 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -3797,7 +3797,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/11", this); } auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -3805,7 +3805,7 @@ struct SeqState { PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/11 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -3835,7 +3835,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/11", this); } auto result = @@ -3843,7 +3843,7 @@ struct SeqState { PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/11 gets %s", this, p != nullptr ? (PromiseResultTraits2::IsOk(*p) @@ -3871,7 +3871,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 4/11", this); } auto result = @@ -3879,7 +3879,7 @@ struct SeqState { PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 4/11 gets %s", this, p != nullptr ? (PromiseResultTraits3::IsOk(*p) @@ -3906,14 +3906,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 5/11", this); } auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 5/11 gets %s", this, p != nullptr ? (PromiseResultTraits4::IsOk(*p) @@ -3939,14 +3939,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState5: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 6/11", this); } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 6/11 gets %s", this, p != nullptr ? (PromiseResultTraits5::IsOk(*p) @@ -3972,14 +3972,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState6: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 7/11", this); } auto result = prior.prior.prior.prior.current_promise(); PromiseResult6* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 7/11 gets %s", this, p != nullptr ? (PromiseResultTraits6::IsOk(*p) @@ -4004,14 +4004,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState7: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 8/11", this); } auto result = prior.prior.prior.current_promise(); PromiseResult7* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 8/11 gets %s", this, p != nullptr ? (PromiseResultTraits7::IsOk(*p) @@ -4036,14 +4036,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState8: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 9/11", this); } auto result = prior.prior.current_promise(); PromiseResult8* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 9/11 gets %s", this, p != nullptr ? (PromiseResultTraits8::IsOk(*p) @@ -4068,14 +4068,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState9: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 10/11", this); } auto result = prior.current_promise(); PromiseResult9* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 10/11 gets %s", this, p != nullptr ? (PromiseResultTraits9::IsOk(*p) @@ -4101,12 +4101,12 @@ struct SeqState { default: case State::kState10: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 11/11", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 11/11 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -4517,7 +4517,7 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/12", this); } auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -4525,7 +4525,7 @@ struct SeqState { PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/12 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -4556,7 +4556,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/12", this); } auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -4564,7 +4564,7 @@ struct SeqState { PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/12 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -4595,7 +4595,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/12", this); } auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -4603,7 +4603,7 @@ struct SeqState { PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/12 gets %s", this, p != nullptr ? (PromiseResultTraits2::IsOk(*p) @@ -4633,7 +4633,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 4/12", this); } auto result = @@ -4641,7 +4641,7 @@ struct SeqState { PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 4/12 gets %s", this, p != nullptr ? (PromiseResultTraits3::IsOk(*p) @@ -4669,7 +4669,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 5/12", this); } auto result = @@ -4677,7 +4677,7 @@ struct SeqState { PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 5/12 gets %s", this, p != nullptr ? (PromiseResultTraits4::IsOk(*p) @@ -4704,14 +4704,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState5: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 6/12", this); } auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 6/12 gets %s", this, p != nullptr ? (PromiseResultTraits5::IsOk(*p) @@ -4737,14 +4737,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState6: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 7/12", this); } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult6* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 7/12 gets %s", this, p != nullptr ? (PromiseResultTraits6::IsOk(*p) @@ -4770,14 +4770,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState7: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 8/12", this); } auto result = prior.prior.prior.prior.current_promise(); PromiseResult7* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 8/12 gets %s", this, p != nullptr ? (PromiseResultTraits7::IsOk(*p) @@ -4802,14 +4802,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState8: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 9/12", this); } auto result = prior.prior.prior.current_promise(); PromiseResult8* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 9/12 gets %s", this, p != nullptr ? (PromiseResultTraits8::IsOk(*p) @@ -4834,14 +4834,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState9: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 10/12", this); } auto result = prior.prior.current_promise(); PromiseResult9* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 10/12 gets %s", this, p != nullptr ? (PromiseResultTraits9::IsOk(*p) @@ -4866,14 +4866,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState10: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 11/12", this); } auto result = prior.current_promise(); PromiseResult10* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 11/12 gets %s", this, p != nullptr ? (PromiseResultTraits10::IsOk(*p) @@ -4899,12 +4899,12 @@ struct SeqState { default: case State::kState11: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 12/12", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 12/12 gets %s", this, result.ready() ? "ready" : "pending"); } @@ -5356,7 +5356,7 @@ struct SeqState { switch (state) { case State::kState0: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 1/13", this); } auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -5364,7 +5364,7 @@ struct SeqState { PromiseResult0* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 1/13 gets %s", this, p != nullptr ? (PromiseResultTraits0::IsOk(*p) @@ -5395,7 +5395,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState1: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 2/13", this); } auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -5403,7 +5403,7 @@ struct SeqState { PromiseResult1* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 2/13 gets %s", this, p != nullptr ? (PromiseResultTraits1::IsOk(*p) @@ -5434,7 +5434,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState2: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 3/13", this); } auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -5442,7 +5442,7 @@ struct SeqState { PromiseResult2* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 3/13 gets %s", this, p != nullptr ? (PromiseResultTraits2::IsOk(*p) @@ -5473,7 +5473,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState3: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 4/13", this); } auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior @@ -5481,7 +5481,7 @@ struct SeqState { PromiseResult3* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 4/13 gets %s", this, p != nullptr ? (PromiseResultTraits3::IsOk(*p) @@ -5511,7 +5511,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState4: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 5/13", this); } auto result = @@ -5519,7 +5519,7 @@ struct SeqState { PromiseResult4* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 5/13 gets %s", this, p != nullptr ? (PromiseResultTraits4::IsOk(*p) @@ -5547,7 +5547,7 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState5: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 6/13", this); } auto result = @@ -5555,7 +5555,7 @@ struct SeqState { PromiseResult5* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 6/13 gets %s", this, p != nullptr ? (PromiseResultTraits5::IsOk(*p) @@ -5582,14 +5582,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState6: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 7/13", this); } auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult6* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 7/13 gets %s", this, p != nullptr ? (PromiseResultTraits6::IsOk(*p) @@ -5615,14 +5615,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState7: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 8/13", this); } auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult7* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 8/13 gets %s", this, p != nullptr ? (PromiseResultTraits7::IsOk(*p) @@ -5648,14 +5648,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState8: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 9/13", this); } auto result = prior.prior.prior.prior.current_promise(); PromiseResult8* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 9/13 gets %s", this, p != nullptr ? (PromiseResultTraits8::IsOk(*p) @@ -5680,14 +5680,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState9: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 10/13", this); } auto result = prior.prior.prior.current_promise(); PromiseResult9* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 10/13 gets %s", this, p != nullptr ? (PromiseResultTraits9::IsOk(*p) @@ -5712,14 +5712,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState10: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 11/13", this); } auto result = prior.prior.current_promise(); PromiseResult10* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 11/13 gets %s", this, p != nullptr ? (PromiseResultTraits10::IsOk(*p) @@ -5744,14 +5744,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; case State::kState11: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 12/13", this); } auto result = prior.current_promise(); PromiseResult11* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { gpr_log( - whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 12/13 gets %s", this, p != nullptr ? (PromiseResultTraits11::IsOk(*p) @@ -5777,12 +5777,12 @@ struct SeqState { default: case State::kState12: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: begin poll step 13/13", this); } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, + gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_INFO, "seq[%p]: poll step 13/13 gets %s", this, result.ready() ? "ready" : "pending"); } diff --git a/src/core/lib/promise/for_each.h b/src/core/lib/promise/for_each.h index 82322add349..529dde62256 100644 --- a/src/core/lib/promise/for_each.h +++ b/src/core/lib/promise/for_each.h @@ -109,8 +109,10 @@ class ForEach { public: using Result = typename PollTraits()())>::Type; - ForEach(Reader reader, Action action) - : reader_(std::move(reader)), action_factory_(std::move(action)) { + ForEach(Reader reader, Action action, DebugLocation whence = {}) + : reader_(std::move(reader)), + action_factory_(std::move(action)), + whence_(whence) { Construct(&reader_next_, reader_.Next()); } ~ForEach() { @@ -125,7 +127,8 @@ class ForEach { ForEach& operator=(const ForEach&) = delete; ForEach(ForEach&& other) noexcept : reader_(std::move(other.reader_)), - action_factory_(std::move(other.action_factory_)) { + action_factory_(std::move(other.action_factory_)), + whence_(other.whence_) { GPR_DEBUG_ASSERT(reading_next_); GPR_DEBUG_ASSERT(other.reading_next_); Construct(&reader_next_, std::move(other.reader_next_)); @@ -136,6 +139,7 @@ class ForEach { reader_ = std::move(other.reader_); action_factory_ = std::move(other.action_factory_); reader_next_ = std::move(other.reader_next_); + whence_ = other.whence_; return *this; } @@ -154,7 +158,8 @@ class ForEach { std::string DebugTag() { return absl::StrCat(GetContext()->DebugTag(), " FOR_EACH[0x", - reinterpret_cast(this), "]: "); + reinterpret_cast(this), "@", whence_.file(), + ":", whence_.line(), "]: "); } Poll PollReaderNext() { @@ -215,6 +220,7 @@ class ForEach { GPR_NO_UNIQUE_ADDRESS Reader reader_; GPR_NO_UNIQUE_ADDRESS ActionFactory action_factory_; + GPR_NO_UNIQUE_ADDRESS DebugLocation whence_; bool reading_next_ = true; union { ReaderNext reader_next_; @@ -226,9 +232,10 @@ class ForEach { /// For each item acquired by calling Reader::Next, run the promise Action. template -for_each_detail::ForEach ForEach(Reader reader, Action action) { +for_each_detail::ForEach ForEach(Reader reader, Action action, + DebugLocation whence = {}) { return for_each_detail::ForEach(std::move(reader), - std::move(action)); + std::move(action), whence); } } // namespace grpc_core diff --git a/src/core/lib/promise/party.cc b/src/core/lib/promise/party.cc index 104201a3b2f..5d967a658e0 100644 --- a/src/core/lib/promise/party.cc +++ b/src/core/lib/promise/party.cc @@ -273,7 +273,7 @@ bool Party::RunOneParticipant(int i) { auto* participant = participants_[i].load(std::memory_order_acquire); if (participant == nullptr) { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(GPR_DEBUG, "%s[party] wakeup %d already complete", + gpr_log(GPR_INFO, "%s[party] wakeup %d already complete", DebugTag().c_str(), i); } return false; @@ -281,7 +281,7 @@ bool Party::RunOneParticipant(int i) { absl::string_view name; if (grpc_trace_promise_primitives.enabled()) { name = participant->name(); - gpr_log(GPR_DEBUG, "%s[%s] begin job %d", DebugTag().c_str(), + gpr_log(GPR_INFO, "%s[%s] begin job %d", DebugTag().c_str(), std::string(name).c_str(), i); } // Poll the participant. @@ -290,12 +290,12 @@ bool Party::RunOneParticipant(int i) { currently_polling_ = kNotPolling; if (done) { if (!name.empty()) { - gpr_log(GPR_DEBUG, "%s[%s] end poll and finish job %d", - DebugTag().c_str(), std::string(name).c_str(), i); + gpr_log(GPR_INFO, "%s[%s] end poll and finish job %d", DebugTag().c_str(), + std::string(name).c_str(), i); } participants_[i].store(nullptr, std::memory_order_relaxed); } else if (!name.empty()) { - gpr_log(GPR_DEBUG, "%s[%s] end poll", DebugTag().c_str(), + gpr_log(GPR_INFO, "%s[%s] end poll", DebugTag().c_str(), std::string(name).c_str()); } return done; @@ -306,7 +306,7 @@ void Party::AddParticipants(Participant** participants, size_t count) { count](size_t* slots) { for (size_t i = 0; i < count; i++) { if (grpc_trace_party_state.enabled()) { - gpr_log(GPR_DEBUG, + gpr_log(GPR_INFO, "Party %p AddParticipant: %s @ %" PRIdPTR, &sync_, std::string(participants[i]->name()).c_str(), slots[i]); } diff --git a/src/core/lib/security/transport/security_handshaker.cc b/src/core/lib/security/transport/security_handshaker.cc index 0dbbf77d191..4c3fcd53f81 100644 --- a/src/core/lib/security/transport/security_handshaker.cc +++ b/src/core/lib/security/transport/security_handshaker.cc @@ -42,8 +42,8 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/stats_data.h" diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 08a3aeb02a5..01099d7a054 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -54,10 +54,10 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/call_finalization.h" #include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_stack.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/channel/context.h" #include "src/core/lib/channel/status_util.h" #include "src/core/lib/compression/compression_internal.h" @@ -90,6 +90,7 @@ #include "src/core/lib/promise/race.h" #include "src/core/lib/promise/seq.h" #include "src/core/lib/promise/status_flag.h" +#include "src/core/lib/promise/try_seq.h" #include "src/core/lib/resource_quota/arena.h" #include "src/core/lib/slice/slice_buffer.h" #include "src/core/lib/slice/slice_internal.h" @@ -2879,6 +2880,12 @@ class ClientPromiseBasedCall final : public PromiseBasedCall { return RefCountedPtr(this); } + ClientMetadata& UnprocessedClientInitialMetadata() override { + Crash("not for v2"); + } + + void V2HackToStartCallWithoutACallFilterStack() override {} + private: RefCount refs_; ClientPromiseBasedCall* const call_; @@ -3764,6 +3771,12 @@ class ServerCallSpine final : public PipeBasedCallSpine, Crash("unimplemented"); } + void V2HackToStartCallWithoutACallFilterStack() override {} + + ClientMetadata& UnprocessedClientInitialMetadata() override { + Crash("not for v2"); + } + bool RunParty() override { ScopedContext ctx(this); return Party::RunParty(); diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 64d5fd3e322..e70e1d001b9 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -23,9 +23,9 @@ #include #include +#include "src/core/channelz/channel_trace.h" +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channel_trace.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/compression/compression_internal.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/stats_data.h" diff --git a/src/core/lib/surface/channel.h b/src/core/lib/surface/channel.h index 58046cdde55..533a944c18c 100644 --- a/src/core/lib/surface/channel.h +++ b/src/core/lib/surface/channel.h @@ -31,8 +31,8 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/gprpp/cpp_impl_of.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" diff --git a/src/core/lib/surface/channel_create.cc b/src/core/lib/surface/channel_create.cc index 4b64f14c029..0fccd09a45b 100644 --- a/src/core/lib/surface/channel_create.cc +++ b/src/core/lib/surface/channel_create.cc @@ -19,8 +19,8 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/stats_data.h" diff --git a/src/core/lib/surface/legacy_channel.cc b/src/core/lib/surface/legacy_channel.cc index 80568674f9c..0ee4cd61312 100644 --- a/src/core/lib/surface/legacy_channel.cc +++ b/src/core/lib/surface/legacy_channel.cc @@ -29,12 +29,12 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/client_channel/client_channel_filter.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/channel_stack_builder_impl.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/channel/metrics.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/stats.h" diff --git a/src/core/lib/surface/legacy_channel.h b/src/core/lib/surface/legacy_channel.h index 780de9f4fa9..3cf3fa0db22 100644 --- a/src/core/lib/surface/legacy_channel.h +++ b/src/core/lib/surface/legacy_channel.h @@ -39,7 +39,7 @@ #include "src/core/lib/slice/slice.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/channel_stack_type.h" -#include "src/core/lib/transport/call_size_estimator.h" +#include "src/core/lib/transport/call_arena_allocator.h" namespace grpc_core { diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index 5e974ec25a6..9d19736ae9c 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -45,10 +45,10 @@ #include #include +#include "src/core/channelz/channel_trace.h" +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args_preconditioning.h" -#include "src/core/lib/channel/channel_trace.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/experiments/experiments.h" diff --git a/src/core/lib/surface/server.h b/src/core/lib/surface/server.h index 356bcc40269..9eca869af44 100644 --- a/src/core/lib/surface/server.h +++ b/src/core/lib/surface/server.h @@ -43,12 +43,12 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/backoff/random_early_detection.h" #include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/cpp_impl_of.h" #include "src/core/lib/gprpp/dual_ref_counted.h" diff --git a/src/core/lib/surface/server_interface.h b/src/core/lib/surface/server_interface.h index ea1081287d2..988cc201910 100644 --- a/src/core/lib/surface/server_interface.h +++ b/src/core/lib/surface/server_interface.h @@ -19,8 +19,8 @@ #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" namespace grpc_core { diff --git a/src/core/lib/transport/call_size_estimator.cc b/src/core/lib/transport/call_arena_allocator.cc similarity index 96% rename from src/core/lib/transport/call_size_estimator.cc rename to src/core/lib/transport/call_arena_allocator.cc index 0892fa9e9cc..a0bae7cd146 100644 --- a/src/core/lib/transport/call_size_estimator.cc +++ b/src/core/lib/transport/call_arena_allocator.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/core/lib/transport/call_size_estimator.h" +#include "src/core/lib/transport/call_arena_allocator.h" #include diff --git a/src/core/lib/transport/call_size_estimator.h b/src/core/lib/transport/call_arena_allocator.h similarity index 65% rename from src/core/lib/transport/call_size_estimator.h rename to src/core/lib/transport/call_arena_allocator.h index 75ae1d7256f..1db02bf6902 100644 --- a/src/core/lib/transport/call_size_estimator.h +++ b/src/core/lib/transport/call_arena_allocator.h @@ -12,15 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef GRPC_SRC_CORE_LIB_TRANSPORT_CALL_SIZE_ESTIMATOR_H -#define GRPC_SRC_CORE_LIB_TRANSPORT_CALL_SIZE_ESTIMATOR_H +#ifndef GRPC_SRC_CORE_LIB_TRANSPORT_CALL_ARENA_ALLOCATOR_H +#define GRPC_SRC_CORE_LIB_TRANSPORT_CALL_ARENA_ALLOCATOR_H #include #include +#include #include +#include "src/core/lib/gprpp/ref_counted.h" +#include "src/core/lib/resource_quota/arena.h" +#include "src/core/lib/resource_quota/memory_quota.h" + namespace grpc_core { class CallSizeEstimator { @@ -47,6 +52,22 @@ class CallSizeEstimator { std::atomic call_size_estimate_; }; +class CallArenaAllocator : public RefCounted { + public: + CallArenaAllocator(MemoryAllocator allocator, size_t initial_size) + : allocator_(std::move(allocator)), call_size_estimator_(initial_size) {} + + Arena* MakeArena() { + return Arena::Create(call_size_estimator_.CallSizeEstimate(), &allocator_); + } + + void Destroy(Arena* arena) { arena->Destroy(); } + + private: + MemoryAllocator allocator_; + CallSizeEstimator call_size_estimator_; +}; + } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_TRANSPORT_CALL_SIZE_ESTIMATOR_H +#endif // GRPC_SRC_CORE_LIB_TRANSPORT_CALL_ARENA_ALLOCATOR_H diff --git a/src/core/lib/transport/call_destination.h b/src/core/lib/transport/call_destination.h index e291bd703cb..2cf0f446d24 100644 --- a/src/core/lib/transport/call_destination.h +++ b/src/core/lib/transport/call_destination.h @@ -22,12 +22,33 @@ namespace grpc_core { -// CallDestination is responsible for the processing of a CallHandler. -// It might be a transport, the server API, or a subchannel on the client (for -// instance). -class CallDestination : public Orphanable { +// UnstartedCallDestination is responsible for starting an UnstartedCallHandler +// and then processing operations on the resulting CallHandler. +// +// Examples of UnstartedCallDestinations include: +// - a load-balanced call in the client channel +// - a hijacking filter (see Interceptor) +class UnstartedCallDestination + : public DualRefCounted { + public: + ~UnstartedCallDestination() override = default; + // Start a call. The UnstartedCallHandler will be consumed by the Destination + // and started. + // Must be called from the party owned by the call, eg the following must + // hold: + // GPR_ASSERT(GetContext() == unstarted_call_handler.party()); + virtual void StartCall(UnstartedCallHandler unstarted_call_handler) = 0; +}; + +// CallDestination is responsible for handling processing of an already started +// call. +// +// Examples of CallDestinations include: +// - a client transport +// - the server API +class CallDestination : public DualRefCounted { public: - virtual void StartCall(CallHandler call_handler) = 0; + virtual void HandleCall(CallHandler unstarted_call_handler) = 0; }; } // namespace grpc_core diff --git a/src/core/lib/transport/call_filters.cc b/src/core/lib/transport/call_filters.cc index 5e3545ba6ce..c40ca8609e8 100644 --- a/src/core/lib/transport/call_filters.cc +++ b/src/core/lib/transport/call_filters.cc @@ -53,6 +53,7 @@ Poll> OperationExecutor::Start( template Poll> OperationExecutor::InitStep(T input, void* call_data) { + GPR_ASSERT(input != nullptr); while (true) { if (ops_ == end_ops_) { return ResultOr{std::move(input), nullptr}; @@ -216,9 +217,10 @@ void CallFilters::CancelDueToFailedPipeOperation(SourceLocation but_where) { } void CallFilters::PushServerTrailingMetadata(ServerMetadataHandle md) { + GPR_ASSERT(md != nullptr); if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { - gpr_log(GPR_DEBUG, "%s Push server trailing metadata: %s into %s", - GetContext()->DebugTag().c_str(), + gpr_log(GPR_INFO, "%s PushServerTrailingMetadata[%p]: %s into %s", + GetContext()->DebugTag().c_str(), this, md->DebugString().c_str(), DebugString().c_str()); } GPR_ASSERT(md != nullptr); @@ -227,7 +229,7 @@ void CallFilters::PushServerTrailingMetadata(ServerMetadataHandle md) { client_initial_metadata_state_.CloseWithError(); server_initial_metadata_state_.CloseSending(); client_to_server_message_state_.CloseWithError(); - server_to_client_message_state_.CloseWithError(); + server_to_client_message_state_.CloseSending(); server_trailing_metadata_waiter_.Wake(); } @@ -358,6 +360,10 @@ void filters_detail::PipeState::DropPush() { case ValueState::kReady: case ValueState::kProcessing: case ValueState::kWaiting: + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + gpr_log(GPR_INFO, "%p drop push in state %s", this, + DebugString().c_str()); + } state_ = ValueState::kError; wait_recv_.Wake(); break; @@ -374,6 +380,10 @@ void filters_detail::PipeState::DropPull() { case ValueState::kReady: case ValueState::kProcessing: case ValueState::kWaiting: + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + gpr_log(GPR_INFO, "%p drop pull in state %s", this, + DebugString().c_str()); + } state_ = ValueState::kError; wait_send_.Wake(); break; @@ -386,9 +396,12 @@ void filters_detail::PipeState::DropPull() { Poll filters_detail::PipeState::PollPush() { switch (state_) { - case ValueState::kIdle: // Read completed and new read started => we see waiting here case ValueState::kWaiting: + state_ = ValueState::kReady; + wait_recv_.Wake(); + return wait_send_.pending(); + case ValueState::kIdle: case ValueState::kClosed: return Success{}; case ValueState::kQueued: diff --git a/src/core/lib/transport/call_filters.h b/src/core/lib/transport/call_filters.h index 0bd9a257314..b69b44a8df3 100644 --- a/src/core/lib/transport/call_filters.h +++ b/src/core/lib/transport/call_filters.h @@ -155,6 +155,10 @@ struct CallConstructor struct ResultOr { + ResultOr(T ok, ServerMetadataHandle error) + : ok(std::move(ok)), error(std::move(error)) { + GPR_ASSERT((this->ok == nullptr) ^ (this->error == nullptr)); + } T ok; ServerMetadataHandle error; }; @@ -1310,44 +1314,6 @@ class CallFilters { filters_detail::StackData data_; }; - class NextMessage { - public: - NextMessage() : has_value_(false), cancelled_(false) {} - explicit NextMessage(MessageHandle value) - : has_value_(true), value_(std::move(value)) {} - explicit NextMessage(bool cancelled) - : has_value_(false), cancelled_(cancelled) {} - NextMessage(const NextMessage&) = delete; - NextMessage& operator=(const NextMessage&) = delete; - NextMessage(NextMessage&& other) noexcept = default; - NextMessage& operator=(NextMessage&& other) = default; - - using value_type = MessageHandle; - - void reset() { - has_value_ = false; - cancelled_ = false; - value_.reset(); - } - bool has_value() const { return has_value_; } - const MessageHandle& value() const { - GPR_DEBUG_ASSERT(has_value_); - return value_; - } - MessageHandle& value() { - GPR_DEBUG_ASSERT(has_value_); - return value_; - } - const MessageHandle& operator*() const { return value(); } - MessageHandle& operator*() { return value(); } - bool cancelled() const { return !has_value_ && cancelled_; } - - private: - bool has_value_; - bool cancelled_; - MessageHandle value_; - }; - explicit CallFilters(ClientMetadataHandle client_initial_metadata); ~CallFilters(); @@ -1422,12 +1388,21 @@ class CallFilters { public: Push(CallFilters* filters, T x) : filters_(filters), value_(std::move(x)) { + GPR_ASSERT(value_ != nullptr); + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + gpr_log(GPR_INFO, "BeginPush[%p|%p]: %s", &state(), this, + state().DebugString().c_str()); + } + GPR_ASSERT(push_slot() == nullptr); state().BeginPush(); push_slot() = this; } ~Push() { if (filters_ != nullptr) { - state().DropPush(); + if (value_ != nullptr) { + state().DropPush(); + } + GPR_ASSERT(push_slot() == this); push_slot() = nullptr; } } @@ -1445,9 +1420,49 @@ class CallFilters { Push& operator=(Push&&) = delete; - Poll operator()() { return state().PollPush(); } + Poll operator()() { + if (value_ == nullptr) { + GPR_ASSERT(filters_ == nullptr); + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + gpr_log(GPR_INFO, "Push[|%p]: already done", this); + } + return Success{}; + } + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + gpr_log(GPR_INFO, "Push[%p|%p]: %s", &state(), this, + state().DebugString().c_str()); + } + auto r = state().PollPush(); + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + if (r.pending()) { + gpr_log(GPR_INFO, "Push[%p|%p]: pending; %s", &state(), this, + state().DebugString().c_str()); + } else if (r.value().ok()) { + gpr_log(GPR_INFO, "Push[%p|%p]: success; %s", &state(), this, + state().DebugString().c_str()); + } else { + gpr_log(GPR_INFO, "Push[%p|%p]: failure; %s", &state(), this, + state().DebugString().c_str()); + } + } + if (r.ready()) { + push_slot() = nullptr; + filters_ = nullptr; + } + return r; + } - T TakeValue() { return std::move(value_); } + T TakeValue() { + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + gpr_log(GPR_INFO, "Push[%p|%p]: take value; %s", &state(), this, + state().DebugString().c_str()); + } + GPR_ASSERT(value_ != nullptr); + GPR_ASSERT(filters_ != nullptr); + push_slot() = nullptr; + filters_ = nullptr; + return std::move(value_); + } absl::string_view DebugString() const { return value_ != nullptr ? " (not pulled)" : ""; @@ -1485,6 +1500,10 @@ class CallFilters { PullMaybe& operator=(PullMaybe&&) = delete; Poll>> operator()() { + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + gpr_log(GPR_INFO, "PullMaybe[%p|%p]: %s executor:%d", &state(), this, + state().DebugString().c_str(), executor_.IsRunning()); + } if (executor_.IsRunning()) { auto c = state().PollClosed(); if (c.ready() && c.value()) { @@ -1544,23 +1563,36 @@ class CallFilters { executor_(std::move(other.executor_)) {} PullMessage& operator=(PullMessage&&) = delete; - Poll operator()() { + Poll>> operator()() { + GPR_ASSERT(filters_ != nullptr); + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + gpr_log(GPR_INFO, "PullMessage[%p|%p]: %s executor:%d", &state(), + this, state().DebugString().c_str(), executor_.IsRunning()); + } if (executor_.IsRunning()) { auto c = state().PollClosed(); if (c.ready() && c.value()) { filters_->CancelDueToFailedPipeOperation(); - return NextMessage(true); + return Failure{}; } return FinishOperationExecutor(executor_.Step(filters_->call_data_)); } auto p = state().PollPull(); auto* r = p.value_if_ready(); - if (r == nullptr) return Pending{}; + if (r == nullptr) { + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + gpr_log(GPR_INFO, "PullMessage[%p] pending: %s executor:%d", + &state(), state().DebugString().c_str(), + executor_.IsRunning()); + } + return Pending{}; + } if (!r->ok()) { filters_->CancelDueToFailedPipeOperation(); - return NextMessage(true); + return Failure{}; } - if (!**r) return NextMessage(false); + if (!**r) return absl::nullopt; + GPR_ASSERT(filters_ != nullptr); return FinishOperationExecutor(executor_.Start( layout(), push()->TakeValue(), filters_->call_data_)); } @@ -1573,15 +1605,19 @@ class CallFilters { return &(filters_->stack_->data_.*layout_ptr); } - Poll FinishOperationExecutor( - Poll> p) { + Poll>> + FinishOperationExecutor(Poll> p) { auto* r = p.value_if_ready(); if (r == nullptr) return Pending{}; GPR_DEBUG_ASSERT(!executor_.IsRunning()); + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + gpr_log(GPR_INFO, "PullMessage[%p|%p] executor done: %s", &state(), + this, state().DebugString().c_str()); + } state().AckPull(); - if (r->ok != nullptr) return NextMessage(std::move(r->ok)); + if (r->ok != nullptr) return std::move(r->ok); filters_->PushServerTrailingMetadata(std::move(r->error)); - return NextMessage(true); + return Failure{}; } CallFilters* filters_; @@ -1699,9 +1735,21 @@ class CallFilters { return std::move(filters_->server_trailing_metadata_); } // Otherwise we need to process it through all the filters. - return executor_.Start(&filters_->stack_->data_.server_trailing_metadata, - std::move(filters_->server_trailing_metadata_), - filters_->call_data_); + auto r = executor_.Start( + &filters_->stack_->data_.server_trailing_metadata, + std::move(filters_->server_trailing_metadata_), filters_->call_data_); + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_promise_primitives)) { + if (r.pending()) { + gpr_log(GPR_INFO, + "%s PullServerTrailingMetadata[%p]: Pending(but executing)", + GetContext()->DebugTag().c_str(), filters_); + } else { + gpr_log(GPR_INFO, "%s PullServerTrailingMetadata[%p]: Ready: %s", + GetContext()->DebugTag().c_str(), filters_, + r.value()->DebugString().c_str()); + } + } + return r; } private: diff --git a/src/core/lib/transport/call_spine.cc b/src/core/lib/transport/call_spine.cc index 6b8ce59916e..eb05608663f 100644 --- a/src/core/lib/transport/call_spine.cc +++ b/src/core/lib/transport/call_spine.cc @@ -16,6 +16,9 @@ #include +#include "src/core/lib/promise/for_each.h" +#include "src/core/lib/promise/try_seq.h" + namespace grpc_core { void ForwardCall(CallHandler call_handler, CallInitiator call_initiator) { @@ -89,12 +92,14 @@ void ForwardCall(CallHandler call_handler, CallInitiator call_initiator) { }); } -CallInitiatorAndHandler MakeCall( +CallInitiatorAndHandler MakeCallPair( ClientMetadataHandle client_initial_metadata, grpc_event_engine::experimental::EventEngine* event_engine, Arena* arena, - bool is_arena_owned) { - auto spine = CallSpine::Create(std::move(client_initial_metadata), - event_engine, arena, is_arena_owned); + RefCountedPtr call_arena_allocator_if_arena_is_owned, + grpc_call_context_element* legacy_context) { + auto spine = CallSpine::Create( + std::move(client_initial_metadata), event_engine, arena, + std::move(call_arena_allocator_if_arena_is_owned), legacy_context); return {CallInitiator(spine), UnstartedCallHandler(spine)}; } diff --git a/src/core/lib/transport/call_spine.h b/src/core/lib/transport/call_spine.h index 514c92c245d..2c81c2ff927 100644 --- a/src/core/lib/transport/call_spine.h +++ b/src/core/lib/transport/call_spine.h @@ -18,16 +18,16 @@ #include #include +#include "src/core/lib/channel/context.h" #include "src/core/lib/promise/detail/status.h" -#include "src/core/lib/promise/for_each.h" #include "src/core/lib/promise/if.h" #include "src/core/lib/promise/latch.h" #include "src/core/lib/promise/party.h" #include "src/core/lib/promise/pipe.h" -#include "src/core/lib/promise/prioritized_race.h" #include "src/core/lib/promise/promise.h" #include "src/core/lib/promise/status_flag.h" -#include "src/core/lib/promise/try_seq.h" +#include "src/core/lib/transport/call_arena_allocator.h" +#include "src/core/lib/transport/call_filters.h" #include "src/core/lib/transport/message.h" #include "src/core/lib/transport/metadata.h" @@ -80,6 +80,8 @@ class CallSpineInterface { virtual Promise PushServerInitialMetadata( absl::optional md) = 0; virtual Promise WasCancelled() = 0; + virtual ClientMetadata& UnprocessedClientInitialMetadata() = 0; + virtual void V2HackToStartCallWithoutACallFilterStack() = 0; // Wrap a promise so that if it returns failure it automatically cancels // the rest of the call. @@ -252,58 +254,149 @@ class PipeBasedCallSpine : public CallSpineInterface { } }; -class CallSpine final : public PipeBasedCallSpine, public Party { +class CallSpine final : public CallSpineInterface, public Party { public: static RefCountedPtr Create( ClientMetadataHandle client_initial_metadata, grpc_event_engine::experimental::EventEngine* event_engine, Arena* arena, - bool is_arena_owned) { - auto spine = RefCountedPtr( - arena->New(event_engine, arena, is_arena_owned)); - spine->SpawnInfallible( - "push_client_initial_metadata", - [spine = spine.get(), client_initial_metadata = std::move( - client_initial_metadata)]() mutable { - return Map(spine->client_initial_metadata_.sender.Push( - std::move(client_initial_metadata)), - [](bool) { return Empty{}; }); - }); - return spine; + RefCountedPtr call_arena_allocator_if_arena_is_owned, + grpc_call_context_element* legacy_context) { + return RefCountedPtr(arena->New( + std::move(client_initial_metadata), event_engine, arena, + std::move(call_arena_allocator_if_arena_is_owned), legacy_context)); + } + + ~CallSpine() override { + if (legacy_context_is_owned_) { + for (size_t i = 0; i < GRPC_CONTEXT_COUNT; i++) { + grpc_call_context_element& elem = legacy_context_[i]; + if (elem.destroy != nullptr) elem.destroy(&elem); + } + } } - Pipe& client_initial_metadata() override { - return client_initial_metadata_; - } - Pipe& server_initial_metadata() override { - return server_initial_metadata_; - } - Pipe& client_to_server_messages() override { - return client_to_server_messages_; - } - Pipe& server_to_client_messages() override { - return server_to_client_messages_; - } - Latch& cancel_latch() override { return cancel_latch_; } - Latch& was_cancelled_latch() override { return was_cancelled_latch_; } + CallFilters& call_filters() { return call_filters_; } + Party& party() override { return *this; } + Arena* arena() override { return arena_; } + void IncrementRefCount() override { Party::IncrementRefCount(); } + void Unref() override { Party::Unref(); } + Promise>> + PullServerInitialMetadata() override { + return call_filters().PullServerInitialMetadata(); + } + + Promise PullServerTrailingMetadata() override { + return call_filters().PullServerTrailingMetadata(); + } + + Promise PushClientToServerMessage( + MessageHandle message) override { + return call_filters().PushClientToServerMessage(std::move(message)); + } + + Promise>> + PullClientToServerMessage() override { + return call_filters().PullClientToServerMessage(); + } + + Promise PushServerToClientMessage( + MessageHandle message) override { + return call_filters().PushServerToClientMessage(std::move(message)); + } + + Promise>> + PullServerToClientMessage() override { + return call_filters().PullServerToClientMessage(); + } + + void PushServerTrailingMetadata(ServerMetadataHandle md) override { + call_filters().PushServerTrailingMetadata(std::move(md)); + } + + void FinishSends() override { call_filters().FinishClientToServerSends(); } + + Promise> PullClientInitialMetadata() + override { + return call_filters().PullClientInitialMetadata(); + } + + Promise PushServerInitialMetadata( + absl::optional md) override { + if (md.has_value()) { + return call_filters().PushServerInitialMetadata(std::move(*md)); + } else { + call_filters().NoServerInitialMetadata(); + return Immediate(Success{}); + } + } + + Promise WasCancelled() override { + return call_filters().WasCancelled(); + } + + ClientMetadata& UnprocessedClientInitialMetadata() override { + return *call_filters().unprocessed_client_initial_metadata(); + } + + // TODO(ctiller): re-evaluate legacy context apis + grpc_call_context_element& legacy_context(grpc_context_index index) const { + return legacy_context_[index]; + } + + grpc_call_context_element* legacy_context() { return legacy_context_; } + + grpc_event_engine::experimental::EventEngine* event_engine() const override { + return event_engine_; + } + + void V2HackToStartCallWithoutACallFilterStack() override { + CallFilters::StackBuilder empty_stack_builder; + call_filters().SetStack(empty_stack_builder.Build()); + } + private: friend class Arena; - CallSpine(grpc_event_engine::experimental::EventEngine* event_engine, - Arena* arena, bool is_arena_owned) + CallSpine(ClientMetadataHandle client_initial_metadata, + grpc_event_engine::experimental::EventEngine* event_engine, + Arena* arena, + RefCountedPtr call_arena_allocator, + grpc_call_context_element* legacy_context) : Party(1), + call_filters_(std::move(client_initial_metadata)), arena_(arena), - is_arena_owned_(is_arena_owned), - event_engine_(event_engine) {} + event_engine_(event_engine), + call_arena_allocator_if_arena_is_owned_( + std::move(call_arena_allocator)) { + if (legacy_context == nullptr) { + legacy_context_ = static_cast( + arena->Alloc(sizeof(grpc_call_context_element) * GRPC_CONTEXT_COUNT)); + memset(legacy_context_, 0, + sizeof(grpc_call_context_element) * GRPC_CONTEXT_COUNT); + legacy_context_is_owned_ = true; + } else { + legacy_context_ = legacy_context; + legacy_context_is_owned_ = false; + } + } - class ScopedContext : public ScopedActivity, - public promise_detail::Context { + class ScopedContext + : public ScopedActivity, + public promise_detail::Context, + public promise_detail::Context< + grpc_event_engine::experimental::EventEngine>, + public promise_detail::Context { public: explicit ScopedContext(CallSpine* spine) - : ScopedActivity(&spine->party()), Context(spine->arena()) {} + : ScopedActivity(spine), + Context(spine->arena_), + Context( + spine->event_engine()), + Context(spine->legacy_context_) {} }; bool RunParty() override { @@ -312,35 +405,30 @@ class CallSpine final : public PipeBasedCallSpine, public Party { } void PartyOver() override { - Arena* a = arena(); + Arena* a = arena_; + RefCountedPtr call_arena_allocator_if_arena_is_owned = + std::move(call_arena_allocator_if_arena_is_owned_); { ScopedContext context(this); CancelRemainingParticipants(); a->DestroyManagedNewObjects(); } this->~CallSpine(); - a->Destroy(); - } - - grpc_event_engine::experimental::EventEngine* event_engine() const override { - return event_engine_; + if (call_arena_allocator_if_arena_is_owned != nullptr) { + call_arena_allocator_if_arena_is_owned->Destroy(a); + } } - Arena* arena_; - bool is_arena_owned_; - // Initial metadata from client to server - Pipe client_initial_metadata_{arena()}; - // Initial metadata from server to client - Pipe server_initial_metadata_{arena()}; - // Messages travelling from the application to the transport. - Pipe client_to_server_messages_{arena()}; - // Messages travelling from the transport to the application. - Pipe server_to_client_messages_{arena()}; - // Latch that can be set to terminate the call - Latch cancel_latch_; - Latch was_cancelled_latch_; + // Call filters/pipes part of the spine + CallFilters call_filters_; + Arena* const arena_; // Event engine associated with this call grpc_event_engine::experimental::EventEngine* const event_engine_; + // Legacy context + // TODO(ctiller): remove + grpc_call_context_element* legacy_context_; + RefCountedPtr call_arena_allocator_if_arena_is_owned_; + bool legacy_context_is_owned_; }; class CallInitiator { @@ -446,6 +534,15 @@ class CallHandler { Arena* arena() { return spine_->arena(); } + grpc_event_engine::experimental::EventEngine* event_engine() { + return DownCast(spine_.get())->event_engine(); + } + + // TODO(ctiller): re-evaluate this API + grpc_call_context_element* legacy_context() { + return DownCast(spine_.get())->legacy_context(); + } + private: RefCountedPtr spine_; }; @@ -482,8 +579,19 @@ class UnstartedCallHandler { return spine_->party().SpawnWaitable(name, std::move(promise_factory)); } + ClientMetadata& UnprocessedClientInitialMetadata() { + return spine_->UnprocessedClientInitialMetadata(); + } + CallHandler V2HackToStartCallWithoutACallFilterStack() { - GPR_ASSERT(DownCast(spine_.get()) != nullptr); + spine_->V2HackToStartCallWithoutACallFilterStack(); + return CallHandler(std::move(spine_)); + } + + CallHandler StartCall(RefCountedPtr call_filters) { + DownCast(spine_.get()) + ->call_filters() + .SetStack(std::move(call_filters)); return CallHandler(std::move(spine_)); } @@ -498,10 +606,11 @@ struct CallInitiatorAndHandler { UnstartedCallHandler handler; }; -CallInitiatorAndHandler MakeCall( +CallInitiatorAndHandler MakeCallPair( ClientMetadataHandle client_initial_metadata, grpc_event_engine::experimental::EventEngine* event_engine, Arena* arena, - bool is_arena_owned); + RefCountedPtr call_arena_allocator_if_arena_is_owned, + grpc_call_context_element* legacy_context); template auto OutgoingMessages(CallHalf h) { diff --git a/src/core/lib/transport/handshaker.cc b/src/core/lib/transport/handshaker.cc index 8288002bf4d..f6f1a0db93d 100644 --- a/src/core/lib/transport/handshaker.cc +++ b/src/core/lib/transport/handshaker.cc @@ -119,11 +119,13 @@ bool HandshakeManager::CallNextHandshakerLocked(grpc_error_handle error) { grpc_endpoint_shutdown(args_.endpoint, error); grpc_endpoint_destroy(args_.endpoint); args_.endpoint = nullptr; - args_.args = ChannelArgs(); + } + if (args_.read_buffer != nullptr) { grpc_slice_buffer_destroy(args_.read_buffer); gpr_free(args_.read_buffer); args_.read_buffer = nullptr; } + args_.args = ChannelArgs(); } if (GRPC_TRACE_FLAG_ENABLED(grpc_handshaker_trace)) { gpr_log(GPR_INFO, diff --git a/src/core/lib/transport/interception_chain.cc b/src/core/lib/transport/interception_chain.cc new file mode 100644 index 00000000000..4d6ad34e315 --- /dev/null +++ b/src/core/lib/transport/interception_chain.cc @@ -0,0 +1,156 @@ +// Copyright 2024 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/transport/interception_chain.h" + +#include + +#include + +#include "src/core/lib/gprpp/match.h" +#include "src/core/lib/transport/call_destination.h" +#include "src/core/lib/transport/call_filters.h" +#include "src/core/lib/transport/call_spine.h" +#include "src/core/lib/transport/metadata.h" + +namespace grpc_core { + +std::atomic InterceptionChainBuilder::next_filter_id_{0}; + +/////////////////////////////////////////////////////////////////////////////// +// HijackedCall + +CallInitiator HijackedCall::MakeCall() { + auto metadata = Arena::MakePooled(); + *metadata = metadata_->Copy(); + return MakeCallWithMetadata(std::move(metadata)); +} + +CallInitiator HijackedCall::MakeCallWithMetadata( + ClientMetadataHandle metadata) { + auto call = MakeCallPair(std::move(metadata), call_handler_.event_engine(), + call_handler_.arena(), nullptr, + call_handler_.legacy_context()); + destination_->StartCall(std::move(call.handler)); + return std::move(call.initiator); +} + +namespace { +class CallStarter final : public UnstartedCallDestination { + public: + CallStarter(RefCountedPtr stack, + RefCountedPtr destination) + : stack_(std::move(stack)), destination_(std::move(destination)) {} + + void Orphaned() override { + stack_.reset(); + destination_.reset(); + } + + void StartCall(UnstartedCallHandler unstarted_call_handler) override { + destination_->HandleCall(unstarted_call_handler.StartCall(stack_)); + } + + private: + RefCountedPtr stack_; + RefCountedPtr destination_; +}; + +class TerminalInterceptor final : public UnstartedCallDestination { + public: + explicit TerminalInterceptor( + RefCountedPtr stack, + RefCountedPtr destination) + : stack_(std::move(stack)), destination_(std::move(destination)) {} + + void Orphaned() override { + stack_.reset(); + destination_.reset(); + } + + void StartCall(UnstartedCallHandler unstarted_call_handler) override { + unstarted_call_handler.SpawnGuarded( + "start_call", + Map(interception_chain_detail::HijackCall(unstarted_call_handler, + destination_, stack_), + [](ValueOrFailure hijacked_call) -> StatusFlag { + if (!hijacked_call.ok()) return Failure{}; + ForwardCall(hijacked_call.value().original_call_handler(), + hijacked_call.value().MakeLastCall()); + return Success{}; + })); + } + + private: + RefCountedPtr stack_; + RefCountedPtr destination_; +}; +} // namespace + +/////////////////////////////////////////////////////////////////////////////// +// InterceptionChain::Builder + +void InterceptionChainBuilder::AddInterceptor( + absl::StatusOr> interceptor) { + if (!status_.ok()) return; + if (!interceptor.ok()) { + status_ = interceptor.status(); + return; + } + (*interceptor)->filter_stack_ = MakeFilterStack(); + if (top_interceptor_ == nullptr) { + top_interceptor_ = std::move(*interceptor); + } else { + Interceptor* previous = top_interceptor_.get(); + while (previous->wrapped_destination_ != nullptr) { + previous = DownCast(previous->wrapped_destination_.get()); + } + previous->wrapped_destination_ = std::move(*interceptor); + } +} + +absl::StatusOr> +InterceptionChainBuilder::Build(FinalDestination final_destination) { + if (!status_.ok()) return status_; + // Build the final UnstartedCallDestination in the chain - what we do here + // depends on both the type of the final destination and the filters we have + // that haven't been captured into an Interceptor yet. + RefCountedPtr terminator = Match( + final_destination, + [this](RefCountedPtr final_destination) + -> RefCountedPtr { + if (stack_builder_.has_value()) { + return MakeRefCounted(MakeFilterStack(), + final_destination); + } + return final_destination; + }, + [this](RefCountedPtr final_destination) + -> RefCountedPtr { + return MakeRefCounted(MakeFilterStack(), + std::move(final_destination)); + }); + // Now append the terminator to the interceptor chain. + if (top_interceptor_ == nullptr) { + return std::move(terminator); + } + Interceptor* previous = top_interceptor_.get(); + while (previous->wrapped_destination_ != nullptr) { + previous = DownCast(previous->wrapped_destination_.get()); + } + previous->wrapped_destination_ = std::move(terminator); + return std::move(top_interceptor_); +} + +} // namespace grpc_core diff --git a/src/core/lib/transport/interception_chain.h b/src/core/lib/transport/interception_chain.h new file mode 100644 index 00000000000..5b05e481ff6 --- /dev/null +++ b/src/core/lib/transport/interception_chain.h @@ -0,0 +1,225 @@ +// Copyright 2024 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_SRC_CORE_LIB_TRANSPORT_INTERCEPTION_CHAIN_H +#define GRPC_SRC_CORE_LIB_TRANSPORT_INTERCEPTION_CHAIN_H + +#include +#include + +#include + +#include "src/core/lib/gprpp/ref_counted.h" +#include "src/core/lib/transport/call_destination.h" +#include "src/core/lib/transport/call_filters.h" +#include "src/core/lib/transport/call_spine.h" +#include "src/core/lib/transport/metadata.h" + +namespace grpc_core { + +class InterceptionChainBuilder; + +// One hijacked call. Using this we can get access to the CallHandler for the +// call object above us, the processed metadata from any filters/interceptors +// above us, and also create new CallInterceptor objects that will be handled +// below. +class HijackedCall final { + public: + HijackedCall(ClientMetadataHandle metadata, + RefCountedPtr destination, + CallHandler call_handler) + : metadata_(std::move(metadata)), + destination_(std::move(destination)), + call_handler_(std::move(call_handler)) {} + + // Create a new call and pass it down the stack. + // This can be called as many times as needed. + CallInitiator MakeCall(); + // Per MakeCall(), but precludes creating further calls. + // Allows us to optimize by not copying initial metadata. + CallInitiator MakeLastCall() { + return MakeCallWithMetadata(std::move(metadata_)); + } + + CallHandler& original_call_handler() { return call_handler_; } + + ClientMetadata& client_metadata() { return *metadata_; } + + private: + CallInitiator MakeCallWithMetadata(ClientMetadataHandle metadata); + + ClientMetadataHandle metadata_; + RefCountedPtr destination_; + CallHandler call_handler_; +}; + +namespace interception_chain_detail { + +inline auto HijackCall(UnstartedCallHandler unstarted_call_handler, + RefCountedPtr destination, + RefCountedPtr stack) { + auto call_handler = unstarted_call_handler.StartCall(stack); + return Map( + call_handler.PullClientInitialMetadata(), + [call_handler, + destination](ValueOrFailure metadata) mutable + -> ValueOrFailure { + if (!metadata.ok()) return Failure{}; + return HijackedCall(std::move(metadata.value()), std::move(destination), + std::move(call_handler)); + }); +} + +} // namespace interception_chain_detail + +// A delegating UnstartedCallDestination for use as a hijacking filter. +// Implementations may look at the unprocessed initial metadata +// and decide to do one of two things: +// +// 1. It can hijack the call. Returns a HijackedCall object that can +// be used to start new calls with the same metadata. +// +// 2. It can consume the call by calling `Consume`. +// +// Upon the StartCall call the UnstartedCallHandler will be from the last +// *Interceptor* in the call chain (without having been processed by any +// intervening filters) -- note that this is commonly not useful (not enough +// guarantees), and so it's usually better to Hijack and examine the metadata. +class Interceptor : public UnstartedCallDestination { + protected: + // Returns a promise that resolves to a HijackedCall instance. + // Hijacking is the process of taking over a call and starting one or more new + // ones. + auto Hijack(UnstartedCallHandler unstarted_call_handler) { + return interception_chain_detail::HijackCall( + std::move(unstarted_call_handler), wrapped_destination_, filter_stack_); + } + + // Consume this call - it will not be passed on to any further filters. + CallHandler Consume(UnstartedCallHandler unstarted_call_handler) { + return unstarted_call_handler.StartCall(filter_stack_); + } + + // TODO(ctiller): Consider a Passthrough() method that allows the call to be + // passed on to the next filter in the chain without any interception by the + // current filter. + + private: + friend class InterceptionChainBuilder; + + RefCountedPtr wrapped_destination_; + RefCountedPtr filter_stack_; +}; + +class InterceptionChainBuilder final { + public: + // The kind of destination that the chain will eventually call. + // We can bottom out in various types depending on where we're intercepting: + // - The top half of the client channel wants to terminate on a + // UnstartedCallDestination (specifically the LB call destination). + // - The bottom half of the client channel and the server code wants to + // terminate on a ClientTransport - which unlike a + // UnstartedCallDestination demands a started CallHandler. + // There's some adaption code that's needed to start filters just prior + // to the bottoming out, and some design considerations to make with that. + // One way (that's not chosen here) would be to have the caller of the + // Builder provide something that can build an adaptor + // UnstartedCallDestination with parameters supplied by this builder - that + // disperses the responsibility of building the adaptor to the caller, which + // is not ideal - we might want to adjust the way this construct is built in + // the future, and building is a builder responsibility. + // Instead, we declare a relatively closed set of destinations here, and + // hide the adaptors inside the builder at build time. + using FinalDestination = + absl::variant, + RefCountedPtr>; + + explicit InterceptionChainBuilder(ChannelArgs args) + : args_(std::move(args)) {} + + // Add a filter with a `Call` class as an inner member. + // Call class must be one compatible with the filters described in + // call_filters.h. + template + absl::enable_if_t + Add() { + if (!status_.ok()) return *this; + auto filter = T::Create(args_, {FilterInstanceId(FilterTypeId())}); + if (!filter.ok()) { + status_ = filter.status(); + return *this; + } + auto& sb = stack_builder(); + sb.Add(filter.value().get()); + sb.AddOwnedObject(std::move(filter.value())); + return *this; + }; + + // Add a filter that is an interceptor - one that can hijack calls. + template + absl::enable_if_t::value, + InterceptionChainBuilder&> + Add() { + AddInterceptor(T::Create(args_, {FilterInstanceId(FilterTypeId())})); + return *this; + }; + + // Add a filter that just mutates server trailing metadata. + template + void AddOnServerTrailingMetadata(F f) { + stack_builder().AddOnServerTrailingMetadata(std::move(f)); + } + + // Build this stack + absl::StatusOr> Build( + FinalDestination final_destination); + + const ChannelArgs& channel_args() const { return args_; } + + private: + CallFilters::StackBuilder& stack_builder() { + if (!stack_builder_.has_value()) stack_builder_.emplace(); + return *stack_builder_; + } + + RefCountedPtr MakeFilterStack() { + auto stack = stack_builder().Build(); + stack_builder_.reset(); + return stack; + } + + template + static size_t FilterTypeId() { + static const size_t id = + next_filter_id_.fetch_add(1, std::memory_order_relaxed); + return id; + } + + size_t FilterInstanceId(size_t filter_type) { + return filter_type_counts_[filter_type]++; + } + + void AddInterceptor(absl::StatusOr> interceptor); + + ChannelArgs args_; + absl::optional stack_builder_; + RefCountedPtr top_interceptor_; + absl::Status status_; + std::map filter_type_counts_; + static std::atomic next_filter_id_; +}; + +} // namespace grpc_core + +#endif // GRPC_SRC_CORE_LIB_TRANSPORT_INTERCEPTION_CHAIN_H diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index c824f0ae05c..fe7f72ef1ed 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -498,7 +498,40 @@ std::string grpc_transport_op_string(grpc_transport_op* op); namespace grpc_core { -class FilterStackTransport { +class FilterStackTransport; +class ClientTransport; +class ServerTransport; + +class Transport : public Orphanable { + public: + struct RawPointerChannelArgTag {}; + static absl::string_view ChannelArgName() { return GRPC_ARG_TRANSPORT; } + + virtual FilterStackTransport* filter_stack_transport() = 0; + virtual ClientTransport* client_transport() = 0; + virtual ServerTransport* server_transport() = 0; + + // name of this transport implementation + virtual absl::string_view GetTransportName() const = 0; + + // implementation of grpc_transport_set_pollset + virtual void SetPollset(grpc_stream* stream, grpc_pollset* pollset) = 0; + + // implementation of grpc_transport_set_pollset + virtual void SetPollsetSet(grpc_stream* stream, + grpc_pollset_set* pollset_set) = 0; + + void SetPollingEntity(grpc_stream* stream, + grpc_polling_entity* pollset_or_pollset_set); + + // implementation of grpc_transport_perform_op + virtual void PerformOp(grpc_transport_op* op) = 0; + + // implementation of grpc_transport_get_endpoint + virtual grpc_endpoint* GetEndpoint() = 0; +}; + +class FilterStackTransport : public Transport { public: // Memory required for a single stream element - this is allocated by upper // layers and initialized by the transport @@ -536,18 +569,18 @@ class FilterStackTransport { grpc_closure* then_schedule_closure) = 0; protected: - ~FilterStackTransport() = default; + ~FilterStackTransport() override = default; }; -class ClientTransport { +class ClientTransport : public Transport { public: virtual void StartCall(CallHandler call_handler) = 0; protected: - ~ClientTransport() = default; + ~ClientTransport() override = default; }; -class ServerTransport { +class ServerTransport : public Transport { public: // Acceptor helps transports create calls. class Acceptor { @@ -569,36 +602,7 @@ class ServerTransport { virtual void SetAcceptor(Acceptor* acceptor) = 0; protected: - ~ServerTransport() = default; -}; - -class Transport : public Orphanable { - public: - struct RawPointerChannelArgTag {}; - static absl::string_view ChannelArgName() { return GRPC_ARG_TRANSPORT; } - - virtual FilterStackTransport* filter_stack_transport() = 0; - virtual ClientTransport* client_transport() = 0; - virtual ServerTransport* server_transport() = 0; - - // name of this transport implementation - virtual absl::string_view GetTransportName() const = 0; - - // implementation of grpc_transport_set_pollset - virtual void SetPollset(grpc_stream* stream, grpc_pollset* pollset) = 0; - - // implementation of grpc_transport_set_pollset - virtual void SetPollsetSet(grpc_stream* stream, - grpc_pollset_set* pollset_set) = 0; - - void SetPollingEntity(grpc_stream* stream, - grpc_polling_entity* pollset_or_pollset_set); - - // implementation of grpc_transport_perform_op - virtual void PerformOp(grpc_transport_op* op) = 0; - - // implementation of grpc_transport_get_endpoint - virtual grpc_endpoint* GetEndpoint() = 0; + ~ServerTransport() override = default; }; } // namespace grpc_core diff --git a/src/core/load_balancing/grpclb/grpclb.cc b/src/core/load_balancing/grpclb/grpclb.cc index 0b62235f51e..34f6afba790 100644 --- a/src/core/load_balancing/grpclb/grpclb.cc +++ b/src/core/load_balancing/grpclb/grpclb.cc @@ -92,11 +92,11 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/client_channel/client_channel_filter.h" #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/backoff/backoff.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/experiments/experiments.h" diff --git a/src/core/load_balancing/health_check_client.cc b/src/core/load_balancing/health_check_client.cc index 455dc789adb..6dfebe2e8d9 100644 --- a/src/core/load_balancing/health_check_client.cc +++ b/src/core/load_balancing/health_check_client.cc @@ -39,13 +39,12 @@ #include #include -#include "src/core/client_channel/client_channel_channelz.h" +#include "src/core/channelz/channel_trace.h" #include "src/core/client_channel/client_channel_internal.h" #include "src/core/client_channel/subchannel.h" #include "src/core/client_channel/subchannel_stream_client.h" #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channel_trace.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/orphanable.h" diff --git a/src/core/load_balancing/oob_backend_metric.cc b/src/core/load_balancing/oob_backend_metric.cc index 6d4bdd03164..4f43594b44e 100644 --- a/src/core/load_balancing/oob_backend_metric.cc +++ b/src/core/load_balancing/oob_backend_metric.cc @@ -37,10 +37,9 @@ #include #include -#include "src/core/client_channel/client_channel_channelz.h" +#include "src/core/channelz/channel_trace.h" #include "src/core/client_channel/subchannel.h" #include "src/core/client_channel/subchannel_stream_client.h" -#include "src/core/lib/channel/channel_trace.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/memory.h" diff --git a/src/core/load_balancing/rls/rls.cc b/src/core/load_balancing/rls/rls.cc index ea7c1c909bd..93de1b7ae9f 100644 --- a/src/core/load_balancing/rls/rls.cc +++ b/src/core/load_balancing/rls/rls.cc @@ -65,10 +65,10 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/client_channel/client_channel_filter.h" #include "src/core/lib/backoff/backoff.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/channel/metrics.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/trace.h" diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc index d705abc1c2c..9235782bb29 100644 --- a/src/core/tsi/ssl_transport_security.cc +++ b/src/core/tsi/ssl_transport_security.cc @@ -1282,10 +1282,6 @@ void tsi_ssl_session_cache_unref(tsi_ssl_session_cache* cache) { tsi::SslSessionLRUCache::FromC(cache)->Unref(); } -size_t tsi_ssl_session_cache_size(tsi_ssl_session_cache* cache) { - return tsi::SslSessionLRUCache::FromC(cache)->Size(); -} - // --- tsi_frame_protector methods implementation. --- static tsi_result ssl_protector_protect(tsi_frame_protector* self, diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/tsi/ssl_transport_security.h index d925f08840b..da3b260adbd 100644 --- a/src/core/tsi/ssl_transport_security.h +++ b/src/core/tsi/ssl_transport_security.h @@ -81,9 +81,6 @@ void tsi_ssl_session_cache_ref(tsi_ssl_session_cache* cache); // Decrement reference counter of \a cache. void tsi_ssl_session_cache_unref(tsi_ssl_session_cache* cache); -// Returns the size of the cache. -size_t tsi_ssl_session_cache_size(tsi_ssl_session_cache* cache); - // --- tsi_ssl_key_logger object --- // Experimental SSL Key logging functionality to enable decryption of diff --git a/src/cpp/ext/csm/csm_observability.cc b/src/cpp/ext/csm/csm_observability.cc index e89950178ef..1f9d04bd7df 100644 --- a/src/cpp/ext/csm/csm_observability.cc +++ b/src/cpp/ext/csm/csm_observability.cc @@ -48,9 +48,8 @@ namespace { std::atomic g_csm_plugin_enabled(false); } -bool CsmServerSelector(const grpc_core::ChannelArgs& args) { - return g_csm_plugin_enabled && - args.GetBool(GRPC_ARG_XDS_ENABLED_SERVER).value_or(false); +bool CsmServerSelector(const grpc_core::ChannelArgs& /*args*/) { + return g_csm_plugin_enabled; } bool CsmChannelTargetSelector(absl::string_view target) { diff --git a/src/cpp/ext/otel/otel_plugin.cc b/src/cpp/ext/otel/otel_plugin.cc index de527591a0d..5546b21c8a3 100644 --- a/src/cpp/ext/otel/otel_plugin.cc +++ b/src/cpp/ext/otel/otel_plugin.cc @@ -104,7 +104,7 @@ class OpenTelemetryPlugin::NPCMetricsKeyValueIterable bool(opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue)> callback) const noexcept override { - for (size_t i = 0; i < label_keys_.size(); i++) { + for (size_t i = 0; i < label_keys_.size(); ++i) { if (!callback(AbslStrViewToOpenTelemetryStrView(label_keys_[i]), AbslStrViewToOpenTelemetryStrView(label_values_[i]))) { return false; diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.mm b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.mm index 38dda64b72e..a49bb9c2566 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.mm +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCCompletionQueue.mm @@ -69,6 +69,9 @@ const grpc_completion_queue_attributes kCompletionQueueAttr = { case GRPC_QUEUE_SHUTDOWN: grpc_completion_queue_destroy(unmanagedQueue); return; + case GRPC_QUEUE_TIMEOUT: + NSLog(@"GRPC_QUEUE_TIMEOUT, success: %d, tag: %p", event.success, event.tag); + break; default: [NSException raise:@"Unrecognized completion type" format:@""]; } diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 9f20c1f18f1..b8848c863d1 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -15,8 +15,10 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_core_dependencies.py.template`!!! CORE_SOURCE_FILES = [ + 'src/core/channelz/channel_trace.cc', + 'src/core/channelz/channelz.cc', + 'src/core/channelz/channelz_registry.cc', 'src/core/client_channel/backup_poller.cc', - 'src/core/client_channel/client_channel_channelz.cc', 'src/core/client_channel/client_channel_factory.cc', 'src/core/client_channel/client_channel_filter.cc', 'src/core/client_channel/client_channel_plugin.cc', @@ -441,9 +443,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/channel/channel_stack_builder.cc', 'src/core/lib/channel/channel_stack_builder_impl.cc', 'src/core/lib/channel/channel_stack_trace.cc', - 'src/core/lib/channel/channel_trace.cc', - 'src/core/lib/channel/channelz.cc', - 'src/core/lib/channel/channelz_registry.cc', 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/metrics.cc', 'src/core/lib/channel/promise_based_filter.cc', @@ -756,9 +755,9 @@ CORE_SOURCE_FILES = [ 'src/core/lib/surface/wait_for_cq_end_op.cc', 'src/core/lib/transport/batch_builder.cc', 'src/core/lib/transport/bdp_estimator.cc', + 'src/core/lib/transport/call_arena_allocator.cc', 'src/core/lib/transport/call_filters.cc', 'src/core/lib/transport/call_final_info.cc', - 'src/core/lib/transport/call_size_estimator.cc', 'src/core/lib/transport/call_spine.cc', 'src/core/lib/transport/connectivity_state.cc', 'src/core/lib/transport/endpoint_info_handshaker.cc', diff --git a/templates/Package.swift.template b/templates/Package.swift.template index 23334c0bc8b..496cd2686c2 100644 --- a/templates/Package.swift.template +++ b/templates/Package.swift.template @@ -25,8 +25,8 @@ ], dependencies: [ - .package(url: "https://github.com/firebase/abseil-cpp-SwiftPM.git", "0.20230802.0"..<"0.20230803.0"), - .package(url: "https://github.com/firebase/boringssl-SwiftPM.git", "0.9.0"..<"0.10.0"), + .package(url: "https://github.com/firebase/abseil-cpp-SwiftPM.git", "0.20240116.1"..<"0.20240117.0"), + .package(url: "https://github.com/firebase/boringssl-SwiftPM.git", "0.32.0"..<"0.33.0"), ], targets: [ diff --git a/templates/gRPC-C++.podspec.template b/templates/gRPC-C++.podspec.template index b4c24348bf1..3231a52e24a 100644 --- a/templates/gRPC-C++.podspec.template +++ b/templates/gRPC-C++.podspec.template @@ -183,7 +183,7 @@ ss.dependency "#{s.name}/Privacy", version ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', version - abseil_version = '1.20240116.1' + abseil_version = '~> 1.20240116.2' % for abseil_spec in grpcpp_abseil_specs: ss.dependency '${abseil_spec}', abseil_version % endfor diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index c3a0b10b0f3..6fe258801c9 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -122,7 +122,7 @@ s.requires_arc = false name = 'grpc' - abseil_version = '1.20240116.1' + abseil_version = '~> 1.20240116.2' # When creating a dynamic framework, name it grpc.framework instead of gRPC-Core.framework. # This lets users write their includes like `#include ` as opposed to `#include diff --git a/test/core/address_utils/BUILD b/test/core/address_utils/BUILD index 792e3ae2210..8abfa7b0c37 100644 --- a/test/core/address_utils/BUILD +++ b/test/core/address_utils/BUILD @@ -26,6 +26,7 @@ grpc_cc_test( name = "sockaddr_utils_test", srcs = ["sockaddr_utils_test.cc"], external_deps = [ + "absl/log:check", "gtest", ], language = "C++", @@ -55,6 +56,7 @@ grpc_fuzzer( name = "sockaddr_utils_fuzzer_test", srcs = ["sockaddr_utils_fuzzer_test.cc"], corpus = "sockaddr_uri_corpus", + external_deps = ["absl/log:check"], tags = ["no_windows"], uses_event_engine = False, uses_polling = False, diff --git a/test/core/address_utils/sockaddr_utils_fuzzer_test.cc b/test/core/address_utils/sockaddr_utils_fuzzer_test.cc index f8caf91e077..09cf4e5244d 100644 --- a/test/core/address_utils/sockaddr_utils_fuzzer_test.cc +++ b/test/core/address_utils/sockaddr_utils_fuzzer_test.cc @@ -19,6 +19,7 @@ #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include @@ -42,6 +43,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { absl::StatusOr parsed_uri = grpc_core::URI::Parse(uri.value()); - GPR_ASSERT(parsed_uri.ok()); + CHECK_OK(parsed_uri); return 0; } diff --git a/test/core/address_utils/sockaddr_utils_test.cc b/test/core/address_utils/sockaddr_utils_test.cc index 81c774f51f0..c9ac8d93ea6 100644 --- a/test/core/address_utils/sockaddr_utils_test.cc +++ b/test/core/address_utils/sockaddr_utils_test.cc @@ -42,6 +42,8 @@ #include +#include "absl/log/check.h" + #include #include "src/core/lib/address_utils/parse_address.h" @@ -57,7 +59,7 @@ grpc_resolved_address MakeAddr4(const uint8_t* data, size_t data_len) { reinterpret_cast(resolved_addr4.addr); memset(&resolved_addr4, 0, sizeof(resolved_addr4)); addr4->sin_family = GRPC_AF_INET; - GPR_ASSERT(data_len == sizeof(addr4->sin_addr.s_addr)); + CHECK(data_len == sizeof(addr4->sin_addr.s_addr)); memcpy(&addr4->sin_addr.s_addr, data, data_len); addr4->sin_port = grpc_htons(12345); resolved_addr4.len = static_cast(sizeof(grpc_sockaddr_in)); @@ -70,7 +72,7 @@ grpc_resolved_address MakeAddr6(const uint8_t* data, size_t data_len) { reinterpret_cast(resolved_addr6.addr); memset(&resolved_addr6, 0, sizeof(resolved_addr6)); addr6->sin6_family = GRPC_AF_INET6; - GPR_ASSERT(data_len == sizeof(addr6->sin6_addr.s6_addr)); + CHECK(data_len == sizeof(addr6->sin6_addr.s6_addr)); memcpy(&addr6->sin6_addr.s6_addr, data, data_len); addr6->sin6_port = grpc_htons(12345); resolved_addr6.len = static_cast(sizeof(grpc_sockaddr_in6)); diff --git a/test/core/bad_client/bad_client.cc b/test/core/bad_client/bad_client.cc index 7394e109b5e..55dba74272c 100644 --- a/test/core/bad_client/bad_client.cc +++ b/test/core/bad_client/bad_client.cc @@ -30,10 +30,10 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args_preconditioning.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gprpp/thd.h" diff --git a/test/core/bad_connection/BUILD b/test/core/bad_connection/BUILD index 6a0ce0c923c..e2ae2e91d88 100644 --- a/test/core/bad_connection/BUILD +++ b/test/core/bad_connection/BUILD @@ -23,6 +23,7 @@ grpc_cc_binary( srcs = [ "close_fd_test.cc", ], + external_deps = ["absl/log:check"], language = "C++", tags = ["no_windows"], deps = [ diff --git a/test/core/bad_connection/close_fd_test.cc b/test/core/bad_connection/close_fd_test.cc index 7313304a05e..33a3e8247c1 100644 --- a/test/core/bad_connection/close_fd_test.cc +++ b/test/core/bad_connection/close_fd_test.cc @@ -23,6 +23,7 @@ // #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/strings/str_format.h" @@ -32,8 +33,8 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/error.h" @@ -92,7 +93,7 @@ static void server_setup_transport(grpc_core::Transport* transport) { grpc_core::ExecCtx exec_ctx; grpc_endpoint_add_to_pollset(g_ctx.ep->server, grpc_cq_pollset(g_ctx.cq)); grpc_core::Server* core_server = grpc_core::Server::FromC(g_ctx.server); - GPR_ASSERT(GRPC_LOG_IF_ERROR( + CHECK(GRPC_LOG_IF_ERROR( "SetupTransport", core_server->SetupTransport(transport, nullptr, core_server->channel_args(), nullptr))); @@ -123,14 +124,14 @@ static void init_client() { transport = grpc_create_chttp2_transport(grpc_core::ChannelArgs(), g_ctx.ep->client, true); client_setup_transport(transport); - GPR_ASSERT(g_ctx.client); + CHECK(g_ctx.client); grpc_chttp2_transport_start_reading(transport, nullptr, nullptr, nullptr); } static void init_server() { grpc_core::ExecCtx exec_ctx; grpc_core::Transport* transport; - GPR_ASSERT(!g_ctx.server); + CHECK(!g_ctx.server); g_ctx.server = grpc_server_create(nullptr, nullptr); grpc_server_register_completion_queue(g_ctx.server, g_ctx.cq, nullptr); grpc_server_start(g_ctx.server); @@ -174,10 +175,10 @@ static void drain_and_destroy_cq(grpc_completion_queue* cq) { static void shutdown_server() { if (!g_ctx.server) return; grpc_server_shutdown_and_notify(g_ctx.server, g_ctx.shutdown_cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(g_ctx.shutdown_cq, tag(1000), - grpc_timeout_seconds_to_deadline(1), - nullptr) - .type == GRPC_OP_COMPLETE); + CHECK(grpc_completion_queue_pluck(g_ctx.shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(1), + nullptr) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(g_ctx.server); g_ctx.server = nullptr; } @@ -244,7 +245,7 @@ static void _test_close_before_server_recv(fd_type fdtype) { call = grpc_channel_create_call( g_ctx.client, nullptr, GRPC_PROPAGATE_DEFAULTS, g_ctx.client_cq, grpc_slice_from_static_string("/foo"), nullptr, deadline, nullptr); - GPR_ASSERT(call); + CHECK(call); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); @@ -286,17 +287,17 @@ static void _test_close_before_server_recv(fd_type fdtype) { op++; error = grpc_call_start_batch(call, ops, static_cast(op - ops), tag(1), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); error = grpc_server_request_call(g_ctx.server, &server_call, &call_details, &request_metadata_recv, g_ctx.bound_cq, g_ctx.cq, tag(101)); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); event = grpc_completion_queue_next( g_ctx.cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); - GPR_ASSERT(event.success == 1); - GPR_ASSERT(event.tag == tag(101)); - GPR_ASSERT(event.type == GRPC_OP_COMPLETE); + CHECK_EQ(event.success, 1); + CHECK(event.tag == tag(101)); + CHECK(event.type == GRPC_OP_COMPLETE); memset(ops, 0, sizeof(ops)); op = ops; @@ -316,7 +317,7 @@ static void _test_close_before_server_recv(fd_type fdtype) { if (fdtype == SERVER_FD) { fd = sfd->server->vtable->get_fd(sfd->server); } else { - GPR_ASSERT(fdtype == CLIENT_FD); + CHECK(fdtype == CLIENT_FD); fd = sfd->client->vtable->get_fd(sfd->client); } // Connection is closed before the server receives the client's message. @@ -324,7 +325,7 @@ static void _test_close_before_server_recv(fd_type fdtype) { error = grpc_call_start_batch(server_call, ops, static_cast(op - ops), tag(102), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); event = grpc_completion_queue_next( g_ctx.bound_cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); @@ -335,8 +336,8 @@ static void _test_close_before_server_recv(fd_type fdtype) { // happen due to a race with closing the fd resulting in pending writes // failing due to stream closure. // - GPR_ASSERT(event.type == GRPC_OP_COMPLETE); - GPR_ASSERT(event.tag == tag(102)); + CHECK(event.type == GRPC_OP_COMPLETE); + CHECK(event.tag == tag(102)); event = grpc_completion_queue_next( g_ctx.client_cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); @@ -350,14 +351,14 @@ static void _test_close_before_server_recv(fd_type fdtype) { // 2. client receives GRPC_STATUS_UNAVAILABLE from server // if (event.type == GRPC_QUEUE_TIMEOUT) { - GPR_ASSERT(event.success == 0); + CHECK_EQ(event.success, 0); // status is not initialized - GPR_ASSERT(status == GRPC_STATUS__DO_NOT_USE); + CHECK_EQ(status, GRPC_STATUS__DO_NOT_USE); } else { - GPR_ASSERT(event.type == GRPC_OP_COMPLETE); - GPR_ASSERT(event.success == 1); - GPR_ASSERT(event.tag == tag(1)); - GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); + CHECK(event.type == GRPC_OP_COMPLETE); + CHECK_EQ(event.success, 1); + CHECK(event.tag == tag(1)); + CHECK_EQ(status, GRPC_STATUS_UNAVAILABLE); } grpc_metadata_array_destroy(&initial_metadata_recv); @@ -419,7 +420,7 @@ static void _test_close_before_server_send(fd_type fdtype) { call = grpc_channel_create_call( g_ctx.client, nullptr, GRPC_PROPAGATE_DEFAULTS, g_ctx.client_cq, grpc_slice_from_static_string("/foo"), nullptr, deadline, nullptr); - GPR_ASSERT(call); + CHECK(call); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); @@ -461,17 +462,17 @@ static void _test_close_before_server_send(fd_type fdtype) { op++; error = grpc_call_start_batch(call, ops, static_cast(op - ops), tag(1), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); error = grpc_server_request_call(g_ctx.server, &server_call, &call_details, &request_metadata_recv, g_ctx.bound_cq, g_ctx.cq, tag(101)); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); event = grpc_completion_queue_next( g_ctx.cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); - GPR_ASSERT(event.success == 1); - GPR_ASSERT(event.tag == tag(101)); - GPR_ASSERT(event.type == GRPC_OP_COMPLETE); + CHECK_EQ(event.success, 1); + CHECK(event.tag == tag(101)); + CHECK(event.type == GRPC_OP_COMPLETE); memset(ops, 0, sizeof(ops)); op = ops; @@ -487,13 +488,13 @@ static void _test_close_before_server_send(fd_type fdtype) { op++; error = grpc_call_start_batch(server_call, ops, static_cast(op - ops), tag(102), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); event = grpc_completion_queue_next( g_ctx.bound_cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); - GPR_ASSERT(event.type == GRPC_OP_COMPLETE); - GPR_ASSERT(event.success == 1); - GPR_ASSERT(event.tag == tag(102)); + CHECK(event.type == GRPC_OP_COMPLETE); + CHECK_EQ(event.success, 1); + CHECK(event.tag == tag(102)); memset(ops, 0, sizeof(ops)); op = ops; @@ -521,7 +522,7 @@ static void _test_close_before_server_send(fd_type fdtype) { if (fdtype == SERVER_FD) { fd = sfd->server->vtable->get_fd(sfd->server); } else { - GPR_ASSERT(fdtype == CLIENT_FD); + CHECK(fdtype == CLIENT_FD); fd = sfd->client->vtable->get_fd(sfd->client); } @@ -530,14 +531,14 @@ static void _test_close_before_server_send(fd_type fdtype) { close(fd); error = grpc_call_start_batch(server_call, ops, static_cast(op - ops), tag(103), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); // Batch operation succeeds on the server side event = grpc_completion_queue_next( g_ctx.bound_cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); - GPR_ASSERT(event.type == GRPC_OP_COMPLETE); - GPR_ASSERT(event.success == 1); - GPR_ASSERT(event.tag == tag(103)); + CHECK(event.type == GRPC_OP_COMPLETE); + CHECK_EQ(event.success, 1); + CHECK(event.tag == tag(103)); event = grpc_completion_queue_next( g_ctx.client_cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); @@ -547,16 +548,16 @@ static void _test_close_before_server_send(fd_type fdtype) { // waiting on the completion queue // if (event.type == GRPC_OP_COMPLETE) { - GPR_ASSERT(event.success == 1); - GPR_ASSERT(event.tag == tag(1)); - GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); + CHECK_EQ(event.success, 1); + CHECK(event.tag == tag(1)); + CHECK_EQ(status, GRPC_STATUS_UNAVAILABLE); } else { - GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT); - GPR_ASSERT(event.success == 0); + CHECK(event.type == GRPC_QUEUE_TIMEOUT); + CHECK_EQ(event.success, 0); // status is not initialized - GPR_ASSERT(status == GRPC_STATUS__DO_NOT_USE); + CHECK_EQ(status, GRPC_STATUS__DO_NOT_USE); } - GPR_ASSERT(was_cancelled == 0); + CHECK_EQ(was_cancelled, 0); grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); @@ -615,7 +616,7 @@ static void _test_close_before_client_send(fd_type fdtype) { call = grpc_channel_create_call( g_ctx.client, nullptr, GRPC_PROPAGATE_DEFAULTS, g_ctx.client_cq, grpc_slice_from_static_string("/foo"), nullptr, deadline, nullptr); - GPR_ASSERT(call); + CHECK(call); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); @@ -661,7 +662,7 @@ static void _test_close_before_client_send(fd_type fdtype) { if (fdtype == SERVER_FD) { fd = sfd->server->vtable->get_fd(sfd->server); } else { - GPR_ASSERT(fdtype == CLIENT_FD); + CHECK(fdtype == CLIENT_FD); fd = sfd->client->vtable->get_fd(sfd->client); } // Connection is closed before the client sends a batch to the server @@ -669,22 +670,22 @@ static void _test_close_before_client_send(fd_type fdtype) { error = grpc_call_start_batch(call, ops, static_cast(op - ops), tag(1), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); // Status unavailable is returned to the client when client or server fd is // closed event = grpc_completion_queue_next( g_ctx.client_cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); - GPR_ASSERT(event.success == 1); - GPR_ASSERT(event.type == GRPC_OP_COMPLETE); - GPR_ASSERT(event.tag == tag(1)); - GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); + CHECK_EQ(event.success, 1); + CHECK(event.type == GRPC_OP_COMPLETE); + CHECK(event.tag == tag(1)); + CHECK_EQ(status, GRPC_STATUS_UNAVAILABLE); // No event is received on the server event = grpc_completion_queue_next( g_ctx.cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); - GPR_ASSERT(event.success == 0); - GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT); + CHECK_EQ(event.success, 0); + CHECK(event.type == GRPC_QUEUE_TIMEOUT); grpc_slice_unref(details); grpc_metadata_array_destroy(&initial_metadata_recv); @@ -723,7 +724,7 @@ static void _test_close_before_call_create(fd_type fdtype) { if (fdtype == SERVER_FD) { fd = sfd->server->vtable->get_fd(sfd->server); } else { - GPR_ASSERT(fdtype == CLIENT_FD); + CHECK(fdtype == CLIENT_FD); fd = sfd->client->vtable->get_fd(sfd->client); } // Connection is closed before the client creates a call @@ -732,19 +733,19 @@ static void _test_close_before_call_create(fd_type fdtype) { call = grpc_channel_create_call( g_ctx.client, nullptr, GRPC_PROPAGATE_DEFAULTS, g_ctx.client_cq, grpc_slice_from_static_string("/foo"), nullptr, deadline, nullptr); - GPR_ASSERT(call); + CHECK(call); // Client and server time out waiting on their completion queues and nothing // is sent or received event = grpc_completion_queue_next( g_ctx.client_cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); - GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT); - GPR_ASSERT(event.success == 0); + CHECK(event.type == GRPC_QUEUE_TIMEOUT); + CHECK_EQ(event.success, 0); event = grpc_completion_queue_next( g_ctx.cq, grpc_timeout_milliseconds_to_deadline(100), nullptr); - GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT); - GPR_ASSERT(event.success == 0); + CHECK(event.type == GRPC_QUEUE_TIMEOUT); + CHECK_EQ(event.success, 0); grpc_call_unref(call); end_test(); diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD index dc36704723c..718b0300a0e 100644 --- a/test/core/channel/BUILD +++ b/test/core/channel/BUILD @@ -95,58 +95,6 @@ grpc_cc_test( ], ) -grpc_cc_test( - name = "channel_trace_test", - srcs = ["channel_trace_test.cc"], - external_deps = [ - "gtest", - ], - language = "C++", - deps = [ - "//:gpr", - "//:grpc", - "//:grpc++", - "//src/core:channel_args", - "//test/core/util:grpc_test_util", - "//test/cpp/util:channel_trace_proto_helper", - ], -) - -grpc_cc_test( - name = "channelz_test", - srcs = ["channelz_test.cc"], - external_deps = [ - "gtest", - ], - language = "C++", - deps = [ - "//:gpr", - "//:grpc", - "//:grpc++", - "//src/core:channel_args", - "//test/core/event_engine:event_engine_test_utils", - "//test/core/util:grpc_test_util", - "//test/cpp/util:channel_trace_proto_helper", - ], -) - -grpc_cc_test( - name = "channelz_registry_test", - srcs = ["channelz_registry_test.cc"], - external_deps = [ - "gtest", - ], - language = "C++", - uses_event_engine = False, - uses_polling = False, - deps = [ - "//:gpr", - "//:grpc", - "//:grpc++", - "//test/core/util:grpc_test_util", - ], -) - grpc_cc_test( name = "status_util_test", srcs = ["status_util_test.cc"], diff --git a/test/core/channel/call_tracer_test.cc b/test/core/channel/call_tracer_test.cc index d83093cb128..4950e8d0276 100644 --- a/test/core/channel/call_tracer_test.cc +++ b/test/core/channel/call_tracer_test.cc @@ -94,6 +94,7 @@ TEST_F(CallTracerTest, MultipleClientCallAttemptTracers) { attempt_tracer->RecordAnnotation("Test"); EXPECT_EQ(annotation_logger_, std::vector({"Test", "Test", "Test"})); + attempt_tracer->RecordEnd(gpr_timespec()); } TEST_F(CallTracerTest, BasicServerCallTracerTest) { diff --git a/test/core/channelz/BUILD b/test/core/channelz/BUILD new file mode 100644 index 00000000000..82c3bde0d30 --- /dev/null +++ b/test/core/channelz/BUILD @@ -0,0 +1,71 @@ +# 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. + +load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package") + +grpc_package(name = "test/core/channelz") + +licenses(["notice"]) + +grpc_cc_test( + name = "channel_trace_test", + srcs = ["channel_trace_test.cc"], + external_deps = [ + "gtest", + ], + language = "C++", + deps = [ + "//:gpr", + "//:grpc", + "//:grpc++", + "//src/core:channel_args", + "//test/core/util:grpc_test_util", + "//test/cpp/util:channel_trace_proto_helper", + ], +) + +grpc_cc_test( + name = "channelz_test", + srcs = ["channelz_test.cc"], + external_deps = [ + "gtest", + ], + language = "C++", + deps = [ + "//:gpr", + "//:grpc", + "//:grpc++", + "//src/core:channel_args", + "//test/core/event_engine:event_engine_test_utils", + "//test/core/util:grpc_test_util", + "//test/cpp/util:channel_trace_proto_helper", + ], +) + +grpc_cc_test( + name = "channelz_registry_test", + srcs = ["channelz_registry_test.cc"], + external_deps = [ + "gtest", + ], + language = "C++", + uses_event_engine = False, + uses_polling = False, + deps = [ + "//:gpr", + "//:grpc", + "//:grpc++", + "//test/core/util:grpc_test_util", + ], +) diff --git a/test/core/channel/channel_trace_test.cc b/test/core/channelz/channel_trace_test.cc similarity index 94% rename from test/core/channel/channel_trace_test.cc rename to test/core/channelz/channel_trace_test.cc index 2396c4a3945..817fd30f687 100644 --- a/test/core/channel/channel_trace_test.cc +++ b/test/core/channelz/channel_trace_test.cc @@ -16,12 +16,14 @@ // // -#include "src/core/lib/channel/channel_trace.h" +#include "src/core/channelz/channel_trace.h" #include #include +#include +#include "absl/synchronization/notification.h" #include "gtest/gtest.h" #include @@ -29,8 +31,8 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/json/json.h" #include "src/core/lib/json/json_writer.h" @@ -317,6 +319,28 @@ TEST(ChannelTracerTest, TestTotalEviction) { ValidateChannelTraceCustom(&tracer, kNumEvents + 1, 0); } +// Tests that the code is thread-safe. +TEST(ChannelTracerTest, ThreadSafety) { + ExecCtx exec_ctx; + ChannelTrace tracer(kEventListMemoryLimit); + absl::Notification done; + std::vector> threads; + for (size_t i = 0; i < 10; ++i) { + threads.push_back(std::make_unique([&]() { + do { + AddSimpleTrace(&tracer); + } while (!done.HasBeenNotified()); + })); + } + for (size_t i = 0; i < 10; ++i) { + tracer.RenderJson(); + } + done.Notify(); + for (const auto& thd : threads) { + thd->join(); + } +} + } // namespace testing } // namespace channelz } // namespace grpc_core diff --git a/test/core/channel/channelz_registry_test.cc b/test/core/channelz/channelz_registry_test.cc similarity index 98% rename from test/core/channel/channelz_registry_test.cc rename to test/core/channelz/channelz_registry_test.cc index 4f9f23bd1d6..02fb0360c72 100644 --- a/test/core/channel/channelz_registry_test.cc +++ b/test/core/channelz/channelz_registry_test.cc @@ -16,7 +16,7 @@ // // -#include "src/core/lib/channel/channelz_registry.h" +#include "src/core/channelz/channelz_registry.h" #include @@ -25,7 +25,7 @@ #include "gtest/gtest.h" -#include "src/core/lib/channel/channelz.h" +#include "src/core/channelz/channelz.h" #include "test/core/util/test_config.h" namespace grpc_core { diff --git a/test/core/channel/channelz_test.cc b/test/core/channelz/channelz_test.cc similarity index 99% rename from test/core/channel/channelz_test.cc rename to test/core/channelz/channelz_test.cc index 973af3690eb..3cf8239eb39 100644 --- a/test/core/channel/channelz_test.cc +++ b/test/core/channelz/channelz_test.cc @@ -16,7 +16,7 @@ // // -#include "src/core/lib/channel/channelz.h" +#include "src/core/channelz/channelz.h" #include @@ -39,8 +39,8 @@ #include #include +#include "src/core/channelz/channelz_registry.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz_registry.h" #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/notification.h" diff --git a/test/core/client_channel/BUILD b/test/core/client_channel/BUILD index db32f642365..1de1356f7d1 100644 --- a/test/core/client_channel/BUILD +++ b/test/core/client_channel/BUILD @@ -33,21 +33,6 @@ grpc_cc_test( ], ) -grpc_cc_test( - name = "http_proxy_mapper_test", - srcs = ["http_proxy_mapper_test.cc"], - external_deps = ["gtest"], - language = "C++", - uses_polling = False, - deps = [ - "//:gpr", - "//:grpc", - "//src/core:channel_args", - "//test/core/util:grpc_test_util", - "//test/core/util:scoped_env_var", - ], -) - grpc_cc_test( name = "retry_throttle_test", srcs = ["retry_throttle_test.cc"], diff --git a/test/core/client_channel/resolvers/BUILD b/test/core/client_channel/resolvers/BUILD deleted file mode 100644 index c6ff60d95d2..00000000000 --- a/test/core/client_channel/resolvers/BUILD +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright 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. - -load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package") - -grpc_package(name = "test/core/client_channel/resolvers") - -licenses(["notice"]) - -grpc_cc_test( - name = "binder_resolver_test", - srcs = ["binder_resolver_test.cc"], - external_deps = [ - "gtest", - ], - language = "C++", - deps = [ - "//:gpr", - "//:grpc", - "//src/core:grpc_resolver_binder", - "//test/core/util:grpc_test_util", - ], -) - -grpc_cc_test( - name = "dns_resolver_test", - srcs = ["dns_resolver_test.cc"], - external_deps = ["gtest"], - language = "C++", - deps = [ - "//:gpr", - "//:grpc", - "//test/core/util:grpc_test_util", - ], -) - -grpc_cc_test( - name = "dns_resolver_cooldown_test", - srcs = ["dns_resolver_cooldown_test.cc"], - external_deps = ["gtest"], - language = "C++", - deps = [ - "//:gpr", - "//:grpc", - "//src/core:channel_args", - "//src/core:closure", - "//test/core/util:grpc_test_util", - ], -) - -grpc_cc_test( - name = "sockaddr_resolver_test", - srcs = ["sockaddr_resolver_test.cc"], - external_deps = ["gtest"], - language = "C++", - deps = [ - "//:gpr", - "//:grpc", - "//test/core/util:grpc_test_util", - ], -) - -grpc_cc_test( - name = "fake_resolver_test", - srcs = ["fake_resolver_test.cc"], - external_deps = ["gtest"], - language = "C++", - deps = [ - "//:gpr", - "//:grpc", - "//:grpc_resolver_fake", - "//src/core:channel_args", - "//test/core/util:grpc_test_util", - ], -) - -grpc_cc_test( - name = "google_c2p_resolver_test", - srcs = ["google_c2p_resolver_test.cc"], - external_deps = [ - "absl/strings:str_format", - "gtest", - ], - language = "C++", - deps = [ - "//:gpr", - "//:grpc", - "//:grpc++", - "//test/core/util:fake_udp_and_tcp_server", - "//test/core/util:grpc_test_util", - "//test/cpp/util:test_util", - ], -) diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD index c3062c1d3a8..6a9f7a0b397 100644 --- a/test/core/end2end/BUILD +++ b/test/core/end2end/BUILD @@ -27,6 +27,7 @@ grpc_cc_library( external_deps = [ "absl/container:flat_hash_map", "absl/functional:any_invocable", + "absl/log:check", "absl/strings", "absl/strings:str_format", "absl/types:variant", @@ -62,6 +63,7 @@ grpc_cc_library( srcs = ["fixtures/http_proxy_fixture.cc"], hdrs = ["fixtures/http_proxy_fixture.h"], external_deps = [ + "absl/log:check", "absl/status", "absl/status:statusor", "absl/strings", @@ -94,6 +96,7 @@ grpc_cc_library( name = "proxy", srcs = ["fixtures/proxy.cc"], hdrs = ["fixtures/proxy.h"], + external_deps = ["absl/log:check"], language = "C++", deps = [ "//:channel_arg_names", @@ -116,6 +119,7 @@ grpc_cc_library( ], external_deps = [ "absl/functional:any_invocable", + "absl/log:check", "absl/memory", "absl/meta:type_traits", "absl/random", @@ -159,6 +163,7 @@ grpc_cc_library( ], external_deps = [ "absl/functional:any_invocable", + "absl/log:check", "absl/status", "absl/status:statusor", "absl/strings", @@ -197,6 +202,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/functional:any_invocable", + "absl/log:check", "absl/meta:type_traits", "absl/random", "absl/status", @@ -261,6 +267,7 @@ grpc_cc_library( ], external_deps = [ "absl/functional:any_invocable", + "absl/log:check", "absl/strings", "absl/types:optional", "gtest", @@ -493,6 +500,7 @@ grpc_core_end2end_test(name = "write_buffering_at_end") grpc_cc_test( name = "bad_server_response_test", srcs = ["bad_server_response_test.cc"], + external_deps = ["absl/log:check"], language = "C++", deps = [ "cq_verifier", @@ -515,6 +523,7 @@ grpc_cc_test( grpc_cc_test( name = "connection_refused_test", srcs = ["connection_refused_test.cc"], + external_deps = ["absl/log:check"], language = "C++", deps = [ "cq_verifier", @@ -531,6 +540,7 @@ grpc_cc_test( name = "dualstack_socket_test", srcs = ["dualstack_socket_test.cc"], external_deps = [ + "absl/log:check", "absl/status:statusor", "absl/strings", "absl/strings:str_format", @@ -554,6 +564,7 @@ grpc_cc_test( name = "goaway_server_test", srcs = ["goaway_server_test.cc"], external_deps = [ + "absl/log:check", "absl/status", "absl/status:statusor", "absl/strings", @@ -585,6 +596,7 @@ grpc_cc_test( grpc_cc_test( name = "invalid_call_argument_test", srcs = ["invalid_call_argument_test.cc"], + external_deps = ["absl/log:check"], language = "C++", deps = [ "cq_verifier", @@ -610,6 +622,7 @@ grpc_cc_test( name = "no_server_test", srcs = ["no_server_test.cc"], external_deps = [ + "absl/log:check", "absl/status", "absl/status:statusor", "absl/time", @@ -638,6 +651,7 @@ grpc_cc_test( ], external_deps = [ "absl/functional:any_invocable", + "absl/log:check", "absl/memory", "absl/meta:type_traits", "absl/strings", @@ -679,6 +693,7 @@ grpc_cc_test( "//src/core/tsi/test_creds:server1.pem", ], external_deps = [ + "absl/log:check", "absl/types:optional", "gtest", ], @@ -709,6 +724,7 @@ grpc_cc_test( "//src/core/tsi/test_creds:server1.pem", ], external_deps = [ + "absl/log:check", "absl/types:optional", "gtest", ], diff --git a/test/core/end2end/bad_server_response_test.cc b/test/core/end2end/bad_server_response_test.cc index b898c0aa23d..6f9ebd429dd 100644 --- a/test/core/end2end/bad_server_response_test.cc +++ b/test/core/end2end/bad_server_response_test.cc @@ -24,6 +24,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -110,13 +112,13 @@ static grpc_closure on_write; static void* tag(intptr_t t) { return reinterpret_cast(t); } static void done_write(void* /*arg*/, grpc_error_handle error) { - GPR_ASSERT(error.ok()); + CHECK_OK(error); gpr_atm_rel_store(&state.done_atm, 1); } static void done_writing_settings_frame(void* /* arg */, grpc_error_handle error) { - GPR_ASSERT(error.ok()); + CHECK_OK(error); grpc_endpoint_read(state.tcp, &state.temp_incoming_buffer, &on_read, /*urgent=*/false, /*min_progress_size=*/1); } @@ -255,15 +257,15 @@ static void start_rpc(int target_port, grpc_status_code expected_status, error = grpc_call_start_batch(state.call, ops, static_cast(op - ops), tag(1), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); cqv.Expect(tag(1), true); cqv.Verify(); - GPR_ASSERT(status == expected_status); + CHECK_EQ(status, expected_status); if (expected_detail != nullptr) { - GPR_ASSERT(-1 != grpc_slice_slice(details, grpc_slice_from_static_string( - expected_detail))); + CHECK_NE(-1, grpc_slice_slice( + details, grpc_slice_from_static_string(expected_detail))); } grpc_metadata_array_destroy(&initial_metadata_recv); @@ -353,7 +355,7 @@ static void run_test(bool http2_response, bool send_settings, thdptr->Join(); state.on_connect_done->WaitForNotification(); // Proof that the server accepted the TCP connection. - GPR_ASSERT(state.connection_attempt_made == true); + CHECK_EQ(state.connection_attempt_made, true); // clean up grpc_endpoint_shutdown(state.tcp, GRPC_ERROR_CREATE("Test Shutdown")); grpc_endpoint_destroy(state.tcp); diff --git a/test/core/end2end/connection_refused_test.cc b/test/core/end2end/connection_refused_test.cc index b3deb41f14f..35e6b0db826 100644 --- a/test/core/end2end/connection_refused_test.cc +++ b/test/core/end2end/connection_refused_test.cc @@ -20,6 +20,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -60,7 +62,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) { // if using service config, create channel args grpc_channel_args* args = nullptr; if (use_service_config) { - GPR_ASSERT(wait_for_ready); + CHECK(wait_for_ready); grpc_arg arg; arg.type = GRPC_ARG_STRING; arg.key = const_cast(GRPC_ARG_SERVICE_CONFIG); @@ -106,17 +108,17 @@ static void run_test(bool wait_for_ready, bool use_service_config) { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call, ops, (size_t)(op - ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(call, ops, (size_t)(op - ops), + grpc_core::CqVerifier::tag(1), nullptr)); // verify that all tags get completed cqv.Expect(grpc_core::CqVerifier::tag(1), true); cqv.Verify(); if (wait_for_ready) { - GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); + CHECK_EQ(status, GRPC_STATUS_DEADLINE_EXCEEDED); } else { - GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); + CHECK_EQ(status, GRPC_STATUS_UNAVAILABLE); } grpc_completion_queue_shutdown(cq); diff --git a/test/core/end2end/cq_verifier.cc b/test/core/end2end/cq_verifier.cc index 6da3a8112ec..4f089e9d480 100644 --- a/test/core/end2end/cq_verifier.cc +++ b/test/core/end2end/cq_verifier.cc @@ -28,6 +28,7 @@ #include #include +#include "absl/log/check.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -163,9 +164,9 @@ int byte_buffer_eq_slice(grpc_byte_buffer* bb, grpc_slice b) { if (bb->data.raw.compression > GRPC_COMPRESS_NONE) { grpc_slice_buffer decompressed_buffer; grpc_slice_buffer_init(&decompressed_buffer); - GPR_ASSERT(grpc_msg_decompress(bb->data.raw.compression, - &bb->data.raw.slice_buffer, - &decompressed_buffer)); + CHECK(grpc_msg_decompress(bb->data.raw.compression, + &bb->data.raw.slice_buffer, + &decompressed_buffer)); grpc_byte_buffer* rbb = grpc_raw_byte_buffer_create( decompressed_buffer.slices, decompressed_buffer.count); int ret_val = raw_byte_buffer_eq_slice(rbb, b); @@ -427,7 +428,7 @@ void CqVerifier::VerifyEmpty(Duration timeout, SourceLocation location) { } const gpr_timespec deadline = gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), timeout.as_timespec()); - GPR_ASSERT(expectations_.empty()); + CHECK(expectations_.empty()); grpc_event ev = Step(deadline); if (ev.type != GRPC_QUEUE_TIMEOUT) { FailUnexpectedEvent(&ev, location); diff --git a/test/core/end2end/dualstack_socket_test.cc b/test/core/end2end/dualstack_socket_test.cc index 4c4c782e3b2..5b989c83657 100644 --- a/test/core/end2end/dualstack_socket_test.cc +++ b/test/core/end2end/dualstack_socket_test.cc @@ -20,6 +20,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include @@ -121,13 +122,13 @@ void test_connect(const char* server_host, const char* client_host, int port, grpc_server_register_completion_queue(server, cq, nullptr); grpc_server_credentials* server_creds = grpc_insecure_server_credentials_create(); - GPR_ASSERT((got_port = grpc_server_add_http2_port( - server, server_hostport.c_str(), server_creds)) > 0); + CHECK((got_port = grpc_server_add_http2_port(server, server_hostport.c_str(), + server_creds)) > 0); grpc_server_credentials_release(server_creds); if (port == 0) { port = got_port; } else { - GPR_ASSERT(port == got_port); + CHECK_EQ(port, got_port); } grpc_server_start(server); grpc_core::CqVerifier cqv(cq); @@ -171,7 +172,7 @@ void test_connect(const char* server_host, const char* client_host, int port, c = grpc_channel_create_call(client, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/foo"), &host, deadline, nullptr); - GPR_ASSERT(c); + CHECK(c); memset(ops, 0, sizeof(ops)); op = ops; @@ -198,14 +199,14 @@ void test_connect(const char* server_host, const char* client_host, int port, op++; error = grpc_call_start_batch(c, ops, static_cast(op - ops), grpc_core::CqVerifier::tag(1), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); if (expect_ok) { // Check for a successful request. error = grpc_server_request_call(server, &s, &call_details, &request_metadata_recv, cq, cq, grpc_core::CqVerifier::tag(101)); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); cqv.Expect(grpc_core::CqVerifier::tag(101), true); cqv.Verify(); @@ -228,7 +229,7 @@ void test_connect(const char* server_host, const char* client_host, int port, op++; error = grpc_call_start_batch(s, ops, static_cast(op - ops), grpc_core::CqVerifier::tag(102), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); cqv.Expect(grpc_core::CqVerifier::tag(102), true); cqv.Expect(grpc_core::CqVerifier::tag(1), true); @@ -238,12 +239,11 @@ void test_connect(const char* server_host, const char* client_host, int port, gpr_log(GPR_DEBUG, "got peer: '%s'", peer); gpr_free(peer); - GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); - GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); - GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); - GPR_ASSERT(0 == - grpc_slice_str_cmp(call_details.host, "foo.test.google.fr")); - GPR_ASSERT(was_cancelled == 0); + CHECK_EQ(status, GRPC_STATUS_UNIMPLEMENTED); + CHECK_EQ(grpc_slice_str_cmp(details, "xyz"), 0); + CHECK_EQ(grpc_slice_str_cmp(call_details.method, "/foo"), 0); + CHECK_EQ(grpc_slice_str_cmp(call_details.host, "foo.test.google.fr"), 0); + CHECK_EQ(was_cancelled, 0); grpc_call_unref(s); } else { @@ -253,7 +253,7 @@ void test_connect(const char* server_host, const char* client_host, int port, gpr_log(GPR_INFO, "status: %d (expected: %d)", status, GRPC_STATUS_UNAVAILABLE); - GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); + CHECK_EQ(status, GRPC_STATUS_UNAVAILABLE); } grpc_call_unref(c); diff --git a/test/core/end2end/end2end_test_fuzzer.cc b/test/core/end2end/end2end_test_fuzzer.cc index 450a4ec51b8..01a730269e9 100644 --- a/test/core/end2end/end2end_test_fuzzer.cc +++ b/test/core/end2end/end2end_test_fuzzer.cc @@ -26,6 +26,8 @@ #include +#include "absl/log/check.h" + #include #include @@ -133,7 +135,7 @@ void RunEnd2endFuzzer(const core_end2end_test_fuzzer::Msg& msg) { test->SetUp(); test->RunTest(); test->TearDown(); - GPR_ASSERT(!::testing::Test::HasFailure()); + CHECK(!::testing::Test::HasFailure()); } } // namespace grpc_core diff --git a/test/core/end2end/end2end_test_suites.cc b/test/core/end2end/end2end_test_suites.cc index f1f86668b20..1505fa38e80 100644 --- a/test/core/end2end/end2end_test_suites.cc +++ b/test/core/end2end/end2end_test_suites.cc @@ -26,6 +26,7 @@ #include "absl/base/thread_annotations.h" #include "absl/functional/any_invocable.h" +#include "absl/log/check.h" #include "absl/meta/type_traits.h" #include "absl/random/random.h" #include "absl/status/status.h" @@ -109,7 +110,7 @@ void ProcessAuthFailure(void* state, grpc_auth_context* /*ctx*/, const grpc_metadata* /*md*/, size_t /*md_count*/, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == nullptr); + CHECK_EQ(state, nullptr); cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } @@ -134,8 +135,7 @@ class CensusFixture : public CoreTestFixture { auto* server = grpc_server_create( args.Set(GRPC_ARG_ENABLE_CENSUS, true).ToC().get(), nullptr); grpc_server_register_completion_queue(server, cq, nullptr); - GPR_ASSERT( - grpc_server_add_http2_port(server, localaddr_.c_str(), server_creds)); + CHECK(grpc_server_add_http2_port(server, localaddr_.c_str(), server_creds)); grpc_server_credentials_release(server_creds); pre_server_start(server); grpc_server_start(server); @@ -168,8 +168,7 @@ class CompressionFixture : public CoreTestFixture { grpc_server_register_completion_queue(server, cq, nullptr); grpc_server_credentials* server_creds = grpc_insecure_server_credentials_create(); - GPR_ASSERT( - grpc_server_add_http2_port(server, localaddr_.c_str(), server_creds)); + CHECK(grpc_server_add_http2_port(server, localaddr_.c_str(), server_creds)); grpc_server_credentials_release(server_creds); pre_server_start(server); grpc_server_start(server); @@ -281,13 +280,11 @@ class FdFixture : public CoreTestFixture { int flags; grpc_create_socketpair_if_unix(sv); flags = fcntl(sv[0], F_GETFL, 0); - GPR_ASSERT(fcntl(sv[0], F_SETFL, flags | O_NONBLOCK) == 0); + CHECK_EQ(fcntl(sv[0], F_SETFL, flags | O_NONBLOCK), 0); flags = fcntl(sv[1], F_GETFL, 0); - GPR_ASSERT(fcntl(sv[1], F_SETFL, flags | O_NONBLOCK) == 0); - GPR_ASSERT(grpc_set_socket_no_sigpipe_if_possible(sv[0]) == - absl::OkStatus()); - GPR_ASSERT(grpc_set_socket_no_sigpipe_if_possible(sv[1]) == - absl::OkStatus()); + CHECK_EQ(fcntl(sv[1], F_SETFL, flags | O_NONBLOCK), 0); + CHECK(grpc_set_socket_no_sigpipe_if_possible(sv[0]) == absl::OkStatus()); + CHECK(grpc_set_socket_no_sigpipe_if_possible(sv[1]) == absl::OkStatus()); } int fd_pair_[2]; @@ -315,7 +312,7 @@ class HttpProxyFilter : public CoreTestFixture { grpc_server_register_completion_queue(server, cq, nullptr); grpc_server_credentials* server_creds = grpc_insecure_server_credentials_create(); - GPR_ASSERT( + CHECK( grpc_server_add_http2_port(server, server_addr_.c_str(), server_creds)); grpc_server_credentials_release(server_creds); pre_server_start(server); @@ -342,7 +339,7 @@ class HttpProxyFilter : public CoreTestFixture { server_addr_.c_str(), creds, args.Set(GRPC_ARG_HTTP_PROXY, proxy_uri).ToC().get()); grpc_channel_credentials_release(creds); - GPR_ASSERT(client); + CHECK(client); return client; } @@ -364,7 +361,7 @@ class ProxyFixture : public CoreTestFixture { grpc_server* s = grpc_server_create(server_args, nullptr); grpc_server_credentials* server_creds = grpc_insecure_server_credentials_create(); - GPR_ASSERT(grpc_server_add_http2_port(s, port, server_creds)); + CHECK(grpc_server_add_http2_port(s, port, server_creds)); grpc_server_credentials_release(server_creds); return s; } @@ -384,7 +381,7 @@ class ProxyFixture : public CoreTestFixture { grpc_server_register_completion_queue(server, cq, nullptr); grpc_server_credentials* server_creds = grpc_insecure_server_credentials_create(); - GPR_ASSERT(grpc_server_add_http2_port( + CHECK(grpc_server_add_http2_port( server, grpc_end2end_proxy_get_server_port(proxy_), server_creds)); grpc_server_credentials_release(server_creds); pre_server_start(server); @@ -398,7 +395,7 @@ class ProxyFixture : public CoreTestFixture { auto* client = grpc_channel_create( grpc_end2end_proxy_get_client_target(proxy_), creds, args.ToC().get()); grpc_channel_credentials_release(creds); - GPR_ASSERT(client); + CHECK(client); return client; } const grpc_end2end_proxy_def proxy_def_ = {CreateProxyServer, @@ -424,7 +421,7 @@ class SslProxyFixture : public CoreTestFixture { server_cert.c_str()}; grpc_server_credentials* ssl_creds = grpc_ssl_server_credentials_create( nullptr, &pem_key_cert_pair, 1, 0, nullptr); - GPR_ASSERT(grpc_server_add_http2_port(s, port, ssl_creds)); + CHECK(grpc_server_add_http2_port(s, port, ssl_creds)); grpc_server_credentials_release(ssl_creds); return s; } @@ -466,7 +463,7 @@ class SslProxyFixture : public CoreTestFixture { auto* server = grpc_server_create(args.ToC().get(), nullptr); grpc_server_register_completion_queue(server, cq, nullptr); - GPR_ASSERT(grpc_server_add_http2_port( + CHECK(grpc_server_add_http2_port( server, grpc_end2end_proxy_get_server_port(proxy_), ssl_creds)); grpc_server_credentials_release(ssl_creds); pre_server_start(server); @@ -483,7 +480,7 @@ class SslProxyFixture : public CoreTestFixture { args.Set(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, "foo.test.google.fr") .ToC() .get()); - GPR_ASSERT(client != nullptr); + CHECK_NE(client, nullptr); grpc_channel_credentials_release(ssl_creds); return client; } @@ -537,7 +534,7 @@ class ChaoticGoodFixture final : public CoreTestFixture { absl::AnyInvocable& pre_server_start) override { auto* server = grpc_server_create(args.ToC().get(), nullptr); grpc_server_register_completion_queue(server, cq, nullptr); - GPR_ASSERT(grpc_server_add_chaotic_good_port(server, localaddr_.c_str())); + CHECK(grpc_server_add_chaotic_good_port(server, localaddr_.c_str())); pre_server_start(server); grpc_server_start(server); return server; diff --git a/test/core/end2end/end2end_tests.cc b/test/core/end2end/end2end_tests.cc index ed1c1b235f5..30615b1698a 100644 --- a/test/core/end2end/end2end_tests.cc +++ b/test/core/end2end/end2end_tests.cc @@ -22,6 +22,7 @@ #include #include +#include "absl/log/check.h" #include "absl/memory/memory.h" #include "absl/random/random.h" @@ -119,8 +120,8 @@ void CoreEnd2endTest::TearDown() { gpr_log(GPR_ERROR, "Timeout in waiting for gRPC shutdown"); } } - GPR_ASSERT(client_ == nullptr); - GPR_ASSERT(server_ == nullptr); + CHECK_EQ(client_, nullptr); + CHECK_EQ(server_, nullptr); initialized_ = false; } @@ -151,20 +152,20 @@ std::string CoreEnd2endTest::IncomingMessage::payload() const { if (payload_->data.raw.compression > GRPC_COMPRESS_NONE) { grpc_slice_buffer decompressed_buffer; grpc_slice_buffer_init(&decompressed_buffer); - GPR_ASSERT(grpc_msg_decompress(payload_->data.raw.compression, + CHECK(grpc_msg_decompress(payload_->data.raw.compression, &payload_->data.raw.slice_buffer, &decompressed_buffer)); grpc_byte_buffer* rbb = grpc_raw_byte_buffer_create( decompressed_buffer.slices, decompressed_buffer.count); grpc_byte_buffer_reader reader; - GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, rbb)); + CHECK(grpc_byte_buffer_reader_init(&reader, rbb)); out = Slice(grpc_byte_buffer_reader_readall(&reader)); grpc_byte_buffer_reader_destroy(&reader); grpc_byte_buffer_destroy(rbb); grpc_slice_buffer_destroy(&decompressed_buffer); } else { grpc_byte_buffer_reader reader; - GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, payload_)); + CHECK(grpc_byte_buffer_reader_init(&reader, payload_)); out = Slice(grpc_byte_buffer_reader_readall(&reader)); grpc_byte_buffer_reader_destroy(&reader); } @@ -322,7 +323,7 @@ CoreEnd2endTest::Call CoreEnd2endTest::ClientCallBuilder::Create() { CoreEnd2endTest::ServerRegisteredMethod::ServerRegisteredMethod( CoreEnd2endTest* test, absl::string_view name, grpc_server_register_method_payload_handling payload_handling) { - GPR_ASSERT(test->server_ == nullptr); + CHECK_EQ(test->server_, nullptr); test->pre_server_start_ = [old = std::move(test->pre_server_start_), handle = handle_, name = std::string(name), payload_handling](grpc_server* server) mutable { @@ -374,14 +375,14 @@ void CoreEnd2endTestRegistry::RegisterTest(absl::string_view suite, SourceLocation) { if (absl::StartsWith(name, "DISABLED_")) return; auto& tests = tests_by_suite_[suite]; - GPR_ASSERT(tests.count(name) == 0); + CHECK_EQ(tests.count(name), 0u); tests[name] = std::move(make_test); } void CoreEnd2endTestRegistry::RegisterSuite( absl::string_view suite, std::vector configs, SourceLocation) { - GPR_ASSERT(suites_.count(suite) == 0); + CHECK_EQ(suites_.count(suite), 0u); suites_[suite] = std::move(configs); } diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index f033f608061..a3435eccd13 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -32,6 +32,7 @@ #include #include "absl/functional/any_invocable.h" +#include "absl/log/check.h" #include "absl/memory/memory.h" #include "absl/meta/type_traits.h" #include "absl/strings/str_cat.h" @@ -640,7 +641,7 @@ class CoreEnd2endTest : public ::testing::Test { if (client_ != nullptr) ShutdownAndDestroyClient(); auto& f = fixture(); client_ = f.MakeClient(args, cq_); - GPR_ASSERT(client_ != nullptr); + CHECK_NE(client_, nullptr); } // Initialize the server. // If called, then InitClient must be called to create a client (otherwise one @@ -650,7 +651,7 @@ class CoreEnd2endTest : public ::testing::Test { if (server_ != nullptr) ShutdownAndDestroyServer(); auto& f = fixture(); server_ = f.MakeServer(args, cq_, pre_server_start_); - GPR_ASSERT(server_ != nullptr); + CHECK_NE(server_, nullptr); } // Remove the client. void ShutdownAndDestroyClient() { @@ -728,7 +729,7 @@ class CoreEnd2endTest : public ::testing::Test { } void SetPostGrpcInitFunc(absl::AnyInvocable fn) { - GPR_ASSERT(fixture_ == nullptr); + CHECK(fixture_ == nullptr); post_grpc_init_func_ = std::move(fn); } diff --git a/test/core/end2end/fixtures/h2_oauth2_common.h b/test/core/end2end/fixtures/h2_oauth2_common.h index e66f341059a..49ccec15bfb 100644 --- a/test/core/end2end/fixtures/h2_oauth2_common.h +++ b/test/core/end2end/fixtures/h2_oauth2_common.h @@ -17,6 +17,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -73,7 +75,7 @@ class Oauth2Fixture : public SecureFixture { void* user_data) { const grpc_metadata* oauth2 = find_metadata(md, md_count, "authorization", oauth2_md()); - GPR_ASSERT(oauth2 != nullptr); + CHECK_NE(oauth2, nullptr); cb(user_data, oauth2, 1, nullptr, 0, GRPC_STATUS_OK, nullptr); } @@ -83,8 +85,8 @@ class Oauth2Fixture : public SecureFixture { void* user_data) { const grpc_metadata* oauth2 = find_metadata(md, md_count, "authorization", oauth2_md()); - GPR_ASSERT(state != nullptr); - GPR_ASSERT(oauth2 != nullptr); + CHECK_NE(state, nullptr); + CHECK_NE(oauth2, nullptr); cb(user_data, oauth2, 1, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } @@ -159,7 +161,7 @@ class Oauth2Fixture : public SecureFixture { size_t /*md_count*/, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == nullptr); + CHECK_EQ(state, nullptr); cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } diff --git a/test/core/end2end/fixtures/h2_ssl_cred_reload_fixture.h b/test/core/end2end/fixtures/h2_ssl_cred_reload_fixture.h index 5b49fcb39e5..0c7dc536a7a 100644 --- a/test/core/end2end/fixtures/h2_ssl_cred_reload_fixture.h +++ b/test/core/end2end/fixtures/h2_ssl_cred_reload_fixture.h @@ -17,6 +17,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -91,7 +93,7 @@ class SslCredReloadFixture : public SecureFixture { size_t /*md_count*/, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == nullptr); + CHECK_EQ(state, nullptr); cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } diff --git a/test/core/end2end/fixtures/h2_ssl_tls_common.h b/test/core/end2end/fixtures/h2_ssl_tls_common.h index e026ccbd381..dbd8bb11539 100644 --- a/test/core/end2end/fixtures/h2_ssl_tls_common.h +++ b/test/core/end2end/fixtures/h2_ssl_tls_common.h @@ -17,6 +17,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -96,7 +98,7 @@ class SslTlsFixture : public SecureFixture { size_t /*md_count*/, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == nullptr); + CHECK_EQ(state, nullptr); cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } diff --git a/test/core/end2end/fixtures/h2_tls_common.h b/test/core/end2end/fixtures/h2_tls_common.h index 0abc56e6d06..908c1fc432e 100644 --- a/test/core/end2end/fixtures/h2_tls_common.h +++ b/test/core/end2end/fixtures/h2_tls_common.h @@ -24,6 +24,7 @@ #include +#include "absl/log/check.h" #include "absl/strings/string_view.h" #include @@ -63,7 +64,7 @@ inline void process_auth_failure(void* state, grpc_auth_context* /*ctx*/, size_t /*md_count*/, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == nullptr); + CHECK_EQ(state, nullptr); cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc index 85b97b90cbc..43c4dc87f8c 100644 --- a/test/core/end2end/fixtures/http_proxy_fixture.cc +++ b/test/core/end2end/fixtures/http_proxy_fixture.cc @@ -26,6 +26,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/escaping.h" @@ -575,7 +576,7 @@ static void on_read_request_done_locked(void* arg, grpc_error_handle error) { proxy_connection_failed(conn, SETUP_FAILED, "HTTP proxy DNS lookup", error); return; } - GPR_ASSERT(!addresses_or->empty()); + CHECK(!addresses_or->empty()); // Connect to requested address. // The connection callback inherits our reference to conn. const grpc_core::Timestamp deadline = @@ -679,7 +680,7 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create( nullptr, grpc_event_engine::experimental::ChannelArgsEndpointConfig(channel_args), on_accept, proxy, &proxy->server); - GPR_ASSERT(error.ok()); + CHECK_OK(error); // Bind to port. grpc_resolved_address resolved_addr; grpc_sockaddr_in* addr = @@ -690,8 +691,8 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create( grpc_sockaddr_set_port(&resolved_addr, proxy_port); int port; error = grpc_tcp_server_add_port(proxy->server, &resolved_addr, &port); - GPR_ASSERT(error.ok()); - GPR_ASSERT(port == proxy_port); + CHECK_OK(error); + CHECK(port == proxy_port); // Start server. auto* pollset = static_cast(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(pollset, &proxy->mu); diff --git a/test/core/end2end/fixtures/local_util.cc b/test/core/end2end/fixtures/local_util.cc index 2c4059b1973..12e05139a85 100644 --- a/test/core/end2end/fixtures/local_util.cc +++ b/test/core/end2end/fixtures/local_util.cc @@ -22,6 +22,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -32,7 +34,7 @@ static void process_auth_failure(void* state, grpc_auth_context* /*ctx*/, size_t /*md_count*/, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == nullptr); + CHECK_EQ(state, nullptr); cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } @@ -53,8 +55,7 @@ grpc_server* LocalTestFixture::MakeServer( grpc_server_credentials_set_auth_metadata_processor(server_creds, processor); } - GPR_ASSERT( - grpc_server_add_http2_port(server, localaddr_.c_str(), server_creds)); + CHECK(grpc_server_add_http2_port(server, localaddr_.c_str(), server_creds)); grpc_server_credentials_release(server_creds); pre_server_start(server); grpc_server_start(server); @@ -66,7 +67,7 @@ grpc_channel* LocalTestFixture::MakeClient(const grpc_core::ChannelArgs& args, grpc_channel_credentials* creds = grpc_local_credentials_create(type_); auto* client = grpc_channel_create(localaddr_.c_str(), creds, args.ToC().get()); - GPR_ASSERT(client != nullptr); + CHECK_NE(client, nullptr); grpc_channel_credentials_release(creds); return client; } diff --git a/test/core/end2end/fixtures/proxy.cc b/test/core/end2end/fixtures/proxy.cc index ddd96a2138f..94e56ef8e82 100644 --- a/test/core/end2end/fixtures/proxy.cc +++ b/test/core/end2end/fixtures/proxy.cc @@ -23,6 +23,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -193,7 +195,7 @@ static void on_p2s_recv_initial_metadata(void* arg, int /*success*/) { err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_sent_initial_metadata, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); } unrefpc(pc, "on_p2s_recv_initial_metadata"); @@ -220,7 +222,7 @@ static void on_p2s_sent_message(void* arg, int success) { refpc(pc, "on_c2p_recv_msg"); err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_recv_msg, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); } unrefpc(pc, "on_p2s_sent_message"); @@ -245,7 +247,7 @@ static void on_c2p_recv_msg(void* arg, int success) { refpc(pc, "on_p2s_sent_message"); err = grpc_call_start_batch( pc->p2s, &op, 1, new_closure(on_p2s_sent_message, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); } else { op.op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op.flags = 0; @@ -253,7 +255,7 @@ static void on_c2p_recv_msg(void* arg, int success) { refpc(pc, "on_p2s_sent_close"); err = grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_sent_close, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); } } else { if (pc->c2p_msg != nullptr) { @@ -280,7 +282,7 @@ static void on_c2p_sent_message(void* arg, int success) { refpc(pc, "on_p2s_recv_msg"); err = grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_recv_msg, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); } unrefpc(pc, "on_c2p_sent_message"); @@ -299,7 +301,7 @@ static void on_p2s_recv_msg(void* arg, int success) { refpc(pc, "on_c2p_sent_message"); err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_sent_message, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); } else { grpc_byte_buffer_destroy(pc->p2s_msg); } @@ -319,7 +321,7 @@ static void on_p2s_status(void* arg, int success) { memset(op, 0, sizeof(op)); if (!pc->proxy->shutdown) { - GPR_ASSERT(success); + CHECK(success); int op_count = 0; if (grpc_call_is_trailers_only(pc->p2s)) { @@ -341,7 +343,7 @@ static void on_p2s_status(void* arg, int success) { refpc(pc, "on_c2p_sent_status"); err = grpc_call_start_batch(pc->c2p, op, op_count, new_closure(on_c2p_sent_status, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); } unrefpc(pc, "on_p2s_status"); @@ -380,7 +382,7 @@ static void on_new_call(void* arg, int success) { err = grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_recv_initial_metadata, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); op.op = GRPC_OP_SEND_INITIAL_METADATA; op.flags = 0; @@ -390,7 +392,7 @@ static void on_new_call(void* arg, int success) { err = grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_sent_initial_metadata, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); op.op = GRPC_OP_RECV_MESSAGE; op.flags = 0; @@ -398,7 +400,7 @@ static void on_new_call(void* arg, int success) { refpc(pc, "on_c2p_recv_msg"); err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_recv_msg, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); op.op = GRPC_OP_RECV_MESSAGE; op.flags = 0; @@ -406,7 +408,7 @@ static void on_new_call(void* arg, int success) { refpc(pc, "on_p2s_recv_msg"); err = grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_recv_msg, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); op.op = GRPC_OP_RECV_STATUS_ON_CLIENT; op.flags = 0; @@ -417,7 +419,7 @@ static void on_new_call(void* arg, int success) { refpc(pc, "on_p2s_status"); err = grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_status, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); op.op = GRPC_OP_RECV_CLOSE_ON_SERVER; op.flags = 0; @@ -425,7 +427,7 @@ static void on_new_call(void* arg, int success) { refpc(pc, "on_c2p_closed"); err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_closed, pc), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); + CHECK_EQ(err, GRPC_CALL_OK); request_call(proxy); @@ -434,14 +436,14 @@ static void on_new_call(void* arg, int success) { unrefpc(pc, "init"); } else { - GPR_ASSERT(proxy->new_call == nullptr); + CHECK_EQ(proxy->new_call, nullptr); } } static void request_call(grpc_end2end_proxy* proxy) { proxy->new_call = nullptr; - GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( - proxy->server, &proxy->new_call, + CHECK(GRPC_CALL_OK == + grpc_server_request_call(proxy->server, &proxy->new_call, &proxy->new_call_details, &proxy->new_call_metadata, proxy->cq, proxy->cq, new_closure(on_new_call, proxy))); diff --git a/test/core/end2end/fixtures/secure_fixture.h b/test/core/end2end/fixtures/secure_fixture.h index 8a64b49fc75..480abfd8698 100644 --- a/test/core/end2end/fixtures/secure_fixture.h +++ b/test/core/end2end/fixtures/secure_fixture.h @@ -19,6 +19,7 @@ #include #include "absl/functional/any_invocable.h" +#include "absl/log/check.h" #include #include @@ -59,7 +60,7 @@ class SecureFixture : public grpc_core::CoreTestFixture { auto* creds = MakeServerCreds(args); auto* server = grpc_server_create(args.ToC().get(), nullptr); grpc_server_register_completion_queue(server, cq, nullptr); - GPR_ASSERT(grpc_server_add_http2_port(server, localaddr_.c_str(), creds)); + CHECK(grpc_server_add_http2_port(server, localaddr_.c_str(), creds)); grpc_server_credentials_release(creds); pre_server_start(server); grpc_server_start(server); @@ -71,7 +72,7 @@ class SecureFixture : public grpc_core::CoreTestFixture { auto* creds = MakeClientCreds(args); auto* client = grpc_channel_create(localaddr_.c_str(), creds, args.ToC().get()); - GPR_ASSERT(client != nullptr); + CHECK_NE(client, nullptr); grpc_channel_credentials_release(creds); return client; } diff --git a/test/core/end2end/fixtures/sockpair_fixture.h b/test/core/end2end/fixtures/sockpair_fixture.h index e8d7c30c4d8..0832f0def52 100644 --- a/test/core/end2end/fixtures/sockpair_fixture.h +++ b/test/core/end2end/fixtures/sockpair_fixture.h @@ -18,6 +18,7 @@ #include #include "absl/functional/any_invocable.h" +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "gtest/gtest.h" @@ -27,10 +28,10 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args_preconditioning.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/endpoint.h" @@ -121,7 +122,7 @@ class SockpairFixture : public CoreTestFixture { "lame channel"); transport->Orphan(); } - GPR_ASSERT(client); + CHECK(client); return client; } diff --git a/test/core/end2end/fuzzers/BUILD b/test/core/end2end/fuzzers/BUILD index 4ed7b7850ee..8364a52be5f 100644 --- a/test/core/end2end/fuzzers/BUILD +++ b/test/core/end2end/fuzzers/BUILD @@ -34,7 +34,10 @@ grpc_cc_library( name = "fuzzing_common", srcs = ["fuzzing_common.cc"], hdrs = ["fuzzing_common.h"], - external_deps = ["absl/strings"], + external_deps = [ + "absl/log:check", + "absl/strings", + ], deps = [ "api_fuzzer_proto", "//:gpr", @@ -47,6 +50,7 @@ grpc_proto_fuzzer( name = "api_fuzzer", srcs = ["api_fuzzer.cc"], corpus = "api_fuzzer_corpus", + external_deps = ["absl/log:check"], language = "C++", proto = None, tags = [ @@ -102,6 +106,7 @@ grpc_proto_fuzzer( name = "client_fuzzer", srcs = ["client_fuzzer.cc"], corpus = "client_fuzzer_corpus", + external_deps = ["absl/log:check"], language = "C++", proto = None, tags = ["no_windows"], @@ -125,6 +130,7 @@ grpc_cc_library( name = "server_fuzzer", srcs = ["server_fuzzer.cc"], hdrs = ["server_fuzzer.h"], + external_deps = ["absl/log:check"], deps = [ "fuzzer_input_proto", "fuzzing_common", @@ -161,6 +167,7 @@ grpc_proto_fuzzer( name = "server_fuzzer_chaotic_good", srcs = ["server_fuzzer_chaotic_good.cc"], corpus = "server_fuzzer_chaotic_good_corpus", + external_deps = ["absl/log:check"], language = "C++", proto = None, tags = [ diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index 213c13b427a..13ec4c012cf 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -27,6 +27,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_join.h" @@ -92,8 +93,7 @@ static void finish_resolve(addr_req r) { if (0 == strcmp(r.addr, "server")) { *r.addresses = std::make_unique(); grpc_resolved_address fake_resolved_address; - GPR_ASSERT( - grpc_parse_ipv4_hostport("1.2.3.4:5", &fake_resolved_address, false)); + CHECK(grpc_parse_ipv4_hostport("1.2.3.4:5", &fake_resolved_address, false)); (*r.addresses) ->emplace_back(fake_resolved_address, grpc_core::ChannelArgs()); grpc_core::ExecCtx::Run(DEBUG_LOCATION, r.on_done, absl::OkStatus()); @@ -231,7 +231,7 @@ grpc_ares_request* my_dns_lookup_ares( } static void my_cancel_ares_request(grpc_ares_request* request) { - GPR_ASSERT(request == nullptr); + CHECK_EQ(request, nullptr); } //////////////////////////////////////////////////////////////////////////////// @@ -404,13 +404,13 @@ ApiFuzzer::ApiFuzzer(const fuzzing_event_engine::Actions& actions) grpc_dns_lookup_hostname_ares = my_dns_lookup_ares; grpc_cancel_ares_request = my_cancel_ares_request; - GPR_ASSERT(channel_ == nullptr); - GPR_ASSERT(server_ == nullptr); + CHECK_EQ(channel_, nullptr); + CHECK_EQ(server_, nullptr); } ApiFuzzer::~ApiFuzzer() { - GPR_ASSERT(channel_ == nullptr); - GPR_ASSERT(server_ == nullptr); + CHECK_EQ(channel_, nullptr); + CHECK_EQ(server_, nullptr); } void ApiFuzzer::Tick() { @@ -458,7 +458,7 @@ ApiFuzzer::Result ApiFuzzer::CreateChannel( creds, args.ToC().get()); grpc_channel_credentials_release(creds); } - GPR_ASSERT(channel_ != nullptr); + CHECK_NE(channel_, nullptr); channel_force_delete_ = false; return Result::kComplete; } @@ -473,7 +473,7 @@ ApiFuzzer::Result ApiFuzzer::CreateServer( ChannelArgs args = testing::CreateChannelArgsFromFuzzingConfiguration( create_server.channel_args(), fuzzing_env); server_ = grpc_server_create(args.ToC().get(), nullptr); - GPR_ASSERT(server_ != nullptr); + CHECK_NE(server_, nullptr); grpc_server_register_completion_queue(server_, cq(), nullptr); for (const auto& http2_port : create_server.http2_ports()) { auto* creds = ReadServerCreds(http2_port.server_creds()); diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc index 788d8dc8c2d..346b48e203b 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/end2end/fuzzers/client_fuzzer.cc @@ -14,6 +14,7 @@ #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/types/optional.h" @@ -73,7 +74,7 @@ class ClientFuzzer final : public BasicFuzzer { ->c_ptr(); } - ~ClientFuzzer() { GPR_ASSERT(channel_ == nullptr); } + ~ClientFuzzer() { CHECK_EQ(channel_, nullptr); } private: Result CreateChannel(const api_fuzzer::CreateChannel&) override { diff --git a/test/core/end2end/fuzzers/fuzzing_common.cc b/test/core/end2end/fuzzers/fuzzing_common.cc index 0b0ea9ff96f..4a20a7870fe 100644 --- a/test/core/end2end/fuzzers/fuzzing_common.cc +++ b/test/core/end2end/fuzzers/fuzzing_common.cc @@ -23,6 +23,7 @@ #include #include +#include "absl/log/check.h" #include "absl/strings/str_cat.h" #include "absl/types/optional.h" @@ -58,7 +59,7 @@ int force_experiments = []() { namespace testing { static void free_non_null(void* p) { - GPR_ASSERT(p != nullptr); + CHECK_NE(p, nullptr); gpr_free(p); } @@ -92,7 +93,7 @@ class Call : public std::enable_shared_from_this { } void SetCall(grpc_call* call) { - GPR_ASSERT(call_ == nullptr); + CHECK_EQ(call_, nullptr); call_ = call; } @@ -273,10 +274,10 @@ class Call : public std::enable_shared_from_this { ++pending_ops_; auto self = shared_from_this(); return MakeValidator([self](bool success) { - GPR_ASSERT(self->pending_ops_ > 0); + CHECK_GT(self->pending_ops_, 0); --self->pending_ops_; if (success) { - GPR_ASSERT(self->call_ != nullptr); + CHECK_NE(self->call_, nullptr); self->type_ = CallType::SERVER; } else { self->type_ = CallType::TOMBSTONED; @@ -335,7 +336,7 @@ Validator* ValidateConnectivityWatch(gpr_timespec deadline, int* counter) { return MakeValidator([deadline, counter](bool success) { if (!success) { auto now = gpr_now(deadline.clock_type); - GPR_ASSERT(gpr_time_cmp(now, deadline) >= 0); + CHECK_GE(gpr_time_cmp(now, deadline), 0); } --*counter; }); @@ -368,13 +369,13 @@ BasicFuzzer::BasicFuzzer(const fuzzing_event_engine::Actions& actions) } BasicFuzzer::~BasicFuzzer() { - GPR_ASSERT(ActiveCall() == nullptr); - GPR_ASSERT(calls_.empty()); + CHECK_EQ(ActiveCall(), nullptr); + CHECK(calls_.empty()); engine_->TickUntilIdle(); grpc_completion_queue_shutdown(cq_); - GPR_ASSERT(PollCq() == Result::kComplete); + CHECK(PollCq() == Result::kComplete); grpc_completion_queue_destroy(cq_); grpc_shutdown_blocking(); @@ -735,7 +736,7 @@ void BasicFuzzer::TryShutdown() { ShutdownCalls(); grpc_timer_manager_tick(); - GPR_ASSERT(PollCq() == Result::kPending); + CHECK(PollCq() == Result::kPending); } void BasicFuzzer::Run(absl::Span actions) { diff --git a/test/core/end2end/fuzzers/fuzzing_common.h b/test/core/end2end/fuzzers/fuzzing_common.h index abf07cd1db4..bfeb776c35e 100644 --- a/test/core/end2end/fuzzers/fuzzing_common.h +++ b/test/core/end2end/fuzzers/fuzzing_common.h @@ -28,6 +28,7 @@ #include #include +#include "absl/log/check.h" #include "absl/types/span.h" #include @@ -63,7 +64,7 @@ inline Validator* MakeValidator(std::function impl) { inline Validator* AssertSuccessAndDecrement(int* counter) { return MakeValidator([counter](bool success) { - GPR_ASSERT(success); + CHECK(success); --*counter; }); } @@ -99,7 +100,7 @@ class BasicFuzzer { void ShutdownCalls(); void ResetServerState() { server_shutdown_ = false; - GPR_ASSERT(pending_server_shutdowns_ == 0); + CHECK_EQ(pending_server_shutdowns_, 0); } // Poll any created completion queue to drive the RPC forward. diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc index ed46cb40062..cc57368ee6f 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.cc +++ b/test/core/end2end/fuzzers/server_fuzzer.cc @@ -14,6 +14,7 @@ #include +#include "absl/log/check.h" #include "absl/types/optional.h" #include @@ -66,7 +67,7 @@ class ServerFuzzer final : public BasicFuzzer { } } - ~ServerFuzzer() { GPR_ASSERT(server_ == nullptr); } + ~ServerFuzzer() { CHECK_EQ(server_, nullptr); } private: Result CreateChannel( @@ -103,7 +104,7 @@ void RunServerFuzzer( ForceEnableExperiment("event_engine_listener", true); return 42; }(); - GPR_ASSERT(once == 42); // avoid unused variable warning + CHECK_EQ(once, 42); // avoid unused variable warning ApplyFuzzConfigVars(msg.config_vars()); TestOnlyReloadExperimentsFromConfigVariables(); testing::ServerFuzzer(msg, server_setup).Run(msg.api_actions()); diff --git a/test/core/end2end/fuzzers/server_fuzzer_chaotic_good.cc b/test/core/end2end/fuzzers/server_fuzzer_chaotic_good.cc index c34dc27d2c9..6d688e655a2 100644 --- a/test/core/end2end/fuzzers/server_fuzzer_chaotic_good.cc +++ b/test/core/end2end/fuzzers/server_fuzzer_chaotic_good.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "absl/log/check.h" + #include #include "src/core/ext/transport/chaotic_good/server/chaotic_good_server.h" @@ -33,8 +35,8 @@ DEFINE_PROTO_FUZZER(const fuzzer_input::Msg& msg) { grpc_event_engine::experimental::URIToResolvedAddress( absl::StrCat("ipv4:0.0.0.0:", port_num)) .value()); - GPR_ASSERT(port.ok()); - GPR_ASSERT(port.value() == port_num); + CHECK_OK(port); + CHECK_EQ(port.value(), port_num); grpc_core::Server::FromC(server)->AddListener( grpc_core::OrphanablePtr< grpc_core::chaotic_good::ChaoticGoodServerListener>(listener)); diff --git a/test/core/end2end/goaway_server_test.cc b/test/core/end2end/goaway_server_test.cc index c8e958edc30..bc2ecbae3b5 100644 --- a/test/core/end2end/goaway_server_test.cc +++ b/test/core/end2end/goaway_server_test.cc @@ -26,6 +26,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" @@ -293,9 +294,9 @@ int main(int argc, char** argv) { op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call1, ops, (size_t)(op - ops), - grpc_core::CqVerifier::tag(0x101), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(call1, ops, (size_t)(op - ops), + grpc_core::CqVerifier::tag(0x101), nullptr)); // and receive status to probe termination memset(ops, 0, sizeof(ops)); op = ops; @@ -306,9 +307,9 @@ int main(int argc, char** argv) { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call1, ops, (size_t)(op - ops), - grpc_core::CqVerifier::tag(0x102), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(call1, ops, (size_t)(op - ops), + grpc_core::CqVerifier::tag(0x102), nullptr)); // bring a server up on the first port grpc_server* server1 = grpc_server_create(nullptr, nullptr); @@ -322,10 +323,10 @@ int main(int argc, char** argv) { // request a call to the server grpc_call* server_call1; - GPR_ASSERT(GRPC_CALL_OK == - grpc_server_request_call(server1, &server_call1, &request_details1, - &request_metadata1, cq, cq, - grpc_core::CqVerifier::tag(0x301))); + CHECK_EQ(GRPC_CALL_OK, + grpc_server_request_call(server1, &server_call1, &request_details1, + &request_metadata1, cq, cq, + grpc_core::CqVerifier::tag(0x301))); set_resolve_port(port1); @@ -334,8 +335,7 @@ int main(int argc, char** argv) { cqv.Expect(grpc_core::CqVerifier::tag(0x301), true); cqv.Verify(); - GPR_ASSERT(GRPC_CHANNEL_READY == - grpc_channel_check_connectivity_state(chan, 0)); + CHECK(GRPC_CHANNEL_READY == grpc_channel_check_connectivity_state(chan, 0)); grpc_channel_watch_connectivity_state(chan, GRPC_CHANNEL_READY, gpr_inf_future(GPR_CLOCK_REALTIME), cq, grpc_core::CqVerifier::tag(0x9999)); @@ -347,9 +347,9 @@ int main(int argc, char** argv) { op->data.recv_close_on_server.cancelled = &was_cancelled1; op->flags = 0; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(server_call1, ops, (size_t)(op - ops), - grpc_core::CqVerifier::tag(0x302), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(server_call1, ops, (size_t)(op - ops), + grpc_core::CqVerifier::tag(0x302), nullptr)); // shutdown first server: // we should see a connectivity change and then nothing @@ -373,9 +373,9 @@ int main(int argc, char** argv) { op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call2, ops, (size_t)(op - ops), - grpc_core::CqVerifier::tag(0x201), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(call2, ops, (size_t)(op - ops), + grpc_core::CqVerifier::tag(0x201), nullptr)); // and receive status to probe termination memset(ops, 0, sizeof(ops)); op = ops; @@ -386,9 +386,9 @@ int main(int argc, char** argv) { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call2, ops, (size_t)(op - ops), - grpc_core::CqVerifier::tag(0x202), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(call2, ops, (size_t)(op - ops), + grpc_core::CqVerifier::tag(0x202), nullptr)); // and bring up second server set_resolve_port(port2); @@ -403,10 +403,10 @@ int main(int argc, char** argv) { // request a call to the server grpc_call* server_call2; - GPR_ASSERT(GRPC_CALL_OK == - grpc_server_request_call(server2, &server_call2, &request_details2, - &request_metadata2, cq, cq, - grpc_core::CqVerifier::tag(0x401))); + CHECK_EQ(GRPC_CALL_OK, + grpc_server_request_call(server2, &server_call2, &request_details2, + &request_metadata2, cq, cq, + grpc_core::CqVerifier::tag(0x401))); // second call should now start cqv.Expect(grpc_core::CqVerifier::tag(0x201), true); @@ -420,9 +420,9 @@ int main(int argc, char** argv) { op->data.recv_close_on_server.cancelled = &was_cancelled2; op->flags = 0; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(server_call2, ops, (size_t)(op - ops), - grpc_core::CqVerifier::tag(0x402), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(server_call2, ops, (size_t)(op - ops), + grpc_core::CqVerifier::tag(0x402), nullptr)); // shutdown second server: we should see nothing grpc_server_shutdown_and_notify(server2, cq, diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc index d1d94e5ac3a..563b696b98f 100644 --- a/test/core/end2end/h2_ssl_cert_test.cc +++ b/test/core/end2end/h2_ssl_cert_test.cc @@ -24,6 +24,7 @@ #include #include "absl/functional/any_invocable.h" +#include "absl/log/check.h" #include "absl/types/optional.h" #include "gtest/gtest.h" @@ -58,7 +59,7 @@ static void process_auth_failure(void* state, grpc_auth_context* /*ctx*/, size_t /*md_count*/, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == nullptr); + CHECK_EQ(state, nullptr); cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } @@ -213,7 +214,7 @@ static void simple_request_body(grpc_core::CoreTestFixture* f, c = grpc_channel_create_call(client, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/foo"), &host, deadline, nullptr); - GPR_ASSERT(c); + CHECK(c); memset(ops, 0, sizeof(ops)); op = ops; @@ -224,7 +225,7 @@ static void simple_request_body(grpc_core::CoreTestFixture* f, op++; error = grpc_call_start_batch(c, ops, static_cast(op - ops), grpc_core::CqVerifier::tag(1), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); cqv.Expect(grpc_core::CqVerifier::tag(1), expected_result == SUCCESS); cqv.Verify(); @@ -236,9 +237,9 @@ static void simple_request_body(grpc_core::CoreTestFixture* f, cqv.Verify(); grpc_server_destroy(server); grpc_completion_queue_shutdown(cq); - GPR_ASSERT(grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), - nullptr) - .type == GRPC_QUEUE_SHUTDOWN); + CHECK(grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), + nullptr) + .type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cq); } @@ -278,9 +279,9 @@ int main(int argc, char** argv) { // Set the SSL roots env var. roots_file = gpr_tmpfile("chttp2_simple_ssl_cert_fullstack_test", &roots_filename); - GPR_ASSERT(roots_filename != nullptr); - GPR_ASSERT(roots_file != nullptr); - GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size); + CHECK_NE(roots_filename, nullptr); + CHECK_NE(roots_file, nullptr); + CHECK(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size); fclose(roots_file); grpc_core::ConfigVars::Overrides config_overrides; config_overrides.default_ssl_roots_file_path = roots_filename; diff --git a/test/core/end2end/h2_ssl_session_reuse_test.cc b/test/core/end2end/h2_ssl_session_reuse_test.cc index 55243de78ed..435cd564f3d 100644 --- a/test/core/end2end/h2_ssl_session_reuse_test.cc +++ b/test/core/end2end/h2_ssl_session_reuse_test.cc @@ -22,6 +22,7 @@ #include +#include "absl/log/check.h" #include "absl/types/optional.h" #include @@ -71,7 +72,7 @@ grpc_server* server_create(grpc_completion_queue* cq, const char* server_addr) { grpc_server* server = grpc_server_create(nullptr, nullptr); grpc_server_register_completion_queue(server, cq, nullptr); - GPR_ASSERT(grpc_server_add_http2_port(server, server_addr, server_creds)); + CHECK(grpc_server_add_http2_port(server, server_addr, server_creds)); grpc_server_credentials_release(server_creds); grpc_server_start(server); return server; @@ -100,7 +101,7 @@ grpc_channel* client_create(const char* server_addr, grpc_channel* client = grpc_channel_create(server_addr, client_creds, client_args); - GPR_ASSERT(client != nullptr); + CHECK_NE(client, nullptr); grpc_channel_credentials_release(client_creds); { @@ -132,7 +133,7 @@ void do_round_trip(grpc_completion_queue* cq, grpc_server* server, grpc_call* c = grpc_channel_create_call( client, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/foo"), nullptr, deadline, nullptr); - GPR_ASSERT(c); + CHECK(c); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); @@ -164,13 +165,13 @@ void do_round_trip(grpc_completion_queue* cq, grpc_server* server, op++; error = grpc_call_start_batch(c, ops, static_cast(op - ops), grpc_core::CqVerifier::tag(1), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); grpc_call* s; error = grpc_server_request_call(server, &s, &call_details, &request_metadata_recv, cq, cq, grpc_core::CqVerifier::tag(101)); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); cqv.Expect(grpc_core::CqVerifier::tag(101), true); cqv.Verify(); @@ -178,11 +179,11 @@ void do_round_trip(grpc_completion_queue* cq, grpc_server* server, grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name( auth, GRPC_SSL_SESSION_REUSED_PROPERTY); const grpc_auth_property* property = grpc_auth_property_iterator_next(&it); - GPR_ASSERT(property != nullptr); + CHECK_NE(property, nullptr); if (expect_session_reuse) { - GPR_ASSERT(strcmp(property->value, "true") == 0); + CHECK_EQ(strcmp(property->value, "true"), 0); } else { - GPR_ASSERT(strcmp(property->value, "false") == 0); + CHECK_EQ(strcmp(property->value, "false"), 0); } grpc_auth_context_release(auth); @@ -206,7 +207,7 @@ void do_round_trip(grpc_completion_queue* cq, grpc_server* server, op++; error = grpc_call_start_batch(s, ops, static_cast(op - ops), grpc_core::CqVerifier::tag(103), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); cqv.Expect(grpc_core::CqVerifier::tag(103), true); cqv.Expect(grpc_core::CqVerifier::tag(1), true); @@ -246,9 +247,9 @@ TEST(H2SessionReuseTest, SingleReuse) { grpc_ssl_session_cache_destroy(cache); - GPR_ASSERT(grpc_completion_queue_next( - cq, grpc_timeout_milliseconds_to_deadline(100), nullptr) - .type == GRPC_QUEUE_TIMEOUT); + CHECK(grpc_completion_queue_next( + cq, grpc_timeout_milliseconds_to_deadline(100), nullptr) + .type == GRPC_QUEUE_TIMEOUT); grpc_server_shutdown_and_notify(server, cq, grpc_core::CqVerifier::tag(1000)); grpc_event ev; diff --git a/test/core/end2end/h2_tls_peer_property_external_verifier_test.cc b/test/core/end2end/h2_tls_peer_property_external_verifier_test.cc index 958ae061e67..45a411781ac 100644 --- a/test/core/end2end/h2_tls_peer_property_external_verifier_test.cc +++ b/test/core/end2end/h2_tls_peer_property_external_verifier_test.cc @@ -22,6 +22,7 @@ #include +#include "absl/log/check.h" #include "absl/types/optional.h" #include @@ -95,7 +96,7 @@ grpc_server* server_create(grpc_completion_queue* cq, const char* server_addr, grpc_server* server = grpc_server_create(nullptr, nullptr); grpc_server_register_completion_queue(server, cq, nullptr); - GPR_ASSERT(grpc_server_add_http2_port(server, server_addr, creds)); + CHECK(grpc_server_add_http2_port(server, server_addr, creds)); grpc_server_credentials_release(creds); grpc_server_start(server); @@ -144,7 +145,7 @@ grpc_channel* client_create(const char* server_addr, grpc_channel_args_copy_and_add(nullptr, args, GPR_ARRAY_SIZE(args)); grpc_channel* client = grpc_channel_create(server_addr, creds, client_args); - GPR_ASSERT(client != nullptr); + CHECK_NE(client, nullptr); grpc_channel_credentials_release(creds); { @@ -177,7 +178,7 @@ void do_round_trip(grpc_completion_queue* cq, grpc_server* server, grpc_call* c = grpc_channel_create_call( client, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/foo"), nullptr, deadline, nullptr); - GPR_ASSERT(c); + CHECK(c); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); @@ -209,12 +210,12 @@ void do_round_trip(grpc_completion_queue* cq, grpc_server* server, op++; error = grpc_call_start_batch(c, ops, static_cast(op - ops), tag(1), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); grpc_call* s; error = grpc_server_request_call(server, &s, &call_details, &request_metadata_recv, cq, cq, tag(101)); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); cqv.Expect(tag(101), true); cqv.Verify(); @@ -238,7 +239,7 @@ void do_round_trip(grpc_completion_queue* cq, grpc_server* server, op++; error = grpc_call_start_batch(s, ops, static_cast(op - ops), tag(103), nullptr); - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); cqv.Expect(tag(103), true); cqv.Expect(tag(1), true); @@ -278,9 +279,9 @@ TEST(H2TlsPeerPropertyExternalVerifier, PeerPropertyExternalVerifierTest) { do_round_trip(cq, server, server_addr.c_str()); - GPR_ASSERT(grpc_completion_queue_next( - cq, grpc_timeout_milliseconds_to_deadline(100), nullptr) - .type == GRPC_QUEUE_TIMEOUT); + CHECK(grpc_completion_queue_next( + cq, grpc_timeout_milliseconds_to_deadline(100), nullptr) + .type == GRPC_QUEUE_TIMEOUT); grpc_server_shutdown_and_notify(server, cq, tag(1000)); grpc_event ev; diff --git a/test/core/end2end/invalid_call_argument_test.cc b/test/core/end2end/invalid_call_argument_test.cc index deeefe165a0..7b0ff0685f2 100644 --- a/test/core/end2end/invalid_call_argument_test.cc +++ b/test/core/end2end/invalid_call_argument_test.cc @@ -23,6 +23,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -108,15 +110,15 @@ static void prepare_test(int is_client) { op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); - GPR_ASSERT(GRPC_CALL_OK == - grpc_server_request_call( - g_state.server, &g_state.server_call, &g_state.call_details, - &g_state.server_initial_metadata_recv, g_state.cq, - g_state.cq, grpc_core::CqVerifier::tag(101))); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_server_request_call( + g_state.server, &g_state.server_call, &g_state.call_details, + &g_state.server_initial_metadata_recv, g_state.cq, g_state.cq, + grpc_core::CqVerifier::tag(101))); g_state.cqv->Expect(grpc_core::CqVerifier::tag(101), true); g_state.cqv->Expect(grpc_core::CqVerifier::tag(1), true); g_state.cqv->Verify(); @@ -156,9 +158,9 @@ static void test_non_null_reserved_on_start_batch() { gpr_log(GPR_INFO, "test_non_null_reserved_on_start_batch"); prepare_test(1); - GPR_ASSERT(GRPC_CALL_ERROR == - grpc_call_start_batch(g_state.call, nullptr, 0, nullptr, - grpc_core::CqVerifier::tag(1))); + CHECK(GRPC_CALL_ERROR == + grpc_call_start_batch(g_state.call, nullptr, 0, nullptr, + grpc_core::CqVerifier::tag(1))); cleanup_test(); } @@ -174,10 +176,10 @@ static void test_non_null_reserved_on_op() { op->flags = 0; op->reserved = grpc_core::CqVerifier::tag(2); op++; - GPR_ASSERT(GRPC_CALL_ERROR == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR == grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), + nullptr)); cleanup_test(); } @@ -193,10 +195,10 @@ static void test_send_initial_metadata_more_than_once() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); g_state.cqv->Expect(grpc_core::CqVerifier::tag(1), false); g_state.cqv->Verify(); @@ -206,10 +208,10 @@ static void test_send_initial_metadata_more_than_once() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); cleanup_test(); } @@ -225,10 +227,10 @@ static void test_too_many_metadata() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_INVALID_METADATA == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); cleanup_test(); } @@ -249,10 +251,10 @@ static void test_send_null_message() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_INVALID_MESSAGE == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_INVALID_MESSAGE == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); cleanup_test(); } @@ -282,10 +284,10 @@ static void test_send_messages_at_the_same_time() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); grpc_byte_buffer_destroy(request_payload); cleanup_test(); } @@ -305,10 +307,10 @@ static void test_send_server_status_from_client() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_CLIENT == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_NOT_ON_CLIENT == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); cleanup_test(); } @@ -324,10 +326,10 @@ static void test_receive_initial_metadata_twice_at_client() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); g_state.cqv->Expect(grpc_core::CqVerifier::tag(1), false); g_state.cqv->Verify(); op = g_state.ops; @@ -337,10 +339,10 @@ static void test_receive_initial_metadata_twice_at_client() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); cleanup_test(); } @@ -356,10 +358,10 @@ static void test_receive_message_with_invalid_flags() { op->flags = 1; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_INVALID_FLAGS == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); cleanup_test(); } @@ -380,10 +382,10 @@ static void test_receive_two_messages_at_the_same_time() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); cleanup_test(); } @@ -399,10 +401,10 @@ static void test_recv_close_on_server_from_client() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_CLIENT == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_NOT_ON_CLIENT == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); cleanup_test(); } @@ -421,10 +423,10 @@ static void test_recv_status_on_client_twice() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); g_state.cqv->Expect(grpc_core::CqVerifier::tag(1), true); g_state.cqv->Verify(); @@ -436,10 +438,10 @@ static void test_recv_status_on_client_twice() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); cleanup_test(); } @@ -454,10 +456,10 @@ static void test_send_close_from_client_on_server() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_SERVER == - grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(2), nullptr)); + CHECK(GRPC_CALL_ERROR_NOT_ON_SERVER == + grpc_call_start_batch(g_state.server_call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(2), nullptr)); cleanup_test(); } @@ -476,10 +478,10 @@ static void test_recv_status_on_client_from_server() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_SERVER == - grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(2), nullptr)); + CHECK(GRPC_CALL_ERROR_NOT_ON_SERVER == + grpc_call_start_batch(g_state.server_call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(2), nullptr)); cleanup_test(); } @@ -498,10 +500,10 @@ static void test_send_status_from_server_with_invalid_flags() { op->flags = 1; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS == - grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(2), nullptr)); + CHECK(GRPC_CALL_ERROR_INVALID_FLAGS == + grpc_call_start_batch(g_state.server_call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(2), nullptr)); cleanup_test(); } @@ -521,10 +523,10 @@ static void test_too_many_trailing_metadata() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA == - grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(2), nullptr)); + CHECK(GRPC_CALL_ERROR_INVALID_METADATA == + grpc_call_start_batch(g_state.server_call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(2), nullptr)); cleanup_test(); } @@ -550,10 +552,10 @@ static void test_send_server_status_twice() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == - grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(2), nullptr)); + CHECK(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == + grpc_call_start_batch(g_state.server_call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(2), nullptr)); cleanup_test(); } @@ -569,10 +571,10 @@ static void test_recv_close_on_server_with_invalid_flags() { op->flags = 1; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS == - grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(2), nullptr)); + CHECK(GRPC_CALL_ERROR_INVALID_FLAGS == + grpc_call_start_batch(g_state.server_call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(2), nullptr)); cleanup_test(); } @@ -593,10 +595,10 @@ static void test_recv_close_on_server_twice() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == - grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(2), nullptr)); + CHECK(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == + grpc_call_start_batch(g_state.server_call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(2), nullptr)); cleanup_test(); } @@ -616,10 +618,10 @@ static void test_invalid_initial_metadata_reserved_key() { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_INVALID_METADATA == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); cleanup_test(); } @@ -639,10 +641,10 @@ static void test_multiple_ops_in_a_single_batch() { op++; op->op = which; op++; - GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == - grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), + grpc_core::CqVerifier::tag(1), nullptr)); } cleanup_test(); diff --git a/test/core/end2end/no_server_test.cc b/test/core/end2end/no_server_test.cc index c6357f911cd..71e85f8b21d 100644 --- a/test/core/end2end/no_server_test.cc +++ b/test/core/end2end/no_server_test.cc @@ -20,6 +20,7 @@ #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/time/time.h" @@ -85,9 +86,9 @@ void run_test(bool wait_for_ready) { op->flags = 0; op->reserved = nullptr; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call, ops, (size_t)(op - ops), - grpc_core::CqVerifier::tag(1), nullptr)); + CHECK_EQ(GRPC_CALL_OK, + grpc_call_start_batch(call, ops, (size_t)(op - ops), + grpc_core::CqVerifier::tag(1), nullptr)); { response_generator->WaitForResolverSet( @@ -105,9 +106,9 @@ void run_test(bool wait_for_ready) { gpr_log(GPR_INFO, "call status: %d", status); if (wait_for_ready) { - GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); + CHECK_EQ(status, GRPC_STATUS_DEADLINE_EXCEEDED); } else { - GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); + CHECK_EQ(status, GRPC_STATUS_UNAVAILABLE); } grpc_slice_unref(details); diff --git a/test/core/end2end/tests/channelz.cc b/test/core/end2end/tests/channelz.cc index a70b2c244d8..7836b291243 100644 --- a/test/core/end2end/tests/channelz.cc +++ b/test/core/end2end/tests/channelz.cc @@ -16,7 +16,7 @@ // // -#include "src/core/lib/channel/channelz.h" +#include "src/core/channelz/channelz.h" #include diff --git a/test/core/end2end/tests/filter_context.cc b/test/core/end2end/tests/filter_context.cc index 5fcfa300fac..b3e2759ef1f 100644 --- a/test/core/end2end/tests/filter_context.cc +++ b/test/core/end2end/tests/filter_context.cc @@ -19,6 +19,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "gtest/gtest.h" @@ -65,7 +66,7 @@ void start_transport_stream_op_batch(grpc_call_element* elem, gpr_log(GPR_INFO, "start_transport_stream_op_batch(): context=%p", batch->payload->context); if (batch->payload->context != nullptr) { - GPR_ASSERT(calld->context == batch->payload->context); + CHECK(calld->context == batch->payload->context); } grpc_call_next_op(elem, batch); } diff --git a/test/core/end2end/tests/grpc_authz.cc b/test/core/end2end/tests/grpc_authz.cc index 6421b24f7a6..d0770bd72fb 100644 --- a/test/core/end2end/tests/grpc_authz.cc +++ b/test/core/end2end/tests/grpc_authz.cc @@ -14,6 +14,7 @@ #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "gtest/gtest.h" @@ -100,7 +101,7 @@ class InitWithTempFile { provider_ = grpc_authorization_policy_provider_file_watcher_create( tmp_file_.name().c_str(), /*refresh_interval_sec=*/1, &code, &error_details); - GPR_ASSERT(GRPC_STATUS_OK == code); + CHECK_EQ(code, GRPC_STATUS_OK); InitWithPolicy(test, provider_); } diff --git a/test/core/end2end/tests/retry_lb_drop.cc b/test/core/end2end/tests/retry_lb_drop.cc index 8ebe2eac5ce..c8289009f53 100644 --- a/test/core/end2end/tests/retry_lb_drop.cc +++ b/test/core/end2end/tests/retry_lb_drop.cc @@ -19,6 +19,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" @@ -106,7 +107,7 @@ CORE_END2END_TEST(RetryTest, RetryLbDrop) { RegisterTestPickArgsLoadBalancingPolicy( builder, [](const PickArgsSeen& pick_args) { - GPR_ASSERT(g_pick_args_vector != nullptr); + CHECK_NE(g_pick_args_vector, nullptr); g_pick_args_vector->push_back(pick_args); }, kDropPolicyName); diff --git a/test/core/end2end/tests/retry_streaming.cc b/test/core/end2end/tests/retry_streaming.cc index d21dd512444..ab06d00a862 100644 --- a/test/core/end2end/tests/retry_streaming.cc +++ b/test/core/end2end/tests/retry_streaming.cc @@ -25,8 +25,8 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/surface/channel.h" #include "test/core/end2end/end2end_tests.h" diff --git a/test/core/end2end/tests/server_streaming.cc b/test/core/end2end/tests/server_streaming.cc index 76e61ac1cd6..76cd2ae7382 100644 --- a/test/core/end2end/tests/server_streaming.cc +++ b/test/core/end2end/tests/server_streaming.cc @@ -18,6 +18,7 @@ #include +#include "absl/log/check.h" #include "gtest/gtest.h" #include @@ -86,7 +87,7 @@ void ServerStreaming(CoreEnd2endTest& test, int num_messages) { EXPECT_EQ(server_message.payload(), "hello world"); num_messages_received++; } - GPR_ASSERT(num_messages_received == num_messages); + CHECK_EQ(num_messages_received, num_messages); if (!seen_status) { test.Expect(1, true); test.Step(); diff --git a/test/core/handshake/BUILD b/test/core/handshake/BUILD index 749afb50ab3..ded4fbd4a48 100644 --- a/test/core/handshake/BUILD +++ b/test/core/handshake/BUILD @@ -105,3 +105,18 @@ grpc_cc_test( # "//test/core/util:grpc_test_util", # ], #) + +grpc_cc_test( + name = "http_proxy_mapper_test", + srcs = ["http_proxy_mapper_test.cc"], + external_deps = ["gtest"], + language = "C++", + uses_polling = False, + deps = [ + "//:gpr", + "//:grpc", + "//src/core:channel_args", + "//test/core/util:grpc_test_util", + "//test/core/util:scoped_env_var", + ], +) diff --git a/test/core/client_channel/http_proxy_mapper_test.cc b/test/core/handshake/http_proxy_mapper_test.cc similarity index 100% rename from test/core/client_channel/http_proxy_mapper_test.cc rename to test/core/handshake/http_proxy_mapper_test.cc diff --git a/test/core/iomgr/BUILD b/test/core/iomgr/BUILD index 8fdb9658373..57837c479ea 100644 --- a/test/core/iomgr/BUILD +++ b/test/core/iomgr/BUILD @@ -26,6 +26,7 @@ grpc_cc_library( name = "endpoint_tests", srcs = ["endpoint_tests.cc"], hdrs = ["endpoint_tests.h"], + external_deps = ["absl/log:check"], language = "C++", visibility = [ "//test:__subpackages__", @@ -59,7 +60,10 @@ grpc_cc_test( grpc_cc_test( name = "endpoint_pair_test", srcs = ["endpoint_pair_test.cc"], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], language = "C++", tags = [ "endpoint_test", @@ -95,6 +99,7 @@ grpc_cc_test( grpc_cc_test( name = "fd_conservation_posix_test", srcs = ["fd_conservation_posix_test.cc"], + external_deps = ["absl/log:check"], language = "C++", tags = ["no_windows"], deps = [ @@ -180,6 +185,7 @@ grpc_cc_test( name = "resolve_address_using_ares_resolver_test", srcs = ["resolve_address_test.cc"], external_deps = [ + "absl/log:check", "absl/strings", "gtest", ], @@ -198,6 +204,7 @@ grpc_cc_test( name = "resolve_address_using_native_resolver_test", srcs = ["resolve_address_test.cc"], external_deps = [ + "absl/log:check", "absl/strings", "gtest", ], @@ -215,7 +222,10 @@ grpc_cc_test( grpc_cc_test( name = "socket_utils_test", srcs = ["socket_utils_test.cc"], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], language = "C++", tags = ["no_windows"], deps = [ @@ -270,7 +280,10 @@ grpc_cc_test( grpc_cc_test( name = "buffer_list_test", srcs = ["buffer_list_test.cc"], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], language = "C++", deps = [ "//:gpr", diff --git a/test/core/iomgr/buffer_list_test.cc b/test/core/iomgr/buffer_list_test.cc index df46aba58d5..4afd6d591f7 100644 --- a/test/core/iomgr/buffer_list_test.cc +++ b/test/core/iomgr/buffer_list_test.cc @@ -20,6 +20,8 @@ #include +#include "absl/log/check.h" + #include #include @@ -37,7 +39,7 @@ extern gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type); static gpr_timespec g_now; gpr_timespec now_impl(gpr_clock_type clock_type) { - GPR_ASSERT(clock_type != GPR_TIMESPAN); + CHECK(clock_type != GPR_TIMESPAN); gpr_timespec ts = g_now; ts.clock_type = clock_type; return ts; diff --git a/test/core/iomgr/endpoint_pair_test.cc b/test/core/iomgr/endpoint_pair_test.cc index 287b8d3db0b..1e630519856 100644 --- a/test/core/iomgr/endpoint_pair_test.cc +++ b/test/core/iomgr/endpoint_pair_test.cc @@ -22,6 +22,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -58,7 +60,7 @@ grpc_endpoint_pair grpc_iomgr_event_engine_shim_endpoint_pair( std::string target_addr = absl::StrCat( "ipv6:[::1]:", std::to_string(grpc_pick_unused_port_or_die())); auto resolved_addr = URIToResolvedAddress(target_addr); - GPR_ASSERT(resolved_addr.ok()); + CHECK_OK(resolved_addr); std::unique_ptr client_endpoint; std::unique_ptr server_endpoint; grpc_core::Notification client_signal; @@ -80,13 +82,13 @@ grpc_endpoint_pair grpc_iomgr_event_engine_shim_endpoint_pair( std::move(accept_cb), [](absl::Status /*status*/) {}, config, std::make_unique("foo")); - GPR_ASSERT(listener->Bind(*resolved_addr).ok()); - GPR_ASSERT(listener->Start().ok()); + CHECK_OK(listener->Bind(*resolved_addr)); + CHECK_OK(listener->Start()); ee->Connect( [&client_endpoint, &client_signal]( absl::StatusOr> endpoint) { - GPR_ASSERT(endpoint.ok()); + CHECK_OK(endpoint); client_endpoint = std::move(*endpoint); client_signal.Notify(); }, diff --git a/test/core/iomgr/endpoint_tests.cc b/test/core/iomgr/endpoint_tests.cc index 1ff46da9765..02cd7b020aa 100644 --- a/test/core/iomgr/endpoint_tests.cc +++ b/test/core/iomgr/endpoint_tests.cc @@ -22,6 +22,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -61,7 +63,7 @@ size_t count_slices(grpc_slice* slices, size_t nslices, int* current_data) { for (i = 0; i < nslices; ++i) { buf = GRPC_SLICE_START_PTR(slices[i]); for (j = 0; j < GRPC_SLICE_LENGTH(slices[i]); ++j) { - GPR_ASSERT(buf[j] == *current_data); + CHECK(buf[j] == *current_data); *current_data = (*current_data + 1) % 256; } num_bytes += GRPC_SLICE_LENGTH(slices[i]); @@ -99,7 +101,7 @@ static grpc_slice* allocate_blocks(size_t num_bytes, size_t slice_size, (*current_data)++; } } - GPR_ASSERT(num_bytes_left == 0); + CHECK_EQ(num_bytes_left, 0u); return slices; } @@ -273,9 +275,9 @@ static void read_and_write_test(grpc_endpoint_test_config config, gpr_mu_lock(g_mu); while (!state.read_done || !state.write_done) { grpc_pollset_worker* worker = nullptr; - GPR_ASSERT(grpc_core::Timestamp::Now() < deadline); - GPR_ASSERT(GRPC_LOG_IF_ERROR( - "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline))); + CHECK(grpc_core::Timestamp::Now() < deadline); + CHECK(GRPC_LOG_IF_ERROR("pollset_work", + grpc_pollset_work(g_pollset, &worker, deadline))); } gpr_mu_unlock(g_mu); grpc_core::ExecCtx::Get()->Flush(); @@ -290,7 +292,7 @@ static void read_and_write_test(grpc_endpoint_test_config config, static void inc_on_failure(void* arg, grpc_error_handle error) { gpr_mu_lock(g_mu); *static_cast(arg) += (!error.ok()); - GPR_ASSERT(GRPC_LOG_IF_ERROR("kick", grpc_pollset_kick(g_pollset, nullptr))); + CHECK(GRPC_LOG_IF_ERROR("kick", grpc_pollset_kick(g_pollset, nullptr))); gpr_mu_unlock(g_mu); } @@ -302,13 +304,13 @@ static void wait_for_fail_count(int* fail_count, int want_fail_count) { while (grpc_core::Timestamp::Now() < deadline && *fail_count < want_fail_count) { grpc_pollset_worker* worker = nullptr; - GPR_ASSERT(GRPC_LOG_IF_ERROR( - "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline))); + CHECK(GRPC_LOG_IF_ERROR("pollset_work", + grpc_pollset_work(g_pollset, &worker, deadline))); gpr_mu_unlock(g_mu); grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); } - GPR_ASSERT(*fail_count == want_fail_count); + CHECK(*fail_count == want_fail_count); gpr_mu_unlock(g_mu); } diff --git a/test/core/iomgr/fd_conservation_posix_test.cc b/test/core/iomgr/fd_conservation_posix_test.cc index 2c7d8b7c699..42790583c9f 100644 --- a/test/core/iomgr/fd_conservation_posix_test.cc +++ b/test/core/iomgr/fd_conservation_posix_test.cc @@ -18,6 +18,8 @@ #include +#include "absl/log/check.h" + #include #include @@ -40,7 +42,7 @@ int main(int argc, char** argv) { // verify we can create and destroy many more than this number // of descriptors rlim.rlim_cur = rlim.rlim_max = 1000; - GPR_ASSERT(0 == setrlimit(RLIMIT_NOFILE, &rlim)); + CHECK_EQ(setrlimit(RLIMIT_NOFILE, &rlim), 0); for (i = 0; i < 10000; i++) { p = grpc_iomgr_create_endpoint_pair("test", nullptr); grpc_endpoint_destroy(p.client); diff --git a/test/core/iomgr/resolve_address_test.cc b/test/core/iomgr/resolve_address_test.cc index 8e133934ccf..68073e153dd 100644 --- a/test/core/iomgr/resolve_address_test.cc +++ b/test/core/iomgr/resolve_address_test.cc @@ -25,6 +25,7 @@ #include #include "absl/functional/bind_front.h" +#include "absl/log/check.h" #include "absl/strings/match.h" #include @@ -546,7 +547,7 @@ int main(int argc, char** argv) { } else if (absl::StrContains(std::string(argv[0]), "using_ares_resolver")) { g_resolver_type = "ares"; } else { - GPR_ASSERT(0); + CHECK(0); } grpc_core::ConfigVars::Overrides overrides; overrides.dns_resolver = g_resolver_type; diff --git a/test/core/iomgr/socket_utils_test.cc b/test/core/iomgr/socket_utils_test.cc index d5b55f1a9fc..4a047dd0ded 100644 --- a/test/core/iomgr/socket_utils_test.cc +++ b/test/core/iomgr/socket_utils_test.cc @@ -28,6 +28,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -198,7 +200,7 @@ TEST(SocketUtilsTest, MainTest) { if (grpc_ipv6_loopback_available()) { sock = socket(AF_INET6, SOCK_STREAM, 0); - GPR_ASSERT(sock > 0); + CHECK_GT(sock, 0); test_set_socket_dscp_ipv6(sock, 8 /*CS1*/); test_set_socket_dscp_ipv6(sock, 16 /*CS2*/); diff --git a/test/core/client_channel/lb_policy/BUILD b/test/core/load_balancing/BUILD similarity index 99% rename from test/core/client_channel/lb_policy/BUILD rename to test/core/load_balancing/BUILD index 292fe932664..304e91c1325 100644 --- a/test/core/client_channel/lb_policy/BUILD +++ b/test/core/load_balancing/BUILD @@ -19,7 +19,7 @@ load( "grpc_package", ) -grpc_package(name = "test/core/client_channel/lb_policy") +grpc_package(name = "test/core/load_balancing") licenses(["notice"]) diff --git a/test/core/client_channel/lb_policy/lb_policy_test_lib.h b/test/core/load_balancing/lb_policy_test_lib.h similarity index 99% rename from test/core/client_channel/lb_policy/lb_policy_test_lib.h rename to test/core/load_balancing/lb_policy_test_lib.h index 3f42dbba0bf..9f2e0b113cd 100644 --- a/test/core/client_channel/lb_policy/lb_policy_test_lib.h +++ b/test/core/load_balancing/lb_policy_test_lib.h @@ -14,8 +14,8 @@ // limitations under the License. // -#ifndef GRPC_TEST_CORE_CLIENT_CHANNEL_LB_POLICY_LB_POLICY_TEST_LIB_H -#define GRPC_TEST_CORE_CLIENT_CHANNEL_LB_POLICY_LB_POLICY_TEST_LIB_H +#ifndef GRPC_TEST_CORE_LOAD_BALANCING_LB_POLICY_TEST_LIB_H +#define GRPC_TEST_CORE_LOAD_BALANCING_LB_POLICY_TEST_LIB_H #include #include @@ -1510,4 +1510,4 @@ class LoadBalancingPolicyTest : public ::testing::Test { } // namespace testing } // namespace grpc_core -#endif // GRPC_TEST_CORE_CLIENT_CHANNEL_LB_POLICY_LB_POLICY_TEST_LIB_H +#endif // GRPC_TEST_CORE_LOAD_BALANCING_LB_POLICY_TEST_LIB_H diff --git a/test/core/client_channel/lb_policy/outlier_detection_lb_config_parser_test.cc b/test/core/load_balancing/outlier_detection_lb_config_parser_test.cc similarity index 100% rename from test/core/client_channel/lb_policy/outlier_detection_lb_config_parser_test.cc rename to test/core/load_balancing/outlier_detection_lb_config_parser_test.cc diff --git a/test/core/client_channel/lb_policy/outlier_detection_test.cc b/test/core/load_balancing/outlier_detection_test.cc similarity index 99% rename from test/core/client_channel/lb_policy/outlier_detection_test.cc rename to test/core/load_balancing/outlier_detection_test.cc index 1dbb5476037..d78af4b3d28 100644 --- a/test/core/client_channel/lb_policy/outlier_detection_test.cc +++ b/test/core/load_balancing/outlier_detection_test.cc @@ -42,7 +42,7 @@ #include "src/core/load_balancing/backend_metric_data.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/resolver/endpoint_addresses.h" -#include "test/core/client_channel/lb_policy/lb_policy_test_lib.h" +#include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/util/test_config.h" namespace grpc_core { diff --git a/test/core/client_channel/lb_policy/pick_first_test.cc b/test/core/load_balancing/pick_first_test.cc similarity index 99% rename from test/core/client_channel/lb_policy/pick_first_test.cc rename to test/core/load_balancing/pick_first_test.cc index cb717cb483e..f6961047d4e 100644 --- a/test/core/client_channel/lb_policy/pick_first_test.cc +++ b/test/core/load_balancing/pick_first_test.cc @@ -48,7 +48,7 @@ #include "src/core/lib/json/json.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/resolver/endpoint_addresses.h" -#include "test/core/client_channel/lb_policy/lb_policy_test_lib.h" +#include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/util/fake_stats_plugin.h" #include "test/core/util/test_config.h" diff --git a/test/core/client_channel/lb_policy/ring_hash_test.cc b/test/core/load_balancing/ring_hash_test.cc similarity index 99% rename from test/core/client_channel/lb_policy/ring_hash_test.cc rename to test/core/load_balancing/ring_hash_test.cc index a8739678e07..4f7493f70b7 100644 --- a/test/core/client_channel/lb_policy/ring_hash_test.cc +++ b/test/core/load_balancing/ring_hash_test.cc @@ -39,7 +39,7 @@ #include "src/core/lib/json/json.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/resolver/endpoint_addresses.h" -#include "test/core/client_channel/lb_policy/lb_policy_test_lib.h" +#include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/util/test_config.h" namespace grpc_core { diff --git a/test/core/client_channel/lb_policy/rls_lb_config_parser_test.cc b/test/core/load_balancing/rls_lb_config_parser_test.cc similarity index 100% rename from test/core/client_channel/lb_policy/rls_lb_config_parser_test.cc rename to test/core/load_balancing/rls_lb_config_parser_test.cc diff --git a/test/core/client_channel/lb_policy/round_robin_test.cc b/test/core/load_balancing/round_robin_test.cc similarity index 99% rename from test/core/client_channel/lb_policy/round_robin_test.cc rename to test/core/load_balancing/round_robin_test.cc index 9af35ed951d..219049dff86 100644 --- a/test/core/client_channel/lb_policy/round_robin_test.cc +++ b/test/core/load_balancing/round_robin_test.cc @@ -27,7 +27,7 @@ #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/resolver/endpoint_addresses.h" -#include "test/core/client_channel/lb_policy/lb_policy_test_lib.h" +#include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/util/test_config.h" namespace grpc_core { diff --git a/test/core/client_channel/lb_policy/static_stride_scheduler_benchmark.cc b/test/core/load_balancing/static_stride_scheduler_benchmark.cc similarity index 100% rename from test/core/client_channel/lb_policy/static_stride_scheduler_benchmark.cc rename to test/core/load_balancing/static_stride_scheduler_benchmark.cc diff --git a/test/core/client_channel/lb_policy/static_stride_scheduler_test.cc b/test/core/load_balancing/static_stride_scheduler_test.cc similarity index 100% rename from test/core/client_channel/lb_policy/static_stride_scheduler_test.cc rename to test/core/load_balancing/static_stride_scheduler_test.cc diff --git a/test/core/client_channel/lb_policy/weighted_round_robin_config_test.cc b/test/core/load_balancing/weighted_round_robin_config_test.cc similarity index 100% rename from test/core/client_channel/lb_policy/weighted_round_robin_config_test.cc rename to test/core/load_balancing/weighted_round_robin_config_test.cc diff --git a/test/core/client_channel/lb_policy/weighted_round_robin_test.cc b/test/core/load_balancing/weighted_round_robin_test.cc similarity index 99% rename from test/core/client_channel/lb_policy/weighted_round_robin_test.cc rename to test/core/load_balancing/weighted_round_robin_test.cc index 9e8cd2c66d1..38293b9d93d 100644 --- a/test/core/client_channel/lb_policy/weighted_round_robin_test.cc +++ b/test/core/load_balancing/weighted_round_robin_test.cc @@ -50,7 +50,7 @@ #include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/weighted_target/weighted_target.h" #include "src/core/resolver/endpoint_addresses.h" -#include "test/core/client_channel/lb_policy/lb_policy_test_lib.h" +#include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/util/fake_stats_plugin.h" #include "test/core/util/test_config.h" diff --git a/test/core/client_channel/lb_policy/xds_override_host_lb_config_parser_test.cc b/test/core/load_balancing/xds_override_host_lb_config_parser_test.cc similarity index 100% rename from test/core/client_channel/lb_policy/xds_override_host_lb_config_parser_test.cc rename to test/core/load_balancing/xds_override_host_lb_config_parser_test.cc diff --git a/test/core/client_channel/lb_policy/xds_override_host_test.cc b/test/core/load_balancing/xds_override_host_test.cc similarity index 99% rename from test/core/client_channel/lb_policy/xds_override_host_test.cc rename to test/core/load_balancing/xds_override_host_test.cc index e6c74b7b2f1..1a177fc907b 100644 --- a/test/core/client_channel/lb_policy/xds_override_host_test.cc +++ b/test/core/load_balancing/xds_override_host_test.cc @@ -46,7 +46,7 @@ #include "src/core/load_balancing/lb_policy.h" #include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/xds/xds_dependency_manager.h" -#include "test/core/client_channel/lb_policy/lb_policy_test_lib.h" +#include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/util/test_config.h" namespace grpc_core { diff --git a/test/core/memory_usage/BUILD b/test/core/memory_usage/BUILD index a0d600a28e0..330d33952b9 100644 --- a/test/core/memory_usage/BUILD +++ b/test/core/memory_usage/BUILD @@ -26,6 +26,7 @@ grpc_cc_library( ], hdrs = ["memstats.h"], external_deps = [ + "absl/log:check", "absl/types:optional", ], tags = [ @@ -44,6 +45,7 @@ grpc_cc_binary( external_deps = [ "absl/flags:flag", "absl/flags:parse", + "absl/log:check", ], tags = [ "bazel_only", @@ -66,6 +68,7 @@ grpc_cc_binary( external_deps = [ "absl/flags:flag", "absl/flags:parse", + "absl/log:check", ], tags = [ "bazel_only", @@ -90,6 +93,7 @@ grpc_cc_binary( external_deps = [ "absl/flags:flag", "absl/flags:parse", + "absl/log:check", "absl/time", ], tags = [ @@ -115,6 +119,7 @@ grpc_cc_binary( external_deps = [ "absl/flags:flag", "absl/flags:parse", + "absl/log:check", ], tags = [ "bazel_only", diff --git a/test/core/memory_usage/callback_client.cc b/test/core/memory_usage/callback_client.cc index 723b57f30fe..bd370e8e0f7 100644 --- a/test/core/memory_usage/callback_client.cc +++ b/test/core/memory_usage/callback_client.cc @@ -27,6 +27,7 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.h" +#include "absl/log/check.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" @@ -124,7 +125,7 @@ std::shared_ptr GetBeforeSnapshot( int main(int argc, char** argv) { absl::ParseCommandLine(argc, argv); char* fake_argv[1]; - GPR_ASSERT(argc >= 1); + CHECK_GE(argc, 1); fake_argv[0] = argv[0]; grpc::testing::TestEnvironment env(&argc, argv); if (absl::GetFlag(FLAGS_target).empty()) { @@ -158,10 +159,10 @@ int main(int argc, char** argv) { // Checking that all channels are still open for (int i = 0; i < size; ++i) { - GPR_ASSERT(!std::exchange(channels_list[i], nullptr) - ->WaitForStateChange(GRPC_CHANNEL_READY, - std::chrono::system_clock::now() + - std::chrono::milliseconds(1))); + CHECK(!std::exchange(channels_list[i], nullptr) + ->WaitForStateChange(GRPC_CHANNEL_READY, + std::chrono::system_clock::now() + + std::chrono::milliseconds(1))); } std::string prefix; diff --git a/test/core/memory_usage/callback_server.cc b/test/core/memory_usage/callback_server.cc index 7737592bb34..ae40b609a1d 100644 --- a/test/core/memory_usage/callback_server.cc +++ b/test/core/memory_usage/callback_server.cc @@ -24,6 +24,7 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.h" +#include "absl/log/check.h" #include #include @@ -77,7 +78,7 @@ static void sigint_handler(int /*x*/) { _exit(0); } int main(int argc, char** argv) { absl::ParseCommandLine(argc, argv); char* fake_argv[1]; - GPR_ASSERT(argc >= 1); + CHECK_GE(argc, 1); fake_argv[0] = argv[0]; grpc::testing::TestEnvironment env(&argc, argv); grpc_init(); diff --git a/test/core/memory_usage/client.cc b/test/core/memory_usage/client.cc index 61185fe361e..3f8849d3664 100644 --- a/test/core/memory_usage/client.cc +++ b/test/core/memory_usage/client.cc @@ -27,6 +27,7 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.h" +#include "absl/log/check.h" #include "absl/strings/match.h" #include @@ -91,10 +92,10 @@ static void init_ping_pong_request(int call_idx) { grpc_slice_from_static_string("/Reflector/reflectUnary"), &hostname, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); - GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(calls[call_idx].call, - metadata_ops, - (size_t)(op - metadata_ops), - tag(call_idx), nullptr)); + CHECK(GRPC_CALL_OK == grpc_call_start_batch(calls[call_idx].call, + metadata_ops, + (size_t)(op - metadata_ops), + tag(call_idx), nullptr)); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); } @@ -111,10 +112,9 @@ static void finish_ping_pong_request(int call_idx) { op->data.recv_status_on_client.status_details = &calls[call_idx].details; op++; - GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(calls[call_idx].call, - status_ops, - (size_t)(op - status_ops), - tag(call_idx), nullptr)); + CHECK(GRPC_CALL_OK == grpc_call_start_batch(calls[call_idx].call, status_ops, + (size_t)(op - status_ops), + tag(call_idx), nullptr)); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_metadata_array_destroy(&calls[call_idx].initial_metadata_recv); grpc_metadata_array_destroy(&calls[call_idx].trailing_metadata_recv); @@ -155,17 +155,17 @@ static MemStats send_snapshot_request(int call_idx, grpc_slice call_type) { calls[call_idx].call = grpc_channel_create_call( channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, call_type, &hostname, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); - GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(calls[call_idx].call, - snapshot_ops, - (size_t)(op - snapshot_ops), - (void*)nullptr, nullptr)); + CHECK(GRPC_CALL_OK == grpc_call_start_batch(calls[call_idx].call, + snapshot_ops, + (size_t)(op - snapshot_ops), + (void*)nullptr, nullptr)); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); gpr_log(GPR_INFO, "Call %d status %d (%s)", call_idx, calls[call_idx].status, std::string(grpc_core::StringViewFromSlice(calls[call_idx].details)) .c_str()); - GPR_ASSERT(response_payload_recv != nullptr); + CHECK_NE(response_payload_recv, nullptr); grpc_byte_buffer_reader reader; grpc_byte_buffer_reader_init(&reader, response_payload_recv); grpc_slice response = grpc_byte_buffer_reader_readall(&reader); @@ -238,7 +238,7 @@ int main(int argc, char** argv) { grpc_slice slice = grpc_slice_from_copied_string("x"); char* fake_argv[1]; - GPR_ASSERT(argc >= 1); + CHECK_GE(argc, 1); fake_argv[0] = argv[0]; grpc::testing::TestEnvironment env(&argc, argv); diff --git a/test/core/memory_usage/memstats.cc b/test/core/memory_usage/memstats.cc index 5bb34361f93..4a479ca5edd 100644 --- a/test/core/memory_usage/memstats.cc +++ b/test/core/memory_usage/memstats.cc @@ -19,6 +19,7 @@ #include #include +#include "absl/log/check.h" #include "absl/strings/str_cat.h" #include @@ -47,7 +48,7 @@ long GetMemUsage(absl::optional pid) { stat_stream.close(); // pid does not connect to an existing process - GPR_ASSERT(!state.empty()); + CHECK(!state.empty()); // Calculations in case x86-64 is configured to use 2MB pages long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; diff --git a/test/core/memory_usage/server.cc b/test/core/memory_usage/server.cc index a789240f5b3..05fa08a5db7 100644 --- a/test/core/memory_usage/server.cc +++ b/test/core/memory_usage/server.cc @@ -33,6 +33,7 @@ #include "absl/base/attributes.h" #include "absl/flags/flag.h" #include "absl/flags/parse.h" +#include "absl/log/check.h" #include "absl/status/status.h" #include @@ -107,9 +108,8 @@ static void send_initial_metadata_unary(void* tag) { metadata_ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; metadata_ops[0].data.send_initial_metadata.count = 0; - GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call*)tag).call, - metadata_ops, 1, tag, - nullptr)); + CHECK(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call*)tag).call, + metadata_ops, 1, tag, nullptr)); } static void send_status(void* tag) { @@ -119,9 +119,8 @@ static void send_status(void* tag) { grpc_slice details = grpc_slice_from_static_string(""); status_op.data.send_status_from_server.status_details = &details; - GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call*)tag).call, - &status_op, 1, tag, - nullptr)); + CHECK(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call*)tag).call, + &status_op, 1, tag, nullptr)); } static void send_snapshot(void* tag, MemStats* snapshot) { @@ -153,9 +152,9 @@ static void send_snapshot(void* tag, MemStats* snapshot) { op->data.recv_close_on_server.cancelled = &was_cancelled; op++; - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch((*(fling_call*)tag).call, snapshot_ops, - (size_t)(op - snapshot_ops), tag, nullptr)); + CHECK(GRPC_CALL_OK == + grpc_call_start_batch((*(fling_call*)tag).call, snapshot_ops, + (size_t)(op - snapshot_ops), tag, nullptr)); } // We have some sort of deadlock, so let's not exit gracefully for now. // When that is resolved, please remove the #include above. @@ -179,7 +178,7 @@ int main(int argc, char** argv) { char* fake_argv[1]; - GPR_ASSERT(argc >= 1); + CHECK_GE(argc, 1); fake_argv[0] = argv[0]; grpc::testing::TestEnvironment env(&argc, argv); @@ -226,10 +225,10 @@ int main(int argc, char** argv) { test_server1_cert}; grpc_server_credentials* ssl_creds = grpc_ssl_server_credentials_create( nullptr, &pem_key_cert_pair, 1, 0, nullptr); - GPR_ASSERT(grpc_server_add_http2_port(server, addr.c_str(), ssl_creds)); + CHECK(grpc_server_add_http2_port(server, addr.c_str(), ssl_creds)); grpc_server_credentials_release(ssl_creds); } else { - GPR_ASSERT(grpc_server_add_http2_port( + CHECK(grpc_server_add_http2_port( server, addr.c_str(), grpc_insecure_server_credentials_create())); } @@ -258,10 +257,10 @@ int main(int argc, char** argv) { shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - shutdown_cq, tag(1000), - grpc_timeout_seconds_to_deadline(5), nullptr) - .type == GRPC_OP_COMPLETE); + CHECK(grpc_completion_queue_pluck(shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + nullptr) + .type == GRPC_OP_COMPLETE); grpc_completion_queue_destroy(shutdown_cq); grpc_completion_queue_shutdown(cq); shutdown_started = 1; @@ -339,7 +338,7 @@ int main(int argc, char** argv) { } break; case GRPC_QUEUE_SHUTDOWN: - GPR_ASSERT(shutdown_started); + CHECK(shutdown_started); shutdown_finished = 1; break; case GRPC_QUEUE_TIMEOUT: diff --git a/test/core/promise/BUILD b/test/core/promise/BUILD index 5bd4ddea346..ac99d1a9fcd 100644 --- a/test/core/promise/BUILD +++ b/test/core/promise/BUILD @@ -19,6 +19,15 @@ licenses(["notice"]) grpc_package(name = "test/core/promise") +grpc_cc_library( + name = "poll_matcher", + testonly = True, + hdrs = ["poll_matcher.h"], + external_deps = ["gtest"], + visibility = ["//test/core:__subpackages__"], + deps = ["//src/core:poll"], +) + grpc_cc_library( name = "test_wakeup_schedulers", testonly = True, @@ -496,6 +505,7 @@ grpc_cc_test( uses_event_engine = False, uses_polling = False, deps = [ + "poll_matcher", "//src/core:loop", "//src/core:map", "//src/core:notification", diff --git a/test/core/promise/observable_test.cc b/test/core/promise/observable_test.cc index 48f52b4978c..e3c74332f04 100644 --- a/test/core/promise/observable_test.cc +++ b/test/core/promise/observable_test.cc @@ -26,6 +26,7 @@ #include "src/core/lib/gprpp/notification.h" #include "src/core/lib/promise/loop.h" #include "src/core/lib/promise/map.h" +#include "test/core/promise/poll_matcher.h" using testing::Mock; using testing::StrictMock; @@ -58,34 +59,6 @@ class MockActivity : public Activity, public Wakeable { std::unique_ptr scoped_activity_; }; -MATCHER(IsPending, "") { - if (arg.ready()) { - *result_listener << "is ready"; - return false; - } - return true; -} - -MATCHER(IsReady, "") { - if (arg.pending()) { - *result_listener << "is pending"; - return false; - } - return true; -} - -MATCHER_P(IsReady, value, "") { - if (arg.pending()) { - *result_listener << "is pending"; - return false; - } - if (arg.value() != value) { - *result_listener << "is " << ::testing::PrintToString(arg.value()); - return false; - } - return true; -} - TEST(ObservableTest, ImmediateNext) { Observable observable(1); auto next = observable.Next(0); diff --git a/test/core/promise/poll_matcher.h b/test/core/promise/poll_matcher.h new file mode 100644 index 00000000000..1c571effbcb --- /dev/null +++ b/test/core/promise/poll_matcher.h @@ -0,0 +1,60 @@ +// Copyright 2024 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_TEST_CORE_PROMISE_POLL_MATCHER_H +#define GRPC_TEST_CORE_PROMISE_POLL_MATCHER_H + +#include "gmock/gmock.h" + +// Various gmock matchers for Poll + +namespace grpc_core { + +// Expect that a promise is still pending: +// EXPECT_THAT(some_promise(), IsPending()); +MATCHER(IsPending, "") { + if (arg.ready()) { + *result_listener << "is ready"; + return false; + } + return true; +} + +// Expect that a promise is ready: +// EXPECT_THAT(some_promise(), IsReady()); +MATCHER(IsReady, "") { + if (arg.pending()) { + *result_listener << "is pending"; + return false; + } + return true; +} + +// Expect that a promise is ready with a specific value: +// EXPECT_THAT(some_promise(), IsReady(value)); +MATCHER_P(IsReady, value, "") { + if (arg.pending()) { + *result_listener << "is pending"; + return false; + } + if (arg.value() != value) { + *result_listener << "is " << ::testing::PrintToString(arg.value()); + return false; + } + return true; +} + +} // namespace grpc_core + +#endif // GRPC_TEST_CORE_PROMISE_POLL_MATCHER_H diff --git a/test/core/resolver/BUILD b/test/core/resolver/BUILD index 04aaf120a8d..020644df369 100644 --- a/test/core/resolver/BUILD +++ b/test/core/resolver/BUILD @@ -1,4 +1,4 @@ -# Copyright 2023 gRPC authors. +# Copyright 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. @@ -32,3 +32,88 @@ grpc_cc_test( "//test/core/util:grpc_test_util", ], ) + +grpc_cc_test( + name = "binder_resolver_test", + srcs = ["binder_resolver_test.cc"], + external_deps = [ + "gtest", + ], + language = "C++", + deps = [ + "//:gpr", + "//:grpc", + "//src/core:grpc_resolver_binder", + "//test/core/util:grpc_test_util", + ], +) + +grpc_cc_test( + name = "dns_resolver_test", + srcs = ["dns_resolver_test.cc"], + external_deps = ["gtest"], + language = "C++", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], +) + +grpc_cc_test( + name = "dns_resolver_cooldown_test", + srcs = ["dns_resolver_cooldown_test.cc"], + external_deps = ["gtest"], + language = "C++", + deps = [ + "//:gpr", + "//:grpc", + "//src/core:channel_args", + "//src/core:closure", + "//test/core/util:grpc_test_util", + ], +) + +grpc_cc_test( + name = "sockaddr_resolver_test", + srcs = ["sockaddr_resolver_test.cc"], + external_deps = ["gtest"], + language = "C++", + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], +) + +grpc_cc_test( + name = "fake_resolver_test", + srcs = ["fake_resolver_test.cc"], + external_deps = ["gtest"], + language = "C++", + deps = [ + "//:gpr", + "//:grpc", + "//:grpc_resolver_fake", + "//src/core:channel_args", + "//test/core/util:grpc_test_util", + ], +) + +grpc_cc_test( + name = "google_c2p_resolver_test", + srcs = ["google_c2p_resolver_test.cc"], + external_deps = [ + "absl/strings:str_format", + "gtest", + ], + language = "C++", + deps = [ + "//:gpr", + "//:grpc", + "//:grpc++", + "//test/core/util:fake_udp_and_tcp_server", + "//test/core/util:grpc_test_util", + "//test/cpp/util:test_util", + ], +) diff --git a/test/core/client_channel/resolvers/binder_resolver_test.cc b/test/core/resolver/binder_resolver_test.cc similarity index 100% rename from test/core/client_channel/resolvers/binder_resolver_test.cc rename to test/core/resolver/binder_resolver_test.cc diff --git a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc b/test/core/resolver/dns_resolver_cooldown_test.cc similarity index 100% rename from test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc rename to test/core/resolver/dns_resolver_cooldown_test.cc diff --git a/test/core/client_channel/resolvers/dns_resolver_test.cc b/test/core/resolver/dns_resolver_test.cc similarity index 100% rename from test/core/client_channel/resolvers/dns_resolver_test.cc rename to test/core/resolver/dns_resolver_test.cc diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/resolver/fake_resolver_test.cc similarity index 100% rename from test/core/client_channel/resolvers/fake_resolver_test.cc rename to test/core/resolver/fake_resolver_test.cc diff --git a/test/core/client_channel/resolvers/google_c2p_resolver_test.cc b/test/core/resolver/google_c2p_resolver_test.cc similarity index 100% rename from test/core/client_channel/resolvers/google_c2p_resolver_test.cc rename to test/core/resolver/google_c2p_resolver_test.cc diff --git a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc b/test/core/resolver/sockaddr_resolver_test.cc similarity index 100% rename from test/core/client_channel/resolvers/sockaddr_resolver_test.cc rename to test/core/resolver/sockaddr_resolver_test.cc diff --git a/test/core/security/BUILD b/test/core/security/BUILD index 58c2c6d63f5..8c40aa5fc50 100644 --- a/test/core/security/BUILD +++ b/test/core/security/BUILD @@ -23,6 +23,7 @@ grpc_fuzzer( name = "alts_credentials_fuzzer", srcs = ["alts_credentials_fuzzer.cc"], corpus = "corpus/alts_credentials_corpus", + external_deps = ["absl/log:check"], language = "C++", tags = ["no_windows"], deps = [ @@ -42,6 +43,7 @@ grpc_fuzzer( "//src/core/tsi/test_creds:server1.key", "//src/core/tsi/test_creds:server1.pem", ], + external_deps = ["absl/log:check"], language = "C++", tags = ["no_windows"], deps = [ @@ -112,7 +114,10 @@ grpc_cc_test( grpc_cc_test( name = "aws_request_signer_test", srcs = ["aws_request_signer_test.cc"], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], language = "C++", deps = [ "//:gpr", @@ -250,6 +255,7 @@ grpc_cc_binary( grpc_cc_binary( name = "fetch_oauth2", srcs = ["fetch_oauth2.cc"], + external_deps = ["absl/log:check"], language = "C++", deps = [ ":oauth2_utils", @@ -264,6 +270,7 @@ grpc_cc_binary( grpc_cc_binary( name = "verify_jwt", srcs = ["verify_jwt.cc"], + external_deps = ["absl/log:check"], language = "C++", deps = [ "//:gpr", @@ -339,6 +346,7 @@ grpc_cc_test( "//src/core/tsi/test_creds:server1.pem", ], external_deps = [ + "absl/log:check", "gtest", ], language = "C++", @@ -389,7 +397,10 @@ grpc_cc_test( grpc_cc_test( name = "grpc_tls_certificate_distributor_test", srcs = ["grpc_tls_certificate_distributor_test.cc"], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], language = "C++", deps = [ "//:gpr", @@ -412,7 +423,10 @@ grpc_cc_test( "//src/core/tsi/test_creds:server1.key", "//src/core/tsi/test_creds:server1.pem", ], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], language = "C++", deps = [ "//:gpr", diff --git a/test/core/security/alts_credentials_fuzzer.cc b/test/core/security/alts_credentials_fuzzer.cc index 1d47a506061..a145ee0f0b0 100644 --- a/test/core/security/alts_credentials_fuzzer.cc +++ b/test/core/security/alts_credentials_fuzzer.cc @@ -18,6 +18,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -82,9 +84,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_channel_credentials* cred = grpc_alts_credentials_create_customized( options, handshaker_service_url, enable_untrusted_alts); if (!enable_untrusted_alts && !is_on_gcp) { - GPR_ASSERT(cred == nullptr); + CHECK_EQ(cred, nullptr); } else { - GPR_ASSERT(cred != nullptr); + CHECK_NE(cred, nullptr); } grpc_channel_credentials_release(cred); grpc_alts_credentials_options_destroy(options); @@ -96,9 +98,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_alts_server_credentials_create_customized( options, handshaker_service_url, enable_untrusted_alts); if (!enable_untrusted_alts && !is_on_gcp) { - GPR_ASSERT(cred == nullptr); + CHECK_EQ(cred, nullptr); } else { - GPR_ASSERT(cred != nullptr); + CHECK_NE(cred, nullptr); } grpc_server_credentials_release(cred); grpc_alts_credentials_options_destroy(options); diff --git a/test/core/security/aws_request_signer_test.cc b/test/core/security/aws_request_signer_test.cc index 94f535d3b2d..c877fd5ae47 100644 --- a/test/core/security/aws_request_signer_test.cc +++ b/test/core/security/aws_request_signer_test.cc @@ -18,6 +18,8 @@ #include +#include "absl/log/check.h" + #include #include "test/core/util/test_config.h" @@ -247,9 +249,8 @@ TEST(GrpcAwsRequestSignerTest, InvalidUrl) { "token", "POST", "invalid_url", "us-east-1", "", {}, &error); std::string actual_error_description; - GPR_ASSERT(grpc_error_get_str(error, - grpc_core::StatusStrProperty::kDescription, - &actual_error_description)); + CHECK(grpc_error_get_str(error, grpc_core::StatusStrProperty::kDescription, + &actual_error_description)); EXPECT_EQ(actual_error_description, "Invalid Aws request url."); } @@ -260,9 +261,8 @@ TEST(GrpcAwsRequestSignerTest, DuplicateRequestDate) { "us-east-1", "", {{"date", kBotoTestDate}, {"x-amz-date", kAmzTestDate}}, &error); std::string actual_error_description; - GPR_ASSERT(grpc_error_get_str(error, - grpc_core::StatusStrProperty::kDescription, - &actual_error_description)); + CHECK(grpc_error_get_str(error, grpc_core::StatusStrProperty::kDescription, + &actual_error_description)); EXPECT_EQ(actual_error_description, "Only one of {date, x-amz-date} can be specified, not both."); } diff --git a/test/core/security/fetch_oauth2.cc b/test/core/security/fetch_oauth2.cc index c60c85bbf7f..8dd9c9731ad 100644 --- a/test/core/security/fetch_oauth2.cc +++ b/test/core/security/fetch_oauth2.cc @@ -19,6 +19,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -137,7 +139,7 @@ int main(int argc, char** argv) { "Missing --gce, --json_sts_options, or --json_refresh_token option."); exit(1); } - GPR_ASSERT(creds != nullptr); + CHECK_NE(creds, nullptr); token = grpc_test_fetch_oauth2_token_with_credentials(creds); if (token != nullptr) { diff --git a/test/core/security/grpc_tls_certificate_distributor_test.cc b/test/core/security/grpc_tls_certificate_distributor_test.cc index 8fa6187eaf9..4b4259e9191 100644 --- a/test/core/security/grpc_tls_certificate_distributor_test.cc +++ b/test/core/security/grpc_tls_certificate_distributor_test.cc @@ -24,6 +24,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -133,17 +135,17 @@ class GrpcTlsCertificateDistributorTest : public ::testing::Test { void OnError(grpc_error_handle root_cert_error, grpc_error_handle identity_cert_error) override { - GPR_ASSERT(!root_cert_error.ok() || !identity_cert_error.ok()); + CHECK(!root_cert_error.ok() || !identity_cert_error.ok()); std::string root_error_str; std::string identity_error_str; if (!root_cert_error.ok()) { - GPR_ASSERT(grpc_error_get_str( + CHECK(grpc_error_get_str( root_cert_error, StatusStrProperty::kDescription, &root_error_str)); } if (!identity_cert_error.ok()) { - GPR_ASSERT(grpc_error_get_str(identity_cert_error, - StatusStrProperty::kDescription, - &identity_error_str)); + CHECK(grpc_error_get_str(identity_cert_error, + StatusStrProperty::kDescription, + &identity_error_str)); } state_->error_queue.emplace_back(std::move(root_error_str), std::move(identity_error_str)); diff --git a/test/core/security/grpc_tls_certificate_provider_test.cc b/test/core/security/grpc_tls_certificate_provider_test.cc index 29e9ca0960d..af5491a48e4 100644 --- a/test/core/security/grpc_tls_certificate_provider_test.cc +++ b/test/core/security/grpc_tls_certificate_provider_test.cc @@ -22,6 +22,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -134,17 +136,17 @@ class GrpcTlsCertificateProviderTest : public ::testing::Test { void OnError(grpc_error_handle root_cert_error, grpc_error_handle identity_cert_error) override { MutexLock lock(&state_->mu); - GPR_ASSERT(!root_cert_error.ok() || !identity_cert_error.ok()); + CHECK(!root_cert_error.ok() || !identity_cert_error.ok()); std::string root_error_str; std::string identity_error_str; if (!root_cert_error.ok()) { - GPR_ASSERT(grpc_error_get_str( + CHECK(grpc_error_get_str( root_cert_error, StatusStrProperty::kDescription, &root_error_str)); } if (!identity_cert_error.ok()) { - GPR_ASSERT(grpc_error_get_str(identity_cert_error, - StatusStrProperty::kDescription, - &identity_error_str)); + CHECK(grpc_error_get_str(identity_cert_error, + StatusStrProperty::kDescription, + &identity_error_str)); } state_->error_queue.emplace_back(std::move(root_error_str), std::move(identity_error_str)); diff --git a/test/core/security/print_google_default_creds_token.cc b/test/core/security/print_google_default_creds_token.cc index 66ea4a904c0..134d3e57d45 100644 --- a/test/core/security/print_google_default_creds_token.cc +++ b/test/core/security/print_google_default_creds_token.cc @@ -19,6 +19,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -51,7 +53,7 @@ static void on_metadata_response(void* arg, grpc_error_handle error) { fflush(stderr); } else { char* token; - GPR_ASSERT(sync->md_array.size == 1); + CHECK_EQ(sync->md_array.size, 1u); token = grpc_slice_to_c_string(GRPC_MDVALUE(sync->md_array.md[0])); printf("\nGot token: %s\n\n", token); gpr_free(token); diff --git a/test/core/security/ssl_server_fuzzer.cc b/test/core/security/ssl_server_fuzzer.cc index e657550f376..ea4e82123e6 100644 --- a/test/core/security/ssl_server_fuzzer.cc +++ b/test/core/security/ssl_server_fuzzer.cc @@ -15,6 +15,7 @@ // limitations under the License. // // +#include "absl/log/check.h" #include #include @@ -54,10 +55,10 @@ static void on_handshake_done(void* arg, grpc_error_handle error) { static_cast(arg); struct handshake_state* state = static_cast(args->user_data); - GPR_ASSERT(state->done_callback_called == false); + CHECK(state->done_callback_called == false); state->done_callback_called = true; // The fuzzer should not pass the handshake. - GPR_ASSERT(!error.ok()); + CHECK(!error.ok()); } extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { @@ -86,7 +87,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { // Create security connector grpc_core::RefCountedPtr sc = creds->create_security_connector(grpc_core::ChannelArgs()); - GPR_ASSERT(sc != nullptr); + CHECK(sc != nullptr); grpc_core::Timestamp deadline = grpc_core::Duration::Seconds(1) + grpc_core::Timestamp::Now(); @@ -110,7 +111,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { GRPC_ERROR_CREATE("Explicit close")); grpc_core::ExecCtx::Get()->Flush(); } - GPR_ASSERT(state.done_callback_called); + CHECK(state.done_callback_called); sc.reset(DEBUG_LOCATION, "test"); grpc_server_credentials_release(creds); diff --git a/test/core/security/tls_security_connector_test.cc b/test/core/security/tls_security_connector_test.cc index 264eb8103db..41ca123eba0 100644 --- a/test/core/security/tls_security_connector_test.cc +++ b/test/core/security/tls_security_connector_test.cc @@ -24,6 +24,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -82,7 +84,7 @@ class TlsSecurityConnectorTest : public ::testing::Test { static std::string GetErrorMsg(grpc_error_handle error) { std::string error_str; - GPR_ASSERT( + CHECK( grpc_error_get_str(error, StatusStrProperty::kDescription, &error_str)); return error_str; } @@ -368,13 +370,13 @@ TEST_F(TlsSecurityConnectorTest, EXPECT_NE(tls_connector->ClientHandshakerFactoryForTesting(), nullptr); // Construct a basic TSI Peer. tsi_peer peer; - GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, - "h2", strlen("h2"), - &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", - &peer.properties[1]) == TSI_OK); + CHECK(tsi_construct_peer(2, &peer) == TSI_OK); + CHECK(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2", + strlen("h2"), + &peer.properties[0]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", + &peer.properties[1]) == TSI_OK); RefCountedPtr auth_context; ExecCtx exec_ctx; grpc_closure* on_peer_checked = GRPC_CLOSURE_CREATE( @@ -404,13 +406,13 @@ TEST_F(TlsSecurityConnectorTest, EXPECT_NE(tls_connector->ClientHandshakerFactoryForTesting(), nullptr); // Construct a basic TSI Peer. tsi_peer peer; - GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, - "h2", strlen("h2"), - &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", - &peer.properties[1]) == TSI_OK); + CHECK(tsi_construct_peer(2, &peer) == TSI_OK); + CHECK(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2", + strlen("h2"), + &peer.properties[0]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", + &peer.properties[1]) == TSI_OK); RefCountedPtr auth_context; const char* expected_error_msg = "Custom verification check failed with error: UNAUTHENTICATED: " @@ -557,13 +559,13 @@ TEST_F(TlsSecurityConnectorTest, EXPECT_NE(tls_connector->ClientHandshakerFactoryForTesting(), nullptr); // Construct a basic TSI Peer. tsi_peer peer; - GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, - "h2", strlen("h2"), - &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", - &peer.properties[1]) == TSI_OK); + CHECK(tsi_construct_peer(2, &peer) == TSI_OK); + CHECK(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2", + strlen("h2"), + &peer.properties[0]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", + &peer.properties[1]) == TSI_OK); RefCountedPtr auth_context; ExecCtx exec_ctx; grpc_closure* on_peer_checked = GRPC_CLOSURE_CREATE( @@ -593,13 +595,13 @@ TEST_F(TlsSecurityConnectorTest, EXPECT_NE(tls_connector->ClientHandshakerFactoryForTesting(), nullptr); // Construct a basic TSI Peer. tsi_peer peer; - GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, - "h2", strlen("h2"), - &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", - &peer.properties[1]) == TSI_OK); + CHECK(tsi_construct_peer(2, &peer) == TSI_OK); + CHECK(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2", + strlen("h2"), + &peer.properties[0]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", + &peer.properties[1]) == TSI_OK); RefCountedPtr auth_context; const char* expected_error_msg = "Custom verification check failed with error: UNAUTHENTICATED: " @@ -631,29 +633,29 @@ TEST_F(TlsSecurityConnectorTest, EXPECT_NE(tls_connector->ClientHandshakerFactoryForTesting(), nullptr); // Construct a full TSI Peer. tsi_peer peer; - GPR_ASSERT(tsi_construct_peer(7, &peer) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, - "h2", strlen("h2"), - &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", - &peer.properties[1]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_PEM_CERT_PROPERTY, "pem_cert", &peer.properties[2]) == - TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_SECURITY_LEVEL_PEER_PROPERTY, - tsi_security_level_to_string(TSI_PRIVACY_AND_INTEGRITY), - &peer.properties[3]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_PEM_CERT_CHAIN_PROPERTY, "pem_cert_chain", - &peer.properties[4]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, "foo.bar.com", - &peer.properties[5]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, "foo.baz.com", - &peer.properties[6]) == TSI_OK); + CHECK(tsi_construct_peer(7, &peer) == TSI_OK); + CHECK(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2", + strlen("h2"), + &peer.properties[0]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", + &peer.properties[1]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_PEM_CERT_PROPERTY, "pem_cert", &peer.properties[2]) == + TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_SECURITY_LEVEL_PEER_PROPERTY, + tsi_security_level_to_string(TSI_PRIVACY_AND_INTEGRITY), + &peer.properties[3]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_PEM_CERT_CHAIN_PROPERTY, "pem_cert_chain", + &peer.properties[4]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, "foo.bar.com", + &peer.properties[5]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, "foo.baz.com", + &peer.properties[6]) == TSI_OK); RefCountedPtr auth_context; ExecCtx exec_ctx; grpc_closure* on_peer_checked = GRPC_CLOSURE_CREATE( @@ -679,29 +681,29 @@ TEST_F(TlsSecurityConnectorTest, EXPECT_NE(tls_connector->ClientHandshakerFactoryForTesting(), nullptr); // Construct a full TSI Peer. tsi_peer peer; - GPR_ASSERT(tsi_construct_peer(7, &peer) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, - "h2", strlen("h2"), - &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.com", - &peer.properties[1]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_PEM_CERT_PROPERTY, "pem_cert", &peer.properties[2]) == - TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_SECURITY_LEVEL_PEER_PROPERTY, - tsi_security_level_to_string(TSI_PRIVACY_AND_INTEGRITY), - &peer.properties[3]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_PEM_CERT_CHAIN_PROPERTY, "pem_cert_chain", - &peer.properties[4]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, "*.com", - &peer.properties[5]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, "foo.baz.com", - &peer.properties[6]) == TSI_OK); + CHECK(tsi_construct_peer(7, &peer) == TSI_OK); + CHECK(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2", + strlen("h2"), + &peer.properties[0]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.com", + &peer.properties[1]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_PEM_CERT_PROPERTY, "pem_cert", &peer.properties[2]) == + TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_SECURITY_LEVEL_PEER_PROPERTY, + tsi_security_level_to_string(TSI_PRIVACY_AND_INTEGRITY), + &peer.properties[3]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_PEM_CERT_CHAIN_PROPERTY, "pem_cert_chain", + &peer.properties[4]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, "*.com", + &peer.properties[5]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, "foo.baz.com", + &peer.properties[6]) == TSI_OK); RefCountedPtr auth_context; const char* expected_error_msg = "Custom verification check failed with error: UNAUTHENTICATED: Hostname " @@ -988,13 +990,13 @@ TEST_F(TlsSecurityConnectorTest, auto connector = credentials->create_security_connector(ChannelArgs()); // Construct a basic TSI Peer. tsi_peer peer; - GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, - "h2", strlen("h2"), - &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", - &peer.properties[1]) == TSI_OK); + CHECK(tsi_construct_peer(2, &peer) == TSI_OK); + CHECK(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2", + strlen("h2"), + &peer.properties[0]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", + &peer.properties[1]) == TSI_OK); RefCountedPtr auth_context; ExecCtx exec_ctx; grpc_closure* on_peer_checked = GRPC_CLOSURE_CREATE( @@ -1019,13 +1021,13 @@ TEST_F(TlsSecurityConnectorTest, auto connector = credentials->create_security_connector(ChannelArgs()); // Construct a basic TSI Peer. tsi_peer peer; - GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, - "h2", strlen("h2"), - &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", - &peer.properties[1]) == TSI_OK); + CHECK(tsi_construct_peer(2, &peer) == TSI_OK); + CHECK(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2", + strlen("h2"), + &peer.properties[0]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", + &peer.properties[1]) == TSI_OK); RefCountedPtr auth_context; const char* expected_error_msg = "Custom verification check failed with error: UNAUTHENTICATED: " @@ -1054,13 +1056,13 @@ TEST_F(TlsSecurityConnectorTest, auto connector = credentials->create_security_connector(ChannelArgs()); // Construct a basic TSI Peer. tsi_peer peer; - GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, - "h2", strlen("h2"), - &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", - &peer.properties[1]) == TSI_OK); + CHECK(tsi_construct_peer(2, &peer) == TSI_OK); + CHECK(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2", + strlen("h2"), + &peer.properties[0]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", + &peer.properties[1]) == TSI_OK); RefCountedPtr auth_context; ExecCtx exec_ctx; grpc_closure* on_peer_checked = GRPC_CLOSURE_CREATE( @@ -1087,13 +1089,13 @@ TEST_F(TlsSecurityConnectorTest, auto connector = credentials->create_security_connector(ChannelArgs()); // Construct a basic TSI Peer. tsi_peer peer; - GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, - "h2", strlen("h2"), - &peer.properties[0]) == TSI_OK); - GPR_ASSERT(tsi_construct_string_peer_property_from_cstring( - TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", - &peer.properties[1]) == TSI_OK); + CHECK(tsi_construct_peer(2, &peer) == TSI_OK); + CHECK(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2", + strlen("h2"), + &peer.properties[0]) == TSI_OK); + CHECK(tsi_construct_string_peer_property_from_cstring( + TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com", + &peer.properties[1]) == TSI_OK); RefCountedPtr auth_context; const char* expected_error_msg = "Custom verification check failed with error: UNAUTHENTICATED: " diff --git a/test/core/security/verify_jwt.cc b/test/core/security/verify_jwt.cc index 9b64fc8e124..c9178d230f1 100644 --- a/test/core/security/verify_jwt.cc +++ b/test/core/security/verify_jwt.cc @@ -19,6 +19,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -55,13 +57,13 @@ static void on_jwt_verification_done(void* user_data, sync->success = (status == GRPC_JWT_VERIFIER_OK); if (sync->success) { - GPR_ASSERT(claims != nullptr); + CHECK_NE(claims, nullptr); std::string claims_str = grpc_core::JsonDump(*grpc_jwt_claims_json(claims), /*indent=*/2); printf("Claims: \n\n%s\n", claims_str.c_str()); grpc_jwt_claims_destroy(claims); } else { - GPR_ASSERT(claims == nullptr); + CHECK_EQ(claims, nullptr); fprintf(stderr, "Verification failed with error %s\n", grpc_jwt_verifier_status_to_string(status)); fflush(stderr); diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD index 516e23e2f20..c52a096f429 100644 --- a/test/core/transport/BUILD +++ b/test/core/transport/BUILD @@ -35,6 +35,23 @@ grpc_cc_test( ], ) +grpc_cc_test( + name = "interception_chain_test", + srcs = ["interception_chain_test.cc"], + external_deps = [ + "gtest", + ], + language = "C++", + uses_event_engine = False, + uses_polling = False, + deps = [ + "//:grpc_base", + "//src/core:interception_chain", + "//src/core:resource_quota", + "//test/core/promise:poll_matcher", + ], +) + grpc_cc_test( name = "call_filters_test", srcs = ["call_filters_test.cc"], @@ -46,6 +63,7 @@ grpc_cc_test( uses_polling = False, deps = [ "//src/core:call_filters", + "//test/core/promise:poll_matcher", ], ) @@ -98,6 +116,7 @@ grpc_cc_test( name = "parsed_metadata_test", srcs = ["parsed_metadata_test.cc"], external_deps = [ + "absl/log:check", "gtest", ], language = "C++", diff --git a/test/core/transport/binder/end2end/BUILD b/test/core/transport/binder/end2end/BUILD index 30605e19fdf..cfc9a7f9614 100644 --- a/test/core/transport/binder/end2end/BUILD +++ b/test/core/transport/binder/end2end/BUILD @@ -63,7 +63,7 @@ grpc_cc_library( testonly = 1, srcs = ["testing_channel_create.cc"], hdrs = ["testing_channel_create.h"], - external_deps = [], + external_deps = ["absl/log:check"], deps = [ ":fake_binder", "//:grpc++_base", diff --git a/test/core/transport/binder/end2end/fuzzers/BUILD b/test/core/transport/binder/end2end/fuzzers/BUILD index 85427723f08..bf8593e2cc7 100644 --- a/test/core/transport/binder/end2end/fuzzers/BUILD +++ b/test/core/transport/binder/end2end/fuzzers/BUILD @@ -35,6 +35,7 @@ grpc_proto_library( grpc_cc_library( name = "fuzzer_utils", srcs = ["fuzzer_utils.cc"], + external_deps = ["absl/log:check"], language = "c++", public_hdrs = ["fuzzer_utils.h"], deps = [ @@ -53,6 +54,7 @@ grpc_proto_fuzzer( "client_fuzzer.cc", ], corpus = "binder_transport_client_fuzzer_corpus", + external_deps = ["absl/log:check"], owner = "binder", proto = "client.proto", tags = [ @@ -76,6 +78,7 @@ grpc_proto_fuzzer( "server_fuzzer.cc", ], corpus = "binder_transport_server_fuzzer_corpus", + external_deps = ["absl/log:check"], owner = "binder", proto = "server.proto", tags = [ diff --git a/test/core/transport/binder/end2end/fuzzers/client_fuzzer.cc b/test/core/transport/binder/end2end/fuzzers/client_fuzzer.cc index dc1f3887110..fb194663f58 100644 --- a/test/core/transport/binder/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/transport/binder/end2end/fuzzers/client_fuzzer.cc @@ -15,6 +15,7 @@ #include #include +#include "absl/log/check.h" #include "absl/memory/memory.h" #include @@ -110,7 +111,7 @@ DEFINE_PROTO_FUZZER(const binder_transport_fuzzer::Input& input) { grpc_call_error error = grpc_call_start_batch( call, ops, static_cast(op - ops), tag(1), nullptr); int requested_calls = 1; - GPR_ASSERT(GRPC_CALL_OK == error); + CHECK_EQ(error, GRPC_CALL_OK); grpc_event ev; while (true) { grpc_core::ExecCtx::Get()->Flush(); @@ -135,13 +136,13 @@ DEFINE_PROTO_FUZZER(const binder_transport_fuzzer::Input& input) { for (int i = 0; i < requested_calls; i++) { ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); - GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); + CHECK(ev.type == GRPC_OP_COMPLETE); } grpc_completion_queue_shutdown(cq); for (int i = 0; i < requested_calls; i++) { ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); - GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); + CHECK(ev.type == GRPC_QUEUE_SHUTDOWN); } grpc_call_unref(call); grpc_completion_queue_destroy(cq); diff --git a/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.cc b/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.cc index 7575a0e56ba..74d9f65665e 100644 --- a/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.cc +++ b/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.cc @@ -14,6 +14,8 @@ #include "test/core/transport/binder/end2end/fuzzers/fuzzer_utils.h" +#include "absl/log/check.h" + namespace grpc_binder { namespace fuzzing { @@ -23,7 +25,7 @@ std::thread* g_fuzzing_thread = nullptr; template void CreateFuzzingThread(Args&&... args) { - GPR_ASSERT(g_fuzzing_thread == nullptr); + CHECK_EQ(g_fuzzing_thread, nullptr); g_fuzzing_thread = new std::thread(std::forward(args)...); } diff --git a/test/core/transport/binder/end2end/fuzzers/server_fuzzer.cc b/test/core/transport/binder/end2end/fuzzers/server_fuzzer.cc index 4472291cb7b..48ce0e6fcea 100644 --- a/test/core/transport/binder/end2end/fuzzers/server_fuzzer.cc +++ b/test/core/transport/binder/end2end/fuzzers/server_fuzzer.cc @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "absl/log/check.h" + #include #include "src/core/ext/transport/binder/transport/binder_transport.h" @@ -62,9 +64,9 @@ DEFINE_PROTO_FUZZER(const binder_transport_fuzzer::Input& input) { grpc_metadata_array_init(&request_metadata1); int requested_calls = 0; - GPR_ASSERT(GRPC_CALL_OK == - grpc_server_request_call(server, &call1, &call_details1, - &request_metadata1, cq, cq, tag(1))); + CHECK(GRPC_CALL_OK == + grpc_server_request_call(server, &call1, &call_details1, + &request_metadata1, cq, cq, tag(1))); requested_calls++; grpc_event ev; @@ -111,7 +113,7 @@ DEFINE_PROTO_FUZZER(const binder_transport_fuzzer::Input& input) { grpc_core::ExecCtx::Get()->InvalidateNow(); } while (ev.type != GRPC_OP_COMPLETE && grpc_core::Timestamp::Now() < deadline); - GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); + CHECK(ev.type == GRPC_OP_COMPLETE); } grpc_completion_queue_shutdown(cq); for (int i = 0; i <= requested_calls; i++) { @@ -121,7 +123,7 @@ DEFINE_PROTO_FUZZER(const binder_transport_fuzzer::Input& input) { grpc_core::ExecCtx::Get()->InvalidateNow(); } while (ev.type != GRPC_QUEUE_SHUTDOWN && grpc_core::Timestamp::Now() < deadline); - GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); + CHECK(ev.type == GRPC_QUEUE_SHUTDOWN); } grpc_server_destroy(server); grpc_completion_queue_destroy(cq); diff --git a/test/core/transport/binder/end2end/testing_channel_create.cc b/test/core/transport/binder/end2end/testing_channel_create.cc index 1823498bf26..50d9470960e 100644 --- a/test/core/transport/binder/end2end/testing_channel_create.cc +++ b/test/core/transport/binder/end2end/testing_channel_create.cc @@ -16,6 +16,8 @@ #include +#include "absl/log/check.h" + #include #include "src/core/ext/transport/binder/transport/binder_transport.h" @@ -124,9 +126,9 @@ grpc_channel* grpc_binder_channel_create_for_testing( grpc_binder::end2end_testing::CreateClientServerBindersPairForTesting(); grpc_error_handle error = grpc_core::Server::FromC(server)->SetupTransport( server_transport, nullptr, server_args, nullptr); - GPR_ASSERT(error.ok()); + CHECK_OK(error); auto channel = grpc_core::ChannelCreate( "binder", client_args, GRPC_CLIENT_DIRECT_CHANNEL, client_transport); - GPR_ASSERT(channel.ok()); + CHECK_OK(channel); return channel->release()->c_ptr(); } diff --git a/test/core/transport/call_filters_test.cc b/test/core/transport/call_filters_test.cc index a2431a909f8..8044aa85610 100644 --- a/test/core/transport/call_filters_test.cc +++ b/test/core/transport/call_filters_test.cc @@ -19,6 +19,8 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "test/core/promise/poll_matcher.h" + using testing::Mock; using testing::StrictMock; @@ -57,34 +59,6 @@ class MockActivity : public Activity, public Wakeable { std::unique_ptr scoped_activity_; }; -MATCHER(IsPending, "") { - if (arg.ready()) { - *result_listener << "is ready"; - return false; - } - return true; -} - -MATCHER(IsReady, "") { - if (arg.pending()) { - *result_listener << "is pending"; - return false; - } - return true; -} - -MATCHER_P(IsReady, value, "") { - if (arg.pending()) { - *result_listener << "is pending"; - return false; - } - if (arg.value() != value) { - *result_listener << "is " << ::testing::PrintToString(arg.value()); - return false; - } - return true; -} - } // namespace //////////////////////////////////////////////////////////////////////////////// diff --git a/test/core/transport/chaotic_good/BUILD b/test/core/transport/chaotic_good/BUILD index c288be7ade5..0a61bcfb488 100644 --- a/test/core/transport/chaotic_good/BUILD +++ b/test/core/transport/chaotic_good/BUILD @@ -77,6 +77,7 @@ grpc_cc_test( name = "frame_test", srcs = ["frame_test.cc"], external_deps = [ + "absl/log:check", "absl/random", "absl/status", "absl/status:statusor", @@ -93,6 +94,7 @@ grpc_proto_fuzzer( srcs = ["frame_fuzzer.cc"], corpus = "frame_fuzzer_corpus", external_deps = [ + "absl/log:check", "absl/random:bit_gen_ref", "absl/status:statusor", ], @@ -221,6 +223,7 @@ grpc_cc_test( name = "chaotic_good_server_test", srcs = ["chaotic_good_server_test.cc"], external_deps = [ + "absl/log:check", "absl/strings", "absl/time", "gtest", diff --git a/test/core/transport/chaotic_good/chaotic_good_server_test.cc b/test/core/transport/chaotic_good/chaotic_good_server_test.cc index 674e2639bb3..db17dfa2b56 100644 --- a/test/core/transport/chaotic_good/chaotic_good_server_test.cc +++ b/test/core/transport/chaotic_good/chaotic_good_server_test.cc @@ -18,6 +18,7 @@ #include #include +#include "absl/log/check.h" #include "absl/strings/str_cat.h" #include "absl/time/time.h" #include "gmock/gmock.h" @@ -66,8 +67,8 @@ class ChaoticGoodServerTest : public ::testing::Test { auto ev = grpc_completion_queue_pluck( shutdown_cq, nullptr, grpc_timeout_milliseconds_to_deadline(15000), nullptr); - GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); - GPR_ASSERT(ev.tag == nullptr); + CHECK(ev.type == GRPC_OP_COMPLETE); + CHECK_EQ(ev.tag, nullptr); grpc_completion_queue_destroy(shutdown_cq); grpc_server_destroy(server_); } @@ -82,8 +83,8 @@ class ChaoticGoodServerTest : public ::testing::Test { void ConstructConnector() { auto uri = URI::Parse("ipv6:" + addr_); - GPR_ASSERT(uri.ok()); - GPR_ASSERT(grpc_parse_uri(*uri, &resolved_addr_)); + CHECK_OK(uri); + CHECK(grpc_parse_uri(*uri, &resolved_addr_)); args_.address = &resolved_addr_; args_.deadline = Timestamp::Now() + Duration::Seconds(5); args_.channel_args = channel_args(); diff --git a/test/core/transport/chaotic_good/client_transport_error_test.cc b/test/core/transport/chaotic_good/client_transport_error_test.cc index bd1e1b77f7a..737f71a7aa2 100644 --- a/test/core/transport/chaotic_good/client_transport_error_test.cc +++ b/test/core/transport/chaotic_good/client_transport_error_test.cc @@ -105,16 +105,19 @@ struct MockPromiseEndpoint { auto SendClientToServerMessages(CallInitiator initiator, int num_messages) { return Loop([initiator, num_messages]() mutable { bool has_message = (num_messages > 0); - return If(has_message, - Seq(initiator.PushMessage(Arena::MakePooled()), - [&num_messages]() -> LoopCtl { - --num_messages; - return Continue(); - }), - [initiator]() mutable -> LoopCtl { - initiator.FinishSends(); - return absl::OkStatus(); - }); + return If( + has_message, + [initiator, &num_messages]() mutable { + return Seq(initiator.PushMessage(Arena::MakePooled()), + [&num_messages]() -> LoopCtl { + --num_messages; + return Continue(); + }); + }, + [initiator]() mutable -> LoopCtl { + initiator.FinishSends(); + return absl::OkStatus(); + }); }); } @@ -130,7 +133,6 @@ class ClientTransportTest : public ::testing::Test { event_engine() { return event_engine_; } - MemoryAllocator* memory_allocator() { return &allocator_; } ChannelArgs MakeChannelArgs() { return CoreConfiguration::Get() @@ -138,6 +140,12 @@ class ClientTransportTest : public ::testing::Test { .PreconditionChannelArgs(nullptr); } + auto MakeCall(ClientMetadataHandle client_initial_metadata) { + auto* arena = call_arena_allocator_->MakeArena(); + return MakeCallPair(std::move(client_initial_metadata), event_engine_.get(), + arena, call_arena_allocator_, nullptr); + } + private: std::shared_ptr event_engine_{ @@ -149,9 +157,12 @@ class ClientTransportTest : public ::testing::Test { return options; }(), fuzzing_event_engine::Actions())}; - MemoryAllocator allocator_ = MakeResourceQuota("test-quota") - ->memory_quota() - ->CreateMemoryAllocator("test-allocator"); + RefCountedPtr call_arena_allocator_{ + MakeRefCounted( + MakeResourceQuota("test-quota") + ->memory_quota() + ->CreateMemoryAllocator("test-allocator"), + 1024)}; }; TEST_F(ClientTransportTest, AddOneStreamWithWriteFailed) { @@ -177,8 +188,7 @@ TEST_F(ClientTransportTest, AddOneStreamWithWriteFailed) { std::move(control_endpoint.promise_endpoint), std::move(data_endpoint.promise_endpoint), MakeChannelArgs(), event_engine(), HPackParser(), HPackCompressor()); - auto call = MakeCall(TestInitialMetadata(), event_engine().get(), - Arena::Create(8192, memory_allocator()), true); + auto call = MakeCall(TestInitialMetadata()); transport->StartCall(call.handler.V2HackToStartCallWithoutACallFilterStack()); call.initiator.SpawnGuarded("test-send", [initiator = call.initiator]() mutable { @@ -222,8 +232,7 @@ TEST_F(ClientTransportTest, AddOneStreamWithReadFailed) { std::move(control_endpoint.promise_endpoint), std::move(data_endpoint.promise_endpoint), MakeChannelArgs(), event_engine(), HPackParser(), HPackCompressor()); - auto call = MakeCall(TestInitialMetadata(), event_engine().get(), - Arena::Create(8192, memory_allocator()), true); + auto call = MakeCall(TestInitialMetadata()); transport->StartCall(call.handler.V2HackToStartCallWithoutACallFilterStack()); call.initiator.SpawnGuarded("test-send", [initiator = call.initiator]() mutable { @@ -275,12 +284,10 @@ TEST_F(ClientTransportTest, AddMultipleStreamWithWriteFailed) { std::move(control_endpoint.promise_endpoint), std::move(data_endpoint.promise_endpoint), MakeChannelArgs(), event_engine(), HPackParser(), HPackCompressor()); - auto call1 = MakeCall(TestInitialMetadata(), event_engine().get(), - Arena::Create(8192, memory_allocator()), true); + auto call1 = MakeCall(TestInitialMetadata()); transport->StartCall( call1.handler.V2HackToStartCallWithoutACallFilterStack()); - auto call2 = MakeCall(TestInitialMetadata(), event_engine().get(), - Arena::Create(8192, memory_allocator()), true); + auto call2 = MakeCall(TestInitialMetadata()); transport->StartCall( call2.handler.V2HackToStartCallWithoutACallFilterStack()); call1.initiator.SpawnGuarded( @@ -347,12 +354,10 @@ TEST_F(ClientTransportTest, AddMultipleStreamWithReadFailed) { std::move(control_endpoint.promise_endpoint), std::move(data_endpoint.promise_endpoint), MakeChannelArgs(), event_engine(), HPackParser(), HPackCompressor()); - auto call1 = MakeCall(TestInitialMetadata(), event_engine().get(), - Arena::Create(8192, memory_allocator()), true); + auto call1 = MakeCall(TestInitialMetadata()); transport->StartCall( call1.handler.V2HackToStartCallWithoutACallFilterStack()); - auto call2 = MakeCall(TestInitialMetadata(), event_engine().get(), - Arena::Create(8192, memory_allocator()), true); + auto call2 = MakeCall(TestInitialMetadata()); transport->StartCall( call2.handler.V2HackToStartCallWithoutACallFilterStack()); call1.initiator.SpawnGuarded( diff --git a/test/core/transport/chaotic_good/client_transport_test.cc b/test/core/transport/chaotic_good/client_transport_test.cc index 3acd0c0c273..b5dc5f823f3 100644 --- a/test/core/transport/chaotic_good/client_transport_test.cc +++ b/test/core/transport/chaotic_good/client_transport_test.cc @@ -15,6 +15,7 @@ #include "src/core/ext/transport/chaotic_good/client_transport.h" #include +#include #include #include #include @@ -78,12 +79,15 @@ auto SendClientToServerMessages(CallInitiator initiator, int num_messages) { bool has_message = (i < num_messages); return If( has_message, - Seq(initiator.PushMessage(Arena::MakePooled( - SliceBuffer(Slice::FromCopiedString(std::to_string(i))), 0)), - [&i]() -> LoopCtl { - ++i; - return Continue(); - }), + [initiator, &i]() mutable { + return Seq( + initiator.PushMessage(Arena::MakePooled( + SliceBuffer(Slice::FromCopiedString(std::to_string(i))), 0)), + [&i]() -> LoopCtl { + ++i; + return Continue(); + }); + }, [initiator]() mutable -> LoopCtl { initiator.FinishSends(); return absl::OkStatus(); @@ -115,8 +119,7 @@ TEST_F(TransportTest, AddOneStream) { std::move(control_endpoint.promise_endpoint), std::move(data_endpoint.promise_endpoint), MakeChannelArgs(), event_engine(), HPackParser(), HPackCompressor()); - auto call = MakeCall(TestInitialMetadata(), event_engine().get(), - Arena::Create(1024, memory_allocator()), true); + auto call = MakeCall(TestInitialMetadata()); transport->StartCall(call.handler.V2HackToStartCallWithoutACallFilterStack()); StrictMock> on_done; EXPECT_CALL(on_done, Call()); @@ -202,8 +205,7 @@ TEST_F(TransportTest, AddOneStreamMultipleMessages) { std::move(control_endpoint.promise_endpoint), std::move(data_endpoint.promise_endpoint), MakeChannelArgs(), event_engine(), HPackParser(), HPackCompressor()); - auto call = MakeCall(TestInitialMetadata(), event_engine().get(), - Arena::Create(8192, memory_allocator()), true); + auto call = MakeCall(TestInitialMetadata()); transport->StartCall(call.handler.V2HackToStartCallWithoutACallFilterStack()); StrictMock> on_done; EXPECT_CALL(on_done, Call()); diff --git a/test/core/transport/chaotic_good/frame_fuzzer.cc b/test/core/transport/chaotic_good/frame_fuzzer.cc index b5a09ab1d80..ff2a7619922 100644 --- a/test/core/transport/chaotic_good/frame_fuzzer.cc +++ b/test/core/transport/chaotic_good/frame_fuzzer.cc @@ -18,6 +18,7 @@ #include #include +#include "absl/log/check.h" #include "absl/random/bit_gen_ref.h" #include "absl/status/statusor.h" @@ -55,8 +56,8 @@ template void AssertRoundTrips(const T& input, FrameType expected_frame_type) { HPackCompressor hpack_compressor; auto serialized = input.Serialize(&hpack_compressor); - GPR_ASSERT(serialized.control.Length() >= - 24); // Initial output buffer size is 64 byte. + CHECK(serialized.control.Length() >= + 24); // Initial output buffer size is 64 byte. uint8_t header_bytes[24]; serialized.control.MoveFirstNBytesIntoBuffer(24, header_bytes); auto header = FrameHeader::Parse(header_bytes); @@ -67,15 +68,15 @@ void AssertRoundTrips(const T& input, FrameType expected_frame_type) { } Crash("Failed to parse header"); } - GPR_ASSERT(header->type == expected_frame_type); + CHECK(header->type == expected_frame_type); T output; HPackParser hpack_parser; DeterministicBitGen bitgen; auto deser = output.Deserialize(&hpack_parser, header.value(), absl::BitGenRef(bitgen), GetContext(), std::move(serialized), FuzzerFrameLimits()); - GPR_ASSERT(deser.ok()); - GPR_ASSERT(output == input); + CHECK_OK(deser); + CHECK(output == input); } template diff --git a/test/core/transport/chaotic_good/frame_test.cc b/test/core/transport/chaotic_good/frame_test.cc index e29df6536cd..15389751a76 100644 --- a/test/core/transport/chaotic_good/frame_test.cc +++ b/test/core/transport/chaotic_good/frame_test.cc @@ -16,6 +16,7 @@ #include +#include "absl/log/check.h" #include "absl/random/random.h" #include "absl/status/status.h" #include "absl/status/statusor.h" @@ -34,15 +35,15 @@ template void AssertRoundTrips(const T& input, FrameType expected_frame_type) { HPackCompressor hpack_compressor; auto serialized = input.Serialize(&hpack_compressor); - GPR_ASSERT(serialized.control.Length() >= - 24); // Initial output buffer size is 64 byte. + CHECK_GE(serialized.control.Length(), + 24); // Initial output buffer size is 64 byte. uint8_t header_bytes[24]; serialized.control.MoveFirstNBytesIntoBuffer(24, header_bytes); auto header = FrameHeader::Parse(header_bytes); if (!header.ok()) { Crash("Failed to parse header"); } - GPR_ASSERT(header->type == expected_frame_type); + CHECK(header->type == expected_frame_type); T output; HPackParser hpack_parser; absl::BitGen bitgen; @@ -53,8 +54,8 @@ void AssertRoundTrips(const T& input, FrameType expected_frame_type) { auto deser = output.Deserialize(&hpack_parser, header.value(), absl::BitGenRef(bitgen), arena.get(), std::move(serialized), TestFrameLimits()); - GPR_ASSERT(deser.ok()); - GPR_ASSERT(output == input); + CHECK_OK(deser); + CHECK(output == input); } TEST(FrameTest, SettingsFrameRoundTrips) { diff --git a/test/core/transport/chaotic_good/server_transport_test.cc b/test/core/transport/chaotic_good/server_transport_test.cc index a4e0272b87c..a5dd0008b9a 100644 --- a/test/core/transport/chaotic_good/server_transport_test.cc +++ b/test/core/transport/chaotic_good/server_transport_test.cc @@ -112,7 +112,7 @@ TEST_F(TransportTest, ReadAndWriteOneMessage) { data_endpoint.ExpectRead( {EventEngineSlice::FromCopiedString("12345678"), Zeros(56)}, nullptr); // Once that's read we'll create a new call - auto* call_arena = Arena::Create(1024, memory_allocator()); + auto* call_arena = MakeArena(); EXPECT_CALL(acceptor, CreateArena).WillOnce(Return(call_arena)); StrictMock> on_done; EXPECT_CALL(acceptor, CreateCall(_, call_arena)) @@ -121,9 +121,9 @@ TEST_F(TransportTest, ReadAndWriteOneMessage) { EXPECT_EQ(client_initial_metadata->get_pointer(HttpPathMetadata()) ->as_string_view(), "/demo.Service/Step"); - CallInitiatorAndHandler call = - MakeCall(std::move(client_initial_metadata), event_engine().get(), - call_arena, true); + CallInitiatorAndHandler call = MakeCallPair( + std::move(client_initial_metadata), event_engine().get(), + call_arena, call_arena_allocator(), nullptr); auto handler = call.handler.V2HackToStartCallWithoutACallFilterStack(); handler.SpawnInfallible("test-io", [&on_done, handler]() mutable { return Seq( diff --git a/test/core/transport/chaotic_good/transport_test.h b/test/core/transport/chaotic_good/transport_test.h index e70158bb8cf..3604be1f190 100644 --- a/test/core/transport/chaotic_good/transport_test.h +++ b/test/core/transport/chaotic_good/transport_test.h @@ -36,7 +36,17 @@ class TransportTest : public ::testing::Test { return event_engine_; } - MemoryAllocator* memory_allocator() { return &allocator_; } + Arena* MakeArena() { return call_arena_allocator_->MakeArena(); } + + RefCountedPtr call_arena_allocator() { + return call_arena_allocator_; + } + + auto MakeCall(ClientMetadataHandle client_initial_metadata) { + auto* arena = call_arena_allocator_->MakeArena(); + return MakeCallPair(std::move(client_initial_metadata), event_engine_.get(), + arena, call_arena_allocator_, nullptr); + } private: std::shared_ptr @@ -49,9 +59,12 @@ class TransportTest : public ::testing::Test { return options; }(), fuzzing_event_engine::Actions())}; - MemoryAllocator allocator_ = MakeResourceQuota("test-quota") - ->memory_quota() - ->CreateMemoryAllocator("test-allocator"); + RefCountedPtr call_arena_allocator_{ + MakeRefCounted( + MakeResourceQuota("test-quota") + ->memory_quota() + ->CreateMemoryAllocator("test-allocator"), + 1024)}; }; grpc_event_engine::experimental::Slice SerializedFrameHeader( diff --git a/test/core/transport/chttp2/flow_control_fuzzer.cc b/test/core/transport/chttp2/flow_control_fuzzer.cc index f599331d818..2b802704208 100644 --- a/test/core/transport/chttp2/flow_control_fuzzer.cc +++ b/test/core/transport/chttp2/flow_control_fuzzer.cc @@ -246,7 +246,7 @@ void FlowControlFuzzer::Perform(const flow_control_fuzzer::Action& action) { bdp->AddIncomingBytes(stream_write.size); } StreamFlowControl::IncomingUpdateContext upd(&stream->fc); - CHECK(upd.RecvData(stream_write.size).ok()); + CHECK_OK(upd.RecvData(stream_write.size)); PerformAction(upd.MakeAction(), stream); } send_from_remote_.pop_front(); diff --git a/test/core/transport/chttp2/graceful_shutdown_test.cc b/test/core/transport/chttp2/graceful_shutdown_test.cc index e0294aebee8..44b60b7cf6b 100644 --- a/test/core/transport/chttp2/graceful_shutdown_test.cc +++ b/test/core/transport/chttp2/graceful_shutdown_test.cc @@ -44,11 +44,11 @@ #include #include +#include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/ext/transport/chttp2/transport/frame_goaway.h" #include "src/core/ext/transport/chttp2/transport/frame_ping.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/channelz.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/notification.h" diff --git a/test/core/transport/chttp2/remove_stream_from_stalled_lists_test.cc b/test/core/transport/chttp2/remove_stream_from_stalled_lists_test.cc index 3cdb2d9940f..7312bd27b78 100644 --- a/test/core/transport/chttp2/remove_stream_from_stalled_lists_test.cc +++ b/test/core/transport/chttp2/remove_stream_from_stalled_lists_test.cc @@ -200,7 +200,7 @@ class TestServer { grpc_call_error error = grpc_server_request_call( server_, &call, &call_details, &request_metadata_recv, call_cq, cq_, request_call_tag); - CHECK(error == GRPC_CALL_OK); + CHECK_EQ(error, GRPC_CALL_OK); } } grpc_event event = grpc_completion_queue_next( diff --git a/test/core/transport/chttp2/stream_leak_with_queued_flow_control_update_test.cc b/test/core/transport/chttp2/stream_leak_with_queued_flow_control_update_test.cc index 423ed40e584..c60ff6e240a 100644 --- a/test/core/transport/chttp2/stream_leak_with_queued_flow_control_update_test.cc +++ b/test/core/transport/chttp2/stream_leak_with_queued_flow_control_update_test.cc @@ -80,7 +80,7 @@ class TestServer { grpc_call* call; grpc_call_error error = grpc_server_request_call( server_, &call, &call_details, &request_metadata_recv, cq_, cq_, tag); - CHECK(error == GRPC_CALL_OK); + CHECK_EQ(error, GRPC_CALL_OK); grpc_event event = grpc_completion_queue_next( cq_, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); CHECK(event.type == GRPC_OP_COMPLETE); @@ -112,7 +112,7 @@ class TestServer { op++; error = grpc_call_start_batch(call, ops, static_cast(op - ops), tag, nullptr); - CHECK(error == GRPC_CALL_OK); + CHECK_EQ(error, GRPC_CALL_OK); event = grpc_completion_queue_next(cq_, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); CHECK(event.type == GRPC_OP_COMPLETE); diff --git a/test/core/transport/chttp2/streams_not_seen_test.cc b/test/core/transport/chttp2/streams_not_seen_test.cc index fe1626d48f4..55719646187 100644 --- a/test/core/transport/chttp2/streams_not_seen_test.cc +++ b/test/core/transport/chttp2/streams_not_seen_test.cc @@ -365,7 +365,7 @@ class StreamsNotSeenTest : public ::testing::Test { } static void OnWriteDone(void* arg, grpc_error_handle error) { - CHECK(error.ok()); + CHECK_OK(error); Notification* on_write_done_notification_ = static_cast(arg); on_write_done_notification_->Notify(); } diff --git a/test/core/transport/chttp2/too_many_pings_test.cc b/test/core/transport/chttp2/too_many_pings_test.cc index 474e2edb4b3..956cab7d394 100644 --- a/test/core/transport/chttp2/too_many_pings_test.cc +++ b/test/core/transport/chttp2/too_many_pings_test.cc @@ -442,7 +442,7 @@ grpc_core::Resolver::Result BuildResolverResult( if (!uri.ok()) { gpr_log(GPR_ERROR, "Failed to parse uri. Error: %s", uri.status().ToString().c_str()); - CHECK(uri.ok()); + CHECK_OK(uri); } grpc_resolved_address address; CHECK(grpc_parse_uri(*uri, &address)); @@ -702,8 +702,8 @@ void PerformCallWithResponsePayload(grpc_channel* channel, grpc_server* server, cqv.Verify(); CHECK(status == GRPC_STATUS_OK); - CHECK(0 == grpc_slice_str_cmp(details, "xyz")); - CHECK(0 == grpc_slice_str_cmp(call_details.method, "/foo")); + CHECK_EQ(grpc_slice_str_cmp(details, "xyz"), 0); + CHECK_EQ(grpc_slice_str_cmp(call_details.method, "/foo"), 0); CHECK_EQ(was_cancelled, 0); CHECK(byte_buffer_eq_slice(response_payload_recv, response_payload_slice)); diff --git a/test/core/transport/interception_chain_test.cc b/test/core/transport/interception_chain_test.cc new file mode 100644 index 00000000000..f72fd59e019 --- /dev/null +++ b/test/core/transport/interception_chain_test.cc @@ -0,0 +1,406 @@ +// Copyright 2024 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/transport/interception_chain.h" + +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include + +#include "src/core/lib/channel/promise_based_filter.h" +#include "src/core/lib/resource_quota/resource_quota.h" +#include "test/core/promise/poll_matcher.h" + +namespace grpc_core { +namespace { + +/////////////////////////////////////////////////////////////////////////////// +// Mutate metadata by annotating that it passed through a filter "x" + +void AnnotatePassedThrough(ClientMetadata& md, int x) { + md.Append(absl::StrCat("passed-through-", x), Slice::FromCopiedString("true"), + [](absl::string_view, const Slice&) { Crash("unreachable"); }); +} + +/////////////////////////////////////////////////////////////////////////////// +// CreationLog helps us reason about filter creation order by logging a small +// record of each filter's creation. + +struct CreationLogEntry { + size_t filter_instance_id; + size_t type_tag; + + bool operator==(const CreationLogEntry& other) const { + return filter_instance_id == other.filter_instance_id && + type_tag == other.type_tag; + } + + friend std::ostream& operator<<(std::ostream& os, + const CreationLogEntry& entry) { + return os << "{filter_instance_id=" << entry.filter_instance_id + << ", type_tag=" << entry.type_tag << "}"; + } +}; + +struct CreationLog { + struct RawPointerChannelArgTag {}; + static absl::string_view ChannelArgName() { return "creation_log"; } + std::vector entries; +}; + +void MaybeLogCreation(const ChannelArgs& channel_args, + ChannelFilter::Args filter_args, size_t type_tag) { + auto* log = channel_args.GetPointer("creation_log"); + if (log == nullptr) return; + log->entries.push_back(CreationLogEntry{filter_args.instance_id(), type_tag}); +} + +/////////////////////////////////////////////////////////////////////////////// +// Test call filter + +template +class TestFilter { + public: + class Call { + public: + void OnClientInitialMetadata(ClientMetadata& md) { + AnnotatePassedThrough(md, I); + } + static const NoInterceptor OnServerInitialMetadata; + static const NoInterceptor OnClientToServerMessage; + static const NoInterceptor OnServerToClientMessage; + static const NoInterceptor OnServerTrailingMetadata; + static const NoInterceptor OnFinalize; + }; + + static absl::StatusOr>> Create( + const ChannelArgs& channel_args, ChannelFilter::Args filter_args) { + MaybeLogCreation(channel_args, filter_args, I); + return std::make_unique>(); + } + + private: + std::unique_ptr i_ = std::make_unique(I); +}; + +template +const NoInterceptor TestFilter::Call::OnServerInitialMetadata; +template +const NoInterceptor TestFilter::Call::OnClientToServerMessage; +template +const NoInterceptor TestFilter::Call::OnServerToClientMessage; +template +const NoInterceptor TestFilter::Call::OnServerTrailingMetadata; +template +const NoInterceptor TestFilter::Call::OnFinalize; + +/////////////////////////////////////////////////////////////////////////////// +// Test call filter that fails to instantiate + +template +class FailsToInstantiateFilter { + public: + class Call { + public: + static const NoInterceptor OnClientInitialMetadata; + static const NoInterceptor OnServerInitialMetadata; + static const NoInterceptor OnClientToServerMessage; + static const NoInterceptor OnServerToClientMessage; + static const NoInterceptor OnServerTrailingMetadata; + static const NoInterceptor OnFinalize; + }; + + static absl::StatusOr>> Create( + const ChannelArgs& channel_args, ChannelFilter::Args filter_args) { + MaybeLogCreation(channel_args, filter_args, I); + return absl::InternalError(absl::StrCat("👊 failed to instantiate ", I)); + } +}; + +template +const NoInterceptor FailsToInstantiateFilter::Call::OnClientInitialMetadata; +template +const NoInterceptor FailsToInstantiateFilter::Call::OnServerInitialMetadata; +template +const NoInterceptor FailsToInstantiateFilter::Call::OnClientToServerMessage; +template +const NoInterceptor FailsToInstantiateFilter::Call::OnServerToClientMessage; +template +const NoInterceptor FailsToInstantiateFilter::Call::OnServerTrailingMetadata; +template +const NoInterceptor FailsToInstantiateFilter::Call::OnFinalize; + +/////////////////////////////////////////////////////////////////////////////// +// Test call interceptor - consumes calls + +template +class TestConsumingInterceptor final : public Interceptor { + public: + void StartCall(UnstartedCallHandler unstarted_call_handler) override { + Consume(std::move(unstarted_call_handler)) + .PushServerTrailingMetadata( + ServerMetadataFromStatus(absl::InternalError("👊 consumed"))); + } + void Orphaned() override {} + static absl::StatusOr>> Create( + const ChannelArgs& channel_args, ChannelFilter::Args filter_args) { + MaybeLogCreation(channel_args, filter_args, I); + return MakeRefCounted>(); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// Test call interceptor - fails to instantiate + +template +class TestFailingInterceptor final : public Interceptor { + public: + void StartCall(UnstartedCallHandler unstarted_call_handler) override { + Crash("unreachable"); + } + void Orphaned() override {} + static absl::StatusOr>> Create( + const ChannelArgs& channel_args, ChannelFilter::Args filter_args) { + MaybeLogCreation(channel_args, filter_args, I); + return absl::InternalError(absl::StrCat("👊 failed to instantiate ", I)); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// Test call interceptor - hijacks calls + +template +class TestHijackingInterceptor final : public Interceptor { + public: + void StartCall(UnstartedCallHandler unstarted_call_handler) override { + unstarted_call_handler.SpawnInfallible( + "hijack", [this, unstarted_call_handler]() mutable { + return Map(Hijack(std::move(unstarted_call_handler)), + [](ValueOrFailure hijacked_call) { + ForwardCall( + hijacked_call.value().original_call_handler(), + hijacked_call.value().MakeCall()); + return Empty{}; + }); + }); + } + void Orphaned() override {} + static absl::StatusOr>> Create( + const ChannelArgs& channel_args, ChannelFilter::Args filter_args) { + MaybeLogCreation(channel_args, filter_args, I); + return MakeRefCounted>(); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// Test fixture + +class InterceptionChainTest : public ::testing::Test { + protected: + InterceptionChainTest() {} + ~InterceptionChainTest() override {} + + RefCountedPtr destination() { return destination_; } + + struct FinishedCall { + CallInitiator call; + ClientMetadataHandle client_metadata; + ServerMetadataHandle server_metadata; + }; + + // Run a call through a UnstartedCallDestination until it's complete. + FinishedCall RunCall(UnstartedCallDestination* destination) { + auto* arena = call_arena_allocator_->MakeArena(); + auto call = MakeCallPair(Arena::MakePooled(), nullptr, + arena, call_arena_allocator_, nullptr); + Poll trailing_md; + call.initiator.SpawnInfallible( + "run_call", [destination, &call, &trailing_md]() mutable { + gpr_log(GPR_INFO, "👊 start call"); + destination->StartCall(std::move(call.handler)); + return Map(call.initiator.PullServerTrailingMetadata(), + [&trailing_md](ServerMetadataHandle md) { + trailing_md = std::move(md); + return Empty{}; + }); + }); + EXPECT_THAT(trailing_md, IsReady()); + return FinishedCall{std::move(call.initiator), destination_->TakeMetadata(), + std::move(trailing_md.value())}; + } + + private: + class Destination final : public UnstartedCallDestination { + public: + void StartCall(UnstartedCallHandler unstarted_call_handler) override { + gpr_log(GPR_INFO, "👊 started call: metadata=%s", + unstarted_call_handler.UnprocessedClientInitialMetadata() + .DebugString() + .c_str()); + EXPECT_EQ(metadata_.get(), nullptr); + metadata_ = Arena::MakePooled(); + *metadata_ = + unstarted_call_handler.UnprocessedClientInitialMetadata().Copy(); + unstarted_call_handler.PushServerTrailingMetadata( + ServerMetadataFromStatus(absl::InternalError("👊 cancelled"))); + } + + void Orphaned() override {} + + ClientMetadataHandle TakeMetadata() { return std::move(metadata_); } + + private: + ClientMetadataHandle metadata_; + }; + RefCountedPtr destination_ = MakeRefCounted(); + RefCountedPtr call_arena_allocator_ = + MakeRefCounted( + ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator( + "test"), + 1024); +}; + +/////////////////////////////////////////////////////////////////////////////// +// Tests begin + +TEST_F(InterceptionChainTest, Empty) { + auto r = InterceptionChainBuilder(ChannelArgs()).Build(destination()); + ASSERT_TRUE(r.ok()) << r.status(); + auto finished_call = RunCall(r.value().get()); + EXPECT_EQ(finished_call.server_metadata->get(GrpcStatusMetadata()), + GRPC_STATUS_INTERNAL); + EXPECT_EQ(finished_call.server_metadata->get_pointer(GrpcMessageMetadata()) + ->as_string_view(), + "👊 cancelled"); + EXPECT_NE(finished_call.client_metadata, nullptr); +} + +TEST_F(InterceptionChainTest, Consumed) { + auto r = InterceptionChainBuilder(ChannelArgs()) + .Add>() + .Build(destination()); + ASSERT_TRUE(r.ok()) << r.status(); + auto finished_call = RunCall(r.value().get()); + EXPECT_EQ(finished_call.server_metadata->get(GrpcStatusMetadata()), + GRPC_STATUS_INTERNAL); + EXPECT_EQ(finished_call.server_metadata->get_pointer(GrpcMessageMetadata()) + ->as_string_view(), + "👊 consumed"); + EXPECT_EQ(finished_call.client_metadata, nullptr); +} + +TEST_F(InterceptionChainTest, Hijacked) { + auto r = InterceptionChainBuilder(ChannelArgs()) + .Add>() + .Build(destination()); + ASSERT_TRUE(r.ok()) << r.status(); + auto finished_call = RunCall(r.value().get()); + EXPECT_EQ(finished_call.server_metadata->get(GrpcStatusMetadata()), + GRPC_STATUS_INTERNAL); + EXPECT_EQ(finished_call.server_metadata->get_pointer(GrpcMessageMetadata()) + ->as_string_view(), + "👊 cancelled"); + EXPECT_NE(finished_call.client_metadata, nullptr); +} + +TEST_F(InterceptionChainTest, FiltersThenHijacked) { + auto r = InterceptionChainBuilder(ChannelArgs()) + .Add>() + .Add>() + .Build(destination()); + ASSERT_TRUE(r.ok()) << r.status(); + auto finished_call = RunCall(r.value().get()); + EXPECT_EQ(finished_call.server_metadata->get(GrpcStatusMetadata()), + GRPC_STATUS_INTERNAL); + EXPECT_EQ(finished_call.server_metadata->get_pointer(GrpcMessageMetadata()) + ->as_string_view(), + "👊 cancelled"); + EXPECT_NE(finished_call.client_metadata, nullptr); + std::string backing; + EXPECT_EQ(finished_call.client_metadata->GetStringValue("passed-through-1", + &backing), + "true"); +} + +TEST_F(InterceptionChainTest, FailsToInstantiateInterceptor) { + auto r = InterceptionChainBuilder(ChannelArgs()) + .Add>() + .Build(destination()); + EXPECT_FALSE(r.ok()); + EXPECT_EQ(r.status().code(), absl::StatusCode::kInternal); + EXPECT_EQ(r.status().message(), "👊 failed to instantiate 1"); +} + +TEST_F(InterceptionChainTest, FailsToInstantiateInterceptor2) { + auto r = InterceptionChainBuilder(ChannelArgs()) + .Add>() + .Add>() + .Build(destination()); + EXPECT_FALSE(r.ok()); + EXPECT_EQ(r.status().code(), absl::StatusCode::kInternal); + EXPECT_EQ(r.status().message(), "👊 failed to instantiate 2"); +} + +TEST_F(InterceptionChainTest, FailsToInstantiateFilter) { + auto r = InterceptionChainBuilder(ChannelArgs()) + .Add>() + .Build(destination()); + EXPECT_FALSE(r.ok()); + EXPECT_EQ(r.status().code(), absl::StatusCode::kInternal); + EXPECT_EQ(r.status().message(), "👊 failed to instantiate 1"); +} + +TEST_F(InterceptionChainTest, FailsToInstantiateFilter2) { + auto r = InterceptionChainBuilder(ChannelArgs()) + .Add>() + .Add>() + .Build(destination()); + EXPECT_FALSE(r.ok()); + EXPECT_EQ(r.status().code(), absl::StatusCode::kInternal); + EXPECT_EQ(r.status().message(), "👊 failed to instantiate 2"); +} + +TEST_F(InterceptionChainTest, CreationOrderCorrect) { + CreationLog log; + auto r = InterceptionChainBuilder(ChannelArgs().SetObject(&log)) + .Add>() + .Add>() + .Add>() + .Add>() + .Add>() + .Add>() + .Add>() + .Add>() + .Add>() + .Build(destination()); + EXPECT_THAT(log.entries, ::testing::ElementsAre( + CreationLogEntry{0, 1}, CreationLogEntry{0, 2}, + CreationLogEntry{0, 3}, CreationLogEntry{0, 4}, + CreationLogEntry{1, 1}, CreationLogEntry{1, 2}, + CreationLogEntry{1, 3}, CreationLogEntry{1, 4}, + CreationLogEntry{2, 1})); +} + +} // namespace +} // namespace grpc_core + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + grpc_tracer_init(); + gpr_log_verbosity_init(); + return RUN_ALL_TESTS(); +} diff --git a/test/core/transport/parsed_metadata_test.cc b/test/core/transport/parsed_metadata_test.cc index 458df652bb4..3b54fe2b535 100644 --- a/test/core/transport/parsed_metadata_test.cc +++ b/test/core/transport/parsed_metadata_test.cc @@ -18,6 +18,7 @@ #include +#include "absl/log/check.h" #include "absl/strings/numbers.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -55,7 +56,7 @@ struct Int32Trait { static int32_t MementoToValue(int32_t memento) { return memento; } static int32_t ParseMemento(Slice slice, bool, MetadataParseErrorFn) { int32_t out; - GPR_ASSERT(absl::SimpleAtoi(slice.as_string_view(), &out)); + CHECK(absl::SimpleAtoi(slice.as_string_view(), &out)); return out; } static std::string DisplayValue(int32_t value) { @@ -75,7 +76,7 @@ struct Int64Trait { static int64_t MementoToValue(int64_t memento) { return -memento; } static int64_t ParseMemento(Slice slice, bool, MetadataParseErrorFn) { int64_t out; - GPR_ASSERT(absl::SimpleAtoi(slice.as_string_view(), &out)); + CHECK(absl::SimpleAtoi(slice.as_string_view(), &out)); return out; } static std::string DisplayValue(int64_t value) { @@ -95,7 +96,7 @@ struct IntptrTrait { static intptr_t MementoToValue(intptr_t memento) { return memento / 2; } static intptr_t ParseMemento(Slice slice, bool, MetadataParseErrorFn) { intptr_t out; - GPR_ASSERT(absl::SimpleAtoi(slice.as_string_view(), &out)); + CHECK(absl::SimpleAtoi(slice.as_string_view(), &out)); return out; } static std::string DisplayValue(intptr_t value) { diff --git a/test/core/transport/test_suite/BUILD b/test/core/transport/test_suite/BUILD index 4bc8d7fcaa2..c42b8c6ece4 100644 --- a/test/core/transport/test_suite/BUILD +++ b/test/core/transport/test_suite/BUILD @@ -48,7 +48,10 @@ grpc_cc_library( name = "chaotic_good_fixture", testonly = 1, srcs = ["chaotic_good_fixture.cc"], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], deps = [ "fixture", "//src/core:chaotic_good_client_transport", diff --git a/test/core/transport/test_suite/chaotic_good_fixture.cc b/test/core/transport/test_suite/chaotic_good_fixture.cc index d13ac3964bb..e1e0baff5e9 100644 --- a/test/core/transport/test_suite/chaotic_good_fixture.cc +++ b/test/core/transport/test_suite/chaotic_good_fixture.cc @@ -14,6 +14,7 @@ #include +#include "absl/log/check.h" #include "gmock/gmock.h" #include "src/core/ext/transport/chaotic_good/client_transport.h" @@ -67,13 +68,13 @@ EndpointPair CreateEndpointPair( [](absl::Status) {}, endpoint_config, std::make_unique( resource_quota->memory_quota())); - GPR_ASSERT(listener->Bind(resolved_address).ok()); - GPR_ASSERT(listener->Start().ok()); + CHECK_OK(listener->Bind(resolved_address)); + CHECK_OK(listener->Start()); event_engine->Connect( [&client_endpoint]( absl::StatusOr> endpoint) { - GPR_ASSERT(endpoint.ok()); + CHECK_OK(endpoint); client_endpoint = std::move(endpoint).value(); }, resolved_address, endpoint_config, diff --git a/test/core/transport/test_suite/fuzzer_main.cc b/test/core/transport/test_suite/fuzzer_main.cc index 3ee0fc65297..45a73e97afc 100644 --- a/test/core/transport/test_suite/fuzzer_main.cc +++ b/test/core/transport/test_suite/fuzzer_main.cc @@ -16,6 +16,8 @@ #include +#include "absl/log/check.h" + #include #include @@ -37,8 +39,8 @@ static void dont_log(gpr_log_func_args* /*args*/) {} DEFINE_PROTO_FUZZER(const transport_test_suite::Msg& msg) { const auto& tests = grpc_core::TransportTestRegistry::Get().tests(); const auto& fixtures = grpc_core::TransportFixtureRegistry::Get().fixtures(); - GPR_ASSERT(!tests.empty()); - GPR_ASSERT(!fixtures.empty()); + CHECK(!tests.empty()); + CHECK(!fixtures.empty()); const int test_id = msg.test_id() % tests.size(); const int fixture_id = msg.fixture_id() % fixtures.size(); @@ -62,5 +64,5 @@ DEFINE_PROTO_FUZZER(const transport_test_suite::Msg& msg) { msg.event_engine_actions(), bitgen); test->RunTest(); delete test; - GPR_ASSERT(!::testing::Test::HasFailure()); + CHECK(!::testing::Test::HasFailure()); } diff --git a/test/core/transport/test_suite/grpc_transport_test.bzl b/test/core/transport/test_suite/grpc_transport_test.bzl index 071b02e48e3..9bd94d33e79 100644 --- a/test/core/transport/test_suite/grpc_transport_test.bzl +++ b/test/core/transport/test_suite/grpc_transport_test.bzl @@ -35,6 +35,7 @@ def grpc_transport_test(name, deps): srcs = ["fuzzer_main.cc"], tags = ["no_windows", "no_mac"], external_deps = [ + "absl/log:check", "gtest", ], deps = [ diff --git a/test/core/transport/test_suite/test.cc b/test/core/transport/test_suite/test.cc index 7dc767810d7..e170c9acda6 100644 --- a/test/core/transport/test_suite/test.cc +++ b/test/core/transport/test_suite/test.cc @@ -58,8 +58,7 @@ void TransportTest::SetServerAcceptor() { CallInitiator TransportTest::CreateCall( ClientMetadataHandle client_initial_metadata) { - auto call = MakeCall(std::move(client_initial_metadata), event_engine_.get(), - Arena::Create(1024, &allocator_), true); + auto call = MakeCall(std::move(client_initial_metadata)); call.handler.SpawnInfallible( "start-call", [this, handler = call.handler]() mutable { transport_pair_.client->client_transport()->StartCall( @@ -231,13 +230,14 @@ std::string TransportTest::RandomMessage() { // TransportTest::Acceptor Arena* TransportTest::Acceptor::CreateArena() { - return Arena::Create(1024, allocator_); + return test_->call_arena_allocator_->MakeArena(); } absl::StatusOr TransportTest::Acceptor::CreateCall( ClientMetadataHandle client_initial_metadata, Arena* arena) { - auto call = - MakeCall(std::move(client_initial_metadata), event_engine_, arena, true); + auto call = MakeCallPair(std::move(client_initial_metadata), + test_->event_engine_.get(), arena, + test_->call_arena_allocator_, nullptr); handlers_.push(call.handler.V2HackToStartCallWithoutACallFilterStack()); return std::move(call.initiator); } diff --git a/test/core/transport/test_suite/test.h b/test/core/transport/test_suite/test.h index 5b0862a2744..1add21cdd29 100644 --- a/test/core/transport/test_suite/test.h +++ b/test/core/transport/test_suite/test.h @@ -86,10 +86,11 @@ class ActionState { explicit ActionState(NameAndLocation name_and_location); State Get() const { return state_; } - void Set(State state) { + void Set(State state, SourceLocation whence = {}) { gpr_log(GPR_INFO, "%s", absl::StrCat(StateString(state), " ", name(), " [", step(), "] ", - file(), ":", line()) + file(), ":", line(), " @ ", whence.file(), ":", + whence.line()) .c_str()); state_ = state; } @@ -237,6 +238,12 @@ class TransportTest : public ::testing::Test { CallHandler TickUntilServerCall(); void WaitForAllPendingWork(); + auto MakeCall(ClientMetadataHandle client_initial_metadata) { + auto* arena = call_arena_allocator_->MakeArena(); + return MakeCallPair(std::move(client_initial_metadata), event_engine_.get(), + arena, call_arena_allocator_, nullptr); + } + // Alternative for Seq for test driver code. // Registers each step so that WaitForAllPendingWork() can report progress, // and wait for completion... AND generate good failure messages when a @@ -265,9 +272,7 @@ class TransportTest : public ::testing::Test { class Acceptor final : public ServerTransport::Acceptor { public: - Acceptor(grpc_event_engine::experimental::EventEngine* event_engine, - MemoryAllocator* allocator) - : event_engine_(event_engine), allocator_(allocator) {} + explicit Acceptor(TransportTest* test) : test_(test) {} Arena* CreateArena() override; absl::StatusOr CreateCall( @@ -276,8 +281,7 @@ class TransportTest : public ::testing::Test { private: std::queue handlers_; - grpc_event_engine::experimental::EventEngine* const event_engine_; - MemoryAllocator* const allocator_; + TransportTest* const test_; }; class WatchDog { @@ -303,10 +307,13 @@ class TransportTest : public ::testing::Test { }(), fuzzing_event_engine::Actions())}; std::unique_ptr fixture_; - MemoryAllocator allocator_ = MakeResourceQuota("test-quota") - ->memory_quota() - ->CreateMemoryAllocator("test-allocator"); - Acceptor acceptor_{event_engine_.get(), &allocator_}; + RefCountedPtr call_arena_allocator_{ + MakeRefCounted( + MakeResourceQuota("test-quota") + ->memory_quota() + ->CreateMemoryAllocator("test-allocator"), + 1024)}; + Acceptor acceptor_{this}; TransportFixture::ClientAndServerTransportPair transport_pair_ = fixture_->CreateTransportPair(event_engine_); std::queue> diff --git a/test/core/tsi/BUILD b/test/core/tsi/BUILD index 3035e3c7415..19de13ce628 100644 --- a/test/core/tsi/BUILD +++ b/test/core/tsi/BUILD @@ -52,6 +52,7 @@ grpc_cc_test( name = "ssl_session_cache_test", srcs = ["ssl_session_cache_test.cc"], external_deps = [ + "absl/log:check", "gtest", ], language = "C++", @@ -148,6 +149,7 @@ grpc_cc_test( "//test/core/tsi/test_creds/crl_data/crls_missing_root:b9322cac.r0", ], external_deps = [ + "absl/log:check", "gtest", ], language = "C++", diff --git a/test/core/tsi/alts/fake_handshaker/BUILD b/test/core/tsi/alts/fake_handshaker/BUILD index bd10037a708..8e5fc464836 100644 --- a/test/core/tsi/alts/fake_handshaker/BUILD +++ b/test/core/tsi/alts/fake_handshaker/BUILD @@ -41,6 +41,9 @@ grpc_cc_library( testonly = True, srcs = ["fake_handshaker_server.cc"], hdrs = ["fake_handshaker_server.h"], + external_deps = [ + "absl/log:check", + ], language = "C++", deps = [ "handshaker_proto", @@ -55,6 +58,7 @@ grpc_cc_binary( srcs = ["fake_handshaker_server_main.cc"], external_deps = [ "absl/flags:flag", + "absl/log:check", ], language = "C++", deps = [ diff --git a/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc b/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc index 3a914af47f4..a333fd85417 100644 --- a/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc +++ b/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc @@ -21,6 +21,7 @@ #include #include +#include "absl/log/check.h" #include "absl/strings/str_format.h" #include @@ -96,7 +97,8 @@ class FakeHandshakerService : public HandshakerService::Service { Status ProcessRequest(HandshakerContext* context, const HandshakerReq& request, HandshakerResp* response) { - GPR_ASSERT(context != nullptr && response != nullptr); + CHECK(context != nullptr); + CHECK_NE(response, nullptr); response->Clear(); if (request.has_client_start()) { gpr_log(GPR_DEBUG, "Process client start request."); @@ -114,7 +116,8 @@ class FakeHandshakerService : public HandshakerService::Service { Status ProcessClientStart(HandshakerContext* context, const StartClientHandshakeReq& request, HandshakerResp* response) { - GPR_ASSERT(context != nullptr && response != nullptr); + CHECK(context != nullptr); + CHECK_NE(response, nullptr); // Checks request. if (context->state != INITIAL) { return Status(StatusCode::FAILED_PRECONDITION, kWrongStateError); @@ -140,7 +143,8 @@ class FakeHandshakerService : public HandshakerService::Service { Status ProcessServerStart(HandshakerContext* context, const StartServerHandshakeReq& request, HandshakerResp* response) { - GPR_ASSERT(context != nullptr && response != nullptr); + CHECK(context != nullptr); + CHECK_NE(response, nullptr); // Checks request. if (context->state != INITIAL) { return Status(StatusCode::FAILED_PRECONDITION, kWrongStateError); @@ -176,7 +180,8 @@ class FakeHandshakerService : public HandshakerService::Service { Status ProcessNext(HandshakerContext* context, const NextHandshakeMessageReq& request, HandshakerResp* response) { - GPR_ASSERT(context != nullptr && response != nullptr); + CHECK(context != nullptr); + CHECK_NE(response, nullptr); if (context->is_client) { // Processes next request on client side. if (context->state != SENT) { @@ -222,7 +227,7 @@ class FakeHandshakerService : public HandshakerService::Service { Status WriteErrorResponse( ServerReaderWriter* stream, const Status& status) { - GPR_ASSERT(!status.ok()); + CHECK(!status.ok()); HandshakerResp response; response.mutable_status()->set_code(status.error_code()); response.mutable_status()->set_details(status.error_message()); diff --git a/test/core/tsi/alts/fake_handshaker/fake_handshaker_server_main.cc b/test/core/tsi/alts/fake_handshaker/fake_handshaker_server_main.cc index ac37e0f38ab..f427c616f01 100644 --- a/test/core/tsi/alts/fake_handshaker/fake_handshaker_server_main.cc +++ b/test/core/tsi/alts/fake_handshaker/fake_handshaker_server_main.cc @@ -18,6 +18,7 @@ #include #include "absl/flags/flag.h" +#include "absl/log/check.h" #include #include @@ -49,7 +50,7 @@ int main(int argc, char** argv) { grpc::testing::TestEnvironment env(&argc, argv); grpc::testing::InitTest(&argc, &argv, true); - GPR_ASSERT(absl::GetFlag(FLAGS_handshaker_port) != 0); + CHECK_NE(absl::GetFlag(FLAGS_handshaker_port), 0); std::ostringstream server_address; server_address << "[::1]:" << absl::GetFlag(FLAGS_handshaker_port); diff --git a/test/core/tsi/alts/handshaker/BUILD b/test/core/tsi/alts/handshaker/BUILD index eb390047a26..d50ea24f9e4 100644 --- a/test/core/tsi/alts/handshaker/BUILD +++ b/test/core/tsi/alts/handshaker/BUILD @@ -81,7 +81,10 @@ grpc_cc_test( srcs = [ "alts_concurrent_connectivity_test.cc", ], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], flaky = True, language = "C++", # TODO(apolcyn): make the fake TCP server used in this diff --git a/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc b/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc index e703c2a1fa8..5ed92950ea3 100644 --- a/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc +++ b/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc @@ -31,6 +31,7 @@ #include +#include "absl/log/check.h" #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" @@ -143,8 +144,8 @@ class TestServer { grpc_server_register_completion_queue(server_, server_cq_, nullptr); int port = grpc_pick_unused_port_or_die(); server_addr_ = grpc_core::JoinHostPort("localhost", port); - GPR_ASSERT(grpc_server_add_http2_port(server_, server_addr_.c_str(), - server_creds)); + CHECK(grpc_server_add_http2_port(server_, server_addr_.c_str(), + server_creds)); grpc_server_credentials_release(server_creds); grpc_server_start(server_); gpr_log(GPR_DEBUG, "Start TestServer %p. listen on %s", this, @@ -167,8 +168,8 @@ class TestServer { static void PollUntilShutdown(const TestServer* self) { grpc_event ev = grpc_completion_queue_next( self->server_cq_, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); - GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); - GPR_ASSERT(ev.tag == self); + CHECK(ev.type == GRPC_OP_COMPLETE); + CHECK(ev.tag == self); gpr_log(GPR_DEBUG, "TestServer %p stop polling", self); } diff --git a/test/core/tsi/crl_ssl_transport_security_test.cc b/test/core/tsi/crl_ssl_transport_security_test.cc index 93018a818d0..bc2f56822c8 100644 --- a/test/core/tsi/crl_ssl_transport_security_test.cc +++ b/test/core/tsi/crl_ssl_transport_security_test.cc @@ -22,6 +22,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" @@ -114,7 +115,7 @@ class CrlSslTransportSecurityTest gpr_malloc(sizeof(tsi_ssl_pem_key_cert_pair))); client_pem_key_cert_pairs_[0].private_key = client_key_.c_str(); client_pem_key_cert_pairs_[0].cert_chain = client_cert_.c_str(); - GPR_ASSERT(root_store_ != nullptr); + CHECK_NE(root_store_, nullptr); } void Run() { @@ -133,7 +134,7 @@ class CrlSslTransportSecurityTest private: static void SetupHandshakers(tsi_test_fixture* fixture) { - GPR_ASSERT(fixture != nullptr); + CHECK_NE(fixture, nullptr); auto* self = reinterpret_cast(fixture); self->SetupHandshakers(); } @@ -178,7 +179,7 @@ class CrlSslTransportSecurityTest } static void CheckHandshakerPeers(tsi_test_fixture* fixture) { - GPR_ASSERT(fixture != nullptr); + CHECK_NE(fixture, nullptr); auto* self = reinterpret_cast(fixture); self->CheckHandshakerPeers(); } @@ -420,7 +421,7 @@ TEST_P(CrlSslTransportSecurityTest, std::string TestNameSuffix( const ::testing::TestParamInfo& version) { if (version.param == tsi_tls_version::TSI_TLS1_2) return "TLS_1_2"; - GPR_ASSERT(version.param == tsi_tls_version::TSI_TLS1_3); + CHECK(version.param == tsi_tls_version::TSI_TLS1_3); return "TLS_1_3"; } diff --git a/test/core/tsi/ssl_session_cache_test.cc b/test/core/tsi/ssl_session_cache_test.cc index 5890f15bc63..1dcdeef5980 100644 --- a/test/core/tsi/ssl_session_cache_test.cc +++ b/test/core/tsi/ssl_session_cache_test.cc @@ -23,6 +23,8 @@ #include +#include "absl/log/check.h" + #include #include @@ -49,7 +51,7 @@ class SessionTracker { tsi::SslSessionPtr NewSession(long id) { static int ex_data_id = SSL_SESSION_get_ex_new_index( 0, nullptr, nullptr, nullptr, DestroyExData); - GPR_ASSERT(ex_data_id != -1); + CHECK_NE(ex_data_id, -1); // OpenSSL and different version of BoringSSL don't agree on API // so try both. tsi::SslSessionPtr session = NewSessionInternal(SSL_SESSION_new); diff --git a/test/core/util/BUILD b/test/core/util/BUILD index 5122f7d589f..6133152ccc4 100644 --- a/test/core/util/BUILD +++ b/test/core/util/BUILD @@ -81,6 +81,7 @@ grpc_cc_library( "tracer_util.h", ], external_deps = [ + "absl/log:check", "absl/status:statusor", "absl/strings", "absl/strings:str_format", @@ -118,6 +119,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/debugging:failure_signal_handler", + "absl/log:check", "absl/status", "absl/status:statusor", "absl/strings", @@ -163,6 +165,7 @@ grpc_cc_library( hdrs = TEST_UTILS_THAT_USE_GRPC_H_HEADERS, external_deps = [ "absl/debugging:failure_signal_handler", + "absl/log:check", "absl/status", "absl/status:statusor", "absl/strings", @@ -218,6 +221,7 @@ grpc_cc_library( srcs = ["fuzzer_corpus_test.cc"], external_deps = [ "absl/flags:flag", + "absl/log:check", "gtest", ], linkstatic = True, @@ -298,6 +302,7 @@ grpc_cc_library( srcs = ["test_lb_policies.cc"], hdrs = ["test_lb_policies.h"], external_deps = [ + "absl/log:check", "absl/status", "absl/status:statusor", "absl/strings", @@ -336,6 +341,7 @@ grpc_cc_library( srcs = ["fake_udp_and_tcp_server.cc"], hdrs = ["fake_udp_and_tcp_server.h"], external_deps = [ + "absl/log:check", "absl/status:statusor", "absl/strings", ], @@ -500,6 +506,7 @@ grpc_cc_library( external_deps = [ "absl/container:flat_hash_map", "absl/functional:any_invocable", + "absl/log:check", "absl/status", "absl/strings", "absl/types:optional", diff --git a/test/core/util/cmdline.cc b/test/core/util/cmdline.cc index c1e34992af5..f4c079bdac0 100644 --- a/test/core/util/cmdline.cc +++ b/test/core/util/cmdline.cc @@ -26,6 +26,7 @@ #include #include +#include "absl/log/check.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" @@ -90,7 +91,7 @@ static void add_arg(gpr_cmdline* cl, const char* name, const char* help, arg* a; for (a = cl->args; a; a = a->next) { - GPR_ASSERT(0 != strcmp(a->name, name)); + CHECK_NE(strcmp(a->name, name), 0); } a = static_cast(gpr_zalloc(sizeof(arg))); @@ -120,8 +121,8 @@ void gpr_cmdline_add_string(gpr_cmdline* cl, const char* name, const char* help, void gpr_cmdline_on_extra_arg( gpr_cmdline* cl, const char* name, const char* help, void (*on_extra_arg)(void* user_data, const char* arg), void* user_data) { - GPR_ASSERT(!cl->extra_arg); - GPR_ASSERT(on_extra_arg); + CHECK(!cl->extra_arg); + CHECK(on_extra_arg); cl->extra_arg = on_extra_arg; cl->extra_arg_user_data = user_data; @@ -203,7 +204,7 @@ static int value_state(gpr_cmdline* cl, char* str) { long intval; char* end; - GPR_ASSERT(cl->cur_arg); + CHECK(cl->cur_arg); switch (cl->cur_arg->type) { case ARGTYPE_INT: @@ -309,7 +310,7 @@ static int normal_state(gpr_cmdline* cl, char* str) { int gpr_cmdline_parse(gpr_cmdline* cl, int argc, char** argv) { int i; - GPR_ASSERT(argc >= 1); + CHECK_GE(argc, 1); cl->argv0 = argv[0]; for (i = 1; i < argc; i++) { diff --git a/test/core/util/fake_stats_plugin.cc b/test/core/util/fake_stats_plugin.cc index 00055d06d94..f858327b98d 100644 --- a/test/core/util/fake_stats_plugin.cc +++ b/test/core/util/fake_stats_plugin.cc @@ -14,6 +14,8 @@ #include "test/core/util/fake_stats_plugin.h" +#include "absl/log/check.h" + #include "src/core/lib/config/core_configuration.h" namespace grpc_core { @@ -45,7 +47,7 @@ FakeStatsClientFilter::Create(const ChannelArgs& args, auto* fake_client_call_tracer_factory = args.GetPointer( GRPC_ARG_INJECT_FAKE_CLIENT_CALL_TRACER_FACTORY); - GPR_ASSERT(fake_client_call_tracer_factory != nullptr); + CHECK_NE(fake_client_call_tracer_factory, nullptr); return std::make_unique( fake_client_call_tracer_factory); } @@ -87,7 +89,7 @@ namespace { void AddKeyValuePairs(absl::Span keys, absl::Span values, std::vector* key_value_pairs) { - GPR_ASSERT(keys.size() == values.size()); + CHECK(keys.size() == values.size()); for (size_t i = 0; i < keys.size(); ++i) { key_value_pairs->push_back(absl::StrCat(keys[i], "=", values[i])); } diff --git a/test/core/util/fake_stats_plugin.h b/test/core/util/fake_stats_plugin.h index 4b3a4018fa3..8a32e4992c0 100644 --- a/test/core/util/fake_stats_plugin.h +++ b/test/core/util/fake_stats_plugin.h @@ -31,6 +31,7 @@ #include "src/core/lib/channel/metrics.h" #include "src/core/lib/channel/promise_based_filter.h" #include "src/core/lib/channel/tcp_tracer.h" +#include "src/core/lib/gprpp/ref_counted.h" namespace grpc_core { @@ -59,12 +60,12 @@ void RegisterFakeStatsPlugin(); class FakeClientCallTracer : public ClientCallTracer { public: class FakeClientCallAttemptTracer - : public ClientCallTracer::CallAttemptTracer { + : public ClientCallTracer::CallAttemptTracer, + public RefCounted { public: explicit FakeClientCallAttemptTracer( std::vector* annotation_logger) : annotation_logger_(annotation_logger) {} - ~FakeClientCallAttemptTracer() override {} void RecordSendInitialMetadata( grpc_metadata_batch* /*send_initial_metadata*/) override {} void RecordSendTrailingMetadata( @@ -83,7 +84,7 @@ class FakeClientCallTracer : public ClientCallTracer { grpc_metadata_batch* /*recv_trailing_metadata*/, const grpc_transport_stream_stats* /*transport_stream_stats*/) override {} - void RecordEnd(const gpr_timespec& /*latency*/) override {} + void RecordEnd(const gpr_timespec& /*latency*/) override { Unref(); } void RecordAnnotation(absl::string_view annotation) override { annotation_logger_->push_back(std::string(annotation)); } @@ -113,9 +114,10 @@ class FakeClientCallTracer : public ClientCallTracer { : annotation_logger_(annotation_logger) {} ~FakeClientCallTracer() override {} CallAttemptTracer* StartNewAttempt(bool /*is_transparent_retry*/) override { - call_attempt_tracers_.emplace_back( - new FakeClientCallAttemptTracer(annotation_logger_)); - return call_attempt_tracers_.back().get(); + auto call_attempt_tracer = + MakeRefCounted(annotation_logger_); + call_attempt_tracers_.emplace_back(call_attempt_tracer); + return call_attempt_tracer.release(); // Released in RecordEnd(). } void RecordAnnotation(absl::string_view annotation) override { @@ -132,8 +134,7 @@ class FakeClientCallTracer : public ClientCallTracer { private: std::vector* annotation_logger_; - std::vector> - call_attempt_tracers_; + std::vector> call_attempt_tracers_; }; #define GRPC_ARG_INJECT_FAKE_CLIENT_CALL_TRACER_FACTORY \ diff --git a/test/core/util/fake_udp_and_tcp_server.cc b/test/core/util/fake_udp_and_tcp_server.cc index 46e49d947b3..a76682db668 100644 --- a/test/core/util/fake_udp_and_tcp_server.cc +++ b/test/core/util/fake_udp_and_tcp_server.cc @@ -23,6 +23,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" @@ -78,13 +79,13 @@ FakeUdpAndTcpServer::FakeUdpAndTcpServer( udp_socket_ = socket(AF_INET6, SOCK_DGRAM, 0); if (udp_socket_ == BAD_SOCKET_RETURN_VAL) { gpr_log(GPR_ERROR, "Failed to create UDP ipv6 socket: %d", ERRNO); - GPR_ASSERT(0); + CHECK(0); } accept_socket_ = socket(AF_INET6, SOCK_STREAM, 0); address_ = absl::StrCat("[::1]:", port_); if (accept_socket_ == BAD_SOCKET_RETURN_VAL) { gpr_log(GPR_ERROR, "Failed to create TCP IPv6 socket: %d", ERRNO); - GPR_ASSERT(0); + CHECK(0); } #ifdef GPR_WINDOWS char val = 1; @@ -94,35 +95,35 @@ FakeUdpAndTcpServer::FakeUdpAndTcpServer( "Failed to set SO_REUSEADDR on TCP ipv6 socket to [::1]:%d, " "errno: %d", port_, ERRNO); - GPR_ASSERT(0); + CHECK(0); } grpc_error_handle set_non_block_error; set_non_block_error = grpc_tcp_set_non_block(udp_socket_); if (!set_non_block_error.ok()) { gpr_log(GPR_ERROR, "Failed to configure non-blocking socket: %s", StatusToString(set_non_block_error).c_str()); - GPR_ASSERT(0); + CHECK(0); } set_non_block_error = grpc_tcp_set_non_block(accept_socket_); if (!set_non_block_error.ok()) { gpr_log(GPR_ERROR, "Failed to configure non-blocking socket: %s", StatusToString(set_non_block_error).c_str()); - GPR_ASSERT(0); + CHECK(0); } #else int val = 1; if (setsockopt(accept_socket_, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) != 0) { gpr_log(GPR_ERROR, "Failed to set SO_REUSEADDR on socket [::1]:%d", port_); - GPR_ASSERT(0); + CHECK(0); } if (fcntl(udp_socket_, F_SETFL, O_NONBLOCK) != 0) { gpr_log(GPR_ERROR, "Failed to set O_NONBLOCK on socket: %d", ERRNO); - GPR_ASSERT(0); + CHECK(0); } if (fcntl(accept_socket_, F_SETFL, O_NONBLOCK) != 0) { gpr_log(GPR_ERROR, "Failed to set O_NONBLOCK on socket: %d", ERRNO); - GPR_ASSERT(0); + CHECK(0); } #endif sockaddr_in6 addr; @@ -139,18 +140,18 @@ FakeUdpAndTcpServer::FakeUdpAndTcpServer( if (bind(udp_socket_, reinterpret_cast(&addr), sizeof(addr)) != 0) { gpr_log(GPR_ERROR, "Failed to bind UDP socket to [::1]:%d", port_); - GPR_ASSERT(0); + CHECK(0); } if (bind(accept_socket_, reinterpret_cast(&addr), sizeof(addr)) != 0) { gpr_log(GPR_ERROR, "Failed to bind TCP socket to [::1]:%d : %d", port_, ERRNO); - GPR_ASSERT(0); + CHECK(0); } if (listen(accept_socket_, 100)) { gpr_log(GPR_ERROR, "Failed to listen on socket bound to [::1]:%d : %d", port_, ERRNO); - GPR_ASSERT(0); + CHECK(0); } gpr_event_init(&stop_ev_); run_server_loop_thd_ = std::make_unique( @@ -176,7 +177,7 @@ FakeUdpAndTcpServer::CloseSocketUponReceivingBytesFromPeer( if (bytes_received_size < 0 && !ErrorIsRetryable(read_error)) { gpr_log(GPR_ERROR, "Failed to receive from peer socket: %d. errno: %d", s, read_error); - GPR_ASSERT(0); + CHECK(0); } if (bytes_received_size >= 0) { gpr_log(GPR_DEBUG, @@ -195,7 +196,7 @@ FakeUdpAndTcpServer::CloseSocketUponCloseFromPeer(int bytes_received_size, if (bytes_received_size < 0 && !ErrorIsRetryable(read_error)) { gpr_log(GPR_ERROR, "Failed to receive from peer socket: %d. errno: %d", s, read_error); - GPR_ASSERT(0); + CHECK(0); } if (bytes_received_size == 0) { // The peer has shut down the connection. @@ -215,7 +216,7 @@ FakeUdpAndTcpServer::SendThreeAllZeroBytes(int bytes_received_size, if (bytes_received_size < 0 && !ErrorIsRetryable(read_error)) { gpr_log(GPR_ERROR, "Failed to receive from peer socket: %d. errno: %d", s, read_error); - GPR_ASSERT(0); + CHECK(0); } if (bytes_received_size == 0) { // The peer has shut down the connection. @@ -257,10 +258,10 @@ void FakeUdpAndTcpServer::FakeUdpAndTcpServerPeer:: "Fake TCP server encountered unexpected error:%d " "sending %d bytes on fd:%d", ERRNO, bytes_to_send, fd_); - GPR_ASSERT(0); + CHECK(0); } else if (bytes_sent > 0) { total_bytes_sent_ += bytes_sent; - GPR_ASSERT(total_bytes_sent_ <= int(kEmptyHttp2SettingsFrame.size())); + CHECK(total_bytes_sent_ <= int(kEmptyHttp2SettingsFrame.size())); } } } @@ -283,13 +284,13 @@ void FakeUdpAndTcpServer::RunServerLoop() { if (!set_non_block_error.ok()) { gpr_log(GPR_ERROR, "Failed to configure non-blocking socket: %s", StatusToString(set_non_block_error).c_str()); - GPR_ASSERT(0); + CHECK(0); } #else if (fcntl(p, F_SETFL, O_NONBLOCK) != 0) { gpr_log(GPR_ERROR, "Failed to configure non-blocking socket, errno: %d", ERRNO); - GPR_ASSERT(0); + CHECK(0); } #endif peers.insert(std::make_unique(p)); @@ -307,8 +308,7 @@ void FakeUdpAndTcpServer::RunServerLoop() { if (r == FakeUdpAndTcpServer::ProcessReadResult::kCloseSocket) { it = peers.erase(it); } else { - GPR_ASSERT(r == - FakeUdpAndTcpServer::ProcessReadResult::kContinueReading); + CHECK(r == FakeUdpAndTcpServer::ProcessReadResult::kContinueReading); it++; } } diff --git a/test/core/util/fuzzer_corpus_test.cc b/test/core/util/fuzzer_corpus_test.cc index e4b66f31443..e789fab7529 100644 --- a/test/core/util/fuzzer_corpus_test.cc +++ b/test/core/util/fuzzer_corpus_test.cc @@ -27,6 +27,7 @@ #include #include "absl/flags/flag.h" +#include "absl/log/check.h" #include "absl/types/optional.h" #include "gtest/gtest.h" @@ -109,7 +110,7 @@ class ExampleGenerator } // Make sure we don't succeed without doing anything, which caused // us to be blind to our fuzzers not running for 9 months. - GPR_ASSERT(!examples_.empty()); + CHECK(!examples_.empty()); // Get a consistent ordering of examples so problems don't just show up on // CI std::sort(examples_.begin(), examples_.end()); diff --git a/test/core/util/histogram.cc b/test/core/util/histogram.cc index 64165f7b0a9..670fd4dea30 100644 --- a/test/core/util/histogram.cc +++ b/test/core/util/histogram.cc @@ -21,6 +21,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -63,7 +65,7 @@ static size_t bucket_for_unchecked(grpc_histogram* h, double x) { static size_t bucket_for(grpc_histogram* h, double x) { size_t bucket = bucket_for_unchecked(h, grpc_core::Clamp(x, 1.0, h->max_possible)); - GPR_ASSERT(bucket < h->num_buckets); + CHECK(bucket < h->num_buckets); return bucket; } @@ -76,8 +78,8 @@ grpc_histogram* grpc_histogram_create(double resolution, double max_bucket_start) { grpc_histogram* h = static_cast(gpr_malloc(sizeof(grpc_histogram))); - GPR_ASSERT(resolution > 0.0); - GPR_ASSERT(max_bucket_start > resolution); + CHECK(resolution > 0.0); + CHECK(max_bucket_start > resolution); h->sum = 0.0; h->sum_of_squares = 0.0; h->multiplier = 1.0 + resolution; @@ -87,8 +89,8 @@ grpc_histogram* grpc_histogram_create(double resolution, h->min_seen = max_bucket_start; h->max_seen = 0.0; h->num_buckets = bucket_for_unchecked(h, max_bucket_start) + 1; - GPR_ASSERT(h->num_buckets > 1); - GPR_ASSERT(h->num_buckets < 100000000); + CHECK_GT(h->num_buckets, 1u); + CHECK_LT(h->num_buckets, 100000000ul); h->buckets = static_cast(gpr_zalloc(sizeof(uint32_t) * h->num_buckets)); return h; @@ -129,7 +131,7 @@ void grpc_histogram_merge_contents(grpc_histogram* histogram, double min_seen, double max_seen, double sum, double sum_of_squares, double count) { size_t i; - GPR_ASSERT(histogram->num_buckets == data_count); + CHECK(histogram->num_buckets == data_count); histogram->sum += sum; histogram->sum_of_squares += sum_of_squares; histogram->count += count; @@ -198,7 +200,7 @@ double grpc_histogram_percentile(grpc_histogram* h, double percentile) { } double grpc_histogram_mean(grpc_histogram* h) { - GPR_ASSERT(h->count != 0); + CHECK_NE(h->count, 0); return h->sum / h->count; } diff --git a/test/core/util/mock_endpoint.cc b/test/core/util/mock_endpoint.cc index d432c3d8778..fe849958ef4 100644 --- a/test/core/util/mock_endpoint.cc +++ b/test/core/util/mock_endpoint.cc @@ -18,6 +18,7 @@ #include "test/core/util/mock_endpoint.h" +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/strings/string_view.h" @@ -153,7 +154,7 @@ grpc_endpoint* grpc_mock_endpoint_create(void (*on_write)(grpc_slice slice)) { void grpc_mock_endpoint_put_read(grpc_endpoint* ep, grpc_slice slice) { mock_endpoint* m = reinterpret_cast(ep); gpr_mu_lock(&m->mu); - GPR_ASSERT(!m->put_reads_done); + CHECK(!m->put_reads_done); if (m->on_read != nullptr) { grpc_slice_buffer_add(m->on_read_out, slice); grpc_core::ExecCtx::Run(DEBUG_LOCATION, m->on_read, absl::OkStatus()); diff --git a/test/core/util/one_corpus_entry_fuzzer.cc b/test/core/util/one_corpus_entry_fuzzer.cc index 85276c31aef..596e5fd093b 100644 --- a/test/core/util/one_corpus_entry_fuzzer.cc +++ b/test/core/util/one_corpus_entry_fuzzer.cc @@ -18,6 +18,8 @@ #include +#include "absl/log/check.h" + #include #include @@ -33,7 +35,7 @@ extern bool leak_check; int main(int argc, char** argv) { squelch = false; leak_check = false; - GPR_ASSERT(argc > 1); // Make sure that we have a filename argument + CHECK_GT(argc, 1); // Make sure that we have a filename argument std::string buffer = grpc_core::testing::GetFileContents(argv[1]); LLVMFuzzerTestOneInput(buffer.data(), buffer.size()); return 0; diff --git a/test/core/util/parse_hexstring.cc b/test/core/util/parse_hexstring.cc index 5fb5876f35c..ecc715454c9 100644 --- a/test/core/util/parse_hexstring.cc +++ b/test/core/util/parse_hexstring.cc @@ -21,6 +21,8 @@ #include #include +#include "absl/log/check.h" + #include #include @@ -35,7 +37,7 @@ Slice ParseHexstring(absl::string_view hexstring) { nibbles += (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'); } - GPR_ASSERT((nibbles & 1) == 0); + CHECK_EQ((nibbles & 1), 0u); slice = grpc_slice_malloc(nibbles / 2); out = GRPC_SLICE_START_PTR(slice); diff --git a/test/core/util/port.cc b/test/core/util/port.cc index 26225ac7701..a941720801f 100644 --- a/test/core/util/port.cc +++ b/test/core/util/port.cc @@ -23,6 +23,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -49,7 +51,7 @@ static int free_chosen_port_locked(int port) { // freed. for (i = 0; i < num_chosen_ports; i++) { if (chosen_ports[i] == port) { - GPR_ASSERT(found == 0); + CHECK_EQ(found, 0); found = 1; found_at = i; } @@ -110,7 +112,7 @@ static int grpc_pick_unused_port_or_die_impl(void) { static void grpc_recycle_unused_port_impl(int port) { gpr_once_init(&g_default_port_picker_init, init_default_port_picker); grpc_core::MutexLock lock(g_default_port_picker_mu); - GPR_ASSERT(free_chosen_port_locked(port)); + CHECK(free_chosen_port_locked(port)); } namespace { @@ -131,7 +133,7 @@ void grpc_recycle_unused_port(int port) { grpc_pick_port_functions grpc_set_pick_port_functions( grpc_pick_port_functions new_functions) { - GPR_ASSERT(new_functions.pick_unused_port_or_die_fn != nullptr); - GPR_ASSERT(new_functions.recycle_unused_port_fn != nullptr); + CHECK_NE(new_functions.pick_unused_port_or_die_fn, nullptr); + CHECK_NE(new_functions.recycle_unused_port_fn, nullptr); return std::exchange(functions(), new_functions); } diff --git a/test/core/util/port_isolated_runtime_environment.cc b/test/core/util/port_isolated_runtime_environment.cc index a13dbb1531e..ac4fd8e1292 100644 --- a/test/core/util/port_isolated_runtime_environment.cc +++ b/test/core/util/port_isolated_runtime_environment.cc @@ -24,6 +24,8 @@ // #include +#include "absl/log/check.h" + #include #include #include @@ -49,7 +51,7 @@ static gpr_atm s_pick_counter = 0; static int grpc_pick_unused_port_or_die_impl(void) { int orig_counter_val = static_cast(gpr_atm_full_fetch_add(&s_pick_counter, 1)); - GPR_ASSERT(orig_counter_val < (MAX_PORT - MIN_PORT + 1)); + CHECK(orig_counter_val < (MAX_PORT - MIN_PORT + 1)); return MIN_PORT + (s_initial_offset + orig_counter_val) % (MAX_PORT - MIN_PORT + 1); } diff --git a/test/core/util/port_server_client.cc b/test/core/util/port_server_client.cc index fd651bc29a7..02d1aa861ad 100644 --- a/test/core/util/port_server_client.cc +++ b/test/core/util/port_server_client.cc @@ -27,6 +27,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/strings/str_format.h" @@ -101,7 +102,7 @@ void grpc_free_port_using_server(int port) { std::string path = absl::StrFormat("/drop/%d", port); auto uri = grpc_core::URI::Create("https", GRPC_PORT_SERVER_ADDRESS, path, {} /* query params */, "" /* fragment */); - GPR_ASSERT(uri.ok()); + CHECK_OK(uri); auto http_request = grpc_core::HttpRequest::Get( std::move(*uri), nullptr /* channel args */, &pr.pops, &req, grpc_core::Timestamp::Now() + grpc_core::Duration::Seconds(30), @@ -173,7 +174,7 @@ static void got_port_from_server(void* arg, grpc_error_handle error) { gpr_mu_unlock(pr->mu); return; } - GPR_ASSERT(pr->retries < 10); + CHECK(pr->retries < 10); gpr_sleep_until(gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis( @@ -185,7 +186,7 @@ static void got_port_from_server(void* arg, grpc_error_handle error) { pr->response = {}; auto uri = grpc_core::URI::Create("http", pr->server, "/get", {} /* query params */, "" /* fragment */); - GPR_ASSERT(uri.ok()); + CHECK_OK(uri); pr->http_request = grpc_core::HttpRequest::Get( std::move(*uri), nullptr /* channel args */, &pr->pops, &req, grpc_core::Timestamp::Now() + grpc_core::Duration::Seconds(30), @@ -197,13 +198,14 @@ static void got_port_from_server(void* arg, grpc_error_handle error) { pr->http_request->Start(); return; } - GPR_ASSERT(response); - GPR_ASSERT(response->status == 200); + CHECK(response); + CHECK_EQ(response->status, 200); for (i = 0; i < response->body_length; i++) { - GPR_ASSERT(response->body[i] >= '0' && response->body[i] <= '9'); + CHECK(response->body[i] >= '0'); + CHECK(response->body[i] <= '9'); port = port * 10 + response->body[i] - '0'; } - GPR_ASSERT(port > 1024); + CHECK(port > 1024); gpr_mu_lock(pr->mu); pr->port = port; GRPC_LOG_IF_ERROR( @@ -232,7 +234,7 @@ int grpc_pick_port_using_server(void) { pr.server = const_cast(GRPC_PORT_SERVER_ADDRESS); auto uri = grpc_core::URI::Create("http", GRPC_PORT_SERVER_ADDRESS, "/get", {} /* query params */, "" /* fragment */); - GPR_ASSERT(uri.ok()); + CHECK_OK(uri); auto http_request = grpc_core::HttpRequest::Get( std::move(*uri), nullptr /* channel args */, &pr.pops, &req, grpc_core::Timestamp::Now() + grpc_core::Duration::Seconds(30), diff --git a/test/core/util/resolve_localhost_ip46.cc b/test/core/util/resolve_localhost_ip46.cc index 1607418f879..f8757dc538f 100644 --- a/test/core/util/resolve_localhost_ip46.cc +++ b/test/core/util/resolve_localhost_ip46.cc @@ -21,6 +21,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" @@ -41,7 +42,7 @@ gpr_once g_resolve_localhost_ipv46 = GPR_ONCE_INIT; void InitResolveLocalhost() { absl::StatusOr> addresses_or = GetDNSResolver()->LookupHostnameBlocking("localhost", "https"); - GPR_ASSERT(addresses_or.ok()); + CHECK_OK(addresses_or); for (const auto& addr : *addresses_or) { const grpc_sockaddr* sock_addr = reinterpret_cast(&addr); diff --git a/test/core/util/test_lb_policies.cc b/test/core/util/test_lb_policies.cc index 0f4f6908e8e..bbd7517d837 100644 --- a/test/core/util/test_lb_policies.cc +++ b/test/core/util/test_lb_policies.cc @@ -21,6 +21,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "absl/types/variant.h" @@ -83,7 +84,7 @@ class ForwardingLoadBalancingPolicy : public LoadBalancingPolicy { CoreConfiguration::Get().lb_policy_registry().ParseLoadBalancingConfig( Json::FromArray({Json::FromObject( {{std::string(delegate_->name()), Json::FromObject({})}})})); - GPR_ASSERT(config.ok()); + CHECK_OK(config); args.config = *config; return delegate_->UpdateLocked(std::move(args)); } @@ -417,7 +418,7 @@ class FixedAddressLoadBalancingPolicy : public ForwardingLoadBalancingPolicy { EndpointAddressesList addresses; if (uri.ok()) { grpc_resolved_address address; - GPR_ASSERT(grpc_parse_uri(*uri, &address)); + CHECK(grpc_parse_uri(*uri, &address)); addresses.emplace_back(address, ChannelArgs()); } else { gpr_log(GPR_ERROR, diff --git a/test/core/util/test_tcp_server.cc b/test/core/util/test_tcp_server.cc index 78d28a38b6c..6e521f3223e 100644 --- a/test/core/util/test_tcp_server.cc +++ b/test/core/util/test_tcp_server.cc @@ -23,6 +23,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -82,11 +84,11 @@ void test_tcp_server_start(test_tcp_server* server, int port) { &server->shutdown_complete, grpc_event_engine::experimental::ChannelArgsEndpointConfig(args), server->on_connect, server->cb_data, &server->tcp_server); - GPR_ASSERT(error.ok()); + CHECK_OK(error); error = grpc_tcp_server_add_port(server->tcp_server, &resolved_addr, &port_added); - GPR_ASSERT(error.ok()); - GPR_ASSERT(port_added == port); + CHECK_OK(error); + CHECK(port_added == port); grpc_tcp_server_start(server->tcp_server, &server->pollset); gpr_log(GPR_INFO, "test tcp server listening on 0.0.0.0:%d", port); diff --git a/test/core/util/tls_utils.cc b/test/core/util/tls_utils.cc index f25a6911304..43214bf1ed1 100644 --- a/test/core/util/tls_utils.cc +++ b/test/core/util/tls_utils.cc @@ -17,6 +17,7 @@ #include +#include "absl/log/check.h" #include "absl/strings/str_cat.h" #include @@ -37,34 +38,33 @@ namespace testing { TmpFile::TmpFile(absl::string_view data) { name_ = CreateTmpFileAndWriteData(data); - GPR_ASSERT(!name_.empty()); + CHECK(!name_.empty()); } -TmpFile::~TmpFile() { GPR_ASSERT(remove(name_.c_str()) == 0); } +TmpFile::~TmpFile() { CHECK_EQ(remove(name_.c_str()), 0); } void TmpFile::RewriteFile(absl::string_view data) { // Create a new file containing new data. std::string new_name = CreateTmpFileAndWriteData(data); - GPR_ASSERT(!new_name.empty()); + CHECK(!new_name.empty()); #ifdef GPR_WINDOWS // Remove the old file. // On Windows rename requires that the new name not exist, whereas // on posix systems rename does an atomic replacement of the new // name. - GPR_ASSERT(remove(name_.c_str()) == 0); + CHECK_EQ(remove(name_.c_str()), 0); #endif // Rename the new file to the original name. - GPR_ASSERT(rename(new_name.c_str(), name_.c_str()) == 0); + CHECK_EQ(rename(new_name.c_str(), name_.c_str()), 0); } std::string TmpFile::CreateTmpFileAndWriteData(absl::string_view data) { char* name = nullptr; FILE* file_descriptor = gpr_tmpfile("test", &name); - GPR_ASSERT(fwrite(data.data(), 1, data.size(), file_descriptor) == - data.size()); - GPR_ASSERT(fclose(file_descriptor) == 0); - GPR_ASSERT(file_descriptor != nullptr); - GPR_ASSERT(name != nullptr); + CHECK(fwrite(data.data(), 1, data.size(), file_descriptor) == data.size()); + CHECK_EQ(fclose(file_descriptor), 0); + CHECK_NE(file_descriptor, nullptr); + CHECK_NE(name, nullptr); std::string name_to_return = name; gpr_free(name); return name_to_return; diff --git a/test/core/xds/BUILD b/test/core/xds/BUILD index 0ca4fe1ac5a..97764c6962b 100644 --- a/test/core/xds/BUILD +++ b/test/core/xds/BUILD @@ -44,7 +44,10 @@ grpc_cc_test( grpc_cc_test( name = "certificate_provider_store_test", srcs = ["certificate_provider_store_test.cc"], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], language = "C++", uses_event_engine = False, uses_polling = False, @@ -151,6 +154,7 @@ grpc_cc_library( srcs = ["xds_transport_fake.cc"], hdrs = ["xds_transport_fake.h"], external_deps = [ + "absl/log:check", "absl/strings", "absl/types:optional", ], @@ -244,7 +248,10 @@ grpc_cc_test( grpc_cc_test( name = "xds_http_filters_test", srcs = ["xds_http_filters_test.cc"], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], language = "C++", uses_event_engine = False, uses_polling = False, diff --git a/test/core/xds/certificate_provider_store_test.cc b/test/core/xds/certificate_provider_store_test.cc index 53f5767e3bd..cd0c9337035 100644 --- a/test/core/xds/certificate_provider_store_test.cc +++ b/test/core/xds/certificate_provider_store_test.cc @@ -23,6 +23,7 @@ #include #include +#include "absl/log/check.h" #include "gtest/gtest.h" #include @@ -47,7 +48,7 @@ class FakeCertificateProvider : public grpc_tls_certificate_provider { public: RefCountedPtr distributor() const override { // never called - GPR_ASSERT(0); + CHECK(0); return nullptr; } diff --git a/test/core/xds/xds_http_filters_test.cc b/test/core/xds/xds_http_filters_test.cc index bdbabc45283..8e14066f5c1 100644 --- a/test/core/xds/xds_http_filters_test.cc +++ b/test/core/xds/xds_http_filters_test.cc @@ -24,6 +24,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/strings/str_format.h" #include "absl/strings/strip.h" @@ -191,7 +192,7 @@ class XdsRouterFilterTest : public XdsHttpFilterTest { XdsRouterFilterTest() { XdsExtension extension = MakeXdsExtension(Router()); filter_ = GetFilter(extension.type); - GPR_ASSERT(filter_ != nullptr); + CHECK_NE(filter_, nullptr); } const XdsHttpFilterImpl* filter_; @@ -275,7 +276,7 @@ class XdsFaultInjectionFilterTest : public XdsHttpFilterTest { XdsFaultInjectionFilterTest() { XdsExtension extension = MakeXdsExtension(HTTPFault()); filter_ = GetFilter(extension.type); - GPR_ASSERT(filter_ != nullptr); + CHECK_NE(filter_, nullptr); } const XdsHttpFilterImpl* filter_; @@ -480,7 +481,7 @@ class XdsRbacFilterTest : public XdsHttpFilterTest { XdsRbacFilterTest() { XdsExtension extension = MakeXdsExtension(RBAC()); filter_ = GetFilter(extension.type); - GPR_ASSERT(filter_ != nullptr); + CHECK_NE(filter_, nullptr); } const XdsHttpFilterImpl* filter_; @@ -1107,7 +1108,7 @@ class XdsStatefulSessionFilterTest : public XdsHttpFilterTest { registry_ = XdsHttpFilterRegistry(); XdsExtension extension = MakeXdsExtension(StatefulSession()); filter_ = GetFilter(extension.type); - GPR_ASSERT(filter_ != nullptr); + CHECK_NE(filter_, nullptr); } const XdsHttpFilterImpl* filter_; diff --git a/test/core/xds/xds_transport_fake.cc b/test/core/xds/xds_transport_fake.cc index 4fe426bb6b6..7a0294b5278 100644 --- a/test/core/xds/xds_transport_fake.cc +++ b/test/core/xds/xds_transport_fake.cc @@ -23,6 +23,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -52,7 +54,7 @@ FakeXdsTransportFactory::FakeStreamingCall::~FakeStreamingCall() { transport_->server()->server_uri().c_str(), this, message.c_str()); } - GPR_ASSERT(from_client_messages_.empty()); + CHECK(from_client_messages_.empty()); } } // Can't call event_handler_->OnStatusReceived() or unref event_handler_ @@ -79,7 +81,7 @@ void FakeXdsTransportFactory::FakeStreamingCall::Orphan() { void FakeXdsTransportFactory::FakeStreamingCall::SendMessage( std::string payload) { MutexLock lock(&mu_); - GPR_ASSERT(!orphaned_); + CHECK(!orphaned_); from_client_messages_.push_back(std::move(payload)); cv_client_msg_.Signal(); if (transport_->auto_complete_messages_from_client()) { @@ -122,7 +124,7 @@ void FakeXdsTransportFactory::FakeStreamingCall:: void FakeXdsTransportFactory::FakeStreamingCall::CompleteSendMessageFromClient( bool ok) { - GPR_ASSERT(!transport_->auto_complete_messages_from_client()); + CHECK(!transport_->auto_complete_messages_from_client()); MutexLock lock(&mu_); CompleteSendMessageFromClientLocked(ok); } @@ -280,7 +282,7 @@ FakeXdsTransportFactory::Create( absl::Status* /*status*/) { MutexLock lock(&mu_); auto& entry = transport_map_[server.Key()]; - GPR_ASSERT(entry == nullptr); + CHECK(entry == nullptr); auto transport = MakeOrphanable( RefAsSubclass(), server, std::move(on_connectivity_failure), auto_complete_messages_from_client_, diff --git a/test/cpp/client/BUILD b/test/cpp/client/BUILD index 95fc4aede8e..7fa032a5fa2 100644 --- a/test/cpp/client/BUILD +++ b/test/cpp/client/BUILD @@ -27,6 +27,7 @@ grpc_cc_test( "//src/core/tsi/test_creds:server1.pem", ], external_deps = [ + "absl/log:check", "gtest", ], deps = [ diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc index e033bc802c8..87e633d854f 100644 --- a/test/cpp/client/credentials_test.cc +++ b/test/cpp/client/credentials_test.cc @@ -21,6 +21,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -275,7 +277,7 @@ TEST(CredentialsTest, TlsChannelCredentialsWithDefaultRootsAndDefaultVerifier) { grpc::experimental::TlsChannelCredentialsOptions options; options.set_verify_server_certs(true); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST( @@ -295,21 +297,21 @@ TEST( options.watch_identity_key_cert_pairs(); options.set_identity_cert_name(kIdentityCertName); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST(CredentialsTest, TlsChannelCredentialsWithStaticDataCertificateProviderLoadingRootOnly) { auto certificate_provider = std::make_shared(kRootCertContents); - GPR_ASSERT(certificate_provider != nullptr); - GPR_ASSERT(certificate_provider->c_provider() != nullptr); + CHECK_NE(certificate_provider, nullptr); + CHECK_NE(certificate_provider->c_provider(), nullptr); grpc::experimental::TlsChannelCredentialsOptions options; options.set_certificate_provider(certificate_provider); options.watch_root_certs(); options.set_root_cert_name(kRootCertName); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST( @@ -327,7 +329,7 @@ TEST( options.watch_identity_key_cert_pairs(); options.set_identity_cert_name(kIdentityCertName); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST( @@ -342,7 +344,7 @@ TEST( options.watch_identity_key_cert_pairs(); options.set_identity_cert_name(kIdentityCertName); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST(CredentialsTest, @@ -354,7 +356,7 @@ TEST(CredentialsTest, options.watch_root_certs(); options.set_root_cert_name(kRootCertName); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST(CredentialsTest, TlsChannelCredentialsWithHostNameVerifier) { @@ -363,7 +365,7 @@ TEST(CredentialsTest, TlsChannelCredentialsWithHostNameVerifier) { options.set_verify_server_certs(true); options.set_certificate_verifier(verifier); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST(CredentialsTest, TlsChannelCredentialsWithSyncExternalVerifier) { @@ -374,7 +376,7 @@ TEST(CredentialsTest, TlsChannelCredentialsWithSyncExternalVerifier) { options.set_certificate_verifier(verifier); options.set_check_call_host(false); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST(CredentialsTest, TlsChannelCredentialsWithAsyncExternalVerifier) { @@ -385,7 +387,7 @@ TEST(CredentialsTest, TlsChannelCredentialsWithAsyncExternalVerifier) { options.set_certificate_verifier(verifier); options.set_check_call_host(false); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST(CredentialsTest, TlsChannelCredentialsWithCrlDirectory) { @@ -399,7 +401,7 @@ TEST(CredentialsTest, TlsChannelCredentialsWithCrlDirectory) { options.set_identity_cert_name(kIdentityCertName); options.set_crl_directory(CRL_DIR_PATH); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST(CredentialsTest, TlsChannelCredentialsWithCrlProvider) { @@ -408,7 +410,7 @@ TEST(CredentialsTest, TlsChannelCredentialsWithCrlProvider) { grpc::experimental::TlsChannelCredentialsOptions options; options.set_crl_provider(*provider); auto channel_credentials = grpc::experimental::TlsCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST(CredentialsTest, TlsChannelCredentialsWithCrlProviderAndDirectory) { @@ -420,7 +422,7 @@ TEST(CredentialsTest, TlsChannelCredentialsWithCrlProviderAndDirectory) { auto channel_credentials = grpc::experimental::TlsCredentials(options); // TODO(gtcooke94) - behavior might change to make this return nullptr in the // future - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST(CredentialsTest, TlsCredentialsOptionsCopyConstructor) { @@ -437,8 +439,7 @@ TEST(CredentialsTest, TlsCredentialsOptionsCopyConstructor) { TlsTestCredentialsOptions copied_options = options; // Make sure the copy constructor cloned the internal pointer - GPR_ASSERT(options.internal_cred_opts() != - copied_options.internal_cred_opts()); + CHECK(options.internal_cred_opts() != copied_options.internal_cred_opts()); } TEST(CredentialsTest, TlsCredentialsOptionsDoesNotLeak) { diff --git a/test/cpp/common/BUILD b/test/cpp/common/BUILD index 1039685d5cc..0ac80b42898 100644 --- a/test/cpp/common/BUILD +++ b/test/cpp/common/BUILD @@ -36,6 +36,7 @@ grpc_cc_test( name = "timer_test", srcs = ["timer_test.cc"], external_deps = [ + "absl/log:check", "gtest", ], flaky = True, @@ -50,6 +51,7 @@ grpc_cc_test( name = "time_jump_test", srcs = ["time_jump_test.cc"], external_deps = [ + "absl/log:check", "gtest", ], tags = [ diff --git a/test/cpp/common/time_jump_test.cc b/test/cpp/common/time_jump_test.cc index 5a58709afd2..9b31abc1a66 100644 --- a/test/cpp/common/time_jump_test.cc +++ b/test/cpp/common/time_jump_test.cc @@ -25,6 +25,7 @@ #include +#include "absl/log/check.h" #include "absl/time/time.h" #include @@ -95,7 +96,7 @@ TEST_P(TimeJumpTest, TimerRunning) { grpc_core::Timestamp::Now() + grpc_core::Duration::Seconds(3), GRPC_CLOSURE_CREATE( [](void*, grpc_error_handle error) { - GPR_ASSERT(error == absl::CancelledError()); + CHECK(error == absl::CancelledError()); }, nullptr, grpc_schedule_on_exec_ctx)); gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); @@ -106,7 +107,7 @@ TEST_P(TimeJumpTest, TimerRunning) { // We expect 1 wakeup/sec when there are not timer expiries int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); - GPR_ASSERT(wakeups <= 3); + CHECK_LE(wakeups, 3); grpc_timer_cancel(&timer); } @@ -127,9 +128,8 @@ TEST_P(TimeJumpTest, TimedWait) { int32_t elapsed_ms = gpr_time_to_millis(gpr_time_sub(after, before)); gpr_log(GPR_DEBUG, "After wait, timedout = %d elapsed_ms = %d", timedout, elapsed_ms); - GPR_ASSERT(1 == timedout); - GPR_ASSERT(1 == - gpr_time_similar(gpr_time_sub(after, before), + CHECK_EQ(timedout, 1); + CHECK(1 == gpr_time_similar(gpr_time_sub(after, before), gpr_time_from_millis(kWaitTimeMs, GPR_TIMESPAN), gpr_time_from_millis(50, GPR_TIMESPAN))); @@ -138,7 +138,7 @@ TEST_P(TimeJumpTest, TimedWait) { // We expect 1 wakeup/sec when there are not timer expiries int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); - GPR_ASSERT(wakeups <= 3); + CHECK_LE(wakeups, 3); } int main(int argc, char** argv) { diff --git a/test/cpp/common/timer_test.cc b/test/cpp/common/timer_test.cc index 261529df432..63d320b30d3 100644 --- a/test/cpp/common/timer_test.cc +++ b/test/cpp/common/timer_test.cc @@ -20,6 +20,8 @@ #include +#include "absl/log/check.h" + #include #include @@ -77,7 +79,7 @@ TEST_F(TimerTest, NoTimers) { // We expect to get 1 wakeup per second. Sometimes we also get a wakeup // during initialization, so in 1.5 seconds we expect to get 1 or 2 wakeups. int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); - GPR_ASSERT(wakeups == 1 || wakeups == 2); + CHECK(wakeups == 1 || wakeups == 2); } #endif @@ -96,7 +98,7 @@ TEST_F(TimerTest, OneTimerExpires) { }, &timer_fired, grpc_schedule_on_exec_ctx)); gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1500)); - GPR_ASSERT(1 == timer_fired); + CHECK_EQ(timer_fired, 1); // We expect to get 1 wakeup/second + 1 wakeup for the expired timer + maybe 1 // wakeup during initialization. i.e. in 1.5 seconds we expect 2 or 3 wakeups. @@ -126,7 +128,7 @@ TEST_F(TimerTest, MultipleTimersExpire) { } gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1500)); - GPR_ASSERT(kNumTimers == timer_fired); + CHECK(kNumTimers == timer_fired); // We expect to get 1 wakeup/second + 1 wakeup for per timer fired + maybe 1 // wakeup during initialization. i.e. in 1.5 seconds we expect 11 or 12 @@ -168,7 +170,7 @@ TEST_F(TimerTest, CancelSomeTimers) { } gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1500)); - GPR_ASSERT(kNumTimers / 2 == timer_fired); + CHECK(kNumTimers / 2 == timer_fired); // We expect to get 1 wakeup/second + 1 wakeup per timer fired + maybe 1 // wakeup during initialization. i.e. in 1.5 seconds we expect 6 or 7 wakeups. diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index 36125889baa..d8a09d6d3c0 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -1068,7 +1068,6 @@ grpc_cc_test( grpc_cc_test( name = "ssl_credentials_test", - timeout = "long", srcs = ["ssl_credentials_test.cc"], data = [ "//src/core/tsi/test_creds:ca.pem", diff --git a/test/cpp/end2end/channelz_service_test.cc b/test/cpp/end2end/channelz_service_test.cc index 520c59f5c15..f95ffb21945 100644 --- a/test/cpp/end2end/channelz_service_test.cc +++ b/test/cpp/end2end/channelz_service_test.cc @@ -95,7 +95,7 @@ class Proxy : public grpc::testing::EchoTestService::Service { std::unique_ptr client_context = ClientContext::FromServerContext(*server_context); size_t idx = request->param().backend_channel_idx(); - CHECK(idx < stubs_.size()); + CHECK_LT(idx, stubs_.size()); return stubs_[idx]->Echo(client_context.get(), *request, response); } diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index d6f95b4ad94..ad74d7f7f97 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -239,7 +239,7 @@ class FakeResolverResponseGeneratorWrapper { for (const int& port : ports) { absl::StatusOr lb_uri = grpc_core::URI::Parse(grpc_core::LocalIpUri(port)); - CHECK(lb_uri.ok()); + CHECK_OK(lb_uri); grpc_resolved_address address; CHECK(grpc_parse_uri(*lb_uri, &address)); result.addresses->emplace_back(address, per_address_args); @@ -3018,7 +3018,7 @@ class WeightedRoundRobinTest : public ClientLbEnd2endTest { const std::unique_ptr& stub, const std::vector& expected_weights, size_t total_passes = 3, EchoRequest* request_ptr = nullptr, int timeout_ms = 15000) { - CHECK(expected_weights.size() == servers_.size()); + CHECK_EQ(expected_weights.size(), servers_.size()); size_t total_picks_per_pass = 0; for (size_t picks : expected_weights) { total_picks_per_pass += picks; diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index 91be4134f12..bfad3551a83 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -709,7 +709,7 @@ class GrpclbEnd2endTest : public ::testing::Test { for (int port : ports) { absl::StatusOr lb_uri = grpc_core::URI::Parse(grpc_core::LocalIpUri(port)); - CHECK(lb_uri.ok()); + CHECK_OK(lb_uri); grpc_resolved_address address; CHECK(grpc_parse_uri(*lb_uri, &address)); grpc_core::ChannelArgs args; @@ -730,7 +730,7 @@ class GrpclbEnd2endTest : public ::testing::Test { result.addresses = std::move(backends); result.service_config = grpc_core::ServiceConfigImpl::Create( grpc_core::ChannelArgs(), service_config_json); - CHECK(result.service_config.ok()); + CHECK_OK(result.service_config); result.args = grpc_core::SetGrpcLbBalancerAddresses( grpc_core::ChannelArgs(), std::move(balancers)); response_generator_->SetResponseSynchronously(std::move(result)); diff --git a/test/cpp/end2end/service_config_end2end_test.cc b/test/cpp/end2end/service_config_end2end_test.cc index 9a002aea033..2f75c77ec7a 100644 --- a/test/cpp/end2end/service_config_end2end_test.cc +++ b/test/cpp/end2end/service_config_end2end_test.cc @@ -175,7 +175,7 @@ class ServiceConfigEnd2endTest : public ::testing::Test { for (const int& port : ports) { absl::StatusOr lb_uri = grpc_core::URI::Parse(grpc_core::LocalIpUri(port)); - CHECK(lb_uri.ok()); + CHECK_OK(lb_uri); grpc_resolved_address address; CHECK(grpc_parse_uri(*lb_uri, &address)); result.addresses->emplace_back(address, grpc_core::ChannelArgs()); diff --git a/test/cpp/end2end/ssl_credentials_test.cc b/test/cpp/end2end/ssl_credentials_test.cc index 092fe427aed..82cba482ca0 100644 --- a/test/cpp/end2end/ssl_credentials_test.cc +++ b/test/cpp/end2end/ssl_credentials_test.cc @@ -15,11 +15,7 @@ // limitations under the License. // // -#include "src/core/lib/security/credentials/ssl/ssl_credentials.h" - #include -#include -#include #include #include @@ -34,67 +30,34 @@ #include #include -#include "src/core/lib/gprpp/cpp_impl_of.h" -#include "src/core/tsi/ssl_transport_security.h" -#include "src/cpp/client/secure_credentials.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/core/util/tls_utils.h" #include "test/cpp/end2end/test_service_impl.h" -// TODO(matthewstevenson88): More test cases to add: -// - Use P256, P384, P512 credentials. -// - Use a long certificate chain. -// - Use a large certificate. -// - Large trust bundle. -// - Bad ALPN. -// - More failure modes. -// - Certs containing more SANs. -// - Copy all of this over to tls_credentials_test.cc. -// - Client doesn't have cert but server requests one. -// - Bad session ticket in cache. -// - Use same channel creds object on sequential/concurrent handshakes. -// - Do successful handshake with a localhost server cert. -// - Missing or malformed roots on both sides. - namespace grpc { namespace testing { namespace { -using ::grpc_core::testing::GetFileContents; -using ::testing::HasSubstr; -using ::testing::IsEmpty; -using ::testing::UnorderedElementsAre; - constexpr char kCaCertPath[] = "src/core/tsi/test_creds/ca.pem"; constexpr char kServerCertPath[] = "src/core/tsi/test_creds/server1.pem"; constexpr char kServerKeyPath[] = "src/core/tsi/test_creds/server1.key"; constexpr char kClientCertPath[] = "src/core/tsi/test_creds/client.pem"; constexpr char kClientKeyPath[] = "src/core/tsi/test_creds/client.key"; constexpr char kMessage[] = "Hello"; -constexpr char kTargetNameOverride[] = "foo.test.google.fr"; - -std::size_t GetSessionCacheSize(grpc_ssl_session_cache* cache) { - tsi_ssl_session_cache* tsi_cache = - reinterpret_cast(cache); - return tsi_ssl_session_cache_size(tsi_cache); -} - -struct SslOptions { - grpc_ssl_client_certificate_request_type request_type = - GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE; - bool use_session_cache; -}; -class SslCredentialsTest : public ::testing::TestWithParam { +class SslCredentialsTest : public ::testing::Test { protected: - void RunServer(absl::Notification* notification, - absl::string_view pem_root_certs) { + void RunServer(absl::Notification* notification) { + std::string root_cert = grpc_core::testing::GetFileContents(kCaCertPath); grpc::SslServerCredentialsOptions::PemKeyCertPair key_cert_pair = { - GetFileContents(kServerKeyPath), GetFileContents(kServerCertPath)}; - grpc::SslServerCredentialsOptions ssl_options(GetParam().request_type); + grpc_core::testing::GetFileContents(kServerKeyPath), + grpc_core::testing::GetFileContents(kServerCertPath)}; + // TODO(gtcooke94) Parametrize this test for TLS and mTLS as well + grpc::SslServerCredentialsOptions ssl_options; ssl_options.pem_key_cert_pairs.push_back(key_cert_pair); - ssl_options.pem_root_certs = std::string(pem_root_certs); + ssl_options.pem_root_certs = root_cert; + ssl_options.force_client_auth = true; grpc::ServerBuilder builder; TestServiceImpl service_; @@ -115,226 +78,57 @@ class SslCredentialsTest : public ::testing::TestWithParam { } } - absl::StatusOr> DoRpc( - const SslCredentialsOptions& options, grpc_ssl_session_cache* cache, - bool override_ssl_target_name = true) { - ChannelArguments channel_args; - if (GetParam().use_session_cache) { - channel_args.SetPointer(std::string(GRPC_SSL_SESSION_CACHE_ARG), cache); - } - if (override_ssl_target_name) { - channel_args.SetSslTargetNameOverride(kTargetNameOverride); - } - - auto creds = SslCredentials(options); - std::shared_ptr channel = - grpc::CreateCustomChannel(server_addr_, creds, channel_args); - - auto stub = grpc::testing::EchoTestService::NewStub(channel); - grpc::testing::EchoRequest request; - grpc::testing::EchoResponse response; - request.set_message(kMessage); - ClientContext context; - context.set_deadline(grpc_timeout_seconds_to_deadline(/*time_s=*/10)); - grpc::Status result = stub->Echo(&context, request, &response); - if (!result.ok()) { - return absl::Status(static_cast(result.error_code()), - result.error_message()); - } - EXPECT_EQ(response.message(), kMessage); - return context.auth_context(); - } - - static std::vector GetAuthContextPropertyAsList( - const AuthContext& auth_context, const std::string& property) { - std::vector properties; - for (const grpc::string_ref& property : - auth_context.FindPropertyValues(property)) { - properties.push_back(absl::string_view(property.data(), property.size())); - } - return properties; - } - - static absl::string_view GetAuthContextProperty( - const AuthContext& auth_context, const std::string& property) { - std::vector properties = - GetAuthContextPropertyAsList(auth_context, property); - return properties.size() == 1 ? properties[0] : ""; - } - TestServiceImpl service_; std::unique_ptr server_ = nullptr; std::thread* server_thread_ = nullptr; std::string server_addr_; }; -TEST_P(SslCredentialsTest, FullHandshake) { - server_addr_ = absl::StrCat("localhost:", - std::to_string(grpc_pick_unused_port_or_die())); - absl::Notification notification; - server_thread_ = new std::thread([&]() { - std::string root_cert = GetFileContents(kCaCertPath); - RunServer(¬ification, root_cert); - }); - notification.WaitForNotification(); - - std::string root_cert = GetFileContents(kCaCertPath); - std::string client_key = GetFileContents(kClientKeyPath); - std::string client_cert = GetFileContents(kClientCertPath); - grpc::SslCredentialsOptions ssl_options; - ssl_options.pem_root_certs = root_cert; - ssl_options.pem_private_key = client_key; - ssl_options.pem_cert_chain = client_cert; - - grpc_ssl_session_cache* cache = grpc_ssl_session_cache_create_lru(16); - - auto full_handshake_context = DoRpc(ssl_options, cache); - EXPECT_EQ(full_handshake_context.status(), absl::OkStatus()); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_SSL_SESSION_REUSED_PROPERTY), - "false"); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME), - GRPC_SSL_TRANSPORT_SECURITY_TYPE); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME), - "TSI_PRIVACY_AND_INTEGRITY"); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_X509_CN_PROPERTY_NAME), - "*.test.google.com"); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_X509_SUBJECT_PROPERTY_NAME), - "CN=*.test.google.com,O=Example\\, Co.,L=Chicago,ST=Illinois,C=US"); - EXPECT_THAT( - GetAuthContextPropertyAsList(**full_handshake_context, - GRPC_X509_SAN_PROPERTY_NAME), - UnorderedElementsAre("*.test.google.fr", "waterzooi.test.google.be", - "*.test.youtube.com", "192.168.1.3")); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_X509_PEM_CERT_PROPERTY_NAME), - GetFileContents(kServerCertPath)); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_X509_PEM_CERT_CHAIN_PROPERTY_NAME), - GetFileContents(kServerCertPath)); - EXPECT_THAT( - GetAuthContextPropertyAsList(**full_handshake_context, - GRPC_PEER_DNS_PROPERTY_NAME), - UnorderedElementsAre("*.test.google.fr", "waterzooi.test.google.be", - "*.test.youtube.com")); - EXPECT_THAT(GetAuthContextPropertyAsList(**full_handshake_context, - GRPC_PEER_URI_PROPERTY_NAME), - IsEmpty()); - EXPECT_THAT(GetAuthContextPropertyAsList(**full_handshake_context, - GRPC_PEER_EMAIL_PROPERTY_NAME), - IsEmpty()); - EXPECT_THAT(GetAuthContextPropertyAsList(**full_handshake_context, - GRPC_PEER_IP_PROPERTY_NAME), - UnorderedElementsAre("192.168.1.3")); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_PEER_SPIFFE_ID_PROPERTY_NAME), - ""); - if (GetParam().use_session_cache) { - EXPECT_EQ(GetSessionCacheSize(cache), 1); +void DoRpc(const std::string& server_addr, + const SslCredentialsOptions& ssl_options, + grpc_ssl_session_cache* cache, bool expect_session_reuse) { + ChannelArguments channel_args; + channel_args.SetPointer(std::string(GRPC_SSL_SESSION_CACHE_ARG), cache); + channel_args.SetSslTargetNameOverride("foo.test.google.fr"); + + std::shared_ptr channel = grpc::CreateCustomChannel( + server_addr, grpc::SslCredentials(ssl_options), channel_args); + + auto stub = grpc::testing::EchoTestService::NewStub(channel); + grpc::testing::EchoRequest request; + grpc::testing::EchoResponse response; + request.set_message(kMessage); + ClientContext context; + context.set_deadline(grpc_timeout_seconds_to_deadline(/*time_s=*/10)); + grpc::Status result = stub->Echo(&context, request, &response); + EXPECT_TRUE(result.ok()); + if (!result.ok()) { + gpr_log(GPR_ERROR, "%s, %s", result.error_message().c_str(), + result.error_details().c_str()); + } + EXPECT_EQ(response.message(), kMessage); + std::shared_ptr auth_context = context.auth_context(); + std::vector properties = + auth_context->FindPropertyValues(GRPC_SSL_SESSION_REUSED_PROPERTY); + ASSERT_EQ(properties.size(), 1u); + if (expect_session_reuse) { + EXPECT_EQ("true", ToString(properties[0])); + } else { + EXPECT_EQ("false", ToString(properties[0])); } - - grpc_ssl_session_cache_destroy(cache); -} - -TEST_P(SslCredentialsTest, ResumedHandshake) { - // Skip this test if session caching is disabled. - if (!GetParam().use_session_cache) return; - - server_addr_ = absl::StrCat("localhost:", - std::to_string(grpc_pick_unused_port_or_die())); - absl::Notification notification; - server_thread_ = new std::thread([&]() { - std::string root_cert = GetFileContents(kCaCertPath); - RunServer(¬ification, root_cert); - }); - notification.WaitForNotification(); - - std::string root_cert = GetFileContents(kCaCertPath); - std::string client_key = GetFileContents(kClientKeyPath); - std::string client_cert = GetFileContents(kClientCertPath); - grpc::SslCredentialsOptions ssl_options; - ssl_options.pem_root_certs = root_cert; - ssl_options.pem_private_key = client_key; - ssl_options.pem_cert_chain = client_cert; - - grpc_ssl_session_cache* cache = grpc_ssl_session_cache_create_lru(16); - - auto full_handshake_context = DoRpc(ssl_options, cache); - EXPECT_EQ(full_handshake_context.status(), absl::OkStatus()); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_SSL_SESSION_REUSED_PROPERTY), - "false"); - - auto resumed_handshake_context = DoRpc(ssl_options, cache); - EXPECT_EQ(resumed_handshake_context.status(), absl::OkStatus()); - EXPECT_EQ(GetAuthContextProperty(**resumed_handshake_context, - GRPC_SSL_SESSION_REUSED_PROPERTY), - "true"); - EXPECT_EQ(GetAuthContextProperty(**resumed_handshake_context, - GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME), - GRPC_SSL_TRANSPORT_SECURITY_TYPE); - EXPECT_EQ(GetAuthContextProperty(**resumed_handshake_context, - GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME), - "TSI_PRIVACY_AND_INTEGRITY"); - EXPECT_EQ(GetAuthContextProperty(**resumed_handshake_context, - GRPC_X509_CN_PROPERTY_NAME), - "*.test.google.com"); - EXPECT_EQ(GetAuthContextProperty(**resumed_handshake_context, - GRPC_X509_SUBJECT_PROPERTY_NAME), - "CN=*.test.google.com,O=Example\\, Co.,L=Chicago,ST=Illinois,C=US"); - EXPECT_THAT( - GetAuthContextPropertyAsList(**resumed_handshake_context, - GRPC_X509_SAN_PROPERTY_NAME), - UnorderedElementsAre("*.test.google.fr", "waterzooi.test.google.be", - "*.test.youtube.com", "192.168.1.3")); - EXPECT_EQ(GetAuthContextProperty(**resumed_handshake_context, - GRPC_X509_PEM_CERT_PROPERTY_NAME), - GetFileContents(kServerCertPath)); - EXPECT_EQ(GetAuthContextProperty(**resumed_handshake_context, - GRPC_X509_PEM_CERT_CHAIN_PROPERTY_NAME), - GetFileContents(kServerCertPath)); - EXPECT_THAT( - GetAuthContextPropertyAsList(**resumed_handshake_context, - GRPC_PEER_DNS_PROPERTY_NAME), - UnorderedElementsAre("*.test.google.fr", "waterzooi.test.google.be", - "*.test.youtube.com")); - EXPECT_THAT(GetAuthContextPropertyAsList(**resumed_handshake_context, - GRPC_PEER_URI_PROPERTY_NAME), - IsEmpty()); - EXPECT_THAT(GetAuthContextPropertyAsList(**resumed_handshake_context, - GRPC_PEER_EMAIL_PROPERTY_NAME), - IsEmpty()); - EXPECT_THAT(GetAuthContextPropertyAsList(**resumed_handshake_context, - GRPC_PEER_IP_PROPERTY_NAME), - UnorderedElementsAre("192.168.1.3")); - EXPECT_EQ(GetAuthContextProperty(**resumed_handshake_context, - GRPC_PEER_SPIFFE_ID_PROPERTY_NAME), - ""); - EXPECT_EQ(GetSessionCacheSize(cache), 1); - - grpc_ssl_session_cache_destroy(cache); } -TEST_P(SslCredentialsTest, SequentialResumption) { - // Skip this test if session caching is disabled. - if (!GetParam().use_session_cache) return; - +TEST_F(SslCredentialsTest, SequentialResumption) { server_addr_ = absl::StrCat("localhost:", std::to_string(grpc_pick_unused_port_or_die())); absl::Notification notification; - server_thread_ = new std::thread([&]() { - std::string root_cert = GetFileContents(kCaCertPath); - RunServer(¬ification, root_cert); - }); + server_thread_ = new std::thread([&]() { RunServer(¬ification); }); notification.WaitForNotification(); - std::string root_cert = GetFileContents(kCaCertPath); - std::string client_key = GetFileContents(kClientKeyPath); - std::string client_cert = GetFileContents(kClientCertPath); + std::string root_cert = grpc_core::testing::GetFileContents(kCaCertPath); + std::string client_key = grpc_core::testing::GetFileContents(kClientKeyPath); + std::string client_cert = + grpc_core::testing::GetFileContents(kClientCertPath); grpc::SslCredentialsOptions ssl_options; ssl_options.pem_root_certs = root_cert; ssl_options.pem_private_key = client_key; @@ -342,38 +136,25 @@ TEST_P(SslCredentialsTest, SequentialResumption) { grpc_ssl_session_cache* cache = grpc_ssl_session_cache_create_lru(16); - auto full_handshake_context = DoRpc(ssl_options, cache); - EXPECT_EQ(full_handshake_context.status(), absl::OkStatus()); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_SSL_SESSION_REUSED_PROPERTY), - "false"); + DoRpc(server_addr_, ssl_options, cache, /*expect_session_reuse=*/false); for (int i = 0; i < 10; i++) { - auto resumed_handshake_context = DoRpc(ssl_options, cache); - EXPECT_EQ(resumed_handshake_context.status(), absl::OkStatus()); - EXPECT_EQ(GetAuthContextProperty(**resumed_handshake_context, - GRPC_SSL_SESSION_REUSED_PROPERTY), - "true"); + DoRpc(server_addr_, ssl_options, cache, /*expect_session_reuse=*/true); } grpc_ssl_session_cache_destroy(cache); } -TEST_P(SslCredentialsTest, ConcurrentResumption) { - // Skip this test if session caching is disabled. - if (!GetParam().use_session_cache) return; - +TEST_F(SslCredentialsTest, ConcurrentResumption) { server_addr_ = absl::StrCat("localhost:", std::to_string(grpc_pick_unused_port_or_die())); absl::Notification notification; - server_thread_ = new std::thread([&]() { - std::string root_cert = GetFileContents(kCaCertPath); - RunServer(¬ification, root_cert); - }); + server_thread_ = new std::thread([&]() { RunServer(¬ification); }); notification.WaitForNotification(); - std::string root_cert = GetFileContents(kCaCertPath); - std::string client_key = GetFileContents(kClientKeyPath); - std::string client_cert = GetFileContents(kClientCertPath); + std::string root_cert = grpc_core::testing::GetFileContents(kCaCertPath); + std::string client_key = grpc_core::testing::GetFileContents(kClientKeyPath); + std::string client_cert = + grpc_core::testing::GetFileContents(kClientCertPath); grpc::SslCredentialsOptions ssl_options; ssl_options.pem_root_certs = root_cert; ssl_options.pem_private_key = client_key; @@ -381,20 +162,12 @@ TEST_P(SslCredentialsTest, ConcurrentResumption) { grpc_ssl_session_cache* cache = grpc_ssl_session_cache_create_lru(16); - auto full_handshake_context = DoRpc(ssl_options, cache); - EXPECT_EQ(full_handshake_context.status(), absl::OkStatus()); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_SSL_SESSION_REUSED_PROPERTY), - "false"); + DoRpc(server_addr_, ssl_options, cache, /*expect_session_reuse=*/false); std::vector threads; threads.reserve(10); for (int i = 0; i < 10; i++) { threads.push_back(std::thread([&]() { - auto resumed_handshake_context = DoRpc(ssl_options, cache); - EXPECT_EQ(resumed_handshake_context.status(), absl::OkStatus()); - EXPECT_EQ(GetAuthContextProperty(**resumed_handshake_context, - GRPC_SSL_SESSION_REUSED_PROPERTY), - "true"); + DoRpc(server_addr_, ssl_options, cache, /*expect_session_reuse=*/true); })); } for (auto& t : threads) { @@ -404,19 +177,17 @@ TEST_P(SslCredentialsTest, ConcurrentResumption) { grpc_ssl_session_cache_destroy(cache); } -TEST_P(SslCredentialsTest, ResumptionFailsDueToNoCapacityInCache) { +TEST_F(SslCredentialsTest, ResumptionFailsDueToNoCapacityInCache) { server_addr_ = absl::StrCat("localhost:", std::to_string(grpc_pick_unused_port_or_die())); absl::Notification notification; - server_thread_ = new std::thread([&]() { - std::string root_cert = GetFileContents(kCaCertPath); - RunServer(¬ification, root_cert); - }); + server_thread_ = new std::thread([&]() { RunServer(¬ification); }); notification.WaitForNotification(); - std::string root_cert = GetFileContents(kCaCertPath); - std::string client_key = GetFileContents(kClientKeyPath); - std::string client_cert = GetFileContents(kClientCertPath); + std::string root_cert = grpc_core::testing::GetFileContents(kCaCertPath); + std::string client_key = grpc_core::testing::GetFileContents(kClientKeyPath); + std::string client_cert = + grpc_core::testing::GetFileContents(kClientCertPath); grpc::SslCredentialsOptions ssl_options; ssl_options.pem_root_certs = root_cert; ssl_options.pem_private_key = client_key; @@ -424,152 +195,12 @@ TEST_P(SslCredentialsTest, ResumptionFailsDueToNoCapacityInCache) { grpc_ssl_session_cache* cache = grpc_ssl_session_cache_create_lru(0); - for (int i = 0; i < 2; ++i) { - auto full_handshake_context = DoRpc(ssl_options, cache); - EXPECT_EQ(full_handshake_context.status(), absl::OkStatus()); - EXPECT_EQ(GetAuthContextProperty(**full_handshake_context, - GRPC_SSL_SESSION_REUSED_PROPERTY), - "false"); - } + DoRpc(server_addr_, ssl_options, cache, /*expect_session_reuse=*/false); + DoRpc(server_addr_, ssl_options, cache, /*expect_session_reuse=*/false); grpc_ssl_session_cache_destroy(cache); } -TEST_P(SslCredentialsTest, ServerCertificateIsUntrusted) { - server_addr_ = absl::StrCat("localhost:", - std::to_string(grpc_pick_unused_port_or_die())); - absl::Notification notification; - server_thread_ = new std::thread([&]() { - std::string root_cert = GetFileContents(kCaCertPath); - RunServer(¬ification, root_cert); - }); - notification.WaitForNotification(); - - // Use the client's own leaf cert as the root cert, so that the server's cert - // will not be trusted by the client. - std::string root_cert = GetFileContents(kClientCertPath); - std::string client_key = GetFileContents(kClientKeyPath); - std::string client_cert = GetFileContents(kClientCertPath); - grpc::SslCredentialsOptions ssl_options; - ssl_options.pem_root_certs = root_cert; - ssl_options.pem_private_key = client_key; - ssl_options.pem_cert_chain = client_cert; - - grpc_ssl_session_cache* cache = grpc_ssl_session_cache_create_lru(0); - - auto auth_context = DoRpc(ssl_options, cache); - EXPECT_EQ(auth_context.status().code(), absl::StatusCode::kUnavailable); - EXPECT_THAT(auth_context.status().message(), - HasSubstr("CERTIFICATE_VERIFY_FAILED")); - EXPECT_EQ(GetSessionCacheSize(cache), 0); - - grpc_ssl_session_cache_destroy(cache); -} - -TEST_P(SslCredentialsTest, ClientCertificateIsUntrusted) { - // Skip this test if the client certificate is not requested. - if (GetParam().request_type == grpc_ssl_client_certificate_request_type:: - GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE) { - return; - } - - server_addr_ = absl::StrCat("localhost:", - std::to_string(grpc_pick_unused_port_or_die())); - absl::Notification notification; - server_thread_ = new std::thread([&]() { - // Use the server's own leaf cert as the root cert, so that the client's - // cert will not be trusted by the server. - std::string root_cert = GetFileContents(kServerCertPath); - RunServer(¬ification, root_cert); - }); - notification.WaitForNotification(); - - std::string root_cert = GetFileContents(kCaCertPath); - std::string client_key = GetFileContents(kClientKeyPath); - std::string client_cert = GetFileContents(kClientCertPath); - grpc::SslCredentialsOptions ssl_options; - ssl_options.pem_root_certs = root_cert; - ssl_options.pem_private_key = client_key; - ssl_options.pem_cert_chain = client_cert; - - grpc_ssl_session_cache* cache = grpc_ssl_session_cache_create_lru(0); - - auto auth_context = DoRpc(ssl_options, cache); - if (GetParam().request_type == - grpc_ssl_client_certificate_request_type:: - GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY || - GetParam().request_type == - grpc_ssl_client_certificate_request_type:: - GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY) { - EXPECT_EQ(auth_context.status().code(), absl::StatusCode::kUnavailable); - // TODO(matthewstevenson88): Investigate having a more descriptive error - // message for the client. - EXPECT_THAT(auth_context.status().message(), - HasSubstr("failed to connect")); - EXPECT_EQ(GetSessionCacheSize(cache), 0); - } else { - // TODO(matthewstevenson88): The handshake fails with a certificate - // verification error in these cases. This is a bug. Fix this. - } - - grpc_ssl_session_cache_destroy(cache); -} - -TEST_P(SslCredentialsTest, ServerHostnameVerificationFails) { - server_addr_ = absl::StrCat("localhost:", - std::to_string(grpc_pick_unused_port_or_die())); - absl::Notification notification; - server_thread_ = new std::thread([&]() { - std::string root_cert = GetFileContents(kCaCertPath); - RunServer(¬ification, root_cert); - }); - notification.WaitForNotification(); - - std::string root_cert = GetFileContents(kCaCertPath); - std::string client_key = GetFileContents(kClientKeyPath); - std::string client_cert = GetFileContents(kClientCertPath); - grpc::SslCredentialsOptions ssl_options; - ssl_options.pem_root_certs = root_cert; - ssl_options.pem_private_key = client_key; - ssl_options.pem_cert_chain = client_cert; - - grpc_ssl_session_cache* cache = grpc_ssl_session_cache_create_lru(0); - - auto auth_context = - DoRpc(ssl_options, cache, /*override_ssl_target_name=*/false); - EXPECT_EQ(auth_context.status().code(), absl::StatusCode::kUnavailable); - // TODO(matthewstevenson88): Logs say "No match found for server name: - // localhost." but this error is not propagated to the user. Fix this. - EXPECT_FALSE(auth_context.status().message().empty()); - EXPECT_EQ(GetSessionCacheSize(cache), 0); - - grpc_ssl_session_cache_destroy(cache); -} - -std::vector GetSslOptions() { - std::vector ssl_options; - for (grpc_ssl_client_certificate_request_type type : - {grpc_ssl_client_certificate_request_type:: - GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE, - grpc_ssl_client_certificate_request_type:: - GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY, - grpc_ssl_client_certificate_request_type:: - GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY, - grpc_ssl_client_certificate_request_type:: - GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY, - grpc_ssl_client_certificate_request_type:: - GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY}) { - for (bool use_session_cache : {false, true}) { - SslOptions option = {type, use_session_cache}; - ssl_options.push_back(option); - } - } - return ssl_options; -} - -INSTANTIATE_TEST_SUITE_P(SslCredentials, SslCredentialsTest, - ::testing::ValuesIn(GetSslOptions())); - } // namespace } // namespace testing } // namespace grpc diff --git a/test/cpp/end2end/time_change_test.cc b/test/cpp/end2end/time_change_test.cc index 00a396318ef..17f7baec053 100644 --- a/test/cpp/end2end/time_change_test.cc +++ b/test/cpp/end2end/time_change_test.cc @@ -58,7 +58,7 @@ static gpr_timespec now_impl(gpr_clock_type clock) { return ts; } CHECK_GE(ts.tv_nsec, 0); - CHECK(ts.tv_nsec < GPR_NS_PER_SEC); + CHECK_LT(ts.tv_nsec, GPR_NS_PER_SEC); gpr_mu_lock(&g_mu); ts.tv_sec += g_time_shift_sec; ts.tv_nsec += g_time_shift_nsec; @@ -126,7 +126,7 @@ TEST(TimespecTest, GrpcNegativeMillisToTimespec) { .as_timespec(GPR_CLOCK_MONOTONIC); CHECK(ts.tv_sec = -2); CHECK(ts.tv_nsec = 5e8); - CHECK(ts.clock_type == GPR_CLOCK_MONOTONIC); + CHECK_EQ(ts.clock_type, GPR_CLOCK_MONOTONIC); } class TimeChangeTest : public ::testing::Test { diff --git a/test/cpp/end2end/xds/xds_cluster_end2end_test.cc b/test/cpp/end2end/xds/xds_cluster_end2end_test.cc index 41780a96313..d52e767053b 100644 --- a/test/cpp/end2end/xds/xds_cluster_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_cluster_end2end_test.cc @@ -355,13 +355,6 @@ TEST_P(CdsTest, MetricLabels) { "mynamespace"), ::testing::Pair(OptionalLabelKey::kLocality, LocalityNameString("locality1")))); - // TODO(yashkt, yijiem): This shutdown shouldn't actually be necessary. The - // only reason it's here is to add a delay before - // fake_client_call_tracer_factory goes out of scope, since there may be - // lingering callbacks in the call stack that are using the CallAttemptTracer - // even after we get here, which would then cause a crash. Find a cleaner way - // to fix this. - balancer_->Shutdown(); } // diff --git a/test/cpp/end2end/xds/xds_cluster_type_end2end_test.cc b/test/cpp/end2end/xds/xds_cluster_type_end2end_test.cc index a66165dce63..096f3f6fc48 100644 --- a/test/cpp/end2end/xds/xds_cluster_type_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_cluster_type_end2end_test.cc @@ -64,7 +64,7 @@ class ClusterTypeTest : public XdsEnd2endTest { for (int port : ports) { absl::StatusOr lb_uri = grpc_core::URI::Parse(grpc_core::LocalIpUri(port)); - CHECK(lb_uri.ok()); + CHECK_OK(lb_uri); grpc_resolved_address address; CHECK(grpc_parse_uri(*lb_uri, &address)); addresses.emplace_back(address, grpc_core::ChannelArgs()); diff --git a/test/cpp/end2end/xds/xds_end2end_test_lib.h b/test/cpp/end2end/xds/xds_end2end_test_lib.h index 99733eb1565..d0e2f55fd9c 100644 --- a/test/cpp/end2end/xds/xds_end2end_test_lib.h +++ b/test/cpp/end2end/xds/xds_end2end_test_lib.h @@ -243,7 +243,7 @@ class XdsEnd2endTest : public ::testing::TestWithParam, virtual ~ServerThread() { // Shutdown should be called manually. Shutdown calls virtual methods and // can't be called from the base class destructor. - GPR_ASSERT(!running_); + CHECK(!running_); } void Start(); diff --git a/test/cpp/end2end/xds/xds_ring_hash_end2end_test.cc b/test/cpp/end2end/xds/xds_ring_hash_end2end_test.cc index b1dc03b3f9b..d8401484061 100644 --- a/test/cpp/end2end/xds/xds_ring_hash_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_ring_hash_end2end_test.cc @@ -70,7 +70,7 @@ class RingHashTest : public XdsEnd2endTest { for (int port : ports) { absl::StatusOr lb_uri = grpc_core::URI::Parse(grpc_core::LocalIpUri(port)); - CHECK(lb_uri.ok()); + CHECK_OK(lb_uri); grpc_resolved_address address; CHECK(grpc_parse_uri(*lb_uri, &address)); addresses.emplace_back(address, grpc_core::ChannelArgs()); diff --git a/test/cpp/ext/csm/csm_observability_test.cc b/test/cpp/ext/csm/csm_observability_test.cc index 63c2af641c8..da2b5a8dad7 100644 --- a/test/cpp/ext/csm/csm_observability_test.cc +++ b/test/cpp/ext/csm/csm_observability_test.cc @@ -77,15 +77,9 @@ TEST(CsmChannelTargetSelectorTest, CsmObservabilityOutOfScope) { "xds://traffic-director-global.xds.googleapis.com/foo")); } -TEST(CsmServerSelectorTest, ChannelArgsWithoutXdsServerArg) { +TEST(CsmServerSelectorTest, ChannelArgs) { auto obs = CsmObservabilityBuilder().BuildAndRegister(); - EXPECT_FALSE(internal::CsmServerSelector(grpc_core::ChannelArgs())); -} - -TEST(CsmServerSelectorTest, ChannelArgsWithXdsServerArg) { - auto obs = CsmObservabilityBuilder().BuildAndRegister(); - EXPECT_TRUE(internal::CsmServerSelector( - grpc_core::ChannelArgs().Set(GRPC_ARG_XDS_ENABLED_SERVER, true))); + EXPECT_TRUE(internal::CsmServerSelector(grpc_core::ChannelArgs())); } TEST(CsmServerSelectorTest, CsmObservabilityOutOfScope) { diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc index 9999d3957d6..4a850c9fb0c 100644 --- a/test/cpp/grpclb/grpclb_api_test.cc +++ b/test/cpp/grpclb/grpclb_api_test.cc @@ -46,7 +46,7 @@ class GrpclbTest : public ::testing::Test { std::string Ip4ToPackedString(const char* ip_str) { struct in_addr ip4; - CHECK(inet_pton(AF_INET, ip_str, &ip4) == 1); + CHECK_EQ(inet_pton(AF_INET, ip_str, &ip4), 1); return std::string(reinterpret_cast(&ip4), sizeof(ip4)); } @@ -60,7 +60,7 @@ std::string PackedStringToIp(const grpc_core::GrpcLbServer& server) { } else { abort(); } - CHECK(inet_ntop(af, (void*)server.ip_addr, ip_str, 46) != nullptr); + CHECK_NE(inet_ntop(af, (void*)server.ip_addr, ip_str, 46), nullptr); return ip_str; } diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 0964b44099c..b09a70d8cf8 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -138,6 +138,7 @@ grpc_cc_library( grpc_cc_binary( name = "interop_client", + external_deps = ["absl/log:check"], language = "C++", deps = [ ":interop_client_main", @@ -280,6 +281,7 @@ grpc_cc_binary( ], external_deps = [ "absl/flags:flag", + "absl/log:check", "otel/exporters/prometheus:prometheus_exporter", "otel/sdk/src/metrics", ], diff --git a/test/cpp/interop/backend_metrics_lb_policy.cc b/test/cpp/interop/backend_metrics_lb_policy.cc index c97267e9716..216c537a9a6 100644 --- a/test/cpp/interop/backend_metrics_lb_policy.cc +++ b/test/cpp/interop/backend_metrics_lb_policy.cc @@ -67,7 +67,7 @@ class BackendMetricsLbPolicy : public LoadBalancingPolicy { : LoadBalancingPolicy(std::move(args), /*initial_refcount=*/2) { load_report_tracker_ = channel_args().GetPointer(kMetricsTrackerArgument); - CHECK(load_report_tracker_ != nullptr); + CHECK_NE(load_report_tracker_, nullptr); Args delegate_args; delegate_args.work_serializer = work_serializer(); delegate_args.args = channel_args(); diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index b82424a0faa..1da6d3fef0f 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -1328,7 +1328,7 @@ bool InteropClient::DoRpcSoakTest( int32_t soak_min_time_ms_between_rpcs, int32_t overall_timeout_seconds, int32_t request_size, int32_t response_size) { gpr_log(GPR_DEBUG, "Sending %d RPCs...", soak_iterations); - CHECK(soak_iterations > 0); + CHECK_GT(soak_iterations, 0); PerformSoakTest(server_uri, false /* reset channel per iteration */, soak_iterations, max_failures, max_acceptable_per_iteration_latency_ms, @@ -1345,7 +1345,7 @@ bool InteropClient::DoChannelSoakTest( int32_t request_size, int32_t response_size) { gpr_log(GPR_DEBUG, "Sending %d RPCs, tearing down the channel each time...", soak_iterations); - CHECK(soak_iterations > 0); + CHECK_GT(soak_iterations, 0); PerformSoakTest(server_uri, true /* reset channel per iteration */, soak_iterations, max_failures, max_acceptable_per_iteration_latency_ms, @@ -1358,8 +1358,8 @@ bool InteropClient::DoChannelSoakTest( bool InteropClient::DoLongLivedChannelTest(int32_t soak_iterations, int32_t iteration_interval) { gpr_log(GPR_DEBUG, "Sending %d RPCs...", soak_iterations); - CHECK(soak_iterations > 0); - CHECK(iteration_interval > 0); + CHECK_GT(soak_iterations, 0); + CHECK_GT(iteration_interval, 0); SimpleRequest request; SimpleResponse response; int num_failures = 0; diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc index 54e48c68673..26c51b9869a 100644 --- a/test/cpp/interop/interop_server.cc +++ b/test/cpp/interop/interop_server.cc @@ -76,8 +76,8 @@ const char kEchoUserAgentKey[] = "x-grpc-test-echo-useragent"; void MaybeEchoMetadata(ServerContext* context) { const auto& client_metadata = context->client_metadata(); - CHECK(client_metadata.count(kEchoInitialMetadataKey) <= 1); - CHECK(client_metadata.count(kEchoTrailingBinMetadataKey) <= 1); + CHECK_LE(client_metadata.count(kEchoInitialMetadataKey), 1u); + CHECK_LE(client_metadata.count(kEchoTrailingBinMetadataKey), 1u); auto iter = client_metadata.find(kEchoInitialMetadataKey); if (iter != client_metadata.end()) { @@ -420,7 +420,7 @@ void grpc::testing::interop::RunServer( ServerStartedCondition* server_started_condition, std::unique_ptr>> server_options) { - CHECK(port != 0); + CHECK_NE(port, 0); std::ostringstream server_address; server_address << "0.0.0.0:" << port; auto server_metric_recorder = diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc index d7057dfedb7..0ab9525e271 100644 --- a/test/cpp/interop/reconnect_interop_server.cc +++ b/test/cpp/interop/reconnect_interop_server.cc @@ -180,8 +180,8 @@ int main(int argc, char** argv) { grpc::testing::InitTest(&argc, &argv, true); signal(SIGINT, sigint_handler); - CHECK(absl::GetFlag(FLAGS_control_port) != 0); - CHECK(absl::GetFlag(FLAGS_retry_port) != 0); + CHECK_NE(absl::GetFlag(FLAGS_control_port), 0); + CHECK_NE(absl::GetFlag(FLAGS_retry_port), 0); RunServer(); return 0; diff --git a/test/cpp/interop/rpc_behavior_lb_policy.cc b/test/cpp/interop/rpc_behavior_lb_policy.cc index ee0df35fb52..8240000aa63 100644 --- a/test/cpp/interop/rpc_behavior_lb_policy.cc +++ b/test/cpp/interop/rpc_behavior_lb_policy.cc @@ -93,7 +93,7 @@ class RpcBehaviorLbPolicy : public LoadBalancingPolicy { grpc_core::Json::FromArray({grpc_core::Json::FromObject( {{std::string(delegate_->name()), grpc_core::Json::FromObject({})}})})); - CHECK(delegate_config.ok()); + CHECK_OK(delegate_config); args.config = std::move(*delegate_config); return delegate_->UpdateLocked(std::move(args)); } diff --git a/test/cpp/interop/xds_interop_client.cc b/test/cpp/interop/xds_interop_client.cc index ec49c007642..02879a979d6 100644 --- a/test/cpp/interop/xds_interop_client.cc +++ b/test/cpp/interop/xds_interop_client.cc @@ -342,8 +342,8 @@ class XdsUpdateClientConfigureServiceImpl std::vector configs; int request_payload_size = absl::GetFlag(FLAGS_request_payload_size); int response_payload_size = absl::GetFlag(FLAGS_response_payload_size); - CHECK(request_payload_size >= 0); - CHECK(response_payload_size >= 0); + CHECK_GE(request_payload_size, 0); + CHECK_GE(response_payload_size, 0); for (const auto& rpc : request->types()) { RpcConfig config; config.timeout_sec = request->timeout_sec(); @@ -448,7 +448,7 @@ grpc::CsmObservability EnableCsmObservability() { void RunServer(const int port, StatsWatchers* stats_watchers, RpcConfigurationsQueue* rpc_configs_queue) { - CHECK(port != 0); + CHECK_NE(port, 0); std::ostringstream server_address; server_address << "0.0.0.0:" << port; @@ -480,7 +480,7 @@ void BuildRpcConfigsFromFlags(RpcConfigurationsQueue* rpc_configs_queue) { for (auto& data : rpc_metadata) { std::vector metadata = absl::StrSplit(data, ':', absl::SkipEmpty()); - CHECK(metadata.size() == 3); + CHECK_EQ(metadata.size(), 3u); if (metadata[0] == "EmptyCall") { metadata_map[ClientConfigureRequest::EMPTY_CALL].push_back( {metadata[1], metadata[2]}); @@ -496,8 +496,8 @@ void BuildRpcConfigsFromFlags(RpcConfigurationsQueue* rpc_configs_queue) { absl::StrSplit(absl::GetFlag(FLAGS_rpc), ',', absl::SkipEmpty()); int request_payload_size = absl::GetFlag(FLAGS_request_payload_size); int response_payload_size = absl::GetFlag(FLAGS_response_payload_size); - CHECK(request_payload_size >= 0); - CHECK(response_payload_size >= 0); + CHECK_GE(request_payload_size, 0); + CHECK_GE(response_payload_size, 0); for (const std::string& rpc_method : rpc_methods) { RpcConfig config; if (rpc_method == "EmptyCall") { diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 29dd386db58..05045fc5a12 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -365,7 +365,7 @@ static void BM_HpackParserParseHeader(benchmark::State& state) { auto error = p.Parse(slices[i], i == slices.size() - 1, absl::BitGenRef(bitgen), /*call_tracer=*/nullptr); - CHECK(error.ok()); + CHECK_OK(error); } }; parse_vec(init_slices); @@ -445,7 +445,7 @@ class FromEncoderFixture { } // Remove the HTTP header. CHECK(!out.empty()); - CHECK(GRPC_SLICE_LENGTH(out[0]) > 9); + CHECK_GT(GRPC_SLICE_LENGTH(out[0]), 9); out[0] = grpc_slice_sub_no_ref(out[0], 9, GRPC_SLICE_LENGTH(out[0])); return out; } diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 9321c2347cf..909cee97cf3 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -395,7 +395,7 @@ static void BM_TransportEmptyOp(benchmark::State& state) { gpr_event_init(stream_cancel_done); std::unique_ptr stream_cancel_closure = MakeTestClosure([&](grpc_error_handle error) { - CHECK(error.ok()); + CHECK_OK(error); gpr_event_set(stream_cancel_done, reinterpret_cast(1)); }); op.on_complete = stream_cancel_closure.get(); diff --git a/test/cpp/microbenchmarks/bm_event_engine_run.cc b/test/cpp/microbenchmarks/bm_event_engine_run.cc index 1dcbbe81465..6c7fc5a5708 100644 --- a/test/cpp/microbenchmarks/bm_event_engine_run.cc +++ b/test/cpp/microbenchmarks/bm_event_engine_run.cc @@ -181,7 +181,7 @@ void FanOutCallback(std::shared_ptr engine, signal.Notify(); return; } - GPR_DEBUG_ASSERT(local_cnt < params.limit); + DCHECK_LT(local_cnt, params.limit); if (params.depth == processing_layer) return; for (int i = 0; i < params.fanout; i++) { engine->Run([engine, params, processing_layer, &count, &signal]() { @@ -244,7 +244,7 @@ void BM_EventEngine_Closure_FanOut(benchmark::State& state) { })); } for (auto _ : state) { - GPR_DEBUG_ASSERT(count.load(std::memory_order_relaxed) == 0); + DCHECK_EQ(count.load(std::memory_order_relaxed), 0); engine->Run(closures[params.depth + 1]); do { signal->WaitForNotification(); diff --git a/test/cpp/microbenchmarks/bm_thread_pool.cc b/test/cpp/microbenchmarks/bm_thread_pool.cc index b0e101109eb..351b6921bfc 100644 --- a/test/cpp/microbenchmarks/bm_thread_pool.cc +++ b/test/cpp/microbenchmarks/bm_thread_pool.cc @@ -156,7 +156,7 @@ void FanOutCallback(std::shared_ptr pool, signal.Notify(); return; } - GPR_DEBUG_ASSERT(local_cnt < params.limit); + DCHECK_LT(local_cnt, params.limit); if (params.depth == processing_layer) return; for (int i = 0; i < params.fanout; i++) { pool->Run([pool, params, processing_layer, &count, &signal]() { @@ -222,7 +222,7 @@ void BM_ThreadPool_Closure_FanOut(benchmark::State& state) { })); } for (auto _ : state) { - GPR_DEBUG_ASSERT(count.load(std::memory_order_relaxed) == 0); + DCHECK_EQ(count.load(std::memory_order_relaxed), 0); pool->Run(closures[params.depth + 1]); do { signal->WaitForNotification(); diff --git a/test/cpp/naming/BUILD b/test/cpp/naming/BUILD index 258b0cedcec..e7dafa0e4c7 100644 --- a/test/cpp/naming/BUILD +++ b/test/cpp/naming/BUILD @@ -38,7 +38,10 @@ grpc_py_binary( grpc_cc_test( name = "cancel_ares_query_test", srcs = ["cancel_ares_query_test.cc"], - external_deps = ["gtest"], + external_deps = [ + "absl/log:check", + "gtest", + ], tags = ["cancel_ares_query_test"], deps = [ "//:gpr", diff --git a/test/cpp/naming/address_sorting_test.cc b/test/cpp/naming/address_sorting_test.cc index 8e0b45872e7..7a5016a972f 100644 --- a/test/cpp/naming/address_sorting_test.cc +++ b/test/cpp/naming/address_sorting_test.cc @@ -24,6 +24,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -74,16 +76,16 @@ grpc_resolved_address TestAddressToGrpcResolvedAddress(TestAddress test_addr) { memset(&in_dest, 0, sizeof(sockaddr_in)); in_dest.sin_port = htons(atoi(port.c_str())); in_dest.sin_family = AF_INET; - GPR_ASSERT(inet_pton(AF_INET, host.c_str(), &in_dest.sin_addr) == 1); + CHECK_EQ(inet_pton(AF_INET, host.c_str(), &in_dest.sin_addr), 1); memcpy(&resolved_addr.addr, &in_dest, sizeof(sockaddr_in)); resolved_addr.len = sizeof(sockaddr_in); } else { - GPR_ASSERT(test_addr.family == AF_INET6); + CHECK(test_addr.family == AF_INET6); sockaddr_in6 in6_dest; memset(&in6_dest, 0, sizeof(sockaddr_in6)); in6_dest.sin6_port = htons(atoi(port.c_str())); in6_dest.sin6_family = AF_INET6; - GPR_ASSERT(inet_pton(AF_INET6, host.c_str(), &in6_dest.sin6_addr) == 1); + CHECK_EQ(inet_pton(AF_INET6, host.c_str(), &in6_dest.sin6_addr), 1); memcpy(&resolved_addr.addr, &in6_dest, sizeof(sockaddr_in6)); resolved_addr.len = sizeof(sockaddr_in6); } diff --git a/test/cpp/naming/cancel_ares_query_test.cc b/test/cpp/naming/cancel_ares_query_test.cc index 9b6cacafd49..472ed54e26e 100644 --- a/test/cpp/naming/cancel_ares_query_test.cc +++ b/test/cpp/naming/cancel_ares_query_test.cc @@ -23,6 +23,7 @@ #include +#include "absl/log/check.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -295,7 +296,7 @@ void TestCancelDuringActiveQuery( grpc_call* call = grpc_channel_create_call( client, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/foo"), nullptr, rpc_deadline, nullptr); - GPR_ASSERT(call); + CHECK(call); grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; diff --git a/test/cpp/naming/generate_resolver_component_tests.bzl b/test/cpp/naming/generate_resolver_component_tests.bzl index c93a22619b9..1c9d6a84b76 100755 --- a/test/cpp/naming/generate_resolver_component_tests.bzl +++ b/test/cpp/naming/generate_resolver_component_tests.bzl @@ -32,6 +32,7 @@ def generate_resolver_component_tests(): "address_sorting_test.cc", ], external_deps = [ + "absl/log:check", "gtest", ], deps = [ @@ -53,6 +54,7 @@ def generate_resolver_component_tests(): "resolver_component_test.cc", ], external_deps = [ + "absl/log:check", "gtest", ], deps = [ @@ -75,6 +77,7 @@ def generate_resolver_component_tests(): ], external_deps = [ "absl/flags:flag", + "absl/log:check", "absl/strings", ], deps = [ diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc index d7aaef9921f..c5d52612ac4 100644 --- a/test/cpp/naming/resolver_component_test.cc +++ b/test/cpp/naming/resolver_component_test.cc @@ -27,6 +27,7 @@ #include #include "absl/flags/flag.h" +#include "absl/log/check.h" #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -209,7 +210,7 @@ void ArgsInit(ArgsStruct* args) { void DoNothing(void* /*arg*/, grpc_error_handle /*error*/) {} void ArgsFinish(ArgsStruct* args) { - GPR_ASSERT(gpr_event_wait(&args->ev, TestDeadline())); + CHECK(gpr_event_wait(&args->ev, TestDeadline())); grpc_pollset_set_del_pollset(args->pollset_set, args->pollset); grpc_pollset_set_destroy(args->pollset_set); grpc_closure DoNothing_cb; @@ -242,7 +243,7 @@ void PollPollsetUntilRequestDone(ArgsStruct* args) { gpr_time_sub(deadline, gpr_now(GPR_CLOCK_REALTIME)); gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64 ".%09d", args->done, time_left.tv_sec, time_left.tv_nsec); - GPR_ASSERT(gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)) >= 0); + CHECK_GE(gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)), 0); grpc_pollset_worker* worker = nullptr; grpc_core::ExecCtx exec_ctx; if (grpc_core::IsEventEngineDnsEnabled()) { @@ -304,7 +305,7 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler { void ReportResult(grpc_core::Resolver::Result result) override { CheckResult(result); grpc_core::MutexLockForGprMu lock(args_->mu); - GPR_ASSERT(!args_->done); + CHECK(!args_->done); args_->done = true; GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(args_->pollset, nullptr)); @@ -362,7 +363,7 @@ class CheckingResultHandler : public ResultHandler { "Invalid for setting for --do_ordered_address_comparison. " "Have %s, want True or False", absl::GetFlag(FLAGS_do_ordered_address_comparison).c_str()); - GPR_ASSERT(0); + CHECK(0); } if (!result.service_config.ok()) { CheckServiceConfigResultLocked(nullptr, result.service_config.status(), @@ -405,7 +406,7 @@ void InjectBrokenNameServerList(ares_channel* channel) { memset(dns_server_addrs, 0, sizeof(dns_server_addrs)); std::string unused_host; std::string local_dns_server_port; - GPR_ASSERT(grpc_core::SplitHostPort( + CHECK(grpc_core::SplitHostPort( absl::GetFlag(FLAGS_local_dns_server_address).c_str(), &unused_host, &local_dns_server_port)); gpr_log(GPR_DEBUG, @@ -429,8 +430,7 @@ void InjectBrokenNameServerList(ares_channel* channel) { dns_server_addrs[1].tcp_port = atoi(local_dns_server_port.c_str()); dns_server_addrs[1].udp_port = atoi(local_dns_server_port.c_str()); dns_server_addrs[1].next = nullptr; - GPR_ASSERT(ares_set_servers_ports(*channel, dns_server_addrs) == - ARES_SUCCESS); + CHECK(ares_set_servers_ports(*channel, dns_server_addrs) == ARES_SUCCESS); } void StartResolvingLocked(grpc_core::Resolver* r) { r->StartLocked(); } diff --git a/test/cpp/naming/resolver_component_tests_runner_invoker.cc b/test/cpp/naming/resolver_component_tests_runner_invoker.cc index f5b8c455e9e..4ad878ef181 100644 --- a/test/cpp/naming/resolver_component_tests_runner_invoker.cc +++ b/test/cpp/naming/resolver_component_tests_runner_invoker.cc @@ -27,6 +27,7 @@ #include #include "absl/flags/flag.h" +#include "absl/log/check.h" #include "absl/strings/str_format.h" #include @@ -99,12 +100,12 @@ int main(int argc, char** argv) { grpc::testing::TestEnvironment env(&argc, argv); grpc::testing::InitTest(&argc, &argv, true); grpc_init(); - GPR_ASSERT(!absl::GetFlag(FLAGS_test_bin_name).empty()); + CHECK(!absl::GetFlag(FLAGS_test_bin_name).empty()); std::string my_bin = argv[0]; int result = 0; if (absl::GetFlag(FLAGS_running_under_bazel)) { - GPR_ASSERT(!absl::GetFlag(FLAGS_grpc_test_directory_relative_to_test_srcdir) - .empty()); + CHECK(!absl::GetFlag(FLAGS_grpc_test_directory_relative_to_test_srcdir) + .empty()); // Use bazel's TEST_SRCDIR environment variable to locate the "test data" // binaries. auto test_srcdir = grpc_core::GetEnv("TEST_SRCDIR"); diff --git a/test/cpp/performance/BUILD b/test/cpp/performance/BUILD index 15de8b3d73c..4a9f64c4095 100644 --- a/test/cpp/performance/BUILD +++ b/test/cpp/performance/BUILD @@ -22,6 +22,7 @@ grpc_cc_test( name = "writes_per_rpc_test", srcs = ["writes_per_rpc_test.cc"], external_deps = [ + "absl/log:check", "gtest", ], tags = ["no_windows"], diff --git a/test/cpp/performance/writes_per_rpc_test.cc b/test/cpp/performance/writes_per_rpc_test.cc index 4b38fbbc258..76c93fd9b59 100644 --- a/test/cpp/performance/writes_per_rpc_test.cc +++ b/test/cpp/performance/writes_per_rpc_test.cc @@ -20,6 +20,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -79,16 +81,16 @@ class InProcessCHTTP2 { listener_endpoint = std::move(ep); listener_started.Notify(); }, - [](absl::Status status) { GPR_ASSERT(status.ok()); }, config, + [](absl::Status status) { CHECK_OK(status); }, config, std::make_unique("foo")); if (!listener.ok()) { grpc_core::Crash(absl::StrCat("failed to start listener: ", listener.status().ToString())); } auto target_addr = URIToResolvedAddress(addr); - GPR_ASSERT(target_addr.ok()); - GPR_ASSERT((*listener)->Bind(*target_addr).ok()); - GPR_ASSERT((*listener)->Start().ok()); + CHECK_OK(target_addr); + CHECK_OK((*listener)->Bind(*target_addr)); + CHECK_OK((*listener)->Start()); // Creating the client std::unique_ptr client_endpoint; grpc_core::Notification client_connected; @@ -96,7 +98,7 @@ class InProcessCHTTP2 { std::make_unique("client"); std::ignore = fuzzing_engine->Connect( [&](absl::StatusOr> endpoint) { - GPR_ASSERT(endpoint.ok()); + CHECK_OK(endpoint); client_endpoint = std::move(*endpoint); client_connected.Notify(); }, @@ -124,7 +126,7 @@ class InProcessCHTTP2 { for (grpc_pollset* pollset : core_server->pollsets()) { grpc_endpoint_add_to_pollset(iomgr_server_endpoint, pollset); } - GPR_ASSERT(GRPC_LOG_IF_ERROR( + CHECK(GRPC_LOG_IF_ERROR( "SetupTransport", core_server->SetupTransport(transport, nullptr, core_server->channel_args(), nullptr))); @@ -143,7 +145,7 @@ class InProcessCHTTP2 { grpc_core::Transport* transport = grpc_create_chttp2_transport( args, grpc_event_engine_endpoint_create(std::move(client_endpoint)), /*is_client=*/true); - GPR_ASSERT(transport); + CHECK(transport); grpc_channel* channel = grpc_core::ChannelCreate("target", args, GRPC_CLIENT_DIRECT_CHANNEL, transport) @@ -234,20 +236,20 @@ static double UnaryPingPong(ThreadedFuzzingEventEngine* fuzzing_engine, void* t; bool ok; response_reader->Finish(&recv_response, &recv_status, tag(4)); - GPR_ASSERT(fixture->cq()->Next(&t, &ok)); - GPR_ASSERT(ok); - GPR_ASSERT(t == tag(0) || t == tag(1)); + CHECK(fixture->cq()->Next(&t, &ok)); + CHECK(ok); + CHECK(t == tag(0) || t == tag(1)); intptr_t slot = reinterpret_cast(t); ServerEnv* senv = server_env[slot]; senv->response_writer.Finish(send_response, Status::OK, tag(3)); for (int i = (1 << 3) | (1 << 4); i != 0;) { - GPR_ASSERT(fixture->cq()->Next(&t, &ok)); - GPR_ASSERT(ok); + CHECK(fixture->cq()->Next(&t, &ok)); + CHECK(ok); int tagnum = static_cast(reinterpret_cast(t)); - GPR_ASSERT(i & (1 << tagnum)); + CHECK(i & (1 << tagnum)); i -= 1 << tagnum; } - GPR_ASSERT(recv_status.ok()); + CHECK(recv_status.ok()); senv->~ServerEnv(); senv = new (senv) ServerEnv(); diff --git a/test/cpp/qps/parse_json.cc b/test/cpp/qps/parse_json.cc index 69b644f7065..c104550f4a1 100644 --- a/test/cpp/qps/parse_json.cc +++ b/test/cpp/qps/parse_json.cc @@ -57,7 +57,7 @@ std::string SerializeJson(const GRPC_CUSTOM_MESSAGE& msg, msg.SerializeToString(&binary); auto status = BinaryToJsonString(type_resolver.get(), type, binary, &json_string); - CHECK(status.ok()); + CHECK_OK(status); return json_string; } diff --git a/test/cpp/server/BUILD b/test/cpp/server/BUILD index 0927de6c7a0..5bb6532ba93 100644 --- a/test/cpp/server/BUILD +++ b/test/cpp/server/BUILD @@ -72,6 +72,7 @@ grpc_cc_test( "//src/core/tsi/test_creds:server1.pem", ], external_deps = [ + "absl/log:check", "gtest", ], deps = [ diff --git a/test/cpp/server/credentials_test.cc b/test/cpp/server/credentials_test.cc index 879c2c101dd..72111a5692b 100644 --- a/test/cpp/server/credentials_test.cc +++ b/test/cpp/server/credentials_test.cc @@ -18,6 +18,8 @@ #include +#include "absl/log/check.h" + #include #include #include @@ -73,7 +75,7 @@ TEST( options.set_cert_request_type( GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY); auto server_credentials = grpc::experimental::TlsServerCredentials(options); - GPR_ASSERT(server_credentials.get() != nullptr); + CHECK_NE(server_credentials.get(), nullptr); } // ServerCredentials should always have identity credential presented. @@ -95,7 +97,7 @@ TEST(CredentialsTest, options.set_cert_request_type( GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY); auto server_credentials = grpc::experimental::TlsServerCredentials(options); - GPR_ASSERT(server_credentials.get() != nullptr); + CHECK_NE(server_credentials.get(), nullptr); } TEST( @@ -111,7 +113,7 @@ TEST( options.set_cert_request_type( GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY); auto server_credentials = grpc::experimental::TlsServerCredentials(options); - GPR_ASSERT(server_credentials.get() != nullptr); + CHECK_NE(server_credentials.get(), nullptr); } TEST(CredentialsTest, TlsServerCredentialsWithCrlChecking) { @@ -126,7 +128,7 @@ TEST(CredentialsTest, TlsServerCredentialsWithCrlChecking) { GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY); options.set_crl_directory(CRL_DIR_PATH); auto server_credentials = grpc::experimental::TlsServerCredentials(options); - GPR_ASSERT(server_credentials.get() != nullptr); + CHECK_NE(server_credentials.get(), nullptr); } // ServerCredentials should always have identity credential presented. @@ -142,7 +144,7 @@ TEST( options.set_cert_request_type( GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY); auto server_credentials = grpc::experimental::TlsServerCredentials(options); - GPR_ASSERT(server_credentials.get() != nullptr); + CHECK_NE(server_credentials.get(), nullptr); } TEST(CredentialsTest, TlsServerCredentialsWithSyncExternalVerifier) { @@ -159,7 +161,7 @@ TEST(CredentialsTest, TlsServerCredentialsWithSyncExternalVerifier) { GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY); options.set_certificate_verifier(verifier); auto server_credentials = grpc::experimental::TlsServerCredentials(options); - GPR_ASSERT(server_credentials.get() != nullptr); + CHECK_NE(server_credentials.get(), nullptr); } TEST(CredentialsTest, TlsServerCredentialsWithAsyncExternalVerifier) { @@ -176,7 +178,7 @@ TEST(CredentialsTest, TlsServerCredentialsWithAsyncExternalVerifier) { GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY); options.set_certificate_verifier(verifier); auto server_credentials = grpc::experimental::TlsServerCredentials(options); - GPR_ASSERT(server_credentials.get() != nullptr); + CHECK_NE(server_credentials.get(), nullptr); } TEST(CredentialsTest, TlsServerCredentialsWithCrlProvider) { @@ -187,7 +189,7 @@ TEST(CredentialsTest, TlsServerCredentialsWithCrlProvider) { grpc::experimental::TlsServerCredentialsOptions options(certificate_provider); options.set_crl_provider(*provider); auto channel_credentials = grpc::experimental::TlsServerCredentials(options); - GPR_ASSERT(channel_credentials.get() != nullptr); + CHECK_NE(channel_credentials.get(), nullptr); } TEST(CredentialsTest, TlsServerCredentialsWithCrlProviderAndDirectory) { @@ -201,7 +203,7 @@ TEST(CredentialsTest, TlsServerCredentialsWithCrlProviderAndDirectory) { auto server_credentials = grpc::experimental::TlsServerCredentials(options); // TODO(gtcooke94) - behavior might change to make this return nullptr in // the future - GPR_ASSERT(server_credentials != nullptr); + CHECK_NE(server_credentials, nullptr); } TEST(CredentialsTest, TlsCredentialsOptionsDoesNotLeak) { diff --git a/test/cpp/server/load_reporter/BUILD b/test/cpp/server/load_reporter/BUILD index 25c995582bc..475fc9018ea 100644 --- a/test/cpp/server/load_reporter/BUILD +++ b/test/cpp/server/load_reporter/BUILD @@ -34,6 +34,8 @@ grpc_cc_test( name = "lb_load_reporter_test", srcs = ["load_reporter_test.cc"], external_deps = [ + "absl/flags:flag", + "absl/log:check", "gtest", "opencensus-stats-test", ], diff --git a/test/cpp/server/load_reporter/load_reporter_test.cc b/test/cpp/server/load_reporter/load_reporter_test.cc index b88ebb5ef2a..b66b66ddfb9 100644 --- a/test/cpp/server/load_reporter/load_reporter_test.cc +++ b/test/cpp/server/load_reporter/load_reporter_test.cc @@ -24,6 +24,7 @@ #include #include +#include "absl/log/check.h" #include "absl/memory/memory.h" #include "opencensus/stats/testing/test_utils.h" @@ -59,7 +60,7 @@ class MockCensusViewProvider : public CensusViewProvider { const ViewDescriptor& FindViewDescriptor(const std::string& view_name) { auto it = view_descriptor_map().find(view_name); - GPR_ASSERT(it != view_descriptor_map().end()); + CHECK(it != view_descriptor_map().end()); return it->second; } }; diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index fe324d5fa78..707c6db9524 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -77,6 +77,7 @@ grpc_cc_library( ], external_deps = [ "absl/flags:flag", + "absl/log:check", "protobuf", ], deps = [ @@ -139,6 +140,7 @@ grpc_cc_library( ], external_deps = [ "absl/flags:flag", + "absl/log:check", "protobuf", "protobuf_clib", ], @@ -335,6 +337,7 @@ grpc_cc_binary( srcs = ["channelz_sampler.cc"], external_deps = [ "absl/flags:flag", + "absl/log:check", "absl/strings", ], language = "c++", @@ -360,6 +363,7 @@ grpc_cc_test( ":channelz_sampler", ], external_deps = [ + "absl/log:check", "gtest", ], flaky = True, diff --git a/test/cpp/util/channelz_sampler.cc b/test/cpp/util/channelz_sampler.cc index 4515aa60e21..d5a79514595 100644 --- a/test/cpp/util/channelz_sampler.cc +++ b/test/cpp/util/channelz_sampler.cc @@ -27,6 +27,7 @@ #include #include "absl/flags/flag.h" +#include "absl/log/check.h" #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" #include "google/protobuf/text_format.h" @@ -134,7 +135,7 @@ class ChannelzSampler final { if (!status.ok()) { gpr_log(GPR_ERROR, "GetChannelRPC failed: %s", get_channel_context.debug_error_string().c_str()); - GPR_ASSERT(0); + CHECK(0); } return get_channel_response.channel(); } @@ -153,7 +154,7 @@ class ChannelzSampler final { if (!status.ok()) { gpr_log(GPR_ERROR, "GetSubchannelRPC failed: %s", get_subchannel_context.debug_error_string().c_str()); - GPR_ASSERT(0); + CHECK(0); } return get_subchannel_response.subchannel(); } @@ -171,7 +172,7 @@ class ChannelzSampler final { if (!status.ok()) { gpr_log(GPR_ERROR, "GetSocketRPC failed: %s", get_socket_context.debug_error_string().c_str()); - GPR_ASSERT(0); + CHECK(0); } return get_socket_response.socket(); } @@ -300,7 +301,7 @@ class ChannelzSampler final { "Wrong user credential type: %s. Allowed credential types: " "INSECURE_CREDENTIALS, ssl, alts, google_default_credentials.", custom_credentials_type.c_str()); - GPR_ASSERT(0); + CHECK(0); } std::shared_ptr channel = CreateChannel(server_address, channel_creds); @@ -333,7 +334,7 @@ class ChannelzSampler final { static_cast(server_start_id), get_servers_context.debug_error_string().c_str()); } - GPR_ASSERT(0); + CHECK(0); } for (const auto& _server : get_servers_response.server()) { all_servers_.push_back(_server); @@ -388,7 +389,7 @@ class ChannelzSampler final { "GetTopChannelsRequest.channel_start_id=%d failed: %s", static_cast(channel_start_id), get_top_channels_context.debug_error_string().c_str()); - GPR_ASSERT(0); + CHECK(0); } for (const auto& _topchannel : get_top_channels_response.channel()) { top_channels_.push_back(_topchannel); diff --git a/test/cpp/util/channelz_sampler_test.cc b/test/cpp/util/channelz_sampler_test.cc index 3b5520a76e4..03ea7139a27 100644 --- a/test/cpp/util/channelz_sampler_test.cc +++ b/test/cpp/util/channelz_sampler_test.cc @@ -24,6 +24,7 @@ #include #include +#include "absl/log/check.h" #include "absl/strings/str_cat.h" #include "gtest/gtest.h" @@ -96,7 +97,7 @@ void RunClient(const std::string& client_id, gpr_event* done_ev) { Status status = stub->EmptyCall(&context, request, &response); if (!status.ok()) { gpr_log(GPR_ERROR, "Client echo failed."); - GPR_ASSERT(0); + CHECK(0); } } } @@ -146,17 +147,17 @@ TEST(ChannelzSamplerTest, SimpleTest) { gpr_log(GPR_ERROR, "Channelz sampler test test-runner exited with code %d", WEXITSTATUS(status)); - GPR_ASSERT(0); // log the line number of the assertion failure + CHECK(0); // log the line number of the assertion failure } } else if (WIFSIGNALED(status)) { gpr_log(GPR_ERROR, "Channelz sampler test test-runner ended from signal %d", WTERMSIG(status)); - GPR_ASSERT(0); + CHECK(0); } else { gpr_log(GPR_ERROR, "Channelz sampler test test-runner ended with unknown status %d", status); - GPR_ASSERT(0); + CHECK(0); } delete test_driver; gpr_event_set(&done_ev1, reinterpret_cast(1)); diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index 6e914e72820..df765c64a49 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -22,6 +22,8 @@ #include #include +#include "absl/log/check.h" + #include #include #include @@ -81,7 +83,7 @@ CliCall::CliCall(const std::shared_ptr& channel, void* got_tag; bool ok; cq_.Next(&got_tag, &ok); - GPR_ASSERT(ok); + CHECK(ok); } CliCall::~CliCall() { @@ -98,7 +100,7 @@ void CliCall::Write(const std::string& request) { grpc::ByteBuffer send_buffer(&req_slice, 1); call_->Write(send_buffer, tag(2)); cq_.Next(&got_tag, &ok); - GPR_ASSERT(ok); + CHECK(ok); } bool CliCall::Read(std::string* response, @@ -113,7 +115,7 @@ bool CliCall::Read(std::string* response, return false; } std::vector slices; - GPR_ASSERT(recv_buffer.Dump(&slices).ok()); + CHECK(recv_buffer.Dump(&slices).ok()); response->clear(); for (size_t i = 0; i < slices.size(); i++) { @@ -132,7 +134,7 @@ void CliCall::WritesDone() { call_->WritesDone(tag(4)); cq_.Next(&got_tag, &ok); - GPR_ASSERT(ok); + CHECK(ok); } void CliCall::WriteAndWait(const std::string& request) { @@ -175,7 +177,7 @@ bool CliCall::ReadAndMaybeNotifyWrite( cq_result = cq_.Next(&got_tag, &ok); if (got_tag == tag(2)) { - GPR_ASSERT(ok); + CHECK(ok); } } @@ -186,7 +188,7 @@ bool CliCall::ReadAndMaybeNotifyWrite( gpr_mu_lock(&write_mu_); if (!write_done_) { cq_.Next(&got_tag, &ok); - GPR_ASSERT(got_tag != tag(2)); + CHECK(got_tag != tag(2)); write_done_ = true; gpr_cv_signal(&write_cv_); } @@ -196,7 +198,7 @@ bool CliCall::ReadAndMaybeNotifyWrite( } std::vector slices; - GPR_ASSERT(recv_buffer.Dump(&slices).ok()); + CHECK(recv_buffer.Dump(&slices).ok()); response->clear(); for (size_t i = 0; i < slices.size(); i++) { response->append(reinterpret_cast(slices[i].begin()), @@ -215,7 +217,7 @@ Status CliCall::Finish(IncomingMetadataContainer* server_trailing_metadata) { call_->Finish(&status, tag(5)); cq_.Next(&got_tag, &ok); - GPR_ASSERT(ok); + CHECK(ok); if (server_trailing_metadata) { *server_trailing_metadata = ctx_.GetServerTrailingMetadata(); } diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index 6f5ad07ce7e..f5c3a9a037e 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -19,6 +19,7 @@ #include "test/cpp/util/create_test_channel.h" #include "absl/flags/flag.h" +#include "absl/log/check.h" #include #include @@ -135,7 +136,7 @@ std::shared_ptr CreateTestChannel( std::shared_ptr channel_creds = testing::GetCredentialsProvider()->GetChannelCredentials(credential_type, &channel_args); - GPR_ASSERT(channel_creds != nullptr); + CHECK_NE(channel_creds, nullptr); if (creds.get()) { channel_creds = grpc::CompositeChannelCredentials(channel_creds, creds); } @@ -174,7 +175,7 @@ std::shared_ptr CreateTestChannel( channel_creds = testing::GetCredentialsProvider()->GetChannelCredentials( testing::kTlsCredentialsType, &channel_args); } - GPR_ASSERT(channel_creds != nullptr); + CHECK_NE(channel_creds, nullptr); const std::string& connect_to = server.empty() ? override_hostname : server; if (creds.get()) { @@ -190,7 +191,7 @@ std::shared_ptr CreateTestChannel( } else { channel_creds = testing::GetCredentialsProvider()->GetChannelCredentials( cred_type, &channel_args); - GPR_ASSERT(channel_creds != nullptr); + CHECK_NE(channel_creds, nullptr); if (interceptor_creators.empty()) { return grpc::CreateCustomChannel(server, channel_creds, channel_args); @@ -252,7 +253,7 @@ std::shared_ptr CreateTestChannel( std::shared_ptr channel_creds = testing::GetCredentialsProvider()->GetChannelCredentials(credential_type, &channel_args); - GPR_ASSERT(channel_creds != nullptr); + CHECK_NE(channel_creds, nullptr); if (creds.get()) { channel_creds = grpc::CompositeChannelCredentials(channel_creds, creds); } diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc index 19504f5762c..c85de0a8b25 100644 --- a/test/cpp/util/test_credentials_provider.cc +++ b/test/cpp/util/test_credentials_provider.cc @@ -26,6 +26,7 @@ #include #include "absl/flags/flag.h" +#include "absl/log/check.h" #include #include @@ -176,7 +177,7 @@ CredentialsProvider* GetCredentialsProvider() { void SetCredentialsProvider(CredentialsProvider* provider) { // For now, forbids overriding provider. - GPR_ASSERT(g_provider == nullptr); + CHECK_EQ(g_provider, nullptr); g_provider = provider; } diff --git a/test/cpp/util/windows/BUILD b/test/cpp/util/windows/BUILD index ffd2352efd4..7bf6080b21b 100644 --- a/test/cpp/util/windows/BUILD +++ b/test/cpp/util/windows/BUILD @@ -31,6 +31,7 @@ grpc_cc_library( "manifest_file.h", ], external_deps = [ + "absl/log:check", "absl/strings", ], deps = [ diff --git a/test/cpp/util/windows/manifest_file.cc b/test/cpp/util/windows/manifest_file.cc index 455095dcc1e..0bf2c9d3f01 100644 --- a/test/cpp/util/windows/manifest_file.cc +++ b/test/cpp/util/windows/manifest_file.cc @@ -24,6 +24,7 @@ #include #include +#include "absl/log/check.h" #include "absl/strings/str_format.h" #include "absl/strings/str_replace.h" #include "absl/strings/str_split.h" @@ -57,7 +58,7 @@ std::string ManifestFile::Get(const std::string& key) { std::getline(filestream_, line); if (!line.empty()) { std::vector kv = absl::StrSplit(line, " "); - GPR_ASSERT(kv.size() == 2); + CHECK_EQ(kv.size(), 2u); cache_.emplace(kv[0], kv[1]); if (kv[0] == key) { return kv[1]; diff --git a/tools/codegen/core/gen_join.py b/tools/codegen/core/gen_join.py index 6ddea69532a..83337653205 100755 --- a/tools/codegen/core/gen_join.py +++ b/tools/codegen/core/gen_join.py @@ -39,7 +39,7 @@ struct JoinState { % endfor } JoinState(const JoinState& other) { - GPR_ASSERT(other.ready.none()); + CHECK(other.ready.none()); % for i in range(0,n): Construct(&promise${i}, other.promise${i}); % endfor @@ -108,6 +108,8 @@ front_matter = """ #include +#include "absl/log/check.h" + #include "src/core/lib/gprpp/construct_destruct.h" #include "src/core/lib/promise/detail/promise_like.h" #include "src/core/lib/promise/poll.h" diff --git a/tools/codegen/core/gen_seq.py b/tools/codegen/core/gen_seq.py index 1a105a460ef..c5d284c1a2f 100755 --- a/tools/codegen/core/gen_seq.py +++ b/tools/codegen/core/gen_seq.py @@ -110,7 +110,7 @@ tail${i}: % endfor } SeqState(const SeqState& other) noexcept : state(other.state), whence(other.whence) { - GPR_ASSERT(state == State::kState0); + CHECK(state == State::kState0); Construct(&${"prior."*(n-1-i)}current_promise, other.${"prior."*(n-1-i)}current_promise); % for i in range(0,n-1): @@ -197,6 +197,7 @@ front_matter = """ #include +#include "absl/log/check.h" #include "absl/base/attributes.h" #include "absl/strings/str_cat.h" diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 45745a6b3c8..3cc34f6b422 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1083,10 +1083,14 @@ include/grpcpp/support/time.h \ include/grpcpp/support/validate_service_config.h \ include/grpcpp/version_info.h \ include/grpcpp/xds_server_builder.h \ +src/core/channelz/channel_trace.cc \ +src/core/channelz/channel_trace.h \ +src/core/channelz/channelz.cc \ +src/core/channelz/channelz.h \ +src/core/channelz/channelz_registry.cc \ +src/core/channelz/channelz_registry.h \ src/core/client_channel/backup_poller.cc \ src/core/client_channel/backup_poller.h \ -src/core/client_channel/client_channel_channelz.cc \ -src/core/client_channel/client_channel_channelz.h \ src/core/client_channel/client_channel_factory.cc \ src/core/client_channel/client_channel_factory.h \ src/core/client_channel/client_channel_filter.cc \ @@ -2149,12 +2153,6 @@ src/core/lib/channel/channel_stack_builder_impl.cc \ src/core/lib/channel/channel_stack_builder_impl.h \ src/core/lib/channel/channel_stack_trace.cc \ src/core/lib/channel/channel_stack_trace.h \ -src/core/lib/channel/channel_trace.cc \ -src/core/lib/channel/channel_trace.h \ -src/core/lib/channel/channelz.cc \ -src/core/lib/channel/channelz.h \ -src/core/lib/channel/channelz_registry.cc \ -src/core/lib/channel/channelz_registry.h \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ @@ -2806,12 +2804,12 @@ src/core/lib/transport/batch_builder.cc \ src/core/lib/transport/batch_builder.h \ src/core/lib/transport/bdp_estimator.cc \ src/core/lib/transport/bdp_estimator.h \ +src/core/lib/transport/call_arena_allocator.cc \ +src/core/lib/transport/call_arena_allocator.h \ src/core/lib/transport/call_filters.cc \ src/core/lib/transport/call_filters.h \ src/core/lib/transport/call_final_info.cc \ src/core/lib/transport/call_final_info.h \ -src/core/lib/transport/call_size_estimator.cc \ -src/core/lib/transport/call_size_estimator.h \ src/core/lib/transport/call_spine.cc \ src/core/lib/transport/call_spine.h \ src/core/lib/transport/connectivity_state.cc \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 73cb5cdb1c6..ba38607ea8d 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -886,11 +886,15 @@ include/grpc/support/thd_id.h \ include/grpc/support/time.h \ include/grpc/support/workaround_list.h \ src/core/README.md \ +src/core/channelz/channel_trace.cc \ +src/core/channelz/channel_trace.h \ +src/core/channelz/channelz.cc \ +src/core/channelz/channelz.h \ +src/core/channelz/channelz_registry.cc \ +src/core/channelz/channelz_registry.h \ src/core/client_channel/README.md \ src/core/client_channel/backup_poller.cc \ src/core/client_channel/backup_poller.h \ -src/core/client_channel/client_channel_channelz.cc \ -src/core/client_channel/client_channel_channelz.h \ src/core/client_channel/client_channel_factory.cc \ src/core/client_channel/client_channel_factory.h \ src/core/client_channel/client_channel_filter.cc \ @@ -1921,12 +1925,6 @@ src/core/lib/channel/channel_stack_builder_impl.cc \ src/core/lib/channel/channel_stack_builder_impl.h \ src/core/lib/channel/channel_stack_trace.cc \ src/core/lib/channel/channel_stack_trace.h \ -src/core/lib/channel/channel_trace.cc \ -src/core/lib/channel/channel_trace.h \ -src/core/lib/channel/channelz.cc \ -src/core/lib/channel/channelz.h \ -src/core/lib/channel/channelz_registry.cc \ -src/core/lib/channel/channelz_registry.h \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ @@ -2583,12 +2581,12 @@ src/core/lib/transport/batch_builder.cc \ src/core/lib/transport/batch_builder.h \ src/core/lib/transport/bdp_estimator.cc \ src/core/lib/transport/bdp_estimator.h \ +src/core/lib/transport/call_arena_allocator.cc \ +src/core/lib/transport/call_arena_allocator.h \ src/core/lib/transport/call_filters.cc \ src/core/lib/transport/call_filters.h \ src/core/lib/transport/call_final_info.cc \ src/core/lib/transport/call_final_info.h \ -src/core/lib/transport/call_size_estimator.cc \ -src/core/lib/transport/call_size_estimator.h \ src/core/lib/transport/call_spine.cc \ src/core/lib/transport/call_spine.h \ src/core/lib/transport/connectivity_state.cc \ diff --git a/tools/internal_ci/helper_scripts/requirements.linux_perf.txt b/tools/internal_ci/helper_scripts/requirements.linux_perf.txt index 761d8ebfcd1..57e1a0c48c1 100644 --- a/tools/internal_ci/helper_scripts/requirements.linux_perf.txt +++ b/tools/internal_ci/helper_scripts/requirements.linux_perf.txt @@ -1,5 +1,5 @@ cryptography==3.4.6 PyJWT==2.0.1 -requests==2.25.1 +requests==2.31.0 scipy==1.5.4 tabulate==0.8.9 diff --git a/tools/internal_ci/helper_scripts/requirements.macos.txt b/tools/internal_ci/helper_scripts/requirements.macos.txt index 8f8d1d2141c..190bf328634 100644 --- a/tools/internal_ci/helper_scripts/requirements.macos.txt +++ b/tools/internal_ci/helper_scripts/requirements.macos.txt @@ -3,4 +3,4 @@ cryptography==3.4.6 PyJWT==2.0.1 pyOpenSSL==20.0.1 PyYAML==6.0 -requests==2.25.1 +requests==2.31.0 diff --git a/tools/internal_ci/linux/grpc_xds_k8s_install_test_driver.sh b/tools/internal_ci/linux/grpc_xds_k8s_install_test_driver.sh deleted file mode 100644 index 4e226fae5e0..00000000000 --- a/tools/internal_ci/linux/grpc_xds_k8s_install_test_driver.sh +++ /dev/null @@ -1,524 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2020 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. -# TODO(sergiitk): move to grpc/grpc when implementing support of other languages -set -eo pipefail - -# Constants -readonly PYTHON_VERSION="${PYTHON_VERSION:-3.10}" -# Test driver -readonly TEST_DRIVER_REPO_NAME="psm-interop" -readonly TEST_DRIVER_REPO_URL="https://github.com/${TEST_DRIVER_REPO_OWNER:-grpc}/psm-interop.git" -readonly TEST_DRIVER_BRANCH="${TEST_DRIVER_BRANCH:-main}" -readonly TEST_DRIVER_PATH="" -readonly TEST_DRIVER_PROTOS_PATH="protos/grpc/testing" -readonly FORCE_TESTING_VERSION="${FORCE_TESTING_VERSION:-}" - -# GKE cluster identifiers. -readonly GKE_CLUSTER_PSM_LB="psm-lb" -readonly GKE_CLUSTER_PSM_SECURITY="psm-security" -readonly GKE_CLUSTER_PSM_BASIC="psm-basic" - -####################################### -# Determines the cluster name and zone based on the given cluster identifier. -# Globals: -# GKE_CLUSTER_NAME: Set to reflect the cluster name to use -# GKE_CLUSTER_ZONE: Set to reflect the cluster zone to use. -# Arguments: -# The cluster identifier -# Outputs: -# Writes the output to stdout, stderr -####################################### -activate_gke_cluster() { - case $1 in - GKE_CLUSTER_PSM_LB) - GKE_CLUSTER_NAME="psm-interop-lb-primary" - GKE_CLUSTER_ZONE="us-central1-a" - ;; - GKE_CLUSTER_PSM_SECURITY) - GKE_CLUSTER_NAME="psm-interop-security" - GKE_CLUSTER_ZONE="us-central1-a" - ;; - GKE_CLUSTER_PSM_CSM) - GKE_CLUSTER_NAME="psm-interop-csm" - GKE_CLUSTER_ZONE="us-east7-c" - ;; - GKE_CLUSTER_PSM_GAMMA) - GKE_CLUSTER_NAME="psm-interop-gamma" - GKE_CLUSTER_ZONE="us-central1-a" - ;; - GKE_CLUSTER_PSM_BASIC) - GKE_CLUSTER_NAME="interop-test-psm-basic" - GKE_CLUSTER_ZONE="us-central1-c" - ;; - *) - echo "Unknown GKE cluster: ${1}" - exit 1 - ;; - esac - echo "Activated GKE cluster: GKE_CLUSTER_NAME=${GKE_CLUSTER_NAME} GKE_CLUSTER_ZONE=${GKE_CLUSTER_ZONE}" -} - -####################################### -# Determines the secondary cluster name and zone based on the given cluster -# identifier. -# Globals: -# GKE_CLUSTER_NAME: Set to reflect the cluster name to use -# GKE_CLUSTER_ZONE: Set to reflect the cluster zone to use. -# Arguments: -# The cluster identifier -# Outputs: -# Writes the output to stdout, stderr -####################################### -activate_secondary_gke_cluster() { - case $1 in - GKE_CLUSTER_PSM_LB) - SECONDARY_GKE_CLUSTER_NAME="psm-interop-lb-secondary" - SECONDARY_GKE_CLUSTER_ZONE="us-west1-b" - ;; - *) - echo "Unknown secondary GKE cluster: ${1}" - exit 1 - ;; - esac - echo "Activated secondary GKE cluster: GKE_CLUSTER_NAME=${GKE_CLUSTER_NAME} GKE_CLUSTER_ZONE=${GKE_CLUSTER_ZONE}" -} - -####################################### -# Run command end report its exit code. Doesn't exit on non-zero exit code. -# Globals: -# None -# Arguments: -# Command to execute -# Outputs: -# Writes the output of given command to stdout, stderr -####################################### -run_ignore_exit_code() { - local exit_code=0 - "$@" || exit_code=$? - if [[ $exit_code != 0 ]]; then - echo "Cmd: '$*', exit code: ${exit_code}" - fi -} - -####################################### -# Parses information about git repository at given path to global variables. -# Globals: -# GIT_ORIGIN_URL: Populated with the origin URL of git repo used for the build -# GIT_COMMIT: Populated with the SHA-1 of git commit being built -# GIT_COMMIT_SHORT: Populated with the short SHA-1 of git commit being built -# Arguments: -# Git source dir -####################################### -parse_src_repo_git_info() { - local src_dir="${SRC_DIR:?SRC_DIR must be set}" - readonly GIT_ORIGIN_URL=$(git -C "${src_dir}" remote get-url origin) - readonly GIT_COMMIT=$(git -C "${src_dir}" rev-parse HEAD) - readonly GIT_COMMIT_SHORT=$(git -C "${src_dir}" rev-parse --short HEAD) -} - - -####################################### -# Checks if the given string is a version branch. -# Version branches: "master", "v1.47.x" -# NOT version branches: "v1.47.0", "1.47.x", "", "dev", "main" -# Arguments: -# Version to test -####################################### -is_version_branch() { - if [ $# -eq 0 ]; then - echo "Usage is_version_branch VERSION" - false - return - fi - if [[ $1 == "master" ]]; then - true - return - fi - # Do not inline version_regex: keep it a string to avoid issues with escaping chars in ~= expr. - local version_regex='^v[0-9]+\.[0-9]+\.x$' - [[ "${1}" =~ $version_regex ]] -} - -####################################### -# List GCR image tags matching given tag name. -# Arguments: -# Image name -# Tag name -# Outputs: -# Writes the table with the list of found tags to stdout. -# If no tags found, the output is an empty string. -####################################### -gcloud_gcr_list_image_tags() { - gcloud container images list-tags --format="table[box](tags,digest,timestamp.date())" --filter="tags:$2" "$1" -} - -####################################### -# Create kube context authenticated with GKE cluster, saves context name. -# to KUBE_CONTEXT -# Globals: -# GKE_CLUSTER_NAME -# GKE_CLUSTER_ZONE -# KUBE_CONTEXT: Populated with name of kubectl context with GKE cluster access -# SECONDARY_KUBE_CONTEXT: Populated with name of kubectl context with secondary GKE cluster access, if any -# Arguments: -# None -# Outputs: -# Writes the output of `gcloud` command to stdout, stderr -# Writes authorization info $HOME/.kube/config -####################################### -gcloud_get_cluster_credentials() { - if [[ -n "${SECONDARY_GKE_CLUSTER_NAME}" && -n "${SECONDARY_GKE_CLUSTER_ZONE}" ]]; then - gcloud container clusters get-credentials "${SECONDARY_GKE_CLUSTER_NAME}" --zone "${SECONDARY_GKE_CLUSTER_ZONE}" - readonly SECONDARY_KUBE_CONTEXT="$(kubectl config current-context)" - else - readonly SECONDARY_KUBE_CONTEXT="" - fi - gcloud container clusters get-credentials "${GKE_CLUSTER_NAME}" --zone "${GKE_CLUSTER_ZONE}" - readonly KUBE_CONTEXT="$(kubectl config current-context)" -} - -####################################### -# Clone the source code of the test driver to $TEST_DRIVER_REPO_DIR, unless -# given folder exists. -# Globals: -# TEST_DRIVER_REPO_URL -# TEST_DRIVER_BRANCH -# TEST_DRIVER_REPO_DIR: path to the repo containing the test driver -# TEST_DRIVER_REPO_DIR_USE_EXISTING: set non-empty value to use exiting -# clone of the driver repo located at $TEST_DRIVER_REPO_DIR. -# Useful for debugging the build script locally. -# Arguments: -# None -# Outputs: -# Writes the output of `git` command to stdout, stderr -# Writes driver source code to $TEST_DRIVER_REPO_DIR -####################################### -test_driver_get_source() { - if [[ -n "${TEST_DRIVER_REPO_DIR_USE_EXISTING}" && -d "${TEST_DRIVER_REPO_DIR}" ]]; then - echo "Using exiting driver directory: ${TEST_DRIVER_REPO_DIR}." - else - echo "Cloning driver to ${TEST_DRIVER_REPO_URL} branch ${TEST_DRIVER_BRANCH} to ${TEST_DRIVER_REPO_DIR}" - git clone -b "${TEST_DRIVER_BRANCH}" --depth=1 "${TEST_DRIVER_REPO_URL}" "${TEST_DRIVER_REPO_DIR}" - fi -} - -####################################### -# Install Python modules from required in $TEST_DRIVER_FULL_DIR/requirements.lock -# to Python virtual environment. Creates and activates Python venv if necessary. -# Globals: -# TEST_DRIVER_FULL_DIR -# PYTHON_VERSION -# Arguments: -# None -# Outputs: -# Writes the output of `python`, `pip` commands to stdout, stderr -# Writes the list of installed modules to stdout -####################################### -test_driver_pip_install() { - echo "Install python dependencies" - cd "${TEST_DRIVER_FULL_DIR}" - - # Create and activate virtual environment unless already using one - if [[ -z "${VIRTUAL_ENV}" ]]; then - local venv_dir="${TEST_DRIVER_FULL_DIR}/venv" - if [[ -d "${venv_dir}" ]]; then - echo "Found python virtual environment directory: ${venv_dir}" - else - echo "Creating python virtual environment: ${venv_dir}" - "python${PYTHON_VERSION}" -m venv "${venv_dir}" --upgrade-deps - fi - # Intentional: No need to check python venv activate script. - # shellcheck source=/dev/null - source "${venv_dir}/bin/activate" - fi - - python3 -m pip install -r requirements.lock - echo "Installed Python packages:" - python3 -m pip list -} - -####################################### -# Compile proto-files needed for the test driver -# Globals: -# TEST_DRIVER_REPO_DIR -# TEST_DRIVER_FULL_DIR -# TEST_DRIVER_PROTOS_PATH -# Arguments: -# None -# Outputs: -# Writes the output of `python -m grpc_tools.protoc` to stdout, stderr -# Writes the list if compiled python code to stdout -# Writes compiled python code with proto messages and grpc services to -# $TEST_DRIVER_FULL_DIR/protos/grpc/testing -####################################### -test_driver_compile_protos() { - declare -a protos - protos=( - "${TEST_DRIVER_PROTOS_PATH}/test.proto" - "${TEST_DRIVER_PROTOS_PATH}/messages.proto" - "${TEST_DRIVER_PROTOS_PATH}/empty.proto" - ) - echo "Generate python code from grpc.testing protos: ${protos[*]}" - cd "${TEST_DRIVER_REPO_DIR}" - python3 -m grpc_tools.protoc \ - --proto_path=. \ - --python_out="${TEST_DRIVER_FULL_DIR}" \ - --grpc_python_out="${TEST_DRIVER_FULL_DIR}" \ - "${protos[@]}" - local protos_out_dir="${TEST_DRIVER_FULL_DIR}/${TEST_DRIVER_PROTOS_PATH}" - echo "Generated files ${protos_out_dir}:" - ls -Fl "${protos_out_dir}" -} - -####################################### -# Installs the test driver and it's requirements. -# https://github.com/grpc/psm-interop#installation -# Globals: -# TEST_DRIVER_REPO_DIR: Populated with the path to the repo containing -# the test driver -# TEST_DRIVER_FULL_DIR: Populated with the path to the test driver source code -# Arguments: -# The directory for test driver's source code -# Outputs: -# Writes the output to stdout, stderr -####################################### -test_driver_install() { - readonly TEST_DRIVER_REPO_DIR="${1:?Usage test_driver_install TEST_DRIVER_REPO_DIR}" - readonly TEST_DRIVER_FULL_DIR="${TEST_DRIVER_REPO_DIR}" - test_driver_get_source - test_driver_pip_install - test_driver_compile_protos -} - -####################################### -# Outputs Ubuntu's lsb_release and system python, pip versions -# Arguments: -# None -# Outputs: -# Writes the output to stdout -####################################### -kokoro_print_version() { - echo "Kokoro Ubuntu version:" - run_ignore_exit_code lsb_release -a - run_ignore_exit_code "python${PYTHON_VERSION}" --version - run_ignore_exit_code "python${PYTHON_VERSION}" -m pip --version -} - -####################################### -# Report extra information about the job via sponge properties. -# Globals: -# KOKORO_ARTIFACTS_DIR -# GIT_ORIGIN_URL -# GIT_COMMIT_SHORT -# TESTGRID_EXCLUDE -# Arguments: -# None -# Outputs: -# Writes the output to stdout -# Writes job properties to $KOKORO_ARTIFACTS_DIR/custom_sponge_config.csv -####################################### -kokoro_write_sponge_properties() { - # CSV format: "property_name","property_value" - # Bump TESTS_FORMAT_VERSION when reported test name changed enough to when it - # makes more sense to discard previous test results from a testgrid board. - # Use GIT_ORIGIN_URL to exclude test runs executed against repo forks from - # testgrid reports. - cat >"${KOKORO_ARTIFACTS_DIR}/custom_sponge_config.csv" <