From 67f364e23e4989c6e7837d03ea4e9d415f3cd890 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Jan 2023 08:50:32 -0800 Subject: [PATCH] [cleanup] Eliminate usage of GRPC_ASSERT(false...); (#31757) * crash function * progress * fix * fix * Automated change: Fix sanity tests * fix * fix * fix * fixes * Automated change: Fix sanity tests * fix * Automated change: Fix sanity tests * fix * fix * use cpp attr * Automated change: Fix sanity tests * fix * fix * fix * fix * fix * fix * add exclusion * fix * typo * fix * fmt * Update tcp_socket_utils.cc * Automated change: Fix sanity tests * fix * revert php changes * Automated change: Fix sanity tests Co-authored-by: ctiller --- BUILD | 8 ++ CMakeLists.txt | 1 + Makefile | 1 + bazel/grpc_deps.bzl | 2 +- build_autogenerated.yaml | 19 +-- config.m4 | 1 + config.w32 | 1 + gRPC-C++.podspec | 2 + gRPC-Core.podspec | 3 + grpc.def | 1 + grpc.gemspec | 2 + grpc.gyp | 1 + include/grpc/support/log.h | 14 ++- package.xml | 2 + src/core/BUILD | 3 + .../client_channel/channel_connectivity.cc | 8 +- .../client_channel/lb_policy/grpclb/grpclb.cc | 9 +- .../dns/c_ares/grpc_ares_ev_driver_windows.cc | 1 + .../resolver/xds/xds_resolver.cc | 2 +- .../stateful_session_filter.cc | 5 +- .../transport/binder/client/channel_create.cc | 2 + .../ext/transport/binder/client/jni_utils.cc | 2 + .../security_policy/binder_security_policy.cc | 1 + .../server/binder_server_credentials.cc | 2 +- .../binder/transport/binder_transport.cc | 2 + .../binder/transport/binder_transport.h | 1 + .../ext/transport/binder/utils/ndk_binder.cc | 1 + .../utils/transport_stream_receiver_impl.cc | 2 + .../binder/wire_format/binder_android.cc | 1 + .../binder/wire_format/transaction.h | 2 + .../binder/wire_format/wire_reader_impl.cc | 1 + .../binder/wire_format/wire_writer.cc | 3 + .../chttp2/transport/chttp2_transport.cc | 8 +- .../chttp2/transport/hpack_encoder.cc | 5 +- .../cronet/transport/cronet_transport.cc | 3 +- src/core/lib/address_utils/sockaddr_utils.cc | 3 +- src/core/lib/channel/promise_based_filter.cc | 119 ++++++++---------- .../lib/compression/compression_internal.cc | 7 +- .../posix_engine/ev_epoll1_linux.cc | 25 ++-- .../posix_engine/ev_poll_posix.cc | 41 +++--- .../posix_engine/lockfree_event.cc | 10 +- .../posix_engine/posix_endpoint.cc | 6 +- .../posix_engine/posix_endpoint.h | 15 +-- .../event_engine/posix_engine/posix_engine.cc | 17 ++- .../posix_engine/posix_engine_listener.h | 10 +- .../posix_engine_listener_utils.cc | 18 +-- .../posix_engine/tcp_socket_utils.cc | 41 +++--- .../posix_engine/traced_buffer_list.cc | 4 +- .../posix_engine/wakeup_fd_eventfd.cc | 11 +- .../posix_engine/wakeup_fd_pipe.cc | 9 +- src/core/lib/event_engine/windows/iocp.cc | 5 +- .../event_engine/windows/windows_endpoint.cc | 9 +- .../event_engine/windows/windows_engine.cc | 13 +- src/core/lib/gpr/alloc.cc | 2 + src/core/lib/gpr/cpu_linux.cc | 1 + src/core/lib/gpr/cpu_posix.cc | 1 + src/core/lib/gpr/cpu_windows.cc | 2 + src/core/lib/gpr/log.cc | 12 +- src/core/lib/gpr/log_android.cc | 2 + src/core/lib/gpr/log_linux.cc | 1 + src/core/lib/gpr/log_posix.cc | 1 + src/core/lib/gpr/log_windows.cc | 1 + src/core/lib/gpr/string.cc | 1 + src/core/lib/gpr/sync_abseil.cc | 2 + src/core/lib/gpr/sync_posix.cc | 2 + src/core/lib/gpr/sync_windows.cc | 2 + src/core/lib/gpr/time.cc | 2 + src/core/lib/gpr/time_posix.cc | 2 + src/core/lib/gpr/time_precise.cc | 1 + src/core/lib/gpr/time_windows.cc | 1 + src/core/lib/gpr/tmpfile_msys.cc | 1 + src/core/lib/gpr/tmpfile_posix.cc | 1 + src/core/lib/gpr/tmpfile_windows.cc | 1 + src/core/lib/gprpp/crash.cc | 33 +++++ src/core/lib/gprpp/crash.h | 34 +++++ src/core/lib/gprpp/stat_windows.cc | 1 + src/core/lib/gprpp/thd_windows.cc | 1 + src/core/lib/iomgr/buffer_list.cc | 1 + src/core/lib/iomgr/call_combiner.cc | 1 + src/core/lib/iomgr/closure.h | 1 + src/core/lib/iomgr/combiner.cc | 1 + src/core/lib/iomgr/endpoint_pair_posix.cc | 1 + src/core/lib/iomgr/endpoint_pair_windows.cc | 1 + src/core/lib/iomgr/error.cc | 2 + src/core/lib/iomgr/error.h | 1 + src/core/lib/iomgr/ev_epoll1_linux.cc | 1 + src/core/lib/iomgr/ev_poll_posix.cc | 12 +- src/core/lib/iomgr/ev_posix.cc | 8 +- src/core/lib/iomgr/exec_ctx.cc | 27 ++-- src/core/lib/iomgr/exec_ctx.h | 1 + src/core/lib/iomgr/executor.cc | 1 + src/core/lib/iomgr/fork_posix.cc | 1 + .../lib/iomgr/grpc_if_nametoindex_posix.cc | 1 + .../iomgr/grpc_if_nametoindex_unsupported.cc | 1 + src/core/lib/iomgr/iocp_windows.cc | 4 +- src/core/lib/iomgr/iomgr.cc | 1 + src/core/lib/iomgr/iomgr_windows.cc | 1 + src/core/lib/iomgr/load_file.cc | 1 + src/core/lib/iomgr/lockfree_event.cc | 8 +- src/core/lib/iomgr/polling_entity.cc | 12 +- src/core/lib/iomgr/pollset_windows.cc | 1 + src/core/lib/iomgr/resolve_address.cc | 1 + src/core/lib/iomgr/resolve_address_posix.cc | 1 + src/core/lib/iomgr/resolve_address_windows.cc | 1 + src/core/lib/iomgr/sockaddr_utils_posix.cc | 1 + src/core/lib/iomgr/socket_mutator.cc | 1 + .../lib/iomgr/socket_utils_common_posix.cc | 1 + src/core/lib/iomgr/socket_utils_linux.cc | 1 + src/core/lib/iomgr/socket_utils_posix.cc | 1 + src/core/lib/iomgr/socket_utils_windows.cc | 1 + src/core/lib/iomgr/socket_windows.cc | 1 + src/core/lib/iomgr/tcp_client_cfstream.cc | 1 + src/core/lib/iomgr/tcp_client_posix.cc | 1 + src/core/lib/iomgr/tcp_client_windows.cc | 1 + src/core/lib/iomgr/tcp_posix.cc | 3 +- src/core/lib/iomgr/tcp_server_posix.cc | 1 + .../iomgr/tcp_server_utils_posix_common.cc | 1 + .../iomgr/tcp_server_utils_posix_ifaddrs.cc | 1 + src/core/lib/iomgr/tcp_server_windows.cc | 1 + src/core/lib/iomgr/tcp_windows.cc | 1 + src/core/lib/iomgr/timer_generic.cc | 37 +++--- src/core/lib/iomgr/timer_manager.cc | 1 + src/core/lib/iomgr/unix_sockets_posix.cc | 1 + src/core/lib/iomgr/unix_sockets_posix_noop.cc | 2 + src/core/lib/iomgr/wakeup_fd_eventfd.cc | 1 + src/core/lib/iomgr/wakeup_fd_pipe.cc | 1 + .../alts/check_gcp_environment_no_op.cc | 1 + .../alts/check_gcp_environment_windows.cc | 1 + .../lib/security/credentials/credentials.cc | 1 + .../lib/security/credentials/credentials.h | 1 + .../credentials/oauth2/oauth2_credentials.cc | 2 +- .../fake/fake_security_connector.cc | 15 ++- src/core/lib/surface/call.cc | 4 +- src/core/lib/surface/server.cc | 3 +- .../frame_protector/alts_frame_protector.cc | 1 + .../tsi/alts/frame_protector/frame_handler.cc | 1 + .../alts/handshaker/alts_handshaker_client.cc | 1 + .../alts/handshaker/alts_shared_resource.cc | 1 + .../alts/handshaker/alts_tsi_handshaker.cc | 1 + .../transport_security_common_api.h | 1 + ...lts_grpc_integrity_only_record_protocol.cc | 1 + ..._grpc_privacy_integrity_record_protocol.cc | 1 + .../alts_grpc_record_protocol_common.cc | 1 + .../alts_iovec_record_protocol.cc | 1 + .../alts_zero_copy_grpc_protector.cc | 1 + src/core/tsi/fake_transport_security.cc | 1 + src/core/tsi/local_transport_security.cc | 1 + .../tsi/ssl/key_logging/ssl_key_logging.cc | 1 + .../ssl/session_cache/ssl_session_cache.cc | 1 + .../ssl/session_cache/ssl_session_openssl.cc | 1 + src/core/tsi/ssl_transport_security.cc | 1 + src/cpp/client/client_context.cc | 9 +- src/cpp/client/client_interceptor.cc | 9 +- src/cpp/ext/gcp/BUILD | 2 +- .../get_cpu_stats_unsupported.cc | 1 + src/cpp/server/server_context.cc | 9 +- src/cpp/thread_manager/thread_manager.cc | 14 +-- .../CronetTests/CoreCronetEnd2EndTests.mm | 1 + src/python/grpcio/grpc_core_dependencies.py | 1 + src/ruby/ext/grpc/rb_grpc_imports.generated.c | 2 + src/ruby/ext/grpc/rb_grpc_imports.generated.h | 3 + .../test/core/end2end/end2end_defs.include | 6 +- .../parse_address_with_named_scope_id_test.cc | 9 +- test/core/bad_connection/close_fd_test.cc | 6 +- test/core/end2end/BUILD | 1 + test/core/end2end/cq_verifier.cc | 10 +- test/core/end2end/end2end_tests.cc | 6 +- test/core/end2end/fixtures/proxy.cc | 5 +- test/core/end2end/fuzzers/client_fuzzer.cc | 17 +-- test/core/end2end/h2_ssl_cert_test.cc | 1 + test/core/end2end/inproc_callback_test.cc | 19 +-- .../core/end2end/tests/load_reporting_hook.cc | 1 + .../end2end/tests/resource_quota_server.cc | 7 +- test/core/event_engine/forkable_test.cc | 1 + .../posix/event_poller_posix_test.cc | 6 +- .../posix/posix_engine_test_utils.cc | 8 +- .../posix/posix_event_engine_connect_test.cc | 26 ++-- .../test_suite/oracle_event_engine_posix.cc | 8 +- .../test_suite/oracle_event_engine_posix.h | 22 ++-- test/core/gpr/log_test.cc | 3 +- test/core/gprpp/single_set_ptr_test.cc | 1 + test/core/handshake/client_ssl.cc | 7 +- test/core/handshake/server_ssl_common.cc | 4 +- test/core/handshake/verify_peer_options.cc | 1 + test/core/iomgr/combiner_test.cc | 1 + test/core/iomgr/endpoint_pair_test.cc | 1 + test/core/iomgr/endpoint_tests.cc | 1 + test/core/iomgr/error_test.cc | 1 + test/core/iomgr/fd_conservation_posix_test.cc | 1 + test/core/iomgr/fd_posix_test.cc | 16 +-- .../grpc_ipv6_loopback_available_test.cc | 1 + test/core/iomgr/load_file_test.cc | 1 + test/core/iomgr/resolve_address_posix_test.cc | 1 + test/core/iomgr/resolve_address_test.cc | 1 + test/core/iomgr/socket_utils_test.cc | 1 + test/core/iomgr/stranded_event_test.cc | 1 + test/core/iomgr/tcp_client_posix_test.cc | 1 + test/core/iomgr/tcp_posix_test.cc | 1 + test/core/iomgr/tcp_server_posix_test.cc | 1 + test/core/iomgr/timer_heap_test.cc | 1 + test/core/iomgr/timer_list_test.cc | 1 + test/core/security/alts_credentials_fuzzer.cc | 1 + .../security/alts_security_connector_test.cc | 1 + test/core/security/auth_context_test.cc | 1 + .../check_gcp_environment_linux_test.cc | 1 + .../check_gcp_environment_windows_test.cc | 1 + test/core/security/create_jwt.cc | 1 + test/core/security/credentials_test.cc | 19 +-- test/core/security/fetch_oauth2.cc | 1 + .../grpc_alts_credentials_options_test.cc | 2 + .../grpc_tls_certificate_distributor_test.cc | 1 + .../grpc_tls_certificate_provider_test.cc | 1 + .../grpc_tls_certificate_verifier_test.cc | 1 + .../grpc_tls_credentials_options_test.cc | 1 + test/core/security/json_token_test.cc | 1 + test/core/security/jwt_verifier_test.cc | 1 + test/core/security/oauth2_utils.cc | 1 + .../print_google_default_creds_token.cc | 1 + test/core/security/secure_endpoint_test.cc | 1 + test/core/security/security_connector_test.cc | 1 + test/core/security/ssl_credentials_test.cc | 1 + test/core/security/ssl_server_fuzzer.cc | 1 + test/core/security/system_roots_test.cc | 1 + .../security/tls_security_connector_test.cc | 1 + test/core/security/verify_jwt.cc | 1 + .../completion_queue_threading_test.cc | 4 +- .../core/surface/public_headers_must_be_c89.c | 1 + .../binder/end2end/binder_server_test.cc | 2 +- .../transport/binder/end2end/fake_binder.cc | 2 + .../binder/end2end/fuzzers/fuzzer_utils.h | 1 + .../core/transport/chttp2/bin_encoder_test.cc | 3 - .../transport/chttp2/hpack_parser_test.cc | 9 +- test/core/tsi/alts/crypt/aes_gcm_test.cc | 1 + .../fake_handshaker/fake_handshaker_server.cc | 14 ++- .../fake_handshaker_server_main.cc | 1 + .../alts/frame_protector/alts_counter_test.cc | 1 + .../alts/frame_protector/alts_crypter_test.cc | 1 + .../alts_frame_protector_test.cc | 1 + .../frame_protector/frame_handler_test.cc | 1 + .../alts_concurrent_connectivity_test.cc | 25 ++-- .../alts_grpc_record_protocol_test.cc | 1 + .../alts_iovec_record_protocol_test.cc | 1 + .../alts_zero_copy_grpc_protector_test.cc | 1 + .../tsi/crl_ssl_transport_security_test.cc | 1 + test/core/tsi/fake_transport_security_test.cc | 1 + test/core/tsi/ssl_session_cache_test.cc | 1 + test/core/tsi/ssl_transport_security_test.cc | 1 + test/core/tsi/transport_security_test.cc | 1 + test/core/tsi/transport_security_test_lib.cc | 1 + test/core/util/one_corpus_entry_fuzzer.cc | 1 + .../util/port_isolated_runtime_environment.cc | 1 + test/core/util/subprocess_windows.cc | 1 + test/core/util/test_config.cc | 5 +- ...tcher_certificate_provider_factory_test.cc | 2 +- .../xds/xds_cluster_resource_type_test.cc | 8 +- test/core/xds/xds_common_types_test.cc | 8 +- .../xds/xds_endpoint_resource_type_test.cc | 8 +- test/core/xds/xds_lb_policy_registry_test.cc | 4 +- .../xds/xds_listener_resource_type_test.cc | 8 +- .../xds_route_config_resource_type_test.cc | 16 +-- test/cpp/client/client_channel_stress_test.cc | 1 + ...channel_with_active_connect_stress_test.cc | 1 + test/cpp/common/time_jump_test.cc | 1 + test/cpp/common/timer_test.cc | 1 + test/cpp/end2end/async_end2end_test.cc | 5 +- test/cpp/end2end/cfstream_test.cc | 1 + test/cpp/end2end/client_crash_test.cc | 1 + test/cpp/end2end/client_crash_test_server.cc | 1 + test/cpp/end2end/client_lb_end2end_test.cc | 1 + test/cpp/end2end/end2end_test.cc | 1 + test/cpp/end2end/flaky_network_test.cc | 1 + test/cpp/end2end/grpclb_end2end_test.cc | 1 + .../end2end/health_service_end2end_test.cc | 1 + test/cpp/end2end/interceptors_util.h | 6 +- test/cpp/end2end/mock_test.cc | 1 + test/cpp/end2end/port_sharing_end2end_test.cc | 1 + test/cpp/end2end/raw_end2end_test.cc | 1 + test/cpp/end2end/server_crash_test.cc | 1 + test/cpp/end2end/server_crash_test_client.cc | 1 + test/cpp/end2end/server_early_return_test.cc | 1 + .../server_load_reporting_end2end_test.cc | 1 + .../end2end/service_config_end2end_test.cc | 1 + test/cpp/end2end/shutdown_test.cc | 1 + test/cpp/end2end/streaming_throughput_test.cc | 1 + test/cpp/end2end/test_service_impl.cc | 1 + test/cpp/end2end/test_service_impl.h | 1 + test/cpp/end2end/time_change_test.cc | 1 + test/cpp/end2end/xds/xds_end2end_test.cc | 1 + test/cpp/end2end/xds/xds_server.cc | 1 + test/cpp/end2end/xds/xds_server.h | 1 + test/cpp/interop/client.cc | 1 + test/cpp/interop/client_helper.cc | 1 + test/cpp/interop/grpclb_fallback_test.cc | 28 ++--- test/cpp/interop/http2_client.cc | 8 +- test/cpp/interop/interop_client.cc | 8 +- test/cpp/interop/interop_server.cc | 1 + test/cpp/interop/interop_test.cc | 1 + test/cpp/interop/istio_echo_server_test.cc | 3 +- test/cpp/interop/metrics_client.cc | 1 + test/cpp/interop/reconnect_interop_client.cc | 1 + test/cpp/interop/reconnect_interop_server.cc | 1 + test/cpp/interop/stress_interop_client.cc | 6 +- test/cpp/interop/stress_test.cc | 1 + test/cpp/interop/xds_interop_server.cc | 1 + test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 1 + .../microbenchmarks/bm_chttp2_transport.cc | 1 + test/cpp/microbenchmarks/bm_cq.cc | 1 + .../microbenchmarks/bm_cq_multiple_threads.cc | 1 + .../microbenchmarks/bm_event_engine_run.cc | 5 +- test/cpp/microbenchmarks/bm_pollset.cc | 1 + test/cpp/microbenchmarks/bm_thread_pool.cc | 5 +- test/cpp/microbenchmarks/bm_work_queue.cc | 1 + .../fullstack_context_mutators.h | 1 + test/cpp/microbenchmarks/fullstack_fixtures.h | 1 + .../fullstack_streaming_pump.h | 4 +- test/cpp/naming/address_sorting_test.cc | 1 + test/cpp/naming/cancel_ares_query_test.cc | 6 +- test/cpp/naming/resolver_component_test.cc | 38 +++--- ...resolver_component_tests_runner_invoker.cc | 24 ++-- test/cpp/performance/writes_per_rpc_test.cc | 1 + test/cpp/qps/benchmark_config.cc | 1 + test/cpp/qps/client.h | 34 ++--- test/cpp/qps/client_async.cc | 11 +- test/cpp/qps/client_callback.cc | 1 + test/cpp/qps/client_sync.cc | 1 + test/cpp/qps/driver.cc | 75 +++++------ .../qps/inproc_sync_unary_ping_pong_test.cc | 1 + test/cpp/qps/json_run_localhost.cc | 1 + test/cpp/qps/parse_json.cc | 7 +- test/cpp/qps/qps_json_driver.cc | 12 +- test/cpp/qps/qps_openloop_test.cc | 1 + test/cpp/qps/qps_worker.cc | 1 + test/cpp/qps/report.cc | 1 + .../qps/secure_sync_unary_ping_pong_test.cc | 1 + test/cpp/qps/server.h | 1 + test/cpp/qps/server_async.cc | 1 + test/cpp/qps/usage_timer.cc | 2 + test/cpp/server/server_request_call_test.cc | 6 +- .../cpp/thread_manager/thread_manager_test.cc | 1 + test/cpp/util/channel_trace_proto_helper.cc | 1 + test/cpp/util/cli_call.cc | 2 + test/cpp/util/cli_credentials.cc | 1 + test/cpp/util/create_test_channel.cc | 1 + test/cpp/util/metrics_server.cc | 1 + .../proto_reflection_descriptor_database.cc | 2 + test/cpp/util/test_credentials_provider.cc | 1 + .../distrib/check_namespace_qualification.py | 1 + tools/distrib/fix_build_deps.py | 4 +- tools/doxygen/Doxyfile.c++.internal | 2 + tools/doxygen/Doxyfile.core.internal | 2 + .../run_tests/sanity/core_banned_functions.py | 2 + 351 files changed, 986 insertions(+), 617 deletions(-) create mode 100644 src/core/lib/gprpp/crash.cc create mode 100644 src/core/lib/gprpp/crash.h diff --git a/BUILD b/BUILD index 36d1a6db365..9b4e0a47f1f 100644 --- a/BUILD +++ b/BUILD @@ -643,6 +643,7 @@ grpc_cc_library( "//src/core:lib/gpr/tmpfile_posix.cc", "//src/core:lib/gpr/tmpfile_windows.cc", "//src/core:lib/gpr/wrap_memcpy.cc", + "//src/core:lib/gprpp/crash.cc", "//src/core:lib/gprpp/fork.cc", "//src/core:lib/gprpp/global_config_env.cc", "//src/core:lib/gprpp/host_port.cc", @@ -658,6 +659,7 @@ grpc_cc_library( "//src/core:lib/gpr/string.h", "//src/core:lib/gpr/time_precise.h", "//src/core:lib/gpr/tmpfile.h", + "//src/core:lib/gprpp/crash.h", "//src/core:lib/gprpp/fork.h", "//src/core:lib/gprpp/global_config.h", "//src/core:lib/gprpp/global_config_custom.h", @@ -691,6 +693,7 @@ grpc_cc_library( ], visibility = ["@grpc:public"], deps = [ + "debug_location", "//src/core:construct_destruct", "//src/core:env", "//src/core:examine_stack", @@ -1002,6 +1005,7 @@ grpc_cc_library( "//src/core:channel_args", "//src/core:channel_args_preconditioning", "//src/core:channel_stack_type", + "//src/core:default_event_engine", "//src/core:iomgr_fwd", "//src/core:iomgr_port", "//src/core:slice", @@ -1746,6 +1750,7 @@ grpc_cc_library( "absl/status", "absl/status:statusor", "absl/strings", + "absl/strings:str_format", "absl/synchronization", "absl/memory", "absl/types:optional", @@ -1817,6 +1822,7 @@ grpc_cc_library( "absl/types:optional", "absl/memory", "upb_lib", + "absl/strings:str_format", "protobuf_headers", ], language = "c++", @@ -2371,6 +2377,7 @@ grpc_cc_library( "//src/core:lib/iomgr/executor.h", "//src/core:lib/iomgr/iomgr_internal.h", ], + external_deps = ["absl/strings:str_format"], visibility = [ "@grpc:alt_grpc_base_legacy", "@grpc:exec_ctx", @@ -2432,6 +2439,7 @@ grpc_cc_library( ], external_deps = [ "absl/strings", + "absl/strings:str_format", ], tags = ["nofixdeps"], visibility = ["@grpc:iomgr_timer"], diff --git a/CMakeLists.txt b/CMakeLists.txt index 1622f33b189..d947df615d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1565,6 +1565,7 @@ add_library(gpr src/core/lib/gpr/tmpfile_posix.cc src/core/lib/gpr/tmpfile_windows.cc src/core/lib/gpr/wrap_memcpy.cc + src/core/lib/gprpp/crash.cc src/core/lib/gprpp/env_linux.cc src/core/lib/gprpp/env_posix.cc src/core/lib/gprpp/env_windows.cc diff --git a/Makefile b/Makefile index 27ff6139b4f..92940dc1887 100644 --- a/Makefile +++ b/Makefile @@ -867,6 +867,7 @@ LIBGPR_SRC = \ src/core/lib/gpr/tmpfile_posix.cc \ src/core/lib/gpr/tmpfile_windows.cc \ src/core/lib/gpr/wrap_memcpy.cc \ + src/core/lib/gprpp/crash.cc \ src/core/lib/gprpp/env_linux.cc \ src/core/lib/gprpp/env_posix.cc \ src/core/lib/gprpp/env_windows.cc \ diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index e830eea132a..3780b652d21 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -206,7 +206,7 @@ def grpc_deps(): ) native.bind( - name = "googleapis_logging_proto", + name = "googleapis_logging_cc_proto", actual = "@com_google_googleapis//google/logging/v2:logging_cc_proto", ) diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 3d22a961460..a5a6c78b9be 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -176,6 +176,8 @@ libs: - src/core/lib/gpr/tmpfile.h - src/core/lib/gpr/useful.h - src/core/lib/gprpp/construct_destruct.h + - src/core/lib/gprpp/crash.h + - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/env.h - src/core/lib/gprpp/examine_stack.h - src/core/lib/gprpp/fork.h @@ -221,6 +223,7 @@ libs: - src/core/lib/gpr/tmpfile_posix.cc - src/core/lib/gpr/tmpfile_windows.cc - src/core/lib/gpr/wrap_memcpy.cc + - src/core/lib/gprpp/crash.cc - src/core/lib/gprpp/env_linux.cc - src/core/lib/gprpp/env_posix.cc - src/core/lib/gprpp/env_windows.cc @@ -810,7 +813,6 @@ libs: - 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/debug_location.h - src/core/lib/gprpp/dual_ref_counted.h - src/core/lib/gprpp/load_file.h - src/core/lib/gprpp/manual_constructor.h @@ -2119,7 +2121,6 @@ libs: - 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/debug_location.h - src/core/lib/gprpp/dual_ref_counted.h - src/core/lib/gprpp/load_file.h - src/core/lib/gprpp/manual_constructor.h @@ -3556,7 +3557,6 @@ libs: - 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/debug_location.h - src/core/lib/gprpp/dual_ref_counted.h - src/core/lib/gprpp/load_file.h - src/core/lib/gprpp/manual_constructor.h @@ -4367,7 +4367,6 @@ targets: headers: - src/core/lib/gprpp/atomic_utils.h - src/core/lib/gprpp/bitset.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h - src/core/lib/gprpp/ref_counted_ptr.h @@ -5668,7 +5667,6 @@ targets: - 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/debug_location.h - src/core/lib/gprpp/manual_constructor.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h @@ -6663,7 +6661,6 @@ targets: - src/core/lib/gpr/spinlock.h - src/core/lib/gprpp/atomic_utils.h - src/core/lib/gprpp/bitset.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/manual_constructor.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h @@ -6940,7 +6937,6 @@ targets: - src/core/lib/gprpp/atomic_utils.h - src/core/lib/gprpp/bitset.h - src/core/lib/gprpp/cpp_impl_of.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/manual_constructor.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h @@ -7032,7 +7028,6 @@ targets: - src/core/lib/gprpp/atomic_utils.h - src/core/lib/gprpp/bitset.h - src/core/lib/gprpp/cpp_impl_of.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/manual_constructor.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h @@ -7301,7 +7296,6 @@ targets: - 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/debug_location.h - src/core/lib/gprpp/dual_ref_counted.h - src/core/lib/gprpp/load_file.h - src/core/lib/gprpp/manual_constructor.h @@ -8860,7 +8854,6 @@ targets: headers: - src/core/lib/gprpp/atomic_utils.h - src/core/lib/gprpp/bitset.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h - src/core/lib/gprpp/ref_counted_ptr.h @@ -8976,7 +8969,6 @@ targets: - src/core/lib/gprpp/atomic_utils.h - src/core/lib/gprpp/bitset.h - src/core/lib/gprpp/cpp_impl_of.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/manual_constructor.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h @@ -9333,7 +9325,6 @@ targets: language: c++ headers: - src/core/lib/gprpp/atomic_utils.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h - src/core/lib/gprpp/ref_counted_ptr.h @@ -9541,7 +9532,6 @@ targets: - src/core/lib/debug/trace.h - src/core/lib/gpr/spinlock.h - src/core/lib/gprpp/bitset.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/manual_constructor.h - src/core/lib/gprpp/status_helper.h - src/core/lib/gprpp/time.h @@ -9640,7 +9630,6 @@ targets: - src/core/lib/gprpp/atomic_utils.h - src/core/lib/gprpp/bitset.h - src/core/lib/gprpp/cpp_impl_of.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/manual_constructor.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h @@ -11684,7 +11673,6 @@ targets: language: c++ headers: - src/core/lib/gprpp/atomic_utils.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/ref_counted.h - src/core/lib/gprpp/ref_counted_ptr.h - src/core/lib/resource_quota/thread_quota.h @@ -12012,7 +12000,6 @@ targets: - src/core/lib/gpr/spinlock.h - src/core/lib/gprpp/atomic_utils.h - src/core/lib/gprpp/bitset.h - - src/core/lib/gprpp/debug_location.h - src/core/lib/gprpp/manual_constructor.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h diff --git a/config.m4 b/config.m4 index 797edd3bffe..782b64ae94e 100644 --- a/config.m4 +++ b/config.m4 @@ -557,6 +557,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/gpr/tmpfile_posix.cc \ src/core/lib/gpr/tmpfile_windows.cc \ src/core/lib/gpr/wrap_memcpy.cc \ + src/core/lib/gprpp/crash.cc \ src/core/lib/gprpp/env_linux.cc \ src/core/lib/gprpp/env_posix.cc \ src/core/lib/gprpp/env_windows.cc \ diff --git a/config.w32 b/config.w32 index f004d31c5d7..5b8d724e60f 100644 --- a/config.w32 +++ b/config.w32 @@ -523,6 +523,7 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\gpr\\tmpfile_posix.cc " + "src\\core\\lib\\gpr\\tmpfile_windows.cc " + "src\\core\\lib\\gpr\\wrap_memcpy.cc " + + "src\\core\\lib\\gprpp\\crash.cc " + "src\\core\\lib\\gprpp\\env_linux.cc " + "src\\core\\lib\\gprpp\\env_posix.cc " + "src\\core\\lib\\gprpp\\env_windows.cc " + diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 75978d8614a..c9fd9ecfdfb 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -769,6 +769,7 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/chunked_vector.h', 'src/core/lib/gprpp/construct_destruct.h', 'src/core/lib/gprpp/cpp_impl_of.h', + 'src/core/lib/gprpp/crash.h', 'src/core/lib/gprpp/debug_location.h', 'src/core/lib/gprpp/dual_ref_counted.h', 'src/core/lib/gprpp/env.h', @@ -1679,6 +1680,7 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/chunked_vector.h', 'src/core/lib/gprpp/construct_destruct.h', 'src/core/lib/gprpp/cpp_impl_of.h', + 'src/core/lib/gprpp/crash.h', 'src/core/lib/gprpp/debug_location.h', 'src/core/lib/gprpp/dual_ref_counted.h', 'src/core/lib/gprpp/env.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 703f92ece4e..f1ddc814b1d 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -1216,6 +1216,8 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/chunked_vector.h', 'src/core/lib/gprpp/construct_destruct.h', 'src/core/lib/gprpp/cpp_impl_of.h', + 'src/core/lib/gprpp/crash.cc', + 'src/core/lib/gprpp/crash.h', 'src/core/lib/gprpp/debug_location.h', 'src/core/lib/gprpp/dual_ref_counted.h', 'src/core/lib/gprpp/env.h', @@ -2347,6 +2349,7 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/chunked_vector.h', 'src/core/lib/gprpp/construct_destruct.h', 'src/core/lib/gprpp/cpp_impl_of.h', + 'src/core/lib/gprpp/crash.h', 'src/core/lib/gprpp/debug_location.h', 'src/core/lib/gprpp/dual_ref_counted.h', 'src/core/lib/gprpp/env.h', diff --git a/grpc.def b/grpc.def index c0171e080e4..e4fcb379c39 100644 --- a/grpc.def +++ b/grpc.def @@ -233,6 +233,7 @@ EXPORTS gpr_set_log_verbosity gpr_log_verbosity_init gpr_set_log_function + gpr_assertion_failed gpr_format_message gpr_strdup gpr_asprintf diff --git a/grpc.gemspec b/grpc.gemspec index 61d46c5734a..93e24b8e1ee 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -1127,6 +1127,8 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/gprpp/chunked_vector.h ) s.files += %w( src/core/lib/gprpp/construct_destruct.h ) s.files += %w( src/core/lib/gprpp/cpp_impl_of.h ) + s.files += %w( src/core/lib/gprpp/crash.cc ) + s.files += %w( src/core/lib/gprpp/crash.h ) s.files += %w( src/core/lib/gprpp/debug_location.h ) s.files += %w( src/core/lib/gprpp/dual_ref_counted.h ) s.files += %w( src/core/lib/gprpp/env.h ) diff --git a/grpc.gyp b/grpc.gyp index 69d21262cc3..f9252aebcde 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -332,6 +332,7 @@ 'src/core/lib/gpr/tmpfile_posix.cc', 'src/core/lib/gpr/tmpfile_windows.cc', 'src/core/lib/gpr/wrap_memcpy.cc', + 'src/core/lib/gprpp/crash.cc', 'src/core/lib/gprpp/env_linux.cc', 'src/core/lib/gprpp/env_posix.cc', 'src/core/lib/gprpp/env_windows.cc', diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index 3a9cd46f5dd..1f987fd35d5 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -84,17 +84,19 @@ typedef struct gpr_log_func_args gpr_log_func_args; typedef void (*gpr_log_func)(gpr_log_func_args* args); GPRAPI void gpr_set_log_function(gpr_log_func func); +GPRAPI void gpr_assertion_failed(const char* filename, int line, + const char* message) GPR_ATTRIBUTE_NORETURN; + /** abort() the process if x is zero, having written a line to the log. Intended for internal invariants. If the error can be recovered from, without the possibility of corruption, or might best be reflected via an exception in a higher-level language, consider returning error code. */ -#define GPR_ASSERT(x) \ - do { \ - if (GPR_UNLIKELY(!(x))) { \ - gpr_log(GPR_ERROR, "assertion failed: %s", #x); \ - abort(); \ - } \ +#define GPR_ASSERT(x) \ + do { \ + if (GPR_UNLIKELY(!(x))) { \ + gpr_assertion_failed(__FILE__, __LINE__, #x); \ + } \ } while (0) #ifndef NDEBUG diff --git a/package.xml b/package.xml index bad8a5155ba..25ac6867a93 100644 --- a/package.xml +++ b/package.xml @@ -1109,6 +1109,8 @@ + + diff --git a/src/core/BUILD b/src/core/BUILD index ef9f183b285..4271e525424 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -1573,6 +1573,7 @@ grpc_cc_library( "absl/status", "absl/status:statusor", "absl/strings", + "absl/strings:str_format", ], deps = [ "event_engine_poller", @@ -1608,6 +1609,7 @@ grpc_cc_library( "absl/status", "absl/status:statusor", "absl/strings", + "absl/strings:str_format", ], deps = [ "common_event_engine_closures", @@ -2590,6 +2592,7 @@ grpc_cc_library( "absl/status", "absl/status:statusor", "absl/strings", + "absl/strings:str_format", "absl/types:optional", ], language = "c++", diff --git a/src/core/ext/filters/client_channel/channel_connectivity.cc b/src/core/ext/filters/client_channel/channel_connectivity.cc index 9f393f8614c..7c87ab6960c 100644 --- a/src/core/ext/filters/client_channel/channel_connectivity.cc +++ b/src/core/ext/filters/client_channel/channel_connectivity.cc @@ -33,6 +33,7 @@ #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/dual_ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" @@ -130,10 +131,9 @@ class StateWatcher : public DualRefCounted { Unref(); return; } - gpr_log(GPR_ERROR, - "grpc_channel_watch_connectivity_state called on " - "something that is not a client channel"); - GPR_ASSERT(false); + Crash( + "grpc_channel_watch_connectivity_state called on something that is " + "not a client channel"); } // Ref from object creation is held by the watcher callback. auto* watcher_timer_init_state = new WatcherTimerInitState( diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index de61e3ca544..af63a734fdc 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -58,7 +58,6 @@ // IWYU pragma: no_include #include -#include #include #include @@ -107,6 +106,7 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted.h" @@ -792,10 +792,9 @@ RefCountedPtr GrpcLb::Helper::CreateSubchannel( static_cast( address.GetAttribute(kGrpcLbAddressAttributeKey)); if (attribute == nullptr) { - gpr_log(GPR_ERROR, - "[grpclb %p] no TokenAndClientStatsAttribute for address %p", - parent_.get(), address.ToString().c_str()); - abort(); + Crash(absl::StrFormat( + "[grpclb %p] no TokenAndClientStatsAttribute for address %p", + parent_.get(), address.ToString().c_str())); } std::string lb_token = attribute->lb_token(); RefCountedPtr client_stats = attribute->client_stats(); diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc index 5f1fd0d34a8..7e427c417e5 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc @@ -36,6 +36,7 @@ #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h" #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/sockaddr_windows.h" diff --git a/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc b/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc index becdbb51b76..4e283df9e70 100644 --- a/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc @@ -583,7 +583,7 @@ XdsResolver::XdsConfigSelector::CreateMethodConfig( retry_parts.push_back( absl::StrFormat(" \"retryableStatusCodes\": [\n %s ]\n", absl::StrJoin(code_parts, ",\n"))); - retry_parts.push_back(absl::StrFormat(" }")); + retry_parts.push_back(" }"); fields.emplace_back(absl::StrJoin(retry_parts, "")); } // Set timeout. diff --git a/src/core/ext/filters/stateful_session/stateful_session_filter.cc b/src/core/ext/filters/stateful_session/stateful_session_filter.cc index 2221f0fbdc8..443d90083c8 100644 --- a/src/core/ext/filters/stateful_session/stateful_session_filter.cc +++ b/src/core/ext/filters/stateful_session/stateful_session_filter.cc @@ -44,6 +44,7 @@ #include "src/core/lib/channel/context.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/promise/context.h" #include "src/core/lib/promise/detail/basic_seq.h" @@ -106,9 +107,7 @@ void MaybeUpdateServerInitialMetadata( server_initial_metadata->Append( "set-cookie", Slice::FromCopiedString(absl::StrJoin(parts, "; ")), [](absl::string_view error, const Slice&) { - gpr_log(GPR_ERROR, "ERROR ADDING set-cookie METADATA: %s", - std::string(error).c_str()); - GPR_ASSERT(false); + Crash(absl::StrCat("ERROR ADDING set-cookie METADATA: ", error)); }); } } diff --git a/src/core/ext/transport/binder/client/channel_create.cc b/src/core/ext/transport/binder/client/channel_create.cc index 52db3ae8330..1c785daffb8 100644 --- a/src/core/ext/transport/binder/client/channel_create.cc +++ b/src/core/ext/transport/binder/client/channel_create.cc @@ -30,6 +30,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + #ifdef GPR_SUPPORT_BINDER_TRANSPORT #include diff --git a/src/core/ext/transport/binder/client/jni_utils.cc b/src/core/ext/transport/binder/client/jni_utils.cc index c93ec4e0d5f..e0e3f59582b 100644 --- a/src/core/ext/transport/binder/client/jni_utils.cc +++ b/src/core/ext/transport/binder/client/jni_utils.cc @@ -20,6 +20,8 @@ #include +#include "src/core/lib/gprpp/crash.h" + #if defined(ANDROID) || defined(__ANDROID__) namespace grpc_binder { diff --git a/src/core/ext/transport/binder/security_policy/binder_security_policy.cc b/src/core/ext/transport/binder/security_policy/binder_security_policy.cc index af24f878b2a..a97bb6c9459 100644 --- a/src/core/ext/transport/binder/security_policy/binder_security_policy.cc +++ b/src/core/ext/transport/binder/security_policy/binder_security_policy.cc @@ -26,6 +26,7 @@ #include #include "src/core/ext/transport/binder/client/jni_utils.h" +#include "src/core/lib/gprpp/crash.h" #endif diff --git a/src/core/ext/transport/binder/server/binder_server_credentials.cc b/src/core/ext/transport/binder/server/binder_server_credentials.cc index 877bd35ff6f..56440f9d27e 100644 --- a/src/core/ext/transport/binder/server/binder_server_credentials.cc +++ b/src/core/ext/transport/binder/server/binder_server_credentials.cc @@ -52,7 +52,7 @@ class BinderServerCredentialsImpl final : public ServerCredentials { void SetAuthMetadataProcessor( const std::shared_ptr& /*processor*/) override { - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); } private: diff --git a/src/core/ext/transport/binder/transport/binder_transport.cc b/src/core/ext/transport/binder/transport/binder_transport.cc index 6cb1e091c50..09a8a64947e 100644 --- a/src/core/ext/transport/binder/transport/binder_transport.cc +++ b/src/core/ext/transport/binder/transport/binder_transport.cc @@ -35,6 +35,8 @@ #include "src/core/ext/transport/binder/wire_format/wire_reader.h" #include "src/core/ext/transport/binder/wire_format/wire_reader_impl.h" #include "src/core/ext/transport/binder/wire_format/wire_writer.h" +#include "src/core/lib/event_engine/default_event_engine.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/transport/error_utils.h" diff --git a/src/core/ext/transport/binder/transport/binder_transport.h b/src/core/ext/transport/binder/transport/binder_transport.h index 93a2034d758..c40a6838127 100644 --- a/src/core/ext/transport/binder/transport/binder_transport.h +++ b/src/core/ext/transport/binder/transport/binder_transport.h @@ -32,6 +32,7 @@ #include "src/core/ext/transport/binder/wire_format/binder.h" #include "src/core/ext/transport/binder/wire_format/wire_reader.h" #include "src/core/ext/transport/binder/wire_format/wire_writer.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/transport/transport.h" #include "src/core/lib/transport/transport_impl.h" diff --git a/src/core/ext/transport/binder/utils/ndk_binder.cc b/src/core/ext/transport/binder/utils/ndk_binder.cc index 298f988567b..20dd4908320 100644 --- a/src/core/ext/transport/binder/utils/ndk_binder.cc +++ b/src/core/ext/transport/binder/utils/ndk_binder.cc @@ -24,6 +24,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" namespace { 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 d7cbf7a2857..d569d1fb614 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 @@ -24,6 +24,8 @@ #include +#include "src/core/lib/gprpp/crash.h" + namespace grpc_binder { const absl::string_view diff --git a/src/core/ext/transport/binder/wire_format/binder_android.cc b/src/core/ext/transport/binder/wire_format/binder_android.cc index c26e84130d0..21e32f2da7c 100644 --- a/src/core/ext/transport/binder/wire_format/binder_android.cc +++ b/src/core/ext/transport/binder/wire_format/binder_android.cc @@ -26,6 +26,7 @@ #include #include "src/core/ext/transport/binder/wire_format/binder_android.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" namespace grpc_binder { diff --git a/src/core/ext/transport/binder/wire_format/transaction.h b/src/core/ext/transport/binder/wire_format/transaction.h index 1bd61377c73..2ea1df58e33 100644 --- a/src/core/ext/transport/binder/wire_format/transaction.h +++ b/src/core/ext/transport/binder/wire_format/transaction.h @@ -24,6 +24,8 @@ #include +#include "src/core/lib/gprpp/crash.h" + namespace grpc_binder { ABSL_CONST_INIT extern const int kFlagPrefix; 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 6688cc2f3c2..407fee796d4 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 @@ -32,6 +32,7 @@ #include "src/core/ext/transport/binder/utils/transport_stream_receiver.h" #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/crash.h" #include "src/core/lib/gprpp/status_helper.h" namespace grpc_binder { 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 6d804e9dab9..f177af8b5ac 100644 --- a/src/core/ext/transport/binder/wire_format/wire_writer.cc +++ b/src/core/ext/transport/binder/wire_format/wire_writer.cc @@ -25,6 +25,9 @@ #include +#include "src/core/lib/event_engine/default_event_engine.h" +#include "src/core/lib/gprpp/crash.h" + #define RETURN_IF_ERROR(expr) \ do { \ const absl::Status status = (expr); \ diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 7e9928dfd77..e509feaf5aa 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -65,6 +64,7 @@ #include "src/core/lib/debug/stats_data.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/bitset.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/status_helper.h" @@ -697,9 +697,9 @@ grpc_chttp2_stream::~grpc_chttp2_stream() { for (int i = 0; i < STREAM_LIST_COUNT; i++) { if (GPR_UNLIKELY(included.is_set(i))) { - gpr_log(GPR_ERROR, "%s stream %d still included in list %d", - t->is_client ? "client" : "server", id, i); - abort(); + grpc_core::Crash(absl::StrFormat("%s stream %d still included in list %d", + t->is_client ? "client" : "server", id, + i)); } } diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index 5f6ff3f1252..93c80a71a61 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -34,6 +34,7 @@ #include "src/core/ext/transport/chttp2/transport/http_trace.h" #include "src/core/ext/transport/chttp2/transport/varint.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/surface/validate_metadata.h" #include "src/core/lib/transport/timeout_encoding.h" @@ -362,7 +363,7 @@ void HPackCompressor::Encoder::Encode(HttpSchemeMetadata, EmitIndexed(7); // :scheme: https break; case HttpSchemeMetadata::ValueType::kInvalid: - GPR_ASSERT(false); + Crash("invalid http scheme encoding"); break; } } @@ -430,7 +431,7 @@ void HPackCompressor::Encoder::Encode(HttpMethodMetadata, Slice::FromStaticString("PUT")); break; case HttpMethodMetadata::ValueType::kInvalid: - GPR_ASSERT(false); + Crash("invalid http method encoding"); break; } } diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc index 5f304dd9ecc..e01141eba40 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.cc +++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc @@ -46,6 +46,7 @@ #include "src/core/ext/transport/chttp2/transport/bin_encoder.h" #include "src/core/ext/transport/cronet/transport/cronet_status.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/iomgr/closure.h" @@ -1109,7 +1110,7 @@ static enum e_op_result execute_stream_op(struct op_and_state* oas) { } } else { // Should never reach here - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); } } stream_state->state_op_done[OP_SEND_MESSAGE] = true; diff --git a/src/core/lib/address_utils/sockaddr_utils.cc b/src/core/lib/address_utils/sockaddr_utils.cc index 08a39cd82c1..e45183a89a3 100644 --- a/src/core/lib/address_utils/sockaddr_utils.cc +++ b/src/core/lib/address_utils/sockaddr_utils.cc @@ -33,6 +33,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/iomgr/port.h" #include "src/core/lib/iomgr/sockaddr.h" @@ -356,7 +357,7 @@ std::string grpc_sockaddr_get_packed_host( const char* addr_bytes = reinterpret_cast(&addr6->sin6_addr); return std::string(addr_bytes, 16); } else { - GPR_ASSERT(false); + grpc_core::Crash("unknown socket family"); } } diff --git a/src/core/lib/channel/promise_based_filter.cc b/src/core/lib/channel/promise_based_filter.cc index 045dd834f64..929d52dce27 100644 --- a/src/core/lib/channel/promise_based_filter.cc +++ b/src/core/lib/channel/promise_based_filter.cc @@ -24,6 +24,7 @@ #include "absl/base/attributes.h" #include "absl/functional/function_ref.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/strings/str_join.h" #include "absl/types/variant.h" @@ -31,6 +32,7 @@ #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/iomgr/error.h" @@ -318,8 +320,7 @@ void BaseCallData::SendMessage::StartOp(CapturedBatch batch) { case State::kForwardedBatch: case State::kBatchCompleted: case State::kPushedToPipe: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); - abort(); + Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); case State::kCancelled: case State::kCancelledButNotYetPolled: return; @@ -348,8 +349,7 @@ void BaseCallData::SendMessage::GotPipe(PipeReceiver* receiver) { case State::kForwardedBatch: case State::kBatchCompleted: case State::kPushedToPipe: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); - abort(); + Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); case State::kCancelled: case State::kCancelledButNotYetPolled: return; @@ -388,8 +388,7 @@ void BaseCallData::SendMessage::OnComplete(absl::Status status) { case State::kPushedToPipe: case State::kGotBatch: case State::kBatchCompleted: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); - abort(); + Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); break; case State::kCancelled: case State::kCancelledButNotYetPolled: @@ -422,8 +421,7 @@ void BaseCallData::SendMessage::Done(const ServerMetadata& metadata) { case State::kGotBatchNoPipe: case State::kGotBatch: case State::kBatchCompleted: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); - abort(); + Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); break; case State::kPushedToPipe: push_.reset(); @@ -574,8 +572,7 @@ void BaseCallData::ReceiveMessage::StartOp(CapturedBatch& batch) { case State::kPulledFromPipe: case State::kCompletedWhilePulledFromPipe: case State::kCompletedWhilePushedToPipe: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); - abort(); + Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); case State::kCancelledWhilstIdle: case State::kCancelled: return; @@ -616,8 +613,7 @@ void BaseCallData::ReceiveMessage::GotPipe(PipeSender* sender) { case State::kCancelledWhilstForwarding: case State::kCancelledWhilstIdle: case State::kBatchCompletedButCancelled: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); - abort(); + Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); case State::kCancelled: return; } @@ -642,8 +638,7 @@ void BaseCallData::ReceiveMessage::OnComplete(absl::Status status) { case State::kCancelledWhilstIdle: case State::kCompletedWhilePulledFromPipe: case State::kCompletedWhilePushedToPipe: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); - abort(); + Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); case State::kForwardedBatchNoPipe: state_ = State::kBatchCompletedNoPipe; return; @@ -702,8 +697,7 @@ void BaseCallData::ReceiveMessage::Done(const ServerMetadata& metadata, case State::kBatchCompleted: case State::kBatchCompletedNoPipe: case State::kBatchCompletedButCancelled: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", StateString(state_)); - abort(); + Crash(absl::StrFormat("ILLEGAL STATE: %s", StateString(state_))); case State::kCancelledWhilstIdle: case State::kCancelledWhilstForwarding: case State::kCancelled: @@ -994,10 +988,10 @@ class ClientCallData::PollContext { case RecvInitialMetadata:: kRespondedToTrailingMetadataPriorToHook: case RecvInitialMetadata::kRespondedButNeedToSetLatch: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", - RecvInitialMetadata::StateString( - self_->recv_initial_metadata_->state)); - abort(); // not reachable + Crash(absl::StrFormat("ILLEGAL STATE: %s", + RecvInitialMetadata::StateString( + self_->recv_initial_metadata_ + ->state))); // not reachable break; case RecvInitialMetadata::kHookedWaitingForLatch: case RecvInitialMetadata::kHookedAndGotLatch: @@ -1033,10 +1027,10 @@ class ClientCallData::PollContext { case RecvInitialMetadata:: kRespondedToTrailingMetadataPriorToHook: case RecvInitialMetadata::kRespondedButNeedToSetLatch: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", - RecvInitialMetadata::StateString( - self_->recv_initial_metadata_->state)); - abort(); // not reachable + Crash(absl::StrFormat("ILLEGAL STATE: %s", + RecvInitialMetadata::StateString( + self_->recv_initial_metadata_ + ->state))); // not reachable break; case RecvInitialMetadata::kCompleteWaitingForLatch: case RecvInitialMetadata::kCompleteAndGotLatch: @@ -1263,10 +1257,10 @@ void ClientCallData::StartBatch(grpc_transport_stream_op_batch* b) { case RecvInitialMetadata::kCompleteAndSetLatch: case RecvInitialMetadata::kResponded: case RecvInitialMetadata::kRespondedButNeedToSetLatch: - gpr_log( - GPR_ERROR, "ILLEGAL STATE: %s", - RecvInitialMetadata::StateString(recv_initial_metadata_->state)); - abort(); // unreachable + Crash(absl::StrFormat( + "ILLEGAL STATE: %s", + RecvInitialMetadata::StateString( + recv_initial_metadata_->state))); // unreachable } if (hook) { auto cb = [](void* ptr, grpc_error_handle error) { @@ -1383,10 +1377,9 @@ void ClientCallData::Cancel(grpc_error_handle error, Flusher* flusher) { case RecvInitialMetadata::kResponded: break; case RecvInitialMetadata::kRespondedButNeedToSetLatch: - gpr_log( - GPR_ERROR, "ILLEGAL STATE: %s", - RecvInitialMetadata::StateString(recv_initial_metadata_->state)); - abort(); + Crash(absl::StrFormat( + "ILLEGAL STATE: %s", + RecvInitialMetadata::StateString(recv_initial_metadata_->state))); break; } } @@ -1441,10 +1434,10 @@ void ClientCallData::RecvInitialMetadataReady(grpc_error_handle error) { case RecvInitialMetadata::kResponded: case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook: case RecvInitialMetadata::kRespondedButNeedToSetLatch: - gpr_log( - GPR_ERROR, "ILLEGAL STATE: %s", - RecvInitialMetadata::StateString(recv_initial_metadata_->state)); - abort(); // unreachable + Crash(absl::StrFormat( + "ILLEGAL STATE: %s", + RecvInitialMetadata::StateString( + recv_initial_metadata_->state))); // unreachable } flusher.AddClosure( std::exchange(recv_initial_metadata_->original_on_ready, nullptr), @@ -1473,10 +1466,10 @@ void ClientCallData::RecvInitialMetadataReady(grpc_error_handle error) { case RecvInitialMetadata::kResponded: case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook: case RecvInitialMetadata::kRespondedButNeedToSetLatch: - gpr_log( - GPR_ERROR, "ILLEGAL STATE: %s", - RecvInitialMetadata::StateString(recv_initial_metadata_->state)); - abort(); // unreachable + Crash(absl::StrFormat( + "ILLEGAL STATE: %s", + RecvInitialMetadata::StateString( + recv_initial_metadata_->state))); // unreachable } } WakeInsideCombiner(&flusher); @@ -1537,10 +1530,10 @@ ArenaPromise ClientCallData::MakeNextPromise( case RecvInitialMetadata::kResponded: case RecvInitialMetadata::kRespondedToTrailingMetadataPriorToHook: case RecvInitialMetadata::kRespondedButNeedToSetLatch: - gpr_log( - GPR_ERROR, "ILLEGAL STATE: %s", - RecvInitialMetadata::StateString(recv_initial_metadata_->state)); - abort(); // unreachable + Crash(absl::StrFormat( + "ILLEGAL STATE: %s", + RecvInitialMetadata::StateString( + recv_initial_metadata_->state))); // unreachable } } else { GPR_ASSERT(call_args.server_initial_metadata == nullptr); @@ -1602,9 +1595,8 @@ Poll ClientCallData::PollTrailingMetadata() { case RecvTrailingState::kResponded: // We've already responded to the caller: we can't do anything and we // should never reach here. - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", - StateString(recv_trailing_state_)); - abort(); + Crash(absl::StrFormat("ILLEGAL STATE: %s", + StateString(recv_trailing_state_))); } GPR_UNREACHABLE_CODE(return Pending{}); } @@ -1903,10 +1895,10 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) { case SendInitialMetadata::kQueuedWaitingForLatch: case SendInitialMetadata::kQueuedAndSetLatch: case SendInitialMetadata::kForwarded: - gpr_log( - GPR_ERROR, "ILLEGAL STATE: %s", - SendInitialMetadata::StateString(send_initial_metadata_->state)); - abort(); // not reachable + Crash(absl::StrFormat( + "ILLEGAL STATE: %s", + SendInitialMetadata::StateString( + send_initial_metadata_->state))); // not reachable } send_initial_metadata_->batch = batch; wake = true; @@ -1942,9 +1934,9 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) { case SendTrailingState::kQueued: case SendTrailingState::kQueuedBehindSendMessage: case SendTrailingState::kForwarded: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", - StateString(send_trailing_state_)); - abort(); // unreachable + Crash( + absl::StrFormat("ILLEGAL STATE: %s", + StateString(send_trailing_state_))); // unreachable break; case SendTrailingState::kCancelled: batch.CancelWith( @@ -2022,10 +2014,10 @@ ArenaPromise ServerCallData::MakeNextPromise( case SendInitialMetadata::kQueuedAndGotLatch: case SendInitialMetadata::kQueuedAndSetLatch: case SendInitialMetadata::kForwarded: - gpr_log( - GPR_ERROR, "ILLEGAL STATE: %s", - SendInitialMetadata::StateString(send_initial_metadata_->state)); - abort(); // not reachable + Crash(absl::StrFormat( + "ILLEGAL STATE: %s", + SendInitialMetadata::StateString( + send_initial_metadata_->state))); // not reachable break; case SendInitialMetadata::kQueuedWaitingForLatch: send_initial_metadata_->state = SendInitialMetadata::kQueuedAndGotLatch; @@ -2062,9 +2054,8 @@ Poll ServerCallData::PollTrailingMetadata() { return WrapMetadata(send_trailing_metadata_batch_->payload ->send_trailing_metadata.send_trailing_metadata); case SendTrailingState::kForwarded: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", - StateString(send_trailing_state_)); - abort(); // unreachable + Crash(absl::StrFormat("ILLEGAL STATE: %s", + StateString(send_trailing_state_))); // unreachable case SendTrailingState::kCancelled: // We could translate cancelled_error to metadata and return it... BUT // we're not gonna be running much longer and the results going to be @@ -2233,9 +2224,9 @@ void ServerCallData::WakeInsideCombiner(Flusher* flusher) { send_trailing_state_ = SendTrailingState::kForwarded; } break; case SendTrailingState::kForwarded: - gpr_log(GPR_ERROR, "ILLEGAL STATE: %s", - StateString(send_trailing_state_)); - abort(); // unreachable + Crash(absl::StrFormat( + "ILLEGAL STATE: %s", + StateString(send_trailing_state_))); // unreachable break; case SendTrailingState::kInitial: { GPR_ASSERT(*md->get_pointer(GrpcStatusMetadata()) != GRPC_STATUS_OK); diff --git a/src/core/lib/compression/compression_internal.cc b/src/core/lib/compression/compression_internal.cc index eb1a31afbc2..36044e0b6c2 100644 --- a/src/core/lib/compression/compression_internal.cc +++ b/src/core/lib/compression/compression_internal.cc @@ -26,6 +26,7 @@ #include "absl/container/inlined_vector.h" #include "absl/strings/ascii.h" +#include "absl/strings/str_format.h" #include "absl/strings/str_split.h" #include "absl/types/variant.h" @@ -33,6 +34,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/surface/api_trace.h" namespace grpc_core { @@ -112,9 +114,8 @@ CompressionAlgorithmSet::CompressionAlgorithmForLevel( GRPC_API_TRACE("grpc_message_compression_algorithm_for_level(level=%d)", 1, ((int)level)); if (level > GRPC_COMPRESS_LEVEL_HIGH) { - gpr_log(GPR_ERROR, "Unknown message compression level %d.", - static_cast(level)); - abort(); + Crash(absl::StrFormat("Unknown message compression level %d.", + static_cast(level))); } if (level == GRPC_COMPRESS_LEVEL_NONE) { diff --git a/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc b/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc index d087534208c..b212756b080 100644 --- a/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +++ b/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc @@ -22,6 +22,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" +#include "absl/strings/str_format.h" #include #include @@ -30,6 +31,7 @@ #include "src/core/lib/event_engine/poller.h" #include "src/core/lib/event_engine/time_util.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/port.h" // This polling engine is only relevant on linux kernels supporting epoll @@ -463,10 +465,9 @@ int Epoll1Poller::DoEpollWait(EventEngine::Duration timeout) { grpc_event_engine::experimental::Milliseconds(timeout))); } while (r < 0 && errno == EINTR); if (r < 0) { - gpr_log(GPR_ERROR, - "(event_engine) Epoll1Poller:%p encountered epoll_wait error: %s", - this, grpc_core::StrError(errno).c_str()); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat( + "(event_engine) Epoll1Poller:%p encountered epoll_wait error: %s", this, + grpc_core::StrError(errno).c_str())); } g_epoll_set_.num_events = r; g_epoll_set_.cursor = 0; @@ -573,34 +574,34 @@ using ::grpc_event_engine::experimental::EventEngine; using ::grpc_event_engine::experimental::Poller; Epoll1Poller::Epoll1Poller(Scheduler* /* engine */) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } -void Epoll1Poller::Shutdown() { GPR_ASSERT(false && "unimplemented"); } +void Epoll1Poller::Shutdown() { grpc_core::Crash("unimplemented"); } -Epoll1Poller::~Epoll1Poller() { GPR_ASSERT(false && "unimplemented"); } +Epoll1Poller::~Epoll1Poller() { grpc_core::Crash("unimplemented"); } EventHandle* Epoll1Poller::CreateHandle(int /*fd*/, absl::string_view /*name*/, bool /*track_err*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } bool Epoll1Poller::ProcessEpollEvents(int /*max_epoll_events_to_handle*/, Events& /*pending_events*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } int Epoll1Poller::DoEpollWait(EventEngine::Duration /*timeout*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } Poller::WorkResult Epoll1Poller::Work( EventEngine::Duration /*timeout*/, absl::FunctionRef /*schedule_poll_again*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } -void Epoll1Poller::Kick() { GPR_ASSERT(false && "unimplemented"); } +void Epoll1Poller::Kick() { grpc_core::Crash("unimplemented"); } // If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return // nullptr. diff --git a/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc b/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc index 47467c4c6ac..32b892a6d7c 100644 --- a/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +++ b/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc @@ -17,7 +17,6 @@ #include "src/core/lib/event_engine/posix_engine/ev_poll_posix.h" #include -#include #include #include @@ -28,6 +27,7 @@ #include "absl/functional/any_invocable.h" #include "absl/status/status.h" #include "absl/status/statusor.h" +#include "absl/strings/str_format.h" #include #include @@ -38,6 +38,7 @@ #include "src/core/lib/event_engine/poller.h" #include "src/core/lib/event_engine/posix_engine/event_poller.h" #include "src/core/lib/event_engine/posix_engine/posix_engine_closure.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/port.h" @@ -415,10 +416,9 @@ int PollEventHandle::NotifyOnLocked(PosixEngineClosure** st, return 1; } else { // upcallptr was set to a different closure. This is an error! - gpr_log(GPR_ERROR, - "User called a notify_on function with a previous callback still " - "pending"); - abort(); + grpc_core::Crash( + "User called a notify_on function with a previous callback still " + "pending"); } return 0; } @@ -719,18 +719,15 @@ Poller::WorkResult PollPoller::Work( // may crash. r = poll(pfds, pfd_count, timeout_ms); } else { - gpr_log(GPR_ERROR, - "Attempted a blocking poll when declared non-polling."); - GPR_ASSERT(false); + grpc_core::Crash("Attempted a blocking poll when declared non-polling."); } if (r <= 0) { if (r < 0 && errno != EINTR) { // Abort fail here. - gpr_log(GPR_ERROR, - "(event_engine) PollPoller:%p encountered poll error: %s", this, - grpc_core::StrError(errno).c_str()); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat( + "(event_engine) PollPoller:%p encountered poll error: %s", this, + grpc_core::StrError(errno).c_str())); } for (i = 1; i < pfd_count; i++) { @@ -852,29 +849,31 @@ PollPoller* MakePollPoller(Scheduler* scheduler, bool use_phony_poll) { #else // GRPC_POSIX_SOCKET_EV_POLL +#include "src/core/lib/gprpp/crash.h" + namespace grpc_event_engine { namespace experimental { PollPoller::PollPoller(Scheduler* /* engine */) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } -void PollPoller::Shutdown() { GPR_ASSERT(false && "unimplemented"); } +void PollPoller::Shutdown() { grpc_core::Crash("unimplemented"); } -PollPoller::~PollPoller() { GPR_ASSERT(false && "unimplemented"); } +PollPoller::~PollPoller() { grpc_core::Crash("unimplemented"); } EventHandle* PollPoller::CreateHandle(int /*fd*/, absl::string_view /*name*/, bool /*track_err*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } Poller::WorkResult PollPoller::Work( EventEngine::Duration /*timeout*/, absl::FunctionRef /*schedule_poll_again*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } -void PollPoller::Kick() { GPR_ASSERT(false && "unimplemented"); } +void PollPoller::Kick() { grpc_core::Crash("unimplemented"); } // If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return // nullptr. @@ -884,15 +883,15 @@ PollPoller* MakePollPoller(Scheduler* /*scheduler*/, } void PollPoller::KickExternal(bool /*ext*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } void PollPoller::PollerHandlesListAddHandle(PollEventHandle* /*handle*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } void PollPoller::PollerHandlesListRemoveHandle(PollEventHandle* /*handle*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } } // namespace experimental diff --git a/src/core/lib/event_engine/posix_engine/lockfree_event.cc b/src/core/lib/event_engine/posix_engine/lockfree_event.cc index 9967e5d9df5..5f17244a446 100644 --- a/src/core/lib/event_engine/posix_engine/lockfree_event.cc +++ b/src/core/lib/event_engine/posix_engine/lockfree_event.cc @@ -15,8 +15,6 @@ #include "src/core/lib/event_engine/posix_engine/lockfree_event.h" -#include - #include #include @@ -27,6 +25,7 @@ #include "src/core/lib/event_engine/posix_engine/event_poller.h" #include "src/core/lib/event_engine/posix_engine/posix_engine_closure.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/status_helper.h" // 'state' holds the to call when the fd is readable or writable respectively. @@ -149,10 +148,9 @@ void LockfreeEvent::NotifyOn(PosixEngineClosure* closure) { } // There is already a closure!. This indicates a bug in the code. - gpr_log(GPR_ERROR, - "LockfreeEvent::NotifyOn: notify_on called with a previous " - "callback still pending"); - abort(); + grpc_core::Crash( + "LockfreeEvent::NotifyOn: notify_on called with a previous " + "callback still pending"); } } } diff --git a/src/core/lib/event_engine/posix_engine/posix_endpoint.cc b/src/core/lib/event_engine/posix_engine/posix_endpoint.cc index 243f9f8d090..c0a7d704f02 100644 --- a/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +++ b/src/core/lib/event_engine/posix_engine/posix_endpoint.cc @@ -856,7 +856,7 @@ TcpZerocopySendRecord* PosixEndpointImpl::TcpGetSendZerocopyRecord( } void PosixEndpointImpl::HandleError(absl::Status /*status*/) { - GPR_ASSERT(false && "Error handling not supported on this platform"); + grpc_core::Crash("Error handling not supported on this platform"); } void PosixEndpointImpl::ZerocopyDisableAndWaitForRemaining() {} @@ -866,7 +866,7 @@ bool PosixEndpointImpl::WriteWithTimestamps(struct msghdr* /*msg*/, ssize_t* /*sent_length*/, int* /*saved_errno*/, int /*additional_flags*/) { - GPR_ASSERT(false && "Write with timestamps not supported for this platform"); + grpc_core::Crash("Write with timestamps not supported for this platform"); } #endif // GRPC_LINUX_ERRQUEUE @@ -1299,7 +1299,7 @@ std::unique_ptr CreatePosixEndpoint( EventHandle* /*handle*/, PosixEngineClosure* /*on_shutdown*/, std::shared_ptr /*engine*/, const PosixTcpOptions& /*options*/) { - GPR_ASSERT(false && "Cannot create PosixEndpoint on this platform"); + grpc_core::Crash("Cannot create PosixEndpoint on this platform"); } } // namespace experimental diff --git a/src/core/lib/event_engine/posix_engine/posix_endpoint.h b/src/core/lib/event_engine/posix_engine/posix_endpoint.h index 62dc4b8eb96..2d73af72e1e 100644 --- a/src/core/lib/event_engine/posix_engine/posix_endpoint.h +++ b/src/core/lib/event_engine/posix_engine/posix_endpoint.h @@ -42,6 +42,7 @@ #include "src/core/lib/event_engine/posix_engine/posix_engine_closure.h" #include "src/core/lib/event_engine/posix_engine/tcp_socket_utils.h" #include "src/core/lib/event_engine/posix_engine/traced_buffer_list.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/port.h" @@ -344,7 +345,7 @@ class TcpZerocopySendCtx { // state was CHECK and is_in_write is false. This means that after the // previous sendmsg returned and set is_in_write to false, it did // not update the z-copy change from CHECK to OPEN. - GPR_ASSERT(false && "OMem state error!"); + grpc_core::Crash("OMem state error!"); } } @@ -641,25 +642,25 @@ class PosixEndpoint grpc_event_engine::experimental::SliceBuffer* /*buffer*/, const grpc_event_engine::experimental::EventEngine::Endpoint:: ReadArgs* /*args*/) override { - GPR_ASSERT(false && "PosixEndpoint::Read not supported on this platform"); + grpc_core::Crash("PosixEndpoint::Read not supported on this platform"); } void Write(absl::AnyInvocable /*on_writable*/, grpc_event_engine::experimental::SliceBuffer* /*data*/, const grpc_event_engine::experimental::EventEngine::Endpoint:: WriteArgs* /*args*/) override { - GPR_ASSERT(false && "PosixEndpoint::Write not supported on this platform"); + grpc_core::Crash("PosixEndpoint::Write not supported on this platform"); } const grpc_event_engine::experimental::EventEngine::ResolvedAddress& GetPeerAddress() const override { - GPR_ASSERT(false && - "PosixEndpoint::GetPeerAddress not supported on this platform"); + grpc_core::Crash( + "PosixEndpoint::GetPeerAddress not supported on this platform"); } const grpc_event_engine::experimental::EventEngine::ResolvedAddress& GetLocalAddress() const override { - GPR_ASSERT(false && - "PosixEndpoint::GetLocalAddress not supported on this platform"); + grpc_core::Crash( + "PosixEndpoint::GetLocalAddress not supported on this platform"); } ~PosixEndpoint() override = default; diff --git a/src/core/lib/event_engine/posix_engine/posix_engine.cc b/src/core/lib/event_engine/posix_engine/posix_engine.cc index fea380acdac..507da3326ff 100644 --- a/src/core/lib/event_engine/posix_engine/posix_engine.cc +++ b/src/core/lib/event_engine/posix_engine/posix_engine.cc @@ -41,6 +41,7 @@ #include "src/core/lib/event_engine/tcp_socket_utils.h" #include "src/core/lib/event_engine/trace.h" #include "src/core/lib/event_engine/utils.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #ifdef GRPC_POSIX_SOCKET_TCP @@ -465,12 +466,10 @@ EventEngine::TaskHandle PosixEventEngine::RunAfterInternal( std::unique_ptr PosixEventEngine::GetDNSResolver( EventEngine::DNSResolver::ResolverOptions const& /*options*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } -bool PosixEventEngine::IsWorkerThread() { - GPR_ASSERT(false && "unimplemented"); -} +bool PosixEventEngine::IsWorkerThread() { grpc_core::Crash("unimplemented"); } bool PosixEventEngine::CancelConnect(EventEngine::ConnectionHandle handle) { #ifdef GRPC_POSIX_SOCKET_TCP @@ -523,8 +522,8 @@ bool PosixEventEngine::CancelConnect(EventEngine::ConnectionHandle handle) { } return connection_cancel_success; #else // GRPC_POSIX_SOCKET_TCP - GPR_ASSERT(false && - "EventEngine::CancelConnect is not supported on this platform"); + grpc_core::Crash( + "EventEngine::CancelConnect is not supported on this platform"); #endif // GRPC_POSIX_SOCKET_TCP } @@ -546,7 +545,7 @@ EventEngine::ConnectionHandle PosixEventEngine::Connect( (*socket).mapped_target_addr, std::move(memory_allocator), options, timeout); #else // GRPC_POSIX_SOCKET_TCP - GPR_ASSERT(false && "EventEngine::Connect is not supported on this platform"); + grpc_core::Crash("EventEngine::Connect is not supported on this platform"); #endif // GRPC_POSIX_SOCKET_TCP } @@ -562,8 +561,8 @@ PosixEventEngine::CreateListener( std::move(memory_allocator_factory), poller_manager_->Poller(), shared_from_this()); #else // GRPC_POSIX_SOCKET_TCP - GPR_ASSERT(false && - "EventEngine::CreateListener is not supported on this platform"); + grpc_core::Crash( + "EventEngine::CreateListener is not supported on this platform"); #endif // GRPC_POSIX_SOCKET_TCP } diff --git a/src/core/lib/event_engine/posix_engine/posix_engine_listener.h b/src/core/lib/event_engine/posix_engine/posix_engine_listener.h index e6c4a827f18..33a7a179011 100644 --- a/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +++ b/src/core/lib/event_engine/posix_engine/posix_engine_listener.h @@ -203,6 +203,8 @@ class PosixEngineListener #else // GRPC_POSIX_SOCKET_TCP +#include "src/core/lib/gprpp/crash.h" + class PosixEngineListener : public grpc_event_engine::experimental::EventEngine::Listener { public: @@ -210,12 +212,12 @@ class PosixEngineListener ~PosixEngineListener() override = default; absl::StatusOr Bind(const grpc_event_engine::experimental::EventEngine:: ResolvedAddress& /*addr*/) override { - GPR_ASSERT(false && - "EventEngine::Listener::Bind not supported on this platform"); + grpc_core::Crash( + "EventEngine::Listener::Bind not supported on this platform"); } absl::Status Start() override { - GPR_ASSERT(false && - "EventEngine::Listener::Start not supported on this platform"); + grpc_core::Crash( + "EventEngine::Listener::Start not supported on this platform"); } }; diff --git a/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc b/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc index 1b2815b9ead..ba678de0dd8 100644 --- a/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +++ b/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc @@ -31,6 +31,7 @@ #include "src/core/lib/event_engine/posix_engine/tcp_socket_utils.h" #include "src/core/lib/event_engine/tcp_socket_utils.h" +#include "src/core/lib/gprpp/crash.h" // IWYU pragma: keep #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/iomgr/port.h" #include "src/core/lib/iomgr/socket_mutator.h" @@ -288,7 +289,7 @@ absl::StatusOr ListenerContainerAddAllLocalAddresses( (void)listener_sockets; (void)options; (void)requested_port; - GPR_ASSERT(false && "System does not support ifaddrs"); + grpc_core::Crash("System does not support ifaddrs"); #endif } @@ -353,25 +354,24 @@ absl::StatusOr CreateAndPrepareListenerSocket(const PosixTcpOptions& /*options*/, const grpc_event_engine::experimental:: EventEngine::ResolvedAddress& /*addr*/) { - GPR_ASSERT( - false && + grpc_core::Crash( "CreateAndPrepareListenerSocket is not supported on this platform"); } absl::StatusOr ListenerContainerAddWildcardAddresses( ListenerSocketsContainer& /*listener_sockets*/, const PosixTcpOptions& /*options*/, int /*requested_port*/) { - GPR_ASSERT(false && - "ListenerContainerAddWildcardAddresses is not supported on this " - "platform"); + grpc_core::Crash( + "ListenerContainerAddWildcardAddresses is not supported on this " + "platform"); } absl::StatusOr ListenerContainerAddAllLocalAddresses( ListenerSocketsContainer& /*listener_sockets*/, const PosixTcpOptions& /*options*/, int /*requested_port*/) { - GPR_ASSERT(false && - "ListenerContainerAddAllLocalAddresses is not supported on this " - "platform"); + grpc_core::Crash( + "ListenerContainerAddAllLocalAddresses is not supported on this " + "platform"); } #endif // GRPC_POSIX_SOCKET_UTILS_COMMON diff --git a/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc b/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc index 114fd8ed796..201a3964625 100644 --- a/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +++ b/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc @@ -29,6 +29,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" // IWYU pragma: keep #include "src/core/lib/iomgr/port.h" #ifdef GRPC_POSIX_SOCKET_UTILS_COMMON @@ -753,31 +754,31 @@ PosixSocketWrapper::CreateAndPrepareTcpClientSocket( #else // GRPC_POSIX_SOCKET_UTILS_COMMON absl::StatusOr PosixSocketWrapper::SetSocketRcvLowat(int /*bytes*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketZeroCopy() { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketNonBlocking(int /*non_blocking*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketCloexec(int /*close_on_exec*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketReuseAddr(int /*reuse*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketLowLatency(int /*low_latency*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketReusePort(int /*reuse*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } void PosixSocketWrapper::ConfigureDefaultTcpUserTimeout(bool /*enable*/, @@ -786,49 +787,49 @@ void PosixSocketWrapper::ConfigureDefaultTcpUserTimeout(bool /*enable*/, void PosixSocketWrapper::TrySetSocketTcpUserTimeout( const PosixTcpOptions& /*options*/, bool /*is_client*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketNoSigpipeIfPossible() { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketIpPktInfoIfPossible() { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketIpv6RecvPktInfoIfPossible() { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketSndBuf(int /*buffer_size_bytes*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketRcvBuf(int /*buffer_size_bytes*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::SetSocketMutator( grpc_fd_usage /*usage*/, grpc_socket_mutator* /*mutator*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::Status PosixSocketWrapper::ApplySocketMutatorInOptions( grpc_fd_usage /*usage*/, const PosixTcpOptions& /*options*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } bool PosixSocketWrapper::SetSocketDualStack() { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } bool PosixSocketWrapper::IsSocketReusePortSupported() { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } bool PosixSocketWrapper::IsIpv6LoopbackAvailable() { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::StatusOr PosixSocketWrapper::CreateDualStackSocket( @@ -836,14 +837,14 @@ absl::StatusOr PosixSocketWrapper::CreateDualStackSocket( /* socket_factory */, const experimental::EventEngine::ResolvedAddress& /*addr*/, int /*type*/, int /*protocol*/, DSMode& /*dsmode*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::StatusOr PosixSocketWrapper::CreateAndPrepareTcpClientSocket( const PosixTcpOptions& /*options*/, const EventEngine::ResolvedAddress& /*target_addr*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } #endif // GRPC_POSIX_SOCKET_UTILS_COMMON diff --git a/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc b/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc index e5119f0c840..947299ce1b7 100644 --- a/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +++ b/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc @@ -316,12 +316,14 @@ void TcpSetWriteTimestampsCallback( #else // GRPC_LINUX_ERRQUEUE +#include "src/core/lib/gprpp/crash.h" + namespace grpc_event_engine { namespace experimental { void TcpSetWriteTimestampsCallback( absl::AnyInvocable /*fn*/) { - GPR_ASSERT(false && "Timestamps callback is not enabled for this platform"); + grpc_core::Crash("Timestamps callback is not enabled for this platform"); } } // namespace experimental diff --git a/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc b/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc index e62d412fad2..2a24d6a5d50 100644 --- a/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc +++ b/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc @@ -19,8 +19,7 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" -#include // IWYU pragma: keep - +#include "src/core/lib/gprpp/crash.h" // IWYU pragma: keep #include "src/core/lib/iomgr/port.h" #ifdef GRPC_LINUX_EVENTFD @@ -105,13 +104,15 @@ EventFdWakeupFd::CreateEventFdWakeupFd() { #else // GRPC_LINUX_EVENTFD -absl::Status EventFdWakeupFd::Init() { GPR_ASSERT(false && "unimplemented"); } +#include "src/core/lib/gprpp/crash.h" + +absl::Status EventFdWakeupFd::Init() { grpc_core::Crash("unimplemented"); } absl::Status EventFdWakeupFd::ConsumeWakeup() { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } -absl::Status EventFdWakeupFd::Wakeup() { GPR_ASSERT(false && "unimplemented"); } +absl::Status EventFdWakeupFd::Wakeup() { grpc_core::Crash("unimplemented"); } bool EventFdWakeupFd::IsSupported() { return false; } diff --git a/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc b/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc index d26327f2a66..8901bf570a0 100644 --- a/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc +++ b/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc @@ -20,8 +20,7 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" -#include // IWYU pragma: keep - +#include "src/core/lib/gprpp/crash.h" // IWYU pragma: keep #include "src/core/lib/iomgr/port.h" #ifdef GRPC_POSIX_WAKEUP_FD @@ -131,13 +130,13 @@ absl::StatusOr> PipeWakeupFd::CreatePipeWakeupFd() { #else // GRPC_POSIX_WAKEUP_FD -absl::Status PipeWakeupFd::Init() { GPR_ASSERT(false && "unimplemented"); } +absl::Status PipeWakeupFd::Init() { grpc_core::Crash("unimplemented"); } absl::Status PipeWakeupFd::ConsumeWakeup() { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } -absl::Status PipeWakeupFd::Wakeup() { GPR_ASSERT(false && "unimplemented"); } +absl::Status PipeWakeupFd::Wakeup() { grpc_core::Crash("unimplemented"); } bool PipeWakeupFd::IsSupported() { return false; } diff --git a/src/core/lib/event_engine/windows/iocp.cc b/src/core/lib/event_engine/windows/iocp.cc index 23fe4969eb0..b0e67ef5b37 100644 --- a/src/core/lib/event_engine/windows/iocp.cc +++ b/src/core/lib/event_engine/windows/iocp.cc @@ -26,6 +26,7 @@ #include "src/core/lib/event_engine/trace.h" #include "src/core/lib/event_engine/windows/iocp.h" #include "src/core/lib/event_engine/windows/win_socket.h" +#include "src/core/lib/gprpp/crash.h" namespace grpc_event_engine { namespace experimental { @@ -94,8 +95,8 @@ Poller::WorkResult IOCP::Work(EventEngine::Duration timeout, if (completion_key == (ULONG_PTR)&kick_token_) { return Poller::WorkResult::kKicked; } - gpr_log(GPR_ERROR, "Unknown custom completion key: %p", completion_key); - abort(); + grpc_core::Crash( + absl::StrFormat("Unknown custom completion key: %p", completion_key)); } if (GRPC_TRACE_FLAG_ENABLED(grpc_event_engine_trace)) { gpr_log(GPR_DEBUG, "IOCP::%p got event on OVERLAPPED::%p", this, diff --git a/src/core/lib/event_engine/windows/windows_endpoint.cc b/src/core/lib/event_engine/windows/windows_endpoint.cc index c77b925c96f..1c9ee4c5390 100644 --- a/src/core/lib/event_engine/windows/windows_endpoint.cc +++ b/src/core/lib/event_engine/windows/windows_endpoint.cc @@ -43,9 +43,9 @@ constexpr int64_t kDefaultTargetReadSize = 8192; constexpr int kMaxWSABUFCount = 16; void AbortOnEvent(absl::Status) { - GPR_ASSERT(false && - "INTERNAL ERROR: Asked to handle read/write event with an invalid " - "callback"); + grpc_core::Crash( + "INTERNAL ERROR: Asked to handle read/write event with an invalid " + "callback"); } } // namespace @@ -63,8 +63,7 @@ WindowsEndpoint::WindowsEndpoint( sockaddr addr; int addr_len = sizeof(addr); if (getsockname(socket_->socket(), &addr, &addr_len) < 0) { - gpr_log(GPR_ERROR, "Unrecoverable error: Failed to get local socket name."); - abort(); + grpc_core::Crash("Unrecoverable error: Failed to get local socket name."); } local_address_ = EventEngine::ResolvedAddress(&addr, addr_len); local_address_string_ = *ResolvedAddressToURI(local_address_); diff --git a/src/core/lib/event_engine/windows/windows_engine.cc b/src/core/lib/event_engine/windows/windows_engine.cc index 28b648848c3..ffddaf09103 100644 --- a/src/core/lib/event_engine/windows/windows_engine.cc +++ b/src/core/lib/event_engine/windows/windows_engine.cc @@ -32,6 +32,7 @@ #include "src/core/lib/event_engine/utils.h" #include "src/core/lib/event_engine/windows/iocp.h" #include "src/core/lib/event_engine/windows/windows_engine.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/time.h" @@ -133,22 +134,20 @@ EventEngine::TaskHandle WindowsEventEngine::RunAfterInternal( std::unique_ptr WindowsEventEngine::GetDNSResolver( EventEngine::DNSResolver::ResolverOptions const& /*options*/) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } -bool WindowsEventEngine::IsWorkerThread() { - GPR_ASSERT(false && "unimplemented"); -} +bool WindowsEventEngine::IsWorkerThread() { grpc_core::Crash("unimplemented"); } bool WindowsEventEngine::CancelConnect(EventEngine::ConnectionHandle handle) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } EventEngine::ConnectionHandle WindowsEventEngine::Connect( OnConnectCallback on_connect, const ResolvedAddress& addr, const EndpointConfig& args, MemoryAllocator memory_allocator, Duration deadline) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } absl::StatusOr> @@ -157,7 +156,7 @@ WindowsEventEngine::CreateListener( absl::AnyInvocable on_shutdown, const EndpointConfig& config, std::unique_ptr memory_allocator_factory) { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } } // namespace experimental diff --git a/src/core/lib/gpr/alloc.cc b/src/core/lib/gpr/alloc.cc index e7d94541e9f..7d0f7eb36d5 100644 --- a/src/core/lib/gpr/alloc.cc +++ b/src/core/lib/gpr/alloc.cc @@ -24,6 +24,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + void* gpr_malloc(size_t size) { void* p; if (size == 0) return nullptr; diff --git a/src/core/lib/gpr/cpu_linux.cc b/src/core/lib/gpr/cpu_linux.cc index eee30a8112c..670ca6551c1 100644 --- a/src/core/lib/gpr/cpu_linux.cc +++ b/src/core/lib/gpr/cpu_linux.cc @@ -33,6 +33,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/strerror.h" static int ncpus = 0; diff --git a/src/core/lib/gpr/cpu_posix.cc b/src/core/lib/gpr/cpu_posix.cc index f1b23f2d554..4b58d869f68 100644 --- a/src/core/lib/gpr/cpu_posix.cc +++ b/src/core/lib/gpr/cpu_posix.cc @@ -30,6 +30,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" static long ncpus = 0; diff --git a/src/core/lib/gpr/cpu_windows.cc b/src/core/lib/gpr/cpu_windows.cc index d31b379ada7..94af1e419c6 100644 --- a/src/core/lib/gpr/cpu_windows.cc +++ b/src/core/lib/gpr/cpu_windows.cc @@ -22,6 +22,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + unsigned gpr_cpu_num_cores(void) { SYSTEM_INFO si; GetSystemInfo(&si); diff --git a/src/core/lib/gpr/log.cc b/src/core/lib/gpr/log.cc index 3e151a7337f..d290b95ad0d 100644 --- a/src/core/lib/gpr/log.cc +++ b/src/core/lib/gpr/log.cc @@ -21,11 +21,14 @@ #include #include +#include "absl/strings/str_cat.h" + #include #include #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/global_config.h" #ifndef GPR_DEFAULT_LOG_VERBOSITY_STRING @@ -48,8 +51,13 @@ static gpr_atm g_min_severity_to_print = GPR_LOG_SEVERITY_UNSET; static gpr_atm g_min_severity_to_print_stacktrace = GPR_LOG_SEVERITY_UNSET; void gpr_unreachable_code(const char* reason, const char* file, int line) { - gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "UNREACHABLE CODE: %s", reason); - abort(); + grpc_core::Crash(absl::StrCat("UNREACHABLE CODE: ", reason), + grpc_core::SourceLocation(file, line)); +} + +void gpr_assertion_failed(const char* filename, int line, const char* message) { + grpc_core::Crash(absl::StrCat("ASSERTION FAILED: ", message), + grpc_core::SourceLocation(filename, line)); } const char* gpr_log_severity_string(gpr_log_severity severity) { diff --git a/src/core/lib/gpr/log_android.cc b/src/core/lib/gpr/log_android.cc index 38b84d7bcbb..92d17115361 100644 --- a/src/core/lib/gpr/log_android.cc +++ b/src/core/lib/gpr/log_android.cc @@ -28,6 +28,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + static android_LogPriority severity_to_log_priority(gpr_log_severity severity) { switch (severity) { case GPR_LOG_SEVERITY_DEBUG: diff --git a/src/core/lib/gpr/log_linux.cc b/src/core/lib/gpr/log_linux.cc index e5f8c871544..7a597f3bb59 100644 --- a/src/core/lib/gpr/log_linux.cc +++ b/src/core/lib/gpr/log_linux.cc @@ -44,6 +44,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/examine_stack.h" int gpr_should_log_stacktrace(gpr_log_severity severity); diff --git a/src/core/lib/gpr/log_posix.cc b/src/core/lib/gpr/log_posix.cc index 3f9e1e23677..18088486118 100644 --- a/src/core/lib/gpr/log_posix.cc +++ b/src/core/lib/gpr/log_posix.cc @@ -35,6 +35,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/examine_stack.h" int gpr_should_log_stacktrace(gpr_log_severity severity); diff --git a/src/core/lib/gpr/log_windows.cc b/src/core/lib/gpr/log_windows.cc index 145186d2fe6..fe249e31c15 100644 --- a/src/core/lib/gpr/log_windows.cc +++ b/src/core/lib/gpr/log_windows.cc @@ -30,6 +30,7 @@ #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/examine_stack.h" int gpr_should_log_stacktrace(gpr_log_severity severity); diff --git a/src/core/lib/gpr/string.cc b/src/core/lib/gpr/string.cc index d4e662d4d38..4d23c89c78b 100644 --- a/src/core/lib/gpr/string.cc +++ b/src/core/lib/gpr/string.cc @@ -35,6 +35,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" char* gpr_strdup(const char* src) { char* dst; diff --git a/src/core/lib/gpr/sync_abseil.cc b/src/core/lib/gpr/sync_abseil.cc index 1c0a2950acc..85fb6cbd354 100644 --- a/src/core/lib/gpr/sync_abseil.cc +++ b/src/core/lib/gpr/sync_abseil.cc @@ -33,6 +33,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + void gpr_mu_init(gpr_mu* mu) { static_assert(sizeof(gpr_mu) == sizeof(absl::Mutex), "gpr_mu and Mutex must be the same size"); diff --git a/src/core/lib/gpr/sync_posix.cc b/src/core/lib/gpr/sync_posix.cc index e5ebf453185..c3cf035ba4d 100644 --- a/src/core/lib/gpr/sync_posix.cc +++ b/src/core/lib/gpr/sync_posix.cc @@ -29,6 +29,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + void gpr_mu_init(gpr_mu* mu) { #ifdef GRPC_ASAN_ENABLED GPR_ASSERT(pthread_mutex_init(&mu->mutex, nullptr) == 0); diff --git a/src/core/lib/gpr/sync_windows.cc b/src/core/lib/gpr/sync_windows.cc index cb24ad73c7f..f06c73efb04 100644 --- a/src/core/lib/gpr/sync_windows.cc +++ b/src/core/lib/gpr/sync_windows.cc @@ -27,6 +27,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + void gpr_mu_init(gpr_mu* mu) { InitializeCriticalSection(&mu->cs); mu->locked = 0; diff --git a/src/core/lib/gpr/time.cc b/src/core/lib/gpr/time.cc index 3390e5c9be4..472cd204e11 100644 --- a/src/core/lib/gpr/time.cc +++ b/src/core/lib/gpr/time.cc @@ -27,6 +27,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + int gpr_time_cmp(gpr_timespec a, gpr_timespec b) { int cmp = (a.tv_sec > b.tv_sec) - (a.tv_sec < b.tv_sec); GPR_ASSERT(a.clock_type == b.clock_type); diff --git a/src/core/lib/gpr/time_posix.cc b/src/core/lib/gpr/time_posix.cc index 9741ab7d508..bc4b9be2218 100644 --- a/src/core/lib/gpr/time_posix.cc +++ b/src/core/lib/gpr/time_posix.cc @@ -32,6 +32,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + static struct timespec timespec_from_gpr(gpr_timespec gts) { struct timespec rv; if (sizeof(time_t) < sizeof(int64_t)) { diff --git a/src/core/lib/gpr/time_precise.cc b/src/core/lib/gpr/time_precise.cc index e2cd07fab5d..46efc61722e 100644 --- a/src/core/lib/gpr/time_precise.cc +++ b/src/core/lib/gpr/time_precise.cc @@ -29,6 +29,7 @@ #include #include "src/core/lib/gpr/time_precise.h" +#include "src/core/lib/gprpp/crash.h" #ifndef GPR_CYCLE_COUNTER_CUSTOM #if GPR_CYCLE_COUNTER_RDTSC_32 || GPR_CYCLE_COUNTER_RDTSC_64 diff --git a/src/core/lib/gpr/time_windows.cc b/src/core/lib/gpr/time_windows.cc index 77bcbe8f2e4..52b23c421d8 100644 --- a/src/core/lib/gpr/time_windows.cc +++ b/src/core/lib/gpr/time_windows.cc @@ -30,6 +30,7 @@ #include #include "src/core/lib/gpr/time_precise.h" +#include "src/core/lib/gprpp/crash.h" static LARGE_INTEGER g_start_time = []() { LARGE_INTEGER x; diff --git a/src/core/lib/gpr/tmpfile_msys.cc b/src/core/lib/gpr/tmpfile_msys.cc index f77cbda2d75..42372a5ce65 100644 --- a/src/core/lib/gpr/tmpfile_msys.cc +++ b/src/core/lib/gpr/tmpfile_msys.cc @@ -31,6 +31,7 @@ #include "src/core/lib/gpr/string_windows.h" #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" FILE* gpr_tmpfile(const char* prefix, char** tmp_filename_out) { FILE* result = NULL; diff --git a/src/core/lib/gpr/tmpfile_posix.cc b/src/core/lib/gpr/tmpfile_posix.cc index 7eceb779922..4d838af72bc 100644 --- a/src/core/lib/gpr/tmpfile_posix.cc +++ b/src/core/lib/gpr/tmpfile_posix.cc @@ -31,6 +31,7 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/strerror.h" FILE* gpr_tmpfile(const char* prefix, char** tmp_filename) { diff --git a/src/core/lib/gpr/tmpfile_windows.cc b/src/core/lib/gpr/tmpfile_windows.cc index 6f63991976d..37ac4f64bcb 100644 --- a/src/core/lib/gpr/tmpfile_windows.cc +++ b/src/core/lib/gpr/tmpfile_windows.cc @@ -30,6 +30,7 @@ #include #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/tchar.h" FILE* gpr_tmpfile(const char* prefix, char** tmp_filename_out) { diff --git a/src/core/lib/gprpp/crash.cc b/src/core/lib/gprpp/crash.cc new file mode 100644 index 00000000000..e287359d6ce --- /dev/null +++ b/src/core/lib/gprpp/crash.cc @@ -0,0 +1,33 @@ +// Copyright 2022 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/lib/gprpp/crash.h" + +#include + +#include + +#include + +namespace grpc_core { + +void Crash(absl::string_view message, SourceLocation location) { + gpr_log(location.file(), location.line(), GPR_LOG_SEVERITY_ERROR, "%s", + std::string(message).c_str()); + abort(); +} + +} // namespace grpc_core diff --git a/src/core/lib/gprpp/crash.h b/src/core/lib/gprpp/crash.h new file mode 100644 index 00000000000..f2998ba291e --- /dev/null +++ b/src/core/lib/gprpp/crash.h @@ -0,0 +1,34 @@ +// Copyright 2022 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GRPC_CORE_LIB_GPRPP_CRASH_H +#define GRPC_CORE_LIB_GPRPP_CRASH_H + +#include + +#include "absl/strings/string_view.h" + +#include "src/core/lib/gprpp/debug_location.h" + +namespace grpc_core { + +// Crash the program after printing `message`. +// ::grpc_core:: prefix to SourceLocation is required to work around a symbol +// mismatch bug on MSVC. +[[noreturn]] void Crash(absl::string_view message, + ::grpc_core::SourceLocation location = {}); + +} // namespace grpc_core + +#endif // GRPC_CORE_LIB_GPRPP_CRASH_H diff --git a/src/core/lib/gprpp/stat_windows.cc b/src/core/lib/gprpp/stat_windows.cc index ce7ff315769..20fc4335566 100644 --- a/src/core/lib/gprpp/stat_windows.cc +++ b/src/core/lib/gprpp/stat_windows.cc @@ -24,6 +24,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/stat.h" #include "src/core/lib/gprpp/strerror.h" diff --git a/src/core/lib/gprpp/thd_windows.cc b/src/core/lib/gprpp/thd_windows.cc index 37784a60d53..8bd310ff359 100644 --- a/src/core/lib/gprpp/thd_windows.cc +++ b/src/core/lib/gprpp/thd_windows.cc @@ -30,6 +30,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/thd.h" diff --git a/src/core/lib/iomgr/buffer_list.cc b/src/core/lib/iomgr/buffer_list.cc index 8da4c645752..11ebc9cc773 100644 --- a/src/core/lib/iomgr/buffer_list.cc +++ b/src/core/lib/iomgr/buffer_list.cc @@ -23,6 +23,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/port.h" diff --git a/src/core/lib/iomgr/call_combiner.cc b/src/core/lib/iomgr/call_combiner.cc index 7b3dcfcf9c0..2b2996c2c4f 100644 --- a/src/core/lib/iomgr/call_combiner.cc +++ b/src/core/lib/iomgr/call_combiner.cc @@ -26,6 +26,7 @@ #include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/stats_data.h" +#include "src/core/lib/gprpp/crash.h" namespace grpc_core { diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 04c45487c6d..54aaaac15f3 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -27,6 +27,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/mpscq.h" diff --git a/src/core/lib/iomgr/combiner.cc b/src/core/lib/iomgr/combiner.cc index 5c3b3b1bc86..1601802d1f8 100644 --- a/src/core/lib/iomgr/combiner.cc +++ b/src/core/lib/iomgr/combiner.cc @@ -27,6 +27,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/mpscq.h" #include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/iomgr_internal.h" diff --git a/src/core/lib/iomgr/endpoint_pair_posix.cc b/src/core/lib/iomgr/endpoint_pair_posix.cc index 41b9d2ac299..754bd350cc3 100644 --- a/src/core/lib/iomgr/endpoint_pair_posix.cc +++ b/src/core/lib/iomgr/endpoint_pair_posix.cc @@ -37,6 +37,7 @@ #include "src/core/lib/event_engine/channel_args_endpoint_config.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/socket_utils_posix.h" #include "src/core/lib/iomgr/tcp_posix.h" diff --git a/src/core/lib/iomgr/endpoint_pair_windows.cc b/src/core/lib/iomgr/endpoint_pair_windows.cc index 8ebfff1c53a..e6f1db7a6b8 100644 --- a/src/core/lib/iomgr/endpoint_pair_windows.cc +++ b/src/core/lib/iomgr/endpoint_pair_windows.cc @@ -28,6 +28,7 @@ #include #include "src/core/lib/address_utils/sockaddr_utils.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/socket_windows.h" diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc index f43809dccc2..c11c56f2ea7 100644 --- a/src/core/lib/iomgr/error.cc +++ b/src/core/lib/iomgr/error.cc @@ -29,6 +29,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + #ifdef GPR_WINDOWS #include #endif diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 5502689948b..1b5d4930c09 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -33,6 +33,7 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/gpr/spinlock.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index b616793e1f3..83b379552af 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -20,6 +20,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/port.h" // This polling engine is only relevant on linux kernels supporting epoll diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index 7304b082825..21d9f8ce284 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -35,6 +35,7 @@ #include #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include #include @@ -42,6 +43,7 @@ #include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/stats_data.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/block_annotate.h" #include "src/core/lib/iomgr/ev_poll_posix.h" @@ -521,10 +523,9 @@ static void notify_on_locked(grpc_fd* fd, grpc_closure** st, maybe_wake_one_watcher_locked(fd); } else { // upcallptr was set to a different closure. This is an error! - gpr_log(GPR_ERROR, - "User called a notify_on function with a previous callback still " - "pending"); - abort(); + grpc_core::Crash( + "User called a notify_on function with a previous callback still " + "pending"); } } @@ -1426,8 +1427,7 @@ int phony_poll(struct pollfd fds[], nfds_t nfds, int timeout) { if (timeout == 0) { return real_poll_function(fds, nfds, 0); } else { - gpr_log(GPR_ERROR, "Attempted a blocking poll when declared non-polling."); - GPR_ASSERT(false); + grpc_core::Crash("Attempted a blocking poll when declared non-polling."); return -1; } } diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc index 9ffff74059b..afa76299700 100644 --- a/src/core/lib/iomgr/ev_posix.cc +++ b/src/core/lib/iomgr/ev_posix.cc @@ -26,12 +26,15 @@ #include +#include "absl/strings/str_format.h" + #include #include #include #include "src/core/lib/debug/trace.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/global_config.h" #include "src/core/lib/iomgr/ev_epoll1_linux.h" #include "src/core/lib/iomgr/ev_poll_posix.h" @@ -187,9 +190,8 @@ void grpc_event_engine_init(void) { gpr_free(strings); if (g_event_engine == nullptr) { - gpr_log(GPR_ERROR, "No event engine could be initialized from %s", - value.get()); - abort(); + grpc_core::Crash(absl::StrFormat( + "No event engine could be initialized from %s", value.get())); } }); g_event_engine->init_engine(); diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc index 2d7805896b1..65cd319d20c 100644 --- a/src/core/lib/iomgr/exec_ctx.cc +++ b/src/core/lib/iomgr/exec_ctx.cc @@ -20,9 +20,12 @@ #include "src/core/lib/iomgr/exec_ctx.h" +#include "absl/strings/str_format.h" + #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/error.h" @@ -85,13 +88,12 @@ void ExecCtx::Run(const DebugLocation& location, grpc_closure* closure, } #ifndef NDEBUG if (closure->scheduled) { - gpr_log(GPR_ERROR, - "Closure already scheduled. (closure: %p, created: [%s:%d], " - "previously scheduled at: [%s: %d], newly scheduled at [%s: %d]", - closure, closure->file_created, closure->line_created, - closure->file_initiated, closure->line_initiated, location.file(), - location.line()); - abort(); + Crash(absl::StrFormat( + "Closure already scheduled. (closure: %p, created: [%s:%d], " + "previously scheduled at: [%s: %d], newly scheduled at [%s: %d]", + closure, closure->file_created, closure->line_created, + closure->file_initiated, closure->line_initiated, location.file(), + location.line())); } closure->scheduled = true; closure->file_initiated = location.file(); @@ -110,12 +112,11 @@ void ExecCtx::RunList(const DebugLocation& location, grpc_closure_list* list) { grpc_closure* next = c->next_data.next; #ifndef NDEBUG if (c->scheduled) { - gpr_log(GPR_ERROR, - "Closure already scheduled. (closure: %p, created: [%s:%d], " - "previously scheduled at: [%s: %d], newly scheduled at [%s:%d]", - c, c->file_created, c->line_created, c->file_initiated, - c->line_initiated, location.file(), location.line()); - abort(); + Crash(absl::StrFormat( + "Closure already scheduled. (closure: %p, created: [%s:%d], " + "previously scheduled at: [%s: %d], newly scheduled at [%s:%d]", + c, c->file_created, c->line_created, c->file_initiated, + c->line_initiated, location.file(), location.line())); } c->scheduled = true; c->file_initiated = location.file(); diff --git a/src/core/lib/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h index 2813e8150fe..3d3f7004862 100644 --- a/src/core/lib/iomgr/exec_ctx.h +++ b/src/core/lib/iomgr/exec_ctx.h @@ -30,6 +30,7 @@ #include #include "src/core/lib/gpr/time_precise.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/fork.h" #include "src/core/lib/gprpp/time.h" diff --git a/src/core/lib/iomgr/executor.cc b/src/core/lib/iomgr/executor.cc index 73dcbeb7c7e..c65475e1041 100644 --- a/src/core/lib/iomgr/executor.cc +++ b/src/core/lib/iomgr/executor.cc @@ -28,6 +28,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/iomgr_internal.h" diff --git a/src/core/lib/iomgr/fork_posix.cc b/src/core/lib/iomgr/fork_posix.cc index b308d5cdcb1..07e48e3ba27 100644 --- a/src/core/lib/iomgr/fork_posix.cc +++ b/src/core/lib/iomgr/fork_posix.cc @@ -32,6 +32,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/fork.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/ev_posix.h" diff --git a/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc b/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc index a5ca75bddfe..fe1ada03592 100644 --- a/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +++ b/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc @@ -27,6 +27,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/grpc_if_nametoindex.h" uint32_t grpc_if_nametoindex(char* name) { diff --git a/src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc b/src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc index 06bfe207f9e..5555cad6d1b 100644 --- a/src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc +++ b/src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc @@ -24,6 +24,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/grpc_if_nametoindex.h" uint32_t grpc_if_nametoindex(char* name) { diff --git a/src/core/lib/iomgr/iocp_windows.cc b/src/core/lib/iomgr/iocp_windows.cc index 70eccba9fd4..2d0c5eb41dd 100644 --- a/src/core/lib/iomgr/iocp_windows.cc +++ b/src/core/lib/iomgr/iocp_windows.cc @@ -32,6 +32,7 @@ #include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/stats_data.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/iomgr_internal.h" @@ -78,8 +79,7 @@ grpc_iocp_work_status grpc_iocp_work(grpc_core::Timestamp deadline) { // We were awoken from a kick. return GRPC_IOCP_WORK_KICK; } - gpr_log(GPR_ERROR, "Unknown custom completion key."); - abort(); + grpc_core::Crash("Unknown custom completion key."); } socket = (grpc_winsocket*)completion_key; diff --git a/src/core/lib/iomgr/iomgr.cc b/src/core/lib/iomgr/iomgr.cc index 99508dd3899..08c51cdd653 100644 --- a/src/core/lib/iomgr/iomgr.cc +++ b/src/core/lib/iomgr/iomgr.cc @@ -31,6 +31,7 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/global_config.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/buffer_list.h" diff --git a/src/core/lib/iomgr/iomgr_windows.cc b/src/core/lib/iomgr/iomgr_windows.cc index bd8db0e0301..b3a4a741072 100644 --- a/src/core/lib/iomgr/iomgr_windows.cc +++ b/src/core/lib/iomgr/iomgr_windows.cc @@ -24,6 +24,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/pollset_windows.h" diff --git a/src/core/lib/iomgr/load_file.cc b/src/core/lib/iomgr/load_file.cc index 01538804f57..8a6ac72a818 100644 --- a/src/core/lib/iomgr/load_file.cc +++ b/src/core/lib/iomgr/load_file.cc @@ -28,6 +28,7 @@ #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/block_annotate.h" grpc_error_handle grpc_load_file(const char* filename, int add_null_terminator, diff --git a/src/core/lib/iomgr/lockfree_event.cc b/src/core/lib/iomgr/lockfree_event.cc index 62d994a3c6b..58130a34cb5 100644 --- a/src/core/lib/iomgr/lockfree_event.cc +++ b/src/core/lib/iomgr/lockfree_event.cc @@ -23,6 +23,7 @@ #include #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" extern grpc_core::DebugOnlyTraceFlag grpc_polling_trace; @@ -148,10 +149,9 @@ void LockfreeEvent::NotifyOn(grpc_closure* closure) { } // There is already a closure!. This indicates a bug in the code - gpr_log(GPR_ERROR, - "LockfreeEvent::NotifyOn: notify_on called with a previous " - "callback still pending"); - abort(); + Crash( + "LockfreeEvent::NotifyOn: notify_on called with a previous " + "callback still pending"); } } } diff --git a/src/core/lib/iomgr/polling_entity.cc b/src/core/lib/iomgr/polling_entity.cc index 445f26606d0..5df50e1ce41 100644 --- a/src/core/lib/iomgr/polling_entity.cc +++ b/src/core/lib/iomgr/polling_entity.cc @@ -20,9 +20,13 @@ #include "src/core/lib/iomgr/polling_entity.h" +#include "absl/strings/str_format.h" + #include #include +#include "src/core/lib/gprpp/crash.h" + grpc_polling_entity grpc_polling_entity_create_from_pollset_set( grpc_pollset_set* pollset_set) { grpc_polling_entity pollent; @@ -70,8 +74,8 @@ void grpc_polling_entity_add_to_pollset_set(grpc_polling_entity* pollent, GPR_ASSERT(pollent->pollent.pollset_set != nullptr); grpc_pollset_set_add_pollset_set(pss_dst, pollent->pollent.pollset_set); } else { - gpr_log(GPR_ERROR, "Invalid grpc_polling_entity tag '%d'", pollent->tag); - abort(); + grpc_core::Crash( + absl::StrFormat("Invalid grpc_polling_entity tag '%d'", pollent->tag)); } } @@ -90,7 +94,7 @@ void grpc_polling_entity_del_from_pollset_set(grpc_polling_entity* pollent, GPR_ASSERT(pollent->pollent.pollset_set != nullptr); grpc_pollset_set_del_pollset_set(pss_dst, pollent->pollent.pollset_set); } else { - gpr_log(GPR_ERROR, "Invalid grpc_polling_entity tag '%d'", pollent->tag); - abort(); + grpc_core::Crash( + absl::StrFormat("Invalid grpc_polling_entity tag '%d'", pollent->tag)); } } diff --git a/src/core/lib/iomgr/pollset_windows.cc b/src/core/lib/iomgr/pollset_windows.cc index 447e3857812..e4091bfe917 100644 --- a/src/core/lib/iomgr/pollset_windows.cc +++ b/src/core/lib/iomgr/pollset_windows.cc @@ -24,6 +24,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/iomgr_internal.h" diff --git a/src/core/lib/iomgr/resolve_address.cc b/src/core/lib/iomgr/resolve_address.cc index eb040249c36..084fdd96233 100644 --- a/src/core/lib/iomgr/resolve_address.cc +++ b/src/core/lib/iomgr/resolve_address.cc @@ -25,6 +25,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/no_destruct.h" namespace grpc_core { diff --git a/src/core/lib/iomgr/resolve_address_posix.cc b/src/core/lib/iomgr/resolve_address_posix.cc index 9d7f5374c83..ee5f9092b9e 100644 --- a/src/core/lib/iomgr/resolve_address_posix.cc +++ b/src/core/lib/iomgr/resolve_address_posix.cc @@ -32,6 +32,7 @@ #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/block_annotate.h" diff --git a/src/core/lib/iomgr/resolve_address_windows.cc b/src/core/lib/iomgr/resolve_address_windows.cc index 19467f1903f..bb5b78de1c8 100644 --- a/src/core/lib/iomgr/resolve_address_windows.cc +++ b/src/core/lib/iomgr/resolve_address_windows.cc @@ -36,6 +36,7 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/block_annotate.h" diff --git a/src/core/lib/iomgr/sockaddr_utils_posix.cc b/src/core/lib/iomgr/sockaddr_utils_posix.cc index 4fed986316b..f0535f45acf 100644 --- a/src/core/lib/iomgr/sockaddr_utils_posix.cc +++ b/src/core/lib/iomgr/sockaddr_utils_posix.cc @@ -41,6 +41,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/sockaddr.h" uint16_t grpc_htons(uint16_t hostshort) { return htons(hostshort); } diff --git a/src/core/lib/iomgr/socket_mutator.cc b/src/core/lib/iomgr/socket_mutator.cc index d0ba2887d53..789d98bafb3 100644 --- a/src/core/lib/iomgr/socket_mutator.cc +++ b/src/core/lib/iomgr/socket_mutator.cc @@ -26,6 +26,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" void grpc_socket_mutator_init(grpc_socket_mutator* mutator, const grpc_socket_mutator_vtable* vtable) { diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc index eff77511a38..df5d9f05a11 100644 --- a/src/core/lib/iomgr/socket_utils_common_posix.cc +++ b/src/core/lib/iomgr/socket_utils_common_posix.cc @@ -50,6 +50,7 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/strerror.h" #include "src/core/lib/iomgr/sockaddr.h" diff --git a/src/core/lib/iomgr/socket_utils_linux.cc b/src/core/lib/iomgr/socket_utils_linux.cc index 64fd83e0514..2e64c21e0b5 100644 --- a/src/core/lib/iomgr/socket_utils_linux.cc +++ b/src/core/lib/iomgr/socket_utils_linux.cc @@ -27,6 +27,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/socket_utils_posix.h" diff --git a/src/core/lib/iomgr/socket_utils_posix.cc b/src/core/lib/iomgr/socket_utils_posix.cc index c4a9361d3ea..bd81dd76a2c 100644 --- a/src/core/lib/iomgr/socket_utils_posix.cc +++ b/src/core/lib/iomgr/socket_utils_posix.cc @@ -30,6 +30,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/socket_utils_posix.h" #endif diff --git a/src/core/lib/iomgr/socket_utils_windows.cc b/src/core/lib/iomgr/socket_utils_windows.cc index 71b95e915ac..8b0e8f45f7c 100644 --- a/src/core/lib/iomgr/socket_utils_windows.cc +++ b/src/core/lib/iomgr/socket_utils_windows.cc @@ -24,6 +24,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/socket_utils.h" diff --git a/src/core/lib/iomgr/socket_windows.cc b/src/core/lib/iomgr/socket_windows.cc index ba3eb1d0aee..0865f1afd2e 100644 --- a/src/core/lib/iomgr/socket_windows.cc +++ b/src/core/lib/iomgr/socket_windows.cc @@ -33,6 +33,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/iomgr_internal.h" #include "src/core/lib/iomgr/pollset.h" diff --git a/src/core/lib/iomgr/tcp_client_cfstream.cc b/src/core/lib/iomgr/tcp_client_cfstream.cc index 1ea3dc481b2..7be3637ac42 100644 --- a/src/core/lib/iomgr/tcp_client_cfstream.cc +++ b/src/core/lib/iomgr/tcp_client_cfstream.cc @@ -33,6 +33,7 @@ #include #include "src/core/lib/address_utils/sockaddr_utils.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/iomgr/cfstream_handle.h" #include "src/core/lib/iomgr/closure.h" diff --git a/src/core/lib/iomgr/tcp_client_posix.cc b/src/core/lib/iomgr/tcp_client_posix.cc index bc8b1692613..96ccdf298cd 100644 --- a/src/core/lib/iomgr/tcp_client_posix.cc +++ b/src/core/lib/iomgr/tcp_client_posix.cc @@ -36,6 +36,7 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/iomgr_internal.h" diff --git a/src/core/lib/iomgr/tcp_client_windows.cc b/src/core/lib/iomgr/tcp_client_windows.cc index f66f20c3875..ecf1546e71a 100644 --- a/src/core/lib/iomgr/tcp_client_windows.cc +++ b/src/core/lib/iomgr/tcp_client_windows.cc @@ -31,6 +31,7 @@ #include #include "src/core/lib/address_utils/sockaddr_utils.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/sockaddr_windows.h" diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index d6c3b46743f..623534ef0db 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -56,6 +56,7 @@ #include "src/core/lib/experiments/experiments.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/strerror.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/buffer_list.h" @@ -364,7 +365,7 @@ class TcpZerocopySendCtx { // state was CHECK and is_in_write is false. This means that after the // previous sendmsg returned and set is_in_write to false, it did // not update the z-copy change from CHECK to OPEN. - GPR_ASSERT(false && "OMem state error!"); + Crash("OMem state error!"); } } diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc index c881f2479b9..bc227936e31 100644 --- a/src/core/lib/iomgr/tcp_server_posix.cc +++ b/src/core/lib/iomgr/tcp_server_posix.cc @@ -51,6 +51,7 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/strerror.h" #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/src/core/lib/iomgr/tcp_server_utils_posix_common.cc b/src/core/lib/iomgr/tcp_server_utils_posix_common.cc index 2e6c6a335cb..574fd02d0de 100644 --- a/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +++ b/src/core/lib/iomgr/tcp_server_utils_posix_common.cc @@ -37,6 +37,7 @@ #include #include "src/core/lib/address_utils/sockaddr_utils.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/tcp_server_utils_posix.h" diff --git a/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc b/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc index 159bea5e9ae..a04f0a36a08 100644 --- a/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +++ b/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc @@ -36,6 +36,7 @@ #include #include "src/core/lib/address_utils/sockaddr_utils.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/tcp_server_utils_posix.h" diff --git a/src/core/lib/iomgr/tcp_server_windows.cc b/src/core/lib/iomgr/tcp_server_windows.cc index 082ecb79464..6cea16e84e9 100644 --- a/src/core/lib/iomgr/tcp_server_windows.cc +++ b/src/core/lib/iomgr/tcp_server_windows.cc @@ -38,6 +38,7 @@ #include #include "src/core/lib/address_utils/sockaddr_utils.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/pollset_windows.h" #include "src/core/lib/iomgr/resolve_address.h" diff --git a/src/core/lib/iomgr/tcp_windows.cc b/src/core/lib/iomgr/tcp_windows.cc index 215aa1bbc11..42bfa039ef8 100644 --- a/src/core/lib/iomgr/tcp_windows.cc +++ b/src/core/lib/iomgr/tcp_windows.cc @@ -33,6 +33,7 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/sockaddr_windows.h" diff --git a/src/core/lib/iomgr/timer_generic.cc b/src/core/lib/iomgr/timer_generic.cc index 36ff009233a..3282fe17d08 100644 --- a/src/core/lib/iomgr/timer_generic.cc +++ b/src/core/lib/iomgr/timer_generic.cc @@ -23,6 +23,7 @@ #include #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include #include @@ -32,6 +33,7 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/gpr/spinlock.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/time_averaged_stats.h" @@ -130,12 +132,11 @@ static void add_to_ht(grpc_timer* t) { if (p == t) { grpc_closure* c = t->closure; - gpr_log(GPR_ERROR, - "** Duplicate timer (%p) being added. Closure: (%p), created at: " - "(%s:%d), scheduled at: (%s:%d) **", - t, c, c->file_created, c->line_created, c->file_initiated, - c->line_initiated); - abort(); + grpc_core::Crash(absl::StrFormat( + "** Duplicate timer (%p) being added. Closure: (%p), created at: " + "(%s:%d), scheduled at: (%s:%d) **", + t, c, c->file_created, c->line_created, c->file_initiated, + c->line_initiated)); } // Timer not present in the bucket. Insert at head of the list @@ -167,12 +168,11 @@ static void remove_from_ht(grpc_timer* t) { if (!removed) { grpc_closure* c = t->closure; - gpr_log(GPR_ERROR, - "** Removing timer (%p) that is not added to hash table. Closure " - "(%p), created at: (%s:%d), scheduled at: (%s:%d) **", - t, c, c->file_created, c->line_created, c->file_initiated, - c->line_initiated); - abort(); + grpc_core::Crash(absl::StrFormat( + "** Removing timer (%p) that is not added to hash table. Closure " + "(%p), created at: (%s:%d), scheduled at: (%s:%d) **", + t, c, c->file_created, c->line_created, c->file_initiated, + c->line_initiated)); } t->hash_table_next = nullptr; @@ -185,13 +185,12 @@ static void remove_from_ht(grpc_timer* t) { static void validate_non_pending_timer(grpc_timer* t) { if (!t->pending && is_in_ht(t)) { grpc_closure* c = t->closure; - gpr_log(GPR_ERROR, - "** gpr_timer_cancel() called on a non-pending timer (%p) which " - "is in the hash table. Closure: (%p), created at: (%s:%d), " - "scheduled at: (%s:%d) **", - t, c, c->file_created, c->line_created, c->file_initiated, - c->line_initiated); - abort(); + grpc_core::Crash(absl::StrFormat( + "** gpr_timer_cancel() called on a non-pending timer (%p) which " + "is in the hash table. Closure: (%p), created at: (%s:%d), " + "scheduled at: (%s:%d) **", + t, c, c->file_created, c->line_created, c->file_initiated, + c->line_initiated)); } } diff --git a/src/core/lib/iomgr/timer_manager.cc b/src/core/lib/iomgr/timer_manager.cc index 5b7fb54b481..d7d8dfb53dd 100644 --- a/src/core/lib/iomgr/timer_manager.cc +++ b/src/core/lib/iomgr/timer_manager.cc @@ -26,6 +26,7 @@ #include #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/timer.h" diff --git a/src/core/lib/iomgr/unix_sockets_posix.cc b/src/core/lib/iomgr/unix_sockets_posix.cc index ca798e45be2..e182e6adf13 100644 --- a/src/core/lib/iomgr/unix_sockets_posix.cc +++ b/src/core/lib/iomgr/unix_sockets_posix.cc @@ -33,6 +33,7 @@ #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/unix_sockets_posix.h" #include "src/core/lib/transport/error_utils.h" diff --git a/src/core/lib/iomgr/unix_sockets_posix_noop.cc b/src/core/lib/iomgr/unix_sockets_posix_noop.cc index 5e78a9fab97..c683145668a 100644 --- a/src/core/lib/iomgr/unix_sockets_posix_noop.cc +++ b/src/core/lib/iomgr/unix_sockets_posix_noop.cc @@ -26,6 +26,8 @@ #include +#include "src/core/lib/gprpp/crash.h" + void grpc_create_socketpair_if_unix(int /* sv */[2]) { // TODO: Either implement this for the non-Unix socket case or make // sure that it is never called in any such case. Until then, leave an diff --git a/src/core/lib/iomgr/wakeup_fd_eventfd.cc b/src/core/lib/iomgr/wakeup_fd_eventfd.cc index e4f31f88d30..38760c2cfb4 100644 --- a/src/core/lib/iomgr/wakeup_fd_eventfd.cc +++ b/src/core/lib/iomgr/wakeup_fd_eventfd.cc @@ -28,6 +28,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/strerror.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" diff --git a/src/core/lib/iomgr/wakeup_fd_pipe.cc b/src/core/lib/iomgr/wakeup_fd_pipe.cc index c034a4e14ac..a3936608cc5 100644 --- a/src/core/lib/iomgr/wakeup_fd_pipe.cc +++ b/src/core/lib/iomgr/wakeup_fd_pipe.cc @@ -28,6 +28,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/strerror.h" #include "src/core/lib/iomgr/socket_utils_posix.h" #include "src/core/lib/iomgr/wakeup_fd_pipe.h" diff --git a/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc b/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc index 6cb6d93e580..7c50a81f609 100644 --- a/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +++ b/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc @@ -22,6 +22,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/credentials/alts/check_gcp_environment.h" bool grpc_alts_is_running_on_gcp() { diff --git a/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc b/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc index c9e492fe628..b034ccaac79 100644 --- a/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +++ b/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc @@ -29,6 +29,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/credentials/alts/check_gcp_environment.h" namespace grpc_core { diff --git a/src/core/lib/security/credentials/credentials.cc b/src/core/lib/security/credentials/credentials.cc index d977265a725..07fbbbeb7f7 100644 --- a/src/core/lib/security/credentials/credentials.cc +++ b/src/core/lib/security/credentials/credentials.cc @@ -28,6 +28,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/surface/api_trace.h" diff --git a/src/core/lib/security/credentials/credentials.h b/src/core/lib/security/credentials/credentials.h index 750e3841d46..cd7c6f45298 100644 --- a/src/core/lib/security/credentials/credentials.h +++ b/src/core/lib/security/credentials/credentials.h @@ -35,6 +35,7 @@ #include #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/unique_type_name.h" diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc index 3bc26a8b983..a63f96bfc91 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc @@ -729,7 +729,7 @@ grpc_access_token_credentials::grpc_access_token_credentials( absl::StrCat("Bearer ", access_token))) {} std::string grpc_access_token_credentials::debug_string() { - return absl::StrFormat("AccessTokenCredentials{Token:present}"); + return "AccessTokenCredentials{Token:present}"; } grpc_call_credentials* grpc_access_token_credentials_create( diff --git a/src/core/lib/security/security_connector/fake/fake_security_connector.cc b/src/core/lib/security/security_connector/fake/fake_security_connector.cc index b3d9438a877..8da210f144c 100644 --- a/src/core/lib/security/security_connector/fake/fake_security_connector.cc +++ b/src/core/lib/security/security_connector/fake/fake_security_connector.cc @@ -28,6 +28,7 @@ #include "absl/status/status.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" @@ -40,6 +41,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -123,16 +125,13 @@ class grpc_fake_channel_security_connector final &fake_security_target_name_override_hostname, &fake_security_target_name_override_ignored_port); if (authority_hostname != fake_security_target_name_override_hostname) { - gpr_log(GPR_ERROR, - "Authority (host) '%s' != Fake Security Target override '%s'", - host.data(), - fake_security_target_name_override_hostname.data()); - abort(); + grpc_core::Crash(absl::StrFormat( + "Authority (host) '%s' != Fake Security Target override '%s'", + host.data(), fake_security_target_name_override_hostname.data())); } } else if (authority_hostname != target_hostname) { - gpr_log(GPR_ERROR, "Authority (host) '%s' != Target '%s'", host.data(), - target_); - abort(); + grpc_core::Crash(absl::StrFormat("Authority (host) '%s' != Target '%s'", + host.data(), target_)); } return grpc_core::ImmediateOkStatus(); } diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 05faba4f29d..f2f783e5204 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -71,6 +71,7 @@ #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/bitset.h" #include "src/core/lib/gprpp/cpp_impl_of.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -728,8 +729,7 @@ void FilterStackCall::SetCompletionQueue(grpc_completion_queue* cq) { GPR_ASSERT(cq); if (grpc_polling_entity_pollset_set(&pollent_) != nullptr) { - gpr_log(GPR_ERROR, "A pollset_set is already registered for this call."); - abort(); + Crash("A pollset_set is already registered for this call."); } cq_ = cq; GRPC_CQ_INTERNAL_REF(cq, "bind"); diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index 61fb6cee98d..985342265f0 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -45,6 +45,7 @@ #include "src/core/lib/channel/channelz.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/mpscq.h" #include "src/core/lib/gprpp/status_helper.h" @@ -341,7 +342,7 @@ class Server::AllocatingRequestMatcherBase : public RequestMatcherInterface { void RequestCallWithPossiblePublish(size_t /*request_queue_index*/, RequestedCall* /*call*/) final { - GPR_ASSERT(false); + Crash("unreachable"); } Server* server() const override { return server_; } diff --git a/src/core/tsi/alts/frame_protector/alts_frame_protector.cc b/src/core/tsi/alts/frame_protector/alts_frame_protector.cc index bb62a5eb83a..7c9b3109076 100644 --- a/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +++ b/src/core/tsi/alts/frame_protector/alts_frame_protector.cc @@ -29,6 +29,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/tsi/alts/crypt/gsec.h" #include "src/core/tsi/alts/frame_protector/alts_crypter.h" #include "src/core/tsi/alts/frame_protector/frame_handler.h" diff --git a/src/core/tsi/alts/frame_protector/frame_handler.cc b/src/core/tsi/alts/frame_protector/frame_handler.cc index 5fe8bb8c864..41b172ad2d2 100644 --- a/src/core/tsi/alts/frame_protector/frame_handler.cc +++ b/src/core/tsi/alts/frame_protector/frame_handler.cc @@ -29,6 +29,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" // Use little endian to interpret a string of bytes as uint32_t. diff --git a/src/core/tsi/alts/handshaker/alts_handshaker_client.cc b/src/core/tsi/alts/handshaker/alts_handshaker_client.cc index 9e6fecd7e4c..aa74a0012eb 100644 --- a/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +++ b/src/core/tsi/alts/handshaker/alts_handshaker_client.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/surface/call.h" diff --git a/src/core/tsi/alts/handshaker/alts_shared_resource.cc b/src/core/tsi/alts/handshaker/alts_shared_resource.cc index 53d7decf419..289078ed978 100644 --- a/src/core/tsi/alts/handshaker/alts_shared_resource.cc +++ b/src/core/tsi/alts/handshaker/alts_shared_resource.cc @@ -23,6 +23,7 @@ #include #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/tsi/alts/handshaker/alts_handshaker_client.h" static alts_shared_resource_dedicated g_alts_resource_dedicated; diff --git a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc index e2800dc4c72..2f1442d02fa 100644 --- a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +++ b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc @@ -33,6 +33,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/thd.h" diff --git a/src/core/tsi/alts/handshaker/transport_security_common_api.h b/src/core/tsi/alts/handshaker/transport_security_common_api.h index 5da57fb9a45..b355d30e172 100644 --- a/src/core/tsi/alts/handshaker/transport_security_common_api.h +++ b/src/core/tsi/alts/handshaker/transport_security_common_api.h @@ -26,6 +26,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/gcp/transport_security_common.upb.h" // C struct coresponding to protobuf message RpcProtocolVersions.Version diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc index 0e517e19248..8f1329b8d3b 100644 --- a/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc @@ -25,6 +25,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h" diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc index ae2856090d6..25c09f6366b 100644 --- a/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc +++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc @@ -23,6 +23,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h" diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc index a0756853949..326eca1f0da 100644 --- a/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc @@ -26,6 +26,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc index e8f302b91cf..dc12a5133b5 100644 --- a/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc @@ -26,6 +26,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/tsi/alts/frame_protector/alts_counter.h" struct alts_iovec_record_protocol { diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc index c9757152500..c32e6b53a85 100644 --- a/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc @@ -26,6 +26,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/tsi/alts/crypt/gsec.h" diff --git a/src/core/tsi/fake_transport_security.cc b/src/core/tsi/fake_transport_security.cc index 4c81572009f..b1371dcfc75 100644 --- a/src/core/tsi/fake_transport_security.cc +++ b/src/core/tsi/fake_transport_security.cc @@ -27,6 +27,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/tsi/transport_security_grpc.h" diff --git a/src/core/tsi/local_transport_security.cc b/src/core/tsi/local_transport_security.cc index b93edcb7079..6b3668c5282 100644 --- a/src/core/tsi/local_transport_security.cc +++ b/src/core/tsi/local_transport_security.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/tsi/transport_security_grpc.h" diff --git a/src/core/tsi/ssl/key_logging/ssl_key_logging.cc b/src/core/tsi/ssl/key_logging/ssl_key_logging.cc index dc08684ef78..51499bbfe2b 100644 --- a/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +++ b/src/core/tsi/ssl/key_logging/ssl_key_logging.cc @@ -20,6 +20,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/src/core/tsi/ssl/session_cache/ssl_session_cache.cc b/src/core/tsi/ssl/session_cache/ssl_session_cache.cc index 456f6f2fbcf..5427c989b2f 100644 --- a/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +++ b/src/core/tsi/ssl/session_cache/ssl_session_cache.cc @@ -23,6 +23,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/tsi/ssl/session_cache/ssl_session.h" diff --git a/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc b/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc index 95befc80b7d..487608d7dca 100644 --- a/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +++ b/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc @@ -20,6 +20,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/tsi/ssl/session_cache/ssl_session.h" #ifndef OPENSSL_IS_BORINGSSL diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc index 8ffcecd8de1..ec75c5ca876 100644 --- a/src/core/tsi/ssl_transport_security.cc +++ b/src/core/tsi/ssl_transport_security.cc @@ -56,6 +56,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/tsi/ssl/key_logging/ssl_key_logging.h" #include "src/core/tsi/ssl/session_cache/ssl_session_cache.h" #include "src/core/tsi/ssl_transport_security_utils.h" diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index e13d363a740..b986946e64d 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -24,6 +24,8 @@ #include #include +#include "absl/strings/str_format.h" + #include #include #include @@ -39,6 +41,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + namespace grpc { class Channel; @@ -141,9 +145,8 @@ void ClientContext::set_compression_algorithm( compression_algorithm_ = algorithm; const char* algorithm_name = nullptr; if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) { - gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.", - algorithm); - abort(); + grpc_core::Crash(absl::StrFormat( + "Name for compression algorithm '%d' unknown.", algorithm)); } GPR_ASSERT(algorithm_name != nullptr); AddMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name); diff --git a/src/cpp/client/client_interceptor.cc b/src/cpp/client/client_interceptor.cc index f8c85330434..93181b825cb 100644 --- a/src/cpp/client/client_interceptor.cc +++ b/src/cpp/client/client_interceptor.cc @@ -16,9 +16,10 @@ // // -#include #include +#include "src/core/lib/gprpp/crash.h" + namespace grpc { namespace internal { @@ -30,9 +31,9 @@ namespace experimental { void RegisterGlobalClientInterceptorFactory( ClientInterceptorFactoryInterface* factory) { if (internal::g_global_client_interceptor_factory != nullptr) { - GPR_ASSERT(false && - "It is illegal to call RegisterGlobalClientInterceptorFactory " - "multiple times."); + grpc_core::Crash( + "It is illegal to call RegisterGlobalClientInterceptorFactory " + "multiple times."); } internal::g_global_client_interceptor_factory = factory; } diff --git a/src/cpp/ext/gcp/BUILD b/src/cpp/ext/gcp/BUILD index a25f621b385..5be21b84849 100644 --- a/src/cpp/ext/gcp/BUILD +++ b/src/cpp/ext/gcp/BUILD @@ -103,8 +103,8 @@ grpc_cc_library( "absl/strings", "absl/strings:str_format", "absl/types:optional", + "googleapis_logging_cc_proto", "googleapis_logging_grpc_service", - "googleapis_logging_proto", "protobuf_headers", ], language = "c++", diff --git a/src/cpp/server/load_reporter/get_cpu_stats_unsupported.cc b/src/cpp/server/load_reporter/get_cpu_stats_unsupported.cc index dd6417bf88b..83734b9c9d7 100644 --- a/src/cpp/server/load_reporter/get_cpu_stats_unsupported.cc +++ b/src/cpp/server/load_reporter/get_cpu_stats_unsupported.cc @@ -22,6 +22,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/cpp/server/load_reporter/get_cpu_stats.h" namespace grpc { diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 6f3c9fd9eef..ec5d0e2ea6e 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -27,6 +27,7 @@ #include #include +#include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include @@ -52,6 +53,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/resource_quota/arena.h" @@ -132,7 +134,7 @@ class ServerContextBase::CompletionOp final // RPC. This should set hijacking state for each of the ops. void SetHijackingState() override { // Servers don't allow hijacking - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); } // Should be called after interceptors are done running @@ -365,9 +367,8 @@ void ServerContextBase::set_compression_algorithm( compression_algorithm_ = algorithm; const char* algorithm_name = nullptr; if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) { - gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.", - algorithm); - abort(); + grpc_core::Crash(absl::StrFormat( + "Name for compression algorithm '%d' unknown.", algorithm)); } GPR_ASSERT(algorithm_name != nullptr); AddInitialMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name); diff --git a/src/cpp/thread_manager/thread_manager.cc b/src/cpp/thread_manager/thread_manager.cc index f518482a79e..2675f32af62 100644 --- a/src/cpp/thread_manager/thread_manager.cc +++ b/src/cpp/thread_manager/thread_manager.cc @@ -18,12 +18,13 @@ #include "src/cpp/thread_manager/thread_manager.h" -#include - #include +#include "absl/strings/str_format.h" + #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/resource_quota/resource_quota.h" @@ -126,11 +127,10 @@ void ThreadManager::CleanupCompletedThreads() { void ThreadManager::Initialize() { if (!thread_quota_->Reserve(min_pollers_)) { - gpr_log(GPR_ERROR, - "No thread quota available to even create the minimum required " - "polling threads (i.e %d). Unable to start the thread manager", - min_pollers_); - abort(); + grpc_core::Crash(absl::StrFormat( + "No thread quota available to even create the minimum required " + "polling threads (i.e %d). Unable to start the thread manager", + min_pollers_)); } { diff --git a/src/objective-c/tests/CronetTests/CoreCronetEnd2EndTests.mm b/src/objective-c/tests/CronetTests/CoreCronetEnd2EndTests.mm index c9387089d21..b34aac58fcf 100644 --- a/src/objective-c/tests/CronetTests/CoreCronetEnd2EndTests.mm +++ b/src/objective-c/tests/CronetTests/CoreCronetEnd2EndTests.mm @@ -35,6 +35,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/string.h" diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 43842c1ccf9..6e05ae8173f 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -532,6 +532,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/gpr/tmpfile_posix.cc', 'src/core/lib/gpr/tmpfile_windows.cc', 'src/core/lib/gpr/wrap_memcpy.cc', + 'src/core/lib/gprpp/crash.cc', 'src/core/lib/gprpp/env_linux.cc', 'src/core/lib/gprpp/env_posix.cc', 'src/core/lib/gprpp/env_windows.cc', diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 58d7a6b2d41..a2fcb9d8a40 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -256,6 +256,7 @@ gpr_log_message_type gpr_log_message_import; gpr_set_log_verbosity_type gpr_set_log_verbosity_import; gpr_log_verbosity_init_type gpr_log_verbosity_init_import; gpr_set_log_function_type gpr_set_log_function_import; +gpr_assertion_failed_type gpr_assertion_failed_import; gpr_format_message_type gpr_format_message_import; gpr_strdup_type gpr_strdup_import; gpr_asprintf_type gpr_asprintf_import; @@ -541,6 +542,7 @@ void grpc_rb_load_imports(HMODULE library) { gpr_set_log_verbosity_import = (gpr_set_log_verbosity_type) GetProcAddress(library, "gpr_set_log_verbosity"); gpr_log_verbosity_init_import = (gpr_log_verbosity_init_type) GetProcAddress(library, "gpr_log_verbosity_init"); gpr_set_log_function_import = (gpr_set_log_function_type) GetProcAddress(library, "gpr_set_log_function"); + gpr_assertion_failed_import = (gpr_assertion_failed_type) GetProcAddress(library, "gpr_assertion_failed"); gpr_format_message_import = (gpr_format_message_type) GetProcAddress(library, "gpr_format_message"); gpr_strdup_import = (gpr_strdup_type) GetProcAddress(library, "gpr_strdup"); gpr_asprintf_import = (gpr_asprintf_type) GetProcAddress(library, "gpr_asprintf"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index e7c46baa812..e9ec9104656 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -743,6 +743,9 @@ extern gpr_log_verbosity_init_type gpr_log_verbosity_init_import; typedef void(*gpr_set_log_function_type)(gpr_log_func func); extern gpr_set_log_function_type gpr_set_log_function_import; #define gpr_set_log_function gpr_set_log_function_import +typedef void(*gpr_assertion_failed_type)(const char* filename, int line, const char* message); +extern gpr_assertion_failed_type gpr_assertion_failed_import; +#define gpr_assertion_failed gpr_assertion_failed_import typedef char*(*gpr_format_message_type)(int messageid); extern gpr_format_message_type gpr_format_message_import; #define gpr_format_message gpr_format_message_import diff --git a/templates/test/core/end2end/end2end_defs.include b/templates/test/core/end2end/end2end_defs.include index 2e84c48b7e1..9bbe9aac27c 100644 --- a/templates/test/core/end2end/end2end_defs.include +++ b/templates/test/core/end2end/end2end_defs.include @@ -25,8 +25,11 @@ #include #include +#include "absl/strings/str_format.h" + #include +#include "src/core/lib/gprpp/crash.h" static bool g_pre_init_called = false; @@ -64,7 +67,6 @@ void grpc_end2end_tests(int argc, char **argv, continue; } % endfor - gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]); - abort(); + grpc_core::Crash(absl::StrFormat( "not a test: '%s'", argv[i])); } } diff --git a/test/core/address_utils/parse_address_with_named_scope_id_test.cc b/test/core/address_utils/parse_address_with_named_scope_id_test.cc index 7faa8d497ee..8ed013b7d3a 100644 --- a/test/core/address_utils/parse_address_with_named_scope_id_test.cc +++ b/test/core/address_utils/parse_address_with_named_scope_id_test.cc @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -38,6 +37,7 @@ #include #include "src/core/lib/address_utils/parse_address.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/resolved_address.h" @@ -89,10 +89,9 @@ struct sockaddr_in6 resolve_with_gettaddrinfo(const char* uri_text) { struct addrinfo* result; int res = getaddrinfo(host.c_str(), port.c_str(), &hints, &result); if (res != 0) { - gpr_log(GPR_ERROR, - "getaddrinfo failed to resolve host:%s port:%s. Error: %d.", - host.c_str(), port.c_str(), res); - abort(); + grpc_core::Crash(absl::StrFormat( + "getaddrinfo failed to resolve host:%s port:%s. Error: %d.", + host.c_str(), port.c_str(), res)); } size_t num_addrs_from_getaddrinfo = 0; for (struct addrinfo* resp = result; resp != nullptr; resp = resp->ai_next) { diff --git a/test/core/bad_connection/close_fd_test.cc b/test/core/bad_connection/close_fd_test.cc index f5724bfd99c..a490ca06ef7 100644 --- a/test/core/bad_connection/close_fd_test.cc +++ b/test/core/bad_connection/close_fd_test.cc @@ -22,9 +22,9 @@ // // #include -#include #include "absl/status/statusor.h" +#include "absl/strings/str_format.h" #include #include @@ -53,6 +53,7 @@ #include #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/completion_queue.h" @@ -203,8 +204,7 @@ static const char* fd_type_str(fd_type fdtype) { } else if (fdtype == SERVER_FD) { return "server"; } else { - gpr_log(GPR_ERROR, "Unexpected fd_type %d", fdtype); - abort(); + grpc_core::Crash(absl::StrFormat("Unexpected fd_type %d", fdtype)); } } diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD index d4babbf29f7..f3b3ea0cb6f 100644 --- a/test/core/end2end/BUILD +++ b/test/core/end2end/BUILD @@ -202,6 +202,7 @@ grpc_cc_test( grpc_cc_test( name = "inproc_callback_test", srcs = ["inproc_callback_test.cc"], + external_deps = ["absl/strings:str_format"], language = "C++", uses_event_engine = False, uses_polling = False, diff --git a/test/core/end2end/cq_verifier.cc b/test/core/end2end/cq_verifier.cc index c4904318241..af6a90b59cd 100644 --- a/test/core/end2end/cq_verifier.cc +++ b/test/core/end2end/cq_verifier.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -40,6 +39,7 @@ #include #include "src/core/lib/compression/message_compress.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/match.h" #include "src/core/lib/surface/event_string.h" @@ -189,17 +189,15 @@ std::string CqVerifier::ToString() const { } void CqVerifier::FailNoEventReceived(const SourceLocation& location) const { - gpr_log(GPR_ERROR, "[%s:%d] no event received, but expected:%s", - location.file(), location.line(), ToString().c_str()); - abort(); + Crash(absl::StrFormat("[%s:%d] no event received, but expected:%s", + location.file(), location.line(), ToString().c_str())); } void CqVerifier::FailUnexpectedEvent(grpc_event* ev, const SourceLocation& location) const { gpr_log(GPR_ERROR, "[%s:%d] cq returned unexpected event: %s", location.file(), location.line(), grpc_event_string(ev).c_str()); - gpr_log(GPR_ERROR, "expected tags:\n%s", ToString().c_str()); - abort(); + Crash(absl::StrFormat("expected tags:\n%s", ToString().c_str())); } void CqVerifier::Verify(Duration timeout, SourceLocation location) { diff --git a/test/core/end2end/end2end_tests.cc b/test/core/end2end/end2end_tests.cc index 4865e2182f2..d95b7abf6e1 100644 --- a/test/core/end2end/end2end_tests.cc +++ b/test/core/end2end/end2end_tests.cc @@ -24,8 +24,11 @@ #include #include +#include "absl/strings/str_format.h" + #include +#include "src/core/lib/gprpp/crash.h" static bool g_pre_init_called = false; @@ -791,7 +794,6 @@ void grpc_end2end_tests(int argc, char **argv, write_buffering_at_end(config); continue; } - gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]); - abort(); + grpc_core::Crash(absl::StrFormat( "not a test: '%s'", argv[i])); } } diff --git a/test/core/end2end/fixtures/proxy.cc b/test/core/end2end/fixtures/proxy.cc index 2926dc2c4f4..c1b7da1a446 100644 --- a/test/core/end2end/fixtures/proxy.cc +++ b/test/core/end2end/fixtures/proxy.cc @@ -18,7 +18,6 @@ #include "test/core/end2end/fixtures/proxy.h" -#include #include #include @@ -34,6 +33,7 @@ #include #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/surface/call.h" @@ -454,8 +454,7 @@ static void thread_main(void* arg) { proxy->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); switch (ev.type) { case GRPC_QUEUE_TIMEOUT: - gpr_log(GPR_ERROR, "Should never reach here"); - abort(); + grpc_core::Crash("Should never reach here"); case GRPC_QUEUE_SHUTDOWN: return; case GRPC_OP_COMPLETE: diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc index f00e3347489..4bd28df4f60 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/end2end/fuzzers/client_fuzzer.cc @@ -23,6 +23,7 @@ #include #include "absl/status/statusor.h" +#include "absl/strings/str_format.h" #include #include @@ -35,6 +36,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args_preconditioning.h" #include "src/core/lib/config/core_configuration.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/exec_ctx.h" @@ -156,11 +158,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); if (ev.type != GRPC_OP_COMPLETE) { - gpr_log(GPR_ERROR, - "[%d/%d requested calls] Unexpected event type (expected " - "COMPLETE): %s", - i, requested_calls, grpc_event_string(&ev).c_str()); - abort(); + grpc_core::Crash(absl::StrFormat( + "[%d/%d requested calls] Unexpected event type (expected " + "COMPLETE): %s", + i, requested_calls, grpc_event_string(&ev).c_str())); } } grpc_completion_queue_shutdown(cq); @@ -168,9 +169,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); if (ev.type != GRPC_QUEUE_SHUTDOWN) { - gpr_log(GPR_ERROR, "Unexpected event type (expected SHUTDOWN): %s", - grpc_event_string(&ev).c_str()); - abort(); + grpc_core::Crash( + absl::StrFormat("Unexpected event type (expected SHUTDOWN): %s", + grpc_event_string(&ev).c_str())); } } grpc_call_unref(call); diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc index 09de6b439b9..459d52e56d7 100644 --- a/test/core/end2end/h2_ssl_cert_test.cc +++ b/test/core/end2end/h2_ssl_cert_test.cc @@ -29,6 +29,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/security_connector/ssl_utils_config.h" diff --git a/test/core/end2end/inproc_callback_test.cc b/test/core/end2end/inproc_callback_test.cc index c7b2566cc45..9e159a45b0d 100644 --- a/test/core/end2end/inproc_callback_test.cc +++ b/test/core/end2end/inproc_callback_test.cc @@ -19,6 +19,8 @@ #include #include +#include "absl/strings/str_format.h" + #include #include #include @@ -29,6 +31,7 @@ #include #include "src/core/ext/transport/inproc/inproc_transport.h" +#include "src/core/lib/gprpp/crash.h" #include "test/core/end2end/end2end_tests.h" #include "test/core/util/test_config.h" @@ -147,15 +150,15 @@ static void verify_tags(gpr_timespec deadline) { if (tags_valid[i]) { gpr_log(GPR_DEBUG, "Verifying tag %d", static_cast(i)); if (tags[i] != tags_expected[i]) { - gpr_log(GPR_ERROR, "Got wrong result (%d instead of %d) for tag %d", - tags[i], tags_expected[i], static_cast(i)); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat( + "Got wrong result (%d instead of %d) for tag %d", tags[i], + tags_expected[i], static_cast(i))); } tags_valid[i] = false; tags_needed[i] = false; } else if (done) { - gpr_log(GPR_ERROR, "Didn't get tag %d", static_cast(i)); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Didn't get tag %d", static_cast(i))); } } } @@ -169,9 +172,9 @@ static void verify_tags(gpr_timespec deadline) { if (done) { for (size_t i = 0; i < kAvailableTags; i++) { if (tags_valid[i]) { - gpr_log(GPR_ERROR, "Got unexpected tag %d and result %d", - static_cast(i), tags[i]); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Got unexpected tag %d and result %d", + static_cast(i), tags[i])); } tags_valid[i] = false; } diff --git a/test/core/end2end/tests/load_reporting_hook.cc b/test/core/end2end/tests/load_reporting_hook.cc index d05debc0e9b..b3250ef2af8 100644 --- a/test/core/end2end/tests/load_reporting_hook.cc +++ b/test/core/end2end/tests/load_reporting_hook.cc @@ -28,6 +28,7 @@ #include "src/core/ext/filters/load_reporting/server_load_reporting_filter.h" #include "src/core/ext/filters/load_reporting/server_load_reporting_plugin.h" #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gprpp/crash.h" #include "test/core/end2end/cq_verifier.h" #include "test/core/end2end/end2end_tests.h" diff --git a/test/core/end2end/tests/resource_quota_server.cc b/test/core/end2end/tests/resource_quota_server.cc index e400109a48d..0196ab9ebc1 100644 --- a/test/core/end2end/tests/resource_quota_server.cc +++ b/test/core/end2end/tests/resource_quota_server.cc @@ -21,6 +21,8 @@ #include #include +#include "absl/strings/str_format.h" + #include #include #include @@ -30,6 +32,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/end2end/end2end_tests.h" #include "test/core/util/test_config.h" @@ -260,8 +263,8 @@ void resource_quota_server(grpc_end2end_test_config config) { case GRPC_STATUS_OK: break; default: - gpr_log(GPR_ERROR, "Unexpected status code: %d", status[call_id]); - abort(); + grpc_core::Crash( + absl::StrFormat("Unexpected status code: %d", status[call_id])); } GPR_ASSERT(pending_client_calls > 0); diff --git a/test/core/event_engine/forkable_test.cc b/test/core/event_engine/forkable_test.cc index c832eebe0e2..386a8760499 100644 --- a/test/core/event_engine/forkable_test.cc +++ b/test/core/event_engine/forkable_test.cc @@ -32,6 +32,7 @@ int main(int /* argc */, char** /* argv */) { return 0; } #include #include "src/core/lib/event_engine/forkable.h" +#include "src/core/lib/gprpp/crash.h" namespace { using ::grpc_event_engine::experimental::Forkable; diff --git a/test/core/event_engine/posix/event_poller_posix_test.cc b/test/core/event_engine/posix/event_poller_posix_test.cc index cff31c7fe11..ecbf2105eac 100644 --- a/test/core/event_engine/posix/event_poller_posix_test.cc +++ b/test/core/event_engine/posix/event_poller_posix_test.cc @@ -25,6 +25,7 @@ #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/strings/str_split.h" #include "absl/strings/string_view.h" #include "gtest/gtest.h" @@ -63,6 +64,7 @@ #include "src/core/lib/event_engine/posix_engine/event_poller_posix_default.h" #include "src/core/lib/event_engine/posix_engine/posix_engine.h" #include "src/core/lib/event_engine/posix_engine/posix_engine_closure.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/dual_ref_counted.h" #include "src/core/lib/gprpp/global_config.h" #include "src/core/lib/gprpp/notification.h" @@ -355,8 +357,8 @@ void ClientStart(client* cl, int port) { abort(); } } else { - gpr_log(GPR_ERROR, "Failed to connect to the server (errno=%d)", errno); - abort(); + grpc_core::Crash( + absl::StrFormat("Failed to connect to the server (errno=%d)", errno)); } } diff --git a/test/core/event_engine/posix/posix_engine_test_utils.cc b/test/core/event_engine/posix/posix_engine_test_utils.cc index 06bee49753e..fabceaf167c 100644 --- a/test/core/event_engine/posix/posix_engine_test_utils.cc +++ b/test/core/event_engine/posix/posix_engine_test_utils.cc @@ -20,8 +20,12 @@ #include #include +#include "absl/strings/str_format.h" + #include +#include "src/core/lib/gprpp/crash.h" + namespace grpc_event_engine { namespace experimental { @@ -53,8 +57,8 @@ int ConnectToServerOrDie(const ResolvedAddress& server_address) { abort(); } } else { - gpr_log(GPR_ERROR, "Failed to connect to the server (errno=%d)", errno); - abort(); + grpc_core::Crash( + absl::StrFormat("Failed to connect to the server (errno=%d)", errno)); } } return client_fd; diff --git a/test/core/event_engine/posix/posix_event_engine_connect_test.cc b/test/core/event_engine/posix/posix_event_engine_connect_test.cc index eb53775af22..5497569eeb5 100644 --- a/test/core/event_engine/posix/posix_event_engine_connect_test.cc +++ b/test/core/event_engine/posix/posix_event_engine_connect_test.cc @@ -32,6 +32,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "gtest/gtest.h" #include @@ -42,6 +43,7 @@ #include "src/core/lib/event_engine/channel_args_endpoint_config.h" #include "src/core/lib/event_engine/posix_engine/posix_engine.h" #include "src/core/lib/event_engine/tcp_socket_utils.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/notification.h" #include "src/core/lib/resource_quota/memory_quota.h" #include "src/core/lib/resource_quota/resource_quota.h" @@ -71,33 +73,29 @@ std::vector CreateConnectedSockets( std::vector ret_sockets; // Creating a new socket file descriptor. if ((server_socket = socket(AF_INET6, SOCK_STREAM, 0)) <= 0) { - gpr_log(GPR_ERROR, "Error creating socket: %s", std::strerror(errno)); - abort(); + grpc_core::Crash( + absl::StrFormat("Error creating socket: %s", std::strerror(errno))); } // MacOS builds fail if SO_REUSEADDR and SO_REUSEPORT are set in the same // setsockopt syscall. So they are set separately one after the other. if (setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt))) { - gpr_log(GPR_ERROR, "Error setsockopt(SO_REUSEADDR): %s", - std::strerror(errno)); - abort(); + grpc_core::Crash(absl::StrFormat("Error setsockopt(SO_REUSEADDR): %s", + std::strerror(errno))); } if (setsockopt(server_socket, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt))) { - gpr_log(GPR_ERROR, "Error setsockopt(SO_REUSEPORT): %s", - std::strerror(errno)); - abort(); + grpc_core::Crash(absl::StrFormat("Error setsockopt(SO_REUSEPORT): %s", + std::strerror(errno))); } // Bind the new socket to server address. if (bind(server_socket, resolved_addr.address(), resolved_addr.size()) < 0) { - gpr_log(GPR_ERROR, "Error bind: %s", std::strerror(errno)); - abort(); + grpc_core::Crash(absl::StrFormat("Error bind: %s", std::strerror(errno))); } // Set the new socket to listen for one active connection at a time. // accept() is intentionally not called on the socket. This allows the // connection queue to build up. if (listen(server_socket, 1) < 0) { - gpr_log(GPR_ERROR, "Error listen: %s", std::strerror(errno)); - abort(); + grpc_core::Crash(absl::StrFormat("Error listen: %s", std::strerror(errno))); } ret_sockets.push_back(server_socket); // Create and connect client sockets until the connection attempt times out. @@ -133,8 +131,8 @@ std::vector CreateConnectedSockets( return ret_sockets; } } else { - gpr_log(GPR_ERROR, "Failed to connect to the server (errno=%d)", errno); - abort(); + grpc_core::Crash(absl::StrFormat( + "Failed to connect to the server (errno=%d)", errno)); } } ret_sockets.push_back(client_socket); diff --git a/test/core/event_engine/test_suite/oracle_event_engine_posix.cc b/test/core/event_engine/test_suite/oracle_event_engine_posix.cc index d603a4fa6c4..422af16cfaa 100644 --- a/test/core/event_engine/test_suite/oracle_event_engine_posix.cc +++ b/test/core/event_engine/test_suite/oracle_event_engine_posix.cc @@ -15,7 +15,6 @@ #include "test/core/event_engine/test_suite/oracle_event_engine_posix.h" #include -#include #include #include @@ -26,6 +25,7 @@ #include "absl/status/status.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/time/clock.h" #include "absl/time/time.h" @@ -34,6 +34,7 @@ #include #include "src/core/lib/address_utils/sockaddr_utils.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/strerror.h" #include "src/core/lib/iomgr/resolved_address.h" @@ -300,9 +301,8 @@ PosixOracleListener::PosixOracleListener( on_shutdown_(std::move(on_shutdown)), memory_allocator_factory_(std::move(memory_allocator_factory)) { if (pipe(pipefd_) == -1) { - gpr_log(GPR_ERROR, "Error creating pipe: %s", - grpc_core::StrError(errno).c_str()); - abort(); + grpc_core::Crash(absl::StrFormat("Error creating pipe: %s", + grpc_core::StrError(errno).c_str())); } } diff --git a/test/core/event_engine/test_suite/oracle_event_engine_posix.h b/test/core/event_engine/test_suite/oracle_event_engine_posix.h index bfad0b3cbc9..0dfb67af925 100644 --- a/test/core/event_engine/test_suite/oracle_event_engine_posix.h +++ b/test/core/event_engine/test_suite/oracle_event_engine_posix.h @@ -29,8 +29,8 @@ #include #include #include -#include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/notification.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/thd.h" @@ -50,10 +50,10 @@ class PosixOracleEndpoint : public EventEngine::Endpoint { SliceBuffer* data, const WriteArgs* args) override; void Shutdown(); EventEngine::ResolvedAddress& GetPeerAddress() const override { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } EventEngine::ResolvedAddress& GetLocalAddress() const override { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } private: @@ -168,29 +168,27 @@ class PosixOracleEventEngine final : public EventEngine { EventEngine::Duration timeout) override; bool CancelConnect(ConnectionHandle /*handle*/) override { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } bool IsWorkerThread() override { return false; }; std::unique_ptr GetDNSResolver( const DNSResolver::ResolverOptions& /*options*/) override { - GPR_ASSERT(false && "unimplemented"); - } - void Run(Closure* /*closure*/) override { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } + void Run(Closure* /*closure*/) override { grpc_core::Crash("unimplemented"); } void Run(absl::AnyInvocable /*closure*/) override { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } TaskHandle RunAfter(EventEngine::Duration /*duration*/, Closure* /*closure*/) override { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } TaskHandle RunAfter(EventEngine::Duration /*duration*/, absl::AnyInvocable /*closure*/) override { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } bool Cancel(TaskHandle /*handle*/) override { - GPR_ASSERT(false && "unimplemented"); + grpc_core::Crash("unimplemented"); } }; diff --git a/test/core/gpr/log_test.cc b/test/core/gpr/log_test.cc index c5bcdd72a4a..4879fd76d53 100644 --- a/test/core/gpr/log_test.cc +++ b/test/core/gpr/log_test.cc @@ -22,6 +22,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" static bool log_func_reached = false; @@ -37,7 +38,7 @@ static void test_should_log(gpr_log_func_args* /*args*/) { } static void test_should_not_log(gpr_log_func_args* /*args*/) { - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); } #define test_log_function_reached(SEVERITY) \ diff --git a/test/core/gprpp/single_set_ptr_test.cc b/test/core/gprpp/single_set_ptr_test.cc index 7844ed221bf..62108e3df59 100644 --- a/test/core/gprpp/single_set_ptr_test.cc +++ b/test/core/gprpp/single_set_ptr_test.cc @@ -14,6 +14,7 @@ #include "src/core/lib/gprpp/single_set_ptr.h" +#include #include #include diff --git a/test/core/handshake/client_ssl.cc b/test/core/handshake/client_ssl.cc index 4f88b3fc48c..69f14d17217 100644 --- a/test/core/handshake/client_ssl.cc +++ b/test/core/handshake/client_ssl.cc @@ -55,6 +55,7 @@ #include #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/load_file.h" @@ -241,16 +242,14 @@ static void server_thread(void* arg) { "SHA384:ECDHE-RSA-AES256-GCM-SHA384"; if (!SSL_CTX_set_cipher_list(ctx, cipher_list)) { ERR_print_errors_fp(stderr); - gpr_log(GPR_ERROR, "Couldn't set server cipher list."); - abort(); + grpc_core::Crash("Couldn't set server cipher list."); } // Enable automatic curve selection. This is a NO-OP when using OpenSSL // versions > 1.0.2. if (!SSL_CTX_set_ecdh_auto(ctx, /*onoff=*/1)) { ERR_print_errors_fp(stderr); - gpr_log(GPR_ERROR, "Couldn't set automatic curve selection."); - abort(); + grpc_core::Crash("Couldn't set automatic curve selection."); } // Register the ALPN selection callback. diff --git a/test/core/handshake/server_ssl_common.cc b/test/core/handshake/server_ssl_common.cc index e09c2692d3b..e29bf9f8289 100644 --- a/test/core/handshake/server_ssl_common.cc +++ b/test/core/handshake/server_ssl_common.cc @@ -44,6 +44,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/error.h" @@ -222,8 +223,7 @@ bool server_ssl_test(const char* alpn_list[], unsigned int alpn_list_len, "SHA384:ECDHE-RSA-AES256-GCM-SHA384"; if (!SSL_CTX_set_cipher_list(ctx, cipher_list)) { ERR_print_errors_fp(stderr); - gpr_log(GPR_ERROR, "Couldn't set server cipher list."); - abort(); + grpc_core::Crash("Couldn't set server cipher list."); } // Configure ALPN list the client will send to the server. This must match the diff --git a/test/core/handshake/verify_peer_options.cc b/test/core/handshake/verify_peer_options.cc index ddece3505fb..beb7b7ae687 100644 --- a/test/core/handshake/verify_peer_options.cc +++ b/test/core/handshake/verify_peer_options.cc @@ -39,6 +39,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/load_file.h" #include "test/core/util/port.h" diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc index 7b515e862fe..de6f8c3aa7f 100644 --- a/test/core/iomgr/combiner_test.cc +++ b/test/core/iomgr/combiner_test.cc @@ -25,6 +25,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/thd.h" #include "test/core/util/test_config.h" diff --git a/test/core/iomgr/endpoint_pair_test.cc b/test/core/iomgr/endpoint_pair_test.cc index 877982164b3..9c06c6cbce5 100644 --- a/test/core/iomgr/endpoint_pair_test.cc +++ b/test/core/iomgr/endpoint_pair_test.cc @@ -26,6 +26,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "test/core/iomgr/endpoint_tests.h" #include "test/core/util/test_config.h" diff --git a/test/core/iomgr/endpoint_tests.cc b/test/core/iomgr/endpoint_tests.cc index 5624b17742d..77d36c82c60 100644 --- a/test/core/iomgr/endpoint_tests.cc +++ b/test/core/iomgr/endpoint_tests.cc @@ -28,6 +28,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/slice/slice_internal.h" #include "test/core/util/test_config.h" diff --git a/test/core/iomgr/error_test.cc b/test/core/iomgr/error_test.cc index 98256960c9f..241ffb6cbe5 100644 --- a/test/core/iomgr/error_test.cc +++ b/test/core/iomgr/error_test.cc @@ -26,6 +26,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" TEST(ErrorTest, SetGetInt) { diff --git a/test/core/iomgr/fd_conservation_posix_test.cc b/test/core/iomgr/fd_conservation_posix_test.cc index 3d020d7d963..5081d5de5f8 100644 --- a/test/core/iomgr/fd_conservation_posix_test.cc +++ b/test/core/iomgr/fd_conservation_posix_test.cc @@ -21,6 +21,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "test/core/util/test_config.h" diff --git a/test/core/iomgr/fd_posix_test.cc b/test/core/iomgr/fd_posix_test.cc index b6d7e2dca97..74588d419aa 100644 --- a/test/core/iomgr/fd_posix_test.cc +++ b/test/core/iomgr/fd_posix_test.cc @@ -36,12 +36,15 @@ #include #include +#include "absl/strings/str_format.h" + #include #include #include #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/strerror.h" #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/iomgr.h" @@ -161,9 +164,8 @@ static void session_read_cb(void* arg, // session // before notify_on_read is called. grpc_fd_notify_on_read(se->em_fd, &se->session_read_closure); } else { - gpr_log(GPR_ERROR, "Unhandled read error %s", - grpc_core::StrError(errno).c_str()); - abort(); + grpc_core::Crash(absl::StrFormat("Unhandled read error %s", + grpc_core::StrError(errno).c_str())); } } } @@ -328,8 +330,8 @@ static void client_session_write(void* arg, // client } gpr_mu_unlock(g_mu); } else { - gpr_log(GPR_ERROR, "unknown errno %s", grpc_core::StrError(errno).c_str()); - abort(); + grpc_core::Crash(absl::StrFormat("unknown errno %s", + grpc_core::StrError(errno).c_str())); } } @@ -350,8 +352,8 @@ static void client_start(client* cl, int port) { abort(); } } else { - gpr_log(GPR_ERROR, "Failed to connect to the server (errno=%d)", errno); - abort(); + grpc_core::Crash( + absl::StrFormat("Failed to connect to the server (errno=%d)", errno)); } } diff --git a/test/core/iomgr/grpc_ipv6_loopback_available_test.cc b/test/core/iomgr/grpc_ipv6_loopback_available_test.cc index 9cfc8e2e980..c1b20fb8d37 100644 --- a/test/core/iomgr/grpc_ipv6_loopback_available_test.cc +++ b/test/core/iomgr/grpc_ipv6_loopback_available_test.cc @@ -21,6 +21,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/iomgr/load_file_test.cc b/test/core/iomgr/load_file_test.cc index 2cf1a6d008d..c72ac3862ba 100644 --- a/test/core/iomgr/load_file_test.cc +++ b/test/core/iomgr/load_file_test.cc @@ -30,6 +30,7 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" #define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x) diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc index 1369bc00c90..40e100ca93d 100644 --- a/test/core/iomgr/resolve_address_posix_test.cc +++ b/test/core/iomgr/resolve_address_posix_test.cc @@ -37,6 +37,7 @@ #include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/gprpp/time.h" diff --git a/test/core/iomgr/resolve_address_test.cc b/test/core/iomgr/resolve_address_test.cc index 32b751dcec9..befd3b0b9b8 100644 --- a/test/core/iomgr/resolve_address_test.cc +++ b/test/core/iomgr/resolve_address_test.cc @@ -36,6 +36,7 @@ #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h" #include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/executor.h" diff --git a/test/core/iomgr/socket_utils_test.cc b/test/core/iomgr/socket_utils_test.cc index 7bcd09f8975..453c44ec529 100644 --- a/test/core/iomgr/socket_utils_test.cc +++ b/test/core/iomgr/socket_utils_test.cc @@ -33,6 +33,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/socket_mutator.h" #include "src/core/lib/iomgr/socket_utils_posix.h" #include "test/core/util/test_config.h" diff --git a/test/core/iomgr/stranded_event_test.cc b/test/core/iomgr/stranded_event_test.cc index e154cd7838e..f56a8524328 100644 --- a/test/core/iomgr/stranded_event_test.cc +++ b/test/core/iomgr/stranded_event_test.cc @@ -43,6 +43,7 @@ #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/error.h" diff --git a/test/core/iomgr/tcp_client_posix_test.cc b/test/core/iomgr/tcp_client_posix_test.cc index c8127b81927..c9ab2af500c 100644 --- a/test/core/iomgr/tcp_client_posix_test.cc +++ b/test/core/iomgr/tcp_client_posix_test.cc @@ -42,6 +42,7 @@ #include #include "src/core/lib/event_engine/channel_args_endpoint_config.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/socket_utils_posix.h" diff --git a/test/core/iomgr/tcp_posix_test.cc b/test/core/iomgr/tcp_posix_test.cc index e869c195790..eba45b045a8 100644 --- a/test/core/iomgr/tcp_posix_test.cc +++ b/test/core/iomgr/tcp_posix_test.cc @@ -39,6 +39,7 @@ #include "src/core/lib/event_engine/channel_args_endpoint_config.h" #include "src/core/lib/experiments/experiments.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/buffer_list.h" #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/sockaddr_posix.h" diff --git a/test/core/iomgr/tcp_server_posix_test.cc b/test/core/iomgr/tcp_server_posix_test.cc index f77e530773f..5c529b82a22 100644 --- a/test/core/iomgr/tcp_server_posix_test.cc +++ b/test/core/iomgr/tcp_server_posix_test.cc @@ -48,6 +48,7 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/event_engine/channel_args_endpoint_config.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/strerror.h" #include "src/core/lib/iomgr/error.h" diff --git a/test/core/iomgr/timer_heap_test.cc b/test/core/iomgr/timer_heap_test.cc index 70e907a309b..8201d318e23 100644 --- a/test/core/iomgr/timer_heap_test.cc +++ b/test/core/iomgr/timer_heap_test.cc @@ -27,6 +27,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/iomgr/timer_list_test.cc b/test/core/iomgr/timer_list_test.cc index b71456b10e1..012392a5c95 100644 --- a/test/core/iomgr/timer_list_test.cc +++ b/test/core/iomgr/timer_list_test.cc @@ -25,6 +25,7 @@ #include #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/iomgr_internal.h" #include "src/core/lib/iomgr/port.h" diff --git a/test/core/security/alts_credentials_fuzzer.cc b/test/core/security/alts_credentials_fuzzer.cc index eaf60c92020..a11d362511f 100644 --- a/test/core/security/alts_credentials_fuzzer.cc +++ b/test/core/security/alts_credentials_fuzzer.cc @@ -24,6 +24,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/security/credentials/alts/alts_credentials.h" #include "src/core/lib/security/credentials/alts/check_gcp_environment.h" diff --git a/test/core/security/alts_security_connector_test.cc b/test/core/security/alts_security_connector_test.cc index 77a3b1f06e7..e6ebec25027 100644 --- a/test/core/security/alts_security_connector_test.cc +++ b/test/core/security/alts_security_connector_test.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/context/security_context.h" #include "src/core/lib/transport/transport.h" #include "src/core/tsi/alts/handshaker/alts_tsi_handshaker.h" diff --git a/test/core/security/auth_context_test.cc b/test/core/security/auth_context_test.cc index 029e2968122..aef3f31b701 100644 --- a/test/core/security/auth_context_test.cc +++ b/test/core/security/auth_context_test.cc @@ -23,6 +23,7 @@ #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/security/context/security_context.h" #include "test/core/util/test_config.h" diff --git a/test/core/security/check_gcp_environment_linux_test.cc b/test/core/security/check_gcp_environment_linux_test.cc index c3d1fea3731..8eb5dc4960f 100644 --- a/test/core/security/check_gcp_environment_linux_test.cc +++ b/test/core/security/check_gcp_environment_linux_test.cc @@ -27,6 +27,7 @@ #include #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/credentials/alts/check_gcp_environment.h" #if GPR_LINUX diff --git a/test/core/security/check_gcp_environment_windows_test.cc b/test/core/security/check_gcp_environment_windows_test.cc index d2423ec2807..a5bb469d471 100644 --- a/test/core/security/check_gcp_environment_windows_test.cc +++ b/test/core/security/check_gcp_environment_windows_test.cc @@ -27,6 +27,7 @@ #include #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/credentials/alts/check_gcp_environment.h" #ifdef GPR_WINDOWS diff --git a/test/core/security/create_jwt.cc b/test/core/security/create_jwt.cc index 19c397ce1bb..4fd4c915672 100644 --- a/test/core/security/create_jwt.cc +++ b/test/core/security/create_jwt.cc @@ -23,6 +23,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/credentials/jwt/jwt_credentials.h" #include "test/core/util/cmdline.h" diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc index 8e89311c015..7761b5e613f 100644 --- a/test/core/security/credentials_test.cc +++ b/test/core/security/credentials_test.cc @@ -43,6 +43,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/time.h" @@ -533,11 +534,11 @@ class RequestMetadataState : public RefCounted { void check_peer(tsi_peer, grpc_endpoint*, const ChannelArgs&, RefCountedPtr*, grpc_closure*) override { - GPR_ASSERT(false); + Crash("unreachable"); } void cancel_check_peer(grpc_closure*, grpc_error_handle) override { - GPR_ASSERT(false); + Crash("unreachable"); } int cmp(const grpc_security_connector*) const override { @@ -552,7 +553,7 @@ class RequestMetadataState : public RefCounted { void add_handshakers(const ChannelArgs&, grpc_pollset_set*, HandshakeManager*) override { - GPR_ASSERT(false); + Crash("unreachable"); } }; @@ -2212,15 +2213,15 @@ TEST(CredentialsTest, TestAuthMetadataContext) { &auth_md_context); if (strcmp(auth_md_context.service_url, test_cases[i].desired_service_url) != 0) { - gpr_log(GPR_ERROR, "Invalid service url, want: %s, got %s.", - test_cases[i].desired_service_url, auth_md_context.service_url); - GPR_ASSERT(false); + Crash(absl::StrFormat("Invalid service url, want: %s, got %s.", + test_cases[i].desired_service_url, + auth_md_context.service_url)); } if (strcmp(auth_md_context.method_name, test_cases[i].desired_method_name) != 0) { - gpr_log(GPR_ERROR, "Invalid method name, want: %s, got %s.", - test_cases[i].desired_method_name, auth_md_context.method_name); - GPR_ASSERT(false); + Crash(absl::StrFormat("Invalid method name, want: %s, got %s.", + test_cases[i].desired_method_name, + auth_md_context.method_name)); } GPR_ASSERT(auth_md_context.channel_auth_context == nullptr); grpc_slice_unref(call_host); diff --git a/test/core/security/fetch_oauth2.cc b/test/core/security/fetch_oauth2.cc index 67c99bd2f0c..29400d3cf9d 100644 --- a/test/core/security/fetch_oauth2.cc +++ b/test/core/security/fetch_oauth2.cc @@ -27,6 +27,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/credentials/credentials.h" diff --git a/test/core/security/grpc_alts_credentials_options_test.cc b/test/core/security/grpc_alts_credentials_options_test.cc index b6c6255e7e8..4168ffe7244 100644 --- a/test/core/security/grpc_alts_credentials_options_test.cc +++ b/test/core/security/grpc_alts_credentials_options_test.cc @@ -27,6 +27,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + #define ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_1 "abc@google.com" #define ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_2 "def@google.com" diff --git a/test/core/security/grpc_tls_certificate_distributor_test.cc b/test/core/security/grpc_tls_certificate_distributor_test.cc index 0c961cdea41..8fa6187eaf9 100644 --- a/test/core/security/grpc_tls_certificate_distributor_test.cc +++ b/test/core/security/grpc_tls_certificate_distributor_test.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/slice/slice_internal.h" #include "test/core/util/test_config.h" #include "test/core/util/tls_utils.h" diff --git a/test/core/security/grpc_tls_certificate_provider_test.cc b/test/core/security/grpc_tls_certificate_provider_test.cc index c8816a21a27..e0a95d5c097 100644 --- a/test/core/security/grpc_tls_certificate_provider_test.cc +++ b/test/core/security/grpc_tls_certificate_provider_test.cc @@ -27,6 +27,7 @@ #include #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/slice/slice_internal.h" #include "test/core/util/test_config.h" diff --git a/test/core/security/grpc_tls_certificate_verifier_test.cc b/test/core/security/grpc_tls_certificate_verifier_test.cc index 34df9ed0d57..2aaa9cc8d63 100644 --- a/test/core/security/grpc_tls_certificate_verifier_test.cc +++ b/test/core/security/grpc_tls_certificate_verifier_test.cc @@ -27,6 +27,7 @@ #include #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/security_connector/tls/tls_security_connector.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/test/core/security/grpc_tls_credentials_options_test.cc b/test/core/security/grpc_tls_credentials_options_test.cc index ce23b6cff3f..4908f85ffc5 100644 --- a/test/core/security/grpc_tls_credentials_options_test.cc +++ b/test/core/security/grpc_tls_credentials_options_test.cc @@ -26,6 +26,7 @@ #include #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/credentials/tls/tls_credentials.h" #include "src/core/lib/security/security_connector/ssl_utils_config.h" diff --git a/test/core/security/json_token_test.cc b/test/core/security/json_token_test.cc index fd76fd666db..4541b43b92d 100644 --- a/test/core/security/json_token_test.cc +++ b/test/core/security/json_token_test.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/json/json.h" #include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h" #include "src/core/lib/slice/b64.h" diff --git a/test/core/security/jwt_verifier_test.cc b/test/core/security/jwt_verifier_test.cc index d48d20c8a07..e90068587e2 100644 --- a/test/core/security/jwt_verifier_test.cc +++ b/test/core/security/jwt_verifier_test.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/http/httpcli.h" #include "src/core/lib/security/credentials/jwt/json_token.h" #include "src/core/lib/slice/b64.h" diff --git a/test/core/security/oauth2_utils.cc b/test/core/security/oauth2_utils.cc index 0c7ccd3f030..5447e7ae87b 100644 --- a/test/core/security/oauth2_utils.cc +++ b/test/core/security/oauth2_utils.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/promise/exec_ctx_wakeup_scheduler.h" #include "src/core/lib/promise/map.h" diff --git a/test/core/security/print_google_default_creds_token.cc b/test/core/security/print_google_default_creds_token.cc index 11bac97eb55..f7348df8202 100644 --- a/test/core/security/print_google_default_creds_token.cc +++ b/test/core/security/print_google_default_creds_token.cc @@ -27,6 +27,7 @@ #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/credentials/composite/composite_credentials.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/slice/slice_string_helpers.h" diff --git a/test/core/security/secure_endpoint_test.cc b/test/core/security/secure_endpoint_test.cc index 9e84b2f68e7..05d896dc470 100644 --- a/test/core/security/secure_endpoint_test.cc +++ b/test/core/security/secure_endpoint_test.cc @@ -28,6 +28,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/test/core/security/security_connector_test.cc b/test/core/security/security_connector_test.cc index 48a08009d97..247445018f3 100644 --- a/test/core/security/security_connector_test.cc +++ b/test/core/security/security_connector_test.cc @@ -30,6 +30,7 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/security/context/security_context.h" #include "src/core/lib/security/security_connector/ssl_utils.h" diff --git a/test/core/security/ssl_credentials_test.cc b/test/core/security/ssl_credentials_test.cc index 7c16c2188d5..76a8e0daec6 100644 --- a/test/core/security/ssl_credentials_test.cc +++ b/test/core/security/ssl_credentials_test.cc @@ -27,6 +27,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/security_connector/ssl_utils.h" #include "src/core/tsi/ssl_transport_security.h" #include "test/core/util/test_config.h" diff --git a/test/core/security/ssl_server_fuzzer.cc b/test/core/security/ssl_server_fuzzer.cc index 7ee10037c46..079b19875e3 100644 --- a/test/core/security/ssl_server_fuzzer.cc +++ b/test/core/security/ssl_server_fuzzer.cc @@ -22,6 +22,7 @@ #include #include "src/core/lib/event_engine/default_event_engine.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/security_connector/security_connector.h" diff --git a/test/core/security/system_roots_test.cc b/test/core/security/system_roots_test.cc index bbf23832d4a..d807333600d 100644 --- a/test/core/security/system_roots_test.cc +++ b/test/core/security/system_roots_test.cc @@ -32,6 +32,7 @@ #include #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/context/security_context.h" diff --git a/test/core/security/tls_security_connector_test.cc b/test/core/security/tls_security_connector_test.cc index 7803f84c107..8e2f87a841a 100644 --- a/test/core/security/tls_security_connector_test.cc +++ b/test/core/security/tls_security_connector_test.cc @@ -29,6 +29,7 @@ #include #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/unique_type_name.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/context/security_context.h" diff --git a/test/core/security/verify_jwt.cc b/test/core/security/verify_jwt.cc index c8b8d29c6f3..d841c700073 100644 --- a/test/core/security/verify_jwt.cc +++ b/test/core/security/verify_jwt.cc @@ -26,6 +26,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/security/credentials/jwt/jwt_verifier.h" diff --git a/test/core/surface/completion_queue_threading_test.cc b/test/core/surface/completion_queue_threading_test.cc index 87f1e20e968..3beb48d10d9 100644 --- a/test/core/surface/completion_queue_threading_test.cc +++ b/test/core/surface/completion_queue_threading_test.cc @@ -29,6 +29,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/surface/completion_queue.h" @@ -207,8 +208,7 @@ static void consumer_thread(void* arg) { gpr_event_set(&opt->on_finished, reinterpret_cast(1)); return; case GRPC_QUEUE_TIMEOUT: - gpr_log(GPR_ERROR, "Invalid timeout received"); - abort(); + grpc_core::Crash("Invalid timeout received"); } } } diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index af73ac4d0af..897bab713ac 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -304,6 +304,7 @@ int main(int argc, char **argv) { printf("%lx", (unsigned long) gpr_set_log_verbosity); printf("%lx", (unsigned long) gpr_log_verbosity_init); printf("%lx", (unsigned long) gpr_set_log_function); + printf("%lx", (unsigned long) gpr_assertion_failed); printf("%lx", (unsigned long) gpr_strdup); printf("%lx", (unsigned long) gpr_asprintf); printf("%lx", (unsigned long) gpr_mu_init); diff --git a/test/core/transport/binder/end2end/binder_server_test.cc b/test/core/transport/binder/end2end/binder_server_test.cc index 51569c9734c..5f226c84196 100644 --- a/test/core/transport/binder/end2end/binder_server_test.cc +++ b/test/core/transport/binder/end2end/binder_server_test.cc @@ -52,7 +52,7 @@ class BinderServerCredentialsImpl final : public ServerCredentials { void SetAuthMetadataProcessor( const std::shared_ptr& /*processor*/) override { - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); } private: diff --git a/test/core/transport/binder/end2end/fake_binder.cc b/test/core/transport/binder/end2end/fake_binder.cc index 704179838ca..5dc25e842c5 100644 --- a/test/core/transport/binder/end2end/fake_binder.cc +++ b/test/core/transport/binder/end2end/fake_binder.cc @@ -19,6 +19,8 @@ #include +#include "src/core/lib/gprpp/crash.h" + namespace grpc_binder { namespace end2end_testing { diff --git a/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.h b/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.h index ce0c988ecca..0196615e6f2 100644 --- a/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.h +++ b/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.h @@ -28,6 +28,7 @@ #include "src/core/ext/transport/binder/wire_format/binder.h" #include "src/core/ext/transport/binder/wire_format/wire_reader.h" +#include "src/core/lib/gprpp/crash.h" #include "test/core/transport/binder/end2end/fuzzers/binder_transport_fuzzer.pb.h" namespace grpc_binder { diff --git a/test/core/transport/chttp2/bin_encoder_test.cc b/test/core/transport/chttp2/bin_encoder_test.cc index 69bbf7df418..83fe34a6d2d 100644 --- a/test/core/transport/chttp2/bin_encoder_test.cc +++ b/test/core/transport/chttp2/bin_encoder_test.cc @@ -20,9 +20,6 @@ #include -// This is here for grpc_is_binary_header -// TODO(murgatroid99): Remove this -// #include #include diff --git a/test/core/transport/chttp2/hpack_parser_test.cc b/test/core/transport/chttp2/hpack_parser_test.cc index 17b21f97408..7bc753d705a 100644 --- a/test/core/transport/chttp2/hpack_parser_test.cc +++ b/test/core/transport/chttp2/hpack_parser_test.cc @@ -25,6 +25,7 @@ #include "absl/status/status.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/types/optional.h" #include "gtest/gtest.h" @@ -32,8 +33,8 @@ #include #include #include -#include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/iomgr/exec_ctx.h" @@ -108,9 +109,9 @@ class ParseTest : public ::testing::TestWithParam { grpc_core::ExecCtx exec_ctx; auto err = parser_->Parse(slices[i], i == nslices - 1); if (!err.ok()) { - gpr_log(GPR_ERROR, "Unexpected parse error: %s", - grpc_core::StatusToString(err).c_str()); - abort(); + grpc_core::Crash( + absl::StrFormat("Unexpected parse error: %s", + grpc_core::StatusToString(err).c_str())); } } diff --git a/test/core/tsi/alts/crypt/aes_gcm_test.cc b/test/core/tsi/alts/crypt/aes_gcm_test.cc index 0f1774f2130..de2d12175e9 100644 --- a/test/core/tsi/alts/crypt/aes_gcm_test.cc +++ b/test/core/tsi/alts/crypt/aes_gcm_test.cc @@ -21,6 +21,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/tsi/alts/crypt/gsec.h" #include "test/core/tsi/alts/crypt/gsec_test_util.h" #include "test/core/util/test_config.h" 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 2f0370ada26..dc8dd9f1fcb 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,8 @@ #include #include +#include "absl/strings/str_format.h" + #include #include #include @@ -30,6 +32,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/tsi/alts/fake_handshaker/handshaker.grpc.pb.h" #include "test/core/tsi/alts/fake_handshaker/handshaker.pb.h" #include "test/core/tsi/alts/fake_handshaker/transport_security_common.pb.h" @@ -253,12 +256,11 @@ class FakeHandshakerService : public HandshakerService::Service { &parent->expected_max_concurrent_rpcs_mu_); if (++parent->concurrent_rpcs_ > parent->expected_max_concurrent_rpcs_) { - gpr_log(GPR_ERROR, - "FakeHandshakerService:%p concurrent_rpcs_:%d " - "expected_max_concurrent_rpcs:%d", - parent, parent->concurrent_rpcs_, - parent->expected_max_concurrent_rpcs_); - abort(); + grpc_core::Crash( + absl::StrFormat("FakeHandshakerService:%p concurrent_rpcs_:%d " + "expected_max_concurrent_rpcs:%d", + parent, parent->concurrent_rpcs_, + parent->expected_max_concurrent_rpcs_)); } } } 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 a689e2fc666..5edb38bf7fe 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 @@ -23,6 +23,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/tsi/alts/fake_handshaker/fake_handshaker_server.h" #include "test/core/util/test_config.h" #include "test/cpp/util/test_config.h" diff --git a/test/core/tsi/alts/frame_protector/alts_counter_test.cc b/test/core/tsi/alts/frame_protector/alts_counter_test.cc index d610deb4df2..baa516d27f6 100644 --- a/test/core/tsi/alts/frame_protector/alts_counter_test.cc +++ b/test/core/tsi/alts/frame_protector/alts_counter_test.cc @@ -23,6 +23,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/tsi/alts/crypt/gsec_test_util.h" const size_t kSmallCounterSize = 4; diff --git a/test/core/tsi/alts/frame_protector/alts_crypter_test.cc b/test/core/tsi/alts/frame_protector/alts_crypter_test.cc index 8d11a32812a..55b4d443da8 100644 --- a/test/core/tsi/alts/frame_protector/alts_crypter_test.cc +++ b/test/core/tsi/alts/frame_protector/alts_crypter_test.cc @@ -27,6 +27,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/tsi/alts/crypt/gsec_test_util.h" static void alts_crypter_test_random_seal_unseal(alts_crypter* server_seal, diff --git a/test/core/tsi/alts/frame_protector/alts_frame_protector_test.cc b/test/core/tsi/alts/frame_protector/alts_frame_protector_test.cc index 3a3b2ec6e25..132fea59e69 100644 --- a/test/core/tsi/alts/frame_protector/alts_frame_protector_test.cc +++ b/test/core/tsi/alts/frame_protector/alts_frame_protector_test.cc @@ -25,6 +25,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/tsi/alts/crypt/gsec.h" #include "src/core/tsi/transport_security_interface.h" #include "test/core/tsi/alts/crypt/gsec_test_util.h" diff --git a/test/core/tsi/alts/frame_protector/frame_handler_test.cc b/test/core/tsi/alts/frame_protector/frame_handler_test.cc index 2bdb4c3ace6..7563d5542e4 100644 --- a/test/core/tsi/alts/frame_protector/frame_handler_test.cc +++ b/test/core/tsi/alts/frame_protector/frame_handler_test.cc @@ -30,6 +30,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "test/core/tsi/alts/crypt/gsec_test_util.h" const size_t kFrameHandlerTestBufferSize = 1024; 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 ae9da992214..670c111d8be 100644 --- a/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc +++ b/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc @@ -47,6 +47,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/error.h" @@ -319,8 +320,7 @@ TEST(AltsConcurrentConnectivityTest, TestConcurrentClientServerHandshakes) { gpr_log(GPR_DEBUG, "done performing concurrent expected-to-succeed connects"); if (gpr_time_cmp(gpr_now(GPR_CLOCK_MONOTONIC), test_deadline) > 0) { - gpr_log(GPR_DEBUG, "Test took longer than expected."); - abort(); + grpc_core::Crash("Test took longer than expected."); } } } @@ -363,10 +363,9 @@ TEST(AltsConcurrentConnectivityTest, connect_loop_runners.clear(); gpr_log(GPR_DEBUG, "done performing concurrent expected-to-fail connects"); if (gpr_time_cmp(gpr_now(GPR_CLOCK_MONOTONIC), test_deadline) > 0) { - gpr_log(GPR_ERROR, - "Exceeded test deadline. ALTS handshakes might not be failing " - "fast when the peer endpoint closes the connection abruptly"); - abort(); + grpc_core::Crash( + "Exceeded test deadline. ALTS handshakes might not be failing " + "fast when the peer endpoint closes the connection abruptly"); } } } @@ -402,10 +401,9 @@ TEST(AltsConcurrentConnectivityTest, connect_loop_runners.clear(); gpr_log(GPR_DEBUG, "done performing concurrent expected-to-fail connects"); if (gpr_time_cmp(gpr_now(GPR_CLOCK_MONOTONIC), test_deadline) > 0) { - gpr_log(GPR_ERROR, - "Exceeded test deadline. ALTS handshakes might not be failing " - "fast when the handshake server closes new connections"); - abort(); + grpc_core::Crash( + "Exceeded test deadline. ALTS handshakes might not be failing " + "fast when the handshake server closes new connections"); } } } @@ -441,10 +439,9 @@ TEST(AltsConcurrentConnectivityTest, connect_loop_runners.clear(); gpr_log(GPR_DEBUG, "done performing concurrent expected-to-fail connects"); if (gpr_time_cmp(gpr_now(GPR_CLOCK_MONOTONIC), test_deadline) > 0) { - gpr_log(GPR_ERROR, - "Exceeded test deadline. ALTS handshakes might not be failing " - "fast when the handshake server is non-response timeout occurs"); - abort(); + grpc_core::Crash( + "Exceeded test deadline. ALTS handshakes might not be failing " + "fast when the handshake server is non-response timeout occurs"); } } } diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc index 815ff326611..eb4ce29aadb 100644 --- a/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc +++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc @@ -23,6 +23,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h" diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol_test.cc index 0a5807a6699..b36bc38fa05 100644 --- a/test/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol_test.cc +++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol_test.cc @@ -23,6 +23,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/tsi/alts/crypt/gsec_test_util.h" constexpr size_t kMaxDataSize = 1024; diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc index 764bae62b5e..9a8176c5429 100644 --- a/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc +++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc @@ -24,6 +24,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/tsi/alts/crypt/gsec.h" diff --git a/test/core/tsi/crl_ssl_transport_security_test.cc b/test/core/tsi/crl_ssl_transport_security_test.cc index 86330428da2..fbb00d4a96e 100644 --- a/test/core/tsi/crl_ssl_transport_security_test.cc +++ b/test/core/tsi/crl_ssl_transport_security_test.cc @@ -24,6 +24,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/security_connector/security_connector.h" #include "src/core/tsi/ssl_transport_security.h" diff --git a/test/core/tsi/fake_transport_security_test.cc b/test/core/tsi/fake_transport_security_test.cc index 6006008cbab..2c58b73bbe9 100644 --- a/test/core/tsi/fake_transport_security_test.cc +++ b/test/core/tsi/fake_transport_security_test.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/security_connector/security_connector.h" #include "src/core/tsi/transport_security.h" #include "test/core/tsi/transport_security_test_lib.h" diff --git a/test/core/tsi/ssl_session_cache_test.cc b/test/core/tsi/ssl_session_cache_test.cc index 11db1458662..9a7da12a9f3 100644 --- a/test/core/tsi/ssl_session_cache_test.cc +++ b/test/core/tsi/ssl_session_cache_test.cc @@ -26,6 +26,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" namespace grpc_core { diff --git a/test/core/tsi/ssl_transport_security_test.cc b/test/core/tsi/ssl_transport_security_test.cc index 45a184d2998..62ebbec30e9 100644 --- a/test/core/tsi/ssl_transport_security_test.cc +++ b/test/core/tsi/ssl_transport_security_test.cc @@ -32,6 +32,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/security_connector/security_connector.h" diff --git a/test/core/tsi/transport_security_test.cc b/test/core/tsi/transport_security_test.cc index 139438a5057..c5572d9b3b2 100644 --- a/test/core/tsi/transport_security_test.cc +++ b/test/core/tsi/transport_security_test.cc @@ -33,6 +33,7 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/tsi/fake_transport_security.h" #include "src/core/tsi/ssl_transport_security.h" #include "test/core/util/test_config.h" diff --git a/test/core/tsi/transport_security_test_lib.cc b/test/core/tsi/transport_security_test_lib.cc index 549a73a3656..eda7ae8794c 100644 --- a/test/core/tsi/transport_security_test_lib.cc +++ b/test/core/tsi/transport_security_test_lib.cc @@ -26,6 +26,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/security/transport/tsi_error.h" diff --git a/test/core/util/one_corpus_entry_fuzzer.cc b/test/core/util/one_corpus_entry_fuzzer.cc index fa0f04f0255..5bd6023adbf 100644 --- a/test/core/util/one_corpus_entry_fuzzer.cc +++ b/test/core/util/one_corpus_entry_fuzzer.cc @@ -21,6 +21,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/load_file.h" diff --git a/test/core/util/port_isolated_runtime_environment.cc b/test/core/util/port_isolated_runtime_environment.cc index 6d9c13bbcbf..ad7e957bf3a 100644 --- a/test/core/util/port_isolated_runtime_environment.cc +++ b/test/core/util/port_isolated_runtime_environment.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/port.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/util/subprocess_windows.cc b/test/core/util/subprocess_windows.cc index 7a474afa808..b639b3ef737 100644 --- a/test/core/util/subprocess_windows.cc +++ b/test/core/util/subprocess_windows.cc @@ -31,6 +31,7 @@ #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/tchar.h" #include "test/core/util/subprocess.h" diff --git a/test/core/util/test_config.cc b/test/core/util/test_config.cc index 366ddc69f3a..a7dcb74e135 100644 --- a/test/core/util/test_config.cc +++ b/test/core/util/test_config.cc @@ -26,12 +26,14 @@ #include "absl/debugging/failure_signal_handler.h" #include "absl/status/status.h" #include "absl/strings/match.h" +#include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/surface/init.h" #include "test/core/event_engine/test_init.h" #include "test/core/util/build.h" @@ -109,8 +111,7 @@ void ParseTestArgs(int* argc, char** argv) { grpc_event_engine::experimental::InitializeTestingEventEngineFactory( argv[i] + engine_flag.length()); if (!engine_set.ok()) { - gpr_log(GPR_ERROR, "%s", engine_set.ToString().c_str()); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("%s", engine_set.ToString().c_str())); } // remove the spent argv RmArg(i, argc, argv); diff --git a/test/core/xds/file_watcher_certificate_provider_factory_test.cc b/test/core/xds/file_watcher_certificate_provider_factory_test.cc index 09947b0bf9d..648e7d302f0 100644 --- a/test/core/xds/file_watcher_certificate_provider_factory_test.cc +++ b/test/core/xds/file_watcher_certificate_provider_factory_test.cc @@ -174,7 +174,7 @@ TEST(FileWatcherConfigTest, PrivateKeyProvidedButIdentityCertMissing) { } TEST(FileWatcherConfigTest, EmptyJsonObject) { - std::string json_str = absl::StrFormat("{}"); + std::string json_str = "{}"; auto json = Json::Parse(json_str); ASSERT_TRUE(json.ok()) << json.status(); grpc_error_handle error; diff --git a/test/core/xds/xds_cluster_resource_type_test.cc b/test/core/xds/xds_cluster_resource_type_test.cc index b91ca22bd5a..18b2f4ebfb3 100644 --- a/test/core/xds/xds_cluster_resource_type_test.cc +++ b/test/core/xds/xds_cluster_resource_type_test.cc @@ -24,6 +24,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" +#include "absl/strings/str_format.h" #include "absl/types/optional.h" #include "absl/types/variant.h" #include "gmock/gmock.h" @@ -32,7 +33,6 @@ #include "upb/upb.hpp" #include -#include #include "src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h" #include "src/core/ext/xds/xds_bootstrap.h" @@ -43,6 +43,7 @@ #include "src/core/ext/xds/xds_health_status.h" #include "src/core/ext/xds/xds_resource_type.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/error.h" @@ -108,9 +109,8 @@ class XdsClusterTest : public ::testing::Test { " }\n" "}"); if (!bootstrap.ok()) { - gpr_log(GPR_ERROR, "Error parsing bootstrap: %s", - bootstrap.status().ToString().c_str()); - GPR_ASSERT(false); + Crash(absl::StrFormat("Error parsing bootstrap: %s", + bootstrap.status().ToString().c_str())); } return MakeRefCounted(std::move(*bootstrap), /*transport_factory=*/nullptr, diff --git a/test/core/xds/xds_common_types_test.cc b/test/core/xds/xds_common_types_test.cc index 8ce82062ac2..cca6a783d34 100644 --- a/test/core/xds/xds_common_types_test.cc +++ b/test/core/xds/xds_common_types_test.cc @@ -27,6 +27,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" +#include "absl/strings/str_format.h" #include "envoy/extensions/transport_sockets/tls/v3/tls.upb.h" #include "gmock/gmock.h" #include "google/protobuf/any.upb.h" @@ -37,7 +38,6 @@ #include "upb/upb.hpp" #include -#include #include "src/core/ext/xds/upb_utils.h" #include "src/core/ext/xds/xds_bootstrap.h" @@ -45,6 +45,7 @@ #include "src/core/ext/xds/xds_client.h" #include "src/core/ext/xds/xds_resource_type.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" @@ -97,9 +98,8 @@ class XdsCommonTypesTest : public ::testing::Test { " }\n" "}"); if (!bootstrap.ok()) { - gpr_log(GPR_ERROR, "Error parsing bootstrap: %s", - bootstrap.status().ToString().c_str()); - GPR_ASSERT(false); + Crash(absl::StrFormat("Error parsing bootstrap: %s", + bootstrap.status().ToString().c_str())); } return MakeRefCounted(std::move(*bootstrap), /*transport_factory=*/nullptr, diff --git a/test/core/xds/xds_endpoint_resource_type_test.cc b/test/core/xds/xds_endpoint_resource_type_test.cc index 8e64975facf..fd16ee95098 100644 --- a/test/core/xds/xds_endpoint_resource_type_test.cc +++ b/test/core/xds/xds_endpoint_resource_type_test.cc @@ -26,13 +26,13 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" +#include "absl/strings/str_format.h" #include "absl/types/optional.h" #include "gtest/gtest.h" #include "upb/def.hpp" #include "upb/upb.hpp" #include -#include #include "src/core/ext/xds/xds_bootstrap.h" #include "src/core/ext/xds/xds_bootstrap_grpc.h" @@ -44,6 +44,7 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/resolver/server_address.h" @@ -86,9 +87,8 @@ class XdsEndpointTest : public ::testing::Test { " ]\n" "}"); if (!bootstrap.ok()) { - gpr_log(GPR_ERROR, "Error parsing bootstrap: %s", - bootstrap.status().ToString().c_str()); - GPR_ASSERT(false); + Crash(absl::StrFormat("Error parsing bootstrap: %s", + bootstrap.status().ToString().c_str())); } return MakeRefCounted(std::move(*bootstrap), /*transport_factory=*/nullptr, diff --git a/test/core/xds/xds_lb_policy_registry_test.cc b/test/core/xds/xds_lb_policy_registry_test.cc index 6bb63765d06..c2a958a04b8 100644 --- a/test/core/xds/xds_lb_policy_registry_test.cc +++ b/test/core/xds/xds_lb_policy_registry_test.cc @@ -33,10 +33,10 @@ #include "upb/upb.hpp" #include -#include #include "src/core/ext/xds/xds_bootstrap_grpc.h" #include "src/core/lib/config/core_configuration.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/validation_errors.h" @@ -89,7 +89,7 @@ class CustomLbPolicyFactory : public LoadBalancingPolicyFactory { public: OrphanablePtr CreateLoadBalancingPolicy( LoadBalancingPolicy::Args /*args*/) const override { - GPR_ASSERT(false); + Crash("unreachable"); return nullptr; } diff --git a/test/core/xds/xds_listener_resource_type_test.cc b/test/core/xds/xds_listener_resource_type_test.cc index fa2dbf4b844..73094532d6d 100644 --- a/test/core/xds/xds_listener_resource_type_test.cc +++ b/test/core/xds/xds_listener_resource_type_test.cc @@ -27,6 +27,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "absl/types/variant.h" @@ -36,7 +37,6 @@ #include "upb/upb.hpp" #include -#include #include "src/core/ext/xds/xds_bootstrap.h" #include "src/core/ext/xds/xds_bootstrap_grpc.h" @@ -46,6 +46,7 @@ #include "src/core/ext/xds/xds_resource_type.h" #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/error.h" @@ -110,9 +111,8 @@ class XdsListenerTest : public ::testing::Test { " }\n" "}"); if (!bootstrap.ok()) { - gpr_log(GPR_ERROR, "Error parsing bootstrap: %s", - bootstrap.status().ToString().c_str()); - GPR_ASSERT(false); + Crash(absl::StrFormat("Error parsing bootstrap: %s", + bootstrap.status().ToString().c_str())); } return MakeRefCounted(std::move(*bootstrap), /*transport_factory=*/nullptr, diff --git a/test/core/xds/xds_route_config_resource_type_test.cc b/test/core/xds/xds_route_config_resource_type_test.cc index f59dd250421..845c9ae28fb 100644 --- a/test/core/xds/xds_route_config_resource_type_test.cc +++ b/test/core/xds/xds_route_config_resource_type_test.cc @@ -28,6 +28,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "absl/types/variant.h" @@ -39,7 +40,6 @@ #include #include -#include #include "src/core/ext/xds/xds_bootstrap.h" #include "src/core/ext/xds/xds_bootstrap_grpc.h" @@ -48,6 +48,7 @@ #include "src/core/ext/xds/xds_route_config.h" #include "src/core/lib/channel/status_util.h" #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/error.h" @@ -97,9 +98,8 @@ class XdsRouteConfigTest : public ::testing::Test { " ]\n" "}"); if (!bootstrap.ok()) { - gpr_log(GPR_ERROR, "Error parsing bootstrap: %s", - bootstrap.status().ToString().c_str()); - GPR_ASSERT(false); + Crash(absl::StrFormat("Error parsing bootstrap: %s", + bootstrap.status().ToString().c_str())); } return MakeRefCounted(std::move(*bootstrap), /*transport_factory=*/nullptr, @@ -344,7 +344,7 @@ class TypedPerFilterConfigTest default: break; } - GPR_ASSERT(false && "unknown typed_per_filter_config scope"); + Crash("unknown typed_per_filter_config scope"); } static const XdsRouteConfigResource::TypedPerFilterConfig& @@ -365,7 +365,7 @@ class TypedPerFilterConfigTest default: break; } - GPR_ASSERT(false); + Crash("unreachable"); } static absl::string_view FieldName() { @@ -380,7 +380,7 @@ class TypedPerFilterConfigTest default: break; } - GPR_ASSERT(false); + Crash("unreachable"); } RouteConfiguration route_config_; @@ -714,7 +714,7 @@ class RetryPolicyTest : public XdsRouteConfigTest, default: break; } - GPR_ASSERT(false); + Crash("unreachable"); } RouteConfiguration route_config_; diff --git a/test/cpp/client/client_channel_stress_test.cc b/test/cpp/client/client_channel_stress_test.cc index 85d9b99e3fe..13b513e31ac 100644 --- a/test/cpp/client/client_channel_stress_test.cc +++ b/test/cpp/client/client_channel_stress_test.cc @@ -41,6 +41,7 @@ #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h" #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/lib/address_utils/parse_address.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/test/cpp/client/destroy_grpclb_channel_with_active_connect_stress_test.cc b/test/cpp/client/destroy_grpclb_channel_with_active_connect_stress_test.cc index 5d24c367cf1..d096af45862 100644 --- a/test/cpp/client/destroy_grpclb_channel_with_active_connect_stress_test.cc +++ b/test/cpp/client/destroy_grpclb_channel_with_active_connect_stress_test.cc @@ -41,6 +41,7 @@ #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/sockaddr.h" diff --git a/test/cpp/common/time_jump_test.cc b/test/cpp/common/time_jump_test.cc index 45116f1531e..5a58709afd2 100644 --- a/test/cpp/common/time_jump_test.cc +++ b/test/cpp/common/time_jump_test.cc @@ -30,6 +30,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/error.h" diff --git a/test/cpp/common/timer_test.cc b/test/cpp/common/timer_test.cc index 7b7c94f5f4e..261529df432 100644 --- a/test/cpp/common/timer_test.cc +++ b/test/cpp/common/timer_test.cc @@ -23,6 +23,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/error.h" diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 96400e4df4a..e508fd721b2 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -22,6 +22,7 @@ #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include #include @@ -36,6 +37,7 @@ #include #include "src/core/ext/filters/client_channel/backup_poller.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/iomgr/port.h" #include "src/proto/grpc/health/v1/health.grpc.pb.h" @@ -195,8 +197,7 @@ class Verifier { } maybe_expectations_.erase(it2); } else { - gpr_log(GPR_ERROR, "Unexpected tag: %p", got_tag); - abort(); + grpc_core::Crash(absl::StrFormat("Unexpected tag: %p", got_tag)); } } } diff --git a/test/cpp/end2end/cfstream_test.cc b/test/cpp/end2end/cfstream_test.cc index ed1797057c9..61627febc88 100644 --- a/test/cpp/end2end/cfstream_test.cc +++ b/test/cpp/end2end/cfstream_test.cc @@ -38,6 +38,7 @@ #include #include "src/core/lib/backoff/backoff.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/iomgr/port.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc index f1c7aead747..b24b2f06b51 100644 --- a/test/cpp/end2end/client_crash_test.cc +++ b/test/cpp/end2end/client_crash_test.cc @@ -30,6 +30,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc index 7b5092c99bf..1d518a43ff4 100644 --- a/test/cpp/end2end/client_crash_test_server.cc +++ b/test/cpp/end2end/client_crash_test_server.cc @@ -27,6 +27,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/test_config.h" diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index 293184156c4..73b5255485d 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -54,6 +54,7 @@ #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/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index fc47a0926ff..c856e146d9c 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -42,6 +42,7 @@ #include #include "src/core/ext/filters/client_channel/backup_poller.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/security/credentials/credentials.h" diff --git a/test/cpp/end2end/flaky_network_test.cc b/test/cpp/end2end/flaky_network_test.cc index 1b7af33cbce..f40f583301c 100644 --- a/test/cpp/end2end/flaky_network_test.cc +++ b/test/cpp/end2end/flaky_network_test.cc @@ -43,6 +43,7 @@ #include #include "src/core/lib/backoff/backoff.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index d157a3d61cf..45ef2877f1b 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -46,6 +46,7 @@ #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/sockaddr.h" diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index da8a633d2a9..119eddaedab 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -34,6 +34,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/health/v1/health.grpc.pb.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" diff --git a/test/cpp/end2end/interceptors_util.h b/test/cpp/end2end/interceptors_util.h index b0dd55eb504..9d130c1db23 100644 --- a/test/cpp/end2end/interceptors_util.h +++ b/test/cpp/end2end/interceptors_util.h @@ -20,8 +20,11 @@ #include +#include "absl/strings/str_format.h" + #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/string_ref_helper.h" @@ -334,8 +337,7 @@ class Verifier { EXPECT_EQ(it2->second.ok, ok); } } else { - gpr_log(GPR_ERROR, "Unexpected tag: %p", got_tag); - abort(); + grpc_core::Crash(absl::StrFormat("Unexpected tag: %p", got_tag)); } } } diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 03a451f0a60..c3819918392 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -36,6 +36,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "src/proto/grpc/testing/echo_mock.grpc.pb.h" diff --git a/test/cpp/end2end/port_sharing_end2end_test.cc b/test/cpp/end2end/port_sharing_end2end_test.cc index 4bcfc45cf2c..a02e174b5cd 100644 --- a/test/cpp/end2end/port_sharing_end2end_test.cc +++ b/test/cpp/end2end/port_sharing_end2end_test.cc @@ -34,6 +34,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/test/cpp/end2end/raw_end2end_test.cc b/test/cpp/end2end/raw_end2end_test.cc index 23d9491dc1b..2b883d0d4c0 100644 --- a/test/cpp/end2end/raw_end2end_test.cc +++ b/test/cpp/end2end/raw_end2end_test.cc @@ -33,6 +33,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/iomgr/port.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index a9b93a69ed6..20a673e5467 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -30,6 +30,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc index 66f83043ed8..db1760d393a 100644 --- a/test/cpp/end2end/server_crash_test_client.cc +++ b/test/cpp/end2end/server_crash_test_client.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/test_config.h" diff --git a/test/cpp/end2end/server_early_return_test.cc b/test/cpp/end2end/server_early_return_test.cc index abc9b0638b0..37be9e68855 100644 --- a/test/cpp/end2end/server_early_return_test.cc +++ b/test/cpp/end2end/server_early_return_test.cc @@ -31,6 +31,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/cpp/end2end/server_load_reporting_end2end_test.cc b/test/cpp/end2end/server_load_reporting_end2end_test.cc index e5def260d9c..3ee3af7b4e7 100644 --- a/test/cpp/end2end/server_load_reporting_end2end_test.cc +++ b/test/cpp/end2end/server_load_reporting_end2end_test.cc @@ -30,6 +30,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/lb/v1/load_reporter.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/service_config_end2end_test.cc b/test/cpp/end2end/service_config_end2end_test.cc index e5d5dabd31d..e4bd5d30bc8 100644 --- a/test/cpp/end2end/service_config_end2end_test.cc +++ b/test/cpp/end2end/service_config_end2end_test.cc @@ -50,6 +50,7 @@ #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/backoff/backoff.h" #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/tcp_client.h" diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index e98f5fcd7d6..ec623e8b135 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -30,6 +30,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc index bbdb76b0b41..6b5d2dadb63 100644 --- a/test/cpp/end2end/streaming_throughput_test.cc +++ b/test/cpp/end2end/streaming_throughput_test.cc @@ -36,6 +36,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc index 51409f3a231..6ba40dae6a9 100644 --- a/test/cpp/end2end/test_service_impl.cc +++ b/test/cpp/end2end/test_service_impl.cc @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/notification.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/string_ref_helper.h" diff --git a/test/cpp/end2end/test_service_impl.h b/test/cpp/end2end/test_service_impl.h index e7057833fba..0ce60738f21 100644 --- a/test/cpp/end2end/test_service_impl.h +++ b/test/cpp/end2end/test_service_impl.h @@ -33,6 +33,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/test_config.h" #include "test/cpp/util/string_ref_helper.h" diff --git a/test/cpp/end2end/time_change_test.cc b/test/cpp/end2end/time_change_test.cc index 61e4a468b08..11dced76405 100644 --- a/test/cpp/end2end/time_change_test.cc +++ b/test/cpp/end2end/time_change_test.cc @@ -34,6 +34,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/timer.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/test/cpp/end2end/xds/xds_end2end_test.cc b/test/cpp/end2end/xds/xds_end2end_test.cc index 2e53481b99d..e2c5a303bde 100644 --- a/test/cpp/end2end/xds/xds_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_end2end_test.cc @@ -72,6 +72,7 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gpr/tmpfile.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/sync.h" diff --git a/test/cpp/end2end/xds/xds_server.cc b/test/cpp/end2end/xds/xds_server.cc index a1dd6d8ac13..79e4a00b287 100644 --- a/test/cpp/end2end/xds/xds_server.cc +++ b/test/cpp/end2end/xds/xds_server.cc @@ -30,6 +30,7 @@ #include #include "src/core/lib/address_utils/parse_address.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/proto/grpc/testing/xds/v3/ads.grpc.pb.h" #include "src/proto/grpc/testing/xds/v3/discovery.grpc.pb.h" diff --git a/test/cpp/end2end/xds/xds_server.h b/test/cpp/end2end/xds/xds_server.h index 6fe71673964..fa21ad08768 100644 --- a/test/cpp/end2end/xds/xds_server.h +++ b/test/cpp/end2end/xds/xds_server.h @@ -31,6 +31,7 @@ #include #include "src/core/lib/address_utils/parse_address.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" #include "src/proto/grpc/testing/xds/v3/ads.grpc.pb.h" #include "src/proto/grpc/testing/xds/v3/cluster.grpc.pb.h" diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 0c4a8c45afc..bf3b86a41fa 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -28,6 +28,7 @@ #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" #include "test/cpp/interop/client_helper.h" #include "test/cpp/interop/interop_client.h" diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index 640a906e765..1ffec938c04 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -33,6 +33,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/slice/b64.h" #include "src/cpp/client/secure_credentials.h" #include "test/core/security/oauth2_utils.h" diff --git a/test/cpp/interop/grpclb_fallback_test.cc b/test/cpp/interop/grpclb_fallback_test.cc index d56c505c8b3..39f008eb216 100644 --- a/test/cpp/interop/grpclb_fallback_test.cc +++ b/test/cpp/interop/grpclb_fallback_test.cc @@ -33,6 +33,7 @@ #include #include "absl/flags/flag.h" +#include "absl/strings/str_format.h" #include "absl/time/time.h" #include @@ -43,6 +44,7 @@ #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/port.h" #include "src/core/lib/iomgr/socket_mutator.h" #include "src/proto/grpc/testing/empty.pb.h" @@ -126,15 +128,13 @@ bool TcpUserTimeoutMutateFd(int fd, grpc_socket_mutator* /*mutator*/) { gpr_log(GPR_INFO, "Setting socket option TCP_USER_TIMEOUT on fd: %d", fd); if (0 != setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &timeout, sizeof(timeout))) { - gpr_log(GPR_ERROR, "Failed to set socket option TCP_USER_TIMEOUT"); - abort(); + grpc_core::Crash("Failed to set socket option TCP_USER_TIMEOUT"); } int newval; socklen_t len = sizeof(newval); if (0 != getsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &newval, &len) || newval != timeout) { - gpr_log(GPR_ERROR, "Failed to get expected socket option TCP_USER_TIMEOUT"); - abort(); + grpc_core::Crash("Failed to get expected socket option TCP_USER_TIMEOUT"); } return true; } @@ -171,13 +171,13 @@ void RunCommand(const std::string& command) { if (WIFEXITED(out)) { int code = WEXITSTATUS(out); if (code != 0) { - gpr_log(GPR_ERROR, "RunCommand failed exit code:%d command:|%s|", code, - command.c_str()); - abort(); + grpc_core::Crash( + absl::StrFormat("RunCommand failed exit code:%d command:|%s|", code, + command.c_str())); } } else { - gpr_log(GPR_ERROR, "RunCommand failed command:|%s|", command.c_str()); - abort(); + grpc_core::Crash( + absl::StrFormat("RunCommand failed command:|%s|", command.c_str())); } } @@ -245,9 +245,8 @@ int main(int argc, char** argv) { DoFallbackAfterStartupTest(); gpr_log(GPR_INFO, "DoFallbackBeforeStartup done!"); } else { - gpr_log(GPR_ERROR, "Invalid test case: %s", - absl::GetFlag(FLAGS_test_case).c_str()); - abort(); + grpc_core::Crash(absl::StrFormat("Invalid test case: %s", + absl::GetFlag(FLAGS_test_case).c_str())); } } @@ -255,9 +254,8 @@ int main(int argc, char** argv) { int main(int argc, char** argv) { grpc::testing::InitTest(&argc, &argv, true); - gpr_log(GPR_ERROR, - "This test requires TCP_USER_TIMEOUT, which isn't available"); - abort(); + grpc_core::Crash( + "This test requires TCP_USER_TIMEOUT, which isn't available"); } #endif // SOCKET_SUPPORTS_TCP_USER_TIMEOUT diff --git a/test/cpp/interop/http2_client.cc b/test/cpp/interop/http2_client.cc index 69fe14dbbc3..cbd717ebd69 100644 --- a/test/cpp/interop/http2_client.cc +++ b/test/cpp/interop/http2_client.cc @@ -21,6 +21,7 @@ #include #include "absl/flags/flag.h" +#include "absl/strings/str_format.h" #include #include @@ -29,6 +30,7 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/messages.pb.h" #include "src/proto/grpc/testing/test.grpc.pb.h" #include "test/cpp/util/create_test_channel.h" @@ -59,9 +61,9 @@ bool Http2Client::AssertStatusCode(const Status& s, StatusCode expected_code) { return true; } - gpr_log(GPR_ERROR, "Error status code: %d (expected: %d), message: %s", - s.error_code(), expected_code, s.error_message().c_str()); - abort(); + grpc_core::Crash(absl::StrFormat( + "Error status code: %d (expected: %d), message: %s", s.error_code(), + expected_code, s.error_message().c_str())); } Status Http2Client::SendUnaryCall(SimpleResponse* response) { diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 123c08a6258..ccab7a36273 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -37,6 +37,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/empty.pb.h" #include "src/proto/grpc/testing/messages.pb.h" #include "src/proto/grpc/testing/test.grpc.pb.h" @@ -68,10 +69,9 @@ void UnaryCompressionChecks(const InteropClientContextInspector& inspector, if (request->response_compressed().value()) { if (received_compression == GRPC_COMPRESS_NONE) { // Requested some compression, got NONE. This is an error. - gpr_log(GPR_ERROR, - "Failure: Requested compression but got uncompressed response " - "from server."); - abort(); + grpc_core::Crash( + "Failure: Requested compression but got uncompressed response " + "from server."); } GPR_ASSERT(inspector.WasCompressed()); } else { diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc index a4807ff77f7..94610a4f8f9 100644 --- a/test/cpp/interop/interop_server.cc +++ b/test/cpp/interop/interop_server.cc @@ -32,6 +32,7 @@ #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/empty.pb.h" #include "src/proto/grpc/testing/messages.pb.h" #include "src/proto/grpc/testing/test.grpc.pb.h" diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc index 33bb29eafac..e838e54224c 100644 --- a/test/cpp/interop/interop_test.cc +++ b/test/cpp/interop/interop_test.cc @@ -35,6 +35,7 @@ #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/socket_utils_posix.h" #include "test/core/util/port.h" #include "test/cpp/util/test_config.h" diff --git a/test/cpp/interop/istio_echo_server_test.cc b/test/cpp/interop/istio_echo_server_test.cc index 3852b6c931d..0499ee48463 100644 --- a/test/cpp/interop/istio_echo_server_test.cc +++ b/test/cpp/interop/istio_echo_server_test.cc @@ -27,6 +27,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -51,7 +52,7 @@ class SimpleEchoTestServerImpl : public proto::EchoTestService::Service { grpc::Status Echo(grpc::ServerContext* /* context */, const proto::EchoRequest* /* request */, proto::EchoResponse* /* response */) override { - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); return Status(StatusCode::INVALID_ARGUMENT, "Unexpected"); } diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc index 0221814f636..853c04a9c17 100644 --- a/test/cpp/interop/metrics_client.cc +++ b/test/cpp/interop/metrics_client.cc @@ -24,6 +24,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/metrics.grpc.pb.h" #include "src/proto/grpc/testing/metrics.pb.h" #include "test/cpp/util/metrics_server.h" diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc index c794f8ce67f..67389299c9d 100644 --- a/test/cpp/interop/reconnect_interop_client.cc +++ b/test/cpp/interop/reconnect_interop_client.cc @@ -27,6 +27,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/empty.pb.h" #include "src/proto/grpc/testing/messages.pb.h" #include "src/proto/grpc/testing/test.grpc.pb.h" diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc index 680ad50e499..c37fdc4c858 100644 --- a/test/cpp/interop/reconnect_interop_server.cc +++ b/test/cpp/interop/reconnect_interop_server.cc @@ -33,6 +33,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/empty.pb.h" #include "src/proto/grpc/testing/messages.pb.h" #include "src/proto/grpc/testing/test.grpc.pb.h" diff --git a/test/cpp/interop/stress_interop_client.cc b/test/cpp/interop/stress_interop_client.cc index c4530a08006..3c537b4f709 100644 --- a/test/cpp/interop/stress_interop_client.cc +++ b/test/cpp/interop/stress_interop_client.cc @@ -22,9 +22,12 @@ #include #include +#include "absl/strings/str_format.h" + #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/cpp/interop/interop_client.h" #include "test/cpp/util/metrics_server.h" @@ -186,8 +189,7 @@ bool StressTestInteropClient::RunTest(TestCaseType test_case) { break; } default: { - gpr_log(GPR_ERROR, "Invalid test case (%d)", test_case); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("Invalid test case (%d)", test_case)); break; } } diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index 659a54eff3c..e3b458fa5be 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -29,6 +29,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/metrics.grpc.pb.h" #include "src/proto/grpc/testing/metrics.pb.h" #include "test/cpp/interop/interop_client.h" diff --git a/test/cpp/interop/xds_interop_server.cc b/test/cpp/interop/xds_interop_server.cc index 0f2a90e3316..ed3c2909b81 100644 --- a/test/cpp/interop/xds_interop_server.cc +++ b/test/cpp/interop/xds_interop_server.cc @@ -34,6 +34,7 @@ #include #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/gethostname.h" #include "src/core/lib/transport/transport.h" #include "src/proto/grpc/testing/empty.pb.h" diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 2c420d0f067..4163b7ed3f1 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -31,6 +31,7 @@ #include "src/core/ext/transport/chttp2/transport/hpack_encoder.h" #include "src/core/ext/transport/chttp2/transport/hpack_parser.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/resource_quota/resource_quota.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index e2f84500f06..420b47502de 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -33,6 +33,7 @@ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/ext/transport/chttp2/transport/internal.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/resource_quota/api.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 29a1ddaaf33..017dbba47b3 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -26,6 +26,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/surface/completion_queue.h" #include "test/core/util/test_config.h" #include "test/cpp/microbenchmarks/helpers.h" diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index e2ad03f4cb7..bdfa8a34438 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -26,6 +26,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/port.h" diff --git a/test/cpp/microbenchmarks/bm_event_engine_run.cc b/test/cpp/microbenchmarks/bm_event_engine_run.cc index cbe8eaac61d..77dd40fb85f 100644 --- a/test/cpp/microbenchmarks/bm_event_engine_run.cc +++ b/test/cpp/microbenchmarks/bm_event_engine_run.cc @@ -21,6 +21,7 @@ #include "absl/debugging/leak_check.h" #include "absl/functional/any_invocable.h" +#include "absl/strings/str_format.h" #include #include @@ -213,8 +214,8 @@ void ClosureFanOutCallback(EventEngine::Closure* child_closure, return; } if (local_cnt > params.limit) { - gpr_log(GPR_ERROR, "Ran too many closures: %d/%d", local_cnt, params.limit); - abort(); + grpc_core::Crash(absl::StrFormat("Ran too many closures: %d/%d", local_cnt, + params.limit)); } if (child_closure == nullptr) return; for (int i = 0; i < params.fanout; i++) { diff --git a/test/cpp/microbenchmarks/bm_pollset.cc b/test/cpp/microbenchmarks/bm_pollset.cc index b3ea49f1f64..a9955d2dbb4 100644 --- a/test/cpp/microbenchmarks/bm_pollset.cc +++ b/test/cpp/microbenchmarks/bm_pollset.cc @@ -27,6 +27,7 @@ #include #include "src/core/lib/gpr/useful.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/pollset.h" diff --git a/test/cpp/microbenchmarks/bm_thread_pool.cc b/test/cpp/microbenchmarks/bm_thread_pool.cc index db8def90d6a..4613a5129c6 100644 --- a/test/cpp/microbenchmarks/bm_thread_pool.cc +++ b/test/cpp/microbenchmarks/bm_thread_pool.cc @@ -20,6 +20,7 @@ #include #include "absl/functional/any_invocable.h" +#include "absl/strings/str_format.h" #include @@ -184,8 +185,8 @@ void ClosureFanOutCallback(EventEngine::Closure* child_closure, return; } if (local_cnt > params.limit) { - gpr_log(GPR_ERROR, "Ran too many closures: %d/%d", local_cnt, params.limit); - abort(); + grpc_core::Crash(absl::StrFormat("Ran too many closures: %d/%d", local_cnt, + params.limit)); } if (child_closure == nullptr) return; for (int i = 0; i < params.fanout; i++) { diff --git a/test/cpp/microbenchmarks/bm_work_queue.cc b/test/cpp/microbenchmarks/bm_work_queue.cc index d0ed7fb4123..3ed1ca0a39b 100644 --- a/test/cpp/microbenchmarks/bm_work_queue.cc +++ b/test/cpp/microbenchmarks/bm_work_queue.cc @@ -27,6 +27,7 @@ #include "src/core/lib/event_engine/common_closures.h" #include "src/core/lib/event_engine/work_queue.h" +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" namespace { diff --git a/test/cpp/microbenchmarks/fullstack_context_mutators.h b/test/cpp/microbenchmarks/fullstack_context_mutators.h index 0d49408b756..2fbb64c4779 100644 --- a/test/cpp/microbenchmarks/fullstack_context_mutators.h +++ b/test/cpp/microbenchmarks/fullstack_context_mutators.h @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/cpp/microbenchmarks/helpers.h" namespace grpc { diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index cb71c28aad1..51d0421e5c6 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -31,6 +31,7 @@ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/test/cpp/microbenchmarks/fullstack_streaming_pump.h b/test/cpp/microbenchmarks/fullstack_streaming_pump.h index d153c9314f1..78ad2cebc7d 100644 --- a/test/cpp/microbenchmarks/fullstack_streaming_pump.h +++ b/test/cpp/microbenchmarks/fullstack_streaming_pump.h @@ -77,7 +77,7 @@ static void BM_PumpStreamClientToServer(benchmark::State& state) { } else if (t == tag(1)) { break; } else { - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); } } } @@ -144,7 +144,7 @@ static void BM_PumpStreamServerToClient(benchmark::State& state) { } else if (t == tag(1)) { break; } else { - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); } } } diff --git a/test/cpp/naming/address_sorting_test.cc b/test/cpp/naming/address_sorting_test.cc index e9a6af1c68e..6186964fed7 100644 --- a/test/cpp/naming/address_sorting_test.cc +++ b/test/cpp/naming/address_sorting_test.cc @@ -37,6 +37,7 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/executor.h" diff --git a/test/cpp/naming/cancel_ares_query_test.cc b/test/cpp/naming/cancel_ares_query_test.cc index d413b753e22..ebb542e4c29 100644 --- a/test/cpp/naming/cancel_ares_query_test.cc +++ b/test/cpp/naming/cancel_ares_query_test.cc @@ -40,6 +40,7 @@ #include "src/core/lib/debug/stats_data.h" #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/gprpp/work_serializer.h" @@ -151,7 +152,7 @@ class AssertFailureResultHandler : public grpc_core::Resolver::ResultHandler { } void ReportResult(grpc_core::Resolver::Result /*result*/) override { - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); } private: @@ -198,8 +199,7 @@ class CancelDuringAresQuery : public ::testing::Test { static void TearDownTestSuite() { grpc_shutdown(); if (gpr_time_cmp(gpr_now(GPR_CLOCK_MONOTONIC), overall_deadline) > 0) { - gpr_log(GPR_ERROR, "Test took too long"); - abort(); + grpc_core::Crash("Test took too long"); } } diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc index e73ccd1e56a..2d9dd2e2e56 100644 --- a/test/cpp/naming/resolver_component_test.cc +++ b/test/cpp/naming/resolver_component_test.cc @@ -49,6 +49,7 @@ #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/work_serializer.h" @@ -159,11 +160,10 @@ vector ParseExpectedAddrs(std::string expected_addrs) { // get the next , (v4 or v6) size_t next_comma = expected_addrs.find(','); if (next_comma == std::string::npos) { - gpr_log(GPR_ERROR, - "Missing ','. Expected_addrs arg should be a semicolon-separated " - "list of , pairs. Left-to-be-parsed arg is |%s|", - expected_addrs.c_str()); - abort(); + grpc_core::Crash(absl::StrFormat( + "Missing ','. Expected_addrs arg should be a semicolon-separated " + "list of , pairs. Left-to-be-parsed arg is |%s|", + expected_addrs.c_str())); } std::string next_addr = expected_addrs.substr(0, next_comma); expected_addrs = expected_addrs.substr(next_comma + 1, std::string::npos); @@ -180,10 +180,9 @@ vector ParseExpectedAddrs(std::string expected_addrs) { expected_addrs.substr(next_semicolon + 1, std::string::npos); } if (out.empty()) { - gpr_log(GPR_ERROR, - "expected_addrs arg should be a semicolon-separated list of " - ", pairs"); - abort(); + grpc_core::Crash( + "expected_addrs arg should be a semicolon-separated list of " + ", pairs"); } return out; } @@ -476,11 +475,10 @@ class CheckingResultHandler : public ResultHandler { result.addresses->size(), balancer_addresses == nullptr ? 0L : balancer_addresses->size()); if (args->expected_addrs.size() != found_lb_addrs.size()) { - gpr_log(GPR_DEBUG, - "found lb addrs size is: %" PRIdPTR - ". expected addrs size is %" PRIdPTR, - found_lb_addrs.size(), args->expected_addrs.size()); - abort(); + grpc_core::Crash(absl::StrFormat("found lb addrs size is: %" PRIdPTR + ". expected addrs size is %" PRIdPTR, + found_lb_addrs.size(), + args->expected_addrs.size())); } if (absl::GetFlag(FLAGS_do_ordered_address_comparison) == "True") { EXPECT_EQ(args->expected_addrs, found_lb_addrs); @@ -601,8 +599,7 @@ void RunResolvesRelevantRecordsTest( absl::GetFlag(FLAGS_local_dns_server_address), absl::GetFlag(FLAGS_target_name)); } else { - gpr_log(GPR_DEBUG, "Invalid value for --inject_broken_nameserver_list."); - abort(); + grpc_core::Crash("Invalid value for --inject_broken_nameserver_list."); } gpr_log(GPR_DEBUG, "resolver_component_test: --enable_srv_queries: %s", absl::GetFlag(FLAGS_enable_srv_queries).c_str()); @@ -612,8 +609,7 @@ void RunResolvesRelevantRecordsTest( if (absl::GetFlag(FLAGS_enable_srv_queries) == "True") { resolver_args = resolver_args.Set(GRPC_ARG_DNS_ENABLE_SRV_QUERIES, true); } else if (absl::GetFlag(FLAGS_enable_srv_queries) != "False") { - gpr_log(GPR_DEBUG, "Invalid value for --enable_srv_queries."); - abort(); + grpc_core::Crash("Invalid value for --enable_srv_queries."); } gpr_log(GPR_DEBUG, "resolver_component_test: --enable_txt_queries: %s", absl::GetFlag(FLAGS_enable_txt_queries).c_str()); @@ -628,8 +624,7 @@ void RunResolvesRelevantRecordsTest( resolver_args = resolver_args.Set(GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION, false); } else if (absl::GetFlag(FLAGS_enable_txt_queries) != "False") { - gpr_log(GPR_DEBUG, "Invalid value for --enable_txt_queries."); - abort(); + grpc_core::Crash("Invalid value for --enable_txt_queries."); } resolver_args = resolver_args.SetObject(GetDefaultEventEngine()); // create resolver and resolve @@ -682,8 +677,7 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); grpc::testing::InitTest(&argc, &argv, true); if (absl::GetFlag(FLAGS_target_name).empty()) { - gpr_log(GPR_ERROR, "Missing target_name param."); - abort(); + grpc_core::Crash("Missing target_name param."); } auto result = RUN_ALL_TESTS(); grpc_shutdown(); diff --git a/test/cpp/naming/resolver_component_tests_runner_invoker.cc b/test/cpp/naming/resolver_component_tests_runner_invoker.cc index 8adeca0c75e..1415e3ea0bf 100644 --- a/test/cpp/naming/resolver_component_tests_runner_invoker.cc +++ b/test/cpp/naming/resolver_component_tests_runner_invoker.cc @@ -25,12 +25,15 @@ #include #include "absl/flags/flag.h" +#include "absl/strings/str_format.h" #include #include #include #include +#include "src/core/lib/gprpp/crash.h" + #ifdef __FreeBSD__ #include #endif @@ -88,21 +91,18 @@ void InvokeResolverComponentTestsRunner( int status = test_driver->Join(); if (WIFEXITED(status)) { if (WEXITSTATUS(status)) { - gpr_log(GPR_INFO, - "Resolver component test test-runner exited with code %d", - WEXITSTATUS(status)); - abort(); + grpc_core::Crash(absl::StrFormat( + "Resolver component test test-runner exited with code %d", + WEXITSTATUS(status))); } } else if (WIFSIGNALED(status)) { - gpr_log(GPR_INFO, - "Resolver component test test-runner ended from signal %d", - WTERMSIG(status)); - abort(); + grpc_core::Crash(absl::StrFormat( + "Resolver component test test-runner ended from signal %d", + WTERMSIG(status))); } else { - gpr_log(GPR_INFO, - "Resolver component test test-runner ended with unknown status %d", - status); - abort(); + grpc_core::Crash(absl::StrFormat( + "Resolver component test test-runner ended with unknown status %d", + status)); } gpr_mu_lock(&test_driver_mu); gpr_cv_signal(&test_driver_cv); diff --git a/test/cpp/performance/writes_per_rpc_test.cc b/test/cpp/performance/writes_per_rpc_test.cc index 20d4378f893..31a52524f9f 100644 --- a/test/cpp/performance/writes_per_rpc_test.cc +++ b/test/cpp/performance/writes_per_rpc_test.cc @@ -30,6 +30,7 @@ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/test/cpp/qps/benchmark_config.cc b/test/cpp/qps/benchmark_config.cc index 75bcda071b9..3f05f3142eb 100644 --- a/test/cpp/qps/benchmark_config.cc +++ b/test/cpp/qps/benchmark_config.cc @@ -24,6 +24,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/cpp/util/test_credentials_provider.h" ABSL_FLAG(bool, enable_log_reporter, true, diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index cff54595cfe..e87cddca064 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -31,6 +31,7 @@ #include "absl/memory/memory.h" #include "absl/strings/match.h" +#include "absl/strings/str_format.h" #include #include @@ -39,6 +40,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/proto/grpc/testing/benchmark_service.grpc.pb.h" #include "src/proto/grpc/testing/payloads.pb.h" @@ -62,7 +64,7 @@ class ClientRequestCreator { // this template must be specialized // fail with an assertion rather than a compile-time // check since these only happen at the beginning anyway - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); } }; @@ -72,10 +74,10 @@ class ClientRequestCreator { ClientRequestCreator(SimpleRequest* req, const PayloadConfig& payload_config) { if (payload_config.has_bytebuf_params()) { - gpr_log(GPR_ERROR, - "Invalid PayloadConfig, config cannot have bytebuf_params: %s", - payload_config.DebugString().c_str()); - GPR_ASSERT(false); // not appropriate for this specialization + grpc_core::Crash(absl::StrFormat( + "Invalid PayloadConfig, config cannot have bytebuf_params: %s", + payload_config.DebugString() + .c_str())); // not appropriate for this specialization } else if (payload_config.has_simple_params()) { req->set_response_type(grpc::testing::PayloadType::COMPRESSABLE); req->set_response_size(payload_config.simple_params().resp_size()); @@ -85,10 +87,10 @@ class ClientRequestCreator { std::unique_ptr body(new char[size]); req->mutable_payload()->set_body(body.get(), size); } else if (payload_config.has_complex_params()) { - gpr_log(GPR_ERROR, - "Invalid PayloadConfig, cannot have complex_params: %s", - payload_config.DebugString().c_str()); - GPR_ASSERT(false); // not appropriate for this specialization + grpc_core::Crash(absl::StrFormat( + "Invalid PayloadConfig, cannot have complex_params: %s", + payload_config.DebugString() + .c_str())); // not appropriate for this specialization } else { // default should be simple proto without payloads req->set_response_type(grpc::testing::PayloadType::COMPRESSABLE); @@ -111,9 +113,10 @@ class ClientRequestCreator { Slice slice(buf.get(), req_sz); *req = ByteBuffer(&slice, 1); } else { - gpr_log(GPR_ERROR, "Invalid PayloadConfig, missing bytebug_params: %s", - payload_config.DebugString().c_str()); - GPR_ASSERT(false); // not appropriate for this specialization + grpc_core::Crash(absl::StrFormat( + "Invalid PayloadConfig, missing bytebug_params: %s", + payload_config.DebugString() + .c_str())); // not appropriate for this specialization } } }; @@ -371,7 +374,7 @@ class Client { num_threads); break; default: - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); } // Set closed_loop_ based on whether or not random_dist is set @@ -487,9 +490,8 @@ class ClientImpl : public Client { cq.Next(&tag, &ok); Channel* channel = static_cast(tag); if (!ok) { - gpr_log(GPR_ERROR, "Channel %p failed to connect within the deadline", - channel); - abort(); + grpc_core::Crash(absl::StrFormat( + "Channel %p failed to connect within the deadline", channel)); } else { grpc_connectivity_state last_observed = channel->GetState(true); if (last_observed == GRPC_CHANNEL_READY) { diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index d6c8354e617..e7ca9061efb 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -37,6 +37,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/surface/completion_queue.h" #include "src/proto/grpc/testing/benchmark_service.grpc.pb.h" #include "test/cpp/qps/client.h" @@ -106,7 +107,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { next_state_ = State::INVALID; return false; default: - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); return false; } } @@ -420,7 +421,7 @@ class ClientRpcContextStreamingPingPongImpl : public ClientRpcContext { return false; break; default: - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); return false; } } @@ -576,7 +577,7 @@ class ClientRpcContextStreamingFromClientImpl : public ClientRpcContext { next_state_ = State::STREAM_IDLE; break; // loop around default: - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); return false; } } @@ -697,7 +698,7 @@ class ClientRpcContextStreamingFromServerImpl : public ClientRpcContext { next_state_ = State::STREAM_IDLE; break; // loop around default: - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); return false; } } @@ -841,7 +842,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { next_state_ = State::INVALID; return false; default: - GPR_ASSERT(false); + grpc_core::Crash("unreachable"); return false; } } diff --git a/test/cpp/qps/client_callback.cc b/test/cpp/qps/client_callback.cc index 1b6414a8448..ff4ffbf07aa 100644 --- a/test/cpp/qps/client_callback.cc +++ b/test/cpp/qps/client_callback.cc @@ -34,6 +34,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/benchmark_service.grpc.pb.h" #include "test/cpp/qps/client.h" #include "test/cpp/qps/usage_timer.h" diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 86c32e67924..b99d2bd1ddb 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -33,6 +33,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/benchmark_service.grpc.pb.h" #include "test/cpp/qps/client.h" #include "test/cpp/qps/interarrival.h" diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index f33568d3158..09571ddde6c 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -34,6 +34,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/host_port.h" #include "src/proto/grpc/testing/worker_service.grpc.pb.h" @@ -240,12 +241,10 @@ static void FinishClients(const std::vector& clients, for (size_t i = 0, i_end = clients.size(); i < i_end; i++) { auto client = &clients[i]; if (!client->stream->Write(client_mark)) { - gpr_log(GPR_ERROR, "Couldn't write mark to client %zu", i); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("Couldn't write mark to client %zu", i)); } if (!client->stream->WritesDone()) { - gpr_log(GPR_ERROR, "Failed WritesDone for client %zu", i); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("Failed WritesDone for client %zu", i)); } } } @@ -275,8 +274,8 @@ static void ReceiveFinalStatusFromClients( // where the shutdown delay pretty much determines the wait here. GPR_ASSERT(!client->stream->Read(&client_status)); } else { - gpr_log(GPR_ERROR, "Couldn't get final status from client %zu", i); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Couldn't get final status from client %zu", i)); } } } @@ -293,9 +292,8 @@ static void ShutdownClients(const std::vector& clients, const bool success = IsSuccess(s); result.add_client_success(success); if (!success) { - gpr_log(GPR_ERROR, "Client %zu had an error %s", i, - s.error_message().c_str()); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("Client %zu had an error %s", i, + s.error_message().c_str())); } } } @@ -306,12 +304,10 @@ static void FinishServers(const std::vector& servers, for (size_t i = 0, i_end = servers.size(); i < i_end; i++) { auto server = &servers[i]; if (!server->stream->Write(server_mark)) { - gpr_log(GPR_ERROR, "Couldn't write mark to server %zu", i); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("Couldn't write mark to server %zu", i)); } if (!server->stream->WritesDone()) { - gpr_log(GPR_ERROR, "Failed WritesDone for server %zu", i); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("Failed WritesDone for server %zu", i)); } } } @@ -330,8 +326,8 @@ static void ReceiveFinalStatusFromServer(const std::vector& servers, // That final status should be the last message on the server stream GPR_ASSERT(!server->stream->Read(&server_status)); } else { - gpr_log(GPR_ERROR, "Couldn't get final status from server %zu", i); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Couldn't get final status from server %zu", i)); } } } @@ -348,9 +344,8 @@ static void ShutdownServers(const std::vector& servers, const bool success = IsSuccess(s); result.add_server_success(success); if (!success) { - gpr_log(GPR_ERROR, "Server %zu had an error %s", i, - s.error_message().c_str()); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("Server %zu had an error %s", i, + s.error_message().c_str())); } } } @@ -449,22 +444,20 @@ std::unique_ptr RunScenario( const ServerConfig& server_config = initial_server_config; if (server_config.core_limit() != 0) { - gpr_log(GPR_ERROR, - "server config core limit is set but ignored by driver"); - GPR_ASSERT(false); + grpc_core::Crash("server config core limit is set but ignored by driver"); } ServerArgs args; *args.mutable_setup() = server_config; servers[i].stream = servers[i].stub->RunServer(alloc_context(&contexts)); if (!servers[i].stream->Write(args)) { - gpr_log(GPR_ERROR, "Could not write args to server %zu", i); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Could not write args to server %zu", i)); } ServerStatus init_status; if (!servers[i].stream->Read(&init_status)) { - gpr_log(GPR_ERROR, "Server %zu did not yield initial status", i); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Server %zu did not yield initial status", i)); } if (run_inproc) { std::string cli_target(INPROC_NAME_PREFIX); @@ -508,8 +501,7 @@ std::unique_ptr RunScenario( ClientConfig per_client_config = client_config; if (initial_client_config.core_limit() != 0) { - gpr_log(GPR_ERROR, "client config core limit set but ignored"); - GPR_ASSERT(false); + grpc_core::Crash("client config core limit set but ignored"); } // Reduce channel count so that total channels specified is held regardless @@ -526,16 +518,16 @@ std::unique_ptr RunScenario( *args.mutable_setup() = per_client_config; clients[i].stream = clients[i].stub->RunClient(alloc_context(&contexts)); if (!clients[i].stream->Write(args)) { - gpr_log(GPR_ERROR, "Could not write args to client %zu", i); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Could not write args to client %zu", i)); } } for (size_t i = 0; i < num_clients; i++) { ClientStatus init_status; if (!clients[i].stream->Read(&init_status)) { - gpr_log(GPR_ERROR, "Client %zu did not yield initial status", i); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Client %zu did not yield initial status", i)); } } @@ -551,15 +543,14 @@ std::unique_ptr RunScenario( for (size_t i = 0; i < num_clients; i++) { auto client = &clients[i]; if (!client->stream->Write(client_mark)) { - gpr_log(GPR_ERROR, "Couldn't write mark to client %zu", i); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("Couldn't write mark to client %zu", i)); } } for (size_t i = 0; i < num_clients; i++) { auto client = &clients[i]; if (!client->stream->Read(&client_status)) { - gpr_log(GPR_ERROR, "Couldn't get status from client %zu", i); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Couldn't get status from client %zu", i)); } } @@ -577,29 +568,27 @@ std::unique_ptr RunScenario( for (size_t i = 0; i < num_servers; i++) { auto server = &servers[i]; if (!server->stream->Write(server_mark)) { - gpr_log(GPR_ERROR, "Couldn't write mark to server %zu", i); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("Couldn't write mark to server %zu", i)); } } for (size_t i = 0; i < num_clients; i++) { auto client = &clients[i]; if (!client->stream->Write(client_mark)) { - gpr_log(GPR_ERROR, "Couldn't write mark to client %zu", i); - GPR_ASSERT(false); + grpc_core::Crash(absl::StrFormat("Couldn't write mark to client %zu", i)); } } for (size_t i = 0; i < num_servers; i++) { auto server = &servers[i]; if (!server->stream->Read(&server_status)) { - gpr_log(GPR_ERROR, "Couldn't get status from server %zu", i); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Couldn't get status from server %zu", i)); } } for (size_t i = 0; i < num_clients; i++) { auto client = &clients[i]; if (!client->stream->Read(&client_status)) { - gpr_log(GPR_ERROR, "Couldn't get status from client %zu", i); - GPR_ASSERT(false); + grpc_core::Crash( + absl::StrFormat("Couldn't get status from client %zu", i)); } } diff --git a/test/cpp/qps/inproc_sync_unary_ping_pong_test.cc b/test/cpp/qps/inproc_sync_unary_ping_pong_test.cc index 31dfa2541e6..784622b918a 100644 --- a/test/cpp/qps/inproc_sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/inproc_sync_unary_ping_pong_test.cc @@ -20,6 +20,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" #include "test/cpp/qps/benchmark_config.h" #include "test/cpp/qps/driver.h" diff --git a/test/cpp/qps/json_run_localhost.cc b/test/cpp/qps/json_run_localhost.cc index 0e8828b11ad..a36847d079f 100644 --- a/test/cpp/qps/json_run_localhost.cc +++ b/test/cpp/qps/json_run_localhost.cc @@ -30,6 +30,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" #include "test/core/util/port.h" #include "test/cpp/util/subprocess.h" diff --git a/test/cpp/qps/parse_json.cc b/test/cpp/qps/parse_json.cc index 6300d04bc7c..889d5070175 100644 --- a/test/cpp/qps/parse_json.cc +++ b/test/cpp/qps/parse_json.cc @@ -20,8 +20,12 @@ #include +#include "absl/strings/str_format.h" + #include +#include "src/core/lib/gprpp/crash.h" + namespace grpc { namespace testing { @@ -37,8 +41,7 @@ void ParseJson(const std::string& json, const std::string& type, std::string errmsg(status.message()); gpr_log(GPR_ERROR, "Failed to convert json to binary: errcode=%d msg=%s", status.code(), errmsg.c_str()); - gpr_log(GPR_ERROR, "JSON: %s", json.c_str()); - abort(); + grpc_core::Crash(absl::StrFormat("JSON: %s", json.c_str())); } GPR_ASSERT(msg->ParseFromString(binary)); } diff --git a/test/cpp/qps/qps_json_driver.cc b/test/cpp/qps/qps_json_driver.cc index 9984a4bd05b..07975a351bf 100644 --- a/test/cpp/qps/qps_json_driver.cc +++ b/test/cpp/qps/qps_json_driver.cc @@ -26,6 +26,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" #include "test/cpp/qps/benchmark_config.h" #include "test/cpp/qps/driver.h" @@ -111,9 +112,7 @@ ConstructPerWorkerCredentialTypesMap() { std::string addr = next_entry.substr(0, comma); std::string cred_type = next_entry.substr(comma + 1, std::string::npos); if (out.find(addr) != out.end()) { - gpr_log(GPR_ERROR, - "Found duplicate addr in per_worker_credential_types."); - abort(); + grpc_core::Crash("Found duplicate addr in per_worker_credential_types."); } out[addr] = cred_type; } @@ -236,10 +235,9 @@ static bool QpsDriver() { if ((!scfile && !scjson && !absl::GetFlag(FLAGS_quit)) || (scfile && (scjson || absl::GetFlag(FLAGS_quit))) || (scjson && absl::GetFlag(FLAGS_quit))) { - gpr_log(GPR_ERROR, - "Exactly one of --scenarios_file, --scenarios_json, " - "or --quit must be set"); - abort(); + grpc_core::Crash( + "Exactly one of --scenarios_file, --scenarios_json, " + "or --quit must be set"); } auto per_worker_credential_types = ConstructPerWorkerCredentialTypesMap(); diff --git a/test/cpp/qps/qps_openloop_test.cc b/test/cpp/qps/qps_openloop_test.cc index 33ff1b726a7..a7764242958 100644 --- a/test/cpp/qps/qps_openloop_test.cc +++ b/test/cpp/qps/qps_openloop_test.cc @@ -20,6 +20,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" #include "test/cpp/qps/benchmark_config.h" #include "test/cpp/qps/driver.h" diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index d3c0630fe12..c9988c7399a 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -36,6 +36,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/proto/grpc/testing/worker_service.grpc.pb.h" #include "test/core/util/grpc_profiler.h" diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc index a57a45d36e6..87ae89f0f2e 100644 --- a/test/cpp/qps/report.cc +++ b/test/cpp/qps/report.cc @@ -23,6 +23,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/report_qps_scenario_service.grpc.pb.h" #include "test/cpp/qps/driver.h" #include "test/cpp/qps/parse_json.h" diff --git a/test/cpp/qps/secure_sync_unary_ping_pong_test.cc b/test/cpp/qps/secure_sync_unary_ping_pong_test.cc index 388ad91eb32..3a272a36687 100644 --- a/test/cpp/qps/secure_sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/secure_sync_unary_ping_pong_test.cc @@ -20,6 +20,7 @@ #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" #include "test/cpp/qps/benchmark_config.h" #include "test/cpp/qps/driver.h" diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h index f3451fca777..e030a099d2a 100644 --- a/test/cpp/qps/server.h +++ b/test/cpp/qps/server.h @@ -28,6 +28,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/control.pb.h" #include "src/proto/grpc/testing/messages.pb.h" #include "test/core/end2end/data/ssl_test_data.h" diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index f643ce53a05..8e0ccbb728e 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -34,6 +34,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/surface/completion_queue.h" #include "src/proto/grpc/testing/benchmark_service.grpc.pb.h" diff --git a/test/cpp/qps/usage_timer.cc b/test/cpp/qps/usage_timer.cc index a06a555acbc..ac0584f6bd2 100644 --- a/test/cpp/qps/usage_timer.cc +++ b/test/cpp/qps/usage_timer.cc @@ -24,6 +24,8 @@ #include #include + +#include "src/core/lib/gprpp/crash.h" #ifdef __linux__ #include #include diff --git a/test/cpp/server/server_request_call_test.cc b/test/cpp/server/server_request_call_test.cc index f131362f0fa..3eb22317047 100644 --- a/test/cpp/server/server_request_call_test.cc +++ b/test/cpp/server/server_request_call_test.cc @@ -20,6 +20,8 @@ #include +#include "absl/strings/str_format.h" + #include #include #include @@ -27,6 +29,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -77,8 +80,7 @@ TEST(ServerRequestCallTest, ShortDeadlineDoesNotCauseOkayFalse) { { std::lock_guard lock(mu); if (!shutting_down && !ok) { - gpr_log(GPR_INFO, "!ok on request %d", n); - abort(); + grpc_core::Crash(absl::StrFormat("!ok on request %d", n)); } if (shutting_down && !ok) { // Failed connection due to shutdown, continue flushing the CQ. diff --git a/test/cpp/thread_manager/thread_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc index 3436a0530dd..1b72d7b0558 100644 --- a/test/cpp/thread_manager/thread_manager_test.cc +++ b/test/cpp/thread_manager/thread_manager_test.cc @@ -31,6 +31,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/util/test_config.h" namespace grpc { diff --git a/test/cpp/util/channel_trace_proto_helper.cc b/test/cpp/util/channel_trace_proto_helper.cc index fc0f91c9683..75a2c6acb26 100644 --- a/test/cpp/util/channel_trace_proto_helper.cc +++ b/test/cpp/util/channel_trace_proto_helper.cc @@ -27,6 +27,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/json/json.h" #include "src/proto/grpc/channelz/channelz.pb.h" diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index 00b26da11f4..6e914e72820 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -29,6 +29,8 @@ #include #include +#include "src/core/lib/gprpp/crash.h" + namespace grpc { namespace testing { namespace { diff --git a/test/cpp/util/cli_credentials.cc b/test/cpp/util/cli_credentials.cc index 439cfedefc7..4e6427a3154 100644 --- a/test/cpp/util/cli_credentials.cc +++ b/test/cpp/util/cli_credentials.cc @@ -24,6 +24,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/load_file.h" ABSL_RETIRED_FLAG(bool, enable_ssl, false, diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index 0707cd94e8d..570fbdb49e9 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -24,6 +24,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/cpp/util/test_credentials_provider.h" ABSL_FLAG(std::string, grpc_test_use_grpclb_with_child_policy, "", diff --git a/test/cpp/util/metrics_server.cc b/test/cpp/util/metrics_server.cc index 715043f357d..f816659f3ed 100644 --- a/test/cpp/util/metrics_server.cc +++ b/test/cpp/util/metrics_server.cc @@ -22,6 +22,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "src/proto/grpc/testing/metrics.grpc.pb.h" #include "src/proto/grpc/testing/metrics.pb.h" diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc index 161bf26eafd..80b095c6d4b 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.cc +++ b/test/cpp/util/proto_reflection_descriptor_database.cc @@ -22,6 +22,8 @@ #include +#include "src/core/lib/gprpp/crash.h" + using grpc::reflection::v1alpha::ErrorResponse; using grpc::reflection::v1alpha::ListServiceResponse; using grpc::reflection::v1alpha::ServerReflection; diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc index 8cb2b3e0ffe..19504f5762c 100644 --- a/test/cpp/util/test_credentials_provider.cc +++ b/test/cpp/util/test_credentials_provider.cc @@ -31,6 +31,7 @@ #include #include +#include "src/core/lib/gprpp/crash.h" #include "test/core/end2end/data/ssl_test_data.h" ABSL_FLAG(std::string, tls_cert_file, "", diff --git a/tools/distrib/check_namespace_qualification.py b/tools/distrib/check_namespace_qualification.py index a1ca08200d2..4ec45770dd8 100755 --- a/tools/distrib/check_namespace_qualification.py +++ b/tools/distrib/check_namespace_qualification.py @@ -76,6 +76,7 @@ IGNORED_FILES = [ # multi-line #define statements are not handled "src/core/lib/gprpp/global_config_env.h", "src/core/lib/profiling/timers.h", + "src/core/lib/gprpp/crash.h" ] # find our home diff --git a/tools/distrib/fix_build_deps.py b/tools/distrib/fix_build_deps.py index 26d73e3bcef..531b0f2de03 100755 --- a/tools/distrib/fix_build_deps.py +++ b/tools/distrib/fix_build_deps.py @@ -141,9 +141,9 @@ EXTERNAL_DEPS = { 'google/logging/v2/logging.grpc.pb.h': 'googleapis_logging_grpc_service', 'google/logging/v2/logging.pb.h': - 'googleapis_logging_proto', + 'googleapis_logging_cc_proto', 'google/logging/v2/log_entry.pb.h': - 'googleapis_logging_proto', + 'googleapis_logging_cc_proto', 'google/monitoring/v3/metric_service.grpc.pb.h': 'googleapis_monitoring_grpc_service', 'gmock/gmock.h': diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index cd0649253ef..b1624c9138b 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -2121,6 +2121,8 @@ src/core/lib/gprpp/bitset.h \ src/core/lib/gprpp/chunked_vector.h \ src/core/lib/gprpp/construct_destruct.h \ src/core/lib/gprpp/cpp_impl_of.h \ +src/core/lib/gprpp/crash.cc \ +src/core/lib/gprpp/crash.h \ src/core/lib/gprpp/debug_location.h \ src/core/lib/gprpp/dual_ref_counted.h \ src/core/lib/gprpp/env.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 730765954fe..ccb66e9aab5 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1902,6 +1902,8 @@ src/core/lib/gprpp/bitset.h \ src/core/lib/gprpp/chunked_vector.h \ src/core/lib/gprpp/construct_destruct.h \ src/core/lib/gprpp/cpp_impl_of.h \ +src/core/lib/gprpp/crash.cc \ +src/core/lib/gprpp/crash.h \ src/core/lib/gprpp/debug_location.h \ src/core/lib/gprpp/dual_ref_counted.h \ src/core/lib/gprpp/env.h \ diff --git a/tools/run_tests/sanity/core_banned_functions.py b/tools/run_tests/sanity/core_banned_functions.py index 2bfa004e4b3..398028a5c22 100755 --- a/tools/run_tests/sanity/core_banned_functions.py +++ b/tools/run_tests/sanity/core_banned_functions.py @@ -56,6 +56,8 @@ BANNED_EXCEPT = { 'src/core/ext/filters/client_channel/lb_policy/rls/rls.cc', 'src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc', ], + # use 'grpc_core::Crash' instead + 'GPR_ASSERT(false': [], # Use `std::exchange()` instead. 'absl::exchange': [],