aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/channel/channel_stack_test.c2
-rw-r--r--test/core/channel/metadata_buffer_test.c4
-rw-r--r--test/core/compression/message_compress_test.c2
-rw-r--r--test/core/echo/client.c2
-rw-r--r--test/core/echo/server.c2
-rw-r--r--test/core/end2end/tests/cancel_after_accept.c2
-rw-r--r--test/core/end2end/tests/cancel_after_accept_and_writes_closed.c2
-rw-r--r--test/core/end2end/tests/cancel_after_invoke.c2
-rw-r--r--test/core/end2end/tests/cancel_in_a_vacuum.c2
-rw-r--r--test/core/fling/client.c2
-rw-r--r--test/core/iomgr/resolve_address_test.c6
-rw-r--r--test/core/iomgr/sockaddr_utils_test.c7
-rw-r--r--test/core/iomgr/tcp_posix_test.c10
-rw-r--r--test/core/json/json_rewrite.c2
-rw-r--r--test/core/json/json_rewrite_test.c4
-rw-r--r--test/core/json/json_test.c2
-rw-r--r--test/core/security/secure_endpoint_test.c7
-rw-r--r--test/core/statistics/census_log_tests.c6
-rw-r--r--test/core/statistics/hash_table_test.c2
-rw-r--r--test/core/support/host_port_test.c3
-rw-r--r--test/core/support/slice_test.c6
-rw-r--r--test/core/surface/completion_queue_test.c2
-rw-r--r--test/core/transport/chttp2/timeout_encoding_test.c2
-rw-r--r--test/core/transport/stream_op_test.c2
-rw-r--r--test/core/transport/transport_end2end_tests.c2
25 files changed, 42 insertions, 43 deletions
diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c
index a400fb15bd..d53098b5e4 100644
--- a/test/core/channel/channel_stack_test.c
+++ b/test/core/channel/channel_stack_test.c
@@ -80,7 +80,7 @@ static void test_create_channel_stack(void) {
const grpc_channel_filter
filter = {call_func, channel_func, sizeof(int),
call_init_func, call_destroy_func, sizeof(int),
- channel_init_func, channel_destroy_func, };
+ channel_init_func, channel_destroy_func, "some_test_filter" };
const grpc_channel_filter *filters = &filter;
grpc_channel_stack *channel_stack;
grpc_call_stack *call_stack;
diff --git a/test/core/channel/metadata_buffer_test.c b/test/core/channel/metadata_buffer_test.c
index 9d7e1591f8..6081308986 100644
--- a/test/core/channel/metadata_buffer_test.c
+++ b/test/core/channel/metadata_buffer_test.c
@@ -112,12 +112,12 @@ static void destroy_channel_elem(grpc_channel_element *elem) {}
static const grpc_channel_filter top_filter = {
fail_call_op, fail_channel_op, sizeof(size_t),
init_call_elem, destroy_call_elem, sizeof(channel_data),
- init_channel_elem, destroy_channel_elem};
+ init_channel_elem, destroy_channel_elem, "top_filter" };
static const grpc_channel_filter bottom_filter = {
expect_call_op, fail_channel_op, sizeof(size_t),
init_call_elem, destroy_call_elem, sizeof(channel_data),
- init_channel_elem, destroy_channel_elem};
+ init_channel_elem, destroy_channel_elem, "bottom_filter" };
static const grpc_channel_filter *filters[2] = {&top_filter, &bottom_filter};
diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.c
index d1e593564f..5f55fa68d3 100644
--- a/test/core/compression/message_compress_test.c
+++ b/test/core/compression/message_compress_test.c
@@ -166,7 +166,7 @@ static void test_bad_data(void) {
}
int main(int argc, char **argv) {
- int i, j, k, m;
+ unsigned i, j, k, m;
grpc_slice_split_mode uncompressed_split_modes[] = {
GRPC_SLICE_SPLIT_IDENTITY, GRPC_SLICE_SPLIT_ONE_BYTE};
grpc_slice_split_mode compressed_split_modes[] = {GRPC_SLICE_SPLIT_MERGE_ALL,
diff --git a/test/core/echo/client.c b/test/core/echo/client.c
index 2f35b03228..bb478c4b4b 100644
--- a/test/core/echo/client.c
+++ b/test/core/echo/client.c
@@ -66,7 +66,7 @@ int main(int argc, char **argv) {
grpc_completion_queue *cq = NULL;
int bytes_written = 0;
int bytes_read = 0;
- int i = 0;
+ unsigned i = 0;
int waiting_finishes;
gpr_slice read_slice;
diff --git a/test/core/echo/server.c b/test/core/echo/server.c
index 6b67334248..2764a9ef0e 100644
--- a/test/core/echo/server.c
+++ b/test/core/echo/server.c
@@ -70,7 +70,7 @@ static void request_call(void) {
static void assert_read_ok(call_state *s, grpc_byte_buffer *b) {
grpc_byte_buffer_reader *bb_reader = NULL;
gpr_slice read_slice;
- int i;
+ unsigned i;
bb_reader = grpc_byte_buffer_reader_create(b);
while (grpc_byte_buffer_reader_next(bb_reader, &read_slice)) {
diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c
index 33aed98c38..05a2dc8bbb 100644
--- a/test/core/end2end/tests/cancel_after_accept.c
+++ b/test/core/end2end/tests/cancel_after_accept.c
@@ -149,7 +149,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
}
void grpc_end2end_tests(grpc_end2end_test_config config) {
- int i;
+ unsigned i;
for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) {
test_cancel_after_accept(config, cancellation_modes[i]);
diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
index f348488b18..db245a37e1 100644
--- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
+++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
@@ -157,7 +157,7 @@ static void test_cancel_after_accept_and_writes_closed(
}
void grpc_end2end_tests(grpc_end2end_test_config config) {
- int i;
+ unsigned i;
for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) {
test_cancel_after_accept_and_writes_closed(config, cancellation_modes[i]);
diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c
index 3bb86723e6..5dfb3f756a 100644
--- a/test/core/end2end/tests/cancel_after_invoke.c
+++ b/test/core/end2end/tests/cancel_after_invoke.c
@@ -132,7 +132,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
}
void grpc_end2end_tests(grpc_end2end_test_config config) {
- int i;
+ unsigned i;
for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) {
test_cancel_after_invoke(config, cancellation_modes[i]);
diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c
index e4f9deecd1..5257ece297 100644
--- a/test/core/end2end/tests/cancel_in_a_vacuum.c
+++ b/test/core/end2end/tests/cancel_in_a_vacuum.c
@@ -122,7 +122,7 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config,
}
void grpc_end2end_tests(grpc_end2end_test_config config) {
- int i;
+ unsigned i;
for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) {
test_cancel_in_a_vacuum(config, cancellation_modes[i]);
diff --git a/test/core/fling/client.c b/test/core/fling/client.c
index 7947ffecc5..8f91098591 100644
--- a/test/core/fling/client.c
+++ b/test/core/fling/client.c
@@ -103,7 +103,7 @@ static const scenario scenarios[] = {
int main(int argc, char **argv) {
gpr_slice slice = gpr_slice_from_copied_string("x");
double start, stop;
- int i;
+ unsigned i;
char *fake_argv[1];
diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.c
index 4cc101b6b0..1f97724e60 100644
--- a/test/core/iomgr/resolve_address_test.c
+++ b/test/core/iomgr/resolve_address_test.c
@@ -85,7 +85,7 @@ static void test_ipv6_with_port(void) {
static void test_ipv6_without_port(void) {
const char* const kCases[] = {"2001:db8::1", "2001:db8::1.2.3.4",
"[2001:db8::1]", };
- int i;
+ unsigned i;
for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) {
gpr_event ev;
gpr_event_init(&ev);
@@ -96,7 +96,7 @@ static void test_ipv6_without_port(void) {
static void test_invalid_ip_addresses(void) {
const char* const kCases[] = {"293.283.1238.3:1", "[2001:db8::11111]:1", };
- int i;
+ unsigned i;
for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) {
gpr_event ev;
gpr_event_init(&ev);
@@ -108,7 +108,7 @@ static void test_invalid_ip_addresses(void) {
static void test_unparseable_hostports(void) {
const char* const kCases[] = {"[", "[::1", "[::1]bad",
"[1.2.3.4]", "[localhost]", "[localhost]:1", };
- int i;
+ unsigned i;
for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) {
gpr_event ev;
gpr_event_init(&ev);
diff --git a/test/core/iomgr/sockaddr_utils_test.c b/test/core/iomgr/sockaddr_utils_test.c
index 3e653da4c9..6cbdc4e21c 100644
--- a/test/core/iomgr/sockaddr_utils_test.c
+++ b/test/core/iomgr/sockaddr_utils_test.c
@@ -182,7 +182,8 @@ static void expect_sockaddr_str(const char *expected, void *addr,
gpr_log(GPR_INFO, " expect_sockaddr_str(%s)", expected);
result = grpc_sockaddr_to_string(&str, (struct sockaddr *)addr, normalize);
GPR_ASSERT(str != NULL);
- GPR_ASSERT(result == strlen(str));
+ GPR_ASSERT(result >= 0);
+ GPR_ASSERT((size_t)result == strlen(str));
GPR_ASSERT(strcmp(expected, str) == 0);
gpr_free(str);
}
@@ -194,7 +195,7 @@ static void test_sockaddr_to_string(void) {
gpr_log(GPR_INFO, "%s", __FUNCTION__);
- errno = 0xDEADBEEF;
+ errno = 0x7EADBEEF;
input4 = make_addr4(kIPv4, sizeof(kIPv4));
expect_sockaddr_str("192.0.2.1:12345", &input4, 0);
@@ -217,7 +218,7 @@ static void test_sockaddr_to_string(void) {
expect_sockaddr_str("(sockaddr family=123)", &dummy, 0);
expect_sockaddr_str("(sockaddr family=123)", &dummy, 1);
- GPR_ASSERT(errno == 0xDEADBEEF);
+ GPR_ASSERT(errno == 0x7EADBEEF);
}
int main(int argc, char **argv) {
diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c
index 24634b4700..f52ae22981 100644
--- a/test/core/iomgr/tcp_posix_test.c
+++ b/test/core/iomgr/tcp_posix_test.c
@@ -94,7 +94,7 @@ static size_t fill_socket_partial(int fd, size_t bytes) {
ssize_t write_bytes;
size_t total_bytes = 0;
unsigned char *buf = malloc(bytes);
- int i;
+ unsigned i;
for (i = 0; i < bytes; ++i) {
buf[i] = i % 256;
}
@@ -115,15 +115,14 @@ struct read_socket_state {
grpc_endpoint *ep;
gpr_mu mu;
gpr_cv cv;
- size_t read_bytes;
+ ssize_t read_bytes;
ssize_t target_read_bytes;
};
static ssize_t count_and_unref_slices(gpr_slice *slices, size_t nslices,
int *current_data) {
ssize_t num_bytes = 0;
- int i;
- int j;
+ unsigned i, j;
unsigned char *buf;
for (i = 0; i < nslices; ++i) {
buf = GPR_SLICE_START_PTR(slices[i]);
@@ -254,8 +253,7 @@ static gpr_slice *allocate_blocks(ssize_t num_bytes, ssize_t slice_size,
ssize_t nslices = num_bytes / slice_size + (num_bytes % slice_size ? 1 : 0);
gpr_slice *slices = gpr_malloc(sizeof(gpr_slice) * nslices);
ssize_t num_bytes_left = num_bytes;
- int i;
- int j;
+ unsigned i, j;
unsigned char *buf;
*num_blocks = nslices;
diff --git a/test/core/json/json_rewrite.c b/test/core/json/json_rewrite.c
index edece98d57..a761a670f0 100644
--- a/test/core/json/json_rewrite.c
+++ b/test/core/json/json_rewrite.c
@@ -131,7 +131,7 @@ static void json_reader_string_add_utf32(void* userdata, gpr_uint32 c) {
}
static gpr_uint32 json_reader_read_char(void* userdata) {
- gpr_uint32 r;
+ int r;
json_reader_userdata* state = userdata;
r = fgetc(state->in);
diff --git a/test/core/json/json_rewrite_test.c b/test/core/json/json_rewrite_test.c
index e47a418761..4ce406c990 100644
--- a/test/core/json/json_rewrite_test.c
+++ b/test/core/json/json_rewrite_test.c
@@ -138,7 +138,7 @@ static void json_reader_string_add_utf32(void* userdata, gpr_uint32 c) {
}
static gpr_uint32 json_reader_read_char(void* userdata) {
- gpr_uint32 r;
+ int r;
json_reader_userdata* state = userdata;
if (!state->did_eagain) {
@@ -298,7 +298,7 @@ static test_file test_files[] = {
};
void test_rewrites() {
- int i;
+ unsigned i;
for (i = 0; i < GPR_ARRAY_SIZE(test_files); i++) {
test_file* test = test_files + i;
diff --git a/test/core/json/json_test.c b/test/core/json/json_test.c
index c234eb9ede..11659a5716 100644
--- a/test/core/json/json_test.c
+++ b/test/core/json/json_test.c
@@ -124,7 +124,7 @@ static testing_pair testing_pairs[] = {
};
static void test_pairs() {
- int i;
+ unsigned i;
for (i = 0; i < GPR_ARRAY_SIZE(testing_pairs); i++) {
testing_pair* pair = testing_pairs + i;
diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c
index 5d875025ec..456515bfd5 100644
--- a/test/core/security/secure_endpoint_test.c
+++ b/test/core/security/secure_endpoint_test.c
@@ -59,7 +59,7 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
f.client_ep =
grpc_secure_endpoint_create(fake_read_protector, tcp.client, NULL, 0);
} else {
- int i;
+ unsigned i;
tsi_result result;
size_t still_pending_size;
size_t total_buffer_size = 8192;
@@ -81,9 +81,8 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
message_bytes += processed_message_size;
message_size -= processed_message_size;
cur += protected_buffer_size_to_send;
+ GPR_ASSERT(buffer_size >= protected_buffer_size_to_send);
buffer_size -= protected_buffer_size_to_send;
-
- GPR_ASSERT(buffer_size >= 0);
}
gpr_slice_unref(plain);
}
@@ -94,8 +93,8 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
&still_pending_size);
GPR_ASSERT(result == TSI_OK);
cur += protected_buffer_size_to_send;
+ GPR_ASSERT(buffer_size >= protected_buffer_size_to_send);
buffer_size -= protected_buffer_size_to_send;
- GPR_ASSERT(buffer_size >= 0);
} while (still_pending_size > 0);
encrypted_leftover = gpr_slice_from_copied_buffer(
(const char *)encrypted_buffer, total_buffer_size - buffer_size);
diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c
index ca2d1dedb0..c7b2b2e46d 100644
--- a/test/core/statistics/census_log_tests.c
+++ b/test/core/statistics/census_log_tests.c
@@ -415,8 +415,8 @@ void test_read_pending_record(void) {
/* Tries reading beyond pending write. */
void test_read_beyond_pending_record(void) {
/* Start a write. */
- gpr_int32 incomplete_record_size = 10;
- gpr_int32 complete_record_size = 20;
+ gpr_uint32 incomplete_record_size = 10;
+ gpr_uint32 complete_record_size = 20;
size_t bytes_available;
void* complete_record;
const void* record_read;
@@ -457,7 +457,7 @@ void test_detached_while_reading(void) {
size_t bytes_available;
const void* record_read;
void* record_written;
- gpr_int32 block_read = 0;
+ gpr_uint32 block_read = 0;
printf("Starting test: detached while reading\n");
setup_test(0);
/* Start a write. */
diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.c
index f8df2574a4..e8e4d8b6f1 100644
--- a/test/core/statistics/hash_table_test.c
+++ b/test/core/statistics/hash_table_test.c
@@ -190,7 +190,7 @@ static void test_insertion_and_deletion_with_high_collision_rate(void) {
census_ht* ht = census_ht_create(&opt);
char key_str[1000][GPR_LTOA_MIN_BUFSIZE];
gpr_uint64 val = 0;
- int i = 0;
+ unsigned i = 0;
for (i = 0; i < 1000; i++) {
census_ht_key key;
key.ptr = key_str[i];
diff --git a/test/core/support/host_port_test.c b/test/core/support/host_port_test.c
index 5b06b7076e..6d14fab863 100644
--- a/test/core/support/host_port_test.c
+++ b/test/core/support/host_port_test.c
@@ -43,7 +43,8 @@ static void join_host_port_expect(const char *host, int port,
char *buf;
int len;
len = gpr_join_host_port(&buf, host, port);
- GPR_ASSERT(strlen(expected) == len);
+ GPR_ASSERT(len >= 0);
+ GPR_ASSERT(strlen(expected) == (size_t)len);
GPR_ASSERT(strcmp(expected, buf) == 0);
gpr_free(buf);
}
diff --git a/test/core/support/slice_test.c b/test/core/support/slice_test.c
index 2a7056feb2..469d7dedc3 100644
--- a/test/core/support/slice_test.c
+++ b/test/core/support/slice_test.c
@@ -103,10 +103,10 @@ static void test_slice_new_with_len_returns_something_sensible(void) {
GPR_ASSERT(do_nothing_with_len_1_calls == 1);
}
-static void test_slice_sub_works(int length) {
+static void test_slice_sub_works(unsigned length) {
gpr_slice slice;
gpr_slice sub;
- int i, j, k;
+ unsigned i, j, k;
LOG_TEST_NAME();
gpr_log(GPR_INFO, "length=%d", length);
@@ -212,7 +212,7 @@ static void test_slice_from_copied_string_works(void) {
}
int main(int argc, char **argv) {
- int length;
+ unsigned length;
grpc_test_init(argc, argv);
test_slice_malloc_returns_something_sensible();
test_slice_new_returns_something_sensible();
diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c
index 71f9cc2291..dc459d62a8 100644
--- a/test/core/surface/completion_queue_test.c
+++ b/test/core/surface/completion_queue_test.c
@@ -214,7 +214,7 @@ static void test_pluck(void) {
grpc_event *ev;
grpc_completion_queue *cc;
void *tags[128];
- int i, j;
+ unsigned i, j;
int on_finish_called = 0;
LOG_TEST();
diff --git a/test/core/transport/chttp2/timeout_encoding_test.c b/test/core/transport/chttp2/timeout_encoding_test.c
index 0ad90dbcef..56a1e6ee63 100644
--- a/test/core/transport/chttp2/timeout_encoding_test.c
+++ b/test/core/transport/chttp2/timeout_encoding_test.c
@@ -94,7 +94,7 @@ void decode_suite(char ext, gpr_timespec (*answer)(long x)) {
long test_vals[] = {1, 12, 123, 1234, 12345, 123456,
1234567, 12345678, 123456789, 98765432, 9876543, 987654,
98765, 9876, 987, 98, 9};
- int i;
+ unsigned i;
char *input;
for (i = 0; i < GPR_ARRAY_SIZE(test_vals); i++) {
gpr_asprintf(&input, "%ld%c", test_vals[i], ext);
diff --git a/test/core/transport/stream_op_test.c b/test/core/transport/stream_op_test.c
index 0d1122c0ad..e6649ec97c 100644
--- a/test/core/transport/stream_op_test.c
+++ b/test/core/transport/stream_op_test.c
@@ -61,7 +61,7 @@ int main(int argc, char **argv) {
gpr_slice test_slice_3 = gpr_slice_malloc(3);
gpr_slice test_slice_4 = gpr_slice_malloc(4);
char x;
- int i;
+ unsigned i;
grpc_stream_op_buffer buf;
grpc_stream_op_buffer buf2;
diff --git a/test/core/transport/transport_end2end_tests.c b/test/core/transport/transport_end2end_tests.c
index 25276c0fca..2cd033bf3a 100644
--- a/test/core/transport/transport_end2end_tests.c
+++ b/test/core/transport/transport_end2end_tests.c
@@ -913,7 +913,7 @@ static const size_t interesting_message_lengths[] = {1, 100, 10000,
100000, 1000000, };
void grpc_transport_end2end_tests(grpc_transport_test_config *config) {
- int i;
+ unsigned i;
g_metadata_context = grpc_mdctx_create();