diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-01-23 15:43:10 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-01-23 15:43:10 -0800 |
commit | 9dd49e664c8f2b1546bc310ae5b2313a23d52137 (patch) | |
tree | f2d22ec091f51561d0727d719ca4850d9daa30e7 | |
parent | 4616b0fc8064e18974e7b940aff9fcbbd9a709fe (diff) | |
parent | 715342eb192c885aba110738c0edee4242bafe5d (diff) |
Merge branch 'test-printf' into bprintf
-rw-r--r-- | test/core/channel/metadata_buffer_test.c | 9 | ||||
-rw-r--r-- | test/core/end2end/cq_verifier.c | 125 | ||||
-rw-r--r-- | test/core/end2end/tests/census_simple_request.c | 6 | ||||
-rw-r--r-- | test/core/end2end/tests/simple_request.c | 6 | ||||
-rw-r--r-- | test/core/security/credentials_test.c | 6 | ||||
-rw-r--r-- | test/core/statistics/hash_table_test.c | 7 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_table_test.c | 21 | ||||
-rw-r--r-- | test/core/transport/chttp2/stream_encoder_test.c | 17 | ||||
-rw-r--r-- | test/core/transport/chttp2/timeout_encoding_test.c | 19 | ||||
-rw-r--r-- | test/core/transport/metadata_test.c | 19 |
10 files changed, 129 insertions, 106 deletions
diff --git a/test/core/channel/metadata_buffer_test.c b/test/core/channel/metadata_buffer_test.c index aa2399272f..d2bc30cc3c 100644 --- a/test/core/channel/metadata_buffer_test.c +++ b/test/core/channel/metadata_buffer_test.c @@ -32,6 +32,7 @@ */ #include "src/core/channel/metadata_buffer.h" +#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include "test/core/util/test_config.h" @@ -42,12 +43,12 @@ /* construct a buffer with some prefix followed by an integer converted to a string */ static gpr_slice construct_buffer(size_t prefix_length, size_t index) { - gpr_slice buffer = gpr_slice_malloc(prefix_length + 32); + gpr_slice buffer = gpr_slice_malloc(prefix_length + GPR_LTOA_MIN_BUFSIZE); memset(GPR_SLICE_START_PTR(buffer), 'a', prefix_length); GPR_SLICE_SET_LENGTH( - buffer, prefix_length + - sprintf((char *)GPR_SLICE_START_PTR(buffer) + prefix_length, - "%d", (int)index)); + buffer, + prefix_length + + gpr_ltoa(index, (char *)GPR_SLICE_START_PTR(buffer) + prefix_length)); return buffer; } diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index 49b131c236..7abe01abf2 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -231,100 +231,92 @@ static void verify_matches(expectation *e, grpc_event *ev) { } } -static char *metadata_expectation_string(metadata *md) { - size_t len; +static void metadata_expectation(gpr_strvec *buf, metadata *md) { size_t i; - char *out; - char *p; - - if (!md) return gpr_strdup("nil"); - - for (len = 0, i = 0; i < md->count; i++) { - len += strlen(md->keys[i]); - len += strlen(md->values[i]); - } - len += 3 + md->count; - - p = out = gpr_malloc(len); - *p++ = '{'; - for (i = 0; i < md->count; i++) { - if (i) *p++ = ','; - p += sprintf(p, "%s:%s", md->keys[i], md->values[i]); + char *tmp; + + if (!md) { + gpr_strvec_add(buf, gpr_strdup("nil")); + } else { + for (i = 0; i < md->count; i++) { + gpr_asprintf(&tmp, "%c%s:%s", i ? ',' : '{', md->keys[i], md->values[i]); + gpr_strvec_add(buf, tmp); + } + gpr_strvec_add(buf, gpr_strdup("}")); } - *p++ = '}'; - *p++ = 0; - return out; } -static size_t expectation_to_string(char *out, expectation *e) { +static void expectation_to_strvec(gpr_strvec *buf, expectation *e) { gpr_timespec timeout; - char *str = NULL; - size_t len; + char *tmp; switch (e->type) { case GRPC_FINISH_ACCEPTED: - return sprintf(out, "GRPC_FINISH_ACCEPTED result=%d", + gpr_asprintf(&tmp, "GRPC_FINISH_ACCEPTED result=%d", e->data.finish_accepted); + gpr_strvec_add(buf, tmp); + break; case GRPC_WRITE_ACCEPTED: - return sprintf(out, "GRPC_WRITE_ACCEPTED result=%d", + gpr_asprintf(&tmp, "GRPC_WRITE_ACCEPTED result=%d", e->data.write_accepted); + gpr_strvec_add(buf, tmp); + break; case GRPC_INVOKE_ACCEPTED: - return sprintf(out, "GRPC_INVOKE_ACCEPTED"); + gpr_strvec_add(buf, gpr_strdup("GRPC_INVOKE_ACCEPTED")); + break; case GRPC_SERVER_RPC_NEW: timeout = gpr_time_sub(e->data.server_rpc_new.deadline, gpr_now()); - return sprintf(out, "GRPC_SERVER_RPC_NEW method=%s host=%s timeout=%fsec", + gpr_asprintf(&tmp, "GRPC_SERVER_RPC_NEW method=%s host=%s timeout=%fsec", e->data.server_rpc_new.method, e->data.server_rpc_new.host, timeout.tv_sec + 1e-9 * timeout.tv_nsec); + gpr_strvec_add(buf, tmp); + break; case GRPC_CLIENT_METADATA_READ: - str = metadata_expectation_string(e->data.client_metadata_read); - len = sprintf(out, "GRPC_CLIENT_METADATA_READ %s", str); - gpr_free(str); - return len; + gpr_strvec_add(buf, gpr_strdup("GRPC_CLIENT_METADATA_READ ")); + metadata_expectation(buf, e->data.client_metadata_read); + break; case GRPC_FINISHED: - str = metadata_expectation_string(e->data.finished.metadata); - len = sprintf(out, "GRPC_FINISHED status=%d details=%s %s", - e->data.finished.status, e->data.finished.details, str); - gpr_free(str); - return len; + gpr_asprintf(&tmp, "GRPC_FINISHED status=%d details=%s ", + e->data.finished.status, e->data.finished.details); + gpr_strvec_add(buf, tmp); + metadata_expectation(buf, e->data.finished.metadata); + break; case GRPC_READ: - if (e->data.read) { - str = - gpr_hexdump((char *)GPR_SLICE_START_PTR(*e->data.read), - GPR_SLICE_LENGTH(*e->data.read), GPR_HEXDUMP_PLAINTEXT); - } - len = sprintf(out, "GRPC_READ data=%s", str); - gpr_free(str); - return len; + gpr_strvec_add(buf, gpr_strdup("GRPC_READ data=")); + gpr_strvec_add(buf, gpr_hexdump((char *)GPR_SLICE_START_PTR(*e->data.read), + GPR_SLICE_LENGTH(*e->data.read), GPR_HEXDUMP_PLAINTEXT)); + break; case GRPC_SERVER_SHUTDOWN: - return sprintf(out, "GRPC_SERVER_SHUTDOWN"); + gpr_strvec_add(buf, gpr_strdup("GRPC_SERVER_SHUTDOWN")); + break; case GRPC_COMPLETION_DO_NOT_USE: case GRPC_QUEUE_SHUTDOWN: gpr_log(GPR_ERROR, "not implemented"); abort(); break; } - return 0; } -static char *expectations_to_string(cq_verifier *v) { +static void expectations_to_strvec(gpr_strvec *buf, cq_verifier *v) { /* allocate a large buffer: we're about to crash anyway */ - char *buffer = gpr_malloc(32 * 1024 * 1024); - char *p = buffer; expectation *e; for (e = v->expect.next; e != &v->expect; e = e->next) { - p += expectation_to_string(p, e); - *p++ = '\n'; + expectation_to_strvec(buf, e); + gpr_strvec_add(buf, gpr_strdup("\n")); } - - *p = 0; - return buffer; } static void fail_no_event_received(cq_verifier *v) { - char *expectations = expectations_to_string(v); - gpr_log(GPR_ERROR, "no event received, but expected:\n%s", expectations); - gpr_free(expectations); + gpr_strvec buf; + char *msg; + gpr_strvec_init(&buf); + gpr_strvec_add(&buf, gpr_strdup("no event received, but expected:\n")); + expectations_to_strvec(&buf, v); + msg = gpr_strvec_flatten(&buf, NULL); + gpr_log(GPR_ERROR, "%s", msg); + gpr_strvec_destroy(&buf); + gpr_free(msg); abort(); } @@ -333,9 +325,10 @@ void cq_verify(cq_verifier *v) { gpr_time_add(gpr_now(), gpr_time_from_micros(10 * GPR_US_PER_SEC)); grpc_event *ev; expectation *e; + char *s; + gpr_strvec have_tags; - char have_tags[512] = {0}; - char *phave = have_tags; + gpr_strvec_init(&have_tags); while (v->expect.next != &v->expect) { ev = grpc_completion_queue_next(v->cq, deadline); @@ -344,7 +337,8 @@ void cq_verify(cq_verifier *v) { } for (e = v->expect.next; e != &v->expect; e = e->next) { - phave += sprintf(phave, " %p", e->tag); + gpr_asprintf(&s, " %p", e->tag); + gpr_strvec_add(&have_tags, s); if (e->tag == ev->tag) { verify_matches(e, ev); e->next->prev = e->prev; @@ -354,15 +348,20 @@ void cq_verify(cq_verifier *v) { } } if (e == &v->expect) { - char *s = grpc_event_string(ev); + s = grpc_event_string(ev); gpr_log(GPR_ERROR, "event not found: %s", s); - gpr_log(GPR_ERROR, "have tags:%s", have_tags); gpr_free(s); + s = gpr_strvec_flatten(&have_tags, NULL); + gpr_log(GPR_ERROR, "have tags:%s", s); + gpr_free(s); + gpr_strvec_destroy(&have_tags); abort(); } grpc_event_finish(ev); } + + gpr_strvec_destroy(&have_tags); } void cq_verify_empty(cq_verifier *v) { diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c index 719f0fe662..86cef437be 100644 --- a/test/core/end2end/tests/census_simple_request.c +++ b/test/core/end2end/tests/census_simple_request.c @@ -37,6 +37,7 @@ #include <string.h> #include <unistd.h> +#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> @@ -145,7 +146,7 @@ static void test_body(grpc_end2end_test_fixture f) { static void test_invoke_request_with_census( grpc_end2end_test_config config, const char *name, void (*body)(grpc_end2end_test_fixture f)) { - char fullname[64]; + char *fullname; grpc_end2end_test_fixture f; grpc_arg client_arg, server_arg; grpc_channel_args client_args, server_args; @@ -163,11 +164,12 @@ static void test_invoke_request_with_census( server_args.num_args = 1; server_args.args = &server_arg; - sprintf(fullname, "%s/%s", __FUNCTION__, name); + gpr_asprintf(&fullname, "%s/%s", __FUNCTION__, name); f = begin_test(config, fullname, &client_args, &server_args); body(f); end_test(&f); config.tear_down_data(&f); + gpr_free(fullname); } void grpc_end2end_tests(grpc_end2end_test_config config) { diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 23fc201d84..f8894a8ba9 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -37,6 +37,7 @@ #include <string.h> #include <unistd.h> +#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> @@ -198,15 +199,16 @@ static void simple_request_body2(grpc_end2end_test_fixture f) { static void test_invoke_simple_request( grpc_end2end_test_config config, const char *name, void (*body)(grpc_end2end_test_fixture f)) { - char fullname[64]; + char *fullname; grpc_end2end_test_fixture f; - sprintf(fullname, "%s/%s", __FUNCTION__, name); + gpr_asprintf(&fullname, "%s/%s", __FUNCTION__, name); f = begin_test(config, fullname, NULL, NULL); body(f); end_test(&f); config.tear_down_data(&f); + gpr_free(fullname); } static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index ec21e0d42f..1c83cc8059 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -498,10 +498,8 @@ static void validate_service_account_http_request( char *expected_body = NULL; GPR_ASSERT(body != NULL); GPR_ASSERT(body_size != 0); - expected_body = gpr_malloc(strlen(expected_service_account_http_body_prefix) + - strlen(test_signed_jwt) + 1); - sprintf(expected_body, "%s%s", expected_service_account_http_body_prefix, - test_signed_jwt); + gpr_asprintf(&expected_body, "%s%s", + expected_service_account_http_body_prefix, test_signed_jwt); GPR_ASSERT(strlen(expected_body) == body_size); GPR_ASSERT(!memcmp(expected_body, body, body_size)); gpr_free(expected_body); diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.c index ebfc2a2a9a..f8df2574a4 100644 --- a/test/core/statistics/hash_table_test.c +++ b/test/core/statistics/hash_table_test.c @@ -38,6 +38,7 @@ #include "src/core/statistics/hash_table.h" #include "src/core/support/murmur_hash.h" +#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> @@ -187,15 +188,15 @@ static void test_insertion_and_deletion_with_high_collision_rate(void) { census_ht_option opt = {CENSUS_HT_POINTER, 13, &force_collision, &cmp_str_keys, NULL, NULL}; census_ht* ht = census_ht_create(&opt); - char key_str[1000][10]; + char key_str[1000][GPR_LTOA_MIN_BUFSIZE]; gpr_uint64 val = 0; int i = 0; for (i = 0; i < 1000; i++) { census_ht_key key; key.ptr = key_str[i]; - sprintf(key_str[i], "%d", i); + gpr_ltoa(i, key_str[i]); census_ht_insert(ht, key, (void*)(&val)); - printf("%d\n", i); + gpr_log(GPR_INFO, "%d\n", i); GPR_ASSERT(census_ht_get_size(ht) == (i + 1)); } for (i = 0; i < 1000; i++) { diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c index 1576a30c1b..d155dee9dc 100644 --- a/test/core/transport/chttp2/hpack_table_test.c +++ b/test/core/transport/chttp2/hpack_table_test.c @@ -36,6 +36,7 @@ #include <string.h> #include <stdio.h> +#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include "test/core/util/test_config.h" @@ -131,8 +132,8 @@ static void test_static_lookup(void) { static void test_many_additions(void) { grpc_chttp2_hptbl tbl; int i; - char key[32]; - char value[32]; + char *key; + char *value; grpc_mdctx *mdctx; LOG_TEST(); @@ -141,14 +142,18 @@ static void test_many_additions(void) { grpc_chttp2_hptbl_init(&tbl, mdctx); for (i = 0; i < 1000000; i++) { - sprintf(key, "K:%d", i); - sprintf(value, "VALUE:%d", i); + gpr_asprintf(&key, "K:%d", i); + gpr_asprintf(&value, "VALUE:%d", i); grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, key, value)); assert_index(&tbl, 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value); + gpr_free(key); + gpr_free(value); if (i) { - sprintf(key, "K:%d", i - 1); - sprintf(value, "VALUE:%d", i - 1); + gpr_asprintf(&key, "K:%d", i - 1); + gpr_asprintf(&value, "VALUE:%d", i - 1); assert_index(&tbl, 2 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value); + gpr_free(key); + gpr_free(value); } } @@ -226,7 +231,7 @@ static void test_find(void) { /* overflow the string buffer, check find still works */ for (i = 0; i < 10000; i++) { - sprintf(buffer, "%d", i); + gpr_ltoa(i, buffer); grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "test", buffer)); } @@ -245,7 +250,7 @@ static void test_find(void) { for (i = 0; i < tbl.num_ents; i++) { int expect = 9999 - i; - sprintf(buffer, "%d", expect); + gpr_ltoa(expect, buffer); r = find_simple(&tbl, "test", buffer); GPR_ASSERT(r.index == i + 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY); diff --git a/test/core/transport/chttp2/stream_encoder_test.c b/test/core/transport/chttp2/stream_encoder_test.c index eb0f688f58..5e8ec0a1af 100644 --- a/test/core/transport/chttp2/stream_encoder_test.c +++ b/test/core/transport/chttp2/stream_encoder_test.c @@ -186,7 +186,7 @@ static void encode_int_to_str(int i, char *p) { static void test_decode_table_overflow(void) { int i; char key[3], value[3]; - char expect[128]; + char *expect; for (i = 0; i < 114; i++) { if (i > 0) { @@ -197,18 +197,21 @@ static void test_decode_table_overflow(void) { encode_int_to_str(i + 1, value); if (i + 61 >= 127) { - sprintf(expect, "000009 0104 deadbeef ff%02x 40 02%02x%02x 02%02x%02x", - i + 61 - 127, key[0], key[1], value[0], value[1]); + gpr_asprintf(&expect, + "000009 0104 deadbeef ff%02x 40 02%02x%02x 02%02x%02x", + i + 61 - 127, key[0], key[1], value[0], value[1]); } else if (i > 0) { - sprintf(expect, "000008 0104 deadbeef %02x 40 02%02x%02x 02%02x%02x", - 0x80 + 61 + i, key[0], key[1], value[0], value[1]); + gpr_asprintf(&expect, + "000008 0104 deadbeef %02x 40 02%02x%02x 02%02x%02x", + 0x80 + 61 + i, key[0], key[1], value[0], value[1]); } else { - sprintf(expect, "000007 0104 deadbeef 40 02%02x%02x 02%02x%02x", key[0], - key[1], value[0], value[1]); + gpr_asprintf(&expect, "000007 0104 deadbeef 40 02%02x%02x 02%02x%02x", + key[0], key[1], value[0], value[1]); } add_sopb_header(key, value); verify_sopb(0, 0, 0, expect); + gpr_free(expect); } /* if the above passes, then we must have just knocked this pair out of the diff --git a/test/core/transport/chttp2/timeout_encoding_test.c b/test/core/transport/chttp2/timeout_encoding_test.c index ffa0070e34..0ad90dbcef 100644 --- a/test/core/transport/chttp2/timeout_encoding_test.c +++ b/test/core/transport/chttp2/timeout_encoding_test.c @@ -36,6 +36,8 @@ #include <stdio.h> #include <string.h> +#include "src/core/support/string.h" +#include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/useful.h> #include "test/core/util/test_config.h" @@ -93,16 +95,23 @@ void decode_suite(char ext, gpr_timespec (*answer)(long x)) { 1234567, 12345678, 123456789, 98765432, 9876543, 987654, 98765, 9876, 987, 98, 9}; int i; - char input[32]; + char *input; for (i = 0; i < GPR_ARRAY_SIZE(test_vals); i++) { - sprintf(input, "%ld%c", test_vals[i], ext); + gpr_asprintf(&input, "%ld%c", test_vals[i], ext); assert_decodes_as(input, answer(test_vals[i])); - sprintf(input, " %ld%c", test_vals[i], ext); + gpr_free(input); + + gpr_asprintf(&input, " %ld%c", test_vals[i], ext); assert_decodes_as(input, answer(test_vals[i])); - sprintf(input, "%ld %c", test_vals[i], ext); + gpr_free(input); + + gpr_asprintf(&input, "%ld %c", test_vals[i], ext); assert_decodes_as(input, answer(test_vals[i])); - sprintf(input, "%ld %c ", test_vals[i], ext); + gpr_free(input); + + gpr_asprintf(&input, "%ld %c ", test_vals[i], ext); assert_decodes_as(input, answer(test_vals[i])); + gpr_free(input); } } diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.c index 804096d0e1..b23db894be 100644 --- a/test/core/transport/metadata_test.c +++ b/test/core/transport/metadata_test.c @@ -35,6 +35,7 @@ #include <stdio.h> +#include "src/core/support/string.h" #include "src/core/transport/chttp2/bin_encoder.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> @@ -99,7 +100,7 @@ static void test_create_metadata(void) { static void test_create_many_ephemeral_metadata(void) { grpc_mdctx *ctx; - char buffer[256]; + char buffer[GPR_LTOA_MIN_BUFSIZE]; long i; size_t mdtab_capacity_before; @@ -109,7 +110,7 @@ static void test_create_many_ephemeral_metadata(void) { mdtab_capacity_before = grpc_mdctx_get_mdtab_capacity_test_only(ctx); /* add, and immediately delete a bunch of different elements */ for (i = 0; i < MANY; i++) { - sprintf(buffer, "%ld", i); + gpr_ltoa(i, buffer); grpc_mdelem_unref(grpc_mdelem_from_strings(ctx, "a", buffer)); } /* capacity should not grow */ @@ -120,7 +121,7 @@ static void test_create_many_ephemeral_metadata(void) { static void test_create_many_persistant_metadata(void) { grpc_mdctx *ctx; - char buffer[256]; + char buffer[GPR_LTOA_MIN_BUFSIZE]; long i; grpc_mdelem **created = gpr_malloc(sizeof(grpc_mdelem *) * MANY); grpc_mdelem *md; @@ -130,12 +131,12 @@ static void test_create_many_persistant_metadata(void) { ctx = grpc_mdctx_create(); /* add phase */ for (i = 0; i < MANY; i++) { - sprintf(buffer, "%ld", i); + gpr_ltoa(i, buffer); created[i] = grpc_mdelem_from_strings(ctx, "a", buffer); } /* verify phase */ for (i = 0; i < MANY; i++) { - sprintf(buffer, "%ld", i); + gpr_ltoa(i, buffer); md = grpc_mdelem_from_strings(ctx, "a", buffer); GPR_ASSERT(md == created[i]); grpc_mdelem_unref(md); @@ -176,7 +177,7 @@ static void test_spin_creating_the_same_thing(void) { static void test_things_stick_around(void) { grpc_mdctx *ctx; int i, j; - char buffer[64]; + char *buffer; int nstrs = 10000; grpc_mdstr **strs = gpr_malloc(sizeof(grpc_mdstr *) * nstrs); int *shuf = gpr_malloc(sizeof(int) * nstrs); @@ -187,9 +188,10 @@ static void test_things_stick_around(void) { ctx = grpc_mdctx_create(); for (i = 0; i < nstrs; i++) { - sprintf(buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%dx", i); + gpr_asprintf(&buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%dx", i); strs[i] = grpc_mdstr_from_string(ctx, buffer); shuf[i] = i; + gpr_free(buffer); } for (i = 0; i < nstrs; i++) { @@ -208,10 +210,11 @@ static void test_things_stick_around(void) { for (i = 0; i < nstrs; i++) { grpc_mdstr_unref(strs[shuf[i]]); for (j = i + 1; j < nstrs; j++) { - sprintf(buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%dx", shuf[j]); + gpr_asprintf(&buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%dx", shuf[j]); test = grpc_mdstr_from_string(ctx, buffer); GPR_ASSERT(test == strs[shuf[j]]); grpc_mdstr_unref(test); + gpr_free(buffer); } } |