diff options
author | Craig Tiller <ctiller@google.com> | 2016-10-26 20:52:03 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-10-26 20:52:03 -0700 |
commit | 3d357d901c5228cf8989aed8949b20d32baad77b (patch) | |
tree | 8bc31b6152788589447846badb6ac1a220fc8681 /test/core/end2end/fixtures | |
parent | 6b5d682c981f365d1f3c1bf771f113bd727d5ee0 (diff) | |
parent | d92b795b53842b747a00a82d5aae0913d041766e (diff) |
Merge github.com:grpc/grpc into buffer_pools_for_realsies
Diffstat (limited to 'test/core/end2end/fixtures')
-rw-r--r-- | test/core/end2end/fixtures/h2_fd.c | 11 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_full+pipe.c | 11 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_full+trace.c | 7 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_sockpair+trace.c | 7 | ||||
-rw-r--r-- | test/core/end2end/fixtures/http_proxy.c | 17 |
5 files changed, 43 insertions, 10 deletions
diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index 5a58fe34cd..2dfa54fb6b 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -31,6 +31,11 @@ * */ +#include "src/core/lib/iomgr/port.h" + +// This test won't work except with posix sockets enabled +#ifdef GRPC_POSIX_SOCKET + #include "test/core/end2end/end2end_tests.h" #include <fcntl.h> @@ -129,3 +134,9 @@ int main(int argc, char **argv) { return 0; } + +#else /* GRPC_POSIX_SOCKET */ + +int main(int argc, char **argv) { return 1; } + +#endif /* GRPC_POSIX_SOCKET */ diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index 5d4c44ce94..e0026a7940 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -31,6 +31,11 @@ * */ +#include "src/core/lib/iomgr/port.h" + +// This test requires posix wakeup fds +#ifdef GRPC_POSIX_WAKEUP_FD + #include "test/core/end2end/end2end_tests.h" #include <string.h> @@ -121,3 +126,9 @@ int main(int argc, char **argv) { return 0; } + +#else /* GRPC_POSIX_WAKEUP_FD */ + +int main(int argc, char **argv) { return 1; } + +#endif /* GRPC_POSIX_WAKEUP_FD */ diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index 64aa53a5ae..eadc62d963 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -31,9 +31,14 @@ * */ +#include "src/core/lib/iomgr/port.h" + #include "test/core/end2end/end2end_tests.h" #include <string.h> +#ifdef GRPC_POSIX_SOCKET +#include <unistd.h> +#endif #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> @@ -111,7 +116,7 @@ int main(int argc, char **argv) { code paths in trace.c to be taken */ gpr_setenv("GRPC_TRACE", "doesnt-exist,http,all"); -#ifdef GPR_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET g_fixture_slowdown_factor = isatty(STDOUT_FILENO) ? 10.0 : 1.0; #else g_fixture_slowdown_factor = 10.0; diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index ae54ca800f..a358edf321 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -31,9 +31,14 @@ * */ +#include "src/core/lib/iomgr/port.h" + #include "test/core/end2end/end2end_tests.h" #include <string.h> +#ifdef GRPC_POSIX_SOCKET +#include <unistd.h> +#endif #include <grpc/support/alloc.h> #include <grpc/support/log.h> @@ -150,7 +155,7 @@ int main(int argc, char **argv) { /* force tracing on, with a value to force many code paths in trace.c to be taken */ gpr_setenv("GRPC_TRACE", "doesnt-exist,http,all"); -#ifdef GPR_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET g_fixture_slowdown_factor = isatty(STDOUT_FILENO) ? 10.0 : 1.0; #else g_fixture_slowdown_factor = 10.0; diff --git a/test/core/end2end/fixtures/http_proxy.c b/test/core/end2end/fixtures/http_proxy.c index bc24cb33cf..630f47ef0e 100644 --- a/test/core/end2end/fixtures/http_proxy.c +++ b/test/core/end2end/fixtures/http_proxy.c @@ -33,6 +33,8 @@ #include "test/core/end2end/fixtures/http_proxy.h" +#include "src/core/lib/iomgr/sockaddr.h" + #include <string.h> #include <grpc/support/alloc.h> @@ -358,8 +360,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg, gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_seconds(10, GPR_TIMESPAN)); grpc_tcp_client_connect(exec_ctx, &conn->on_server_connect_done, &conn->server_endpoint, conn->pollset_set, NULL, - (struct sockaddr*)&resolved_addresses->addrs[0].addr, - resolved_addresses->addrs[0].len, deadline); + &resolved_addresses->addrs[0], deadline); grpc_resolved_addresses_destroy(resolved_addresses); } @@ -431,13 +432,13 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(void) { &exec_ctx, NULL, proxy->channel_args, &proxy->server); GPR_ASSERT(error == GRPC_ERROR_NONE); // Bind to port. - struct sockaddr_in addr; - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - grpc_sockaddr_set_port((struct sockaddr*)&addr, proxy_port); + grpc_resolved_address resolved_addr; + struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; + memset(&resolved_addr, 0, sizeof(resolved_addr)); + addr->sin_family = AF_INET; + grpc_sockaddr_set_port(&resolved_addr, proxy_port); int port; - error = grpc_tcp_server_add_port(proxy->server, (struct sockaddr*)&addr, - sizeof(addr), &port); + error = grpc_tcp_server_add_port(proxy->server, &resolved_addr, &port); GPR_ASSERT(error == GRPC_ERROR_NONE); GPR_ASSERT(port == proxy_port); // Start server. |