aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/support
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/support')
-rw-r--r--test/core/support/alloc_test.c20
-rw-r--r--test/core/support/arena_test.c22
-rw-r--r--test/core/support/avl_test.c56
-rw-r--r--test/core/support/cmdline_test.c120
-rw-r--r--test/core/support/cpu_test.c8
-rw-r--r--test/core/support/env_test.c8
-rw-r--r--test/core/support/histogram_test.c6
-rw-r--r--test/core/support/host_port_test.c8
-rw-r--r--test/core/support/log_test.c8
-rw-r--r--test/core/support/mpscq_test.c40
-rw-r--r--test/core/support/murmur_hash_test.c4
-rw-r--r--test/core/support/spinlock_test.c26
-rw-r--r--test/core/support/stack_lockfree_test.c12
-rw-r--r--test/core/support/string_test.c36
-rw-r--r--test/core/support/sync_test.c78
-rw-r--r--test/core/support/thd_test.c8
-rw-r--r--test/core/support/time_test.c14
-rw-r--r--test/core/support/tls_test.c4
-rw-r--r--test/core/support/useful_test.c2
19 files changed, 239 insertions, 241 deletions
diff --git a/test/core/support/alloc_test.c b/test/core/support/alloc_test.c
index 088ae7d944..37f2c2ef42 100644
--- a/test/core/support/alloc_test.c
+++ b/test/core/support/alloc_test.c
@@ -20,35 +20,33 @@
#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
-static void *fake_malloc(size_t size) { return (void *)size; }
+static void* fake_malloc(size_t size) { return (void*)size; }
-static void *fake_realloc(void *addr, size_t size) { return (void *)size; }
+static void* fake_realloc(void* addr, size_t size) { return (void*)size; }
-static void fake_free(void *addr) {
- *((intptr_t *)addr) = (intptr_t)0xdeadd00d;
-}
+static void fake_free(void* addr) { *((intptr_t*)addr) = (intptr_t)0xdeadd00d; }
static void test_custom_allocs() {
const gpr_allocation_functions default_fns = gpr_get_allocation_functions();
intptr_t addr_to_free = 0;
- char *i;
+ char* i;
gpr_allocation_functions fns = {fake_malloc, NULL, fake_realloc, fake_free};
gpr_set_allocation_functions(fns);
- GPR_ASSERT((void *)(size_t)0xdeadbeef == gpr_malloc(0xdeadbeef));
- GPR_ASSERT((void *)(size_t)0xcafed00d == gpr_realloc(0, 0xcafed00d));
+ GPR_ASSERT((void*)(size_t)0xdeadbeef == gpr_malloc(0xdeadbeef));
+ GPR_ASSERT((void*)(size_t)0xcafed00d == gpr_realloc(0, 0xcafed00d));
gpr_free(&addr_to_free);
GPR_ASSERT(addr_to_free == (intptr_t)0xdeadd00d);
/* Restore and check we don't get funky values and that we don't leak */
gpr_set_allocation_functions(default_fns);
- GPR_ASSERT((void *)sizeof(*i) != (i = gpr_malloc(sizeof(*i))));
- GPR_ASSERT((void *)2 != (i = gpr_realloc(i, 2)));
+ GPR_ASSERT((void*)sizeof(*i) != (i = gpr_malloc(sizeof(*i))));
+ GPR_ASSERT((void*)2 != (i = gpr_realloc(i, 2)));
gpr_free(i);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
test_custom_allocs();
return 0;
diff --git a/test/core/support/arena_test.c b/test/core/support/arena_test.c
index afb309280f..d198c4053d 100644
--- a/test/core/support/arena_test.c
+++ b/test/core/support/arena_test.c
@@ -32,10 +32,10 @@
static void test_noop(void) { gpr_arena_destroy(gpr_arena_create(1)); }
-static void test(const char *name, size_t init_size, const size_t *allocs,
+static void test(const char* name, size_t init_size, const size_t* allocs,
size_t nallocs) {
gpr_strvec v;
- char *s;
+ char* s;
gpr_strvec_init(&v);
gpr_asprintf(&s, "test '%s': %" PRIdPTR " <- {", name, init_size);
gpr_strvec_add(&v, s);
@@ -49,8 +49,8 @@ static void test(const char *name, size_t init_size, const size_t *allocs,
gpr_log(GPR_INFO, "%s", s);
gpr_free(s);
- gpr_arena *a = gpr_arena_create(init_size);
- void **ps = gpr_zalloc(sizeof(*ps) * nallocs);
+ gpr_arena* a = gpr_arena_create(init_size);
+ void** ps = gpr_zalloc(sizeof(*ps) * nallocs);
for (size_t i = 0; i < nallocs; i++) {
ps[i] = gpr_arena_alloc(a, allocs[i]);
// ensure no duplicate results
@@ -71,20 +71,20 @@ static void test(const char *name, size_t init_size, const size_t *allocs,
#define CONCURRENT_TEST_THREADS 100
size_t concurrent_test_iterations() {
- if (sizeof(void *) < 8) return 1000;
+ if (sizeof(void*) < 8) return 1000;
return 100000;
}
typedef struct {
gpr_event ev_start;
- gpr_arena *arena;
+ gpr_arena* arena;
} concurrent_test_args;
-static void concurrent_test_body(void *arg) {
- concurrent_test_args *a = arg;
+static void concurrent_test_body(void* arg) {
+ concurrent_test_args* a = arg;
gpr_event_wait(&a->ev_start, gpr_inf_future(GPR_CLOCK_REALTIME));
for (size_t i = 0; i < concurrent_test_iterations(); i++) {
- *(char *)gpr_arena_alloc(a->arena, 1) = (char)i;
+ *(char*)gpr_arena_alloc(a->arena, 1) = (char)i;
}
}
@@ -103,7 +103,7 @@ static void concurrent_test(void) {
gpr_thd_new(&thds[i], concurrent_test_body, &args, &opt);
}
- gpr_event_set(&args.ev_start, (void *)1);
+ gpr_event_set(&args.ev_start, (void*)1);
for (int i = 0; i < CONCURRENT_TEST_THREADS; i++) {
gpr_thd_join(thds[i]);
@@ -112,7 +112,7 @@ static void concurrent_test(void) {
gpr_arena_destroy(args.arena);
}
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
grpc_test_init(argc, argv);
test_noop();
diff --git a/test/core/support/avl_test.c b/test/core/support/avl_test.c
index 37424d6405..bd7487f6da 100644
--- a/test/core/support/avl_test.c
+++ b/test/core/support/avl_test.c
@@ -27,36 +27,36 @@
#include "test/core/util/test_config.h"
-static int *box(int x) {
- int *b = gpr_malloc(sizeof(*b));
+static int* box(int x) {
+ int* b = gpr_malloc(sizeof(*b));
*b = x;
return b;
}
-static long int_compare(void *int1, void *int2, void *unused) {
- return (*(int *)int1) - (*(int *)int2);
+static long int_compare(void* int1, void* int2, void* unused) {
+ return (*(int*)int1) - (*(int*)int2);
}
-static void *int_copy(void *p, void *unused) { return box(*(int *)p); }
+static void* int_copy(void* p, void* unused) { return box(*(int*)p); }
-static void destroy(void *p, void *unused) { gpr_free(p); }
+static void destroy(void* p, void* unused) { gpr_free(p); }
static const gpr_avl_vtable int_int_vtable = {destroy, int_copy, int_compare,
destroy, int_copy};
static void check_get(gpr_avl avl, int key, int value) {
- int *k = box(key);
- GPR_ASSERT(*(int *)gpr_avl_get(avl, k, NULL) == value);
+ int* k = box(key);
+ GPR_ASSERT(*(int*)gpr_avl_get(avl, k, NULL) == value);
gpr_free(k);
}
static void check_negget(gpr_avl avl, int key) {
- int *k = box(key);
+ int* k = box(key);
GPR_ASSERT(gpr_avl_get(avl, k, NULL) == NULL);
gpr_free(k);
}
static gpr_avl remove_int(gpr_avl avl, int key) {
- int *k = box(key);
+ int* k = box(key);
avl = gpr_avl_remove(avl, k, NULL);
gpr_free(k);
return avl;
@@ -83,9 +83,9 @@ static void test_ll(void) {
avl = gpr_avl_add(avl, box(5), box(1), NULL);
avl = gpr_avl_add(avl, box(4), box(2), NULL);
avl = gpr_avl_add(avl, box(3), box(3), NULL);
- GPR_ASSERT(*(int *)avl.root->key == 4);
- GPR_ASSERT(*(int *)avl.root->left->key == 3);
- GPR_ASSERT(*(int *)avl.root->right->key == 5);
+ GPR_ASSERT(*(int*)avl.root->key == 4);
+ GPR_ASSERT(*(int*)avl.root->left->key == 3);
+ GPR_ASSERT(*(int*)avl.root->right->key == 5);
gpr_avl_unref(avl, NULL);
}
@@ -96,9 +96,9 @@ static void test_lr(void) {
avl = gpr_avl_add(avl, box(5), box(1), NULL);
avl = gpr_avl_add(avl, box(3), box(2), NULL);
avl = gpr_avl_add(avl, box(4), box(3), NULL);
- GPR_ASSERT(*(int *)avl.root->key == 4);
- GPR_ASSERT(*(int *)avl.root->left->key == 3);
- GPR_ASSERT(*(int *)avl.root->right->key == 5);
+ GPR_ASSERT(*(int*)avl.root->key == 4);
+ GPR_ASSERT(*(int*)avl.root->left->key == 3);
+ GPR_ASSERT(*(int*)avl.root->right->key == 5);
gpr_avl_unref(avl, NULL);
}
@@ -109,9 +109,9 @@ static void test_rr(void) {
avl = gpr_avl_add(avl, box(3), box(1), NULL);
avl = gpr_avl_add(avl, box(4), box(2), NULL);
avl = gpr_avl_add(avl, box(5), box(3), NULL);
- GPR_ASSERT(*(int *)avl.root->key == 4);
- GPR_ASSERT(*(int *)avl.root->left->key == 3);
- GPR_ASSERT(*(int *)avl.root->right->key == 5);
+ GPR_ASSERT(*(int*)avl.root->key == 4);
+ GPR_ASSERT(*(int*)avl.root->left->key == 3);
+ GPR_ASSERT(*(int*)avl.root->right->key == 5);
gpr_avl_unref(avl, NULL);
}
@@ -122,9 +122,9 @@ static void test_rl(void) {
avl = gpr_avl_add(avl, box(3), box(1), NULL);
avl = gpr_avl_add(avl, box(5), box(2), NULL);
avl = gpr_avl_add(avl, box(4), box(3), NULL);
- GPR_ASSERT(*(int *)avl.root->key == 4);
- GPR_ASSERT(*(int *)avl.root->left->key == 3);
- GPR_ASSERT(*(int *)avl.root->right->key == 5);
+ GPR_ASSERT(*(int*)avl.root->key == 4);
+ GPR_ASSERT(*(int*)avl.root->left->key == 3);
+ GPR_ASSERT(*(int*)avl.root->right->key == 5);
gpr_avl_unref(avl, NULL);
}
@@ -137,11 +137,11 @@ static void test_unbalanced(void) {
avl = gpr_avl_add(avl, box(3), box(3), NULL);
avl = gpr_avl_add(avl, box(2), box(4), NULL);
avl = gpr_avl_add(avl, box(1), box(5), NULL);
- GPR_ASSERT(*(int *)avl.root->key == 4);
- GPR_ASSERT(*(int *)avl.root->left->key == 2);
- GPR_ASSERT(*(int *)avl.root->left->left->key == 1);
- GPR_ASSERT(*(int *)avl.root->left->right->key == 3);
- GPR_ASSERT(*(int *)avl.root->right->key == 5);
+ GPR_ASSERT(*(int*)avl.root->key == 4);
+ GPR_ASSERT(*(int*)avl.root->left->key == 2);
+ GPR_ASSERT(*(int*)avl.root->left->left->key == 1);
+ GPR_ASSERT(*(int*)avl.root->left->right->key == 3);
+ GPR_ASSERT(*(int*)avl.root->right->key == 5);
gpr_avl_unref(avl, NULL);
}
@@ -3639,7 +3639,7 @@ static void test_stress(int amount_of_stress) {
gpr_avl_unref(avl, NULL);
}
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
grpc_test_init(argc, argv);
test_get();
diff --git a/test/core/support/cmdline_test.c b/test/core/support/cmdline_test.c
index 72e7c7f9fc..8d6a372c13 100644
--- a/test/core/support/cmdline_test.c
+++ b/test/core/support/cmdline_test.c
@@ -29,8 +29,8 @@
static void test_simple_int(void) {
int x = 1;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "-foo", "3"};
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "-foo", "3"};
LOG_TEST();
@@ -44,8 +44,8 @@ static void test_simple_int(void) {
static void test_eq_int(void) {
int x = 1;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "-foo=3"};
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "-foo=3"};
LOG_TEST();
@@ -59,8 +59,8 @@ static void test_eq_int(void) {
static void test_2dash_int(void) {
int x = 1;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "--foo", "3"};
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "--foo", "3"};
LOG_TEST();
@@ -74,8 +74,8 @@ static void test_2dash_int(void) {
static void test_2dash_eq_int(void) {
int x = 1;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "--foo=3"};
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "--foo=3"};
LOG_TEST();
@@ -88,9 +88,9 @@ static void test_2dash_eq_int(void) {
}
static void test_simple_string(void) {
- char *x = NULL;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "-foo", "3"};
+ char* x = NULL;
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "-foo", "3"};
LOG_TEST();
@@ -103,9 +103,9 @@ static void test_simple_string(void) {
}
static void test_eq_string(void) {
- char *x = NULL;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "-foo=3"};
+ char* x = NULL;
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "-foo=3"};
LOG_TEST();
@@ -118,9 +118,9 @@ static void test_eq_string(void) {
}
static void test_2dash_string(void) {
- char *x = NULL;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "--foo", "3"};
+ char* x = NULL;
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "--foo", "3"};
LOG_TEST();
@@ -133,9 +133,9 @@ static void test_2dash_string(void) {
}
static void test_2dash_eq_string(void) {
- char *x = NULL;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "--foo=3"};
+ char* x = NULL;
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "--foo=3"};
LOG_TEST();
@@ -149,8 +149,8 @@ static void test_2dash_eq_string(void) {
static void test_flag_on(void) {
int x = 2;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "--foo"};
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "--foo"};
LOG_TEST();
@@ -164,8 +164,8 @@ static void test_flag_on(void) {
static void test_flag_no(void) {
int x = 2;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "--no-foo"};
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "--no-foo"};
LOG_TEST();
@@ -179,8 +179,8 @@ static void test_flag_no(void) {
static void test_flag_val_1(void) {
int x = 2;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "--foo=1"};
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "--foo=1"};
LOG_TEST();
@@ -194,8 +194,8 @@ static void test_flag_val_1(void) {
static void test_flag_val_0(void) {
int x = 2;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "--foo=0"};
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "--foo=0"};
LOG_TEST();
@@ -209,8 +209,8 @@ static void test_flag_val_0(void) {
static void test_flag_val_true(void) {
int x = 2;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "--foo=true"};
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "--foo=true"};
LOG_TEST();
@@ -224,8 +224,8 @@ static void test_flag_val_true(void) {
static void test_flag_val_false(void) {
int x = 2;
- gpr_cmdline *cl;
- char *args[] = {(char *)__FILE__, "--foo=false"};
+ gpr_cmdline* cl;
+ char* args[] = {(char*)__FILE__, "--foo=false"};
LOG_TEST();
@@ -238,12 +238,12 @@ static void test_flag_val_false(void) {
}
static void test_many(void) {
- char *str = NULL;
+ char* str = NULL;
int x = 0;
int flag = 2;
- gpr_cmdline *cl;
+ gpr_cmdline* cl;
- char *args[] = {(char *)__FILE__, "--str", "hello", "-x=4", "-no-flag"};
+ char* args[] = {(char*)__FILE__, "--str", "hello", "-x=4", "-no-flag"};
LOG_TEST();
@@ -258,8 +258,8 @@ static void test_many(void) {
gpr_cmdline_destroy(cl);
}
-static void extra_arg_cb(void *user_data, const char *arg) {
- int *count = user_data;
+static void extra_arg_cb(void* user_data, const char* arg) {
+ int* count = user_data;
GPR_ASSERT(arg != NULL);
GPR_ASSERT(strlen(arg) == 1);
GPR_ASSERT(arg[0] == 'a' + *count);
@@ -267,9 +267,9 @@ static void extra_arg_cb(void *user_data, const char *arg) {
}
static void test_extra(void) {
- gpr_cmdline *cl;
+ gpr_cmdline* cl;
int count = 0;
- char *args[] = {(char *)__FILE__, "a", "b", "c"};
+ char* args[] = {(char*)__FILE__, "a", "b", "c"};
LOG_TEST();
@@ -282,9 +282,9 @@ static void test_extra(void) {
}
static void test_extra_dashdash(void) {
- gpr_cmdline *cl;
+ gpr_cmdline* cl;
int count = 0;
- char *args[] = {(char *)__FILE__, "--", "a", "b", "c"};
+ char* args[] = {(char*)__FILE__, "--", "a", "b", "c"};
LOG_TEST();
@@ -297,10 +297,10 @@ static void test_extra_dashdash(void) {
}
static void test_usage(void) {
- gpr_cmdline *cl;
- char *usage;
+ gpr_cmdline* cl;
+ char* usage;
- char *str = NULL;
+ char* str = NULL;
int x = 0;
int flag = 2;
@@ -329,13 +329,13 @@ static void test_usage(void) {
}
static void test_help(void) {
- gpr_cmdline *cl;
+ gpr_cmdline* cl;
- char *str = NULL;
+ char* str = NULL;
int x = 0;
int flag = 2;
- char *help[] = {(char *)__FILE__, "-h"};
+ char* help[] = {(char*)__FILE__, "-h"};
LOG_TEST();
@@ -353,13 +353,13 @@ static void test_help(void) {
}
static void test_badargs1(void) {
- gpr_cmdline *cl;
+ gpr_cmdline* cl;
- char *str = NULL;
+ char* str = NULL;
int x = 0;
int flag = 2;
- char *bad_arg_name[] = {(char *)__FILE__, "--y"};
+ char* bad_arg_name[] = {(char*)__FILE__, "--y"};
LOG_TEST();
@@ -378,13 +378,13 @@ static void test_badargs1(void) {
}
static void test_badargs2(void) {
- gpr_cmdline *cl;
+ gpr_cmdline* cl;
- char *str = NULL;
+ char* str = NULL;
int x = 0;
int flag = 2;
- char *bad_int_value[] = {(char *)__FILE__, "--x", "henry"};
+ char* bad_int_value[] = {(char*)__FILE__, "--x", "henry"};
LOG_TEST();
@@ -403,13 +403,13 @@ static void test_badargs2(void) {
}
static void test_badargs3(void) {
- gpr_cmdline *cl;
+ gpr_cmdline* cl;
- char *str = NULL;
+ char* str = NULL;
int x = 0;
int flag = 2;
- char *bad_bool_value[] = {(char *)__FILE__, "--flag=henry"};
+ char* bad_bool_value[] = {(char*)__FILE__, "--flag=henry"};
LOG_TEST();
@@ -428,13 +428,13 @@ static void test_badargs3(void) {
}
static void test_badargs4(void) {
- gpr_cmdline *cl;
+ gpr_cmdline* cl;
- char *str = NULL;
+ char* str = NULL;
int x = 0;
int flag = 2;
- char *bad_bool_value[] = {(char *)__FILE__, "--no-str"};
+ char* bad_bool_value[] = {(char*)__FILE__, "--no-str"};
LOG_TEST();
@@ -452,7 +452,7 @@ static void test_badargs4(void) {
gpr_cmdline_destroy(cl);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
test_simple_int();
test_eq_int();
diff --git a/test/core/support/cpu_test.c b/test/core/support/cpu_test.c
index 72db53fa49..3c49486651 100644
--- a/test/core/support/cpu_test.c
+++ b/test/core/support/cpu_test.c
@@ -57,12 +57,12 @@ struct cpu_test {
uint32_t ncores;
int is_done;
gpr_cv done_cv;
- int *used; /* is this core used? */
+ int* used; /* is this core used? */
unsigned r; /* random number */
};
-static void worker_thread(void *arg) {
- struct cpu_test *ct = (struct cpu_test *)arg;
+static void worker_thread(void* arg) {
+ struct cpu_test* ct = (struct cpu_test*)arg;
uint32_t cpu;
unsigned r = 12345678;
unsigned i, j;
@@ -128,7 +128,7 @@ static void cpu_test(void) {
gpr_free(ct.used);
}
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
grpc_test_init(argc, argv);
cpu_test();
return 0;
diff --git a/test/core/support/env_test.c b/test/core/support/env_test.c
index 661a546720..54009536b4 100644
--- a/test/core/support/env_test.c
+++ b/test/core/support/env_test.c
@@ -29,9 +29,9 @@
#define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x)
static void test_setenv_getenv(void) {
- const char *name = "FOO";
- const char *value = "BAR";
- char *retrieved_value;
+ const char* name = "FOO";
+ const char* value = "BAR";
+ char* retrieved_value;
LOG_TEST_NAME("test_setenv_getenv");
@@ -42,7 +42,7 @@ static void test_setenv_getenv(void) {
gpr_free(retrieved_value);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
test_setenv_getenv();
return 0;
diff --git a/test/core/support/histogram_test.c b/test/core/support/histogram_test.c
index 0ee5d5cdd1..86b7d599e6 100644
--- a/test/core/support/histogram_test.c
+++ b/test/core/support/histogram_test.c
@@ -25,7 +25,7 @@ static void test_no_op(void) {
gpr_histogram_destroy(gpr_histogram_create(0.01, 60e9));
}
-static void expect_percentile(gpr_histogram *h, double percentile,
+static void expect_percentile(gpr_histogram* h, double percentile,
double min_expect, double max_expect) {
double got = gpr_histogram_percentile(h, percentile);
gpr_log(GPR_INFO, "@%f%%, expect %f <= %f <= %f", percentile, min_expect, got,
@@ -35,7 +35,7 @@ static void expect_percentile(gpr_histogram *h, double percentile,
}
static void test_simple(void) {
- gpr_histogram *h;
+ gpr_histogram* h;
LOG_TEST("test_simple");
@@ -52,7 +52,7 @@ static void test_simple(void) {
}
static void test_percentile(void) {
- gpr_histogram *h;
+ gpr_histogram* h;
double last;
double i;
double cur;
diff --git a/test/core/support/host_port_test.c b/test/core/support/host_port_test.c
index 2ff3bcf68e..42dd56524f 100644
--- a/test/core/support/host_port_test.c
+++ b/test/core/support/host_port_test.c
@@ -23,9 +23,9 @@
#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
-static void join_host_port_expect(const char *host, int port,
- const char *expected) {
- char *buf;
+static void join_host_port_expect(const char* host, int port,
+ const char* expected) {
+ char* buf;
int len;
len = gpr_join_host_port(&buf, host, port);
GPR_ASSERT(len >= 0);
@@ -48,7 +48,7 @@ static void test_join_host_port_garbage(void) {
join_host_port_expect("::]", 107, "[::]]:107");
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
test_join_host_port();
diff --git a/test/core/support/log_test.c b/test/core/support/log_test.c
index c221ff6783..9602bbb090 100644
--- a/test/core/support/log_test.c
+++ b/test/core/support/log_test.c
@@ -26,17 +26,17 @@
static bool log_func_reached = false;
-static void test_callback(gpr_log_func_args *args) {
+static void test_callback(gpr_log_func_args* args) {
GPR_ASSERT(0 == strcmp(__FILE__, args->file));
GPR_ASSERT(args->severity == GPR_LOG_SEVERITY_INFO);
GPR_ASSERT(0 == strcmp(args->message, "hello 1 2 3"));
}
-static void test_should_log(gpr_log_func_args *args) {
+static void test_should_log(gpr_log_func_args* args) {
log_func_reached = true;
}
-static void test_should_not_log(gpr_log_func_args *args) { GPR_ASSERT(false); }
+static void test_should_not_log(gpr_log_func_args* args) { GPR_ASSERT(false); }
#define test_log_function_reached(SEVERITY) \
gpr_set_log_function(test_should_log); \
@@ -52,7 +52,7 @@ static void test_should_not_log(gpr_log_func_args *args) { GPR_ASSERT(false); }
gpr_log_message(SEVERITY, "hello 1 2 3"); \
gpr_log(SEVERITY, "hello %d %d %d", 1, 2, 3);
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
/* test logging at various verbosity levels */
gpr_log(GPR_DEBUG, "%s", "hello world");
diff --git a/test/core/support/mpscq_test.c b/test/core/support/mpscq_test.c
index 5e7dc9fca5..c71132bde9 100644
--- a/test/core/support/mpscq_test.c
+++ b/test/core/support/mpscq_test.c
@@ -30,11 +30,11 @@
typedef struct test_node {
gpr_mpscq_node node;
size_t i;
- size_t *ctr;
+ size_t* ctr;
} test_node;
-static test_node *new_node(size_t i, size_t *ctr) {
- test_node *n = gpr_malloc(sizeof(test_node));
+static test_node* new_node(size_t i, size_t* ctr) {
+ test_node* n = gpr_malloc(sizeof(test_node));
n->i = i;
n->ctr = ctr;
return n;
@@ -48,7 +48,7 @@ static void test_serial(void) {
gpr_mpscq_push(&q, &new_node(i, NULL)->node);
}
for (size_t i = 0; i < 10000000; i++) {
- test_node *n = (test_node *)gpr_mpscq_pop(&q);
+ test_node* n = (test_node*)gpr_mpscq_pop(&q);
GPR_ASSERT(n);
GPR_ASSERT(n->i == i);
gpr_free(n);
@@ -57,14 +57,14 @@ static void test_serial(void) {
typedef struct {
size_t ctr;
- gpr_mpscq *q;
- gpr_event *start;
+ gpr_mpscq* q;
+ gpr_event* start;
} thd_args;
#define THREAD_ITERATIONS 10000
-static void test_thread(void *args) {
- thd_args *a = args;
+static void test_thread(void* args) {
+ thd_args* a = args;
gpr_event_wait(a->start, gpr_inf_future(GPR_CLOCK_REALTIME));
for (size_t i = 1; i <= THREAD_ITERATIONS; i++) {
gpr_mpscq_push(a->q, &new_node(i, &a->ctr)->node);
@@ -89,13 +89,13 @@ static void test_mt(void) {
}
size_t num_done = 0;
size_t spins = 0;
- gpr_event_set(&start, (void *)1);
+ gpr_event_set(&start, (void*)1);
while (num_done != GPR_ARRAY_SIZE(thds)) {
- gpr_mpscq_node *n;
+ gpr_mpscq_node* n;
while ((n = gpr_mpscq_pop(&q)) == NULL) {
spins++;
}
- test_node *tn = (test_node *)n;
+ test_node* tn = (test_node*)n;
GPR_ASSERT(*tn->ctr == tn->i - 1);
*tn->ctr = tn->i;
if (tn->i == THREAD_ITERATIONS) num_done++;
@@ -109,17 +109,17 @@ static void test_mt(void) {
}
typedef struct {
- thd_args *ta;
+ thd_args* ta;
size_t num_thds;
gpr_mu mu;
size_t num_done;
size_t spins;
- gpr_mpscq *q;
- gpr_event *start;
+ gpr_mpscq* q;
+ gpr_event* start;
} pull_args;
-static void pull_thread(void *arg) {
- pull_args *pa = arg;
+static void pull_thread(void* arg) {
+ pull_args* pa = arg;
gpr_event_wait(pa->start, gpr_inf_future(GPR_CLOCK_REALTIME));
for (;;) {
@@ -128,11 +128,11 @@ static void pull_thread(void *arg) {
gpr_mu_unlock(&pa->mu);
return;
}
- gpr_mpscq_node *n;
+ gpr_mpscq_node* n;
while ((n = gpr_mpscq_pop(pa->q)) == NULL) {
pa->spins++;
}
- test_node *tn = (test_node *)n;
+ test_node* tn = (test_node*)n;
GPR_ASSERT(*tn->ctr == tn->i - 1);
*tn->ctr = tn->i;
if (tn->i == THREAD_ITERATIONS) pa->num_done++;
@@ -171,7 +171,7 @@ static void test_mt_multipop(void) {
gpr_thd_options_set_joinable(&options);
GPR_ASSERT(gpr_thd_new(&pull_thds[i], pull_thread, &pa, &options));
}
- gpr_event_set(&start, (void *)1);
+ gpr_event_set(&start, (void*)1);
for (size_t i = 0; i < GPR_ARRAY_SIZE(pull_thds); i++) {
gpr_thd_join(pull_thds[i]);
}
@@ -182,7 +182,7 @@ static void test_mt_multipop(void) {
gpr_mpscq_destroy(&q);
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
test_serial();
test_mt();
diff --git a/test/core/support/murmur_hash_test.c b/test/core/support/murmur_hash_test.c
index 5677515d04..461c728951 100644
--- a/test/core/support/murmur_hash_test.c
+++ b/test/core/support/murmur_hash_test.c
@@ -23,7 +23,7 @@
#include <string.h>
-typedef uint32_t (*hash_func)(const void *key, size_t len, uint32_t seed);
+typedef uint32_t (*hash_func)(const void* key, size_t len, uint32_t seed);
/* From smhasher:
This should hopefully be a thorough and uambiguous test of whether a hash
@@ -63,7 +63,7 @@ static void verification_test(hash_func hash, uint32_t expected) {
}
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
/* basic tests to verify that things don't crash */
gpr_murmur_hash3("", 0, 0);
diff --git a/test/core/support/spinlock_test.c b/test/core/support/spinlock_test.c
index b236a88ab7..185538ee93 100644
--- a/test/core/support/spinlock_test.c
+++ b/test/core/support/spinlock_test.c
@@ -32,7 +32,7 @@
/* Tests for gpr_spinlock. */
struct test {
int thread_count; /* number of threads */
- gpr_thd_id *threads;
+ gpr_thd_id* threads;
int64_t iterations; /* number of iterations per thread */
int64_t counter;
@@ -42,8 +42,8 @@ struct test {
};
/* Return pointer to a new struct test. */
-static struct test *test_new(int threads, int64_t iterations, int incr_step) {
- struct test *m = gpr_malloc(sizeof(*m));
+static struct test* test_new(int threads, int64_t iterations, int incr_step) {
+ struct test* m = gpr_malloc(sizeof(*m));
m->thread_count = threads;
m->threads = gpr_malloc(sizeof(*m->threads) * (size_t)threads);
m->iterations = iterations;
@@ -55,13 +55,13 @@ static struct test *test_new(int threads, int64_t iterations, int incr_step) {
}
/* Return pointer to a new struct test. */
-static void test_destroy(struct test *m) {
+static void test_destroy(struct test* m) {
gpr_free(m->threads);
gpr_free(m);
}
/* Create m->threads threads, each running (*body)(m) */
-static void test_create_threads(struct test *m, void (*body)(void *arg)) {
+static void test_create_threads(struct test* m, void (*body)(void* arg)) {
int i;
for (i = 0; i != m->thread_count; i++) {
gpr_thd_options opt = gpr_thd_options_default();
@@ -71,7 +71,7 @@ static void test_create_threads(struct test *m, void (*body)(void *arg)) {
}
/* Wait until all threads report done. */
-static void test_wait(struct test *m) {
+static void test_wait(struct test* m) {
int i;
for (i = 0; i != m->thread_count; i++) {
gpr_thd_join(m->threads[i]);
@@ -84,10 +84,10 @@ static void test_wait(struct test *m) {
incr_step controls by how much m->refcount should be incremented/decremented
(if at all) each time in the tests.
*/
-static void test(const char *name, void (*body)(void *m), int timeout_s,
+static void test(const char* name, void (*body)(void* m), int timeout_s,
int incr_step) {
int64_t iterations = 1024;
- struct test *m;
+ struct test* m;
gpr_timespec start = gpr_now(GPR_CLOCK_REALTIME);
gpr_timespec time_taken;
gpr_timespec deadline = gpr_time_add(
@@ -112,8 +112,8 @@ static void test(const char *name, void (*body)(void *m), int timeout_s,
}
/* Increment m->counter on each iteration; then mark thread as done. */
-static void inc(void *v /*=m*/) {
- struct test *m = v;
+static void inc(void* v /*=m*/) {
+ struct test* m = v;
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_spinlock_lock(&m->mu);
@@ -124,8 +124,8 @@ static void inc(void *v /*=m*/) {
/* Increment m->counter under lock acquired with trylock, m->iterations times;
then mark thread as done. */
-static void inctry(void *v /*=m*/) {
- struct test *m = v;
+static void inctry(void* v /*=m*/) {
+ struct test* m = v;
int64_t i;
for (i = 0; i != m->iterations;) {
if (gpr_spinlock_trylock(&m->mu)) {
@@ -138,7 +138,7 @@ static void inctry(void *v /*=m*/) {
/* ------------------------------------------------- */
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
grpc_test_init(argc, argv);
test("spinlock", &inc, 1, 1);
test("spinlock try", &inctry, 1, 1);
diff --git a/test/core/support/stack_lockfree_test.c b/test/core/support/stack_lockfree_test.c
index 4b1f60ce01..e6d0c9b795 100644
--- a/test/core/support/stack_lockfree_test.c
+++ b/test/core/support/stack_lockfree_test.c
@@ -32,7 +32,7 @@
#define MAX_THREADS 32
static void test_serial_sized(size_t size) {
- gpr_stack_lockfree *stack = gpr_stack_lockfree_create(size);
+ gpr_stack_lockfree* stack = gpr_stack_lockfree_create(size);
size_t i;
size_t j;
@@ -67,15 +67,15 @@ static void test_serial() {
}
struct test_arg {
- gpr_stack_lockfree *stack;
+ gpr_stack_lockfree* stack;
int stack_size;
int nthreads;
int rank;
int sum;
};
-static void test_mt_body(void *v) {
- struct test_arg *arg = (struct test_arg *)v;
+static void test_mt_body(void* v) {
+ struct test_arg* arg = (struct test_arg*)v;
int lo, hi;
int i;
int res;
@@ -93,7 +93,7 @@ static void test_mt_body(void *v) {
}
static void test_mt_sized(size_t size, int nth) {
- gpr_stack_lockfree *stack;
+ gpr_stack_lockfree* stack;
struct test_arg args[MAX_THREADS];
gpr_thd_id thds[MAX_THREADS];
int sum;
@@ -132,7 +132,7 @@ static void test_mt() {
}
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
test_serial();
test_mt();
diff --git a/test/core/support/string_test.c b/test/core/support/string_test.c
index bee2139477..4bae158a15 100644
--- a/test/core/support/string_test.c
+++ b/test/core/support/string_test.c
@@ -32,8 +32,8 @@
#define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x)
static void test_strdup(void) {
- static const char *src1 = "hello world";
- char *dst1;
+ static const char* src1 = "hello world";
+ char* dst1;
LOG_TEST_NAME("test_strdup");
@@ -44,9 +44,9 @@ static void test_strdup(void) {
GPR_ASSERT(NULL == gpr_strdup(NULL));
}
-static void expect_dump(const char *buf, size_t len, uint32_t flags,
- const char *result) {
- char *got = gpr_dump(buf, len, flags);
+static void expect_dump(const char* buf, size_t len, uint32_t flags,
+ const char* result) {
+ char* got = gpr_dump(buf, len, flags);
GPR_ASSERT(0 == strcmp(got, result));
gpr_free(got);
}
@@ -61,12 +61,12 @@ static void test_dump(void) {
expect_dump("ab", 2, GPR_DUMP_HEX | GPR_DUMP_ASCII, "61 62 'ab'");
}
-static void test_pu32_fail(const char *s) {
+static void test_pu32_fail(const char* s) {
uint32_t out;
GPR_ASSERT(!gpr_parse_bytes_to_uint32(s, strlen(s), &out));
}
-static void test_pu32_succeed(const char *s, uint32_t want) {
+static void test_pu32_succeed(const char* s, uint32_t want) {
uint32_t out;
GPR_ASSERT(gpr_parse_bytes_to_uint32(s, strlen(s), &out));
GPR_ASSERT(out == want);
@@ -107,7 +107,7 @@ static void test_parse_uint32(void) {
}
static void test_asprintf(void) {
- char *buf;
+ char* buf;
int i, j;
LOG_TEST_NAME("test_asprintf");
@@ -132,9 +132,9 @@ static void test_asprintf(void) {
}
static void test_strjoin(void) {
- const char *parts[4] = {"one", "two", "three", "four"};
+ const char* parts[4] = {"one", "two", "three", "four"};
size_t joined_len;
- char *joined;
+ char* joined;
LOG_TEST_NAME("test_strjoin");
@@ -152,9 +152,9 @@ static void test_strjoin(void) {
}
static void test_strjoin_sep(void) {
- const char *parts[4] = {"one", "two", "three", "four"};
+ const char* parts[4] = {"one", "two", "three", "four"};
size_t joined_len;
- char *joined;
+ char* joined;
LOG_TEST_NAME("test_strjoin_sep");
@@ -179,7 +179,7 @@ static void test_strjoin_sep(void) {
}
static void test_ltoa() {
- char *str;
+ char* str;
char buf[GPR_LTOA_MIN_BUFSIZE];
LOG_TEST_NAME("test_ltoa");
@@ -226,7 +226,7 @@ static void test_int64toa() {
}
static void test_leftpad() {
- char *padded;
+ char* padded;
LOG_TEST_NAME("test_leftpad");
@@ -274,9 +274,9 @@ static void test_memrchr(void) {
GPR_ASSERT(NULL == gpr_memrchr(NULL, 'a', 0));
GPR_ASSERT(NULL == gpr_memrchr("", 'a', 0));
GPR_ASSERT(NULL == gpr_memrchr("hello", 'b', 5));
- GPR_ASSERT(0 == strcmp((const char *)gpr_memrchr("hello", 'h', 5), "hello"));
- GPR_ASSERT(0 == strcmp((const char *)gpr_memrchr("hello", 'o', 5), "o"));
- GPR_ASSERT(0 == strcmp((const char *)gpr_memrchr("hello", 'l', 5), "lo"));
+ GPR_ASSERT(0 == strcmp((const char*)gpr_memrchr("hello", 'h', 5), "hello"));
+ GPR_ASSERT(0 == strcmp((const char*)gpr_memrchr("hello", 'o', 5), "o"));
+ GPR_ASSERT(0 == strcmp((const char*)gpr_memrchr("hello", 'l', 5), "lo"));
}
static void test_is_true(void) {
@@ -294,7 +294,7 @@ static void test_is_true(void) {
GPR_ASSERT(false == gpr_is_true("0"));
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
grpc_test_init(argc, argv);
test_strdup();
test_dump();
diff --git a/test/core/support/sync_test.c b/test/core/support/sync_test.c
index 178d77edcd..b4436f7bba 100644
--- a/test/core/support/sync_test.c
+++ b/test/core/support/sync_test.c
@@ -47,7 +47,7 @@ typedef struct queue {
} queue;
/* Initialize *q. */
-void queue_init(queue *q) {
+void queue_init(queue* q) {
gpr_mu_init(&q->mu);
gpr_cv_init(&q->non_empty);
gpr_cv_init(&q->non_full);
@@ -56,14 +56,14 @@ void queue_init(queue *q) {
}
/* Free storage associated with *q. */
-void queue_destroy(queue *q) {
+void queue_destroy(queue* q) {
gpr_mu_destroy(&q->mu);
gpr_cv_destroy(&q->non_empty);
gpr_cv_destroy(&q->non_full);
}
/* Wait until there is room in *q, then append x to *q. */
-void queue_append(queue *q, int x) {
+void queue_append(queue* q, int x) {
gpr_mu_lock(&q->mu);
/* To wait for a predicate without a deadline, loop on the negation of the
predicate, and use gpr_cv_wait(..., gpr_inf_future(GPR_CLOCK_REALTIME))
@@ -87,7 +87,7 @@ void queue_append(queue *q, int x) {
/* If it can be done without blocking, append x to *q and return non-zero.
Otherwise return 0. */
-int queue_try_append(queue *q, int x) {
+int queue_try_append(queue* q, int x) {
int result = 0;
if (gpr_mu_trylock(&q->mu)) {
if (q->length != N) {
@@ -106,7 +106,7 @@ int queue_try_append(queue *q, int x) {
/* Wait until the *q is non-empty or deadline abs_deadline passes. If the
queue is non-empty, remove its head entry, place it in *head, and return
non-zero. Otherwise return 0. */
-int queue_remove(queue *q, int *head, gpr_timespec abs_deadline) {
+int queue_remove(queue* q, int* head, gpr_timespec abs_deadline) {
int result = 0;
gpr_mu_lock(&q->mu);
/* To wait for a predicate with a deadline, loop on the negation of the
@@ -156,8 +156,8 @@ struct test {
};
/* Return pointer to a new struct test. */
-static struct test *test_new(int threads, int64_t iterations, int incr_step) {
- struct test *m = gpr_malloc(sizeof(*m));
+static struct test* test_new(int threads, int64_t iterations, int incr_step) {
+ struct test* m = gpr_malloc(sizeof(*m));
m->threads = threads;
m->iterations = iterations;
m->counter = 0;
@@ -176,7 +176,7 @@ static struct test *test_new(int threads, int64_t iterations, int incr_step) {
}
/* Return pointer to a new struct test. */
-static void test_destroy(struct test *m) {
+static void test_destroy(struct test* m) {
gpr_mu_destroy(&m->mu);
gpr_cv_destroy(&m->cv);
gpr_cv_destroy(&m->done_cv);
@@ -185,7 +185,7 @@ static void test_destroy(struct test *m) {
}
/* Create m->threads threads, each running (*body)(m) */
-static void test_create_threads(struct test *m, void (*body)(void *arg)) {
+static void test_create_threads(struct test* m, void (*body)(void* arg)) {
gpr_thd_id id;
int i;
for (i = 0; i != m->threads; i++) {
@@ -194,7 +194,7 @@ static void test_create_threads(struct test *m, void (*body)(void *arg)) {
}
/* Wait until all threads report done. */
-static void test_wait(struct test *m) {
+static void test_wait(struct test* m) {
gpr_mu_lock(&m->mu);
while (m->done != 0) {
gpr_cv_wait(&m->done_cv, &m->mu, gpr_inf_future(GPR_CLOCK_REALTIME));
@@ -203,7 +203,7 @@ static void test_wait(struct test *m) {
}
/* Get an integer thread id in the raneg 0..threads-1 */
-static int thread_id(struct test *m) {
+static int thread_id(struct test* m) {
int id;
gpr_mu_lock(&m->mu);
id = m->thread_count++;
@@ -213,7 +213,7 @@ static int thread_id(struct test *m) {
/* Indicate that a thread is done, by decrementing m->done
and signalling done_cv if m->done==0. */
-static void mark_thread_done(struct test *m) {
+static void mark_thread_done(struct test* m) {
gpr_mu_lock(&m->mu);
GPR_ASSERT(m->done != 0);
m->done--;
@@ -229,10 +229,10 @@ static void mark_thread_done(struct test *m) {
incr_step controls by how much m->refcount should be incremented/decremented
(if at all) each time in the tests.
*/
-static void test(const char *name, void (*body)(void *m),
- void (*extra)(void *m), int timeout_s, int incr_step) {
+static void test(const char* name, void (*body)(void* m),
+ void (*extra)(void* m), int timeout_s, int incr_step) {
int64_t iterations = 1024;
- struct test *m;
+ struct test* m;
gpr_timespec start = gpr_now(GPR_CLOCK_REALTIME);
gpr_timespec time_taken;
gpr_timespec deadline = gpr_time_add(
@@ -262,8 +262,8 @@ static void test(const char *name, void (*body)(void *m),
}
/* Increment m->counter on each iteration; then mark thread as done. */
-static void inc(void *v /*=m*/) {
- struct test *m = v;
+static void inc(void* v /*=m*/) {
+ struct test* m = v;
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_mu_lock(&m->mu);
@@ -275,8 +275,8 @@ static void inc(void *v /*=m*/) {
/* Increment m->counter under lock acquired with trylock, m->iterations times;
then mark thread as done. */
-static void inctry(void *v /*=m*/) {
- struct test *m = v;
+static void inctry(void* v /*=m*/) {
+ struct test* m = v;
int64_t i;
for (i = 0; i != m->iterations;) {
if (gpr_mu_trylock(&m->mu)) {
@@ -290,8 +290,8 @@ static void inctry(void *v /*=m*/) {
/* Increment counter only when (m->counter%m->threads)==m->thread_id; then mark
thread as done. */
-static void inc_by_turns(void *v /*=m*/) {
- struct test *m = v;
+static void inc_by_turns(void* v /*=m*/) {
+ struct test* m = v;
int64_t i;
int id = thread_id(m);
for (i = 0; i != m->iterations; i++) {
@@ -308,8 +308,8 @@ static void inc_by_turns(void *v /*=m*/) {
/* Wait a millisecond and increment counter on each iteration;
then mark thread as done. */
-static void inc_with_1ms_delay(void *v /*=m*/) {
- struct test *m = v;
+static void inc_with_1ms_delay(void* v /*=m*/) {
+ struct test* m = v;
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_timespec deadline;
@@ -326,8 +326,8 @@ static void inc_with_1ms_delay(void *v /*=m*/) {
/* Wait a millisecond and increment counter on each iteration, using an event
for timing; then mark thread as done. */
-static void inc_with_1ms_delay_event(void *v /*=m*/) {
- struct test *m = v;
+static void inc_with_1ms_delay_event(void* v /*=m*/) {
+ struct test* m = v;
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_timespec deadline;
@@ -344,8 +344,8 @@ static void inc_with_1ms_delay_event(void *v /*=m*/) {
/* Produce m->iterations elements on queue m->q, then mark thread as done.
Even threads use queue_append(), and odd threads use queue_try_append()
until it succeeds. */
-static void many_producers(void *v /*=m*/) {
- struct test *m = v;
+static void many_producers(void* v /*=m*/) {
+ struct test* m = v;
int64_t i;
int x = thread_id(m);
if ((x & 1) == 0) {
@@ -364,8 +364,8 @@ static void many_producers(void *v /*=m*/) {
/* Consume elements from m->q until m->threads*m->iterations are seen,
wait an extra second to confirm that no more elements are arriving,
then mark thread as done. */
-static void consumer(void *v /*=m*/) {
- struct test *m = v;
+static void consumer(void* v /*=m*/) {
+ struct test* m = v;
int64_t n = m->iterations * m->threads;
int64_t i;
int value;
@@ -384,8 +384,8 @@ static void consumer(void *v /*=m*/) {
/* Increment m->stats_counter m->iterations times, transfer counter value to
m->counter, then mark thread as done. */
-static void statsinc(void *v /*=m*/) {
- struct test *m = v;
+static void statsinc(void* v /*=m*/) {
+ struct test* m = v;
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_stats_inc(&m->stats_counter, 1);
@@ -399,8 +399,8 @@ static void statsinc(void *v /*=m*/) {
/* Increment m->refcount by m->incr_step for m->iterations times. Decrement
m->thread_refcount once, and if it reaches zero, set m->event to (void*)1;
then mark thread as done. */
-static void refinc(void *v /*=m*/) {
- struct test *m = v;
+static void refinc(void* v /*=m*/) {
+ struct test* m = v;
int64_t i;
for (i = 0; i != m->iterations; i++) {
if (m->incr_step == 1) {
@@ -410,7 +410,7 @@ static void refinc(void *v /*=m*/) {
}
}
if (gpr_unref(&m->thread_refcount)) {
- gpr_event_set(&m->event, (void *)1);
+ gpr_event_set(&m->event, (void*)1);
}
mark_thread_done(m);
}
@@ -418,13 +418,13 @@ static void refinc(void *v /*=m*/) {
/* Wait until m->event is set to (void *)1, then decrement m->refcount by 1
(m->threads * m->iterations * m->incr_step) times, and ensure that the last
decrement caused the counter to reach zero, then mark thread as done. */
-static void refcheck(void *v /*=m*/) {
- struct test *m = v;
+static void refcheck(void* v /*=m*/) {
+ struct test* m = v;
int64_t n = m->iterations * m->threads * m->incr_step;
int64_t i;
GPR_ASSERT(gpr_event_wait(&m->event, gpr_inf_future(GPR_CLOCK_REALTIME)) ==
- (void *)1);
- GPR_ASSERT(gpr_event_get(&m->event) == (void *)1);
+ (void*)1);
+ GPR_ASSERT(gpr_event_get(&m->event) == (void*)1);
for (i = 1; i != n; i++) {
GPR_ASSERT(!gpr_unref(&m->refcount));
m->counter++;
@@ -436,7 +436,7 @@ static void refcheck(void *v /*=m*/) {
/* ------------------------------------------------- */
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
grpc_test_init(argc, argv);
test("mutex", &inc, NULL, 1, 1);
test("mutex try", &inctry, NULL, 1, 1);
diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c
index 2c578a242c..4fd0051776 100644
--- a/test/core/support/thd_test.c
+++ b/test/core/support/thd_test.c
@@ -36,8 +36,8 @@ struct test {
};
/* A Thread body. Decrement t->n, and if is becomes zero, set t->done. */
-static void thd_body(void *v) {
- struct test *t = v;
+static void thd_body(void* v) {
+ struct test* t = v;
gpr_mu_lock(&t->mu);
t->n--;
if (t->n == 0) {
@@ -47,7 +47,7 @@ static void thd_body(void *v) {
gpr_mu_unlock(&t->mu);
}
-static void thd_body_joinable(void *v) {}
+static void thd_body_joinable(void* v) {}
/* Test thread options work as expected */
static void test_options(void) {
@@ -93,7 +93,7 @@ static void test(void) {
/* ------------------------------------------------- */
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
grpc_test_init(argc, argv);
test_options();
test();
diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c
index 74b5ef6114..608169274f 100644
--- a/test/core/support/time_test.c
+++ b/test/core/support/time_test.c
@@ -28,15 +28,15 @@
#include <string.h>
#include "test/core/util/test_config.h"
-static void to_fp(void *arg, const char *buf, size_t len) {
- fwrite(buf, 1, len, (FILE *)arg);
+static void to_fp(void* arg, const char* buf, size_t len) {
+ fwrite(buf, 1, len, (FILE*)arg);
}
/* Convert gpr_intmax x to ascii base b (2..16), and write with
(*writer)(arg, ...), zero padding to "chars" digits). */
static void i_to_s(intmax_t x, int base, int chars,
- void (*writer)(void *arg, const char *buf, size_t len),
- void *arg) {
+ void (*writer)(void* arg, const char* buf, size_t len),
+ void* arg) {
char buf[64];
char fmt[32];
GPR_ASSERT(base == 16 || base == 10);
@@ -47,8 +47,8 @@ static void i_to_s(intmax_t x, int base, int chars,
/* Convert ts to ascii, and write with (*writer)(arg, ...). */
static void ts_to_s(gpr_timespec t,
- void (*writer)(void *arg, const char *buf, size_t len),
- void *arg) {
+ void (*writer)(void* arg, const char* buf, size_t len),
+ void* arg) {
if (t.tv_sec < 0 && t.tv_nsec != 0) {
t.tv_sec++;
t.tv_nsec = GPR_NS_PER_SEC - t.tv_nsec;
@@ -241,7 +241,7 @@ static void test_cmp_extreme(void) {
GPR_ASSERT(gpr_time_cmp(t1, t2) == 0);
}
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
grpc_test_init(argc, argv);
test_values();
diff --git a/test/core/support/tls_test.c b/test/core/support/tls_test.c
index 5529d5cf59..b1b4737432 100644
--- a/test/core/support/tls_test.c
+++ b/test/core/support/tls_test.c
@@ -30,7 +30,7 @@
GPR_TLS_DECL(test_var);
-static void thd_body(void *arg) {
+static void thd_body(void* arg) {
intptr_t i;
GPR_ASSERT(gpr_tls_get(&test_var) == 0);
@@ -44,7 +44,7 @@ static void thd_body(void *arg) {
/* ------------------------------------------------- */
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
gpr_thd_options opt = gpr_thd_options_default();
int i;
gpr_thd_id threads[NUM_THREADS];
diff --git a/test/core/support/useful_test.c b/test/core/support/useful_test.c
index 2f84f485fc..2f86010d77 100644
--- a/test/core/support/useful_test.c
+++ b/test/core/support/useful_test.c
@@ -21,7 +21,7 @@
#include <grpc/support/useful.h>
#include "test/core/util/test_config.h"
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
int four[4];
int five[5];
uint32_t bitset = 0;