Compile and link core tests with libuv

reviewable/pr8125/r3
murgatroid99 9 years ago
parent dedb923b6e
commit c36f6ea745
  1. 6
      BUILD
  2. 5
      CMakeLists.txt
  3. 24
      Makefile
  4. 1
      binding.gyp
  5. 17
      build.yaml
  6. 1
      config.m4
  7. 1
      gRPC-Core.podspec
  8. 1
      grpc.gemspec
  9. 1
      package.xml
  10. 2
      src/boringssl/gen_build_yaml.py
  11. 50
      src/core/lib/iomgr/endpoint_pair_uv.c
  12. 3
      src/core/lib/iomgr/sockaddr.h
  13. 1
      src/core/lib/iomgr/tcp_client.h
  14. 25
      src/core/lib/iomgr/tcp_client_uv.c
  15. 8
      src/core/lib/iomgr/tcp_uv.c
  16. 1
      src/python/grpcio/grpc_core_dependencies.py
  17. 9
      templates/Makefile.template
  18. 1
      templates/tools/run_tests/tests.json.template
  19. 3
      test/core/client_config/set_initial_connect_string_test.c
  20. 3
      test/core/end2end/bad_server_response_test.c
  21. 46
      test/core/end2end/cq_verifier.c
  22. 47
      test/core/end2end/cq_verifier_internal.h
  23. 73
      test/core/end2end/cq_verifier_native.c
  24. 108
      test/core/end2end/cq_verifier_uv.c
  25. 13
      test/core/end2end/dualstack_socket_test.c
  26. 13
      test/core/end2end/fixtures/h2_fd.c
  27. 13
      test/core/end2end/fixtures/h2_full+pipe.c
  28. 2
      test/core/end2end/fixtures/http_proxy.c
  29. 6
      test/core/end2end/fuzzers/api_fuzzer.c
  30. 8
      test/core/end2end/gen_build_yaml.py
  31. 13
      test/core/iomgr/fd_posix_test.c
  32. 14
      test/core/iomgr/socket_utils_test.c
  33. 13
      test/core/iomgr/tcp_posix_test.c
  34. 13
      test/core/iomgr/tcp_server_posix_test.c
  35. 13
      test/core/iomgr/timer_heap_test.c
  36. 2
      test/core/util/port_server_client.c
  37. 58
      test/core/util/port_uv.c
  38. 1
      tools/doxygen/Doxyfile.c++.internal
  39. 1
      tools/doxygen/Doxyfile.core.internal
  40. 21
      tools/run_tests/run_tests.py
  41. 6
      tools/run_tests/sources_and_headers.json
  42. 156
      tools/run_tests/tests.json
  43. 2
      vsprojects/vcxproj/grpc++/grpc++.vcxproj
  44. 3
      vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters
  45. 2
      vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj
  46. 3
      vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters
  47. 2
      vsprojects/vcxproj/grpc/grpc.vcxproj
  48. 3
      vsprojects/vcxproj/grpc/grpc.vcxproj.filters
  49. 9
      vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj
  50. 15
      vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters
  51. 7
      vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj
  52. 12
      vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.filters
  53. 2
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
  54. 3
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters

