aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
Diffstat (limited to 'test/core')
-rwxr-xr-xtest/core/bad_ssl/gen_build_yaml.py4
-rw-r--r--test/core/bad_ssl/server_common.c (renamed from test/core/bad_ssl/server.c)4
-rw-r--r--test/core/bad_ssl/server_common.h (renamed from test/core/bad_ssl/server.h)2
-rw-r--r--test/core/bad_ssl/servers/alpn.c4
-rw-r--r--test/core/bad_ssl/servers/cert.c6
-rw-r--r--test/core/end2end/end2end_nosec_tests.c36
-rw-r--r--test/core/end2end/end2end_tests.c36
-rw-r--r--test/core/end2end/fixtures/h2_ssl+poll.c2
-rw-r--r--test/core/end2end/fixtures/h2_ssl.c15
-rw-r--r--test/core/end2end/fixtures/h2_ssl_proxy.c13
-rw-r--r--test/core/end2end/fixtures/h2_uchannel.c24
-rwxr-xr-xtest/core/end2end/gen_build_yaml.py6
-rw-r--r--test/core/end2end/tests/connectivity.c (renamed from test/core/end2end/tests/channel_connectivity.c)4
-rw-r--r--test/core/end2end/tests/ping.c (renamed from test/core/end2end/tests/channel_ping.c)4
-rw-r--r--test/core/end2end/tests/simple_metadata.c (renamed from test/core/end2end/tests/metadata.c)4
-rw-r--r--test/core/httpcli/httpcli_test.c24
-rw-r--r--test/core/httpcli/httpscli_test.c23
-rw-r--r--test/core/iomgr/endpoint_pair_test.c6
-rw-r--r--test/core/iomgr/fd_posix_test.c56
-rw-r--r--test/core/iomgr/tcp_client_posix_test.c58
-rw-r--r--test/core/iomgr/tcp_posix_test.c56
-rw-r--r--test/core/iomgr/tcp_server_posix_test.c16
-rw-r--r--test/core/iomgr/workqueue_test.c16
-rw-r--r--test/core/security/b64_test.c (renamed from test/core/security/base64_test.c)4
-rw-r--r--test/core/security/create_jwt.c2
-rw-r--r--test/core/security/credentials_test.c17
-rw-r--r--test/core/security/fetch_oauth2.c4
-rw-r--r--test/core/security/json_token_test.c7
-rw-r--r--test/core/security/jwt_verifier_test.c2
-rw-r--r--test/core/security/oauth2_utils.c10
-rw-r--r--test/core/security/print_google_default_creds_token.c20
-rw-r--r--test/core/security/secure_endpoint_test.c6
-rw-r--r--test/core/security/security_connector_test.c15
-rw-r--r--test/core/security/verify_jwt.c16
-rw-r--r--test/core/support/load_file_test.c (renamed from test/core/support/file_test.c)5
-rw-r--r--test/core/util/port_posix.c25
-rw-r--r--test/core/util/port_windows.c27
-rw-r--r--test/core/util/test_tcp_server.c6
-rw-r--r--test/core/util/test_tcp_server.h2
39 files changed, 283 insertions, 304 deletions
diff --git a/test/core/bad_ssl/gen_build_yaml.py b/test/core/bad_ssl/gen_build_yaml.py
index cc097a8fdf..e2a3febe5d 100755
--- a/test/core/bad_ssl/gen_build_yaml.py
+++ b/test/core/bad_ssl/gen_build_yaml.py
@@ -52,8 +52,8 @@ def main():
'name': 'bad_ssl_test_server',
'build': 'private',
'language': 'c',
- 'src': ['test/core/bad_ssl/server.c'],
- 'headers': ['test/core/bad_ssl/server.h'],
+ 'src': ['test/core/bad_ssl/server_common.c'],
+ 'headers': ['test/core/bad_ssl/server_common.h'],
'vs_proj_dir': 'test',
'platforms': ['linux', 'posix', 'mac'],
'deps': [
diff --git a/test/core/bad_ssl/server.c b/test/core/bad_ssl/server_common.c
index 6113d364c9..cde844a552 100644
--- a/test/core/bad_ssl/server.c
+++ b/test/core/bad_ssl/server_common.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
@@ -35,7 +35,7 @@
#include <grpc/support/log.h>
#include <signal.h>
-#include "test/core/bad_ssl/server.h"
+#include "test/core/bad_ssl/server_common.h"
#include "test/core/util/test_config.h"
/* Common server implementation details for all servers in servers/.
diff --git a/test/core/bad_ssl/server.h b/test/core/bad_ssl/server_common.h
index 8ec7755503..2566c25905 100644
--- a/test/core/bad_ssl/server.h
+++ b/test/core/bad_ssl/server_common.h
@@ -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
diff --git a/test/core/bad_ssl/servers/alpn.c b/test/core/bad_ssl/servers/alpn.c
index 7d70690e52..c8cc83b134 100644
--- a/test/core/bad_ssl/servers/alpn.c
+++ b/test/core/bad_ssl/servers/alpn.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
@@ -39,7 +39,7 @@
#include <grpc/support/useful.h>
#include "src/core/transport/chttp2/alpn.h"
-#include "test/core/bad_ssl/server.h"
+#include "test/core/bad_ssl/server_common.h"
#include "test/core/end2end/data/ssl_test_data.h"
/* This test starts a server that is configured to advertise (via alpn and npn)
diff --git a/test/core/bad_ssl/servers/cert.c b/test/core/bad_ssl/servers/cert.c
index d67a6ca1d4..4edef50b67 100644
--- a/test/core/bad_ssl/servers/cert.c
+++ b/test/core/bad_ssl/servers/cert.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
@@ -38,9 +38,9 @@
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
-#include "src/core/support/file.h"
+#include "src/core/support/load_file.h"
-#include "test/core/bad_ssl/server.h"
+#include "test/core/bad_ssl/server_common.h"
#include "test/core/end2end/data/ssl_test_data.h"
/* This server will present an untrusted cert to the connecting client,
diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c
index 9ff46d62e4..17dc190d14 100644
--- a/test/core/end2end/end2end_nosec_tests.c
+++ b/test/core/end2end/end2end_nosec_tests.c
@@ -46,9 +46,8 @@ extern void cancel_after_invoke(grpc_end2end_test_config config);
extern void cancel_before_invoke(grpc_end2end_test_config config);
extern void cancel_in_a_vacuum(grpc_end2end_test_config config);
extern void cancel_with_status(grpc_end2end_test_config config);
-extern void channel_connectivity(grpc_end2end_test_config config);
-extern void channel_ping(grpc_end2end_test_config config);
extern void compressed_payload(grpc_end2end_test_config config);
+extern void connectivity(grpc_end2end_test_config config);
extern void default_host(grpc_end2end_test_config config);
extern void disappearing_server(grpc_end2end_test_config config);
extern void empty_batch(grpc_end2end_test_config config);
@@ -59,10 +58,10 @@ extern void invoke_large_request(grpc_end2end_test_config config);
extern void large_metadata(grpc_end2end_test_config config);
extern void max_concurrent_streams(grpc_end2end_test_config config);
extern void max_message_length(grpc_end2end_test_config config);
-extern void metadata(grpc_end2end_test_config config);
extern void negative_deadline(grpc_end2end_test_config config);
extern void no_op(grpc_end2end_test_config config);
extern void payload(grpc_end2end_test_config config);
+extern void ping(grpc_end2end_test_config config);
extern void ping_pong_streaming(grpc_end2end_test_config config);
extern void registered_call(grpc_end2end_test_config config);
extern void request_with_flags(grpc_end2end_test_config config);
@@ -71,6 +70,7 @@ extern void server_finishes_request(grpc_end2end_test_config config);
extern void shutdown_finishes_calls(grpc_end2end_test_config config);
extern void shutdown_finishes_tags(grpc_end2end_test_config config);
extern void simple_delayed_request(grpc_end2end_test_config config);
+extern void simple_metadata(grpc_end2end_test_config config);
extern void simple_request(grpc_end2end_test_config config);
extern void trailing_metadata(grpc_end2end_test_config config);
@@ -87,9 +87,8 @@ void grpc_end2end_tests(int argc, char **argv,
cancel_before_invoke(config);
cancel_in_a_vacuum(config);
cancel_with_status(config);
- channel_connectivity(config);
- channel_ping(config);
compressed_payload(config);
+ connectivity(config);
default_host(config);
disappearing_server(config);
empty_batch(config);
@@ -100,10 +99,10 @@ void grpc_end2end_tests(int argc, char **argv,
large_metadata(config);
max_concurrent_streams(config);
max_message_length(config);
- metadata(config);
negative_deadline(config);
no_op(config);
payload(config);
+ ping(config);
ping_pong_streaming(config);
registered_call(config);
request_with_flags(config);
@@ -112,6 +111,7 @@ void grpc_end2end_tests(int argc, char **argv,
shutdown_finishes_calls(config);
shutdown_finishes_tags(config);
simple_delayed_request(config);
+ simple_metadata(config);
simple_request(config);
trailing_metadata(config);
return;
@@ -150,18 +150,14 @@ void grpc_end2end_tests(int argc, char **argv,
cancel_with_status(config);
continue;
}
- if (0 == strcmp("channel_connectivity", argv[i])) {
- channel_connectivity(config);
- continue;
- }
- if (0 == strcmp("channel_ping", argv[i])) {
- channel_ping(config);
- continue;
- }
if (0 == strcmp("compressed_payload", argv[i])) {
compressed_payload(config);
continue;
}
+ if (0 == strcmp("connectivity", argv[i])) {
+ connectivity(config);
+ continue;
+ }
if (0 == strcmp("default_host", argv[i])) {
default_host(config);
continue;
@@ -202,10 +198,6 @@ void grpc_end2end_tests(int argc, char **argv,
max_message_length(config);
continue;
}
- if (0 == strcmp("metadata", argv[i])) {
- metadata(config);
- continue;
- }
if (0 == strcmp("negative_deadline", argv[i])) {
negative_deadline(config);
continue;
@@ -218,6 +210,10 @@ void grpc_end2end_tests(int argc, char **argv,
payload(config);
continue;
}
+ if (0 == strcmp("ping", argv[i])) {
+ ping(config);
+ continue;
+ }
if (0 == strcmp("ping_pong_streaming", argv[i])) {
ping_pong_streaming(config);
continue;
@@ -250,6 +246,10 @@ void grpc_end2end_tests(int argc, char **argv,
simple_delayed_request(config);
continue;
}
+ if (0 == strcmp("simple_metadata", argv[i])) {
+ simple_metadata(config);
+ continue;
+ }
if (0 == strcmp("simple_request", argv[i])) {
simple_request(config);
continue;
diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c
index 397ff446a9..6f2f5aff78 100644
--- a/test/core/end2end/end2end_tests.c
+++ b/test/core/end2end/end2end_tests.c
@@ -47,9 +47,8 @@ extern void cancel_after_invoke(grpc_end2end_test_config config);
extern void cancel_before_invoke(grpc_end2end_test_config config);
extern void cancel_in_a_vacuum(grpc_end2end_test_config config);
extern void cancel_with_status(grpc_end2end_test_config config);
-extern void channel_connectivity(grpc_end2end_test_config config);
-extern void channel_ping(grpc_end2end_test_config config);
extern void compressed_payload(grpc_end2end_test_config config);
+extern void connectivity(grpc_end2end_test_config config);
extern void default_host(grpc_end2end_test_config config);
extern void disappearing_server(grpc_end2end_test_config config);
extern void empty_batch(grpc_end2end_test_config config);
@@ -60,10 +59,10 @@ extern void invoke_large_request(grpc_end2end_test_config config);
extern void large_metadata(grpc_end2end_test_config config);
extern void max_concurrent_streams(grpc_end2end_test_config config);
extern void max_message_length(grpc_end2end_test_config config);
-extern void metadata(grpc_end2end_test_config config);
extern void negative_deadline(grpc_end2end_test_config config);
extern void no_op(grpc_end2end_test_config config);
extern void payload(grpc_end2end_test_config config);
+extern void ping(grpc_end2end_test_config config);
extern void ping_pong_streaming(grpc_end2end_test_config config);
extern void registered_call(grpc_end2end_test_config config);
extern void request_with_flags(grpc_end2end_test_config config);
@@ -72,6 +71,7 @@ extern void server_finishes_request(grpc_end2end_test_config config);
extern void shutdown_finishes_calls(grpc_end2end_test_config config);
extern void shutdown_finishes_tags(grpc_end2end_test_config config);
extern void simple_delayed_request(grpc_end2end_test_config config);
+extern void simple_metadata(grpc_end2end_test_config config);
extern void simple_request(grpc_end2end_test_config config);
extern void trailing_metadata(grpc_end2end_test_config config);
@@ -89,9 +89,8 @@ void grpc_end2end_tests(int argc, char **argv,
cancel_before_invoke(config);
cancel_in_a_vacuum(config);
cancel_with_status(config);
- channel_connectivity(config);
- channel_ping(config);
compressed_payload(config);
+ connectivity(config);
default_host(config);
disappearing_server(config);
empty_batch(config);
@@ -102,10 +101,10 @@ void grpc_end2end_tests(int argc, char **argv,
large_metadata(config);
max_concurrent_streams(config);
max_message_length(config);
- metadata(config);
negative_deadline(config);
no_op(config);
payload(config);
+ ping(config);
ping_pong_streaming(config);
registered_call(config);
request_with_flags(config);
@@ -114,6 +113,7 @@ void grpc_end2end_tests(int argc, char **argv,
shutdown_finishes_calls(config);
shutdown_finishes_tags(config);
simple_delayed_request(config);
+ simple_metadata(config);
simple_request(config);
trailing_metadata(config);
return;
@@ -156,18 +156,14 @@ void grpc_end2end_tests(int argc, char **argv,
cancel_with_status(config);
continue;
}
- if (0 == strcmp("channel_connectivity", argv[i])) {
- channel_connectivity(config);
- continue;
- }
- if (0 == strcmp("channel_ping", argv[i])) {
- channel_ping(config);
- continue;
- }
if (0 == strcmp("compressed_payload", argv[i])) {
compressed_payload(config);
continue;
}
+ if (0 == strcmp("connectivity", argv[i])) {
+ connectivity(config);
+ continue;
+ }
if (0 == strcmp("default_host", argv[i])) {
default_host(config);
continue;
@@ -208,10 +204,6 @@ void grpc_end2end_tests(int argc, char **argv,
max_message_length(config);
continue;
}
- if (0 == strcmp("metadata", argv[i])) {
- metadata(config);
- continue;
- }
if (0 == strcmp("negative_deadline", argv[i])) {
negative_deadline(config);
continue;
@@ -224,6 +216,10 @@ void grpc_end2end_tests(int argc, char **argv,
payload(config);
continue;
}
+ if (0 == strcmp("ping", argv[i])) {
+ ping(config);
+ continue;
+ }
if (0 == strcmp("ping_pong_streaming", argv[i])) {
ping_pong_streaming(config);
continue;
@@ -256,6 +252,10 @@ void grpc_end2end_tests(int argc, char **argv,
simple_delayed_request(config);
continue;
}
+ if (0 == strcmp("simple_metadata", argv[i])) {
+ simple_metadata(config);
+ continue;
+ }
if (0 == strcmp("simple_request", argv[i])) {
simple_request(config);
continue;
diff --git a/test/core/end2end/fixtures/h2_ssl+poll.c b/test/core/end2end/fixtures/h2_ssl+poll.c
index 9138b84376..66268c77d5 100644
--- a/test/core/end2end/fixtures/h2_ssl+poll.c
+++ b/test/core/end2end/fixtures/h2_ssl+poll.c
@@ -44,7 +44,7 @@
#include "src/core/iomgr/pollset_posix.h"
#include "src/core/security/credentials.h"
#include "src/core/support/env.h"
-#include "src/core/support/file.h"
+#include "src/core/support/tmpfile.h"
#include "src/core/support/string.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c
index 5c63dfb6aa..e21a3477df 100644
--- a/test/core/end2end/fixtures/h2_ssl.c
+++ b/test/core/end2end/fixtures/h2_ssl.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
@@ -36,17 +36,18 @@
#include <stdio.h>
#include <string.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/host_port.h>
+#include <grpc/support/log.h>
+
#include "src/core/channel/channel_args.h"
#include "src/core/security/credentials.h"
#include "src/core/support/env.h"
-#include "src/core/support/file.h"
+#include "src/core/support/tmpfile.h"
#include "src/core/support/string.h"
-#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
-#include <grpc/support/log.h>
-#include "test/core/util/test_config.h"
-#include "test/core/util/port.h"
#include "test/core/end2end/data/ssl_test_data.h"
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
typedef struct fullstack_secure_fixture_data {
char *localaddr;
diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c
index a93bd83a1f..6340d3f403 100644
--- a/test/core/end2end/fixtures/h2_ssl_proxy.c
+++ b/test/core/end2end/fixtures/h2_ssl_proxy.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
@@ -36,18 +36,19 @@
#include <stdio.h>
#include <string.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/host_port.h>
+#include <grpc/support/log.h>
+
#include "src/core/channel/channel_args.h"
#include "src/core/security/credentials.h"
#include "src/core/support/env.h"
-#include "src/core/support/file.h"
+#include "src/core/support/tmpfile.h"
#include "src/core/support/string.h"
-#include <grpc/support/alloc.h>
-#include <grpc/support/host_port.h>
-#include <grpc/support/log.h>
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/end2end/fixtures/proxy.h"
-#include "test/core/util/test_config.h"
#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
typedef struct fullstack_secure_fixture_data {
grpc_end2end_proxy *proxy;
diff --git a/test/core/end2end/fixtures/h2_uchannel.c b/test/core/end2end/fixtures/h2_uchannel.c
index f363b60cba..87bbd64d09 100644
--- a/test/core/end2end/fixtures/h2_uchannel.c
+++ b/test/core/end2end/fixtures/h2_uchannel.c
@@ -238,12 +238,12 @@ static grpc_end2end_test_fixture chttp2_create_fixture_micro_fullstack(
}
grpc_connectivity_state g_state = GRPC_CHANNEL_IDLE;
-grpc_pollset_set g_interested_parties;
+grpc_pollset_set *g_interested_parties;
static void state_changed(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
if (g_state != GRPC_CHANNEL_READY) {
grpc_subchannel_notify_on_state_change(
- exec_ctx, arg, &g_interested_parties, &g_state,
+ exec_ctx, arg, g_interested_parties, &g_state,
grpc_closure_create(state_changed, arg));
}
}
@@ -253,33 +253,31 @@ static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
}
static grpc_connected_subchannel *connect_subchannel(grpc_subchannel *c) {
- gpr_mu mu;
- gpr_mu_init(&mu);
+ gpr_mu *mu;
grpc_pollset *pollset = gpr_malloc(grpc_pollset_size());
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_init(pollset, &mu);
- grpc_pollset_set_init(&g_interested_parties);
- grpc_pollset_set_add_pollset(&exec_ctx, &g_interested_parties, pollset);
- grpc_subchannel_notify_on_state_change(&exec_ctx, c, &g_interested_parties,
+ g_interested_parties = grpc_pollset_set_create();
+ grpc_pollset_set_add_pollset(&exec_ctx, g_interested_parties, pollset);
+ grpc_subchannel_notify_on_state_change(&exec_ctx, c, g_interested_parties,
&g_state,
grpc_closure_create(state_changed, c));
grpc_exec_ctx_flush(&exec_ctx);
- gpr_mu_lock(&mu);
+ gpr_mu_lock(mu);
while (g_state != GRPC_CHANNEL_READY) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1));
- gpr_mu_unlock(&mu);
+ gpr_mu_unlock(mu);
grpc_exec_ctx_flush(&exec_ctx);
- gpr_mu_lock(&mu);
+ gpr_mu_lock(mu);
}
grpc_pollset_shutdown(&exec_ctx, pollset,
grpc_closure_create(destroy_pollset, pollset));
- grpc_pollset_set_destroy(&g_interested_parties);
- gpr_mu_unlock(&mu);
+ grpc_pollset_set_destroy(g_interested_parties);
+ gpr_mu_unlock(mu);
grpc_exec_ctx_finish(&exec_ctx);
gpr_free(pollset);
- gpr_mu_destroy(&mu);
return grpc_subchannel_get_connected_subchannel(c);
}
diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py
index f24dbe72cf..4dfafcea24 100755
--- a/test/core/end2end/gen_build_yaml.py
+++ b/test/core/end2end/gen_build_yaml.py
@@ -94,9 +94,8 @@ END2END_TESTS = {
'cancel_before_invoke': default_test_options._replace(cpu_cost=LOWCPU),
'cancel_in_a_vacuum': default_test_options._replace(cpu_cost=LOWCPU),
'cancel_with_status': default_test_options._replace(cpu_cost=LOWCPU),
- 'channel_connectivity': connectivity_test_options._replace(proxyable=False, cpu_cost=LOWCPU),
- 'channel_ping': connectivity_test_options._replace(proxyable=False),
'compressed_payload': default_test_options._replace(proxyable=False, cpu_cost=LOWCPU),
+ 'connectivity': connectivity_test_options._replace(proxyable=False, cpu_cost=LOWCPU),
'default_host': default_test_options._replace(needs_fullstack=True,
needs_dns=True),
'disappearing_server': connectivity_test_options,
@@ -109,11 +108,11 @@ END2END_TESTS = {
'large_metadata': default_test_options,
'max_concurrent_streams': default_test_options._replace(proxyable=False),
'max_message_length': default_test_options._replace(cpu_cost=LOWCPU),
- 'metadata': default_test_options,
'negative_deadline': default_test_options,
'no_op': default_test_options,
'payload': default_test_options._replace(cpu_cost=LOWCPU),
'ping_pong_streaming': default_test_options,
+ 'ping': connectivity_test_options._replace(proxyable=False),
'registered_call': default_test_options,
'request_with_flags': default_test_options._replace(proxyable=False),
'request_with_payload': default_test_options,
@@ -121,6 +120,7 @@ END2END_TESTS = {
'shutdown_finishes_calls': default_test_options,
'shutdown_finishes_tags': default_test_options,
'simple_delayed_request': connectivity_test_options._replace(cpu_cost=LOWCPU),
+ 'simple_metadata': default_test_options,
'simple_request': default_test_options,
'trailing_metadata': default_test_options,
}
diff --git a/test/core/end2end/tests/channel_connectivity.c b/test/core/end2end/tests/connectivity.c
index 0e21e65557..975c620731 100644
--- a/test/core/end2end/tests/channel_connectivity.c
+++ b/test/core/end2end/tests/connectivity.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
@@ -168,7 +168,7 @@ static void test_connectivity(grpc_end2end_test_config config) {
cq_verifier_destroy(cqv);
}
-void channel_connectivity(grpc_end2end_test_config config) {
+void connectivity(grpc_end2end_test_config config) {
GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION);
test_connectivity(config);
}
diff --git a/test/core/end2end/tests/channel_ping.c b/test/core/end2end/tests/ping.c
index 73fab206fb..f85df63de7 100644
--- a/test/core/end2end/tests/channel_ping.c
+++ b/test/core/end2end/tests/ping.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
@@ -91,7 +91,7 @@ static void test_ping(grpc_end2end_test_config config) {
cq_verifier_destroy(cqv);
}
-void channel_ping(grpc_end2end_test_config config) {
+void ping(grpc_end2end_test_config config) {
GPR_ASSERT(config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION);
test_ping(config);
}
diff --git a/test/core/end2end/tests/metadata.c b/test/core/end2end/tests/simple_metadata.c
index 5e92091eb7..c5084a560f 100644
--- a/test/core/end2end/tests/metadata.c
+++ b/test/core/end2end/tests/simple_metadata.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
@@ -260,6 +260,6 @@ static void test_request_response_with_metadata_and_payload(
config.tear_down_data(&f);
}
-void metadata(grpc_end2end_test_config config) {
+void simple_metadata(grpc_end2end_test_config config) {
test_request_response_with_metadata_and_payload(config);
}
diff --git a/test/core/httpcli/httpcli_test.c b/test/core/httpcli/httpcli_test.c
index cfa1829214..da1463329d 100644
--- a/test/core/httpcli/httpcli_test.c
+++ b/test/core/httpcli/httpcli_test.c
@@ -47,7 +47,7 @@
static int g_done = 0;
static grpc_httpcli_context g_context;
-static gpr_mu g_mu;
+static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
static gpr_timespec n_seconds_time(int seconds) {
@@ -64,10 +64,10 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg,
GPR_ASSERT(response->status == 200);
GPR_ASSERT(response->body_length == strlen(expect));
GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length));
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
g_done = 1;
grpc_pollset_kick(g_pollset, NULL);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
static void test_get(int port) {
@@ -88,16 +88,16 @@ static void test_get(int port) {
grpc_httpcli_get(&exec_ctx, &g_context, g_pollset, &req, n_seconds_time(15),
on_finish, (void *)42);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20));
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
gpr_free(host);
}
@@ -119,16 +119,16 @@ static void test_post(int port) {
grpc_httpcli_post(&exec_ctx, &g_context, g_pollset, &req, "hello", 5,
n_seconds_time(15), on_finish, (void *)42);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20));
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
gpr_free(host);
}
@@ -177,7 +177,6 @@ int main(int argc, char **argv) {
grpc_init();
grpc_httpcli_context_init(&g_context);
g_pollset = gpr_malloc(grpc_pollset_size());
- gpr_mu_init(&g_mu);
grpc_pollset_init(g_pollset, &g_mu);
test_get(port);
@@ -189,7 +188,6 @@ int main(int argc, char **argv) {
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();
- gpr_mu_destroy(&g_mu);
gpr_free(g_pollset);
gpr_subprocess_destroy(server);
diff --git a/test/core/httpcli/httpscli_test.c b/test/core/httpcli/httpscli_test.c
index b12f9472b1..7f765bc614 100644
--- a/test/core/httpcli/httpscli_test.c
+++ b/test/core/httpcli/httpscli_test.c
@@ -47,7 +47,7 @@
static int g_done = 0;
static grpc_httpcli_context g_context;
-static gpr_mu g_mu;
+static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
static gpr_timespec n_seconds_time(int seconds) {
@@ -64,10 +64,10 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg,
GPR_ASSERT(response->status == 200);
GPR_ASSERT(response->body_length == strlen(expect));
GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length));
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
g_done = 1;
grpc_pollset_kick(g_pollset, NULL);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
static void test_get(int port) {
@@ -89,16 +89,16 @@ static void test_get(int port) {
grpc_httpcli_get(&exec_ctx, &g_context, g_pollset, &req, n_seconds_time(15),
on_finish, (void *)42);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20));
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
gpr_free(host);
}
@@ -121,16 +121,16 @@ static void test_post(int port) {
grpc_httpcli_post(&exec_ctx, &g_context, g_pollset, &req, "hello", 5,
n_seconds_time(15), on_finish, (void *)42);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (!g_done) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), n_seconds_time(20));
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
gpr_free(host);
}
@@ -192,7 +192,6 @@ int main(int argc, char **argv) {
grpc_shutdown();
gpr_free(g_pollset);
- gpr_mu_destroy(&g_mu);
gpr_subprocess_destroy(server);
diff --git a/test/core/iomgr/endpoint_pair_test.c b/test/core/iomgr/endpoint_pair_test.c
index c02e414935..c3a91088a5 100644
--- a/test/core/iomgr/endpoint_pair_test.c
+++ b/test/core/iomgr/endpoint_pair_test.c
@@ -42,7 +42,7 @@
#include "test/core/iomgr/endpoint_tests.h"
#include "test/core/util/test_config.h"
-static gpr_mu g_mu;
+static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
static void clean_up(void) {}
@@ -73,17 +73,15 @@ static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, bool success) {
int main(int argc, char **argv) {
grpc_closure destroyed;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- gpr_mu_init(&g_mu);
grpc_test_init(argc, argv);
grpc_init();
g_pollset = gpr_malloc(grpc_pollset_size());
grpc_pollset_init(g_pollset, &g_mu);
- grpc_endpoint_tests(configs[0], g_pollset, &g_mu);
+ grpc_endpoint_tests(configs[0], g_pollset, g_mu);
grpc_closure_init(&destroyed, destroy_pollset, g_pollset);
grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();
- gpr_mu_destroy(&g_mu);
gpr_free(g_pollset);
return 0;
diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c
index d199e0c272..99689ebcc3 100644
--- a/test/core/iomgr/fd_posix_test.c
+++ b/test/core/iomgr/fd_posix_test.c
@@ -53,7 +53,7 @@
#include "src/core/iomgr/pollset_posix.h"
#include "test/core/util/test_config.h"
-static gpr_mu g_mu;
+static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
/* buffer size used to send and receive data.
@@ -182,10 +182,10 @@ static void listen_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*server */,
grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, NULL, "b");
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
sv->done = 1;
grpc_pollset_kick(g_pollset, NULL);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
/* Called when a new TCP connection request arrives in the listening port. */
@@ -252,18 +252,18 @@ static int server_start(grpc_exec_ctx *exec_ctx, server *sv) {
/* Wait and shutdown a sever. */
static void server_wait_and_shutdown(server *sv) {
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (!sv->done) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
/* ===An upload client to test notify_on_write=== */
@@ -310,9 +310,9 @@ static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */
ssize_t write_once = 0;
if (!success) {
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
client_session_shutdown_cb(exec_ctx, arg, 1);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
return;
}
@@ -322,7 +322,7 @@ static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */
} while (write_once > 0);
if (errno == EAGAIN) {
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
if (cl->client_write_cnt < CLIENT_TOTAL_WRITE_CNT) {
cl->write_closure.cb = client_session_write;
cl->write_closure.cb_arg = cl;
@@ -331,7 +331,7 @@ static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */
} else {
client_session_shutdown_cb(exec_ctx, arg, 1);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
} else {
gpr_log(GPR_ERROR, "unknown errno %s", strerror(errno));
abort();
@@ -367,18 +367,18 @@ static void client_start(grpc_exec_ctx *exec_ctx, client *cl, int port) {
/* Wait for the signal to shutdown a client. */
static void client_wait_and_shutdown(client *cl) {
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (!cl->done) {
grpc_pollset_worker *worker = NULL;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
/* Test grpc_fd. Start an upload server and client, upload a stream of
@@ -413,20 +413,20 @@ static void first_read_callback(grpc_exec_ctx *exec_ctx,
void *arg /* fd_change_data */, bool success) {
fd_change_data *fdc = arg;
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
fdc->cb_that_ran = first_read_callback;
grpc_pollset_kick(g_pollset, NULL);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
static void second_read_callback(grpc_exec_ctx *exec_ctx,
void *arg /* fd_change_data */, bool success) {
fd_change_data *fdc = arg;
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
fdc->cb_that_ran = second_read_callback;
grpc_pollset_kick(g_pollset, NULL);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
/* Test that changing the callback we use for notify_on_read actually works.
@@ -468,18 +468,18 @@ static void test_grpc_fd_change(void) {
GPR_ASSERT(result == 1);
/* And now wait for it to run. */
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (a.cb_that_ran == NULL) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
GPR_ASSERT(a.cb_that_ran == first_read_callback);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
/* And drain the socket so we can generate a new read edge */
result = read(sv[0], &data, 1);
@@ -492,19 +492,19 @@ static void test_grpc_fd_change(void) {
result = write(sv[1], &data, 1);
GPR_ASSERT(result == 1);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (b.cb_that_ran == NULL) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
/* Except now we verify that second_read_callback ran instead */
GPR_ASSERT(b.cb_that_ran == second_read_callback);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_fd_orphan(&exec_ctx, em_fd, NULL, NULL, "d");
grpc_exec_ctx_finish(&exec_ctx);
@@ -522,7 +522,6 @@ int main(int argc, char **argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_iomgr_init();
- gpr_mu_init(&g_mu);
g_pollset = gpr_malloc(grpc_pollset_size());
grpc_pollset_init(g_pollset, &g_mu);
test_grpc_fd();
@@ -531,7 +530,6 @@ int main(int argc, char **argv) {
grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
grpc_exec_ctx_finish(&exec_ctx);
gpr_free(g_pollset);
- gpr_mu_destroy(&g_mu);
grpc_iomgr_shutdown();
return 0;
}
diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c
index 58d6d2cb56..1e6fa5d45a 100644
--- a/test/core/iomgr/tcp_client_posix_test.c
+++ b/test/core/iomgr/tcp_client_posix_test.c
@@ -49,8 +49,8 @@
#include "src/core/iomgr/timer.h"
#include "test/core/util/test_config.h"
-static grpc_pollset_set g_pollset_set;
-static gpr_mu g_mu;
+static grpc_pollset_set *g_pollset_set;
+static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
static int g_connections_complete = 0;
static grpc_endpoint *g_connecting = NULL;
@@ -60,10 +60,10 @@ static gpr_timespec test_deadline(void) {
}
static void finish_connection() {
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
g_connections_complete++;
grpc_pollset_kick(g_pollset, NULL);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
@@ -101,14 +101,14 @@ void test_succeeds(void) {
GPR_ASSERT(0 == bind(svr_fd, (struct sockaddr *)&addr, addr_len));
GPR_ASSERT(0 == listen(svr_fd, 1));
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
connections_complete_before = g_connections_complete;
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
/* connect to it */
GPR_ASSERT(getsockname(svr_fd, (struct sockaddr *)&addr, &addr_len) == 0);
grpc_closure_init(&done, must_succeed, NULL);
- grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, &g_pollset_set,
+ grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set,
(struct sockaddr *)&addr, addr_len,
gpr_inf_future(GPR_CLOCK_REALTIME));
@@ -120,19 +120,19 @@ void test_succeeds(void) {
GPR_ASSERT(r >= 0);
close(r);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (g_connections_complete == connections_complete_before) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5));
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_flush(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
}
@@ -149,17 +149,17 @@ void test_fails(void) {
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
connections_complete_before = g_connections_complete;
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
/* connect to a broken address */
grpc_closure_init(&done, must_fail, NULL);
- grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, &g_pollset_set,
+ grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set,
(struct sockaddr *)&addr, addr_len,
gpr_inf_future(GPR_CLOCK_REALTIME));
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
/* wait for the connection callback to finish */
while (g_connections_complete == connections_complete_before) {
@@ -169,12 +169,12 @@ void test_fails(void) {
if (!grpc_timer_check(&exec_ctx, now, &polling_deadline)) {
grpc_pollset_work(&exec_ctx, g_pollset, &worker, now, polling_deadline);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_flush(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
}
@@ -219,16 +219,16 @@ void test_times_out(void) {
connect_deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
connections_complete_before = g_connections_complete;
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_closure_init(&done, must_fail, NULL);
- grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, &g_pollset_set,
+ grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set,
(struct sockaddr *)&addr, addr_len, connect_deadline);
/* Make sure the event doesn't trigger early */
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
for (;;) {
grpc_pollset_worker *worker = NULL;
gpr_timespec now = gpr_now(connect_deadline.clock_type);
@@ -256,11 +256,11 @@ void test_times_out(void) {
if (!grpc_timer_check(&exec_ctx, now, &polling_deadline)) {
grpc_pollset_work(&exec_ctx, g_pollset, &worker, now, polling_deadline);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_flush(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
@@ -279,22 +279,20 @@ int main(int argc, char **argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
- grpc_pollset_set_init(&g_pollset_set);
+ g_pollset_set = grpc_pollset_set_create();
g_pollset = gpr_malloc(grpc_pollset_size());
- gpr_mu_init(&g_mu);
grpc_pollset_init(g_pollset, &g_mu);
- grpc_pollset_set_add_pollset(&exec_ctx, &g_pollset_set, g_pollset);
+ grpc_pollset_set_add_pollset(&exec_ctx, g_pollset_set, g_pollset);
grpc_exec_ctx_finish(&exec_ctx);
test_succeeds();
gpr_log(GPR_ERROR, "End of first test");
test_fails();
test_times_out();
- grpc_pollset_set_destroy(&g_pollset_set);
+ grpc_pollset_set_destroy(g_pollset_set);
grpc_closure_init(&destroyed, destroy_pollset, g_pollset);
grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();
gpr_free(g_pollset);
- gpr_mu_destroy(&g_mu);
return 0;
}
diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c
index d6758f8fe1..4351642ab6 100644
--- a/test/core/iomgr/tcp_posix_test.c
+++ b/test/core/iomgr/tcp_posix_test.c
@@ -48,7 +48,7 @@
#include "test/core/iomgr/endpoint_tests.h"
#include "test/core/util/test_config.h"
-static gpr_mu g_mu;
+static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
/*
@@ -146,7 +146,7 @@ static void read_cb(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
GPR_ASSERT(success);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
current_data = state->read_bytes % 256;
read_bytes = count_slices(state->incoming.slices, state->incoming.count,
&current_data);
@@ -154,10 +154,10 @@ static void read_cb(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
gpr_log(GPR_INFO, "Read %d bytes of %d", read_bytes,
state->target_read_bytes);
if (state->read_bytes >= state->target_read_bytes) {
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
} else {
grpc_endpoint_read(exec_ctx, state->ep, &state->incoming, &state->read_cb);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
}
@@ -189,17 +189,17 @@ static void read_test(size_t num_bytes, size_t slice_size) {
grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (state.read_bytes < state.target_read_bytes) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), deadline);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
gpr_slice_buffer_destroy(&state.incoming);
grpc_endpoint_destroy(&exec_ctx, ep);
@@ -235,17 +235,17 @@ static void large_read_test(size_t slice_size) {
grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (state.read_bytes < state.target_read_bytes) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), deadline);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
gpr_slice_buffer_destroy(&state.incoming);
grpc_endpoint_destroy(&exec_ctx, ep);
@@ -284,11 +284,11 @@ static void write_done(grpc_exec_ctx *exec_ctx,
void *user_data /* write_socket_state */, bool success) {
struct write_socket_state *state = (struct write_socket_state *)user_data;
gpr_log(GPR_INFO, "Write done callback called");
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
gpr_log(GPR_INFO, "Signalling write done");
state->write_done = 1;
grpc_pollset_kick(g_pollset, NULL);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
void drain_socket_blocking(int fd, size_t num_bytes, size_t read_size) {
@@ -305,11 +305,11 @@ void drain_socket_blocking(int fd, size_t num_bytes, size_t read_size) {
for (;;) {
grpc_pollset_worker *worker = NULL;
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10));
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
do {
bytes_read =
@@ -364,7 +364,7 @@ static void write_test(size_t num_bytes, size_t slice_size) {
grpc_endpoint_write(&exec_ctx, ep, &outgoing, &write_done_closure);
drain_socket_blocking(sv[0], num_bytes, num_bytes);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
for (;;) {
grpc_pollset_worker *worker = NULL;
if (state.write_done) {
@@ -372,11 +372,11 @@ static void write_test(size_t num_bytes, size_t slice_size) {
}
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), deadline);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
gpr_slice_buffer_destroy(&outgoing);
grpc_endpoint_destroy(&exec_ctx, ep);
@@ -424,27 +424,27 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (state.read_bytes < state.target_read_bytes) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), deadline);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
gpr_slice_buffer_destroy(&state.incoming);
grpc_tcp_destroy_and_release_fd(&exec_ctx, ep, &fd, &fd_released_cb);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
while (!fd_released_done) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), deadline);
}
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
GPR_ASSERT(fd_released_done == 1);
GPR_ASSERT(fd == sv[1]);
grpc_exec_ctx_finish(&exec_ctx);
@@ -514,16 +514,14 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
g_pollset = gpr_malloc(grpc_pollset_size());
- gpr_mu_init(&g_mu);
grpc_pollset_init(g_pollset, &g_mu);
run_tests();
- grpc_endpoint_tests(configs[0], g_pollset, &g_mu);
+ grpc_endpoint_tests(configs[0], g_pollset, g_mu);
grpc_closure_init(&destroyed, destroy_pollset, g_pollset);
grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();
gpr_free(g_pollset);
- gpr_mu_destroy(&g_mu);
return 0;
}
diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c
index ed627734bf..7933468355 100644
--- a/test/core/iomgr/tcp_server_posix_test.c
+++ b/test/core/iomgr/tcp_server_posix_test.c
@@ -52,7 +52,7 @@
#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", #x)
-static gpr_mu g_mu;
+static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
static int g_nconnects = 0;
@@ -117,11 +117,11 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
grpc_endpoint_shutdown(exec_ctx, tcp);
grpc_endpoint_destroy(exec_ctx, tcp);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
on_connect_result_set(&g_result, acceptor);
g_nconnects++;
grpc_pollset_kick(g_pollset, NULL);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
static void test_no_op(void) {
@@ -178,7 +178,7 @@ static void tcp_connect(grpc_exec_ctx *exec_ctx, const struct sockaddr *remote,
int clifd = socket(remote->sa_family, SOCK_STREAM, 0);
int nconnects_before;
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
nconnects_before = g_nconnects;
on_connect_result_init(&g_result);
GPR_ASSERT(clifd >= 0);
@@ -190,16 +190,16 @@ static void tcp_connect(grpc_exec_ctx *exec_ctx, const struct sockaddr *remote,
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(exec_ctx, g_pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), deadline);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(exec_ctx);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
}
gpr_log(GPR_DEBUG, "wait done");
GPR_ASSERT(g_nconnects == nconnects_before + 1);
close(clifd);
*result = g_result;
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
/* Tests a tcp server with multiple ports. TODO(daniel-j-born): Multiple fds for
@@ -315,7 +315,6 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
grpc_init();
g_pollset = gpr_malloc(grpc_pollset_size());
- gpr_mu_init(&g_mu);
grpc_pollset_init(g_pollset, &g_mu);
test_no_op();
@@ -330,6 +329,5 @@ int main(int argc, char **argv) {
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();
gpr_free(g_pollset);
- gpr_mu_destroy(&g_mu);
return 0;
}
diff --git a/test/core/iomgr/workqueue_test.c b/test/core/iomgr/workqueue_test.c
index f557042e39..8a1faf6303 100644
--- a/test/core/iomgr/workqueue_test.c
+++ b/test/core/iomgr/workqueue_test.c
@@ -39,15 +39,15 @@
#include "test/core/util/test_config.h"
-static gpr_mu g_mu;
+static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
static void must_succeed(grpc_exec_ctx *exec_ctx, void *p, bool success) {
GPR_ASSERT(success == 1);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
*(int *)p = 1;
grpc_pollset_kick(g_pollset, NULL);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
}
static void test_ref_unref(void) {
@@ -71,11 +71,11 @@ static void test_add_closure(void) {
grpc_workqueue_push(wq, &c, 1);
grpc_workqueue_add_to_pollset(&exec_ctx, wq, g_pollset);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
GPR_ASSERT(!done);
grpc_pollset_work(&exec_ctx, g_pollset, &worker, gpr_now(deadline.clock_type),
deadline);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done);
@@ -96,11 +96,11 @@ static void test_flush(void) {
grpc_workqueue_flush(&exec_ctx, wq);
grpc_workqueue_add_to_pollset(&exec_ctx, wq, g_pollset);
- gpr_mu_lock(&g_mu);
+ gpr_mu_lock(g_mu);
GPR_ASSERT(!done);
grpc_pollset_work(&exec_ctx, g_pollset, &worker, gpr_now(deadline.clock_type),
deadline);
- gpr_mu_unlock(&g_mu);
+ gpr_mu_unlock(g_mu);
grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done);
@@ -117,7 +117,6 @@ int main(int argc, char **argv) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_test_init(argc, argv);
grpc_init();
- gpr_mu_init(&g_mu);
g_pollset = gpr_malloc(grpc_pollset_size());
grpc_pollset_init(g_pollset, &g_mu);
@@ -131,6 +130,5 @@ int main(int argc, char **argv) {
grpc_shutdown();
gpr_free(g_pollset);
- gpr_mu_destroy(&g_mu);
return 0;
}
diff --git a/test/core/security/base64_test.c b/test/core/security/b64_test.c
index e656d4c947..772514e1fd 100644
--- a/test/core/security/base64_test.c
+++ b/test/core/security/b64_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
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/security/base64.h"
+#include "src/core/security/b64.h"
#include <string.h>
diff --git a/test/core/security/create_jwt.c b/test/core/security/create_jwt.c
index 237dc9aa3e..4c0cf436ee 100644
--- a/test/core/security/create_jwt.c
+++ b/test/core/security/create_jwt.c
@@ -36,7 +36,7 @@
#include "src/core/security/credentials.h"
#include "src/core/security/json_token.h"
-#include "src/core/support/file.h"
+#include "src/core/support/load_file.h"
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index 8a210bb3c3..98133ef5e5 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -32,25 +32,24 @@
*/
#include <grpc/support/port_platform.h>
+
#include "src/core/security/credentials.h"
+#include <openssl/rsa.h>
#include <stdlib.h>
#include <string.h>
-#include "src/core/httpcli/httpcli.h"
-#include "src/core/security/json_token.h"
-#include "src/core/support/env.h"
-#include "src/core/support/file.h"
-#include "src/core/support/string.h"
-
-#include "test/core/util/test_config.h"
-
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
-#include <openssl/rsa.h>
+#include "src/core/httpcli/httpcli.h"
+#include "src/core/security/json_token.h"
+#include "src/core/support/env.h"
+#include "src/core/support/tmpfile.h"
+#include "src/core/support/string.h"
+#include "test/core/util/test_config.h"
/* -- Mock channel credentials. -- */
diff --git a/test/core/security/fetch_oauth2.c b/test/core/security/fetch_oauth2.c
index ee1178cbdd..87b54f1a0c 100644
--- a/test/core/security/fetch_oauth2.c
+++ b/test/core/security/fetch_oauth2.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
@@ -43,7 +43,7 @@
#include <grpc/support/sync.h>
#include "src/core/security/credentials.h"
-#include "src/core/support/file.h"
+#include "src/core/support/load_file.h"
#include "test/core/security/oauth2_utils.h"
static grpc_call_credentials *create_refresh_token_creds(
diff --git a/test/core/security/json_token_test.c b/test/core/security/json_token_test.c
index 7c01a9ce5c..4d80c16fb9 100644
--- a/test/core/security/json_token_test.c
+++ b/test/core/security/json_token_test.c
@@ -33,16 +33,17 @@
#include "src/core/security/json_token.h"
+#include <openssl/evp.h>
#include <string.h>
-#include "src/core/security/base64.h"
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice.h>
-#include "test/core/util/test_config.h"
+
#include "src/core/json/json.h"
-#include <openssl/evp.h>
+#include "src/core/security/b64.h"
+#include "test/core/util/test_config.h"
/* This JSON key was generated with the GCE console and revoked immediately.
The identifiers have been changed as well.
diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c
index f396398cef..f6ec9e12ef 100644
--- a/test/core/security/jwt_verifier_test.c
+++ b/test/core/security/jwt_verifier_test.c
@@ -36,7 +36,7 @@
#include <string.h>
#include "src/core/httpcli/httpcli.h"
-#include "src/core/security/base64.h"
+#include "src/core/security/b64.h"
#include "src/core/security/json_token.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c
index 3280eac801..9b70afffe1 100644
--- a/test/core/security/oauth2_utils.c
+++ b/test/core/security/oauth2_utils.c
@@ -45,7 +45,7 @@
#include "src/core/security/credentials.h"
typedef struct {
- gpr_mu mu;
+ gpr_mu *mu;
grpc_pollset *pollset;
int is_done;
char *token;
@@ -67,11 +67,11 @@ static void on_oauth2_response(grpc_exec_ctx *exec_ctx, void *user_data,
GPR_SLICE_LENGTH(token_slice));
token[GPR_SLICE_LENGTH(token_slice)] = '\0';
}
- gpr_mu_lock(&request->mu);
+ gpr_mu_lock(request->mu);
request->is_done = 1;
request->token = token;
grpc_pollset_kick(request->pollset, NULL);
- gpr_mu_unlock(&request->mu);
+ gpr_mu_unlock(request->mu);
}
static void do_nothing(grpc_exec_ctx *exec_ctx, void *unused, bool success) {}
@@ -95,14 +95,14 @@ char *grpc_test_fetch_oauth2_token_with_credentials(
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&request.mu);
+ gpr_mu_lock(request.mu);
while (!request.is_done) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, request.pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
}
- gpr_mu_unlock(&request.mu);
+ gpr_mu_unlock(request.mu);
grpc_pollset_shutdown(&exec_ctx, request.pollset, &do_nothing_closure);
grpc_exec_ctx_finish(&exec_ctx);
diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.c
index 2145a79ff9..09673f362c 100644
--- a/test/core/security/print_google_default_creds_token.c
+++ b/test/core/security/print_google_default_creds_token.c
@@ -46,7 +46,7 @@
#include "src/core/support/string.h"
typedef struct {
- gpr_mu mu;
+ gpr_mu *mu;
grpc_pollset *pollset;
int is_done;
} synchronizer;
@@ -64,10 +64,10 @@ static void on_metadata_response(grpc_exec_ctx *exec_ctx, void *user_data,
printf("\nGot token: %s\n\n", token);
gpr_free(token);
}
- gpr_mu_lock(&sync->mu);
+ gpr_mu_lock(sync->mu);
sync->is_done = 1;
grpc_pollset_kick(sync->pollset, NULL);
- gpr_mu_unlock(&sync->mu);
+ gpr_mu_unlock(sync->mu);
}
int main(int argc, char **argv) {
@@ -94,7 +94,6 @@ int main(int argc, char **argv) {
}
sync.pollset = gpr_malloc(grpc_pollset_size());
- gpr_mu_init(&sync.mu);
grpc_pollset_init(sync.pollset, &sync.mu);
sync.is_done = 0;
@@ -102,21 +101,22 @@ int main(int argc, char **argv) {
&exec_ctx, ((grpc_composite_channel_credentials *)creds)->call_creds,
sync.pollset, context, on_metadata_response, &sync);
- gpr_mu_lock(&sync.mu);
+ gpr_mu_lock(sync.mu);
while (!sync.is_done) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, sync.pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
- gpr_mu_unlock(&sync.mu);
- grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&sync.mu);
+ gpr_mu_unlock(sync.mu);
+ grpc_exec_ctx_flush(&exec_ctx);
+ gpr_mu_lock(sync.mu);
}
- gpr_mu_unlock(&sync.mu);
+ gpr_mu_unlock(sync.mu);
+
+ grpc_exec_ctx_finish(&exec_ctx);
grpc_channel_credentials_release(creds);
gpr_free(sync.pollset);
- gpr_mu_destroy(&sync.mu);
end:
gpr_cmdline_destroy(cl);
diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c
index 61543ada43..0e8c38a53e 100644
--- a/test/core/security/secure_endpoint_test.c
+++ b/test/core/security/secure_endpoint_test.c
@@ -45,7 +45,7 @@
#include "src/core/tsi/fake_transport_security.h"
#include "test/core/util/test_config.h"
-static gpr_mu g_mu;
+static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
@@ -183,9 +183,8 @@ int main(int argc, char **argv) {
grpc_init();
g_pollset = gpr_malloc(grpc_pollset_size());
- gpr_mu_init(&g_mu);
grpc_pollset_init(g_pollset, &g_mu);
- grpc_endpoint_tests(configs[0], g_pollset, &g_mu);
+ grpc_endpoint_tests(configs[0], g_pollset, g_mu);
test_leftover(configs[1], 1);
grpc_closure_init(&destroyed, destroy_pollset, g_pollset);
grpc_pollset_shutdown(&exec_ctx, g_pollset, &destroyed);
@@ -193,7 +192,6 @@ int main(int argc, char **argv) {
grpc_shutdown();
gpr_free(g_pollset);
- gpr_mu_destroy(&g_mu);
return 0;
}
diff --git a/test/core/security/security_connector_test.c b/test/core/security/security_connector_test.c
index ee5435f01d..420e3a4c52 100644
--- a/test/core/security/security_connector_test.c
+++ b/test/core/security/security_connector_test.c
@@ -34,22 +34,21 @@
#include <stdio.h>
#include <string.h>
+#include <grpc/grpc_security.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
+#include <grpc/support/useful.h>
+
#include "src/core/security/security_connector.h"
#include "src/core/security/security_context.h"
#include "src/core/support/env.h"
-#include "src/core/support/file.h"
+#include "src/core/support/tmpfile.h"
#include "src/core/support/string.h"
#include "src/core/tsi/ssl_transport_security.h"
#include "src/core/tsi/transport_security.h"
#include "test/core/util/test_config.h"
-#include <grpc/grpc_security.h>
-
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/string_util.h>
-#include <grpc/support/useful.h>
-
static int check_transport_security_type(const grpc_auth_context *ctx) {
grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name(
ctx, GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME);
diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.c
index c3cf6bb739..eb86589681 100644
--- a/test/core/security/verify_jwt.c
+++ b/test/core/security/verify_jwt.c
@@ -46,7 +46,7 @@
typedef struct {
grpc_pollset *pollset;
- gpr_mu mu;
+ gpr_mu *mu;
int is_done;
int success;
} synchronizer;
@@ -79,10 +79,10 @@ static void on_jwt_verification_done(void *user_data,
grpc_jwt_verifier_status_to_string(status));
}
- gpr_mu_lock(&sync->mu);
+ gpr_mu_lock(sync->mu);
sync->is_done = 1;
grpc_pollset_kick(sync->pollset, NULL);
- gpr_mu_unlock(&sync->mu);
+ gpr_mu_unlock(sync->mu);
}
int main(int argc, char **argv) {
@@ -106,26 +106,24 @@ int main(int argc, char **argv) {
grpc_init();
sync.pollset = gpr_malloc(grpc_pollset_size());
- gpr_mu_init(&sync.mu);
grpc_pollset_init(sync.pollset, &sync.mu);
sync.is_done = 0;
grpc_jwt_verifier_verify(&exec_ctx, verifier, sync.pollset, jwt, aud,
on_jwt_verification_done, &sync);
- gpr_mu_lock(&sync.mu);
+ gpr_mu_lock(sync.mu);
while (!sync.is_done) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, sync.pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_inf_future(GPR_CLOCK_MONOTONIC));
- gpr_mu_unlock(&sync.mu);
+ gpr_mu_unlock(sync.mu);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&sync.mu);
+ gpr_mu_lock(sync.mu);
}
- gpr_mu_unlock(&sync.mu);
+ gpr_mu_unlock(sync.mu);
- gpr_mu_destroy(&sync.mu);
gpr_free(sync.pollset);
grpc_jwt_verifier_destroy(verifier);
diff --git a/test/core/support/file_test.c b/test/core/support/load_file_test.c
index 330b2173ef..e6ba617440 100644
--- a/test/core/support/file_test.c
+++ b/test/core/support/load_file_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
@@ -38,7 +38,8 @@
#include <grpc/support/log.h>
#include <grpc/support/slice.h>
-#include "src/core/support/file.h"
+#include "src/core/support/load_file.h"
+#include "src/core/support/tmpfile.h"
#include "src/core/support/string.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c
index a04471706e..8b8514ccc9 100644
--- a/test/core/util/port_posix.c
+++ b/test/core/util/port_posix.c
@@ -69,7 +69,7 @@ static int has_port_been_chosen(int port) {
}
typedef struct freereq {
- gpr_mu mu;
+ gpr_mu *mu;
grpc_pollset *pollset;
int done;
} freereq;
@@ -83,10 +83,10 @@ static void destroy_pollset_and_shutdown(grpc_exec_ctx *exec_ctx, void *p,
static void freed_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
const grpc_httpcli_response *response) {
freereq *pr = arg;
- gpr_mu_lock(&pr->mu);
+ gpr_mu_lock(pr->mu);
pr->done = 1;
grpc_pollset_kick(pr->pollset, NULL);
- gpr_mu_unlock(&pr->mu);
+ gpr_mu_unlock(pr->mu);
}
static void free_port_using_server(char *server, int port) {
@@ -103,7 +103,6 @@ static void free_port_using_server(char *server, int port) {
memset(&req, 0, sizeof(req));
pr.pollset = gpr_malloc(grpc_pollset_size());
- gpr_mu_init(&pr.mu);
grpc_pollset_init(pr.pollset, &pr.mu);
grpc_closure_init(&shutdown_closure, destroy_pollset_and_shutdown,
pr.pollset);
@@ -116,21 +115,20 @@ static void free_port_using_server(char *server, int port) {
grpc_httpcli_get(&exec_ctx, &context, pr.pollset, &req,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), freed_port_from_server,
&pr);
- gpr_mu_lock(&pr.mu);
+ gpr_mu_lock(pr.mu);
while (!pr.done) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, pr.pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1));
}
- gpr_mu_unlock(&pr.mu);
+ gpr_mu_unlock(pr.mu);
grpc_httpcli_context_destroy(&context);
grpc_exec_ctx_finish(&exec_ctx);
grpc_pollset_shutdown(&exec_ctx, pr.pollset, &shutdown_closure);
grpc_exec_ctx_finish(&exec_ctx);
gpr_free(pr.pollset);
- gpr_mu_destroy(&pr.mu);
gpr_free(path);
}
@@ -208,7 +206,7 @@ static int is_port_available(int *port, int is_tcp) {
}
typedef struct portreq {
- gpr_mu mu;
+ gpr_mu *mu;
grpc_pollset *pollset;
int port;
int retries;
@@ -253,10 +251,10 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
port = port * 10 + response->body[i] - '0';
}
GPR_ASSERT(port > 1024);
- gpr_mu_lock(&pr->mu);
+ gpr_mu_lock(pr->mu);
pr->port = port;
grpc_pollset_kick(pr->pollset, NULL);
- gpr_mu_unlock(&pr->mu);
+ gpr_mu_unlock(pr->mu);
}
static int pick_port_using_server(char *server) {
@@ -271,7 +269,6 @@ static int pick_port_using_server(char *server) {
memset(&pr, 0, sizeof(pr));
memset(&req, 0, sizeof(req));
pr.pollset = gpr_malloc(grpc_pollset_size());
- gpr_mu_init(&pr.mu);
grpc_pollset_init(pr.pollset, &pr.mu);
grpc_closure_init(&shutdown_closure, destroy_pollset_and_shutdown,
pr.pollset);
@@ -287,20 +284,20 @@ static int pick_port_using_server(char *server) {
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server,
&pr);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_mu_lock(&pr.mu);
+ gpr_mu_lock(pr.mu);
while (pr.port == -1) {
grpc_pollset_worker *worker = NULL;
grpc_pollset_work(&exec_ctx, pr.pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1));
}
- gpr_mu_unlock(&pr.mu);
+ gpr_mu_unlock(pr.mu);
grpc_httpcli_context_destroy(&context);
grpc_pollset_shutdown(&exec_ctx, pr.pollset, &shutdown_closure);
grpc_exec_ctx_finish(&exec_ctx);
gpr_free(pr.pollset);
- gpr_mu_destroy(&pr.mu);
+ gpr_mu_destroy(pr.mu);
return pr.port;
}
diff --git a/test/core/util/port_windows.c b/test/core/util/port_windows.c
index b5bd0168ad..3b20aeb718 100644
--- a/test/core/util/port_windows.c
+++ b/test/core/util/port_windows.c
@@ -129,7 +129,8 @@ static int is_port_available(int *port, int is_tcp) {
}
typedef struct portreq {
- grpc_pollset pollset;
+ grpc_pollset *pollset;
+ gpr_mu *mu;
int port;
} portreq;
@@ -145,10 +146,10 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
port = port * 10 + response->body[i] - '0';
}
GPR_ASSERT(port > 1024);
- gpr_mu_lock(GRPC_POLLSET_MU(&pr->pollset));
+ gpr_mu_lock(pr->mu);
pr->port = port;
- grpc_pollset_kick(&pr->pollset, NULL);
- gpr_mu_unlock(GRPC_POLLSET_MU(&pr->pollset));
+ grpc_pollset_kick(pr->pollset, NULL);
+ gpr_mu_unlock(pr->mu);
}
static void destroy_pollset_and_shutdown(grpc_exec_ctx *exec_ctx, void *p,
@@ -168,32 +169,34 @@ static int pick_port_using_server(char *server) {
memset(&pr, 0, sizeof(pr));
memset(&req, 0, sizeof(req));
- grpc_pollset_init(&pr.pollset);
+ pr.pollset = gpr_malloc(grpc_pollset_size());
+ grpc_pollset_init(pr.pollset, &pr.mu);
pr.port = -1;
req.host = server;
req.path = "/get";
grpc_httpcli_context_init(&context);
- grpc_httpcli_get(&exec_ctx, &context, &pr.pollset, &req,
+ grpc_httpcli_get(&exec_ctx, &context, pr.pollset, &req,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server,
&pr);
- gpr_mu_lock(GRPC_POLLSET_MU(&pr.pollset));
+ gpr_mu_lock(pr.mu);
while (pr.port == -1) {
grpc_pollset_worker *worker = NULL;
- grpc_pollset_work(&exec_ctx, &pr.pollset, &worker,
+ grpc_pollset_work(&exec_ctx, pr.pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1));
- gpr_mu_unlock(GRPC_POLLSET_MU(&pr.pollset));
+ gpr_mu_unlock(pr.mu);
grpc_exec_ctx_flush(&exec_ctx);
- gpr_mu_lock(GRPC_POLLSET_MU(&pr.pollset));
+ gpr_mu_lock(pr.mu);
}
- gpr_mu_unlock(GRPC_POLLSET_MU(&pr.pollset));
+ gpr_mu_unlock(pr.mu);
grpc_httpcli_context_destroy(&context);
grpc_closure_init(&destroy_pollset_closure, destroy_pollset_and_shutdown,
&pr.pollset);
- grpc_pollset_shutdown(&exec_ctx, &pr.pollset, &destroy_pollset_closure);
+ grpc_pollset_shutdown(&exec_ctx, pr.pollset, &destroy_pollset_closure);
+ gpr_free(pr.pollset);
grpc_exec_ctx_finish(&exec_ctx);
return pr.port;
diff --git a/test/core/util/test_tcp_server.c b/test/core/util/test_tcp_server.c
index 8f1db4e501..ab379441d8 100644
--- a/test/core/util/test_tcp_server.c
+++ b/test/core/util/test_tcp_server.c
@@ -58,7 +58,6 @@ void test_tcp_server_init(test_tcp_server *server,
grpc_closure_init(&server->shutdown_complete, on_server_destroyed, server);
server->shutdown = 0;
server->pollset = gpr_malloc(grpc_pollset_size());
- gpr_mu_init(&server->mu);
grpc_pollset_init(server->pollset, &server->mu);
server->on_connect = on_connect;
server->cb_data = user_data;
@@ -91,10 +90,10 @@ void test_tcp_server_poll(test_tcp_server *server, int seconds) {
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_seconds(seconds, GPR_TIMESPAN));
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- gpr_mu_lock(&server->mu);
+ gpr_mu_lock(server->mu);
grpc_pollset_work(&exec_ctx, server->pollset, &worker,
gpr_now(GPR_CLOCK_MONOTONIC), deadline);
- gpr_mu_unlock(&server->mu);
+ gpr_mu_unlock(server->mu);
grpc_exec_ctx_finish(&exec_ctx);
}
@@ -116,6 +115,5 @@ void test_tcp_server_destroy(test_tcp_server *server) {
grpc_exec_ctx_finish(&exec_ctx);
grpc_pollset_destroy(server->pollset);
gpr_free(server->pollset);
- gpr_mu_destroy(&server->mu);
grpc_shutdown();
}
diff --git a/test/core/util/test_tcp_server.h b/test/core/util/test_tcp_server.h
index ef9dd007c7..15fcb4fb87 100644
--- a/test/core/util/test_tcp_server.h
+++ b/test/core/util/test_tcp_server.h
@@ -41,7 +41,7 @@ typedef struct test_tcp_server {
grpc_tcp_server *tcp_server;
grpc_closure shutdown_complete;
int shutdown;
- gpr_mu mu;
+ gpr_mu *mu;
grpc_pollset *pollset;
grpc_tcp_server_cb on_connect;
void *cb_data;