aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/codegen/compiler_test_golden40
-rw-r--r--test/cpp/end2end/BUILD20
-rw-r--r--test/cpp/end2end/hybrid_end2end_test.cc43
-rw-r--r--test/cpp/end2end/raw_end2end_test.cc (renamed from test/cpp/end2end/codegen_generic_end2end_test.cc)36
4 files changed, 77 insertions, 62 deletions
diff --git a/test/cpp/codegen/compiler_test_golden b/test/cpp/codegen/compiler_test_golden
index 90dabb5cb7..756f6a0224 100644
--- a/test/cpp/codegen/compiler_test_golden
+++ b/test/cpp/codegen/compiler_test_golden
@@ -346,14 +346,14 @@ class ServiceA final {
}
};
template <class BaseClass>
- class WithCodegenGenericMethod_MethodA1 : public BaseClass {
+ class WithRawMethod_MethodA1 : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
- WithCodegenGenericMethod_MethodA1() {
- ::grpc::Service::MarkMethodCodegenGeneric(0);
+ WithRawMethod_MethodA1() {
+ ::grpc::Service::MarkMethodRaw(0);
}
- ~WithCodegenGenericMethod_MethodA1() override {
+ ~WithRawMethod_MethodA1() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
@@ -366,14 +366,14 @@ class ServiceA final {
}
};
template <class BaseClass>
- class WithCodegenGenericMethod_MethodA2 : public BaseClass {
+ class WithRawMethod_MethodA2 : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
- WithCodegenGenericMethod_MethodA2() {
- ::grpc::Service::MarkMethodCodegenGeneric(1);
+ WithRawMethod_MethodA2() {
+ ::grpc::Service::MarkMethodRaw(1);
}
- ~WithCodegenGenericMethod_MethodA2() override {
+ ~WithRawMethod_MethodA2() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
@@ -386,14 +386,14 @@ class ServiceA final {
}
};
template <class BaseClass>
- class WithCodegenGenericMethod_MethodA3 : public BaseClass {
+ class WithRawMethod_MethodA3 : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
- WithCodegenGenericMethod_MethodA3() {
- ::grpc::Service::MarkMethodCodegenGeneric(2);
+ WithRawMethod_MethodA3() {
+ ::grpc::Service::MarkMethodRaw(2);
}
- ~WithCodegenGenericMethod_MethodA3() override {
+ ~WithRawMethod_MethodA3() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
@@ -406,14 +406,14 @@ class ServiceA final {
}
};
template <class BaseClass>
- class WithCodegenGenericMethod_MethodA4 : public BaseClass {
+ class WithRawMethod_MethodA4 : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
- WithCodegenGenericMethod_MethodA4() {
- ::grpc::Service::MarkMethodCodegenGeneric(3);
+ WithRawMethod_MethodA4() {
+ ::grpc::Service::MarkMethodRaw(3);
}
- ~WithCodegenGenericMethod_MethodA4() override {
+ ~WithRawMethod_MethodA4() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
@@ -558,14 +558,14 @@ class ServiceB final {
}
};
template <class BaseClass>
- class WithCodegenGenericMethod_MethodB1 : public BaseClass {
+ class WithRawMethod_MethodB1 : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
- WithCodegenGenericMethod_MethodB1() {
- ::grpc::Service::MarkMethodCodegenGeneric(0);
+ WithRawMethod_MethodB1() {
+ ::grpc::Service::MarkMethodRaw(0);
}
- ~WithCodegenGenericMethod_MethodB1() override {
+ ~WithRawMethod_MethodB1() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD
index 8ab0811ffa..23dde69dd0 100644
--- a/test/cpp/end2end/BUILD
+++ b/test/cpp/end2end/BUILD
@@ -242,6 +242,26 @@ grpc_cc_test(
)
grpc_cc_test(
+ name = "raw_end2end_test",
+ srcs = ["raw_end2end_test.cc"],
+ external_deps = [
+ "gtest",
+ ],
+ deps = [
+ ":test_service_impl",
+ "//:gpr",
+ "//:grpc",
+ "//:grpc++",
+ "//src/proto/grpc/testing:echo_messages_proto",
+ "//src/proto/grpc/testing:echo_proto",
+ "//src/proto/grpc/testing/duplicate:echo_duplicate_proto",
+ "//test/core/util:gpr_test_util",
+ "//test/core/util:grpc_test_util",
+ "//test/cpp/util:test_util",
+ ],
+)
+
+grpc_cc_test(
name = "mock_test",
srcs = ["mock_test.cc"],
external_deps = [
diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc
index 4238c59380..339eadde92 100644
--- a/test/cpp/end2end/hybrid_end2end_test.cc
+++ b/test/cpp/end2end/hybrid_end2end_test.cc
@@ -74,12 +74,12 @@ void HandleEcho(Service* service, ServerCompletionQueue* cq, bool dup_service) {
Verify(cq, 2, true);
}
-// Handlers to handle codegen generic request at a server. To be run in a
+// Handlers to handle raw request at a server. To be run in a
// separate thread. Note that this is the same as the async version, except
// that the req/resp are ByteBuffers
template <class Service>
-void HandleCodegenGenericEcho(Service* service, ServerCompletionQueue* cq,
- bool dup_service) {
+void HandleRawEcho(Service* service, ServerCompletionQueue* cq,
+ bool dup_service) {
ServerContext srv_ctx;
GenericServerAsyncResponseWriter response_writer(&srv_ctx);
ByteBuffer recv_buffer;
@@ -114,8 +114,7 @@ void HandleClientStreaming(Service* service, ServerCompletionQueue* cq) {
}
template <class Service>
-void HandleCodegenGenericClientStreaming(Service* service,
- ServerCompletionQueue* cq) {
+void HandleRawClientStreaming(Service* service, ServerCompletionQueue* cq) {
ServerContext srv_ctx;
ByteBuffer recv_buffer;
EchoRequest recv_request;
@@ -425,32 +424,30 @@ TEST_F(HybridEnd2endTest, AsyncEcho) {
echo_handler_thread.join();
}
-TEST_F(HybridEnd2endTest, CodegenGenericEcho) {
- typedef EchoTestService::WithCodegenGenericMethod_Echo<TestServiceImpl> SType;
+TEST_F(HybridEnd2endTest, RawEcho) {
+ typedef EchoTestService::WithRawMethod_Echo<TestServiceImpl> SType;
SType service;
SetUpServer(&service, nullptr, nullptr);
ResetStub();
- std::thread echo_handler_thread(HandleCodegenGenericEcho<SType>, &service,
- cqs_[0].get(), false);
+ std::thread echo_handler_thread(HandleRawEcho<SType>, &service, cqs_[0].get(),
+ false);
TestAllMethods();
echo_handler_thread.join();
}
-TEST_F(HybridEnd2endTest, CodegenGenericRequestStream) {
- typedef EchoTestService::WithCodegenGenericMethod_RequestStream<
- TestServiceImpl>
- SType;
+TEST_F(HybridEnd2endTest, RawRequestStream) {
+ typedef EchoTestService::WithRawMethod_RequestStream<TestServiceImpl> SType;
SType service;
SetUpServer(&service, nullptr, nullptr);
ResetStub();
- std::thread request_stream_handler_thread(
- HandleCodegenGenericClientStreaming<SType>, &service, cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleRawClientStreaming<SType>,
+ &service, cqs_[0].get());
TestAllMethods();
request_stream_handler_thread.join();
}
-TEST_F(HybridEnd2endTest, AsyncEchoCodegenGenericRequestStream) {
- typedef EchoTestService::WithCodegenGenericMethod_RequestStream<
+TEST_F(HybridEnd2endTest, AsyncEchoRawRequestStream) {
+ typedef EchoTestService::WithRawMethod_RequestStream<
EchoTestService::WithAsyncMethod_Echo<TestServiceImpl>>
SType;
SType service;
@@ -458,15 +455,15 @@ TEST_F(HybridEnd2endTest, AsyncEchoCodegenGenericRequestStream) {
ResetStub();
std::thread echo_handler_thread(HandleEcho<SType>, &service, cqs_[0].get(),
false);
- std::thread request_stream_handler_thread(
- HandleCodegenGenericClientStreaming<SType>, &service, cqs_[1].get());
+ std::thread request_stream_handler_thread(HandleRawClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
request_stream_handler_thread.join();
echo_handler_thread.join();
}
-TEST_F(HybridEnd2endTest, GenericEchoCodegenGenericRequestStream) {
- typedef EchoTestService::WithCodegenGenericMethod_RequestStream<
+TEST_F(HybridEnd2endTest, GenericEchoRawRequestStream) {
+ typedef EchoTestService::WithRawMethod_RequestStream<
EchoTestService::WithGenericMethod_Echo<TestServiceImpl>>
SType;
SType service;
@@ -475,8 +472,8 @@ TEST_F(HybridEnd2endTest, GenericEchoCodegenGenericRequestStream) {
ResetStub();
std::thread generic_handler_thread(HandleGenericCall, &generic_service,
cqs_[0].get());
- std::thread request_stream_handler_thread(
- HandleCodegenGenericClientStreaming<SType>, &service, cqs_[1].get());
+ std::thread request_stream_handler_thread(HandleRawClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
generic_handler_thread.join();
request_stream_handler_thread.join();
diff --git a/test/cpp/end2end/codegen_generic_end2end_test.cc b/test/cpp/end2end/raw_end2end_test.cc
index 6bb5712eb2..37fdc423fd 100644
--- a/test/cpp/end2end/codegen_generic_end2end_test.cc
+++ b/test/cpp/end2end/raw_end2end_test.cc
@@ -189,9 +189,9 @@ class Verifier {
bool lambda_run_;
};
-class CodegenGenericEnd2EndTest : public ::testing::Test {
+class RawEnd2EndTest : public ::testing::Test {
protected:
- CodegenGenericEnd2EndTest() {}
+ RawEnd2EndTest() {}
void SetUp() override {
port_ = grpc_pick_unused_port_or_die();
@@ -259,7 +259,7 @@ class CodegenGenericEnd2EndTest : public ::testing::Test {
};
// Regular Async, both peers use proto
-TEST_F(CodegenGenericEnd2EndTest, PureAsyncService) {
+TEST_F(RawEnd2EndTest, PureAsyncService) {
typedef grpc::testing::EchoTestService::AsyncService SType;
ResetStub();
auto service = BuildAndStartServer<SType>();
@@ -282,8 +282,8 @@ TEST_F(CodegenGenericEnd2EndTest, PureAsyncService) {
}
// Client uses proto, server uses generic codegen, unary
-TEST_F(CodegenGenericEnd2EndTest, CodegenGenericServerUnary) {
- typedef grpc::testing::EchoTestService::WithCodegenGenericMethod_Echo<
+TEST_F(RawEnd2EndTest, RawServerUnary) {
+ typedef grpc::testing::EchoTestService::WithRawMethod_Echo<
grpc::testing::EchoTestService::Service>
SType;
ResetStub();
@@ -310,11 +310,10 @@ TEST_F(CodegenGenericEnd2EndTest, CodegenGenericServerUnary) {
}
// Client uses proto, server uses generic codegen, client streaming
-TEST_F(CodegenGenericEnd2EndTest, CodegenGenericServerClientStreaming) {
- typedef grpc::testing::EchoTestService::
- WithCodegenGenericMethod_RequestStream<
- grpc::testing::EchoTestService::Service>
- SType;
+TEST_F(RawEnd2EndTest, RawServerClientStreaming) {
+ typedef grpc::testing::EchoTestService::WithRawMethod_RequestStream<
+ grpc::testing::EchoTestService::Service>
+ SType;
ResetStub();
auto service = BuildAndStartServer<SType>();
@@ -357,11 +356,10 @@ TEST_F(CodegenGenericEnd2EndTest, CodegenGenericServerClientStreaming) {
}
// Client uses proto, server uses generic codegen, server streaming
-TEST_F(CodegenGenericEnd2EndTest, CodegenGenericServerServerStreaming) {
- typedef grpc::testing::EchoTestService::
- WithCodegenGenericMethod_ResponseStream<
- grpc::testing::EchoTestService::Service>
- SType;
+TEST_F(RawEnd2EndTest, RawServerServerStreaming) {
+ typedef grpc::testing::EchoTestService::WithRawMethod_ResponseStream<
+ grpc::testing::EchoTestService::Service>
+ SType;
ResetStub();
auto service = BuildAndStartServer<SType>();
grpc::GenericServerAsyncWriter srv_stream(&srv_ctx_);
@@ -400,8 +398,8 @@ TEST_F(CodegenGenericEnd2EndTest, CodegenGenericServerServerStreaming) {
}
// Client uses proto, server uses generic codegen, bidi streaming
-TEST_F(CodegenGenericEnd2EndTest, CodegenGenericServerBidiStreaming) {
- typedef grpc::testing::EchoTestService::WithCodegenGenericMethod_BidiStream<
+TEST_F(RawEnd2EndTest, RawServerBidiStreaming) {
+ typedef grpc::testing::EchoTestService::WithRawMethod_BidiStream<
grpc::testing::EchoTestService::Service>
SType;
ResetStub();
@@ -443,8 +441,8 @@ TEST_F(CodegenGenericEnd2EndTest, CodegenGenericServerBidiStreaming) {
}
// Testing that this pattern compiles
-TEST_F(CodegenGenericEnd2EndTest, CompileTest) {
- typedef grpc::testing::EchoTestService::WithCodegenGenericMethod_Echo<
+TEST_F(RawEnd2EndTest, CompileTest) {
+ typedef grpc::testing::EchoTestService::WithRawMethod_Echo<
grpc::testing::EchoTestService::AsyncService>
SType;
ResetStub();