diff options
author | Juanli Shen <aspirinsjl@gmail.com> | 2018-06-01 20:03:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-01 20:03:08 -0700 |
commit | 7b50c5533b45f2993fd5ba7da0ddc9f3531406dd (patch) | |
tree | e535a800b76fcb74f9c13ca92b070c766a9cb71a /test | |
parent | 57fbb513483e9e175f59f8e1e829437d8252215e (diff) | |
parent | 3c3f3ad75a478e8e3eac8d25bf72701fae6c02f7 (diff) |
Merge pull request #15418 from AspirinSJL/smaller_hpack
Decrease GRPC_CHTTP2_HPACKC_NUM_VALUES
Diffstat (limited to 'test')
-rw-r--r-- | test/core/transport/chttp2/hpack_encoder_test.cc | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/test/core/transport/chttp2/hpack_encoder_test.cc b/test/core/transport/chttp2/hpack_encoder_test.cc index d3ba50a91c..2a57198ab6 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.cc +++ b/test/core/transport/chttp2/hpack_encoder_test.cc @@ -160,6 +160,8 @@ static void encode_int_to_str(int i, char* p) { } static void test_decode_table_overflow() { + // Decrease the default table size to make decode table overflow easier. + grpc_chttp2_hpack_compressor_set_max_table_size(&g_compressor, 1024); int i; char key[3], value[3]; char* expect; @@ -170,27 +172,20 @@ static void test_decode_table_overflow() { false, }; - for (i = 0; i < 114; i++) { + for (i = 0; i < 29; i++) { encode_int_to_str(i, key); encode_int_to_str(i + 1, value); - - if (i + 61 >= 127) { + if (i == 0) { + // 3fe107 corresponds to the table size update. 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) { + "00000a 0104 deadbeef 3fe107 40 02%02x%02x 02%02x%02x", + key[0], key[1], value[0], value[1]); + verify(params, expect, 1, key, value); + } else { 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 { - gpr_asprintf(&expect, "000007 0104 deadbeef 40 02%02x%02x 02%02x%02x", - key[0], key[1], value[0], value[1]); - } - - if (i > 0) { verify(params, expect, 2, "aa", "ba", key, value); - } else { - verify(params, expect, 1, key, value); } gpr_free(expect); } |