Implement callback CQ at C++ layer using shared thread pool if non-background iomgr

pull/25169/head
Vijay Pai 4 years ago
parent fe114b21ef
commit dba8bb59a0
  1. 3
      include/grpcpp/impl/codegen/completion_queue.h
  2. 31
      src/cpp/client/channel_cc.cc
  3. 106
      src/cpp/common/completion_queue_cc.cc
  4. 35
      src/cpp/server/server_cc.cc
  5. 56
      test/cpp/end2end/client_callback_end2end_test.cc
  6. 25
      test/cpp/end2end/context_allocator_end2end_test.cc
  7. 83
      test/cpp/end2end/end2end_test.cc
  8. 30
      test/cpp/end2end/message_allocator_end2end_test.cc
  9. 1
      test/cpp/microbenchmarks/BUILD
  10. 2
      test/cpp/microbenchmarks/bm_callback_unary_ping_pong.cc

@ -409,6 +409,9 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen {
return true;
}
static CompletionQueue* CallbackAlternativeCQ();
static void ReleaseCallbackAlternativeCQ(CompletionQueue* cq);
grpc_completion_queue* cq_; // owned
gpr_atm avalanches_in_flight_;

@ -38,7 +38,9 @@
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/surface/completion_queue.h"
namespace grpc {
@ -56,7 +58,12 @@ Channel::Channel(const std::string& host, grpc_channel* channel,
Channel::~Channel() {
grpc_channel_destroy(c_channel_);
if (callback_cq_ != nullptr) {
callback_cq_->Shutdown();
if (grpc_iomgr_run_in_background()) {
// gRPC-core provides the backing needed for the preferred CQ type
callback_cq_->Shutdown();
} else {
CompletionQueue::ReleaseCallbackAlternativeCQ(callback_cq_);
}
}
}
@ -238,13 +245,21 @@ class ShutdownCallback : public grpc_experimental_completion_queue_functor {
// if there is no explicit per-channel CQ registered
grpc::internal::MutexLock l(&mu_);
if (callback_cq_ == nullptr) {
auto* shutdown_callback = new ShutdownCallback;
callback_cq_ = new ::grpc::CompletionQueue(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_CALLBACK, GRPC_CQ_DEFAULT_POLLING,
shutdown_callback});
// Transfer ownership of the new cq to its own shutdown callback
shutdown_callback->TakeCQ(callback_cq_);
if (grpc_iomgr_run_in_background()) {
// gRPC-core provides the backing needed for the preferred CQ type
auto* shutdown_callback = new ShutdownCallback;
callback_cq_ =
new ::grpc::CompletionQueue(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_CALLBACK,
GRPC_CQ_DEFAULT_POLLING, shutdown_callback});
// Transfer ownership of the new cq to its own shutdown callback
shutdown_callback->TakeCQ(callback_cq_);
} else {
// Otherwise we need to use the alternative CQ variant
callback_cq_ = CompletionQueue::CallbackAlternativeCQ();
}
}
return callback_cq_;
}

@ -20,13 +20,106 @@
#include <memory>
#include <grpc/grpc.h>
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/support/time.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/thd.h"
namespace grpc {
namespace {
internal::GrpcLibraryInitializer g_gli_initializer;
gpr_once g_once_init_callback_alternative = GPR_ONCE_INIT;
grpc_core::ManualConstructor<grpc_core::Mutex> g_callback_alternative_mu;
// Implement a ref-counted callback CQ for global use in the alternative
// implementation so that its threads are only created once. Do this using
// explicit ref-counts and raw pointers rather than a shared-ptr since that
// has a non-trivial destructor and thus can't be used for global variables.
struct CallbackAlternativeCQ {
int refs = 0; // GUARDED_BY(g_callback_alternative_mu);
CompletionQueue* cq; // GUARDED_BY(g_callback_alternative_mu);
std::vector<grpc_core::Thread>*
nexting_threads; // GUARDED_BY(g_callback_alternative_mu);
static internal::GrpcLibraryInitializer g_gli_initializer;
CompletionQueue* Ref() {
grpc_core::MutexLock lock(&*g_callback_alternative_mu);
refs++;
if (refs == 1) {
cq = new CompletionQueue;
int num_nexting_threads = GPR_CLAMP(gpr_cpu_num_cores() / 2, 2, 16);
nexting_threads = new std::vector<grpc_core::Thread>;
for (int i = 0; i < num_nexting_threads; i++) {
nexting_threads->emplace_back(
"nexting_thread",
[](void* arg) {
grpc_completion_queue* cq =
static_cast<CompletionQueue*>(arg)->cq();
while (true) {
// Use the raw Core next function rather than the C++ Next since
// Next incorporates FinalizeResult and we actually want that
// called from the callback functor itself.
// TODO(vjpai): Migrate below to next without a timeout or idle
// phase. That's currently starving out some other polling,
// though.
auto ev = grpc_completion_queue_next(
cq,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_millis(1000, GPR_TIMESPAN)),
nullptr);
if (ev.type == GRPC_QUEUE_SHUTDOWN) {
return;
}
if (ev.type == GRPC_QUEUE_TIMEOUT) {
gpr_sleep_until(
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_millis(100, GPR_TIMESPAN)));
continue;
}
GPR_DEBUG_ASSERT(ev.type == GRPC_OP_COMPLETE);
// We can always execute the callback inline rather than
// pushing it to another Executor thread because this
// thread is definitely running on a background thread, does not
// hold any application locks before executing the callback,
// and cannot be entered recursively.
auto* functor =
static_cast<grpc_experimental_completion_queue_functor*>(
ev.tag);
functor->functor_run(functor, ev.success);
}
},
cq);
}
for (auto& th : *nexting_threads) {
th.Start();
}
}
return cq;
}
void Unref() {
grpc_core::MutexLock lock(&*g_callback_alternative_mu);
refs--;
if (refs == 0) {
cq->Shutdown();
for (auto& th : *nexting_threads) {
th.Join();
}
delete nexting_threads;
delete cq;
}
}
};
CallbackAlternativeCQ g_callback_alternative_cq;
} // namespace
// 'CompletionQueue' constructor can safely call GrpcLibraryCodegen(false) here
// i.e not have GrpcLibraryCodegen call grpc_init(). This is because, to create
@ -96,4 +189,15 @@ bool CompletionQueue::CompletionQueueTLSCache::Flush(void** tag, bool* ok) {
return false;
}
CompletionQueue* CompletionQueue::CallbackAlternativeCQ() {
gpr_once_init(&g_once_init_callback_alternative,
[] { g_callback_alternative_mu.Init(); });
return g_callback_alternative_cq.Ref();
}
void CompletionQueue::ReleaseCallbackAlternativeCQ(CompletionQueue* cq) {
GPR_DEBUG_ASSERT(cq == g_callback_alternative_cq.cq);
g_callback_alternative_cq.Unref();
}
} // namespace grpc

