diff options
Diffstat (limited to 'test/core/transport')
-rw-r--r-- | test/core/transport/BUILD | 24 | ||||
-rw-r--r-- | test/core/transport/byte_stream_test.cc (renamed from test/core/transport/byte_stream_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/chttp2/BUILD | 34 | ||||
-rw-r--r-- | test/core/transport/chttp2/alpn_test.cc (renamed from test/core/transport/chttp2/alpn_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/chttp2/bin_decoder_test.cc (renamed from test/core/transport/chttp2/bin_decoder_test.c) | 2 | ||||
-rw-r--r-- | test/core/transport/chttp2/bin_encoder_test.cc (renamed from test/core/transport/chttp2/bin_encoder_test.c) | 4 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_encoder_test.cc (renamed from test/core/transport/chttp2/hpack_encoder_test.c) | 47 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_parser_fuzzer_test.cc (renamed from test/core/transport/chttp2/hpack_parser_fuzzer_test.c) | 2 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_parser_test.cc (renamed from test/core/transport/chttp2/hpack_parser_test.c) | 2 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_table_test.cc (renamed from test/core/transport/chttp2/hpack_table_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/chttp2/stream_map_test.cc (renamed from test/core/transport/chttp2/stream_map_test.c) | 2 | ||||
-rw-r--r-- | test/core/transport/chttp2/varint_test.cc (renamed from test/core/transport/chttp2/varint_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/connectivity_state_test.cc (renamed from test/core/transport/connectivity_state_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/metadata_test.cc (renamed from test/core/transport/metadata_test.c) | 12 | ||||
-rw-r--r-- | test/core/transport/status_conversion_test.cc (renamed from test/core/transport/status_conversion_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/stream_owned_slice_test.cc (renamed from test/core/transport/stream_owned_slice_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/timeout_encoding_test.cc (renamed from test/core/transport/timeout_encoding_test.c) | 0 |
17 files changed, 65 insertions, 64 deletions
diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD index edd27b8a5f..b31d4ff899 100644 --- a/test/core/transport/BUILD +++ b/test/core/transport/BUILD @@ -35,8 +35,8 @@ grpc_cc_test( grpc_cc_test( name = "byte_stream_test", - srcs = ["byte_stream_test.c"], - language = "C", + srcs = ["byte_stream_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -47,8 +47,8 @@ grpc_cc_test( grpc_cc_test( name = "connectivity_state_test", - srcs = ["connectivity_state_test.c"], - language = "C", + srcs = ["connectivity_state_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -59,8 +59,8 @@ grpc_cc_test( grpc_cc_test( name = "metadata_test", - srcs = ["metadata_test.c"], - language = "C", + srcs = ["metadata_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -86,8 +86,8 @@ grpc_cc_test( grpc_cc_test( name = "status_conversion_test", - srcs = ["status_conversion_test.c"], - language = "C", + srcs = ["status_conversion_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -98,8 +98,8 @@ grpc_cc_test( grpc_cc_test( name = "stream_owned_slice_test", - srcs = ["stream_owned_slice_test.c"], - language = "C", + srcs = ["stream_owned_slice_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -110,8 +110,8 @@ grpc_cc_test( grpc_cc_test( name = "timeout_encoding_test", - srcs = ["timeout_encoding_test.c"], - language = "C", + srcs = ["timeout_encoding_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", diff --git a/test/core/transport/byte_stream_test.c b/test/core/transport/byte_stream_test.cc index e62a697284..e62a697284 100644 --- a/test/core/transport/byte_stream_test.c +++ b/test/core/transport/byte_stream_test.cc diff --git a/test/core/transport/chttp2/BUILD b/test/core/transport/chttp2/BUILD index 6081940243..1ea7d0341d 100644 --- a/test/core/transport/chttp2/BUILD +++ b/test/core/transport/chttp2/BUILD @@ -22,7 +22,7 @@ load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer") grpc_fuzzer( name = "hpack_parser_fuzzer", - srcs = ["hpack_parser_fuzzer_test.c"], + srcs = ["hpack_parser_fuzzer_test.cc"], corpus = "hpack_parser_corpus", deps = [ "//:grpc", @@ -32,8 +32,8 @@ grpc_fuzzer( grpc_cc_test( name = "alpn_test", - srcs = ["alpn_test.c"], - language = "C", + srcs = ["alpn_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -44,8 +44,8 @@ grpc_cc_test( grpc_cc_test( name = "bin_decoder_test", - srcs = ["bin_decoder_test.c"], - language = "C", + srcs = ["bin_decoder_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -56,8 +56,8 @@ grpc_cc_test( grpc_cc_test( name = "bin_encoder_test", - srcs = ["bin_encoder_test.c"], - language = "C", + srcs = ["bin_encoder_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -68,8 +68,8 @@ grpc_cc_test( grpc_cc_test( name = "hpack_encoder_test", - srcs = ["hpack_encoder_test.c"], - language = "C", + srcs = ["hpack_encoder_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -80,8 +80,8 @@ grpc_cc_test( grpc_cc_test( name = "hpack_parser_test", - srcs = ["hpack_parser_test.c"], - language = "C", + srcs = ["hpack_parser_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -92,8 +92,8 @@ grpc_cc_test( grpc_cc_test( name = "hpack_table_test", - srcs = ["hpack_table_test.c"], - language = "C", + srcs = ["hpack_table_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -104,8 +104,8 @@ grpc_cc_test( grpc_cc_test( name = "stream_map_test", - srcs = ["stream_map_test.c"], - language = "C", + srcs = ["stream_map_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", @@ -116,8 +116,8 @@ grpc_cc_test( grpc_cc_test( name = "varint_test", - srcs = ["varint_test.c"], - language = "C", + srcs = ["varint_test.cc"], + language = "C++", deps = [ "//:gpr", "//:grpc", diff --git a/test/core/transport/chttp2/alpn_test.c b/test/core/transport/chttp2/alpn_test.cc index a43377393e..a43377393e 100644 --- a/test/core/transport/chttp2/alpn_test.c +++ b/test/core/transport/chttp2/alpn_test.cc diff --git a/test/core/transport/chttp2/bin_decoder_test.c b/test/core/transport/chttp2/bin_decoder_test.cc index 64cb1589f5..a29ec8a13f 100644 --- a/test/core/transport/chttp2/bin_decoder_test.c +++ b/test/core/transport/chttp2/bin_decoder_test.cc @@ -30,7 +30,7 @@ static int all_ok = 1; static void expect_slice_eq(grpc_exec_ctx* exec_ctx, grpc_slice expected, - grpc_slice slice, char* debug, int line) { + grpc_slice slice, const char* debug, int line) { if (!grpc_slice_eq(slice, expected)) { char* hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); char* he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.cc index 2465c59355..78b8808c41 100644 --- a/test/core/transport/chttp2/bin_encoder_test.c +++ b/test/core/transport/chttp2/bin_encoder_test.cc @@ -31,8 +31,8 @@ static int all_ok = 1; -static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char* debug, - int line) { +static void expect_slice_eq(grpc_slice expected, grpc_slice slice, + const char* debug, int line) { if (!grpc_slice_eq(slice, expected)) { char* hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); char* he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.cc index 9045f32643..a7e44abc2b 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.cc @@ -58,7 +58,8 @@ static void verify(grpc_exec_ctx* exec_ctx, const verify_params params, grpc_slice expect = parse_hexstring(expected); size_t i; va_list l; - grpc_linked_mdelem* e = gpr_malloc(sizeof(*e) * nheaders); + grpc_linked_mdelem* e = + static_cast<grpc_linked_mdelem*>(gpr_malloc(sizeof(*e) * nheaders)); grpc_metadata_batch b; grpc_metadata_batch_init(&b); @@ -89,7 +90,8 @@ static void verify(grpc_exec_ctx* exec_ctx, const verify_params params, if (cap_to_delete == num_to_delete) { cap_to_delete = GPR_MAX(2 * cap_to_delete, 1000); - to_delete = gpr_realloc(to_delete, sizeof(*to_delete) * cap_to_delete); + to_delete = static_cast<void**>( + gpr_realloc(to_delete, sizeof(*to_delete) * cap_to_delete)); } to_delete[num_to_delete++] = e; @@ -98,11 +100,11 @@ static void verify(grpc_exec_ctx* exec_ctx, const verify_params params, grpc_transport_one_way_stats stats; memset(&stats, 0, sizeof(stats)); grpc_encode_header_options hopt = { - .stream_id = 0xdeadbeef, - .is_eof = params.eof, - .use_true_binary_metadata = params.use_true_binary_metadata, - .max_frame_size = 16384, - .stats = &stats, + 0xdeadbeef, /* stream_id */ + params.eof, /* is_eof */ + params.use_true_binary_metadata, /* use_true_binary_metadata */ + 16384, /* max_frame_size */ + &stats /* stats */ }; grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt, &output); @@ -129,9 +131,9 @@ static void test_basic_headers(grpc_exec_ctx* exec_ctx) { int i; verify_params params = { - .eof = false, - .use_true_binary_metadata = false, - .only_intern_key = false, + false, + false, + false, }; verify(exec_ctx, params, "000005 0104 deadbeef 40 0161 0161", 1, "a", "a"); verify(exec_ctx, params, "000001 0104 deadbeef be", 1, "a", "a"); @@ -167,9 +169,9 @@ static void test_decode_table_overflow(grpc_exec_ctx* exec_ctx) { char* expect; verify_params params = { - .eof = false, - .use_true_binary_metadata = false, - .only_intern_key = false, + false, + false, + false, }; for (i = 0; i < 114; i++) { @@ -213,7 +215,8 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx* exec_ctx, grpc_slice_intern(grpc_slice_from_static_string(value))); size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem, use_true_binary); size_t initial_table_size = g_compressor.table_size; - grpc_linked_mdelem* e = gpr_malloc(sizeof(*e)); + grpc_linked_mdelem* e = + static_cast<grpc_linked_mdelem*>(gpr_malloc(sizeof(*e))); grpc_metadata_batch b; grpc_metadata_batch_init(&b); e[0].md = elem; @@ -227,11 +230,11 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx* exec_ctx, grpc_transport_one_way_stats stats; memset(&stats, 0, sizeof(stats)); grpc_encode_header_options hopt = { - .stream_id = 0xdeadbeef, - .is_eof = false, - .use_true_binary_metadata = use_true_binary, - .max_frame_size = 16384, - .stats = &stats}; + 0xdeadbeef, /* stream_id */ + false, /* is_eof */ + use_true_binary, /* use_true_binary_metadata */ + 16384, /* max_frame_size */ + &stats /* stats */}; grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt, &output); grpc_slice_buffer_destroy_internal(exec_ctx, &output); @@ -251,11 +254,7 @@ static void test_encode_header_size(grpc_exec_ctx* exec_ctx) { static void test_interned_key_indexed(grpc_exec_ctx* exec_ctx) { int i; - verify_params params = { - .eof = false, - .use_true_binary_metadata = false, - .only_intern_key = true, - }; + verify_params params = {false, false, true}; verify(exec_ctx, params, "000009 0104 deadbeef 40 0161 0162 0f2f 0163", 2, "a", "b", "a", "c"); for (i = 0; i < 10; i++) { diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc index 01230eb675..942f25e0b7 100644 --- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c +++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc @@ -34,7 +34,7 @@ static void onhdr(grpc_exec_ctx* exec_ctx, void* ud, grpc_mdelem md) { } static void dont_log(gpr_log_func_args* args) {} -int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); if (squelch) gpr_set_log_function(dont_log); grpc_init(); diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.cc index 6fbbaca1ab..434b46eb2e 100644 --- a/test/core/transport/chttp2/hpack_parser_test.c +++ b/test/core/transport/chttp2/hpack_parser_test.cc @@ -34,7 +34,7 @@ typedef struct { static void onhdr(grpc_exec_ctx* exec_ctx, void* ud, grpc_mdelem md) { const char *ekey, *evalue; - test_checker* chk = ud; + test_checker* chk = static_cast<test_checker*>(ud); ekey = va_arg(chk->args, char*); GPR_ASSERT(ekey); evalue = va_arg(chk->args, char*); diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.cc index ff7c2de538..ff7c2de538 100644 --- a/test/core/transport/chttp2/hpack_table_test.c +++ b/test/core/transport/chttp2/hpack_table_test.cc diff --git a/test/core/transport/chttp2/stream_map_test.c b/test/core/transport/chttp2/stream_map_test.cc index 43e7e7f59c..23a7b3f4c2 100644 --- a/test/core/transport/chttp2/stream_map_test.c +++ b/test/core/transport/chttp2/stream_map_test.cc @@ -92,7 +92,7 @@ static void test_basic_add_find(uint32_t n) { /* verify that for_each gets the right values during test_delete_evens_XXX */ static void verify_for_each(void* user_data, uint32_t stream_id, void* ptr) { - uint32_t* for_each_check = user_data; + uint32_t* for_each_check = static_cast<uint32_t*>(user_data); GPR_ASSERT(ptr); GPR_ASSERT(*for_each_check == stream_id); *for_each_check += 2; diff --git a/test/core/transport/chttp2/varint_test.c b/test/core/transport/chttp2/varint_test.cc index 413b461b3a..413b461b3a 100644 --- a/test/core/transport/chttp2/varint_test.c +++ b/test/core/transport/chttp2/varint_test.cc diff --git a/test/core/transport/connectivity_state_test.c b/test/core/transport/connectivity_state_test.cc index 8cd7b30b66..8cd7b30b66 100644 --- a/test/core/transport/connectivity_state_test.c +++ b/test/core/transport/connectivity_state_test.cc diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.cc index c555159a7a..b60a9619fb 100644 --- a/test/core/transport/metadata_test.c +++ b/test/core/transport/metadata_test.cc @@ -114,7 +114,8 @@ static void test_create_many_ephemeral_metadata(bool intern_keys, static void test_create_many_persistant_metadata(void) { char buffer[GPR_LTOA_MIN_BUFSIZE]; long i; - grpc_mdelem* created = gpr_malloc(sizeof(grpc_mdelem) * MANY); + grpc_mdelem* created = + static_cast<grpc_mdelem*>(gpr_malloc(sizeof(grpc_mdelem) * MANY)); grpc_mdelem md; gpr_log(GPR_INFO, "test_create_many_persistant_metadata"); @@ -226,8 +227,9 @@ static void test_things_stick_around(void) { size_t i, j; char* buffer; size_t nstrs = 1000; - grpc_slice* strs = gpr_malloc(sizeof(grpc_slice) * nstrs); - size_t* shuf = gpr_malloc(sizeof(size_t) * nstrs); + grpc_slice* strs = + static_cast<grpc_slice*>(gpr_malloc(sizeof(grpc_slice) * nstrs)); + size_t* shuf = static_cast<size_t*>(gpr_malloc(sizeof(size_t) * nstrs)); grpc_slice test; gpr_log(GPR_INFO, "test_things_stick_around"); @@ -281,9 +283,9 @@ static void test_user_data_works(void) { grpc_init(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - ud1 = gpr_malloc(sizeof(int)); + ud1 = static_cast<int*>(gpr_malloc(sizeof(int))); *ud1 = 1; - ud2 = gpr_malloc(sizeof(int)); + ud2 = static_cast<int*>(gpr_malloc(sizeof(int))); *ud2 = 2; md = grpc_mdelem_from_slices( &exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc")), diff --git a/test/core/transport/status_conversion_test.c b/test/core/transport/status_conversion_test.cc index 7af5d12cb7..7af5d12cb7 100644 --- a/test/core/transport/status_conversion_test.c +++ b/test/core/transport/status_conversion_test.cc diff --git a/test/core/transport/stream_owned_slice_test.c b/test/core/transport/stream_owned_slice_test.cc index 0b592a0496..0b592a0496 100644 --- a/test/core/transport/stream_owned_slice_test.c +++ b/test/core/transport/stream_owned_slice_test.cc diff --git a/test/core/transport/timeout_encoding_test.c b/test/core/transport/timeout_encoding_test.cc index 0930bc836d..0930bc836d 100644 --- a/test/core/transport/timeout_encoding_test.c +++ b/test/core/transport/timeout_encoding_test.cc |