aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/end2end/end2end_test.cc4
-rw-r--r--test/cpp/end2end/streaming_throughput_test.cc94
-rw-r--r--test/cpp/interop/client.cc4
-rw-r--r--test/cpp/interop/interop_client.cc3
-rw-r--r--test/cpp/interop/interop_test.cc1
-rw-r--r--test/cpp/qps/driver.cc8
-rw-r--r--test/cpp/qps/server_async.cc4
-rw-r--r--test/cpp/qps/server_sync.cc4
-rw-r--r--test/cpp/util/string_ref_test.cc18
9 files changed, 69 insertions, 71 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index 49a38ce544..b67550eec2 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -193,7 +193,6 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor {
const char TestAuthMetadataProcessor::kGoodGuy[] = "Dr Jekyll";
const char TestAuthMetadataProcessor::kIdentityPropName[] = "novel identity";
-
class Proxy : public ::grpc::cpp::test::util::TestService::Service {
public:
Proxy(std::shared_ptr<Channel> channel)
@@ -259,7 +258,8 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
if (request->has_param() &&
(request->param().expected_client_identity().length() > 0 ||
request->param().check_auth_context())) {
- CheckServerAuthContext(context, request->param().expected_client_identity());
+ CheckServerAuthContext(context,
+ request->param().expected_client_identity());
}
if (request->has_param() &&
request->param().response_message_length() > 0) {
diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc
index 344bf507ce..d4ab1486cc 100644
--- a/test/cpp/end2end/streaming_throughput_test.cc
+++ b/test/cpp/end2end/streaming_throughput_test.cc
@@ -58,57 +58,60 @@ using grpc::cpp::test::util::EchoRequest;
using grpc::cpp::test::util::EchoResponse;
using std::chrono::system_clock;
-const char* kLargeString = "("
- "To be, or not to be- that is the question:"
- "Whether 'tis nobler in the mind to suffer"
- "The slings and arrows of outrageous fortune"
- "Or to take arms against a sea of troubles,"
- "And by opposing end them. To die- to sleep-"
- "No more; and by a sleep to say we end"
- "The heartache, and the thousand natural shock"
- "That flesh is heir to. 'Tis a consummation"
- "Devoutly to be wish'd. To die- to sleep."
- "To sleep- perchance to dream: ay, there's the rub!"
- "For in that sleep of death what dreams may come"
- "When we have shuffled off this mortal coil,"
- "Must give us pause. There's the respect"
- "That makes calamity of so long life."
- "For who would bear the whips and scorns of time,"
- "Th' oppressor's wrong, the proud man's contumely,"
- "The pangs of despis'd love, the law's delay,"
- "The insolence of office, and the spurns"
- "That patient merit of th' unworthy takes,"
- "When he himself might his quietus make"
- "With a bare bodkin? Who would these fardels bear,"
- "To grunt and sweat under a weary life,"
- "But that the dread of something after death-"
- "The undiscover'd country, from whose bourn"
- "No traveller returns- puzzles the will,"
- "And makes us rather bear those ills we have"
- "Than fly to others that we know not of?"
- "Thus conscience does make cowards of us all,"
- "And thus the native hue of resolution"
- "Is sicklied o'er with the pale cast of thought,"
- "And enterprises of great pith and moment"
- "With this regard their currents turn awry"
- "And lose the name of action.- Soft you now!"
- "The fair Ophelia!- Nymph, in thy orisons"
- "Be all my sins rememb'red.";
+const char* kLargeString =
+ "("
+ "To be, or not to be- that is the question:"
+ "Whether 'tis nobler in the mind to suffer"
+ "The slings and arrows of outrageous fortune"
+ "Or to take arms against a sea of troubles,"
+ "And by opposing end them. To die- to sleep-"
+ "No more; and by a sleep to say we end"
+ "The heartache, and the thousand natural shock"
+ "That flesh is heir to. 'Tis a consummation"
+ "Devoutly to be wish'd. To die- to sleep."
+ "To sleep- perchance to dream: ay, there's the rub!"
+ "For in that sleep of death what dreams may come"
+ "When we have shuffled off this mortal coil,"
+ "Must give us pause. There's the respect"
+ "That makes calamity of so long life."
+ "For who would bear the whips and scorns of time,"
+ "Th' oppressor's wrong, the proud man's contumely,"
+ "The pangs of despis'd love, the law's delay,"
+ "The insolence of office, and the spurns"
+ "That patient merit of th' unworthy takes,"
+ "When he himself might his quietus make"
+ "With a bare bodkin? Who would these fardels bear,"
+ "To grunt and sweat under a weary life,"
+ "But that the dread of something after death-"
+ "The undiscover'd country, from whose bourn"
+ "No traveller returns- puzzles the will,"
+ "And makes us rather bear those ills we have"
+ "Than fly to others that we know not of?"
+ "Thus conscience does make cowards of us all,"
+ "And thus the native hue of resolution"
+ "Is sicklied o'er with the pale cast of thought,"
+ "And enterprises of great pith and moment"
+ "With this regard their currents turn awry"
+ "And lose the name of action.- Soft you now!"
+ "The fair Ophelia!- Nymph, in thy orisons"
+ "Be all my sins rememb'red.";
namespace grpc {
namespace testing {
class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
public:
- static void BidiStream_Sender(ServerReaderWriter<EchoResponse, EchoRequest>* stream, gpr_atm* should_exit) {
+ static void BidiStream_Sender(
+ ServerReaderWriter<EchoResponse, EchoRequest>* stream,
+ gpr_atm* should_exit) {
EchoResponse response;
response.set_message(kLargeString);
while (gpr_atm_acq_load(should_exit) == static_cast<gpr_atm>(0)) {
- struct timespec tv = {0, 1000000}; // 1 ms
+ struct timespec tv = {0, 1000000}; // 1 ms
struct timespec rem;
// TODO (vpai): Mark this blocking
while (nanosleep(&tv, &rem) != 0) {
- tv = rem;
+ tv = rem;
};
stream->Write(response);
@@ -123,14 +126,15 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
gpr_atm should_exit;
gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(0));
- std::thread sender(std::bind(&TestServiceImpl::BidiStream_Sender, stream, &should_exit));
+ std::thread sender(
+ std::bind(&TestServiceImpl::BidiStream_Sender, stream, &should_exit));
while (stream->Read(&request)) {
- struct timespec tv = {0, 3000000}; // 3 ms
+ struct timespec tv = {0, 3000000}; // 3 ms
struct timespec rem;
// TODO (vpai): Mark this blocking
while (nanosleep(&tv, &rem) != 0) {
- tv = rem;
+ tv = rem;
};
}
gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(1));
@@ -155,8 +159,8 @@ class End2endTest : public ::testing::Test {
void TearDown() GRPC_OVERRIDE { server_->Shutdown(); }
void ResetStub() {
- std::shared_ptr<Channel> channel = CreateChannel(
- server_address_.str(), InsecureCredentials());
+ std::shared_ptr<Channel> channel =
+ CreateChannel(server_address_.str(), InsecureCredentials());
stub_ = grpc::cpp::test::util::TestService::NewStub(channel);
}
@@ -169,7 +173,7 @@ class End2endTest : public ::testing::Test {
static void Drainer(ClientReaderWriter<EchoRequest, EchoResponse>* reader) {
EchoResponse response;
while (reader->Read(&response)) {
- // Just drain out the responses as fast as possible.
+ // Just drain out the responses as fast as possible.
}
}
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index 58c71cca35..8f5ea0084f 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -146,8 +146,8 @@ int main(int argc, char** argv) {
if (FLAGS_enable_ssl) {
grpc::string json_key = GetServiceAccountJsonKey();
client.DoJwtTokenCreds(json_key);
- client.DoOauth2AuthToken(
- FLAGS_default_service_account, FLAGS_oauth_scope);
+ client.DoOauth2AuthToken(FLAGS_default_service_account,
+ FLAGS_oauth_scope);
client.DoPerRpcCreds(json_key);
}
// compute_engine_creds only runs in GCE.
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index 02e10a50aa..5169945762 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -203,8 +203,7 @@ void InteropClient::DoOauth2AuthToken(const grpc::string& username,
}
void InteropClient::DoPerRpcCreds(const grpc::string& json_key) {
- gpr_log(GPR_INFO,
- "Sending a unary rpc with per-rpc JWT access token ...");
+ gpr_log(GPR_INFO, "Sending a unary rpc with per-rpc JWT access token ...");
SimpleRequest request;
SimpleResponse response;
request.set_fill_username(true);
diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc
index f01b032e95..faf6698903 100644
--- a/test/cpp/interop/interop_test.cc
+++ b/test/cpp/interop/interop_test.cc
@@ -55,7 +55,6 @@ extern "C" {
#include "src/core/support/string.h"
}
-
int test_client(const char* root, const char* host, int port) {
int status;
pid_t cli;
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 6e71c45935..ac763e4b3c 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -153,8 +153,8 @@ std::unique_ptr<ScenarioResult> RunScenario(
// where class contained in std::vector must have a copy constructor
auto* servers = new ServerData[num_servers];
for (size_t i = 0; i < num_servers; i++) {
- servers[i].stub = Worker::NewStub(CreateChannel(workers[i],
- InsecureCredentials()));
+ servers[i].stub =
+ Worker::NewStub(CreateChannel(workers[i], InsecureCredentials()));
ServerArgs args;
result_server_config = server_config;
result_server_config.set_host(workers[i]);
@@ -181,8 +181,8 @@ std::unique_ptr<ScenarioResult> RunScenario(
// where class contained in std::vector must have a copy constructor
auto* clients = new ClientData[num_clients];
for (size_t i = 0; i < num_clients; i++) {
- clients[i].stub = Worker::NewStub(CreateChannel(workers[i + num_servers],
- InsecureCredentials()));
+ clients[i].stub = Worker::NewStub(
+ CreateChannel(workers[i + num_servers], InsecureCredentials()));
ClientArgs args;
result_client_config = client_config;
result_client_config.set_host(workers[i + num_servers]);
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 516598a0e2..76575e42da 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -52,7 +52,6 @@
#include "test/cpp/qps/qpstest.grpc.pb.h"
#include "test/cpp/qps/server.h"
-
namespace grpc {
namespace testing {
@@ -98,8 +97,7 @@ class AsyncQpsServerTest : public Server {
}
}
~AsyncQpsServerTest() {
- auto deadline = std::chrono::system_clock::now() +
- std::chrono::seconds(10);
+ auto deadline = std::chrono::system_clock::now() + std::chrono::seconds(10);
server_->Shutdown(deadline);
for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) {
(*ss)->set_shutdown();
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index d930ba2464..dfaa760617 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -47,7 +47,6 @@
#include "test/cpp/qps/server.h"
#include "test/cpp/qps/timer.h"
-
namespace grpc {
namespace testing {
@@ -86,8 +85,7 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service {
class SynchronousServer GRPC_FINAL : public grpc::testing::Server {
public:
SynchronousServer(const ServerConfig& config, int port)
- : impl_(MakeImpl(port)) {
- }
+ : impl_(MakeImpl(port)) {}
private:
std::unique_ptr<grpc::Server> MakeImpl(int port) {
diff --git a/test/cpp/util/string_ref_test.cc b/test/cpp/util/string_ref_test.cc
index 465072d43e..44a298d892 100644
--- a/test/cpp/util/string_ref_test.cc
+++ b/test/cpp/util/string_ref_test.cc
@@ -45,8 +45,7 @@ const char kTestStringWithEmbeddedNull[] = "blah\0foo";
const size_t kTestStringWithEmbeddedNullLength = 8;
const char kTestUnrelatedString[] = "foo";
-class StringRefTest : public ::testing::Test {
-};
+class StringRefTest : public ::testing::Test {};
TEST_F(StringRefTest, Empty) {
string_ref s;
@@ -74,7 +73,8 @@ TEST_F(StringRefTest, FromString) {
}
TEST_F(StringRefTest, CopyConstructor) {
- string_ref s1(kTestString);;
+ string_ref s1(kTestString);
+ ;
string_ref s2(s1);
EXPECT_EQ(s1.length(), s2.length());
EXPECT_EQ(s1.data(), s2.data());
@@ -89,7 +89,8 @@ TEST_F(StringRefTest, FromStringWithEmbeddedNull) {
}
TEST_F(StringRefTest, Assignment) {
- string_ref s1(kTestString);;
+ string_ref s1(kTestString);
+ ;
string_ref s2;
EXPECT_EQ(nullptr, s2.data());
s2 = s1;
@@ -109,7 +110,7 @@ TEST_F(StringRefTest, Iterator) {
TEST_F(StringRefTest, ReverseIterator) {
string_ref s(kTestString);
size_t i = strlen(kTestString);
- for (auto rit = s.crbegin(); rit != s.crend(); ++rit) {
+ for (auto rit = s.crbegin(); rit != s.crend(); ++rit) {
EXPECT_EQ(kTestString[--i], *rit);
}
EXPECT_EQ(0U, i);
@@ -168,9 +169,9 @@ TEST_F(StringRefTest, Find) {
EXPECT_EQ(0U, s1.find(s1));
EXPECT_EQ(0U, s2.find(s2));
EXPECT_EQ(0U, s3.find(s3));
- EXPECT_EQ(string_ref::npos,s1.find(s2) );
- EXPECT_EQ(string_ref::npos,s2.find(s1));
- EXPECT_EQ(string_ref::npos,s1.find(s3));
+ EXPECT_EQ(string_ref::npos, s1.find(s2));
+ EXPECT_EQ(string_ref::npos, s2.find(s1));
+ EXPECT_EQ(string_ref::npos, s1.find(s3));
EXPECT_EQ(0U, s3.find(s1));
EXPECT_EQ(5U, s3.find(s2));
EXPECT_EQ(string_ref::npos, s1.find('z'));
@@ -212,4 +213,3 @@ int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-