@ -47,6 +47,7 @@
#include "src/core/ext/transport/inproc/inproc_transport.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/completion_queue.h"
@ -917,7 +918,12 @@ Server::~Server() {
value->Shutdown();
}
if (callback_cq_ != nullptr) {
callback_cq_->Shutdown();
if (grpc_iomgr_run_in_background()) {
// gRPC-core provides the backing needed for the preferred CQ type
callback_cq_->Shutdown();
} else {
CompletionQueue::ReleaseCallbackAlternativeCQ(callback_cq_);
}
callback_cq_ = nullptr;
}
}
@ -1237,7 +1243,12 @@ void Server::ShutdownInternal(gpr_timespec deadline) {
// Shutdown the callback CQ. The CQ is owned by its own shutdown tag, so it
// will delete itself at true shutdown.
if (callback_cq_ != nullptr) {
callback_cq_->Shutdown();
if (grpc_iomgr_run_in_background()) {
// gRPC-core provides the backing needed for the preferred CQ type
callback_cq_->Shutdown();
} else {
CompletionQueue::ReleaseCallbackAlternativeCQ(callback_cq_);
}
callback_cq_ = nullptr;
}
@ -1309,13 +1320,19 @@ grpc::CompletionQueue* Server::CallbackCQ() {
if (callback_cq_ != nullptr) {
return callback_cq_;
}
auto* shutdown_callback = new grpc::ShutdownCallback;
callback_cq_ = new grpc::CompletionQueue(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_CALLBACK, GRPC_CQ_DEFAULT_POLLING,
shutdown_callback});
// Transfer ownership of the new cq to its own shutdown callback
shutdown_callback->TakeCQ(callback_cq_);
if (grpc_iomgr_run_in_background()) {
// gRPC-core provides the backing needed for the preferred CQ type
auto* shutdown_callback = new grpc::ShutdownCallback;
callback_cq_ = new grpc::CompletionQueue(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_CALLBACK, GRPC_CQ_DEFAULT_POLLING,
shutdown_callback});
// Transfer ownership of the new cq to its own shutdown callback
shutdown_callback->TakeCQ(callback_cq_);
} else {
// Otherwise we need to use the alternative CQ variant
callback_cq_ = CompletionQueue::CallbackAlternativeCQ();
}
return callback_cq_;
}

