aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Julien Boeuf <jboeuf@google.com>2016-01-28 15:45:08 -0800
committerGravatar Julien Boeuf <jboeuf@google.com>2016-01-28 15:45:08 -0800
commit54cc08c216ea23a85e122ef19a30ffe3399255e9 (patch)
treea923c2e552c2827bd7491b19ff63443e7c2fdcef /test/core
parenta50da4757ae7eb75b67d78b7e82fba79d2c987da (diff)
parent822602cff0f3b1f8373ac06a8ab8fe9792b1037e (diff)
Merge branch 'master' of github.com:grpc/grpc into ssl_credentials_override_default_roots
Diffstat (limited to 'test/core')
-rw-r--r--test/core/support/alloc_test.c6
-rw-r--r--test/core/transport/chttp2/hpack_table_test.c6
-rw-r--r--test/core/util/port_posix.c5
3 files changed, 10 insertions, 7 deletions
diff --git a/test/core/support/alloc_test.c b/test/core/support/alloc_test.c
index a7051a46a1..6bdba8c390 100644
--- a/test/core/support/alloc_test.c
+++ b/test/core/support/alloc_test.c
@@ -39,7 +39,9 @@ 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_free(void *addr) { *((intptr_t *)addr) = 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();
@@ -52,7 +54,7 @@ static void test_custom_allocs() {
GPR_ASSERT((void *)(size_t)0xcafed00d == gpr_realloc(0, 0xcafed00d));
gpr_free(&addr_to_free);
- GPR_ASSERT(addr_to_free == 0xdeadd00d);
+ 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);
diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c
index 39f4174eec..3c5f2e4e31 100644
--- a/test/core/transport/chttp2/hpack_table_test.c
+++ b/test/core/transport/chttp2/hpack_table_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -236,7 +236,7 @@ static void test_find(void) {
/* overflow the string buffer, check find still works */
for (i = 0; i < 10000; i++) {
- gpr_ltoa(i, buffer);
+ int64_ttoa(i, buffer);
elem = grpc_mdelem_from_strings("test", buffer);
GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem));
GRPC_MDELEM_UNREF(elem);
@@ -256,7 +256,7 @@ static void test_find(void) {
for (i = 0; i < tbl.num_ents; i++) {
uint32_t expect = 9999 - i;
- gpr_ltoa(expect, buffer);
+ int64_ttoa(expect, buffer);
r = find_simple(&tbl, "test", buffer);
GPR_ASSERT(r.index == i + 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY);
diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c
index 732a51c5cb..11cefbf01c 100644
--- a/test/core/util/port_posix.c
+++ b/test/core/util/port_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@
#include "test/core/util/port.h"
+#include <math.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <stdio.h>
@@ -229,10 +230,10 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
grpc_httpcli_request req;
memset(&req, 0, sizeof(req));
GPR_ASSERT(pr->retries < 10);
+ sleep(1 + (unsigned)(pow(1.3, pr->retries) * rand() / RAND_MAX));
pr->retries++;
req.host = pr->server;
req.path = "/get";
- sleep(1);
grpc_httpcli_get(exec_ctx, pr->ctx, &pr->pollset, &req,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server,
pr);