aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-07-08 21:46:52 -0700
committerGravatar Yang Gao <yangg@google.com>2015-07-08 21:46:52 -0700
commitd130bdd176810c49f4e1d584f648cdbc46801d7b (patch)
treec5f9c35bd8d5be6cb012ea37ccd71f5fa0440cf5 /test
parent7dbb4fc05ded49169c46bf25ba2aee5024a0f2fd (diff)
parentc1f7e315021778bbc997af5e7ac785d6b8619240 (diff)
Merge pull request #2308 from ctiller/metadata-wants-to-be-debugged
Add metadata refcount debug helpers
Diffstat (limited to 'test')
-rw-r--r--test/core/transport/chttp2/hpack_parser_test.c2
-rw-r--r--test/core/transport/chttp2/hpack_table_test.c2
-rw-r--r--test/core/transport/chttp2/stream_encoder_test.c2
-rw-r--r--test/core/transport/metadata_test.c38
4 files changed, 22 insertions, 22 deletions
diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.c
index 1d6ad2a758..3a313375a4 100644
--- a/test/core/transport/chttp2/hpack_parser_test.c
+++ b/test/core/transport/chttp2/hpack_parser_test.c
@@ -53,7 +53,7 @@ static void onhdr(void *ud, grpc_mdelem *md) {
GPR_ASSERT(evalue);
GPR_ASSERT(gpr_slice_str_cmp(md->key->slice, ekey) == 0);
GPR_ASSERT(gpr_slice_str_cmp(md->value->slice, evalue) == 0);
- grpc_mdelem_unref(md);
+ GRPC_MDELEM_UNREF(md);
}
static void test_vector(grpc_chttp2_hpack_parser *parser,
diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c
index 8b86e08168..15b37d17b6 100644
--- a/test/core/transport/chttp2/hpack_table_test.c
+++ b/test/core/transport/chttp2/hpack_table_test.c
@@ -167,7 +167,7 @@ static grpc_chttp2_hptbl_find_result find_simple(grpc_chttp2_hptbl *tbl,
const char *value) {
grpc_mdelem *md = grpc_mdelem_from_strings(tbl->mdctx, key, value);
grpc_chttp2_hptbl_find_result r = grpc_chttp2_hptbl_find(tbl, md);
- grpc_mdelem_unref(md);
+ GRPC_MDELEM_UNREF(md);
return r;
}
diff --git a/test/core/transport/chttp2/stream_encoder_test.c b/test/core/transport/chttp2/stream_encoder_test.c
index 6f2ea274fe..e6731ff195 100644
--- a/test/core/transport/chttp2/stream_encoder_test.c
+++ b/test/core/transport/chttp2/stream_encoder_test.c
@@ -262,7 +262,7 @@ static void chk_hdr(void *p, grpc_mdelem *el) {
GPR_ASSERT(0 == gpr_slice_str_cmp(el->key->slice, st->key));
GPR_ASSERT(0 == gpr_slice_str_cmp(el->value->slice, st->value));
st->got_hdr = 1;
- grpc_mdelem_unref(el);
+ GRPC_MDELEM_UNREF(el);
}
static void test_decode_random_headers_inner(int max_len) {
diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.c
index 89deee5a40..a932e04f33 100644
--- a/test/core/transport/metadata_test.c
+++ b/test/core/transport/metadata_test.c
@@ -70,10 +70,10 @@ static void test_create_string(void) {
GPR_ASSERT(s3 != s1);
GPR_ASSERT(gpr_slice_str_cmp(s1->slice, "hello") == 0);
GPR_ASSERT(gpr_slice_str_cmp(s3->slice, "very much not hello") == 0);
- grpc_mdstr_unref(s1);
- grpc_mdstr_unref(s2);
+ GRPC_MDSTR_UNREF(s1);
+ GRPC_MDSTR_UNREF(s2);
grpc_mdctx_unref(ctx);
- grpc_mdstr_unref(s3);
+ GRPC_MDSTR_UNREF(s3);
}
static void test_create_metadata(void) {
@@ -93,9 +93,9 @@ static void test_create_metadata(void) {
GPR_ASSERT(gpr_slice_str_cmp(m1->key->slice, "a") == 0);
GPR_ASSERT(gpr_slice_str_cmp(m1->value->slice, "b") == 0);
GPR_ASSERT(gpr_slice_str_cmp(m3->value->slice, "c") == 0);
- grpc_mdelem_unref(m1);
- grpc_mdelem_unref(m2);
- grpc_mdelem_unref(m3);
+ GRPC_MDELEM_UNREF(m1);
+ GRPC_MDELEM_UNREF(m2);
+ GRPC_MDELEM_UNREF(m3);
grpc_mdctx_unref(ctx);
}
@@ -112,7 +112,7 @@ static void test_create_many_ephemeral_metadata(void) {
/* add, and immediately delete a bunch of different elements */
for (i = 0; i < MANY; i++) {
gpr_ltoa(i, buffer);
- grpc_mdelem_unref(grpc_mdelem_from_strings(ctx, "a", buffer));
+ GRPC_MDELEM_UNREF(grpc_mdelem_from_strings(ctx, "a", buffer));
}
/* capacity should not grow */
GPR_ASSERT(mdtab_capacity_before ==
@@ -140,11 +140,11 @@ static void test_create_many_persistant_metadata(void) {
gpr_ltoa(i, buffer);
md = grpc_mdelem_from_strings(ctx, "a", buffer);
GPR_ASSERT(md == created[i]);
- grpc_mdelem_unref(md);
+ GRPC_MDELEM_UNREF(md);
}
/* cleanup phase */
for (i = 0; i < MANY; i++) {
- grpc_mdelem_unref(created[i]);
+ GRPC_MDELEM_UNREF(created[i]);
}
grpc_mdctx_unref(ctx);
@@ -160,15 +160,15 @@ static void test_spin_creating_the_same_thing(void) {
GPR_ASSERT(grpc_mdctx_get_mdtab_count_test_only(ctx) == 0);
GPR_ASSERT(grpc_mdctx_get_mdtab_free_test_only(ctx) == 0);
- grpc_mdelem_unref(grpc_mdelem_from_strings(ctx, "a", "b"));
+ GRPC_MDELEM_UNREF(grpc_mdelem_from_strings(ctx, "a", "b"));
GPR_ASSERT(grpc_mdctx_get_mdtab_count_test_only(ctx) == 1);
GPR_ASSERT(grpc_mdctx_get_mdtab_free_test_only(ctx) == 1);
- grpc_mdelem_unref(grpc_mdelem_from_strings(ctx, "a", "b"));
+ GRPC_MDELEM_UNREF(grpc_mdelem_from_strings(ctx, "a", "b"));
GPR_ASSERT(grpc_mdctx_get_mdtab_count_test_only(ctx) == 1);
GPR_ASSERT(grpc_mdctx_get_mdtab_free_test_only(ctx) == 1);
- grpc_mdelem_unref(grpc_mdelem_from_strings(ctx, "a", "b"));
+ GRPC_MDELEM_UNREF(grpc_mdelem_from_strings(ctx, "a", "b"));
GPR_ASSERT(grpc_mdctx_get_mdtab_count_test_only(ctx) == 1);
GPR_ASSERT(grpc_mdctx_get_mdtab_free_test_only(ctx) == 1);
@@ -196,8 +196,8 @@ static void test_things_stick_around(void) {
}
for (i = 0; i < nstrs; i++) {
- grpc_mdstr_ref(strs[i]);
- grpc_mdstr_unref(strs[i]);
+ GRPC_MDSTR_REF(strs[i]);
+ GRPC_MDSTR_UNREF(strs[i]);
}
for (i = 0; i < nstrs; i++) {
@@ -209,12 +209,12 @@ static void test_things_stick_around(void) {
}
for (i = 0; i < nstrs; i++) {
- grpc_mdstr_unref(strs[shuf[i]]);
+ GRPC_MDSTR_UNREF(strs[shuf[i]]);
for (j = i + 1; j < nstrs; 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);
+ GRPC_MDSTR_UNREF(test);
gpr_free(buffer);
}
}
@@ -237,14 +237,14 @@ static void test_slices_work(void) {
str = grpc_mdstr_from_string(
ctx, "123456789012345678901234567890123456789012345678901234567890");
slice = gpr_slice_ref(str->slice);
- grpc_mdstr_unref(str);
+ GRPC_MDSTR_UNREF(str);
gpr_slice_unref(slice);
str = grpc_mdstr_from_string(
ctx, "123456789012345678901234567890123456789012345678901234567890");
slice = gpr_slice_ref(str->slice);
gpr_slice_unref(slice);
- grpc_mdstr_unref(str);
+ GRPC_MDSTR_UNREF(str);
grpc_mdctx_unref(ctx);
}
@@ -264,7 +264,7 @@ static void test_base64_and_huffman_works(void) {
GPR_ASSERT(0 == gpr_slice_cmp(slice1, slice2));
gpr_slice_unref(slice2);
- grpc_mdstr_unref(str);
+ GRPC_MDSTR_UNREF(str);
grpc_mdctx_unref(ctx);
}