@ -348,6 +348,7 @@ cc_library(
"src/core/lib/iomgr/combiner.c",
"src/core/lib/iomgr/endpoint.c",
"src/core/lib/iomgr/endpoint_pair_posix.c",
"src/core/lib/iomgr/endpoint_pair_uv.c",
"src/core/lib/iomgr/endpoint_pair_windows.c",
"src/core/lib/iomgr/error.c",
"src/core/lib/iomgr/ev_epoll_linux.c",
@ -749,6 +750,7 @@ cc_library(
"src/core/lib/iomgr/combiner.c",
"src/core/lib/iomgr/endpoint.c",
"src/core/lib/iomgr/endpoint_pair_posix.c",
"src/core/lib/iomgr/endpoint_pair_uv.c",
"src/core/lib/iomgr/endpoint_pair_windows.c",
"src/core/lib/iomgr/error.c",
"src/core/lib/iomgr/ev_epoll_linux.c",
@ -1112,6 +1114,7 @@ cc_library(
"src/core/lib/iomgr/combiner.c",
"src/core/lib/iomgr/endpoint.c",
"src/core/lib/iomgr/endpoint_pair_posix.c",
"src/core/lib/iomgr/endpoint_pair_uv.c",
"src/core/lib/iomgr/endpoint_pair_windows.c",
"src/core/lib/iomgr/error.c",
"src/core/lib/iomgr/ev_epoll_linux.c",
@ -1459,6 +1462,7 @@ cc_library(
"src/core/lib/iomgr/combiner.c",
"src/core/lib/iomgr/endpoint.c",
"src/core/lib/iomgr/endpoint_pair_posix.c",
"src/core/lib/iomgr/endpoint_pair_uv.c",
"src/core/lib/iomgr/endpoint_pair_windows.c",
"src/core/lib/iomgr/error.c",
"src/core/lib/iomgr/ev_epoll_linux.c",
@ -1880,6 +1884,7 @@ cc_library(
"src/core/lib/iomgr/combiner.c",
"src/core/lib/iomgr/endpoint.c",
"src/core/lib/iomgr/endpoint_pair_posix.c",
"src/core/lib/iomgr/endpoint_pair_uv.c",
"src/core/lib/iomgr/endpoint_pair_windows.c",
"src/core/lib/iomgr/error.c",
"src/core/lib/iomgr/ev_epoll_linux.c",
@ -2279,6 +2284,7 @@ objc_library(
"src/core/lib/iomgr/combiner.c",
"src/core/lib/iomgr/endpoint.c",
"src/core/lib/iomgr/endpoint_pair_posix.c",
"src/core/lib/iomgr/endpoint_pair_uv.c",
"src/core/lib/iomgr/endpoint_pair_windows.c",
"src/core/lib/iomgr/error.c",
"src/core/lib/iomgr/ev_epoll_linux.c",

@ -309,6 +309,7 @@ add_library(grpc
src/core/lib/iomgr/combiner.c
src/core/lib/iomgr/endpoint.c
src/core/lib/iomgr/endpoint_pair_posix.c
src/core/lib/iomgr/endpoint_pair_uv.c
src/core/lib/iomgr/endpoint_pair_windows.c
src/core/lib/iomgr/error.c
src/core/lib/iomgr/ev_epoll_linux.c
@ -577,6 +578,7 @@ add_library(grpc_cronet
src/core/lib/iomgr/combiner.c
src/core/lib/iomgr/endpoint.c
src/core/lib/iomgr/endpoint_pair_posix.c
src/core/lib/iomgr/endpoint_pair_uv.c
src/core/lib/iomgr/endpoint_pair_windows.c
src/core/lib/iomgr/error.c
src/core/lib/iomgr/ev_epoll_linux.c
@ -817,6 +819,7 @@ add_library(grpc_unsecure
src/core/lib/iomgr/combiner.c
src/core/lib/iomgr/endpoint.c
src/core/lib/iomgr/endpoint_pair_posix.c
src/core/lib/iomgr/endpoint_pair_uv.c
src/core/lib/iomgr/endpoint_pair_windows.c
src/core/lib/iomgr/error.c
src/core/lib/iomgr/ev_epoll_linux.c
@ -1085,6 +1088,7 @@ add_library(grpc++
src/core/lib/iomgr/combiner.c
src/core/lib/iomgr/endpoint.c
src/core/lib/iomgr/endpoint_pair_posix.c
src/core/lib/iomgr/endpoint_pair_uv.c
src/core/lib/iomgr/endpoint_pair_windows.c
src/core/lib/iomgr/error.c
src/core/lib/iomgr/ev_epoll_linux.c
@ -1449,6 +1453,7 @@ add_library(grpc++_unsecure
src/core/lib/iomgr/combiner.c
src/core/lib/iomgr/endpoint.c
src/core/lib/iomgr/endpoint_pair_posix.c
src/core/lib/iomgr/endpoint_pair_uv.c
src/core/lib/iomgr/endpoint_pair_windows.c
src/core/lib/iomgr/error.c
src/core/lib/iomgr/ev_epoll_linux.c

@ -345,10 +345,6 @@ HOST_CXX ?= $(CXX)
HOST_LD ?= $(LD)
HOST_LDXX ?= $(LDXX)
ifdef EXTRA_DEFINES
DEFINES += $(EXTRA_DEFINES)
endif
CFLAGS += -std=c99 -Wsign-conversion -Wconversion $(W_SHADOW) $(W_EXTRA_SEMI)
ifeq ($(HAS_CXX11),true)
CXXFLAGS += -std=c++11
@ -447,6 +443,14 @@ LDFLAGS += $(ARCH_FLAGS)
LDLIBS += $(addprefix -l, $(LIBS))
LDLIBSXX += $(addprefix -l, $(LIBSXX))
CFLAGS += $(EXTRA_CFLAGS)
CXXFLAGS += $(EXTRA_CXXFLAGS)
CPPFLAGS += $(EXTRA_CPPFLAGS)
LDFLAGS += $(EXTRA_LDFLAGS)
DEFINES += $(EXTRA_DEFINES)
LDLIBS += $(EXTRA_LDLIBS)
HOST_CPPFLAGS = $(CPPFLAGS)
HOST_CFLAGS = $(CFLAGS)
HOST_CXXFLAGS = $(CXXFLAGS)
@ -2546,6 +2550,7 @@ LIBGRPC_SRC = \
src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \
src/core/lib/iomgr/endpoint_pair_posix.c \
src/core/lib/iomgr/endpoint_pair_uv.c \
src/core/lib/iomgr/endpoint_pair_windows.c \
src/core/lib/iomgr/error.c \
src/core/lib/iomgr/ev_epoll_linux.c \
@ -2832,6 +2837,7 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \
src/core/lib/iomgr/endpoint_pair_posix.c \
src/core/lib/iomgr/endpoint_pair_uv.c \
src/core/lib/iomgr/endpoint_pair_windows.c \
src/core/lib/iomgr/error.c \
src/core/lib/iomgr/ev_epoll_linux.c \
@ -3076,6 +3082,8 @@ LIBGRPC_TEST_UTIL_SRC = \
test/core/end2end/data/test_root_cert.c \
test/core/security/oauth2_utils.c \
test/core/end2end/cq_verifier.c \
test/core/end2end/cq_verifier_native.c \
test/core/end2end/cq_verifier_uv.c \
test/core/end2end/fixtures/http_proxy.c \
test/core/end2end/fixtures/proxy.c \
test/core/iomgr/endpoint_tests.c \
@ -3086,6 +3094,7 @@ LIBGRPC_TEST_UTIL_SRC = \
test/core/util/passthru_endpoint.c \
test/core/util/port_posix.c \
test/core/util/port_server_client.c \
test/core/util/port_uv.c \
test/core/util/port_windows.c \
test/core/util/slice_splitter.c \
src/core/lib/channel/channel_args.c \
@ -3107,6 +3116,7 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \
src/core/lib/iomgr/endpoint_pair_posix.c \
src/core/lib/iomgr/endpoint_pair_uv.c \
src/core/lib/iomgr/endpoint_pair_windows.c \
src/core/lib/iomgr/error.c \
src/core/lib/iomgr/ev_epoll_linux.c \
@ -3253,6 +3263,8 @@ endif
LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
test/core/end2end/cq_verifier.c \
test/core/end2end/cq_verifier_native.c \
test/core/end2end/cq_verifier_uv.c \
test/core/end2end/fixtures/http_proxy.c \
test/core/end2end/fixtures/proxy.c \
test/core/iomgr/endpoint_tests.c \
@ -3263,6 +3275,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
test/core/util/passthru_endpoint.c \
test/core/util/port_posix.c \
test/core/util/port_server_client.c \
test/core/util/port_uv.c \
test/core/util/port_windows.c \
test/core/util/slice_splitter.c \
@ -3310,6 +3323,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \
src/core/lib/iomgr/endpoint_pair_posix.c \
src/core/lib/iomgr/endpoint_pair_uv.c \
src/core/lib/iomgr/endpoint_pair_windows.c \
src/core/lib/iomgr/error.c \
src/core/lib/iomgr/ev_epoll_linux.c \
@ -3661,6 +3675,7 @@ LIBGRPC++_SRC = \
src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \
src/core/lib/iomgr/endpoint_pair_posix.c \
src/core/lib/iomgr/endpoint_pair_uv.c \
src/core/lib/iomgr/endpoint_pair_windows.c \
src/core/lib/iomgr/error.c \
src/core/lib/iomgr/ev_epoll_linux.c \
@ -4300,6 +4315,7 @@ LIBGRPC++_UNSECURE_SRC = \
src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \
src/core/lib/iomgr/endpoint_pair_posix.c \
src/core/lib/iomgr/endpoint_pair_uv.c \
src/core/lib/iomgr/endpoint_pair_windows.c \
src/core/lib/iomgr/error.c \
src/core/lib/iomgr/ev_epoll_linux.c \

@ -587,6 +587,7 @@
'src/core/lib/iomgr/combiner.c',
'src/core/lib/iomgr/endpoint.c',
'src/core/lib/iomgr/endpoint_pair_posix.c',
'src/core/lib/iomgr/endpoint_pair_uv.c',
'src/core/lib/iomgr/endpoint_pair_windows.c',
'src/core/lib/iomgr/error.c',
'src/core/lib/iomgr/ev_epoll_linux.c',

@ -275,6 +275,7 @@ filegroups:
- src/core/lib/iomgr/combiner.c
- src/core/lib/iomgr/endpoint.c
- src/core/lib/iomgr/endpoint_pair_posix.c
- src/core/lib/iomgr/endpoint_pair_uv.c
- src/core/lib/iomgr/endpoint_pair_windows.c
- src/core/lib/iomgr/error.c
- src/core/lib/iomgr/ev_epoll_linux.c
@ -522,6 +523,7 @@ filegroups:
build: test
headers:
- test/core/end2end/cq_verifier.h
- test/core/end2end/cq_verifier_internal.h
- test/core/end2end/fixtures/http_proxy.h
- test/core/end2end/fixtures/proxy.h
- test/core/iomgr/endpoint_tests.h
@ -535,6 +537,8 @@ filegroups:
- test/core/util/slice_splitter.h
src:
- test/core/end2end/cq_verifier.c
- test/core/end2end/cq_verifier_native.c
- test/core/end2end/cq_verifier_uv.c
- test/core/end2end/fixtures/http_proxy.c
- test/core/end2end/fixtures/proxy.c
- test/core/iomgr/endpoint_tests.c
@ -545,6 +549,7 @@ filegroups:
- test/core/util/passthru_endpoint.c
- test/core/util/port_posix.c
- test/core/util/port_server_client.c
- test/core/util/port_uv.c
- test/core/util/port_windows.c
- test/core/util/slice_splitter.c
deps:
@ -1511,6 +1516,8 @@ targets:
- grpc
- gpr_test_util
- gpr
exclude_iomgrs:
- uv
platforms:
- mac
- linux
@ -2451,6 +2458,8 @@ targets:
- grpc
- gpr_test_util
- gpr
exclude_iomgrs:
- uv
platforms:
- mac
- linux
@ -2466,6 +2475,8 @@ targets:
- grpc
- gpr_test_util
- gpr
exclude_iomgrs:
- uv
platforms:
- mac
- linux
@ -2480,6 +2491,8 @@ targets:
- grpc
- gpr_test_util
- gpr
exclude_iomgrs:
- uv
platforms:
- mac
- linux
@ -2514,6 +2527,8 @@ targets:
- grpc
- gpr_test_util
- gpr
exclude_iomgrs:
- uv
- name: timer_list_test
build: test
language: c
@ -2524,6 +2539,8 @@ targets:
- grpc
- gpr_test_util
- gpr
exclude_iomgrs:
- uv
- name: transport_connectivity_state_test
build: test
language: c

@ -103,6 +103,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \
src/core/lib/iomgr/endpoint_pair_posix.c \
src/core/lib/iomgr/endpoint_pair_uv.c \
src/core/lib/iomgr/endpoint_pair_windows.c \
src/core/lib/iomgr/error.c \
src/core/lib/iomgr/ev_epoll_linux.c \

@ -439,6 +439,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/combiner.c',
'src/core/lib/iomgr/endpoint.c',
'src/core/lib/iomgr/endpoint_pair_posix.c',
'src/core/lib/iomgr/endpoint_pair_uv.c',
'src/core/lib/iomgr/endpoint_pair_windows.c',
'src/core/lib/iomgr/error.c',
'src/core/lib/iomgr/ev_epoll_linux.c',

@ -359,6 +359,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/combiner.c )
s.files += %w( src/core/lib/iomgr/endpoint.c )
s.files += %w( src/core/lib/iomgr/endpoint_pair_posix.c )
s.files += %w( src/core/lib/iomgr/endpoint_pair_uv.c )
s.files += %w( src/core/lib/iomgr/endpoint_pair_windows.c )
s.files += %w( src/core/lib/iomgr/error.c )
s.files += %w( src/core/lib/iomgr/ev_epoll_linux.c )

@ -366,6 +366,7 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/combiner.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint_pair_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint_pair_uv.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint_pair_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/error.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_epoll_linux.c" role="src" />

@ -36,7 +36,7 @@ import yaml
sys.dont_write_bytecode = True
boring_ssl_root = os.path.abspath(os.path.join(
os.path.dirname(sys.argv[0]),
os.path.dirname(sys.argv[0]),
'../../third_party/boringssl'))
sys.path.append(os.path.join(boring_ssl_root, 'util'))

@ -0,0 +1,50 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_UV
#include <stdlib.h>
#include "src/core/lib/iomgr/endpoint_pair.h"
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name,
size_t read_slice_size) {
grpc_endpoint_pair endpoint_pair;
// TODO(mlumish): implement this properly under libuv
abort();
return endpoint_pair;
}
#endif /* GRPC_UV */

@ -32,7 +32,8 @@
*/
/* This header transitively includes other headers that care about include
* order, so it should be included first */
* order, so it should be included first. As a consequence, it should not be
* included in any other header. */
#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_H
#define GRPC_CORE_LIB_IOMGR_SOCKADDR_H

@ -38,7 +38,6 @@
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
/* Asynchronously connect to an address (specified as (addr, len)), and call
cb with arg and the completed connection when done (or call cb with arg and

@ -116,11 +116,11 @@ static void uv_tc_on_connect(uv_connect_t *req, int status) {
grpc_exec_ctx_finish(&exec_ctx);
}
void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
grpc_endpoint **ep,
grpc_pollset_set *interested_parties,
const grpc_resolved_address *resolved_addr,
gpr_timespec deadline) {
static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx,
grpc_closure *closure, grpc_endpoint **ep,
grpc_pollset_set *interested_parties,
const grpc_resolved_address *resolved_addr,
gpr_timespec deadline) {
grpc_uv_tcp_connect *connect;
(void)interested_parties;
connect = gpr_malloc(sizeof(grpc_uv_tcp_connect));
@ -141,4 +141,19 @@ void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
uv_tc_on_alarm, connect, gpr_now(GPR_CLOCK_MONOTONIC));
}
// overridden by api_fuzzer.c
void (*grpc_tcp_client_connect_impl)(
grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep,
grpc_pollset_set *interested_parties, const grpc_resolved_address *addr,
gpr_timespec deadline) = tcp_client_connect_impl;
void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
grpc_endpoint **ep,
grpc_pollset_set *interested_parties,
const grpc_resolved_address *addr,
gpr_timespec deadline) {
grpc_tcp_client_connect_impl(exec_ctx, closure, ep, interested_parties, addr,
deadline);
}
#endif /* GRPC_UV */

@ -135,7 +135,7 @@ static void read_callback(uv_stream_t *stream, ssize_t nread,
error = GRPC_ERROR_CREATE("EOF");
} else if (nread > 0) {
// Successful read
sub = gpr_slice_sub_no_ref(tcp->read_slice, 0, nread);
sub = gpr_slice_sub_no_ref(tcp->read_slice, 0, (size_t)nread);
gpr_slice_buffer_add(tcp->read_slices, sub);
error = GRPC_ERROR_NONE;
if (grpc_tcp_trace) {
@ -217,10 +217,10 @@ static void uv_endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
uv_write_t *write_req;
if (grpc_tcp_trace) {
size_t i;
size_t j;
for (i = 0; i < write_slices->count; i++) {
char *data = gpr_dump_slice(write_slices->slices[i],
for (j = 0; j < write_slices->count; j++) {
char *data = gpr_dump_slice(write_slices->slices[j],
GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "WRITE %p (peer=%s): %s", tcp, tcp->peer_string, data);
gpr_free(data);

@ -97,6 +97,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/iomgr/combiner.c',
'src/core/lib/iomgr/endpoint.c',
'src/core/lib/iomgr/endpoint_pair_posix.c',
'src/core/lib/iomgr/endpoint_pair_uv.c',
'src/core/lib/iomgr/endpoint_pair_windows.c',
'src/core/lib/iomgr/error.c',
'src/core/lib/iomgr/ev_epoll_linux.c',

@ -219,10 +219,6 @@
HOST_LD ?= $(LD)
HOST_LDXX ?= $(LDXX)
ifdef EXTRA_DEFINES
DEFINES += $(EXTRA_DEFINES)
endif
CFLAGS += -std=c99 -Wsign-conversion -Wconversion ${' '.join(warning_var('$(W_%s)', warning) for warning in PREFERRED_WARNINGS)}
ifeq ($(HAS_CXX11),true)
CXXFLAGS += -std=c++11
@ -324,6 +320,11 @@
LDLIBS += $(addprefix -l, $(LIBS))
LDLIBSXX += $(addprefix -l, $(LIBSXX))
% for arg in ['CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'DEFINES', 'LDLIBS']:
${arg} += $(EXTRA_${arg})
% endfor
HOST_CPPFLAGS = $(CPPFLAGS)
HOST_CFLAGS = $(CFLAGS)
HOST_CXXFLAGS = $(CXXFLAGS)

@ -10,6 +10,7 @@
"ci_platforms": tgt.ci_platforms,
"gtest": tgt.gtest,
"exclude_configs": tgt.get("exclude_configs", []),
"exclude_iomgrs": tgt.get("exclude_iomgrs", []),
"args": [],
"flaky": tgt.flaky,
"cpu_cost": tgt.get("cpu_cost", 1.0)}

@ -30,6 +30,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/lib/iomgr/sockaddr.h"
#include <string.h>
#include <grpc/grpc.h>
@ -40,7 +42,6 @@
#include <grpc/support/thd.h>
#include "src/core/ext/client_config/initial_connect_string.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/security/credentials/fake/fake_credentials.h"
#include "src/core/lib/support/string.h"
#include "test/core/util/port.h"

@ -30,6 +30,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/lib/iomgr/sockaddr.h"
#include <string.h>
#include <grpc/grpc.h>
@ -40,7 +42,6 @@
#include <grpc/support/thd.h>
// #include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/support/string.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/port.h"

@ -32,6 +32,7 @@
*/
#include "test/core/end2end/cq_verifier.h"
#include "test/core/end2end/cq_verifier_internal.h"
#include <stdarg.h>
#include <stdio.h>
@ -59,35 +60,15 @@ typedef struct metadata {
/* details what we expect to find on a single event - and forms a linked
list to detail other expectations */
typedef struct expectation {
struct expectation {
struct expectation *next;
const char *file;
int line;
grpc_completion_type type;
void *tag;
int success;
} expectation;
/* the verifier itself */
struct cq_verifier {
/* bound completion queue */
grpc_completion_queue *cq;
/* start of expectation list */
expectation *first_expectation;
};
cq_verifier *cq_verifier_create(grpc_completion_queue *cq) {
cq_verifier *v = gpr_malloc(sizeof(cq_verifier));
v->cq = cq;
v->first_expectation = NULL;
return v;
}
void cq_verifier_destroy(cq_verifier *v) {
cq_verify(v);
gpr_free(v);
}
static int has_metadata(const grpc_metadata *md, size_t count, const char *key,
const char *value) {
size_t i;
@ -197,7 +178,7 @@ static void expectation_to_strvec(gpr_strvec *buf, expectation *e) {
static void expectations_to_strvec(gpr_strvec *buf, cq_verifier *v) {
expectation *e;
for (e = v->first_expectation; e != NULL; e = e->next) {
for (e = cq_verifier_get_first_expectation(v); e != NULL; e = e->next) {
expectation_to_strvec(buf, e);
gpr_strvec_add(buf, gpr_strdup("\n"));
}
@ -217,19 +198,19 @@ static void fail_no_event_received(cq_verifier *v) {
}
void cq_verify(cq_verifier *v) {
const gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10);
while (v->first_expectation != NULL) {
grpc_event ev = grpc_completion_queue_next(v->cq, deadline, NULL);
int timeout_seconds = 10;
while (cq_verifier_get_first_expectation(v) != NULL) {
grpc_event ev = cq_verifier_next_event(v, timeout_seconds);
if (ev.type == GRPC_QUEUE_TIMEOUT) {
fail_no_event_received(v);
break;
}
expectation *e;
expectation *prev = NULL;
for (e = v->first_expectation; e != NULL; e = e->next) {
for (e = cq_verifier_get_first_expectation(v); e != NULL; e = e->next) {
if (e->tag == ev.tag) {
verify_matches(e, &ev);
if (e == v->first_expectation) v->first_expectation = e->next;
if (e == cq_verifier_get_first_expectation(v)) cq_verifier_set_first_expectation(v, e->next);
if (prev != NULL) prev->next = e->next;
gpr_free(e);
break;
@ -253,14 +234,11 @@ void cq_verify(cq_verifier *v) {
}
void cq_verify_empty_timeout(cq_verifier *v, int timeout_sec) {
gpr_timespec deadline =
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_seconds(timeout_sec, GPR_TIMESPAN));
grpc_event ev;
GPR_ASSERT(v->first_expectation == NULL && "expectation queue must be empty");
GPR_ASSERT(cq_verifier_get_first_expectation(v) == NULL && "expectation queue must be empty");
ev = grpc_completion_queue_next(v->cq, deadline, NULL);
ev = cq_verifier_next_event(v, timeout_sec);
if (ev.type != GRPC_QUEUE_TIMEOUT) {
char *s = grpc_event_string(&ev);
gpr_log(GPR_ERROR, "unexpected event (expected nothing): %s", s);
@ -279,8 +257,8 @@ static void add(cq_verifier *v, const char *file, int line,
e->line = line;
e->tag = tag;
e->success = success;
e->next = v->first_expectation;
v->first_expectation = e;
e->next = cq_verifier_get_first_expectation(v);
cq_verifier_set_first_expectation(v, e);
}
void cq_expect_completion(cq_verifier *v, const char *file, int line, void *tag,

@ -0,0 +1,47 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_TEST_CORE_END2END_CQ_VERIFIER_INTERNAL_H
#define GRPC_TEST_CORE_END2END_CQ_VERIFIER_INTERNAL_H
#include "test/core/end2end/cq_verifier.h"
typedef struct expectation expectation;
expectation *cq_verifier_get_first_expectation(cq_verifier *v);
void cq_verifier_set_first_expectation(cq_verifier *v, expectation *e);
grpc_event cq_verifier_next_event(cq_verifier *v, int timeout_seconds);
#endif /* GRPC_TEST_CORE_END2END_CQ_VERIFIER_INTERNAL_H */

@ -0,0 +1,73 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/* This check is for testing only. */
#ifndef GRPC_UV
#include "test/core/end2end/cq_verifier_internal.h"
/* the verifier itself */
struct cq_verifier {
/* bound completion queue */
grpc_completion_queue *cq;
/* start of expectation list */
expectation *first_expectation;
uv_timer_t timer;
};
cq_verifier *cq_verifier_create(grpc_completion_queue *cq) {
cq_verifier *v = gpr_malloc(sizeof(cq_verifier));
v->cq = cq;
cq_verifier_set_first_expectation(v,NULL);
return v;
}
void cq_verifier_destroy(cq_verifier *v) {
cq_verify(v);
gpr_free(v);
}
expectation *cq_verifier_get_first_expectation(cq_verifier *v) {
return v->first_expectation;
}
void cq_verifier_set_first_expectation(cq_verifier *v, expectation *e) {
v->first_expectation = e;
}
grpc_event cq_verifier_next_event(cq_verifier *v, int timeout_seconds) {
const gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(timeout_seconds);
return grpc_completion_queue_next(v->cq, deadline, NULL);
}
#endif /* GRPC_UV */

@ -0,0 +1,108 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <grpc/support/port_platform.h>
#ifdef GRPC_UV
#include <uv.h>
#include <grpc/support/alloc.h>
#include "test/core/end2end/cq_verifier_internal.h"
typedef enum timer_state {
TIMER_STARTED,
TIMER_TRIGGERED,
TIMER_CLOSED
} timer_state;
/* the verifier itself */
struct cq_verifier {
/* bound completion queue */
grpc_completion_queue *cq;
/* start of expectation list */
expectation *first_expectation;
uv_timer_t timer;
};
cq_verifier *cq_verifier_create(grpc_completion_queue *cq) {
cq_verifier *v = gpr_malloc(sizeof(cq_verifier));
v->cq = cq;
v->first_expectation = NULL;
uv_timer_init(uv_default_loop(), &v->timer);
v->timer.data = (void *)TIMER_STARTED;
return v;
}
void timer_close_cb(uv_handle_t *handle) {
handle->data = (void *)TIMER_CLOSED;
}
void cq_verifier_destroy(cq_verifier *v) {
cq_verify(v);
uv_close((uv_handle_t *)&v->timer, timer_close_cb);
while ((timer_state)v->timer.data != TIMER_CLOSED) {
uv_run(uv_default_loop(), UV_RUN_NOWAIT);
}
gpr_free(v);
}
expectation *cq_verifier_get_first_expectation(cq_verifier *v) {
return v->first_expectation;
}
void cq_verifier_set_first_expectation(cq_verifier *v, expectation *e) {
v->first_expectation = e;
}
void timer_run_cb(uv_timer_t *timer) {
timer->data = (void *)TIMER_TRIGGERED;
}
grpc_event cq_verifier_next_event(cq_verifier *v, int timeout_seconds) {
uint64_t timeout_ms = timeout_seconds < 0 ? 0 : (uint64_t)timeout_seconds * 1000;
grpc_event ev;
v->timer.data = (void *)TIMER_STARTED;
uv_timer_start(&v->timer, timer_run_cb, timeout_ms, 0);
ev = grpc_completion_queue_next(v->cq, gpr_inf_past(GPR_CLOCK_MONOTONIC), NULL);
// Stop the loop if the timer goes off or we get a non-timeout event
while (((timer_state)v->timer.data != TIMER_TRIGGERED) &&
ev.type == GRPC_QUEUE_TIMEOUT){
uv_run(uv_default_loop(), UV_RUN_ONCE);
ev = grpc_completion_queue_next(v->cq, gpr_inf_past(GPR_CLOCK_MONOTONIC), NULL);
}
return ev;
}
#endif /* GRPC_UV */

@ -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 <string.h>
#include <grpc/grpc.h>
@ -353,3 +358,11 @@ int main(int argc, char **argv) {
return 0;
}
#else /* GRPC_POSIX_SOCKET */
int main(int argc, char **argv) {
return 1;
}
#endif /* GRPC_POSIX_SOCKET */

@ -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>
@ -126,3 +131,11 @@ int main(int argc, char **argv) {
return 0;
}
#else /* GRPC_POSIX_SOCKET */
int main(int argc, char **argv) {
return 1;
}
#endif /* GRPC_POSIX_SOCKET */

@ -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>
@ -119,3 +124,11 @@ 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 */

@ -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>

@ -231,8 +231,8 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr,
// defined in tcp_client_posix.c
extern void (*grpc_tcp_client_connect_impl)(
grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep,
grpc_pollset_set *interested_parties, const struct sockaddr *addr,
size_t addr_len, gpr_timespec deadline);
grpc_pollset_set *interested_parties, const grpc_resolved_address *addr,
gpr_timespec deadline);
static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
grpc_endpoint **ep, gpr_timespec deadline);
@ -289,7 +289,7 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
static void my_tcp_client_connect(grpc_exec_ctx *exec_ctx,
grpc_closure *closure, grpc_endpoint **ep,
grpc_pollset_set *interested_parties,
const struct sockaddr *addr, size_t addr_len,
const grpc_resolved_address *addr,
gpr_timespec deadline) {
sched_connect(exec_ctx, closure, ep, deadline);
}

@ -39,9 +39,9 @@ import hashlib
FixtureOptions = collections.namedtuple(
'FixtureOptions',
'fullstack includes_proxy dns_resolver secure platforms ci_mac tracing exclude_configs')
'fullstack includes_proxy dns_resolver secure platforms ci_mac tracing exclude_configs exclude_iomgrs')
default_unsecure_fixture_options = FixtureOptions(
True, False, True, False, ['windows', 'linux', 'mac', 'posix'], True, False, [])
True, False, True, False, ['windows', 'linux', 'mac', 'posix'], True, False, [], [])
socketpair_unsecure_fixture_options = default_unsecure_fixture_options._replace(fullstack=False, dns_resolver=False)
default_secure_fixture_options = default_unsecure_fixture_options._replace(secure=True)
uds_fixture_options = default_unsecure_fixture_options._replace(dns_resolver=False, platforms=['linux', 'mac', 'posix'])
@ -58,7 +58,7 @@ END2END_FIXTURES = {
'h2_fd': fd_unsecure_fixture_options,
'h2_full': default_unsecure_fixture_options,
'h2_full+pipe': default_unsecure_fixture_options._replace(
platforms=['linux']),
platforms=['linux'], exclude_iomgrs=['uv']),
'h2_full+trace': default_unsecure_fixture_options._replace(tracing=True),
'h2_http_proxy': default_unsecure_fixture_options._replace(ci_mac=False),
'h2_oauth2': default_secure_fixture_options._replace(ci_mac=False),
@ -280,7 +280,7 @@ def main():
)
}
print yaml.dump(json)
p
if __name__ == '__main__':
main()

@ -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 "src/core/lib/iomgr/ev_posix.h"
#include <ctype.h>
@ -548,3 +553,11 @@ int main(int argc, char **argv) {
grpc_iomgr_shutdown();
return 0;
}
#else /* GRPC_POSIX_SOCKET */
int main(int argc, char **argv) {
return 1;
}
#endif /* GRPC_POSIX_SOCKET */

@ -31,7 +31,11 @@
*
*/
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/port.h"
// This test won't work except with posix sockets enabled
#ifdef GRPC_POSIX_SOCKET
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include <errno.h>
@ -68,3 +72,11 @@ int main(int argc, char **argv) {
return 0;
}
#else /* GRPC_POSIX_SOCKET */
int main(int argc, char **argv) {
return 1;
}
#endif /* GRPC_POSIX_SOCKET */

@ -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 "src/core/lib/iomgr/tcp_posix.h"
#include <errno.h>
@ -544,3 +549,11 @@ int main(int argc, char **argv) {
return 0;
}
#else /* GRPC_POSIX_SOCKET */
int main(int argc, char **argv) {
return 1;
}
#endif /* GRPC_POSIX_SOCKET */

@ -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 "src/core/lib/iomgr/tcp_server.h"
#include <errno.h>
@ -360,3 +365,11 @@ int main(int argc, char **argv) {
gpr_free(g_pollset);
return 0;
}
#else /* GRPC_POSIX_SOCKET */
int main(int argc, char **argv) {
return 1;
}
#endif /* GRPC_POSIX_SOCKET */

@ -31,6 +31,11 @@
*
*/
#include "src/core/lib/iomgr/port.h"
// This test only works with the generic timer implementation
#ifdef GRPC_TIMER_USE_GENERIC
#include "src/core/lib/iomgr/timer_heap.h"
#include <stdlib.h>
@ -315,3 +320,11 @@ int main(int argc, char **argv) {
return 0;
}
#else /* GRPC_TIMER_USE_GENERIC */
int main(int argc, char **argv) {
return 1;
}
#endif /* GRPC_TIMER_USE_GENERIC */

@ -80,7 +80,7 @@ void grpc_free_port_using_server(char *server, int port) {
grpc_httpcli_response rsp;
freereq pr;
char *path;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_RUN_INNER_LOOP;
grpc_closure *shutdown_closure;
grpc_init();

@ -0,0 +1,58 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/lib/iomgr/port.h"
#include "test/core/util/test_config.h"
#if defined(GRPC_UV) && defined(GRPC_TEST_PICK_PORT)
#include <grpc/support/log.h>
#include "test/core/util/port.h"
int grpc_pick_unused_port(void) {
// Temporary implementation
return 4242;
}
int grpc_pick_unused_port_or_die(void) {
int port = grpc_pick_unused_port();
GPR_ASSERT(port > 0);
return port;
}
void grpc_recycle_unused_port(int port) {
// Temporary implementation
(void)port;
}
#endif /* GRPC_UV && GRPC_TEST_PICK_PORT */

@ -1011,6 +1011,7 @@ src/core/lib/iomgr/closure.c \
src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \
src/core/lib/iomgr/endpoint_pair_posix.c \
src/core/lib/iomgr/endpoint_pair_uv.c \
src/core/lib/iomgr/endpoint_pair_windows.c \
src/core/lib/iomgr/error.c \
src/core/lib/iomgr/ev_epoll_linux.c \

@ -976,6 +976,7 @@ src/core/lib/iomgr/closure.c \
src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \
src/core/lib/iomgr/endpoint_pair_posix.c \
src/core/lib/iomgr/endpoint_pair_uv.c \
src/core/lib/iomgr/endpoint_pair_windows.c \
src/core/lib/iomgr/error.c \
src/core/lib/iomgr/ev_epoll_linux.c \

@ -83,7 +83,7 @@ _DEFAULT_TIMEOUT_SECONDS = 5 * 60
# SimpleConfig: just compile with CONFIG=config, and run the binary to test
class Config(object):
def __init__(self, config, environ=None, timeout_multiplier=1, tool_prefix=[]):
def __init__(self, config, environ=None, timeout_multiplier=1, tool_prefix=[], iomgr_platform='native'):
if environ is None:
environ = {}
self.build_config = config
@ -91,6 +91,7 @@ class Config(object):
self.environ['CONFIG'] = config
self.tool_prefix = tool_prefix
self.timeout_multiplier = timeout_multiplier
self.iomgr_platform = iomgr_platform
def job_spec(self, cmdline, timeout_seconds=_DEFAULT_TIMEOUT_SECONDS,
shortname=None, environ={}, cpu_cost=1.0, flaky=False):
@ -202,6 +203,18 @@ class CLanguage(object):
else:
self._docker_distro, self._make_options = self._compiler_options(self.args.use_docker,
self.args.compiler)
if args.iomgr_platform == "uv":
cflags = '-DGRPC_UV '
try:
cflags += subprocess.check_output(['pkg-config', '--cflags', 'libuv']).strip() + ' '
except subprocess.CalledProcessError:
pass
try:
ldflags = subprocess.check_output(['pkg-config', '--libs', 'libuv']).strip() + ' '
except subprocess.CalledProcessError:
ldflags = '-luv '
self._make_options += ['EXTRA_CPPFLAGS={}'.format(cflags),
'EXTRA_LDLIBS={}'.format(ldflags)]
def test_specs(self):
out = []
@ -218,6 +231,8 @@ class CLanguage(object):
shortname_ext = '' if polling_strategy=='all' else ' GRPC_POLL_STRATEGY=%s' % polling_strategy
if self.config.build_config in target['exclude_configs']:
continue
if self.args.iomgr_platform in target.get('exclude_iomgrs', []):
continue
if self.platform == 'windows':
binary = 'vsprojects/%s%s/%s.exe' % (
'x64/' if self.args.arch == 'x64' else '',
@ -1003,6 +1018,10 @@ argp.add_argument('--compiler',
'coreclr'],
default='default',
help='Selects compiler to use. Allowed values depend on the platform and language.')
argp.add_argument('--iomgr_platform',
choices=['native', 'uv'],
default='native',
help='Selects iomgr platform to build on')
argp.add_argument('--build_only',
default=False,
action='store_const',

@ -6111,6 +6111,7 @@
"src/core/lib/iomgr/endpoint.h",
"src/core/lib/iomgr/endpoint_pair.h",
"src/core/lib/iomgr/endpoint_pair_posix.c",
"src/core/lib/iomgr/endpoint_pair_uv.c",
"src/core/lib/iomgr/endpoint_pair_windows.c",
"src/core/lib/iomgr/error.c",
"src/core/lib/iomgr/error.h",
@ -6549,6 +6550,7 @@
],
"headers": [
"test/core/end2end/cq_verifier.h",
"test/core/end2end/cq_verifier_internal.h",
"test/core/end2end/fixtures/http_proxy.h",
"test/core/end2end/fixtures/proxy.h",
"test/core/iomgr/endpoint_tests.h",
@ -6566,6 +6568,9 @@
"src": [
"test/core/end2end/cq_verifier.c",
"test/core/end2end/cq_verifier.h",
"test/core/end2end/cq_verifier_internal.h",
"test/core/end2end/cq_verifier_native.c",
"test/core/end2end/cq_verifier_uv.c",
"test/core/end2end/fixtures/http_proxy.c",
"test/core/end2end/fixtures/http_proxy.h",
"test/core/end2end/fixtures/proxy.c",
@ -6586,6 +6591,7 @@
"test/core/util/port_posix.c",
"test/core/util/port_server_client.c",
"test/core/util/port_server_client.h",
"test/core/util/port_uv.c",
"test/core/util/port_windows.c",
"test/core/util/slice_splitter.c",
"test/core/util/slice_splitter.h"

File diff suppressed because it is too large Load Diff

@ -565,6 +565,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_posix.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_uv.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_windows.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\error.c">

@ -157,6 +157,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_posix.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_uv.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_windows.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>

@ -551,6 +551,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_posix.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_uv.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_windows.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\error.c">

@ -142,6 +142,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_posix.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_uv.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_windows.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>

@ -507,6 +507,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_posix.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_uv.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_windows.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\error.c">

@ -61,6 +61,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_posix.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_uv.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_windows.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>

@ -176,6 +176,7 @@
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\data\ssl_test_data.h" />
<ClInclude Include="$(SolutionDir)\..\test\core\security\oauth2_utils.h" />
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\cq_verifier.h" />
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_internal.h" />
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\fixtures\http_proxy.h" />
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\fixtures\proxy.h" />
<ClInclude Include="$(SolutionDir)\..\test\core\iomgr\endpoint_tests.h" />
@ -290,6 +291,10 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_native.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_uv.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\fixtures\http_proxy.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\fixtures\proxy.c">
@ -310,6 +315,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_server_client.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_uv.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_windows.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\slice_splitter.c">
@ -352,6 +359,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_posix.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_uv.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_windows.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\error.c">

@ -19,6 +19,12 @@
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier.c">
<Filter>test\core\end2end</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_native.c">
<Filter>test\core\end2end</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_uv.c">
<Filter>test\core\end2end</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\fixtures\http_proxy.c">
<Filter>test\core\end2end\fixtures</Filter>
</ClCompile>
@ -49,6 +55,9 @@
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_server_client.c">
<Filter>test\core\util</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_uv.c">
<Filter>test\core\util</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_windows.c">
<Filter>test\core\util</Filter>
</ClCompile>
@ -112,6 +121,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_posix.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_uv.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_windows.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
@ -446,6 +458,9 @@
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\cq_verifier.h">
<Filter>test\core\end2end</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_internal.h">
<Filter>test\core\end2end</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\fixtures\http_proxy.h">
<Filter>test\core\end2end\fixtures</Filter>
</ClInclude>

@ -148,6 +148,7 @@
<ItemGroup>
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\cq_verifier.h" />
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_internal.h" />
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\fixtures\http_proxy.h" />
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\fixtures\proxy.h" />
<ClInclude Include="$(SolutionDir)\..\test\core\iomgr\endpoint_tests.h" />
@ -163,6 +164,10 @@
<ItemGroup>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_native.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_uv.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\fixtures\http_proxy.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\fixtures\proxy.c">
@ -183,6 +188,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_server_client.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_uv.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_windows.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\slice_splitter.c">

@ -4,6 +4,12 @@
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier.c">
<Filter>test\core\end2end</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_native.c">
<Filter>test\core\end2end</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_uv.c">
<Filter>test\core\end2end</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\fixtures\http_proxy.c">
<Filter>test\core\end2end\fixtures</Filter>
</ClCompile>
@ -34,6 +40,9 @@
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_server_client.c">
<Filter>test\core\util</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_uv.c">
<Filter>test\core\util</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\util\port_windows.c">
<Filter>test\core\util</Filter>
</ClCompile>
@ -45,6 +54,9 @@
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\cq_verifier.h">
<Filter>test\core\end2end</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\cq_verifier_internal.h">
<Filter>test\core\end2end</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\test\core\end2end\fixtures\http_proxy.h">
<Filter>test\core\end2end\fixtures</Filter>
</ClInclude>

@ -475,6 +475,8 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_posix.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_uv.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_windows.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\error.c">

@ -64,6 +64,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_posix.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_uv.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint_pair_windows.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>

Loading…
Cancel
Save