@ -46,17 +46,6 @@
#include "test/cpp/util/string_ref_helper.h"
#include "test/cpp/util/test_credentials_provider.h"
// MAYBE_SKIP_TEST is a macro to determine if this particular test configuration
// should be skipped based on a decision made at SetUp time. In particular, any
// callback tests can only be run if the iomgr can run in the background or if
// the transport is in-process.
#define MAYBE_SKIP_TEST \
do { \
if (do_not_test_) { \
return; \
} \
} while (0)
namespace grpc {
namespace testing {
namespace {
@ -130,10 +119,6 @@ class ClientCallbackEnd2endTest
server_ = builder.BuildAndStart();
is_server_started_ = true;
if (GetParam().protocol == Protocol::TCP &&
!grpc_iomgr_run_in_background()) {
do_not_test_ = true;
}
}
void ResetStub() {
@ -337,7 +322,6 @@ class ClientCallbackEnd2endTest
rpc.Await();
}
}
bool do_not_test_{false};
bool is_server_started_{false};
int picked_port_{0};
std::shared_ptr<Channel> channel_;
@ -350,13 +334,11 @@ class ClientCallbackEnd2endTest
};
TEST_P(ClientCallbackEnd2endTest, SimpleRpc) {
MAYBE_SKIP_TEST;
ResetStub();
SendRpcs(1, false);
}
TEST_P(ClientCallbackEnd2endTest, SimpleRpcExpectedError) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
@ -391,7 +373,6 @@ TEST_P(ClientCallbackEnd2endTest, SimpleRpcExpectedError) {
}
TEST_P(ClientCallbackEnd2endTest, SimpleRpcUnderLockNested) {
MAYBE_SKIP_TEST;
ResetStub();
// The request/response state associated with an RPC and the synchronization
@ -452,7 +433,6 @@ TEST_P(ClientCallbackEnd2endTest, SimpleRpcUnderLockNested) {
}
TEST_P(ClientCallbackEnd2endTest, SimpleRpcUnderLock) {
MAYBE_SKIP_TEST;
ResetStub();
std::mutex mu;
std::condition_variable cv;
@ -480,13 +460,11 @@ TEST_P(ClientCallbackEnd2endTest, SimpleRpcUnderLock) {
}
TEST_P(ClientCallbackEnd2endTest, SequentialRpcs) {
MAYBE_SKIP_TEST;
ResetStub();
SendRpcs(10, false);
}
TEST_P(ClientCallbackEnd2endTest, SendClientInitialMetadata) {
MAYBE_SKIP_TEST;
ResetStub();
SimpleRequest request;
SimpleResponse response;
@ -513,51 +491,43 @@ TEST_P(ClientCallbackEnd2endTest, SendClientInitialMetadata) {
}
TEST_P(ClientCallbackEnd2endTest, SimpleRpcWithBinaryMetadata) {
MAYBE_SKIP_TEST;
ResetStub();
SendRpcs(1, true);
}
TEST_P(ClientCallbackEnd2endTest, SequentialRpcsWithVariedBinaryMetadataValue) {
MAYBE_SKIP_TEST;
ResetStub();
SendRpcs(10, true);
}
TEST_P(ClientCallbackEnd2endTest, SequentialGenericRpcs) {
MAYBE_SKIP_TEST;
ResetStub();
SendRpcsGeneric(10, false);
}
TEST_P(ClientCallbackEnd2endTest, SequentialGenericRpcsAsBidi) {
MAYBE_SKIP_TEST;
ResetStub();
SendGenericEchoAsBidi(10, 1, /*do_writes_done=*/true);
}
TEST_P(ClientCallbackEnd2endTest, SequentialGenericRpcsAsBidiWithReactorReuse) {
MAYBE_SKIP_TEST;
ResetStub();
SendGenericEchoAsBidi(10, 10, /*do_writes_done=*/true);
}
TEST_P(ClientCallbackEnd2endTest, GenericRpcNoWritesDone) {
MAYBE_SKIP_TEST;
ResetStub();
SendGenericEchoAsBidi(1, 1, /*do_writes_done=*/false);
}
#if GRPC_ALLOW_EXCEPTIONS
TEST_P(ClientCallbackEnd2endTest, ExceptingRpc) {
MAYBE_SKIP_TEST;
ResetStub();
SendRpcsGeneric(10, true);
}
#endif
TEST_P(ClientCallbackEnd2endTest, MultipleRpcsWithVariedBinaryMetadataValue) {
MAYBE_SKIP_TEST;
ResetStub();
std::vector<std::thread> threads;
threads.reserve(10);
@ -570,7 +540,6 @@ TEST_P(ClientCallbackEnd2endTest, MultipleRpcsWithVariedBinaryMetadataValue) {
}
TEST_P(ClientCallbackEnd2endTest, MultipleRpcs) {
MAYBE_SKIP_TEST;
ResetStub();
std::vector<std::thread> threads;
threads.reserve(10);
@ -583,7 +552,6 @@ TEST_P(ClientCallbackEnd2endTest, MultipleRpcs) {
}
TEST_P(ClientCallbackEnd2endTest, CancelRpcBeforeStart) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -612,7 +580,6 @@ TEST_P(ClientCallbackEnd2endTest, CancelRpcBeforeStart) {
}
TEST_P(ClientCallbackEnd2endTest, RequestEchoServerCancel) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -743,7 +710,6 @@ class WriteClient : public grpc::experimental::ClientWriteReactor<EchoRequest> {
};
TEST_P(ClientCallbackEnd2endTest, RequestStream) {
MAYBE_SKIP_TEST;
ResetStub();
WriteClient test{stub_.get(), DO_NOT_CANCEL, 3};
test.Await();
@ -754,7 +720,6 @@ TEST_P(ClientCallbackEnd2endTest, RequestStream) {
}
TEST_P(ClientCallbackEnd2endTest, ClientCancelsRequestStream) {
MAYBE_SKIP_TEST;
ResetStub();
WriteClient test{stub_.get(), DO_NOT_CANCEL, 3, ClientCancelInfo{2}};
test.Await();
@ -766,7 +731,6 @@ TEST_P(ClientCallbackEnd2endTest, ClientCancelsRequestStream) {
// Server to cancel before doing reading the request
TEST_P(ClientCallbackEnd2endTest, RequestStreamServerCancelBeforeReads) {
MAYBE_SKIP_TEST;
ResetStub();
WriteClient test{stub_.get(), CANCEL_BEFORE_PROCESSING, 1};
test.Await();
@ -778,7 +742,6 @@ TEST_P(ClientCallbackEnd2endTest, RequestStreamServerCancelBeforeReads) {
// Server to cancel while reading a request from the stream in parallel
TEST_P(ClientCallbackEnd2endTest, RequestStreamServerCancelDuringRead) {
MAYBE_SKIP_TEST;
ResetStub();
WriteClient test{stub_.get(), CANCEL_DURING_PROCESSING, 10};
test.Await();
@ -791,7 +754,6 @@ TEST_P(ClientCallbackEnd2endTest, RequestStreamServerCancelDuringRead) {
// Server to cancel after reading all the requests but before returning to the
// client
TEST_P(ClientCallbackEnd2endTest, RequestStreamServerCancelAfterReads) {
MAYBE_SKIP_TEST;
ResetStub();
WriteClient test{stub_.get(), CANCEL_AFTER_PROCESSING, 4};
test.Await();
@ -802,7 +764,6 @@ TEST_P(ClientCallbackEnd2endTest, RequestStreamServerCancelAfterReads) {
}
TEST_P(ClientCallbackEnd2endTest, UnaryReactor) {
MAYBE_SKIP_TEST;
ResetStub();
class UnaryClient : public grpc::experimental::ClientUnaryReactor {
public:
@ -861,7 +822,6 @@ TEST_P(ClientCallbackEnd2endTest, UnaryReactor) {
}
TEST_P(ClientCallbackEnd2endTest, GenericUnaryReactor) {
MAYBE_SKIP_TEST;
ResetStub();
const std::string kMethodName("/grpc.testing.EchoTestService/Echo");
class UnaryClient : public grpc::experimental::ClientUnaryReactor {
@ -1027,7 +987,6 @@ class ReadClient : public grpc::experimental::ClientReadReactor<EchoResponse> {
};
TEST_P(ClientCallbackEnd2endTest, ResponseStream) {
MAYBE_SKIP_TEST;
ResetStub();
ReadClient test{stub_.get(), DO_NOT_CANCEL};
test.Await();
@ -1038,7 +997,6 @@ TEST_P(ClientCallbackEnd2endTest, ResponseStream) {
}
TEST_P(ClientCallbackEnd2endTest, ClientCancelsResponseStream) {
MAYBE_SKIP_TEST;
ResetStub();
ReadClient test{stub_.get(), DO_NOT_CANCEL, ClientCancelInfo{2}};
test.Await();
@ -1048,7 +1006,6 @@ TEST_P(ClientCallbackEnd2endTest, ClientCancelsResponseStream) {
// Server to cancel before sending any response messages
TEST_P(ClientCallbackEnd2endTest, ResponseStreamServerCancelBefore) {
MAYBE_SKIP_TEST;
ResetStub();
ReadClient test{stub_.get(), CANCEL_BEFORE_PROCESSING};
test.Await();
@ -1060,7 +1017,6 @@ TEST_P(ClientCallbackEnd2endTest, ResponseStreamServerCancelBefore) {
// Server to cancel while writing a response to the stream in parallel
TEST_P(ClientCallbackEnd2endTest, ResponseStreamServerCancelDuring) {
MAYBE_SKIP_TEST;
ResetStub();
ReadClient test{stub_.get(), CANCEL_DURING_PROCESSING};
test.Await();
@ -1073,7 +1029,6 @@ TEST_P(ClientCallbackEnd2endTest, ResponseStreamServerCancelDuring) {
// Server to cancel after writing all the respones to the stream but before
// returning to the client
TEST_P(ClientCallbackEnd2endTest, ResponseStreamServerCancelAfter) {
MAYBE_SKIP_TEST;
ResetStub();
ReadClient test{stub_.get(), CANCEL_AFTER_PROCESSING};
test.Await();
@ -1238,7 +1193,6 @@ class BidiClient
};
TEST_P(ClientCallbackEnd2endTest, BidiStream) {
MAYBE_SKIP_TEST;
ResetStub();
BidiClient test(stub_.get(), DO_NOT_CANCEL,
kServerDefaultResponseStreamsToSend,
@ -1251,7 +1205,6 @@ TEST_P(ClientCallbackEnd2endTest, BidiStream) {
}
TEST_P(ClientCallbackEnd2endTest, BidiStreamFirstWriteAsync) {
MAYBE_SKIP_TEST;
ResetStub();
BidiClient test(stub_.get(), DO_NOT_CANCEL,
kServerDefaultResponseStreamsToSend,
@ -1264,7 +1217,6 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamFirstWriteAsync) {
}
TEST_P(ClientCallbackEnd2endTest, BidiStreamCorked) {
MAYBE_SKIP_TEST;
ResetStub();
BidiClient test(stub_.get(), DO_NOT_CANCEL,
kServerDefaultResponseStreamsToSend,
@ -1277,7 +1229,6 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamCorked) {
}
TEST_P(ClientCallbackEnd2endTest, BidiStreamCorkedFirstWriteAsync) {
MAYBE_SKIP_TEST;
ResetStub();
BidiClient test(stub_.get(), DO_NOT_CANCEL,
kServerDefaultResponseStreamsToSend,
@ -1290,7 +1241,6 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamCorkedFirstWriteAsync) {
}
TEST_P(ClientCallbackEnd2endTest, ClientCancelsBidiStream) {
MAYBE_SKIP_TEST;
ResetStub();
BidiClient test(stub_.get(), DO_NOT_CANCEL,
kServerDefaultResponseStreamsToSend,
@ -1305,7 +1255,6 @@ TEST_P(ClientCallbackEnd2endTest, ClientCancelsBidiStream) {
// Server to cancel before reading/writing any requests/responses on the stream
TEST_P(ClientCallbackEnd2endTest, BidiStreamServerCancelBefore) {
MAYBE_SKIP_TEST;
ResetStub();
BidiClient test(stub_.get(), CANCEL_BEFORE_PROCESSING, /*num_msgs_to_send=*/2,
/*cork_metadata=*/false, /*first_write_async=*/false);
@ -1319,7 +1268,6 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamServerCancelBefore) {
// Server to cancel while reading/writing requests/responses on the stream in
// parallel
TEST_P(ClientCallbackEnd2endTest, BidiStreamServerCancelDuring) {
MAYBE_SKIP_TEST;
ResetStub();
BidiClient test(stub_.get(), CANCEL_DURING_PROCESSING,
/*num_msgs_to_send=*/10, /*cork_metadata=*/false,
@ -1334,7 +1282,6 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamServerCancelDuring) {
// Server to cancel after reading/writing all requests/responses on the stream
// but before returning to the client
TEST_P(ClientCallbackEnd2endTest, BidiStreamServerCancelAfter) {
MAYBE_SKIP_TEST;
ResetStub();
BidiClient test(stub_.get(), CANCEL_AFTER_PROCESSING, /*num_msgs_to_send=*/5,
/*cork_metadata=*/false, /*first_write_async=*/false);
@ -1346,7 +1293,6 @@ TEST_P(ClientCallbackEnd2endTest, BidiStreamServerCancelAfter) {
}
TEST_P(ClientCallbackEnd2endTest, SimultaneousReadAndWritesDone) {
MAYBE_SKIP_TEST;
ResetStub();
class Client : public grpc::experimental::ClientBidiReactor<EchoRequest,
EchoResponse> {
@ -1394,7 +1340,6 @@ TEST_P(ClientCallbackEnd2endTest, SimultaneousReadAndWritesDone) {
}
TEST_P(ClientCallbackEnd2endTest, UnimplementedRpc) {
MAYBE_SKIP_TEST;
ChannelArguments args;
const auto& channel_creds = GetCredentialsProvider()->GetChannelCredentials(
GetParam().credentials_type, &args);
@ -1429,7 +1374,6 @@ TEST_P(ClientCallbackEnd2endTest, UnimplementedRpc) {
TEST_P(ClientCallbackEnd2endTest,
ResponseStreamExtraReactionFlowReadsUntilDone) {
MAYBE_SKIP_TEST;
ResetStub();
class ReadAllIncomingDataClient
: public grpc::experimental::ClientReadReactor<EchoResponse> {

@ -43,17 +43,6 @@
#include "test/cpp/end2end/test_service_impl.h"
#include "test/cpp/util/test_credentials_provider.h"
// MAYBE_SKIP_TEST is a macro to determine if this particular test configuration
// should be skipped based on a decision made at SetUp time. In particular, any
// callback tests can only be run if the iomgr can run in the background or if
// the transport is in-process.
#define MAYBE_SKIP_TEST \
do { \
if (do_not_test_) { \
return; \
} \
} while (0)
namespace grpc {
namespace testing {
namespace {
@ -95,15 +84,7 @@ class ContextAllocatorEnd2endTestBase
~ContextAllocatorEnd2endTestBase() override = default;
void SetUp() override {
GetParam().Log();
if (GetParam().protocol == Protocol::TCP) {
if (!grpc_iomgr_run_in_background()) {
do_not_test_ = true;
return;
}
}
}
void SetUp() override { GetParam().Log(); }
void CreateServer(std::unique_ptr<grpc::ContextAllocator> context_allocator) {
ServerBuilder builder;
@ -185,7 +166,6 @@ class ContextAllocatorEnd2endTestBase
}
}
bool do_not_test_{false};
int picked_port_{0};
std::shared_ptr<Channel> channel_;
std::unique_ptr<EchoTestService::Stub> stub_;
@ -197,7 +177,6 @@ class ContextAllocatorEnd2endTestBase
class DefaultContextAllocatorTest : public ContextAllocatorEnd2endTestBase {};
TEST_P(DefaultContextAllocatorTest, SimpleRpc) {
MAYBE_SKIP_TEST;
const int kRpcCount = 10;
CreateServer(nullptr);
ResetStub();
@ -239,7 +218,6 @@ class NullContextAllocatorTest : public ContextAllocatorEnd2endTestBase {
};
TEST_P(NullContextAllocatorTest, UnaryRpc) {
MAYBE_SKIP_TEST;
const int kRpcCount = 10;
std::atomic<int> allocation_count{0};
std::atomic<int> deallocation_count{0};
@ -290,7 +268,6 @@ class SimpleContextAllocatorTest : public ContextAllocatorEnd2endTestBase {
};
TEST_P(SimpleContextAllocatorTest, UnaryRpc) {
MAYBE_SKIP_TEST;
const int kRpcCount = 10;
std::atomic<int> allocation_count{0};
std::atomic<int> deallocation_count{0};

@ -64,17 +64,6 @@ using grpc::testing::EchoResponse;
using grpc::testing::kTlsCredentialsType;
using std::chrono::system_clock;
// MAYBE_SKIP_TEST is a macro to determine if this particular test configuration
// should be skipped based on a decision made at SetUp time. In particular,
// tests that use the callback server can only be run if the iomgr can run in
// the background or if the transport is in-process.
#define MAYBE_SKIP_TEST \
do { \
if (do_not_test_) { \
return; \
} \
} while (0)
namespace grpc {
namespace testing {
namespace {
@ -330,14 +319,6 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
GetParam().Log();
}
void SetUp() override {
if (GetParam().callback_server && !GetParam().inproc &&
!grpc_iomgr_run_in_background()) {
do_not_test_ = true;
return;
}
}
void TearDown() override {
if (is_server_started_) {
server_->Shutdown();
@ -471,7 +452,6 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
PhonyInterceptor::Reset();
}
bool do_not_test_{false};
bool is_server_started_;
std::shared_ptr<Channel> channel_;
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
@ -527,7 +507,6 @@ class End2endServerTryCancelTest : public End2endTest {
// NOTE: Do not call this function with server_try_cancel == DO_NOT_CANCEL.
void TestRequestStreamServerCancel(
ServerTryCancelRequestPhase server_try_cancel, int num_msgs_to_send) {
MAYBE_SKIP_TEST;
RestartServer(std::shared_ptr<AuthMetadataProcessor>());
ResetStub();
EchoRequest request;
@ -606,7 +585,6 @@ class End2endServerTryCancelTest : public End2endTest {
// NOTE: Do not call this function with server_try_cancel == DO_NOT_CANCEL.
void TestResponseStreamServerCancel(
ServerTryCancelRequestPhase server_try_cancel) {
MAYBE_SKIP_TEST;
RestartServer(std::shared_ptr<AuthMetadataProcessor>());
ResetStub();
EchoRequest request;
@ -688,7 +666,6 @@ class End2endServerTryCancelTest : public End2endTest {
// NOTE: Do not call this function with server_try_cancel == DO_NOT_CANCEL.
void TestBidiStreamServerCancel(ServerTryCancelRequestPhase server_try_cancel,
int num_messages) {
MAYBE_SKIP_TEST;
RestartServer(std::shared_ptr<AuthMetadataProcessor>());
ResetStub();
EchoRequest request;
@ -764,7 +741,6 @@ class End2endServerTryCancelTest : public End2endTest {
};
TEST_P(End2endServerTryCancelTest, RequestEchoServerCancel) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -827,7 +803,6 @@ TEST_P(End2endServerTryCancelTest, BidiStreamServerCancelAfter) {
}
TEST_P(End2endTest, SimpleRpcWithCustomUserAgentPrefix) {
MAYBE_SKIP_TEST;
// User-Agent is an HTTP header for HTTP transports only
if (GetParam().inproc) {
return;
@ -851,7 +826,6 @@ TEST_P(End2endTest, SimpleRpcWithCustomUserAgentPrefix) {
}
TEST_P(End2endTest, MultipleRpcsWithVariedBinaryMetadataValue) {
MAYBE_SKIP_TEST;
ResetStub();
std::vector<std::thread> threads;
threads.reserve(10);
@ -864,7 +838,6 @@ TEST_P(End2endTest, MultipleRpcsWithVariedBinaryMetadataValue) {
}
TEST_P(End2endTest, MultipleRpcs) {
MAYBE_SKIP_TEST;
ResetStub();
std::vector<std::thread> threads;
threads.reserve(10);
@ -877,7 +850,6 @@ TEST_P(End2endTest, MultipleRpcs) {
}
TEST_P(End2endTest, ManyStubs) {
MAYBE_SKIP_TEST;
ResetStub();
ChannelTestPeer peer(channel_.get());
int registered_calls_pre = peer.registered_calls();
@ -890,7 +862,6 @@ TEST_P(End2endTest, ManyStubs) {
}
TEST_P(End2endTest, EmptyBinaryMetadata) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -903,7 +874,6 @@ TEST_P(End2endTest, EmptyBinaryMetadata) {
}
TEST_P(End2endTest, ReconnectChannel) {
MAYBE_SKIP_TEST;
if (GetParam().inproc) {
return;
}
@ -931,7 +901,6 @@ TEST_P(End2endTest, ReconnectChannel) {
}
TEST_P(End2endTest, RequestStreamOneRequest) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -948,7 +917,6 @@ TEST_P(End2endTest, RequestStreamOneRequest) {
}
TEST_P(End2endTest, RequestStreamOneRequestWithCoalescingApi) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -964,7 +932,6 @@ TEST_P(End2endTest, RequestStreamOneRequestWithCoalescingApi) {
}
TEST_P(End2endTest, RequestStreamTwoRequests) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -981,7 +948,6 @@ TEST_P(End2endTest, RequestStreamTwoRequests) {
}
TEST_P(End2endTest, RequestStreamTwoRequestsWithWriteThrough) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -998,7 +964,6 @@ TEST_P(End2endTest, RequestStreamTwoRequestsWithWriteThrough) {
}
TEST_P(End2endTest, RequestStreamTwoRequestsWithCoalescingApi) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1015,7 +980,6 @@ TEST_P(End2endTest, RequestStreamTwoRequestsWithCoalescingApi) {
}
TEST_P(End2endTest, ResponseStream) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1034,7 +998,6 @@ TEST_P(End2endTest, ResponseStream) {
}
TEST_P(End2endTest, ResponseStreamWithCoalescingApi) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1056,7 +1019,6 @@ TEST_P(End2endTest, ResponseStreamWithCoalescingApi) {
// This was added to prevent regression from issue:
// https://github.com/grpc/grpc/issues/11546
TEST_P(End2endTest, ResponseStreamWithEverythingCoalesced) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1078,7 +1040,6 @@ TEST_P(End2endTest, ResponseStreamWithEverythingCoalesced) {
}
TEST_P(End2endTest, BidiStream) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1103,7 +1064,6 @@ TEST_P(End2endTest, BidiStream) {
}
TEST_P(End2endTest, BidiStreamWithCoalescingApi) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1139,7 +1099,6 @@ TEST_P(End2endTest, BidiStreamWithCoalescingApi) {
// This was added to prevent regression from issue:
// https://github.com/grpc/grpc/issues/11546
TEST_P(End2endTest, BidiStreamWithEverythingCoalesced) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1165,7 +1124,6 @@ TEST_P(End2endTest, BidiStreamWithEverythingCoalesced) {
// Talk to the two services with the same name but different package names.
// The two stubs are created on the same channel.
TEST_P(End2endTest, DiffPackageServices) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1194,7 +1152,6 @@ void CancelRpc(ClientContext* context, int delay_us, ServiceType* service) {
}
TEST_P(End2endTest, CancelRpcBeforeStart) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1210,7 +1167,6 @@ TEST_P(End2endTest, CancelRpcBeforeStart) {
}
TEST_P(End2endTest, CancelRpcAfterStart) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1247,7 +1203,6 @@ TEST_P(End2endTest, CancelRpcAfterStart) {
// Client cancels request stream after sending two messages
TEST_P(End2endTest, ClientCancelsRequestStream) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1271,7 +1226,6 @@ TEST_P(End2endTest, ClientCancelsRequestStream) {
// Client cancels server stream after sending some messages
TEST_P(End2endTest, ClientCancelsResponseStream) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1307,7 +1261,6 @@ TEST_P(End2endTest, ClientCancelsResponseStream) {
// Client cancels bidi stream after sending some messages
TEST_P(End2endTest, ClientCancelsBidi) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1343,7 +1296,6 @@ TEST_P(End2endTest, ClientCancelsBidi) {
}
TEST_P(End2endTest, RpcMaxMessageSize) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1366,7 +1318,6 @@ void ReaderThreadFunc(ClientReaderWriter<EchoRequest, EchoResponse>* stream,
// Run a Read and a WritesDone simultaneously.
TEST_P(End2endTest, SimultaneousReadWritesDone) {
MAYBE_SKIP_TEST;
ResetStub();
ClientContext context;
gpr_event ev;
@ -1381,7 +1332,6 @@ TEST_P(End2endTest, SimultaneousReadWritesDone) {
}
TEST_P(End2endTest, ChannelState) {
MAYBE_SKIP_TEST;
if (GetParam().inproc) {
return;
}
@ -1432,7 +1382,6 @@ TEST_P(End2endTest, ChannelStateTimeout) {
// Talking to a non-existing service.
TEST_P(End2endTest, NonExistingService) {
MAYBE_SKIP_TEST;
ResetChannel();
std::unique_ptr<grpc::testing::UnimplementedEchoService::Stub> stub;
stub = grpc::testing::UnimplementedEchoService::NewStub(channel_);
@ -1450,7 +1399,6 @@ TEST_P(End2endTest, NonExistingService) {
// Ask the server to send back a serialized proto in trailer.
// This is an example of setting error details.
TEST_P(End2endTest, BinaryTrailerTest) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1477,7 +1425,6 @@ TEST_P(End2endTest, BinaryTrailerTest) {
}
TEST_P(End2endTest, ExpectErrorTest) {
MAYBE_SKIP_TEST;
ResetStub();
std::vector<ErrorStatus> expected_status;
@ -1529,13 +1476,11 @@ class ProxyEnd2endTest : public End2endTest {
};
TEST_P(ProxyEnd2endTest, SimpleRpc) {
MAYBE_SKIP_TEST;
ResetStub();
SendRpc(stub_.get(), 1, false);
}
TEST_P(ProxyEnd2endTest, SimpleRpcWithEmptyMessages) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1546,7 +1491,6 @@ TEST_P(ProxyEnd2endTest, SimpleRpcWithEmptyMessages) {
}
TEST_P(ProxyEnd2endTest, MultipleRpcs) {
MAYBE_SKIP_TEST;
ResetStub();
std::vector<std::thread> threads;
threads.reserve(10);
@ -1560,7 +1504,6 @@ TEST_P(ProxyEnd2endTest, MultipleRpcs) {
// Set a 10us deadline and make sure proper error is returned.
TEST_P(ProxyEnd2endTest, RpcDeadlineExpires) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1586,7 +1529,6 @@ TEST_P(ProxyEnd2endTest, RpcDeadlineExpires) {
// Set a long but finite deadline.
TEST_P(ProxyEnd2endTest, RpcLongDeadline) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1603,7 +1545,6 @@ TEST_P(ProxyEnd2endTest, RpcLongDeadline) {
// Ask server to echo back the deadline it sees.
TEST_P(ProxyEnd2endTest, EchoDeadline) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1629,7 +1570,6 @@ TEST_P(ProxyEnd2endTest, EchoDeadline) {
// Ask server to echo back the deadline it sees. The rpc has no deadline.
TEST_P(ProxyEnd2endTest, EchoDeadlineForNoDeadlineRpc) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1645,7 +1585,6 @@ TEST_P(ProxyEnd2endTest, EchoDeadlineForNoDeadlineRpc) {
}
TEST_P(ProxyEnd2endTest, UnimplementedRpc) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1661,7 +1600,6 @@ TEST_P(ProxyEnd2endTest, UnimplementedRpc) {
// Client cancels rpc after 10ms
TEST_P(ProxyEnd2endTest, ClientCancelsRpc) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1696,7 +1634,6 @@ TEST_P(ProxyEnd2endTest, ClientCancelsRpc) {
// Server cancels rpc after 1ms
TEST_P(ProxyEnd2endTest, ServerCancelsRpc) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1711,7 +1648,6 @@ TEST_P(ProxyEnd2endTest, ServerCancelsRpc) {
// Make the response larger than the flow control window.
TEST_P(ProxyEnd2endTest, HugeResponse) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1729,7 +1665,6 @@ TEST_P(ProxyEnd2endTest, HugeResponse) {
}
TEST_P(ProxyEnd2endTest, Peer) {
MAYBE_SKIP_TEST;
// Peer is not meaningful for inproc
if (GetParam().inproc) {
return;
@ -1758,7 +1693,6 @@ class SecureEnd2endTest : public End2endTest {
};
TEST_P(SecureEnd2endTest, SimpleRpcWithHost) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
@ -1790,7 +1724,6 @@ bool MetadataContains(
}
TEST_P(SecureEnd2endTest, BlockingAuthMetadataPluginAndProcessorSuccess) {
MAYBE_SKIP_TEST;
auto* processor = new TestAuthMetadataProcessor(true);
StartServer(std::shared_ptr<AuthMetadataProcessor>(processor));
ResetStub();
@ -1816,7 +1749,6 @@ TEST_P(SecureEnd2endTest, BlockingAuthMetadataPluginAndProcessorSuccess) {
}
TEST_P(SecureEnd2endTest, BlockingAuthMetadataPluginAndProcessorFailure) {
MAYBE_SKIP_TEST;
auto* processor = new TestAuthMetadataProcessor(true);
StartServer(std::shared_ptr<AuthMetadataProcessor>(processor));
ResetStub();
@ -1832,7 +1764,6 @@ TEST_P(SecureEnd2endTest, BlockingAuthMetadataPluginAndProcessorFailure) {
}
TEST_P(SecureEnd2endTest, SetPerCallCredentials) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1884,7 +1815,6 @@ class CredentialsInterceptorFactory
};
TEST_P(SecureEnd2endTest, CallCredentialsInterception) {
MAYBE_SKIP_TEST;
if (!GetParam().use_interceptors) {
return;
}
@ -1914,7 +1844,6 @@ TEST_P(SecureEnd2endTest, CallCredentialsInterception) {
}
TEST_P(SecureEnd2endTest, CallCredentialsInterceptionWithSetCredentials) {
MAYBE_SKIP_TEST;
if (!GetParam().use_interceptors) {
return;
}
@ -1949,7 +1878,6 @@ TEST_P(SecureEnd2endTest, CallCredentialsInterceptionWithSetCredentials) {
}
TEST_P(SecureEnd2endTest, OverridePerCallCredentials) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -1987,7 +1915,6 @@ TEST_P(SecureEnd2endTest, OverridePerCallCredentials) {
}
TEST_P(SecureEnd2endTest, AuthMetadataPluginKeyFailure) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -2008,7 +1935,6 @@ TEST_P(SecureEnd2endTest, AuthMetadataPluginKeyFailure) {
}
TEST_P(SecureEnd2endTest, AuthMetadataPluginValueFailure) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -2028,7 +1954,6 @@ TEST_P(SecureEnd2endTest, AuthMetadataPluginValueFailure) {
}
TEST_P(SecureEnd2endTest, AuthMetadataPluginWithDeadline) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
request.mutable_param()->set_skip_cancelled_check(true);
@ -2054,7 +1979,6 @@ TEST_P(SecureEnd2endTest, AuthMetadataPluginWithDeadline) {
}
TEST_P(SecureEnd2endTest, AuthMetadataPluginWithCancel) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
request.mutable_param()->set_skip_cancelled_check(true);
@ -2083,7 +2007,6 @@ TEST_P(SecureEnd2endTest, AuthMetadataPluginWithCancel) {
}
TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginFailure) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -2107,7 +2030,6 @@ TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginFailure) {
}
TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginAndProcessorSuccess) {
MAYBE_SKIP_TEST;
auto* processor = new TestAuthMetadataProcessor(false);
StartServer(std::shared_ptr<AuthMetadataProcessor>(processor));
ResetStub();
@ -2136,7 +2058,6 @@ TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginAndProcessorSuccess) {
}
TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginAndProcessorFailure) {
MAYBE_SKIP_TEST;
auto* processor = new TestAuthMetadataProcessor(false);
StartServer(std::shared_ptr<AuthMetadataProcessor>(processor));
ResetStub();
@ -2155,7 +2076,6 @@ TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginAndProcessorFailure) {
}
TEST_P(SecureEnd2endTest, BlockingAuthMetadataPluginFailure) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -2179,7 +2099,6 @@ TEST_P(SecureEnd2endTest, BlockingAuthMetadataPluginFailure) {
}
TEST_P(SecureEnd2endTest, CompositeCallCreds) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -2212,7 +2131,6 @@ TEST_P(SecureEnd2endTest, CompositeCallCreds) {
}
TEST_P(SecureEnd2endTest, ClientAuthContext) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;
EchoResponse response;
@ -2257,7 +2175,6 @@ class ResourceQuotaEnd2endTest : public End2endTest {
};
TEST_P(ResourceQuotaEnd2endTest, SimpleRequest) {
MAYBE_SKIP_TEST;
ResetStub();
EchoRequest request;

@ -45,17 +45,6 @@
#include "test/core/util/test_config.h"
#include "test/cpp/util/test_credentials_provider.h"
// MAYBE_SKIP_TEST is a macro to determine if this particular test configuration
// should be skipped based on a decision made at SetUp time. In particular, any
// callback tests can only be run if the iomgr can run in the background or if
// the transport is in-process.
#define MAYBE_SKIP_TEST \
do { \
if (do_not_test_) { \
return; \
} \
} while (0)
namespace grpc {
namespace testing {
namespace {
@ -117,15 +106,7 @@ void TestScenario::Log() const {
class MessageAllocatorEnd2endTestBase
: public ::testing::TestWithParam<TestScenario> {
protected:
MessageAllocatorEnd2endTestBase() {
GetParam().Log();
if (GetParam().protocol == Protocol::TCP) {
if (!grpc_iomgr_run_in_background()) {
do_not_test_ = true;
return;
}
}
}
MessageAllocatorEnd2endTestBase() { GetParam().Log(); }
~MessageAllocatorEnd2endTestBase() override = default;
@ -210,7 +191,6 @@ class MessageAllocatorEnd2endTestBase
}
}
bool do_not_test_{false};
int picked_port_{0};
std::shared_ptr<Channel> channel_;
std::unique_ptr<EchoTestService::Stub> stub_;
@ -222,7 +202,6 @@ class MessageAllocatorEnd2endTestBase
class NullAllocatorTest : public MessageAllocatorEnd2endTestBase {};
TEST_P(NullAllocatorTest, SimpleRpc) {
MAYBE_SKIP_TEST;
CreateServer(nullptr);
ResetStub();
SendRpcs(1);
@ -278,7 +257,6 @@ class SimpleAllocatorTest : public MessageAllocatorEnd2endTestBase {
};
TEST_P(SimpleAllocatorTest, SimpleRpc) {
MAYBE_SKIP_TEST;
const int kRpcCount = 10;
std::unique_ptr<SimpleAllocator> allocator(new SimpleAllocator);
CreateServer(allocator.get());
@ -293,7 +271,6 @@ TEST_P(SimpleAllocatorTest, SimpleRpc) {
}
TEST_P(SimpleAllocatorTest, RpcWithEarlyFreeRequest) {
MAYBE_SKIP_TEST;
const int kRpcCount = 10;
std::unique_ptr<SimpleAllocator> allocator(new SimpleAllocator);
auto mutator = [](experimental::RpcAllocatorState* allocator_state,
@ -318,7 +295,6 @@ TEST_P(SimpleAllocatorTest, RpcWithEarlyFreeRequest) {
}
TEST_P(SimpleAllocatorTest, RpcWithReleaseRequest) {
MAYBE_SKIP_TEST;
const int kRpcCount = 10;
std::unique_ptr<SimpleAllocator> allocator(new SimpleAllocator);
std::vector<EchoRequest*> released_requests;
@ -378,7 +354,6 @@ class ArenaAllocatorTest : public MessageAllocatorEnd2endTestBase {
};
TEST_P(ArenaAllocatorTest, SimpleRpc) {
MAYBE_SKIP_TEST;
const int kRpcCount = 10;
std::unique_ptr<ArenaAllocator> allocator(new ArenaAllocator);
CreateServer(allocator.get());
@ -429,10 +404,7 @@ INSTANTIATE_TEST_SUITE_P(ArenaAllocatorTest, ArenaAllocatorTest,
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
// The grpc_init is to cover the MAYBE_SKIP_TEST.
grpc_init();
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
grpc_shutdown();
return ret;
}

@ -357,6 +357,7 @@ grpc_cc_library(
grpc_cc_test(
name = "bm_callback_unary_ping_pong",
size = "large",
srcs = [
"bm_callback_unary_ping_pong.cc",
],

@ -31,7 +31,7 @@ namespace testing {
// internal microbenchmarking tooling
static void SweepSizesArgs(benchmark::internal::Benchmark* b) {
b->Args({0, 0});
for (int i = 1; i <= 128 * 1024 * 1024; i *= 8) {
for (int i = 1; i <= 16 * 1024 * 1024; i *= 8) {
// First argument is the message size of request
// Second argument is the message size of response
b->Args({i, 0});

Loading…
Cancel
Save