diff --git a/CMakeLists.txt b/CMakeLists.txt index 72e072c179b..e004528bbcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2098,7 +2098,6 @@ if(gRPC_BUILD_TESTS) add_library(grpc_test_util test/core/util/cmdline.cc - test/core/util/debugger_macros.cc test/core/util/eval_args_mock_endpoint.cc test/core/util/fuzzer_util.cc test/core/util/grpc_profiler.cc @@ -2170,7 +2169,6 @@ if(gRPC_BUILD_TESTS) add_library(grpc_test_util_unsecure test/core/util/cmdline.cc - test/core/util/debugger_macros.cc test/core/util/eval_args_mock_endpoint.cc test/core/util/fuzzer_util.cc test/core/util/grpc_profiler.cc @@ -15237,7 +15235,6 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/simple_messages.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/simple_messages.grpc.pb.h test/core/util/cmdline.cc - test/core/util/debugger_macros.cc test/core/util/eval_args_mock_endpoint.cc test/core/util/fuzzer_util.cc test/core/util/grpc_profiler.cc diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 16ae58c7c46..0c3afac2070 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -1424,7 +1424,6 @@ libs: public_headers: [] headers: - test/core/util/cmdline.h - - test/core/util/debugger_macros.h - test/core/util/eval_args_mock_endpoint.h - test/core/util/fuzzer_util.h - test/core/util/grpc_profiler.h @@ -1446,7 +1445,6 @@ libs: - test/core/util/trickle_endpoint.h src: - test/core/util/cmdline.cc - - test/core/util/debugger_macros.cc - test/core/util/eval_args_mock_endpoint.cc - test/core/util/fuzzer_util.cc - test/core/util/grpc_profiler.cc @@ -1482,7 +1480,6 @@ libs: public_headers: [] headers: - test/core/util/cmdline.h - - test/core/util/debugger_macros.h - test/core/util/eval_args_mock_endpoint.h - test/core/util/fuzzer_util.h - test/core/util/grpc_profiler.h @@ -1504,7 +1501,6 @@ libs: - test/core/util/trickle_endpoint.h src: - test/core/util/cmdline.cc - - test/core/util/debugger_macros.cc - test/core/util/eval_args_mock_endpoint.cc - test/core/util/fuzzer_util.cc - test/core/util/grpc_profiler.cc @@ -7818,7 +7814,6 @@ targets: language: c++ headers: - test/core/util/cmdline.h - - test/core/util/debugger_macros.h - test/core/util/eval_args_mock_endpoint.h - test/core/util/fuzzer_util.h - test/core/util/grpc_profiler.h @@ -7843,7 +7838,6 @@ targets: - src/proto/grpc/testing/echo_messages.proto - src/proto/grpc/testing/simple_messages.proto - test/core/util/cmdline.cc - - test/core/util/debugger_macros.cc - test/core/util/eval_args_mock_endpoint.cc - test/core/util/fuzzer_util.cc - test/core/util/grpc_profiler.cc diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index f5a666e15f0..0976cbfe1a3 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -2023,8 +2023,6 @@ Pod::Spec.new do |s| 'test/core/end2end/tests/write_buffering_at_end.cc', 'test/core/util/cmdline.cc', 'test/core/util/cmdline.h', - 'test/core/util/debugger_macros.cc', - 'test/core/util/debugger_macros.h', 'test/core/util/eval_args_mock_endpoint.cc', 'test/core/util/eval_args_mock_endpoint.h', 'test/core/util/fuzzer_util.cc', diff --git a/grpc.gyp b/grpc.gyp index 965a66d14ed..369b0c3bdf6 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -1004,7 +1004,6 @@ ], 'sources': [ 'test/core/util/cmdline.cc', - 'test/core/util/debugger_macros.cc', 'test/core/util/eval_args_mock_endpoint.cc', 'test/core/util/fuzzer_util.cc', 'test/core/util/grpc_profiler.cc', @@ -1042,7 +1041,6 @@ ], 'sources': [ 'test/core/util/cmdline.cc', - 'test/core/util/debugger_macros.cc', 'test/core/util/eval_args_mock_endpoint.cc', 'test/core/util/fuzzer_util.cc', 'test/core/util/grpc_profiler.cc', diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 77b806cd050..2608edf386b 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -424,8 +424,6 @@ class CallData { // will not run until after this method returns. void AsyncPickDone(grpc_call_element* elem, grpc_error* error); - RefCountedPtr subchannel_call() { return subchannel_call_; } - private: class ResolverQueuedCallCanceller; class LbQueuedCallCanceller; @@ -4588,9 +4586,3 @@ void grpc_client_channel_stop_connectivity_watch( auto* chand = static_cast(elem->channel_data); chand->RemoveConnectivityWatcher(watcher); } - -grpc_core::RefCountedPtr -grpc_client_channel_get_subchannel_call(grpc_call_element* elem) { - auto* calld = static_cast(elem->call_data); - return calld->subchannel_call(); -} diff --git a/src/core/ext/filters/client_channel/client_channel.h b/src/core/ext/filters/client_channel/client_channel.h index 35c2a2af6b2..202de8aee02 100644 --- a/src/core/ext/filters/client_channel/client_channel.h +++ b/src/core/ext/filters/client_channel/client_channel.h @@ -75,8 +75,4 @@ void grpc_client_channel_stop_connectivity_watch( grpc_channel_element* elem, grpc_core::AsyncConnectivityStateWatcherInterface* watcher); -/* Debug helper: pull the subchannel call from a call stack element */ -grpc_core::RefCountedPtr -grpc_client_channel_get_subchannel_call(grpc_call_element* elem); - #endif // GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_H diff --git a/test/core/util/BUILD b/test/core/util/BUILD index feaeeab7e5a..34323332aea 100644 --- a/test/core/util/BUILD +++ b/test/core/util/BUILD @@ -21,19 +21,6 @@ grpc_package( visibility = "public", ) -grpc_cc_library( - name = "grpc_debugger_macros", - srcs = [ - "debugger_macros.cc", - ], - hdrs = [ - "debugger_macros.h", - ], - deps = [ - "//:grpc_common", - ], -) - grpc_cc_library( name = "grpc_test_util_base", srcs = [ @@ -91,7 +78,6 @@ grpc_cc_library( ], language = "C++", deps = [ - ":grpc_debugger_macros", ":stack_tracer", "//:gpr", "//:grpc_base_c", diff --git a/test/core/util/debugger_macros.cc b/test/core/util/debugger_macros.cc deleted file mode 100644 index fde68f32178..00000000000 --- a/test/core/util/debugger_macros.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/* - * A collection of 'macros' that help navigating the grpc object hierarchy - * Not intended to be robust for main-line code, often cuts across abstraction - * boundaries. - */ -#include - -#include "src/core/ext/filters/client_channel/client_channel.h" -#include "src/core/ext/transport/chttp2/transport/internal.h" -#include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/surface/call.h" - -grpc_stream* grpc_transport_stream_from_call(grpc_call* call) { - grpc_call_stack* cs = grpc_call_get_call_stack(call); - for (;;) { - grpc_call_element* el = grpc_call_stack_element(cs, cs->count - 1); - if (el->filter == &grpc_client_channel_filter) { - grpc_core::RefCountedPtr scc = - grpc_client_channel_get_subchannel_call(el); - if (scc == nullptr) { - fprintf(stderr, "No subchannel-call"); - fflush(stderr); - return nullptr; - } - cs = scc->GetCallStack(); - } else if (el->filter == &grpc_connected_filter) { - return grpc_connected_channel_get_stream(el); - } else { - fprintf(stderr, "Unrecognized filter: %s", el->filter->name); - fflush(stderr); - return nullptr; - } - } -} - -grpc_chttp2_stream* grpc_chttp2_stream_from_call(grpc_call* call) { - return reinterpret_cast( - grpc_transport_stream_from_call(call)); -} diff --git a/test/core/util/debugger_macros.h b/test/core/util/debugger_macros.h deleted file mode 100644 index 71228c6e875..00000000000 --- a/test/core/util/debugger_macros.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_TEST_CORE_UTIL_DEBUGGER_MACROS_H -#define GRPC_TEST_CORE_UTIL_DEBUGGER_MACROS_H - -#include "src/core/ext/transport/chttp2/transport/internal.h" -#include "src/core/lib/surface/call.h" - -grpc_chttp2_stream* grpc_chttp2_stream_from_call(grpc_call* call); - -#endif /* GRPC_TEST_CORE_UTIL_DEBUGGER_MACROS_H */ diff --git a/test/cpp/end2end/cfstream_test.cc b/test/cpp/end2end/cfstream_test.cc index a69ee496501..a7e3a9f8b91 100644 --- a/test/cpp/end2end/cfstream_test.cc +++ b/test/cpp/end2end/cfstream_test.cc @@ -42,7 +42,6 @@ #include "src/core/lib/gpr/env.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" -#include "test/core/util/debugger_macros.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" @@ -145,18 +144,6 @@ class CFStreamTest : public ::testing::TestWithParam { return CreateCustomChannel(server_address.str(), channel_creds, args); } - int GetStreamID(ClientContext& context) { - int stream_id = 0; - grpc_call* call = context.c_call(); - if (call) { - grpc_chttp2_stream* stream = grpc_chttp2_stream_from_call(call); - if (stream) { - stream_id = stream->id; - } - } - return stream_id; - } - void SendRpc( const std::unique_ptr& stub, bool expect_success = false) { @@ -166,13 +153,11 @@ class CFStreamTest : public ::testing::TestWithParam { request.set_message(msg); ClientContext context; Status status = stub->Echo(&context, request, response.get()); - int stream_id = GetStreamID(context); if (status.ok()) { - gpr_log(GPR_DEBUG, "RPC with stream_id %d succeeded", stream_id); + gpr_log(GPR_DEBUG, "RPC with succeeded"); EXPECT_EQ(msg, response->message()); } else { - gpr_log(GPR_DEBUG, "RPC with stream_id %d failed: %s", stream_id, - status.error_message().c_str()); + gpr_log(GPR_DEBUG, "RPC failed: %s", status.error_message().c_str()); } if (expect_success) { EXPECT_TRUE(status.ok()); @@ -392,17 +377,16 @@ TEST_P(CFStreamTest, NetworkFlapRpcsInFlight) { ++total_completions; GPR_ASSERT(ok); AsyncClientCall* call = static_cast(got_tag); - int stream_id = GetStreamID(call->context); if (!call->status.ok()) { - gpr_log(GPR_DEBUG, "RPC with stream_id %d failed with error: %s", - stream_id, call->status.error_message().c_str()); + gpr_log(GPR_DEBUG, "RPC failed with error: %s", + call->status.error_message().c_str()); // Bring network up when RPCs start failing if (network_down) { NetworkUp(); network_down = false; } } else { - gpr_log(GPR_DEBUG, "RPC with stream_id %d succeeded", stream_id); + gpr_log(GPR_DEBUG, "RPC succeeded"); } delete call; } @@ -440,13 +424,12 @@ TEST_P(CFStreamTest, ConcurrentRpc) { ++total_completions; GPR_ASSERT(ok); AsyncClientCall* call = static_cast(got_tag); - int stream_id = GetStreamID(call->context); if (!call->status.ok()) { - gpr_log(GPR_DEBUG, "RPC with stream_id %d failed with error: %s", - stream_id, call->status.error_message().c_str()); + gpr_log(GPR_DEBUG, "RPC failed with error: %s", + call->status.error_message().c_str()); // Bring network up when RPCs start failing } else { - gpr_log(GPR_DEBUG, "RPC with stream_id %d succeeded", stream_id); + gpr_log(GPR_DEBUG, "RPC succeeded"); } delete call; } diff --git a/test/cpp/end2end/flaky_network_test.cc b/test/cpp/end2end/flaky_network_test.cc index 9b27aa86365..805770d0810 100644 --- a/test/cpp/end2end/flaky_network_test.cc +++ b/test/cpp/end2end/flaky_network_test.cc @@ -43,7 +43,6 @@ #include "src/core/lib/backoff/backoff.h" #include "src/core/lib/gpr/env.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" -#include "test/core/util/debugger_macros.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" @@ -226,19 +225,10 @@ class FlakyNetworkTest : public ::testing::TestWithParam { } Status status = stub->Echo(&context, request, response.get()); auto ok = status.ok(); - int stream_id = 0; - grpc_call* call = context.c_call(); - if (call) { - grpc_chttp2_stream* stream = grpc_chttp2_stream_from_call(call); - if (stream) { - stream_id = stream->id; - } - } if (ok) { - gpr_log(GPR_DEBUG, "RPC with stream_id %d succeeded", stream_id); + gpr_log(GPR_DEBUG, "RPC succeeded"); } else { - gpr_log(GPR_DEBUG, "RPC with stream_id %d failed: %s", stream_id, - status.error_message().c_str()); + gpr_log(GPR_DEBUG, "RPC failed: %s", status.error_message().c_str()); } return ok; }