clang-format c++ code
diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc
index 59ca33c..24251f2 100644
--- a/test/cpp/client/credentials_test.cc
+++ b/test/cpp/client/credentials_test.cc
@@ -54,7 +54,7 @@
} // namespace testing
} // namespace grpc
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
grpc_init();
int ret = RUN_ALL_TESTS();
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 70df9e1..e347120 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -66,7 +66,7 @@
namespace {
-void* tag(int i) { return (void*)(gpr_intptr)i; }
+void* tag(int i) { return (void*)(gpr_intptr) i; }
void verify_ok(CompletionQueue* cq, int i, bool expect_ok) {
bool ok;
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index 4a0d2c5..a2faa62 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -68,7 +68,7 @@
namespace testing {
namespace {
-void* tag(int i) { return (void*)(gpr_intptr)i; }
+void* tag(int i) { return (void*)(gpr_intptr) i; }
void verify_ok(CompletionQueue* cq, int i, bool expect_ok) {
bool ok;
@@ -91,7 +91,7 @@
class GenericEnd2endTest : public ::testing::Test {
protected:
- GenericEnd2endTest() : generic_service_("*") {}
+ GenericEnd2endTest() : generic_service_("*") {}
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
@@ -116,8 +116,8 @@
}
void ResetStub() {
- std::shared_ptr<ChannelInterface> channel =
- CreateChannel(server_address_.str(), InsecureCredentials(), ChannelArguments());
+ std::shared_ptr<ChannelInterface> channel = CreateChannel(
+ server_address_.str(), InsecureCredentials(), ChannelArguments());
stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel));
}
@@ -238,7 +238,6 @@
client_ok(6);
EXPECT_EQ(send_response.message(), recv_response.message());
-
cli_stream->WritesDone(tag(7));
client_ok(7);
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index e5645e5..ef41067 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -237,8 +237,7 @@
}
void DoJwtTokenCreds() {
- gpr_log(GPR_INFO,
- "Sending a large unary rpc with JWT token credentials ...");
+ gpr_log(GPR_INFO, "Sending a large unary rpc with JWT token credentials ...");
std::shared_ptr<ChannelInterface> channel =
CreateChannelForTestCase("jwt_token_creds");
SimpleRequest request;
diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc
index 811e0eb..a7a5cc0 100644
--- a/test/cpp/interop/interop_test.cc
+++ b/test/cpp/interop/interop_test.cc
@@ -54,13 +54,13 @@
#include <grpc/support/log.h>
#include "test/core/util/port.h"
-int test_client(const char *root, const char *host, int port) {
+int test_client(const char* root, const char* host, int port) {
int status;
pid_t cli;
cli = fork();
if (cli == 0) {
- char *binary_path;
- char *port_arg;
+ char* binary_path;
+ char* port_arg;
gpr_asprintf(&binary_path, "%s/interop_client", root);
gpr_asprintf(&port_arg, "--server_port=%d", port);
@@ -78,9 +78,9 @@
return 0;
}
-int main(int argc, char **argv) {
- char *me = argv[0];
- char *lslash = strrchr(me, '/');
+int main(int argc, char** argv) {
+ char* me = argv[0];
+ char* lslash = strrchr(me, '/');
char root[1024];
int port = grpc_pick_unused_port_or_die();
int status;
@@ -104,8 +104,8 @@
/* start the server */
svr = fork();
if (svr == 0) {
- char *binary_path;
- char *port_arg;
+ char* binary_path;
+ char* port_arg;
gpr_asprintf(&binary_path, "%s/interop_server", root);
gpr_asprintf(&port_arg, "--port=%d", port);
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index c6535be..526f37a 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -61,23 +61,23 @@
virtual ~ClientRpcContext() {}
virtual bool RunNextState() = 0; // do next state, return false if steps done
virtual void StartNewClone() = 0;
- static void *tag(ClientRpcContext *c) { return reinterpret_cast<void *>(c); }
- static ClientRpcContext *detag(void *t) {
- return reinterpret_cast<ClientRpcContext *>(t);
+ static void* tag(ClientRpcContext* c) { return reinterpret_cast<void*>(c); }
+ static ClientRpcContext* detag(void* t) {
+ return reinterpret_cast<ClientRpcContext*>(t);
}
- virtual void report_stats(Histogram *hist) = 0;
+ virtual void report_stats(Histogram* hist) = 0;
};
template <class RequestType, class ResponseType>
class ClientRpcContextUnaryImpl : public ClientRpcContext {
public:
ClientRpcContextUnaryImpl(
- TestService::Stub *stub, const RequestType &req,
+ TestService::Stub* stub, const RequestType& req,
std::function<
std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>(
- TestService::Stub *, grpc::ClientContext *, const RequestType &,
- void *)> start_req,
- std::function<void(grpc::Status, ResponseType *)> on_done)
+ TestService::Stub*, grpc::ClientContext*, const RequestType&,
+ void*)> start_req,
+ std::function<void(grpc::Status, ResponseType*)> on_done)
: context_(),
stub_(stub),
req_(req),
@@ -90,7 +90,7 @@
start_req(stub_, &context_, req_, ClientRpcContext::tag(this))) {}
~ClientRpcContextUnaryImpl() GRPC_OVERRIDE {}
bool RunNextState() GRPC_OVERRIDE { return (this->*next_state_)(); }
- void report_stats(Histogram *hist) GRPC_OVERRIDE {
+ void report_stats(Histogram* hist) GRPC_OVERRIDE {
hist->Add((Timer::Now() - start_) * 1e9);
}
@@ -113,13 +113,13 @@
return false;
}
grpc::ClientContext context_;
- TestService::Stub *stub_;
+ TestService::Stub* stub_;
RequestType req_;
ResponseType response_;
bool (ClientRpcContextUnaryImpl::*next_state_)();
- std::function<void(grpc::Status, ResponseType *)> callback_;
+ std::function<void(grpc::Status, ResponseType*)> callback_;
std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>(
- TestService::Stub *, grpc::ClientContext *, const RequestType &, void *)>
+ TestService::Stub*, grpc::ClientContext*, const RequestType&, void*)>
start_req_;
grpc::Status status_;
double start_;
@@ -129,13 +129,13 @@
class AsyncClient GRPC_FINAL : public Client {
public:
- explicit AsyncClient(const ClientConfig &config) : Client(config) {
+ explicit AsyncClient(const ClientConfig& config) : Client(config) {
for (int i = 0; i < config.async_client_threads(); i++) {
cli_cqs_.emplace_back(new CompletionQueue);
}
auto payload_size = config.payload_size();
- auto check_done = [payload_size](grpc::Status s, SimpleResponse *response) {
+ auto check_done = [payload_size](grpc::Status s, SimpleResponse* response) {
GPR_ASSERT(s.IsOk() && (response->payload().type() ==
grpc::testing::PayloadType::COMPRESSABLE) &&
(response->payload().body().length() ==
@@ -144,16 +144,16 @@
int t = 0;
for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) {
- for (auto &channel : channels_) {
- auto *cq = cli_cqs_[t].get();
+ for (auto& channel : channels_) {
+ auto* cq = cli_cqs_[t].get();
t = (t + 1) % cli_cqs_.size();
- auto start_req = [cq](TestService::Stub *stub, grpc::ClientContext *ctx,
- const SimpleRequest &request, void *tag) {
+ auto start_req = [cq](TestService::Stub* stub, grpc::ClientContext* ctx,
+ const SimpleRequest& request, void* tag) {
return stub->AsyncUnaryCall(ctx, request, cq, tag);
};
- TestService::Stub *stub = channel.get_stub();
- const SimpleRequest &request = request_;
+ TestService::Stub* stub = channel.get_stub();
+ const SimpleRequest& request = request_;
new ClientRpcContextUnaryImpl<SimpleRequest, SimpleResponse>(
stub, request, start_req, check_done);
}
@@ -165,9 +165,9 @@
~AsyncClient() GRPC_OVERRIDE {
EndThreads();
- for (auto &cq : cli_cqs_) {
+ for (auto& cq : cli_cqs_) {
cq->Shutdown();
- void *got_tag;
+ void* got_tag;
bool ok;
while (cq->Next(&got_tag, &ok)) {
delete ClientRpcContext::detag(got_tag);
@@ -175,12 +175,12 @@
}
}
- void ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE {
- void *got_tag;
+ void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE {
+ void* got_tag;
bool ok;
cli_cqs_[thread_idx]->Next(&got_tag, &ok);
- ClientRpcContext *ctx = ClientRpcContext::detag(got_tag);
+ ClientRpcContext* ctx = ClientRpcContext::detag(got_tag);
if (ctx->RunNextState() == false) {
// call the callback and then delete it
ctx->report_stats(histogram);
@@ -193,7 +193,7 @@
std::vector<std::unique_ptr<CompletionQueue>> cli_cqs_;
};
-std::unique_ptr<Client> CreateAsyncClient(const ClientConfig &args) {
+std::unique_ptr<Client> CreateAsyncClient(const ClientConfig& args) {
return std::unique_ptr<Client>(new AsyncClient(args));
}
diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc
index bf51e74..5e9a577 100644
--- a/test/cpp/qps/qps_driver.cc
+++ b/test/cpp/qps/qps_driver.cc
@@ -69,7 +69,7 @@
using namespace google;
using namespace gflags;
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_init();
ParseCommandLineFlags(&argc, &argv, true);
diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc
index 005f0f9..6a207d8 100644
--- a/test/cpp/qps/server.cc
+++ b/test/cpp/qps/server.cc
@@ -73,8 +73,8 @@
// In some distros, gflags is in the namespace google, and in some others,
// in gflags. This hack is enabling us to find both.
-namespace google { }
-namespace gflags { }
+namespace google {}
+namespace gflags {}
using namespace google;
using namespace gflags;
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 19778e5..fcb5ac6 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -62,9 +62,9 @@
class AsyncQpsServerTest : public Server {
public:
- AsyncQpsServerTest(const ServerConfig &config, int port)
+ AsyncQpsServerTest(const ServerConfig& config, int port)
: srv_cq_(), async_service_(&srv_cq_), server_(nullptr) {
- char *server_address = NULL;
+ char* server_address = NULL;
gpr_join_host_port(&server_address, "::", port);
ServerBuilder builder;
@@ -87,10 +87,10 @@
threads_.push_back(std::thread([=]() {
// Wait until work is available or we are shutting down
bool ok;
- void *got_tag;
+ void* got_tag;
while (srv_cq_.Next(&got_tag, &ok)) {
if (ok) {
- ServerRpcContext *ctx = detag(got_tag);
+ ServerRpcContext* ctx = detag(got_tag);
// The tag is a pointer to an RPC context to invoke
if (ctx->RunNextState() == false) {
// this RPC context is done, so refresh it
@@ -105,7 +105,7 @@
~AsyncQpsServerTest() {
server_->Shutdown();
srv_cq_.Shutdown();
- for (auto &thr : threads_) {
+ for (auto& thr : threads_) {
thr.join();
}
while (!contexts_.empty()) {
@@ -122,21 +122,21 @@
virtual bool RunNextState() = 0; // do next state, return false if all done
virtual void Reset() = 0; // start this back at a clean state
};
- static void *tag(ServerRpcContext *func) {
- return reinterpret_cast<void *>(func);
+ static void* tag(ServerRpcContext* func) {
+ return reinterpret_cast<void*>(func);
}
- static ServerRpcContext *detag(void *tag) {
- return reinterpret_cast<ServerRpcContext *>(tag);
+ static ServerRpcContext* detag(void* tag) {
+ return reinterpret_cast<ServerRpcContext*>(tag);
}
template <class RequestType, class ResponseType>
class ServerRpcContextUnaryImpl : public ServerRpcContext {
public:
ServerRpcContextUnaryImpl(
- std::function<void(ServerContext *, RequestType *,
- grpc::ServerAsyncResponseWriter<ResponseType> *,
- void *)> request_method,
- std::function<grpc::Status(const RequestType *, ResponseType *)>
+ std::function<void(ServerContext*, RequestType*,
+ grpc::ServerAsyncResponseWriter<ResponseType>*,
+ void*)> request_method,
+ std::function<grpc::Status(const RequestType*, ResponseType*)>
invoke_method)
: next_state_(&ServerRpcContextUnaryImpl::invoker),
request_method_(request_method),
@@ -175,16 +175,16 @@
ServerContext srv_ctx_;
RequestType req_;
bool (ServerRpcContextUnaryImpl::*next_state_)();
- std::function<void(ServerContext *, RequestType *,
- grpc::ServerAsyncResponseWriter<ResponseType> *, void *)>
+ std::function<void(ServerContext*, RequestType*,
+ grpc::ServerAsyncResponseWriter<ResponseType>*, void*)>
request_method_;
- std::function<grpc::Status(const RequestType *, ResponseType *)>
+ std::function<grpc::Status(const RequestType*, ResponseType*)>
invoke_method_;
grpc::ServerAsyncResponseWriter<ResponseType> response_writer_;
};
- static Status UnaryCall(const SimpleRequest *request,
- SimpleResponse *response) {
+ static Status UnaryCall(const SimpleRequest* request,
+ SimpleResponse* response) {
if (request->has_response_size() && request->response_size() > 0) {
if (!SetPayload(request->response_type(), request->response_size(),
response->mutable_payload())) {
@@ -197,13 +197,13 @@
TestService::AsyncService async_service_;
std::vector<std::thread> threads_;
std::unique_ptr<grpc::Server> server_;
- std::function<void(ServerContext *, SimpleRequest *,
- grpc::ServerAsyncResponseWriter<SimpleResponse> *, void *)>
+ std::function<void(ServerContext*, SimpleRequest*,
+ grpc::ServerAsyncResponseWriter<SimpleResponse>*, void*)>
request_unary_;
- std::forward_list<ServerRpcContext *> contexts_;
+ std::forward_list<ServerRpcContext*> contexts_;
};
-std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config,
+std::unique_ptr<Server> CreateAsyncServer(const ServerConfig& config,
int port) {
return std::unique_ptr<Server>(new AsyncQpsServerTest(config, port));
}
diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc
index d3b84b2..f040acc 100644
--- a/test/cpp/util/create_test_channel.cc
+++ b/test/cpp/util/create_test_channel.cc
@@ -72,8 +72,7 @@
const grpc::string& connect_to =
server.empty() ? override_hostname : server;
if (creds.get()) {
- channel_creds =
- CompositeCredentials(creds, channel_creds);
+ channel_creds = CompositeCredentials(creds, channel_creds);
}
return CreateChannel(connect_to, channel_creds, channel_args);
} else {
diff --git a/test/cpp/util/status_test.cc b/test/cpp/util/status_test.cc
index 8c6a335..17b92ab 100644
--- a/test/cpp/util/status_test.cc
+++ b/test/cpp/util/status_test.cc
@@ -36,7 +36,7 @@
#include <grpc/support/log.h>
// Make sure the existing grpc_status_code match with grpc::Code.
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
GPR_ASSERT(grpc::StatusCode::OK ==
static_cast<grpc::StatusCode>(GRPC_STATUS_OK));
GPR_ASSERT(grpc::StatusCode::CANCELLED ==