aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/client_channel/parse_address_test.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-12-06 09:47:54 -0800
committerGravatar GitHub <noreply@github.com>2017-12-06 09:47:54 -0800
commit8cf1470a51ea276ca84825e7495d4ee24743540d (patch)
tree72385cc865094115bc08cb813201d48cb09840bb /test/core/client_channel/parse_address_test.cc
parent1d4e99508409be052bd129ba507bae1fbe7eb7fa (diff)
Revert "Revert "All instances of exec_ctx being passed around in src/core removed""
Diffstat (limited to 'test/core/client_channel/parse_address_test.cc')
-rw-r--r--test/core/client_channel/parse_address_test.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/core/client_channel/parse_address_test.cc b/test/core/client_channel/parse_address_test.cc
index 94f76da920..6d56961d84 100644
--- a/test/core/client_channel/parse_address_test.cc
+++ b/test/core/client_channel/parse_address_test.cc
@@ -24,6 +24,7 @@
#include <sys/un.h>
#endif
+#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include "src/core/lib/iomgr/exec_ctx.h"
@@ -33,8 +34,8 @@
#ifdef GRPC_HAVE_UNIX_SOCKET
static void test_grpc_parse_unix(const char* uri_text, const char* pathname) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri* uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_uri* uri = grpc_uri_parse(uri_text, 0);
grpc_resolved_address addr;
GPR_ASSERT(1 == grpc_parse_unix(uri, &addr));
@@ -43,7 +44,6 @@ static void test_grpc_parse_unix(const char* uri_text, const char* pathname) {
GPR_ASSERT(0 == strcmp(addr_un->sun_path, pathname));
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish(&exec_ctx);
}
#else /* GRPC_HAVE_UNIX_SOCKET */
@@ -54,8 +54,8 @@ static void test_grpc_parse_unix(const char* uri_text, const char* pathname) {}
static void test_grpc_parse_ipv4(const char* uri_text, const char* host,
unsigned short port) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri* uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_uri* uri = grpc_uri_parse(uri_text, 0);
grpc_resolved_address addr;
char ntop_buf[INET_ADDRSTRLEN];
@@ -68,13 +68,12 @@ static void test_grpc_parse_ipv4(const char* uri_text, const char* host,
GPR_ASSERT(ntohs(addr_in->sin_port) == port);
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish(&exec_ctx);
}
static void test_grpc_parse_ipv6(const char* uri_text, const char* host,
unsigned short port, uint32_t scope_id) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_uri* uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_uri* uri = grpc_uri_parse(uri_text, 0);
grpc_resolved_address addr;
char ntop_buf[INET6_ADDRSTRLEN];
@@ -88,14 +87,16 @@ static void test_grpc_parse_ipv6(const char* uri_text, const char* host,
GPR_ASSERT(addr_in6->sin6_scope_id == scope_id);
grpc_uri_destroy(uri);
- grpc_exec_ctx_finish(&exec_ctx);
}
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
+ grpc_init();
test_grpc_parse_unix("unix:/path/name", "/path/name");
test_grpc_parse_ipv4("ipv4:192.0.2.1:12345", "192.0.2.1", 12345);
test_grpc_parse_ipv6("ipv6:[2001:db8::1]:12345", "2001:db8::1", 12345, 0);
test_grpc_parse_ipv6("ipv6:[2001:db8::1%252]:12345", "2001:db8::1", 12345, 2);
+
+ grpc_shutdown();
}