Fix gpr_log format mismatches in c++ tests

pull/6871/head
Yuchen Zeng 9 years ago
parent 1f24af879c
commit 0ba114408e
  1. 4
      include/grpc/support/string_util.h
  2. 4
      src/core/ext/transport/chttp2/transport/chttp2_transport.c
  3. 3
      test/cpp/end2end/async_end2end_test.cc
  4. 5
      test/cpp/interop/client.cc
  5. 10
      test/cpp/interop/interop_client.cc
  6. 2
      test/cpp/interop/metrics_client.cc
  7. 8
      test/cpp/qps/driver.cc
  8. 2
      test/cpp/qps/parse_json.cc

@ -54,8 +54,8 @@ GPRAPI char *gpr_strdup(const char *src);
On error, returns -1 and sets *strp to NULL. If the format string is bad,
the result is undefined. */
GPRAPI int gpr_asprintf(char **strp, const char *format,
...) GPRC_PRINT_FORMAT_CHECK(2, 3);
GPRAPI int gpr_asprintf(char **strp, const char *format, ...)
GPRC_PRINT_FORMAT_CHECK(2, 3);
#ifdef __cplusplus
}

@ -957,7 +957,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx,
if (metadata_size > metadata_peer_limit) {
gpr_log(GPR_DEBUG,
"to-be-sent initial metadata size exceeds peer limit "
"(%lu vs. %lu)",
"(%" PRIuPTR " vs. %" PRIuPTR ")",
metadata_size, metadata_peer_limit);
cancel_from_api(exec_ctx, transport_global, stream_global,
GRPC_STATUS_RESOURCE_EXHAUSTED);
@ -1012,7 +1012,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx,
if (metadata_size > metadata_peer_limit) {
gpr_log(GPR_DEBUG,
"to-be-sent trailing metadata size exceeds peer limit "
"(%lu vs. %lu)",
"(%" PRIuPTR " vs. %" PRIuPTR ")",
metadata_size, metadata_peer_limit);
cancel_from_api(exec_ctx, transport_global, stream_global,
GRPC_STATUS_RESOURCE_EXHAUSTED);

@ -231,7 +231,8 @@ class TestScenario {
void Log() const {
gpr_log(GPR_INFO,
"Scenario: disable_blocking %d, credentials %s, message size %d",
disable_blocking, credentials_type.c_str(), message_content.size());
disable_blocking, credentials_type.c_str(),
(int)(message_content.size()));
}
bool disable_blocking;
const grpc::string credentials_type;

@ -171,8 +171,9 @@ int main(int argc, char** argv) {
"large_unary|large_compressed_unary|client_streaming|server_streaming|"
"server_compressed_streaming|half_duplex|ping_pong|cancel_after_begin|"
"cancel_after_first_response|timeout_on_sleeping_server|empty_stream|"
"compute_engine_creds|jwt_token_creds|oauth2_auth_token|per_rpc_creds",
"status_code_and_message|custom_metadata", FLAGS_test_case.c_str());
"compute_engine_creds|jwt_token_creds|oauth2_auth_token|per_rpc_creds|"
"status_code_and_message|custom_metadata",
FLAGS_test_case.c_str());
ret = 1;
}

@ -433,7 +433,7 @@ bool InteropClient::DoResponseStreaming() {
// most likely due to connection failure.
gpr_log(GPR_ERROR,
"DoResponseStreaming(): Read fewer streams (%d) than "
"response_stream_sizes.size() (%d)",
"response_stream_sizes.size() (%" PRIu64 ")",
i, response_stream_sizes.size());
return TransientFailureOrAbort();
}
@ -517,9 +517,11 @@ bool InteropClient::DoResponseCompressedStreaming() {
// stream->Read() failed before reading all the expected messages. This
// is most likely due to a connection failure.
gpr_log(GPR_ERROR,
"DoResponseCompressedStreaming(): Responses read (k=%d) is "
"DoResponseCompressedStreaming(): Responses read (k=%" PRIuPTR
") is "
"less than the expected messages (i.e "
"response_stream_sizes.size() (%d)). (i=%d, j=%d)",
"response_stream_sizes.size() (%" PRIu64 ")). (i=%" PRIuPTR
", j=%" PRIuPTR ")",
k, response_stream_sizes.size(), i, j);
return TransientFailureOrAbort();
}
@ -608,7 +610,7 @@ bool InteropClient::DoHalfDuplex() {
// most likely due to a connection failure
gpr_log(GPR_ERROR,
"DoHalfDuplex(): Responses read (i=%d) are less than the expected "
"number of messages response_stream_sizes.size() (%d)",
"number of messages response_stream_sizes.size() (%" PRIu64 ")",
i, response_stream_sizes.size());
return TransientFailureOrAbort();
}

@ -76,7 +76,7 @@ bool PrintMetrics(std::unique_ptr<MetricsService::Stub> stub, bool total_only,
while (reader->Read(&gauge_response)) {
if (gauge_response.value_case() == GaugeResponse::kLongValue) {
if (!total_only) {
gpr_log(GPR_INFO, "%s: %ld", gauge_response.name().c_str(),
gpr_log(GPR_INFO, "%s: %lld", gauge_response.name().c_str(),
gauge_response.long_value());
}
overall_qps += gauge_response.long_value();

@ -244,8 +244,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++) {
gpr_log(GPR_INFO, "Starting server on %s (worker #%d)", workers[i].c_str(),
i);
gpr_log(GPR_INFO, "Starting server on %s (worker #%" PRIuPTR ")",
workers[i].c_str(), i);
servers[i].stub = WorkerService::NewStub(
CreateChannel(workers[i], InsecureChannelCredentials()));
@ -307,8 +307,8 @@ std::unique_ptr<ScenarioResult> RunScenario(
auto* clients = new ClientData[num_clients];
for (size_t i = 0; i < num_clients; i++) {
const auto& worker = workers[i + num_servers];
gpr_log(GPR_INFO, "Starting client on %s (worker #%d)", worker.c_str(),
i + num_servers);
gpr_log(GPR_INFO, "Starting client on %s (worker #%" PRIuPTR ")",
worker.c_str(), i + num_servers);
clients[i].stub = WorkerService::NewStub(
CreateChannel(worker, InsecureChannelCredentials()));
ClientConfig per_client_config = client_config;

@ -55,7 +55,7 @@ void ParseJson(const grpc::string& json, const grpc::string& type,
grpc::string errmsg(status.error_message());
gpr_log(GPR_ERROR, "Failed to convert json to binary: errcode=%d msg=%s",
status.error_code(), errmsg.c_str());
gpr_log(GPR_ERROR, "JSON: ", json.c_str());
gpr_log(GPR_ERROR, "JSON: %s", json.c_str());
abort();
}
GPR_ASSERT(msg->ParseFromString(binary));

Loading…
Cancel
Save