aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
Diffstat (limited to 'test/core')
-rw-r--r--test/core/end2end/fixtures/proxy.c4
-rw-r--r--test/core/transport/chttp2/hpack_parser_test.c7
-rw-r--r--test/core/transport/chttp2/hpack_table_test.c27
3 files changed, 22 insertions, 16 deletions
diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c
index b793358653..434e75dd15 100644
--- a/test/core/end2end/fixtures/proxy.c
+++ b/test/core/end2end/fixtures/proxy.c
@@ -157,9 +157,7 @@ static void unrefpc(proxy_call *pc, const char *reason) {
}
}
-static void refpc(proxy_call *pc, const char *reason) {
- gpr_ref(&pc->refs);
-}
+static void refpc(proxy_call *pc, const char *reason) { gpr_ref(&pc->refs); }
static void on_c2p_sent_initial_metadata(void *arg, int success) {
proxy_call *pc = arg;
diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.c
index e4cabeae3b..c6b35fba79 100644
--- a/test/core/transport/chttp2/hpack_parser_test.c
+++ b/test/core/transport/chttp2/hpack_parser_test.c
@@ -151,8 +151,8 @@ static void test_vectors(grpc_slice_split_mode mode) {
grpc_chttp2_hpack_parser_destroy(&parser);
grpc_chttp2_hpack_parser_init(&parser, mdctx);
-grpc_chttp2_hptbl_set_max_bytes(&parser.table, 256);
-grpc_chttp2_hptbl_set_current_table_size(&parser.table, 256);
+ grpc_chttp2_hptbl_set_max_bytes(&parser.table, 256);
+ grpc_chttp2_hptbl_set_current_table_size(&parser.table, 256);
/* D.5.1 */
test_vector(&parser, mode,
"4803 3330 3258 0770 7269 7661 7465 611d"
@@ -185,7 +185,8 @@ grpc_chttp2_hptbl_set_current_table_size(&parser.table, 256);
grpc_chttp2_hpack_parser_destroy(&parser);
grpc_chttp2_hpack_parser_init(&parser, mdctx);
- parser.table.max_bytes = 256;
+ grpc_chttp2_hptbl_set_max_bytes(&parser.table, 256);
+ grpc_chttp2_hptbl_set_current_table_size(&parser.table, 256);
/* D.6.1 */
test_vector(&parser, mode,
"4882 6402 5885 aec3 771a 4b61 96d0 7abe"
diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c
index 5bdeeafb67..5eb52d6d9a 100644
--- a/test/core/transport/chttp2/hpack_table_test.c
+++ b/test/core/transport/chttp2/hpack_table_test.c
@@ -143,10 +143,12 @@ static void test_many_additions(void) {
grpc_chttp2_hptbl_init(&tbl, mdctx);
for (i = 0; i < 1000000; i++) {
+ grpc_mdelem *elem;
gpr_asprintf(&key, "K:%d", i);
gpr_asprintf(&value, "VALUE:%d", i);
- GPR_ASSERT(grpc_chttp2_hptbl_add(
- &tbl, grpc_mdelem_from_strings(mdctx, key, value)));
+ elem = grpc_mdelem_from_strings(mdctx, key, value);
+ GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem));
+ GRPC_MDELEM_UNREF(elem);
assert_index(&tbl, 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value);
gpr_free(key);
gpr_free(value);
@@ -177,18 +179,22 @@ static void test_find(void) {
gpr_uint32 i;
char buffer[32];
grpc_mdctx *mdctx;
+ grpc_mdelem *elem;
grpc_chttp2_hptbl_find_result r;
LOG_TEST("test_find");
mdctx = grpc_mdctx_create();
grpc_chttp2_hptbl_init(&tbl, mdctx);
- GPR_ASSERT(grpc_chttp2_hptbl_add(
- &tbl, grpc_mdelem_from_strings(mdctx, "abc", "xyz")));
- GPR_ASSERT(grpc_chttp2_hptbl_add(
- &tbl, grpc_mdelem_from_strings(mdctx, "abc", "123")));
- GPR_ASSERT(
- grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "x", "1")));
+ elem = grpc_mdelem_from_strings(mdctx, "abc", "xyz");
+ GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem));
+ GRPC_MDELEM_UNREF(elem);
+ elem = grpc_mdelem_from_strings(mdctx, "abc", "123");
+ GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem));
+ GRPC_MDELEM_UNREF(elem);
+ elem = grpc_mdelem_from_strings(mdctx, "x", "1");
+ GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem));
+ GRPC_MDELEM_UNREF(elem);
r = find_simple(&tbl, "abc", "123");
GPR_ASSERT(r.index == 2 + GRPC_CHTTP2_LAST_STATIC_ENTRY);
@@ -237,8 +243,9 @@ static void test_find(void) {
/* overflow the string buffer, check find still works */
for (i = 0; i < 10000; i++) {
gpr_ltoa(i, buffer);
- GPR_ASSERT(grpc_chttp2_hptbl_add(
- &tbl, grpc_mdelem_from_strings(mdctx, "test", buffer)));
+ elem = grpc_mdelem_from_strings(mdctx, "test", buffer);
+ GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem));
+ GRPC_MDELEM_UNREF(elem);
}
r = find_simple(&tbl, "abc", "123");