diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-06-11 16:33:15 -0700 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-06-11 16:33:15 -0700 |
commit | dddf20793269a7ba5f658ae5fdcde2c175cf196b (patch) | |
tree | 595d0fbc0c501132857b63f00f073ec6a0f54f58 | |
parent | 935ae7d01242c21f0230ead18927087a70c03e5b (diff) | |
parent | 37b292a0f7500e434c9ae41919248e2641ddc7f1 (diff) |
Merge branch 'master' into epollerr
211 files changed, 6240 insertions, 1551 deletions
@@ -72,6 +72,13 @@ disable= # TODO(https://github.com/grpc/grpc/issues/261): Maybe we could have # this one if we extracted just a few more helper functions... too-many-nested-blocks, - # NOTE(nathaniel): I have disputed the premise of this inspection from - # the beginning and will continue to do so until it goes away for good. + # TODO(https://github.com/grpc/grpc/issues/261): Disable unnecessary + # super-init requirement for abstract class implementations for now. + super-init-not-called, + # NOTE(nathaniel): A single statement that always returns program + # control is better than two statements the first of which sometimes + # returns program control and the second of which always returns + # program control. Probably generally, but definitely in the cases of + # if:/else: and for:/else:. useless-else-on-loop, + no-else-return, diff --git a/.pylintrc-tests b/.pylintrc-tests index b358b2c4a0..ebe9d507cd 100644 --- a/.pylintrc-tests +++ b/.pylintrc-tests @@ -103,6 +103,13 @@ disable= # TODO(https://github.com/grpc/grpc/issues/261): Maybe we could have # this one if we extracted just a few more helper functions... too-many-nested-blocks, - # NOTE(nathaniel): I have disputed the premise of this inspection from - # the beginning and will continue to do so until it goes away for good. + # TODO(https://github.com/grpc/grpc/issues/261): Disable unnecessary + # super-init requirement for abstract class implementations for now. + super-init-not-called, + # NOTE(nathaniel): A single statement that always returns program + # control is better than two statements the first of which sometimes + # returns program control and the second of which always returns + # program control. Probably generally, but definitely in the cases of + # if:/else: and for:/else:. useless-else-on-loop, + no-else-return, @@ -1004,6 +1004,25 @@ grpc_cc_library( ) grpc_cc_library( + name = "grpc_cfstream", + srcs = [ + "src/core/lib/iomgr/cfstream_handle.cc", + "src/core/lib/iomgr/endpoint_cfstream.cc", + "src/core/lib/iomgr/error_cfstream.cc", + "src/core/lib/iomgr/tcp_client_cfstream.cc", + ], + hdrs = [ + "src/core/lib/iomgr/cfstream_handle.h", + "src/core/lib/iomgr/endpoint_cfstream.h", + "src/core/lib/iomgr/error_cfstream.h", + ], + deps = [ + ":gpr_base", + ":grpc_base", + ], +) + +grpc_cc_library( name = "grpc_client_channel", srcs = [ "src/core/ext/filters/client_channel/backup_poller.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index af56886cd9..ca9a1eb679 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -700,6 +700,7 @@ target_include_directories(address_sorting ) target_link_libraries(address_sorting + ${_gRPC_BASELIB_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} ) @@ -5297,6 +5298,7 @@ add_library(end2end_tests test/core/end2end/tests/max_message_length.cc test/core/end2end/tests/negative_deadline.cc test/core/end2end/tests/network_status_change.cc + test/core/end2end/tests/no_error_on_hotpath.cc test/core/end2end/tests/no_logging.cc test/core/end2end/tests/no_op.cc test/core/end2end/tests/payload.cc @@ -5415,6 +5417,7 @@ add_library(end2end_nosec_tests test/core/end2end/tests/max_message_length.cc test/core/end2end/tests/negative_deadline.cc test/core/end2end/tests/network_status_change.cc + test/core/end2end/tests/no_error_on_hotpath.cc test/core/end2end/tests/no_logging.cc test/core/end2end/tests/no_op.cc test/core/end2end/tests/payload.cc @@ -501,7 +501,6 @@ endif ifeq ($(HAS_PKG_CONFIG),true) OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl -OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl ZLIB_CHECK_CMD = $(PKG_CONFIG) --exists zlib PROTOBUF_CHECK_CMD = $(PKG_CONFIG) --atleast-version=3.5.0 protobuf CARES_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.11.0 libcares @@ -514,7 +513,6 @@ OPENSSL_LIBS = ssl crypto endif OPENSSL_ALPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) -OPENSSL_NPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-npn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) BORINGSSL_COMPILE_CHECK_CMD = $(CC) $(CPPFLAGS) -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare -Wno-implicit-fallthrough $(NO_W_EXTRA_SEMI) -o $(TMPOUT) test/build/boringssl.c $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) @@ -542,13 +540,7 @@ HAS_SYSTEM_PROTOBUF_VERIFY = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) HAS_SYSTEM_OPENSSL_ALPN ?= $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) -HAS_SYSTEM_OPENSSL_NPN = true CACHE_MK += HAS_SYSTEM_OPENSSL_ALPN = true, -else -HAS_SYSTEM_OPENSSL_NPN ?= $(shell $(OPENSSL_NPN_CHECK_CMD) 2> /dev/null && echo true || echo false) -endif -ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) -CACHE_MK += HAS_SYSTEM_OPENSSL_NPN = true, endif HAS_SYSTEM_ZLIB ?= $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_SYSTEM_ZLIB),true) @@ -565,7 +557,6 @@ endif else # override system libraries if the config requires a custom compiled library HAS_SYSTEM_OPENSSL_ALPN = false -HAS_SYSTEM_OPENSSL_NPN = false HAS_SYSTEM_ZLIB = false HAS_SYSTEM_PROTOBUF = false HAS_SYSTEM_CARES = false @@ -712,12 +703,7 @@ ifneq ($(HAS_EMBEDDED_OPENSSL_ALPN),false) EMBED_OPENSSL ?= $(HAS_EMBEDDED_OPENSSL_ALPN) NO_SECURE ?= false else # HAS_EMBEDDED_OPENSSL_ALPN=false -ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) -EMBED_OPENSSL ?= false -NO_SECURE ?= false -else NO_SECURE ?= true -endif # HAS_SYSTEM_OPENSSL_NPN=true endif # HAS_EMBEDDED_OPENSSL_ALPN endif # HAS_SYSTEM_OPENSSL_ALPN @@ -751,10 +737,10 @@ LDFLAGS := $(LDFLAGS_OPENSSL_PKG_CONFIG) $(LDFLAGS) else # HAS_PKG_CONFIG=false LIBS_SECURE = $(OPENSSL_LIBS) endif # HAS_PKG_CONFIG -ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) +ifeq ($(DISABLE_ALPN),true) CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 LIBS_SECURE = $(OPENSSL_LIBS) -endif # HAS_SYSTEM_OPENSSL_NPN +endif # DISABLE_ALPN PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) endif # EMBED_OPENSSL endif # NO_SECURE @@ -1347,7 +1333,6 @@ uri_fuzzer_test_one_entry: $(BINDIR)/$(CONFIG)/uri_fuzzer_test_one_entry run_dep_checks: $(OPENSSL_ALPN_CHECK_CMD) || true - $(OPENSSL_NPN_CHECK_CMD) || true $(ZLIB_CHECK_CMD) || true $(PERFTOOLS_CHECK_CMD) || true $(PROTOBUF_CHECK_CMD) || true @@ -10006,6 +9991,7 @@ LIBEND2END_TESTS_SRC = \ test/core/end2end/tests/max_message_length.cc \ test/core/end2end/tests/negative_deadline.cc \ test/core/end2end/tests/network_status_change.cc \ + test/core/end2end/tests/no_error_on_hotpath.cc \ test/core/end2end/tests/no_logging.cc \ test/core/end2end/tests/no_op.cc \ test/core/end2end/tests/payload.cc \ @@ -10122,6 +10108,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \ test/core/end2end/tests/max_message_length.cc \ test/core/end2end/tests/negative_deadline.cc \ test/core/end2end/tests/network_status_change.cc \ + test/core/end2end/tests/no_error_on_hotpath.cc \ test/core/end2end/tests/no_logging.cc \ test/core/end2end/tests/no_op.cc \ test/core/end2end/tests/payload.cc \ diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl index 5216a7a44b..3288565714 100644 --- a/bazel/cc_grpc_library.bzl +++ b/bazel/cc_grpc_library.bzl @@ -43,12 +43,7 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo ) if not proto_only: - if use_external: - # when this file is used by non-grpc projects - plugin = "//external:grpc_cpp_plugin" - else: - plugin = "//:grpc_cpp_plugin" - + plugin = "@com_github_grpc_grpc//:grpc_cpp_plugin" generate_cc( name = codegen_grpc_target, srcs = [proto_target], @@ -57,14 +52,8 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo generate_mocks = generate_mocks, **kwargs ) - - if use_external: - # when this file is used by non-grpc projects - grpc_deps = ["//external:grpc++_codegen_proto", - "//external:protobuf"] - else: - grpc_deps = ["//:grpc++_codegen_proto", "//external:protobuf"] - + grpc_deps = ["@com_github_grpc_grpc//:grpc++_codegen_proto", + "//external:protobuf"] native.cc_library( name = name, srcs = [":" + codegen_grpc_target, ":" + codegen_target], diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 53073941f3..162ec1f5f5 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -130,12 +130,12 @@ def grpc_deps(): if "com_github_bazelbuild_bazeltoolchains" not in native.existing_rules(): native.http_archive( name = "com_github_bazelbuild_bazeltoolchains", - strip_prefix = "bazel-toolchains-09c850dbb8e785ded3d23a7003e9a0168fe1fb2f", + strip_prefix = "bazel-toolchains-4653c01284d8a4a536f8f9bb47b7d10f94c549e7", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/09c850dbb8e785ded3d23a7003e9a0168fe1fb2f.tar.gz", - "https://github.com/bazelbuild/bazel-toolchains/archive/09c850dbb8e785ded3d23a7003e9a0168fe1fb2f.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/4653c01284d8a4a536f8f9bb47b7d10f94c549e7.tar.gz", + "https://github.com/bazelbuild/bazel-toolchains/archive/4653c01284d8a4a536f8f9bb47b7d10f94c549e7.tar.gz", ], - sha256 = "08e521cf2d0998e3d27a16c2e2542ebf4d3857b3ddadcfd145d128140754d7bd", + sha256 = "1c4a532b396c698e6467a1548554571cb85fa091e472b05e398ebc836c315d77", ) # TODO: move some dependencies from "grpc_deps" here? diff --git a/build.yaml b/build.yaml index 16c90fbd4c..ff87d5965a 100644 --- a/build.yaml +++ b/build.yaml @@ -536,6 +536,19 @@ filegroups: uses: - grpc_codegen - grpc_trace_headers +- name: grpc_cfstream + headers: + - src/core/lib/iomgr/cfstream_handle.h + - src/core/lib/iomgr/endpoint_cfstream.h + - src/core/lib/iomgr/error_cfstream.h + src: + - src/core/lib/iomgr/cfstream_handle.cc + - src/core/lib/iomgr/endpoint_cfstream.cc + - src/core/lib/iomgr/error_cfstream.cc + - src/core/lib/iomgr/tcp_client_cfstream.cc + uses: + - grpc_base_headers + - gpr_base_headers - name: grpc_client_authority_filter headers: - src/core/ext/filters/http/client_authority_filter.h diff --git a/examples/ruby/pubsub/.gitignore b/examples/ruby/pubsub/.gitignore new file mode 100644 index 0000000000..62fcb4fa94 --- /dev/null +++ b/examples/ruby/pubsub/.gitignore @@ -0,0 +1,15 @@ +/.bundle/ +/.yardoc +/Gemfile.lock +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ +*.bundle +*.so +*.o +*.a +mkmf.log +vendor diff --git a/examples/ruby/pubsub/Gemfile b/examples/ruby/pubsub/Gemfile new file mode 100644 index 0000000000..4ee8ffe3d6 --- /dev/null +++ b/examples/ruby/pubsub/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org/' + +gem 'grpc', '~> 1.0' +gem 'googleauth', '>= 0.5.1', '< 0.7' diff --git a/src/ruby/bin/apis/google/protobuf/empty.rb b/examples/ruby/pubsub/google/protobuf/empty.rb index 4743bded3d..4743bded3d 100644 --- a/src/ruby/bin/apis/google/protobuf/empty.rb +++ b/examples/ruby/pubsub/google/protobuf/empty.rb diff --git a/src/ruby/bin/apis/pubsub_demo.rb b/examples/ruby/pubsub/pubsub_demo.rb index c565771d45..c565771d45 100755 --- a/src/ruby/bin/apis/pubsub_demo.rb +++ b/examples/ruby/pubsub/pubsub_demo.rb diff --git a/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb b/examples/ruby/pubsub/tech/pubsub/proto/pubsub.rb index 73a0d5d9e4..73a0d5d9e4 100644 --- a/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +++ b/examples/ruby/pubsub/tech/pubsub/proto/pubsub.rb diff --git a/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb b/examples/ruby/pubsub/tech/pubsub/proto/pubsub_services.rb index b34db57b44..b34db57b44 100644 --- a/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +++ b/examples/ruby/pubsub/tech/pubsub/proto/pubsub_services.rb diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index f3be7129b5..a4d62a76c6 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -1080,6 +1080,24 @@ Pod::Spec.new do |s| 'src/core/ext/filters/workarounds/workaround_utils.h' end + s.subspec 'CFStream-Implementation' do |ss| + ss.header_mappings_dir = '.' + ss.dependency "#{s.name}/Implementation", version + ss.pod_target_xcconfig = { + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GRPC_CFSTREAM=1' + } + ss.source_files = 'src/core/lib/iomgr/cfstream_handle.cc', + 'src/core/lib/iomgr/endpoint_cfstream.cc', + 'src/core/lib/iomgr/error_cfstream.cc', + 'src/core/lib/iomgr/tcp_client_cfstream.cc', + 'src/core/lib/iomgr/cfstream_handle.h', + 'src/core/lib/iomgr/endpoint_cfstream.h', + 'src/core/lib/iomgr/error_cfstream.h' + ss.private_header_files = 'src/core/lib/iomgr/cfstream_handle.h', + 'src/core/lib/iomgr/endpoint_cfstream.h', + 'src/core/lib/iomgr/error_cfstream.h' + end + s.subspec 'Cronet-Interface' do |ss| ss.header_mappings_dir = 'include/grpc' ss.source_files = 'include/grpc/grpc_cronet.h' @@ -1198,6 +1216,7 @@ Pod::Spec.new do |s| 'test/core/end2end/tests/max_message_length.cc', 'test/core/end2end/tests/negative_deadline.cc', 'test/core/end2end/tests/network_status_change.cc', + 'test/core/end2end/tests/no_error_on_hotpath.cc', 'test/core/end2end/tests/no_logging.cc', 'test/core/end2end/tests/no_op.cc', 'test/core/end2end/tests/payload.cc', diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 17e650c264..039f3d412b 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -41,12 +41,25 @@ Pod::Spec.new do |s| s.header_dir = name src_dir = 'src/objective-c/ProtoRPC' - s.source_files = "#{src_dir}/*.{h,m}" - s.header_mappings_dir = "#{src_dir}" - s.dependency 'gRPC', version - s.dependency 'gRPC-RxLibrary', version - s.dependency 'Protobuf', '~> 3.0' + s.default_subspec = 'Main' + + s.subspec 'Main' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.dependency 'gRPC', version + ss.dependency 'gRPC-RxLibrary', version + ss.dependency 'Protobuf', '~> 3.0' + + ss.source_files = "#{src_dir}/*.{h,m}" + end + s.subspec 'CFStream' do |ss| + ss.dependency 'gRPC/CFStream', version + ss.dependency "#{s.name}/Main", version + ss.pod_target_xcconfig = { + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GRPC_CFSTREAM=1' + } + end + s.pod_target_xcconfig = { # This is needed by all pods that depend on Protobuf: 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', diff --git a/gRPC.podspec b/gRPC.podspec index afc4581091..a1d7720628 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -63,6 +63,16 @@ Pod::Spec.new do |s| ss.dependency 'gRPC-Core', version end + # This subspec is mutually exclusive with the `Main` subspec + s.subspec 'CFStream' do |ss| + ss.dependency 'gRPC-Core/CFStream-Implementation', version + ss.dependency "#{s.name}/Main", version + + ss.pod_target_xcconfig = { + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GRPC_CFSTREAM=1' + } + end + s.subspec 'GID' do |ss| ss.ios.deployment_target = '7.0' diff --git a/grpc.gemspec b/grpc.gemspec index 1e4722d635..5ab3713683 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -20,7 +20,9 @@ Gem::Specification.new do |s| s.files += Dir.glob('src/ruby/bin/**/*') s.files += Dir.glob('src/ruby/ext/**/*') s.files += Dir.glob('src/ruby/lib/**/*') - s.files += Dir.glob('src/ruby/pb/**/*') + s.files += Dir.glob('src/ruby/pb/**/*').reject do |f| + f.match(%r{^src/ruby/pb/test}) + end s.files += Dir.glob('include/grpc/**/*') s.test_files = Dir.glob('src/ruby/spec/**/*') s.bindir = 'src/ruby/bin' @@ -28,7 +30,6 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.add_dependency 'google-protobuf', '~> 3.1' - s.add_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.add_dependency 'googleapis-common-protos-types', '~> 1.0.0' s.add_development_dependency 'bundler', '~> 1.9' @@ -41,6 +42,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'rspec', '~> 3.6' s.add_development_dependency 'rubocop', '~> 0.49.1' s.add_development_dependency 'signet', '~> 0.7.0' + s.add_development_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.extensions = %w(src/ruby/ext/grpc/extconf.rb) @@ -2630,6 +2630,7 @@ 'test/core/end2end/tests/max_message_length.cc', 'test/core/end2end/tests/negative_deadline.cc', 'test/core/end2end/tests/network_status_change.cc', + 'test/core/end2end/tests/no_error_on_hotpath.cc', 'test/core/end2end/tests/no_logging.cc', 'test/core/end2end/tests/no_op.cc', 'test/core/end2end/tests/payload.cc', @@ -2720,6 +2721,7 @@ 'test/core/end2end/tests/max_message_length.cc', 'test/core/end2end/tests/negative_deadline.cc', 'test/core/end2end/tests/network_status_change.cc', + 'test/core/end2end/tests/no_error_on_hotpath.cc', 'test/core/end2end/tests/no_logging.cc', 'test/core/end2end/tests/no_op.cc', 'test/core/end2end/tests/payload.cc', diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 022be5fec4..9329c61bf2 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -332,7 +332,7 @@ typedef struct { #define GRPC_ARG_PER_RPC_RETRY_BUFFER_SIZE "grpc.per_rpc_retry_buffer_size" /** Channel arg that carries the bridged objective c object for custom metrics * logging filter. */ -#define GRPC_ARG_MOBILE_LOG_CONFIG "grpc.mobile_log_config" +#define GRPC_ARG_MOBILE_LOG_CONTEXT "grpc.mobile_log_context" /** If non-zero, client authority filter is disabled for the channel */ #define GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER \ "grpc.disable_client_authority_filter" diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index bf1bf3df6a..01ce5f03e9 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -227,7 +227,10 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +/* TODO(mxyan): Remove when CFStream becomes default */ +#ifndef GRPC_CFSTREAM #define GPR_SUPPORT_CHANNELS_FROM_FD 1 +#endif #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ diff --git a/include/grpcpp/impl/codegen/call.h b/include/grpcpp/impl/codegen/call.h index 28cc4a9e20..e324f6b14d 100644 --- a/include/grpcpp/impl/codegen/call.h +++ b/include/grpcpp/impl/codegen/call.h @@ -573,10 +573,13 @@ class CallOpClientRecvStatus { binary_error_details = grpc::string(iter->second.begin(), iter->second.length()); } - *recv_status_ = Status(static_cast<StatusCode>(status_code_), - grpc::string(GRPC_SLICE_START_PTR(error_message_), - GRPC_SLICE_END_PTR(error_message_)), - binary_error_details); + *recv_status_ = + Status(static_cast<StatusCode>(status_code_), + GRPC_SLICE_IS_EMPTY(error_message_) + ? grpc::string() + : grpc::string(GRPC_SLICE_START_PTR(error_message_), + GRPC_SLICE_END_PTR(error_message_)), + binary_error_details); client_context_->set_debug_error_string( debug_error_string_ != nullptr ? debug_error_string_ : ""); g_core_codegen_interface->grpc_slice_unref(error_message_); @@ -35,7 +35,7 @@ egg_info.manifest_maker.template = 'PYTHON-MANIFEST.in' PY3 = sys.version_info.major == 3 PYTHON_STEM = os.path.join('src', 'python', 'grpcio') CORE_INCLUDE = ('include', '.',) -BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) +SSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) CARES_INCLUDE = ( os.path.join('third_party', 'cares'), @@ -84,6 +84,24 @@ CLASSIFIERS = [ # present, then it will still attempt to use Cython. BUILD_WITH_CYTHON = os.environ.get('GRPC_PYTHON_BUILD_WITH_CYTHON', False) +# Export this variable to use the system installation of openssl. You need to +# have the header files installed (in /usr/include/openssl) and during +# runtime, the shared libary must be installed +BUILD_WITH_SYSTEM_OPENSSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_OPENSSL', + False) + +# Export this variable to use the system installation of zlib. You need to +# have the header files installed (in /usr/include/) and during +# runtime, the shared libary must be installed +BUILD_WITH_SYSTEM_ZLIB = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ZLIB', + False) + +# Export this variable to use the system installation of cares. You need to +# have the header files installed (in /usr/include/) and during +# runtime, the shared libary must be installed +BUILD_WITH_SYSTEM_CARES = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_CARES', + False) + # Environment variable to determine whether or not to enable coverage analysis # in Cython modules. ENABLE_CYTHON_TRACING = os.environ.get( @@ -148,8 +166,21 @@ CORE_C_FILES = tuple(grpc_core_dependencies.CORE_SOURCE_FILES) if "win32" in sys.platform: CORE_C_FILES = filter(lambda x: 'third_party/cares' not in x, CORE_C_FILES) +if BUILD_WITH_SYSTEM_OPENSSL: + CORE_C_FILES = filter(lambda x: 'third_party/boringssl' not in x, CORE_C_FILES) + CORE_C_FILES = filter(lambda x: 'src/boringssl' not in x, CORE_C_FILES) + SSL_INCLUDE = (os.path.join('/usr', 'include', 'openssl'),) + +if BUILD_WITH_SYSTEM_ZLIB: + CORE_C_FILES = filter(lambda x: 'third_party/zlib' not in x, CORE_C_FILES) + ZLIB_INCLUDE = (os.path.join('/usr', 'include'),) + +if BUILD_WITH_SYSTEM_CARES: + CORE_C_FILES = filter(lambda x: 'third_party/cares' not in x, CORE_C_FILES) + CARES_INCLUDE = (os.path.join('/usr', 'include'),) + EXTENSION_INCLUDE_DIRECTORIES = ( - (PYTHON_STEM,) + CORE_INCLUDE + BORINGSSL_INCLUDE + ZLIB_INCLUDE + + (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE + CARES_INCLUDE + ADDRESS_SORTING_INCLUDE) EXTENSION_LIBRARIES = () @@ -159,6 +190,12 @@ if not "win32" in sys.platform: EXTENSION_LIBRARIES += ('m',) if "win32" in sys.platform: EXTENSION_LIBRARIES += ('advapi32', 'ws2_32',) +if BUILD_WITH_SYSTEM_OPENSSL: + EXTENSION_LIBRARIES += ('ssl', 'crypto',) +if BUILD_WITH_SYSTEM_ZLIB: + EXTENSION_LIBRARIES += ('z',) +if BUILD_WITH_SYSTEM_CARES: + EXTENSION_LIBRARIES += ('cares',) DEFINE_MACROS = ( ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600), diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index 6e2730579a..1c51f6da94 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -590,19 +590,16 @@ void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor* service) { out->Print("{\n"); out->Indent(); - out->Print("return grpc::ServerServiceDefinition.CreateBuilder()\n"); + out->Print("return grpc::ServerServiceDefinition.CreateBuilder()"); out->Indent(); out->Indent(); for (int i = 0; i < service->method_count(); i++) { const MethodDescriptor* method = service->method(i); - out->Print(".AddMethod($methodfield$, serviceImpl.$methodname$)", + out->Print("\n.AddMethod($methodfield$, serviceImpl.$methodname$)", "methodfield", GetMethodFieldName(method), "methodname", method->name()); - if (i == service->method_count() - 1) { - out->Print(".Build();"); - } - out->Print("\n"); } + out->Print(".Build();\n"); out->Outdent(); out->Outdent(); @@ -676,20 +673,26 @@ grpc::string GetServices(const FileDescriptor* file, bool generate_client, out.PrintRaw(leading_comments.c_str()); } - out.Print("#pragma warning disable 1591\n"); + out.Print("#pragma warning disable 0414, 1591\n"); + out.Print("#region Designer generated code\n"); out.Print("\n"); out.Print("using grpc = global::Grpc.Core;\n"); out.Print("\n"); - out.Print("namespace $namespace$ {\n", "namespace", GetFileNamespace(file)); - out.Indent(); + grpc::string file_namespace = GetFileNamespace(file); + if (file_namespace != "") { + out.Print("namespace $namespace$ {\n", "namespace", file_namespace); + out.Indent(); + } for (int i = 0; i < file->service_count(); i++) { GenerateService(&out, file->service(i), generate_client, generate_server, internal_access); } - out.Outdent(); - out.Print("}\n"); + if (file_namespace != "") { + out.Outdent(); + out.Print("}\n"); + } out.Print("#endregion\n"); } return output; diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 936d70b959..ea6775a8d8 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -891,6 +891,7 @@ typedef struct client_channel_call_data { grpc_closure pick_cancel_closure; grpc_polling_entity* pollent; + bool pollent_added_to_interested_parties; // Batches are added to this list when received from above. // They are removed when we are done handling the batch (i.e., when @@ -949,7 +950,6 @@ static void retry_commit(grpc_call_element* elem, static void start_internal_recv_trailing_metadata(grpc_call_element* elem); static void on_complete(void* arg, grpc_error* error); static void start_retriable_subchannel_batches(void* arg, grpc_error* ignored); -static void pick_after_resolver_result_start_locked(grpc_call_element* elem); static void start_pick_locked(void* arg, grpc_error* ignored); // @@ -2684,59 +2684,133 @@ static void pick_done(void* arg, grpc_error* error) { } } +static void maybe_add_call_to_channel_interested_parties_locked( + grpc_call_element* elem) { + channel_data* chand = static_cast<channel_data*>(elem->channel_data); + call_data* calld = static_cast<call_data*>(elem->call_data); + if (!calld->pollent_added_to_interested_parties) { + calld->pollent_added_to_interested_parties = true; + grpc_polling_entity_add_to_pollset_set(calld->pollent, + chand->interested_parties); + } +} + +static void maybe_del_call_from_channel_interested_parties_locked( + grpc_call_element* elem) { + channel_data* chand = static_cast<channel_data*>(elem->channel_data); + call_data* calld = static_cast<call_data*>(elem->call_data); + if (calld->pollent_added_to_interested_parties) { + calld->pollent_added_to_interested_parties = false; + grpc_polling_entity_del_from_pollset_set(calld->pollent, + chand->interested_parties); + } +} + // Invoked when a pick is completed to leave the client_channel combiner // and continue processing in the call combiner. +// If needed, removes the call's polling entity from chand->interested_parties. static void pick_done_locked(grpc_call_element* elem, grpc_error* error) { call_data* calld = static_cast<call_data*>(elem->call_data); + maybe_del_call_from_channel_interested_parties_locked(elem); GRPC_CLOSURE_INIT(&calld->pick_closure, pick_done, elem, grpc_schedule_on_exec_ctx); GRPC_CLOSURE_SCHED(&calld->pick_closure, error); } -// A wrapper around pick_done_locked() that is used in cases where -// either (a) the pick was deferred pending a resolver result or (b) the -// pick was done asynchronously. Removes the call's polling entity from -// chand->interested_parties before invoking pick_done_locked(). -static void async_pick_done_locked(grpc_call_element* elem, grpc_error* error) { - channel_data* chand = static_cast<channel_data*>(elem->channel_data); - call_data* calld = static_cast<call_data*>(elem->call_data); - grpc_polling_entity_del_from_pollset_set(calld->pollent, - chand->interested_parties); - pick_done_locked(elem, error); -} +namespace grpc_core { -// Note: This runs under the client_channel combiner, but will NOT be -// holding the call combiner. -static void pick_callback_cancel_locked(void* arg, grpc_error* error) { - grpc_call_element* elem = static_cast<grpc_call_element*>(arg); - channel_data* chand = static_cast<channel_data*>(elem->channel_data); - call_data* calld = static_cast<call_data*>(elem->call_data); - // Note: chand->lb_policy may have changed since we started our pick, - // in which case we will be cancelling the pick on a policy other than - // the one we started it on. However, this will just be a no-op. - if (GPR_LIKELY(error != GRPC_ERROR_NONE && chand->lb_policy != nullptr)) { +// Performs subchannel pick via LB policy. +class LbPicker { + public: + // Starts a pick on chand->lb_policy. + static void StartLocked(grpc_call_element* elem) { + channel_data* chand = static_cast<channel_data*>(elem->channel_data); + call_data* calld = static_cast<call_data*>(elem->call_data); if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: cancelling pick from LB policy %p", + gpr_log(GPR_INFO, "chand=%p calld=%p: starting pick on lb_policy=%p", chand, calld, chand->lb_policy.get()); } - chand->lb_policy->CancelPickLocked(&calld->pick, GRPC_ERROR_REF(error)); + // If this is a retry, use the send_initial_metadata payload that + // we've cached; otherwise, use the pending batch. The + // send_initial_metadata batch will be the first pending batch in the + // list, as set by get_batch_index() above. + calld->pick.initial_metadata = + calld->seen_send_initial_metadata + ? &calld->send_initial_metadata + : calld->pending_batches[0] + .batch->payload->send_initial_metadata.send_initial_metadata; + calld->pick.initial_metadata_flags = + calld->seen_send_initial_metadata + ? calld->send_initial_metadata_flags + : calld->pending_batches[0] + .batch->payload->send_initial_metadata + .send_initial_metadata_flags; + GRPC_CLOSURE_INIT(&calld->pick_closure, &LbPicker::DoneLocked, elem, + grpc_combiner_scheduler(chand->combiner)); + calld->pick.on_complete = &calld->pick_closure; + GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback"); + const bool pick_done = chand->lb_policy->PickLocked(&calld->pick); + if (GPR_LIKELY(pick_done)) { + // Pick completed synchronously. + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, "chand=%p calld=%p: pick completed synchronously", + chand, calld); + } + pick_done_locked(elem, GRPC_ERROR_NONE); + GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback"); + } else { + // Pick will be returned asynchronously. + // Add the polling entity from call_data to the channel_data's + // interested_parties, so that the I/O of the LB policy can be done + // under it. It will be removed in pick_done_locked(). + maybe_add_call_to_channel_interested_parties_locked(elem); + // Request notification on call cancellation. + GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback_cancel"); + grpc_call_combiner_set_notify_on_cancel( + calld->call_combiner, + GRPC_CLOSURE_INIT(&calld->pick_cancel_closure, + &LbPicker::CancelLocked, elem, + grpc_combiner_scheduler(chand->combiner))); + } } - GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback_cancel"); -} -// Callback invoked by LoadBalancingPolicy::PickLocked() for async picks. -// Unrefs the LB policy and invokes async_pick_done_locked(). -static void pick_callback_done_locked(void* arg, grpc_error* error) { - grpc_call_element* elem = static_cast<grpc_call_element*>(arg); - channel_data* chand = static_cast<channel_data*>(elem->channel_data); - call_data* calld = static_cast<call_data*>(elem->call_data); - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: pick completed asynchronously", chand, - calld); + private: + // Callback invoked by LoadBalancingPolicy::PickLocked() for async picks. + // Unrefs the LB policy and invokes pick_done_locked(). + static void DoneLocked(void* arg, grpc_error* error) { + grpc_call_element* elem = static_cast<grpc_call_element*>(arg); + channel_data* chand = static_cast<channel_data*>(elem->channel_data); + call_data* calld = static_cast<call_data*>(elem->call_data); + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, "chand=%p calld=%p: pick completed asynchronously", + chand, calld); + } + pick_done_locked(elem, GRPC_ERROR_REF(error)); + GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback"); } - async_pick_done_locked(elem, GRPC_ERROR_REF(error)); - GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback"); -} + + // Note: This runs under the client_channel combiner, but will NOT be + // holding the call combiner. + static void CancelLocked(void* arg, grpc_error* error) { + grpc_call_element* elem = static_cast<grpc_call_element*>(arg); + channel_data* chand = static_cast<channel_data*>(elem->channel_data); + call_data* calld = static_cast<call_data*>(elem->call_data); + // Note: chand->lb_policy may have changed since we started our pick, + // in which case we will be cancelling the pick on a policy other than + // the one we started it on. However, this will just be a no-op. + if (GPR_UNLIKELY(error != GRPC_ERROR_NONE && chand->lb_policy != nullptr)) { + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, + "chand=%p calld=%p: cancelling pick from LB policy %p", chand, + calld, chand->lb_policy.get()); + } + chand->lb_policy->CancelPickLocked(&calld->pick, GRPC_ERROR_REF(error)); + } + GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback_cancel"); + } +}; + +} // namespace grpc_core // Applies service config to the call. Must be invoked once we know // that the resolver has returned results to the channel. @@ -2766,6 +2840,24 @@ static void apply_service_config_to_call_locked(grpc_call_element* elem) { grpc_deadline_state_reset(elem, calld->deadline); } } + // If the service config set wait_for_ready and the application + // did not explicitly set it, use the value from the service config. + uint32_t* send_initial_metadata_flags = + &calld->pending_batches[0] + .batch->payload->send_initial_metadata + .send_initial_metadata_flags; + if (GPR_UNLIKELY( + calld->method_params->wait_for_ready() != + ClientChannelMethodParams::WAIT_FOR_READY_UNSET && + !(*send_initial_metadata_flags & + GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET))) { + if (calld->method_params->wait_for_ready() == + ClientChannelMethodParams::WAIT_FOR_READY_TRUE) { + *send_initial_metadata_flags |= GRPC_INITIAL_METADATA_WAIT_FOR_READY; + } else { + *send_initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY; + } + } } } // If no retry policy, disable retries. @@ -2776,215 +2868,164 @@ static void apply_service_config_to_call_locked(grpc_call_element* elem) { } } -// Starts a pick on chand->lb_policy. -// Returns true if pick is completed synchronously. -static bool pick_callback_start_locked(grpc_call_element* elem) { - channel_data* chand = static_cast<channel_data*>(elem->channel_data); +// Invoked once resolver results are available. +static void process_service_config_and_start_lb_pick_locked( + grpc_call_element* elem) { call_data* calld = static_cast<call_data*>(elem->call_data); - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: starting pick on lb_policy=%p", chand, - calld, chand->lb_policy.get()); - } // Only get service config data on the first attempt. if (GPR_LIKELY(calld->num_attempts_completed == 0)) { apply_service_config_to_call_locked(elem); } - // If the application explicitly set wait_for_ready, use that. - // Otherwise, if the service config specified a value for this - // method, use that. - // - // The send_initial_metadata batch will be the first one in the list, - // as set by get_batch_index() above. - calld->pick.initial_metadata = - calld->seen_send_initial_metadata - ? &calld->send_initial_metadata - : calld->pending_batches[0] - .batch->payload->send_initial_metadata.send_initial_metadata; - uint32_t send_initial_metadata_flags = - calld->seen_send_initial_metadata - ? calld->send_initial_metadata_flags - : calld->pending_batches[0] - .batch->payload->send_initial_metadata - .send_initial_metadata_flags; - const bool wait_for_ready_set_from_api = - send_initial_metadata_flags & - GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET; - const bool wait_for_ready_set_from_service_config = - calld->method_params != nullptr && - calld->method_params->wait_for_ready() != - ClientChannelMethodParams::WAIT_FOR_READY_UNSET; - if (GPR_UNLIKELY(!wait_for_ready_set_from_api && - wait_for_ready_set_from_service_config)) { - if (calld->method_params->wait_for_ready() == - ClientChannelMethodParams::WAIT_FOR_READY_TRUE) { - send_initial_metadata_flags |= GRPC_INITIAL_METADATA_WAIT_FOR_READY; - } else { - send_initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY; - } - } - calld->pick.initial_metadata_flags = send_initial_metadata_flags; - GRPC_CLOSURE_INIT(&calld->pick_closure, pick_callback_done_locked, elem, - grpc_combiner_scheduler(chand->combiner)); - calld->pick.on_complete = &calld->pick_closure; - GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback"); - const bool pick_done = chand->lb_policy->PickLocked(&calld->pick); - if (GPR_LIKELY(pick_done)) { - // Pick completed synchronously. - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: pick completed synchronously", - chand, calld); - } - GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback"); - } else { - GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback_cancel"); - grpc_call_combiner_set_notify_on_cancel( - calld->call_combiner, - GRPC_CLOSURE_INIT(&calld->pick_cancel_closure, - pick_callback_cancel_locked, elem, - grpc_combiner_scheduler(chand->combiner))); - } - return pick_done; + // Start LB pick. + grpc_core::LbPicker::StartLocked(elem); } -typedef struct { - grpc_call_element* elem; - bool finished; - grpc_closure closure; - grpc_closure cancel_closure; -} pick_after_resolver_result_args; - -// Note: This runs under the client_channel combiner, but will NOT be -// holding the call combiner. -static void pick_after_resolver_result_cancel_locked(void* arg, - grpc_error* error) { - pick_after_resolver_result_args* args = - static_cast<pick_after_resolver_result_args*>(arg); - if (GPR_LIKELY(args->finished)) { - gpr_free(args); - return; - } - // If we don't yet have a resolver result, then a closure for - // pick_after_resolver_result_done_locked() will have been added to - // chand->waiting_for_resolver_result_closures, and it may not be invoked - // until after this call has been destroyed. We mark the operation as - // finished, so that when pick_after_resolver_result_done_locked() - // is called, it will be a no-op. We also immediately invoke - // async_pick_done_locked() to propagate the error back to the caller. - args->finished = true; - grpc_call_element* elem = args->elem; - channel_data* chand = static_cast<channel_data*>(elem->channel_data); - call_data* calld = static_cast<call_data*>(elem->call_data); - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, - "chand=%p calld=%p: cancelling pick waiting for resolver result", - chand, calld); - } - // Note: Although we are not in the call combiner here, we are - // basically stealing the call combiner from the pending pick, so - // it's safe to call async_pick_done_locked() here -- we are - // essentially calling it here instead of calling it in - // pick_after_resolver_result_done_locked(). - async_pick_done_locked(elem, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "Pick cancelled", &error, 1)); -} - -static void pick_after_resolver_result_done_locked(void* arg, - grpc_error* error) { - pick_after_resolver_result_args* args = - static_cast<pick_after_resolver_result_args*>(arg); - if (GPR_UNLIKELY(args->finished)) { - /* cancelled, do nothing */ - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "call cancelled before resolver result"); - } - gpr_free(args); - return; - } - args->finished = true; - grpc_call_element* elem = args->elem; - channel_data* chand = static_cast<channel_data*>(elem->channel_data); - call_data* calld = static_cast<call_data*>(elem->call_data); - if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) { +namespace grpc_core { + +// Handles waiting for a resolver result. +// Used only for the first call on an idle channel. +class ResolverResultWaiter { + public: + explicit ResolverResultWaiter(grpc_call_element* elem) : elem_(elem) { + channel_data* chand = static_cast<channel_data*>(elem->channel_data); + call_data* calld = static_cast<call_data*>(elem->call_data); if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: resolver failed to return data", + gpr_log(GPR_INFO, + "chand=%p calld=%p: deferring pick pending resolver result", chand, calld); } - async_pick_done_locked(elem, GRPC_ERROR_REF(error)); - } else if (GPR_UNLIKELY(chand->resolver == nullptr)) { - // Shutting down. - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: resolver disconnected", chand, - calld); + // Add closure to be run when a resolver result is available. + GRPC_CLOSURE_INIT(&done_closure_, &ResolverResultWaiter::DoneLocked, this, + grpc_combiner_scheduler(chand->combiner)); + AddToWaitingList(); + // Set cancellation closure, so that we abort if the call is cancelled. + GRPC_CLOSURE_INIT(&cancel_closure_, &ResolverResultWaiter::CancelLocked, + this, grpc_combiner_scheduler(chand->combiner)); + grpc_call_combiner_set_notify_on_cancel(calld->call_combiner, + &cancel_closure_); + } + + private: + // Adds closure_ to chand->waiting_for_resolver_result_closures. + void AddToWaitingList() { + channel_data* chand = static_cast<channel_data*>(elem_->channel_data); + grpc_closure_list_append(&chand->waiting_for_resolver_result_closures, + &done_closure_, GRPC_ERROR_NONE); + } + + // Invoked when a resolver result is available. + static void DoneLocked(void* arg, grpc_error* error) { + ResolverResultWaiter* self = static_cast<ResolverResultWaiter*>(arg); + // If CancelLocked() has already run, delete ourselves without doing + // anything. Note that the call stack may have already been destroyed, + // so it's not safe to access anything in elem_. + if (GPR_UNLIKELY(self->finished_)) { + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, "call cancelled before resolver result"); + } + Delete(self); + return; } - async_pick_done_locked( - elem, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); - } else if (GPR_UNLIKELY(chand->lb_policy == nullptr)) { - // Transient resolver failure. - // If call has wait_for_ready=true, try again; otherwise, fail. - uint32_t send_initial_metadata_flags = - calld->seen_send_initial_metadata - ? calld->send_initial_metadata_flags - : calld->pending_batches[0] - .batch->payload->send_initial_metadata - .send_initial_metadata_flags; - if (send_initial_metadata_flags & GRPC_INITIAL_METADATA_WAIT_FOR_READY) { + // Otherwise, process the resolver result. + grpc_call_element* elem = self->elem_; + channel_data* chand = static_cast<channel_data*>(elem->channel_data); + call_data* calld = static_cast<call_data*>(elem->call_data); + if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) { if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, - "chand=%p calld=%p: resolver returned but no LB policy; " - "wait_for_ready=true; trying again", + gpr_log(GPR_INFO, "chand=%p calld=%p: resolver failed to return data", chand, calld); } - pick_after_resolver_result_start_locked(elem); + pick_done_locked(elem, GRPC_ERROR_REF(error)); + } else if (GPR_UNLIKELY(chand->resolver == nullptr)) { + // Shutting down. + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, "chand=%p calld=%p: resolver disconnected", chand, + calld); + } + pick_done_locked(elem, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); + } else if (GPR_UNLIKELY(chand->lb_policy == nullptr)) { + // Transient resolver failure. + // If call has wait_for_ready=true, try again; otherwise, fail. + uint32_t send_initial_metadata_flags = + calld->seen_send_initial_metadata + ? calld->send_initial_metadata_flags + : calld->pending_batches[0] + .batch->payload->send_initial_metadata + .send_initial_metadata_flags; + if (send_initial_metadata_flags & GRPC_INITIAL_METADATA_WAIT_FOR_READY) { + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, + "chand=%p calld=%p: resolver returned but no LB policy; " + "wait_for_ready=true; trying again", + chand, calld); + } + // Re-add ourselves to the waiting list. + self->AddToWaitingList(); + // Return early so that we don't set finished_ to true below. + return; + } else { + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, + "chand=%p calld=%p: resolver returned but no LB policy; " + "wait_for_ready=false; failing", + chand, calld); + } + pick_done_locked( + elem, + grpc_error_set_int( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Name resolution failure"), + GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); + } } else { if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, - "chand=%p calld=%p: resolver returned but no LB policy; " - "wait_for_ready=false; failing", + gpr_log(GPR_INFO, "chand=%p calld=%p: resolver returned, doing LB pick", chand, calld); } - async_pick_done_locked( - elem, - grpc_error_set_int( - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Name resolution failure"), - GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); + process_service_config_and_start_lb_pick_locked(elem); } - } else { - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: resolver returned, doing pick", - chand, calld); + self->finished_ = true; + } + + // Invoked when the call is cancelled. + // Note: This runs under the client_channel combiner, but will NOT be + // holding the call combiner. + static void CancelLocked(void* arg, grpc_error* error) { + ResolverResultWaiter* self = static_cast<ResolverResultWaiter*>(arg); + // If DoneLocked() has already run, delete ourselves without doing anything. + if (GPR_LIKELY(self->finished_)) { + Delete(self); + return; } - if (GPR_LIKELY(pick_callback_start_locked(elem))) { - // Even if the LB policy returns a result synchronously, we have - // already added our polling entity to chand->interested_parties - // in order to wait for the resolver result, so we need to - // remove it here. Therefore, we call async_pick_done_locked() - // instead of pick_done_locked(). - async_pick_done_locked(elem, GRPC_ERROR_NONE); + // If we are being cancelled, immediately invoke pick_done_locked() + // to propagate the error back to the caller. + if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) { + grpc_call_element* elem = self->elem_; + channel_data* chand = static_cast<channel_data*>(elem->channel_data); + call_data* calld = static_cast<call_data*>(elem->call_data); + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, + "chand=%p calld=%p: cancelling call waiting for name " + "resolution", + chand, calld); + } + // Note: Although we are not in the call combiner here, we are + // basically stealing the call combiner from the pending pick, so + // it's safe to call pick_done_locked() here -- we are essentially + // calling it here instead of calling it in DoneLocked(). + pick_done_locked(elem, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( + "Pick cancelled", &error, 1)); } + self->finished_ = true; } -} -static void pick_after_resolver_result_start_locked(grpc_call_element* elem) { - channel_data* chand = static_cast<channel_data*>(elem->channel_data); - call_data* calld = static_cast<call_data*>(elem->call_data); - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, - "chand=%p calld=%p: deferring pick pending resolver result", chand, - calld); - } - pick_after_resolver_result_args* args = - static_cast<pick_after_resolver_result_args*>(gpr_zalloc(sizeof(*args))); - args->elem = elem; - GRPC_CLOSURE_INIT(&args->closure, pick_after_resolver_result_done_locked, - args, grpc_combiner_scheduler(chand->combiner)); - grpc_closure_list_append(&chand->waiting_for_resolver_result_closures, - &args->closure, GRPC_ERROR_NONE); - grpc_call_combiner_set_notify_on_cancel( - calld->call_combiner, - GRPC_CLOSURE_INIT(&args->cancel_closure, - pick_after_resolver_result_cancel_locked, args, - grpc_combiner_scheduler(chand->combiner))); -} + grpc_call_element* elem_; + grpc_closure done_closure_; + grpc_closure cancel_closure_; + bool finished_ = false; +}; + +} // namespace grpc_core static void start_pick_locked(void* arg, grpc_error* ignored) { grpc_call_element* elem = static_cast<grpc_call_element*>(arg); @@ -2993,31 +3034,24 @@ static void start_pick_locked(void* arg, grpc_error* ignored) { GPR_ASSERT(calld->pick.connected_subchannel == nullptr); GPR_ASSERT(calld->subchannel_call == nullptr); if (GPR_LIKELY(chand->lb_policy != nullptr)) { - // We already have an LB policy, so ask it for a pick. - if (GPR_LIKELY(pick_callback_start_locked(elem))) { - // Pick completed synchronously. - pick_done_locked(elem, GRPC_ERROR_NONE); - return; - } + // We already have resolver results, so process the service config + // and start an LB pick. + process_service_config_and_start_lb_pick_locked(elem); + } else if (GPR_UNLIKELY(chand->resolver == nullptr)) { + pick_done_locked(elem, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); } else { // We do not yet have an LB policy, so wait for a resolver result. - if (GPR_UNLIKELY(chand->resolver == nullptr)) { - pick_done_locked(elem, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); - return; - } if (GPR_UNLIKELY(!chand->started_resolving)) { start_resolving_locked(chand); } - pick_after_resolver_result_start_locked(elem); + // Create a new waiter, which will delete itself when done. + grpc_core::New<grpc_core::ResolverResultWaiter>(elem); + // Add the polling entity from call_data to the channel_data's + // interested_parties, so that the I/O of the resolver can be done + // under it. It will be removed in pick_done_locked(). + maybe_add_call_to_channel_interested_parties_locked(elem); } - // We need to wait for either a resolver result or for an async result - // from the LB policy. Add the polling entity from call_data to the - // channel_data's interested_parties, so that the I/O of the LB policy - // and resolver can be done under it. The polling entity will be - // removed in async_pick_done_locked(). - grpc_polling_entity_add_to_pollset_set(calld->pollent, - chand->interested_parties); } // diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc index 73d2af6e42..00a84302ed 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc @@ -18,7 +18,7 @@ #include <grpc/support/port_platform.h> #include "src/core/lib/iomgr/port.h" -#if GRPC_ARES == 1 && defined(GRPC_POSIX_SOCKET) +#if GRPC_ARES == 1 && defined(GRPC_POSIX_SOCKET_ARES_EV_DRIVER) #include <ares.h> #include <sys/ioctl.h> @@ -348,4 +348,4 @@ void grpc_ares_ev_driver_start(grpc_ares_ev_driver* ev_driver) { gpr_mu_unlock(&ev_driver->mu); } -#endif /* GRPC_ARES == 1 && defined(GRPC_POSIX_SOCKET) */ +#endif /* GRPC_ARES == 1 && defined(GRPC_POSIX_SOCKET_ARES_EV_DRIVER) */ diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index cc4a823798..a8090d18a6 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -1451,10 +1451,8 @@ static void perform_stream_op_locked(void* stream_op, } } if (op_payload->send_initial_metadata.peer_string != nullptr) { - char* old_peer_string = (char*)gpr_atm_full_xchg( - op_payload->send_initial_metadata.peer_string, - (gpr_atm)gpr_strdup(t->peer_string)); - gpr_free(old_peer_string); + gpr_atm_rel_store(op_payload->send_initial_metadata.peer_string, + (gpr_atm)t->peer_string); } } @@ -1569,10 +1567,8 @@ static void perform_stream_op_locked(void* stream_op, s->trailing_metadata_available = op_payload->recv_initial_metadata.trailing_metadata_available; if (op_payload->recv_initial_metadata.peer_string != nullptr) { - char* old_peer_string = (char*)gpr_atm_full_xchg( - op_payload->recv_initial_metadata.peer_string, - (gpr_atm)gpr_strdup(t->peer_string)); - gpr_free(old_peer_string); + gpr_atm_rel_store(op_payload->recv_initial_metadata.peer_string, + (gpr_atm)t->peer_string); } grpc_chttp2_maybe_complete_recv_initial_metadata(t, s); } diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index d5ef063883..0eaf63f133 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -41,14 +41,18 @@ #include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/timeout_encoding.h" -#define HASH_FRAGMENT_1(x) ((x)&255) -#define HASH_FRAGMENT_2(x) ((x >> 8) & 255) -#define HASH_FRAGMENT_3(x) ((x >> 16) & 255) -#define HASH_FRAGMENT_4(x) ((x >> 24) & 255) +#define HASH_FRAGMENT_MASK (GRPC_CHTTP2_HPACKC_NUM_VALUES - 1) +#define HASH_FRAGMENT_1(x) ((x)&HASH_FRAGMENT_MASK) +#define HASH_FRAGMENT_2(x) \ + (((x) >> GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS) & HASH_FRAGMENT_MASK) +#define HASH_FRAGMENT_3(x) \ + (((x) >> (GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS * 2)) & HASH_FRAGMENT_MASK) +#define HASH_FRAGMENT_4(x) \ + (((x) >> (GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS * 3)) & HASH_FRAGMENT_MASK) /* if the probability of this item being seen again is < 1/x then don't add it to the table */ -#define ONE_ON_ADD_PROBABILITY 128 +#define ONE_ON_ADD_PROBABILITY (GRPC_CHTTP2_HPACKC_NUM_VALUES >> 1) /* don't consider adding anything bigger than this to the hpack table */ #define MAX_DECODER_SPACE_USAGE 512 @@ -135,7 +139,7 @@ static void inc_filter(uint8_t idx, uint32_t* sum, uint8_t* elems) { } else { int i; *sum = 0; - for (i = 0; i < GRPC_CHTTP2_HPACKC_NUM_FILTERS; i++) { + for (i = 0; i < GRPC_CHTTP2_HPACKC_NUM_VALUES; i++) { elems[i] /= 2; (*sum) += elems[i]; } diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h index b370932131..e31a7399d7 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h @@ -28,8 +28,9 @@ #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" -#define GRPC_CHTTP2_HPACKC_NUM_FILTERS 256 -#define GRPC_CHTTP2_HPACKC_NUM_VALUES 256 +// This should be <= 8. We use 6 to save space. +#define GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS 6 +#define GRPC_CHTTP2_HPACKC_NUM_VALUES (1 << GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS) /* initial table size, per spec */ #define GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE 4096 /* maximum table size we'll actually use */ @@ -58,7 +59,7 @@ typedef struct { a new literal should be added to the compression table or not. They track a single integer that counts how often a particular value has been seen. When that count reaches max (255), all values are halved. */ - uint8_t filter_elems[GRPC_CHTTP2_HPACKC_NUM_FILTERS]; + uint8_t filter_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES]; /* entry tables for keys & elems: these tables track values that have been seen and *may* be in the decompressor table */ diff --git a/src/core/lib/iomgr/cfstream_handle.cc b/src/core/lib/iomgr/cfstream_handle.cc new file mode 100644 index 0000000000..30f4e65632 --- /dev/null +++ b/src/core/lib/iomgr/cfstream_handle.cc @@ -0,0 +1,183 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <grpc/support/port_platform.h> + +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_CFSTREAM +#import <CoreFoundation/CoreFoundation.h> +#import "src/core/lib/iomgr/cfstream_handle.h" + +#include <grpc/support/atm.h> +#include <grpc/support/sync.h> + +#include "src/core/lib/debug/trace.h" +#include "src/core/lib/iomgr/closure.h" +#include "src/core/lib/iomgr/exec_ctx.h" + +extern grpc_core::TraceFlag grpc_tcp_trace; + +void* CFStreamHandle::Retain(void* info) { + CFStreamHandle* handle = static_cast<CFStreamHandle*>(info); + CFSTREAM_HANDLE_REF(handle, "retain"); + return info; +} + +void CFStreamHandle::Release(void* info) { + CFStreamHandle* handle = static_cast<CFStreamHandle*>(info); + CFSTREAM_HANDLE_UNREF(handle, "release"); +} + +CFStreamHandle* CFStreamHandle::CreateStreamHandle( + CFReadStreamRef read_stream, CFWriteStreamRef write_stream) { + return new CFStreamHandle(read_stream, write_stream); +} + +void CFStreamHandle::ReadCallback(CFReadStreamRef stream, + CFStreamEventType type, + void* client_callback_info) { + CFStreamHandle* handle = static_cast<CFStreamHandle*>(client_callback_info); + CFSTREAM_HANDLE_REF(handle, "read callback"); + dispatch_async( + dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + grpc_core::ExecCtx exec_ctx; + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CFStream ReadCallback (%p, %p, %lu, %p)", handle, + stream, type, client_callback_info); + } + switch (type) { + case kCFStreamEventOpenCompleted: + handle->open_event_.SetReady(); + break; + case kCFStreamEventHasBytesAvailable: + case kCFStreamEventEndEncountered: + handle->read_event_.SetReady(); + break; + case kCFStreamEventErrorOccurred: + handle->open_event_.SetReady(); + handle->read_event_.SetReady(); + break; + default: + GPR_UNREACHABLE_CODE(return ); + } + CFSTREAM_HANDLE_UNREF(handle, "read callback"); + }); +} +void CFStreamHandle::WriteCallback(CFWriteStreamRef stream, + CFStreamEventType type, + void* clientCallBackInfo) { + CFStreamHandle* handle = static_cast<CFStreamHandle*>(clientCallBackInfo); + CFSTREAM_HANDLE_REF(handle, "write callback"); + dispatch_async( + dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + grpc_core::ExecCtx exec_ctx; + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CFStream WriteCallback (%p, %p, %lu, %p)", handle, + stream, type, clientCallBackInfo); + } + switch (type) { + case kCFStreamEventOpenCompleted: + handle->open_event_.SetReady(); + break; + case kCFStreamEventCanAcceptBytes: + case kCFStreamEventEndEncountered: + handle->write_event_.SetReady(); + break; + case kCFStreamEventErrorOccurred: + handle->open_event_.SetReady(); + handle->write_event_.SetReady(); + break; + default: + GPR_UNREACHABLE_CODE(return ); + } + CFSTREAM_HANDLE_UNREF(handle, "write callback"); + }); +} + +CFStreamHandle::CFStreamHandle(CFReadStreamRef read_stream, + CFWriteStreamRef write_stream) { + gpr_ref_init(&refcount_, 1); + open_event_.InitEvent(); + read_event_.InitEvent(); + write_event_.InitEvent(); + CFStreamClientContext ctx = {0, static_cast<void*>(this), nil, nil, nil}; + CFReadStreamSetClient( + read_stream, + kCFStreamEventOpenCompleted | kCFStreamEventHasBytesAvailable | + kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered, + CFStreamHandle::ReadCallback, &ctx); + CFWriteStreamSetClient( + write_stream, + kCFStreamEventOpenCompleted | kCFStreamEventCanAcceptBytes | + kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered, + CFStreamHandle::WriteCallback, &ctx); + CFReadStreamScheduleWithRunLoop(read_stream, CFRunLoopGetMain(), + kCFRunLoopCommonModes); + CFWriteStreamScheduleWithRunLoop(write_stream, CFRunLoopGetMain(), + kCFRunLoopCommonModes); +} + +CFStreamHandle::~CFStreamHandle() { + open_event_.DestroyEvent(); + read_event_.DestroyEvent(); + write_event_.DestroyEvent(); +} + +void CFStreamHandle::NotifyOnOpen(grpc_closure* closure) { + open_event_.NotifyOn(closure); +} + +void CFStreamHandle::NotifyOnRead(grpc_closure* closure) { + read_event_.NotifyOn(closure); +} + +void CFStreamHandle::NotifyOnWrite(grpc_closure* closure) { + write_event_.NotifyOn(closure); +} + +void CFStreamHandle::Shutdown(grpc_error* error) { + open_event_.SetShutdown(GRPC_ERROR_REF(error)); + read_event_.SetShutdown(GRPC_ERROR_REF(error)); + write_event_.SetShutdown(GRPC_ERROR_REF(error)); + GRPC_ERROR_UNREF(error); +} + +void CFStreamHandle::Ref(const char* file, int line, const char* reason) { + if (grpc_tcp_trace.enabled()) { + gpr_atm val = gpr_atm_no_barrier_load(&refcount_.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "CFStream Handle ref %p : %s %" PRIdPTR " -> %" PRIdPTR, this, + reason, val, val + 1); + } + gpr_ref(&refcount_); +} + +void CFStreamHandle::Unref(const char* file, int line, const char* reason) { + if (grpc_tcp_trace.enabled()) { + gpr_atm val = gpr_atm_no_barrier_load(&refcount_.count); + gpr_log(GPR_ERROR, + "CFStream Handle unref %p : %s %" PRIdPTR " -> %" PRIdPTR, this, + reason, val, val - 1); + } + if (gpr_unref(&refcount_)) { + delete this; + } +} + +#endif diff --git a/src/core/lib/iomgr/cfstream_handle.h b/src/core/lib/iomgr/cfstream_handle.h new file mode 100644 index 0000000000..4258e72431 --- /dev/null +++ b/src/core/lib/iomgr/cfstream_handle.h @@ -0,0 +1,80 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* The CFStream handle acts as an event synchronization entity for + * read/write/open/error/eos events happening on CFStream streams. */ + +#ifndef GRPC_CORE_LIB_IOMGR_CFSTREAM_HANDLE_H +#define GRPC_CORE_LIB_IOMGR_CFSTREAM_HANDLE_H + +#include <grpc/support/port_platform.h> + +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_CFSTREAM +#import <CoreFoundation/CoreFoundation.h> + +#include "src/core/lib/iomgr/closure.h" +#include "src/core/lib/iomgr/lockfree_event.h" + +class CFStreamHandle final { + public: + static CFStreamHandle* CreateStreamHandle(CFReadStreamRef read_stream, + CFWriteStreamRef write_stream); + ~CFStreamHandle(); + CFStreamHandle(const CFReadStreamRef& ref) = delete; + CFStreamHandle(CFReadStreamRef&& ref) = delete; + CFStreamHandle& operator=(const CFStreamHandle& rhs) = delete; + + void NotifyOnOpen(grpc_closure* closure); + void NotifyOnRead(grpc_closure* closure); + void NotifyOnWrite(grpc_closure* closure); + void Shutdown(grpc_error* error); + + void Ref(const char* file = "", int line = 0, const char* reason = nullptr); + void Unref(const char* file = "", int line = 0, const char* reason = nullptr); + + private: + CFStreamHandle(CFReadStreamRef read_stream, CFWriteStreamRef write_stream); + static void ReadCallback(CFReadStreamRef stream, CFStreamEventType type, + void* client_callback_info); + static void WriteCallback(CFWriteStreamRef stream, CFStreamEventType type, + void* client_callback_info); + static void* Retain(void* info); + static void Release(void* info); + + grpc_core::LockfreeEvent open_event_; + grpc_core::LockfreeEvent read_event_; + grpc_core::LockfreeEvent write_event_; + + gpr_refcount refcount_; +}; + +#ifdef DEBUG +#define CFSTREAM_HANDLE_REF(handle, reason) \ + (handle)->Ref(__FILE__, __LINE__, (reason)) +#define CFSTREAM_HANDLE_UNREF(handle, reason) \ + (handle)->Unref(__FILE__, __LINE__, (reason)) +#else +#define CFSTREAM_HANDLE_REF(handle, reason) (handle)->Ref() +#define CFSTREAM_HANDLE_UNREF(handle, reason) (handle)->Unref() +#endif + +#endif + +#endif /* GRPC_CORE_LIB_IOMGR_CFSTREAM_HANDLE_H */ diff --git a/src/core/lib/iomgr/endpoint_cfstream.cc b/src/core/lib/iomgr/endpoint_cfstream.cc new file mode 100644 index 0000000000..c3bc0cc8fd --- /dev/null +++ b/src/core/lib/iomgr/endpoint_cfstream.cc @@ -0,0 +1,372 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <grpc/support/port_platform.h> + +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_CFSTREAM_ENDPOINT + +#import <CoreFoundation/CoreFoundation.h> +#import "src/core/lib/iomgr/endpoint_cfstream.h" + +#include <grpc/slice_buffer.h> +#include <grpc/support/alloc.h> +#include <grpc/support/string_util.h> + +#include "src/core/lib/gpr/string.h" +#include "src/core/lib/iomgr/cfstream_handle.h" +#include "src/core/lib/iomgr/closure.h" +#include "src/core/lib/iomgr/endpoint.h" +#include "src/core/lib/iomgr/error_cfstream.h" +#include "src/core/lib/slice/slice_internal.h" +#include "src/core/lib/slice/slice_string_helpers.h" + +extern grpc_core::TraceFlag grpc_tcp_trace; + +typedef struct { + grpc_endpoint base; + gpr_refcount refcount; + + CFReadStreamRef read_stream; + CFWriteStreamRef write_stream; + CFStreamHandle* stream_sync; + + grpc_closure* read_cb; + grpc_closure* write_cb; + grpc_slice_buffer* read_slices; + grpc_slice_buffer* write_slices; + + grpc_closure read_action; + grpc_closure write_action; + + char* peer_string; + grpc_resource_user* resource_user; + grpc_resource_user_slice_allocator slice_allocator; +} CFStreamEndpoint; + +static void CFStreamFree(CFStreamEndpoint* ep) { + grpc_resource_user_unref(ep->resource_user); + CFRelease(ep->read_stream); + CFRelease(ep->write_stream); + CFSTREAM_HANDLE_UNREF(ep->stream_sync, "free"); + gpr_free(ep->peer_string); + gpr_free(ep); +} + +#ifndef NDEBUG +#define EP_REF(ep, reason) CFStreamRef((ep), (reason), __FILE__, __LINE__) +#define EP_UNREF(ep, reason) CFStreamUnref((ep), (reason), __FILE__, __LINE__) +static void CFStreamUnref(CFStreamEndpoint* ep, const char* reason, + const char* file, int line) { + if (grpc_tcp_trace.enabled()) { + gpr_atm val = gpr_atm_no_barrier_load(&ep->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "CFStream endpoint unref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, + reason, val, val - 1); + } + if (gpr_unref(&ep->refcount)) { + CFStreamFree(ep); + } +} +static void CFStreamRef(CFStreamEndpoint* ep, const char* reason, + const char* file, int line) { + if (grpc_tcp_trace.enabled()) { + gpr_atm val = gpr_atm_no_barrier_load(&ep->refcount.count); + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, + "CFStream endpoint ref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, + reason, val, val + 1); + } + gpr_ref(&ep->refcount); +} +#else +#define EP_REF(ep, reason) CFStreamRef((ep)) +#define EP_UNREF(ep, reason) CFStreamUnref((ep)) +static void CFStreamUnref(CFStreamEndpoint* ep) { + if (gpr_unref(&ep->refcount)) { + CFStreamFree(ep); + } +} +static void CFStreamRef(CFStreamEndpoint* ep) { gpr_ref(&ep->refcount); } +#endif + +static grpc_error* CFStreamAnnotateError(grpc_error* src_error, + CFStreamEndpoint* ep) { + return grpc_error_set_str( + grpc_error_set_int(src_error, GRPC_ERROR_INT_GRPC_STATUS, + GRPC_STATUS_UNAVAILABLE), + GRPC_ERROR_STR_TARGET_ADDRESS, + grpc_slice_from_copied_string(ep->peer_string)); +} + +static void CallReadCb(CFStreamEndpoint* ep, grpc_error* error) { + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CFStream endpoint:%p call_read_cb %p %p:%p", ep, + ep->read_cb, ep->read_cb->cb, ep->read_cb->cb_arg); + size_t i; + const char* str = grpc_error_string(error); + gpr_log(GPR_DEBUG, "read: error=%s", str); + + for (i = 0; i < ep->read_slices->count; i++) { + char* dump = grpc_dump_slice(ep->read_slices->slices[i], + GPR_DUMP_HEX | GPR_DUMP_ASCII); + gpr_log(GPR_DEBUG, "READ %p (peer=%s): %s", ep, ep->peer_string, dump); + gpr_free(dump); + } + } + grpc_closure* cb = ep->read_cb; + ep->read_cb = nullptr; + ep->read_slices = nullptr; + GRPC_CLOSURE_SCHED(cb, error); +} + +static void CallWriteCb(CFStreamEndpoint* ep, grpc_error* error) { + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CFStream endpoint:%p call_write_cb %p %p:%p", ep, + ep->write_cb, ep->write_cb->cb, ep->write_cb->cb_arg); + const char* str = grpc_error_string(error); + gpr_log(GPR_DEBUG, "write: error=%s", str); + } + grpc_closure* cb = ep->write_cb; + ep->write_cb = nullptr; + ep->write_slices = nullptr; + GRPC_CLOSURE_SCHED(cb, error); +} + +static void ReadAction(void* arg, grpc_error* error) { + CFStreamEndpoint* ep = static_cast<CFStreamEndpoint*>(arg); + GPR_ASSERT(ep->read_cb != nullptr); + if (error) { + grpc_slice_buffer_reset_and_unref_internal(ep->read_slices); + CallReadCb(ep, GRPC_ERROR_REF(error)); + EP_UNREF(ep, "read"); + return; + } + + GPR_ASSERT(ep->read_slices->count == 1); + grpc_slice slice = ep->read_slices->slices[0]; + size_t len = GRPC_SLICE_LENGTH(slice); + CFIndex read_size = + CFReadStreamRead(ep->read_stream, GRPC_SLICE_START_PTR(slice), len); + if (read_size == -1) { + grpc_slice_buffer_reset_and_unref_internal(ep->read_slices); + CFErrorRef stream_error = CFReadStreamCopyError(ep->read_stream); + if (stream_error != nullptr) { + error = CFStreamAnnotateError( + GRPC_ERROR_CREATE_FROM_CFERROR(stream_error, "Read error"), ep); + CFRelease(stream_error); + } else { + error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Read error"); + } + CallReadCb(ep, error); + EP_UNREF(ep, "read"); + } else if (read_size == 0) { + grpc_slice_buffer_reset_and_unref_internal(ep->read_slices); + CallReadCb(ep, + CFStreamAnnotateError( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Socket closed"), ep)); + EP_UNREF(ep, "read"); + } else { + if (read_size < len) { + grpc_slice_buffer_trim_end(ep->read_slices, len - read_size, nullptr); + } + CallReadCb(ep, GRPC_ERROR_NONE); + EP_UNREF(ep, "read"); + } +} + +static void WriteAction(void* arg, grpc_error* error) { + CFStreamEndpoint* ep = static_cast<CFStreamEndpoint*>(arg); + GPR_ASSERT(ep->write_cb != nullptr); + if (error) { + grpc_slice_buffer_reset_and_unref_internal(ep->write_slices); + CallWriteCb(ep, GRPC_ERROR_REF(error)); + EP_UNREF(ep, "write"); + return; + } + + grpc_slice slice = grpc_slice_buffer_take_first(ep->write_slices); + size_t slice_len = GRPC_SLICE_LENGTH(slice); + CFIndex write_size = CFWriteStreamWrite( + ep->write_stream, GRPC_SLICE_START_PTR(slice), slice_len); + if (write_size == -1) { + grpc_slice_buffer_reset_and_unref_internal(ep->write_slices); + CFErrorRef stream_error = CFWriteStreamCopyError(ep->write_stream); + if (stream_error != nullptr) { + error = CFStreamAnnotateError( + GRPC_ERROR_CREATE_FROM_CFERROR(stream_error, "write failed."), ep); + CFRelease(stream_error); + } else { + error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("write failed."); + } + CallWriteCb(ep, error); + EP_UNREF(ep, "write"); + } else { + if (write_size < GRPC_SLICE_LENGTH(slice)) { + grpc_slice_buffer_undo_take_first( + ep->write_slices, grpc_slice_sub(slice, write_size, slice_len)); + } + if (ep->write_slices->length > 0) { + ep->stream_sync->NotifyOnWrite(&ep->write_action); + } else { + CallWriteCb(ep, GRPC_ERROR_NONE); + EP_UNREF(ep, "write"); + } + + if (grpc_tcp_trace.enabled()) { + grpc_slice trace_slice = grpc_slice_sub(slice, 0, write_size); + char* dump = grpc_dump_slice(trace_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); + gpr_log(GPR_DEBUG, "WRITE %p (peer=%s): %s", ep, ep->peer_string, dump); + gpr_free(dump); + grpc_slice_unref_internal(trace_slice); + } + } + grpc_slice_unref_internal(slice); +} + +static void CFStreamReadAllocationDone(void* arg, grpc_error* error) { + CFStreamEndpoint* ep = static_cast<CFStreamEndpoint*>(arg); + if (error == GRPC_ERROR_NONE) { + ep->stream_sync->NotifyOnRead(&ep->read_action); + } else { + grpc_slice_buffer_reset_and_unref_internal(ep->read_slices); + CallReadCb(ep, error); + EP_UNREF(ep, "read"); + } +} + +static void CFStreamRead(grpc_endpoint* ep, grpc_slice_buffer* slices, + grpc_closure* cb) { + CFStreamEndpoint* ep_impl = reinterpret_cast<CFStreamEndpoint*>(ep); + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CFStream endpoint:%p read (%p, %p) length:%zu", ep_impl, + slices, cb, slices->length); + } + GPR_ASSERT(ep_impl->read_cb == nullptr); + ep_impl->read_cb = cb; + ep_impl->read_slices = slices; + grpc_slice_buffer_reset_and_unref_internal(slices); + grpc_resource_user_alloc_slices(&ep_impl->slice_allocator, + GRPC_TCP_DEFAULT_READ_SLICE_SIZE, 1, + ep_impl->read_slices); + EP_REF(ep_impl, "read"); +} + +static void CFStreamWrite(grpc_endpoint* ep, grpc_slice_buffer* slices, + grpc_closure* cb) { + CFStreamEndpoint* ep_impl = reinterpret_cast<CFStreamEndpoint*>(ep); + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CFStream endpoint:%p write (%p, %p) length:%zu", + ep_impl, slices, cb, slices->length); + } + GPR_ASSERT(ep_impl->write_cb == nullptr); + ep_impl->write_cb = cb; + ep_impl->write_slices = slices; + EP_REF(ep_impl, "write"); + ep_impl->stream_sync->NotifyOnWrite(&ep_impl->write_action); +} + +void CFStreamShutdown(grpc_endpoint* ep, grpc_error* why) { + CFStreamEndpoint* ep_impl = reinterpret_cast<CFStreamEndpoint*>(ep); + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CFStream endpoint:%p shutdown (%p)", ep_impl, why); + } + CFReadStreamClose(ep_impl->read_stream); + CFWriteStreamClose(ep_impl->write_stream); + ep_impl->stream_sync->Shutdown(why); + grpc_resource_user_shutdown(ep_impl->resource_user); + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CFStream endpoint:%p shutdown DONE (%p)", ep_impl, why); + } +} + +void CFStreamDestroy(grpc_endpoint* ep) { + CFStreamEndpoint* ep_impl = reinterpret_cast<CFStreamEndpoint*>(ep); + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CFStream endpoint:%p destroy", ep_impl); + } + EP_UNREF(ep_impl, "destroy"); +} + +grpc_resource_user* CFStreamGetResourceUser(grpc_endpoint* ep) { + CFStreamEndpoint* ep_impl = reinterpret_cast<CFStreamEndpoint*>(ep); + return ep_impl->resource_user; +} + +char* CFStreamGetPeer(grpc_endpoint* ep) { + CFStreamEndpoint* ep_impl = reinterpret_cast<CFStreamEndpoint*>(ep); + return gpr_strdup(ep_impl->peer_string); +} + +int CFStreamGetFD(grpc_endpoint* ep) { return 0; } + +void CFStreamAddToPollset(grpc_endpoint* ep, grpc_pollset* pollset) {} +void CFStreamAddToPollsetSet(grpc_endpoint* ep, grpc_pollset_set* pollset) {} +void CFStreamDeleteFromPollsetSet(grpc_endpoint* ep, + grpc_pollset_set* pollset) {} + +static const grpc_endpoint_vtable vtable = {CFStreamRead, + CFStreamWrite, + CFStreamAddToPollset, + CFStreamAddToPollsetSet, + CFStreamDeleteFromPollsetSet, + CFStreamShutdown, + CFStreamDestroy, + CFStreamGetResourceUser, + CFStreamGetPeer, + CFStreamGetFD}; + +grpc_endpoint* grpc_cfstream_endpoint_create( + CFReadStreamRef read_stream, CFWriteStreamRef write_stream, + const char* peer_string, grpc_resource_quota* resource_quota, + CFStreamHandle* stream_sync) { + CFStreamEndpoint* ep_impl = + static_cast<CFStreamEndpoint*>(gpr_malloc(sizeof(CFStreamEndpoint))); + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, + "CFStream endpoint:%p create readStream:%p writeStream: %p", + ep_impl, read_stream, write_stream); + } + ep_impl->base.vtable = &vtable; + gpr_ref_init(&ep_impl->refcount, 1); + ep_impl->read_stream = read_stream; + ep_impl->write_stream = write_stream; + CFRetain(read_stream); + CFRetain(write_stream); + ep_impl->stream_sync = stream_sync; + CFSTREAM_HANDLE_REF(ep_impl->stream_sync, "endpoint create"); + + ep_impl->peer_string = gpr_strdup(peer_string); + ep_impl->read_cb = nil; + ep_impl->write_cb = nil; + ep_impl->read_slices = nil; + ep_impl->write_slices = nil; + GRPC_CLOSURE_INIT(&ep_impl->read_action, ReadAction, + static_cast<void*>(ep_impl), grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&ep_impl->write_action, WriteAction, + static_cast<void*>(ep_impl), grpc_schedule_on_exec_ctx); + ep_impl->resource_user = + grpc_resource_user_create(resource_quota, peer_string); + grpc_resource_user_slice_allocator_init(&ep_impl->slice_allocator, + ep_impl->resource_user, + CFStreamReadAllocationDone, ep_impl); + + return &ep_impl->base; +} + +#endif /* GRPC_CFSTREAM_ENDPOINT */ diff --git a/src/core/lib/iomgr/endpoint_cfstream.h b/src/core/lib/iomgr/endpoint_cfstream.h new file mode 100644 index 0000000000..ef957c1f11 --- /dev/null +++ b/src/core/lib/iomgr/endpoint_cfstream.h @@ -0,0 +1,49 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_IOMGR_ENDPOINT_CFSTREAM_H +#define GRPC_CORE_LIB_IOMGR_ENDPOINT_CFSTREAM_H +/* + Low level TCP "bottom half" implementation, for use by transports built on + top of a TCP connection. + + Note that this file does not (yet) include APIs for creating the socket in + the first place. + + All calls passing slice transfer ownership of a slice refcount unless + otherwise specified. +*/ + +#include <grpc/support/port_platform.h> + +#ifdef GRPC_CFSTREAM + +#import <CoreFoundation/CoreFoundation.h> + +#include "src/core/lib/debug/trace.h" +#include "src/core/lib/iomgr/cfstream_handle.h" +#include "src/core/lib/iomgr/endpoint.h" + +grpc_endpoint* grpc_cfstream_endpoint_create( + CFReadStreamRef read_stream, CFWriteStreamRef write_stream, + const char* peer_string, grpc_resource_quota* resource_quota, + CFStreamHandle* stream_sync); + +#endif /* GRPC_CFSTREAM */ + +#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_CFSTREAM_H */ diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc index 4088cf612e..90ed34da11 100644 --- a/src/core/lib/iomgr/error.cc +++ b/src/core/lib/iomgr/error.cc @@ -312,6 +312,12 @@ static void internal_add_error(grpc_error** err, grpc_error* new_err) { // It is very common to include and extra int and string in an error #define SURPLUS_CAPACITY (2 * SLOTS_PER_INT + SLOTS_PER_TIME) +static bool g_error_creation_allowed = true; + +void grpc_disable_error_creation() { g_error_creation_allowed = false; } + +void grpc_enable_error_creation() { g_error_creation_allowed = true; } + grpc_error* grpc_error_create(const char* file, int line, grpc_slice desc, grpc_error** referencing, size_t num_referencing) { @@ -326,6 +332,12 @@ grpc_error* grpc_error_create(const char* file, int line, grpc_slice desc, return GRPC_ERROR_OOM; } #ifndef NDEBUG + if (!g_error_creation_allowed) { + gpr_log(GPR_ERROR, + "Error creation occurred when error creation was disabled [%s:%d]", + file, line); + abort(); + } if (grpc_trace_error_refcount.enabled()) { gpr_log(GPR_DEBUG, "%p create [%s:%d]", err, file, line); } diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index f8cae4da82..27c4d22fd1 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -123,6 +123,11 @@ typedef enum { #define GRPC_ERROR_OOM ((grpc_error*)2) #define GRPC_ERROR_CANCELLED ((grpc_error*)4) +// debug only toggles that allow for a sanity to check that ensures we will +// never create any errors in the per-RPC hotpath. +void grpc_disable_error_creation(); +void grpc_enable_error_creation(); + const char* grpc_error_string(grpc_error* error); /// Create an error - but use GRPC_ERROR_CREATE instead diff --git a/src/core/lib/iomgr/error_cfstream.cc b/src/core/lib/iomgr/error_cfstream.cc new file mode 100644 index 0000000000..d7af8c377f --- /dev/null +++ b/src/core/lib/iomgr/error_cfstream.cc @@ -0,0 +1,52 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <grpc/support/port_platform.h> + +#ifdef GRPC_CFSTREAM +#include <CoreFoundation/CoreFoundation.h> + +#include <grpc/support/alloc.h> +#include <grpc/support/string_util.h> + +#include "src/core/lib/iomgr/error.h" + +#define MAX_ERROR_DESCRIPTION 256 + +grpc_error* grpc_error_create_from_cferror(const char* file, int line, + void* arg, const char* custom_desc) { + CFErrorRef error = static_cast<CFErrorRef>(arg); + char buf_domain[MAX_ERROR_DESCRIPTION]; + char buf_desc[MAX_ERROR_DESCRIPTION]; + char* error_msg; + CFErrorDomain domain = CFErrorGetDomain((error)); + CFIndex code = CFErrorGetCode((error)); + CFStringRef desc = CFErrorCopyDescription((error)); + CFStringGetCString(domain, buf_domain, MAX_ERROR_DESCRIPTION, + kCFStringEncodingUTF8); + CFStringGetCString(desc, buf_desc, MAX_ERROR_DESCRIPTION, + kCFStringEncodingUTF8); + gpr_asprintf(&error_msg, "%s (error domain:%s, code:%ld, description:%s)", + custom_desc, buf_domain, code, buf_desc); + CFRelease(desc); + grpc_error* return_error = grpc_error_create( + file, line, grpc_slice_from_copied_string(error_msg), NULL, 0); + gpr_free(error_msg); + return return_error; +} +#endif /* GRPC_CFSTREAM */ diff --git a/src/core/lib/iomgr/error_cfstream.h b/src/core/lib/iomgr/error_cfstream.h new file mode 100644 index 0000000000..06ab751329 --- /dev/null +++ b/src/core/lib/iomgr/error_cfstream.h @@ -0,0 +1,31 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_IOMGR_ERROR_CFSTREAM_H +#define GRPC_CORE_LIB_IOMGR_ERROR_CFSTREAM_H + +#ifdef GRPC_CFSTREAM +// Create an error from Apple Core Foundation CFError object +#define GRPC_ERROR_CREATE_FROM_CFERROR(error, desc) \ + grpc_error_create_from_cferror(__FILE__, __LINE__, \ + static_cast<void*>((error)), (desc)) +grpc_error* grpc_error_create_from_cferror(const char* file, int line, + void* arg, const char* desc); +#endif /* GRPC_CFSTREAM */ + +#endif /* GRPC_CORE_LIB_IOMGR_ERROR_CFSTREAM_H */ diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index 554522598c..98ab974057 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -1264,12 +1264,12 @@ const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request) { } #else /* defined(GRPC_LINUX_EPOLL) */ -#if defined(GRPC_POSIX_SOCKET) +#if defined(GRPC_POSIX_SOCKET_EV_EPOLL1) #include "src/core/lib/iomgr/ev_epoll1_linux.h" /* If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return * NULL */ const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request) { return nullptr; } -#endif /* defined(GRPC_POSIX_SOCKET) */ +#endif /* defined(GRPC_POSIX_SOCKET_EV_EPOLL1) */ #endif /* !defined(GRPC_LINUX_EPOLL) */ diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc index be400c6ee9..f22eb8ee87 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.cc +++ b/src/core/lib/iomgr/ev_epollex_linux.cc @@ -1586,7 +1586,7 @@ const grpc_event_engine_vtable* grpc_init_epollex_linux( } #else /* defined(GRPC_LINUX_EPOLL_CREATE1) */ -#if defined(GRPC_POSIX_SOCKET) +#if defined(GRPC_POSIX_SOCKET_EV_EPOLLEX) #include "src/core/lib/iomgr/ev_epollex_linux.h" /* If GRPC_LINUX_EPOLL_CREATE1 is not defined, it means epoll_create1 is not available. Return NULL */ @@ -1594,6 +1594,6 @@ const grpc_event_engine_vtable* grpc_init_epollex_linux( bool explicitly_requested) { return nullptr; } -#endif /* defined(GRPC_POSIX_SOCKET) */ +#endif /* defined(GRPC_POSIX_SOCKET_EV_EPOLLEX) */ #endif /* !defined(GRPC_LINUX_EPOLL_CREATE1) */ diff --git a/src/core/lib/iomgr/ev_epollsig_linux.cc b/src/core/lib/iomgr/ev_epollsig_linux.cc index 6c0f0c91f3..20512e31ac 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.cc +++ b/src/core/lib/iomgr/ev_epollsig_linux.cc @@ -1750,7 +1750,7 @@ const grpc_event_engine_vtable* grpc_init_epollsig_linux( } #else /* defined(GRPC_LINUX_EPOLL_CREATE1) */ -#if defined(GRPC_POSIX_SOCKET) +#if defined(GRPC_POSIX_SOCKET_EV_EPOLLSIG) #include "src/core/lib/iomgr/ev_epollsig_linux.h" /* If GRPC_LINUX_EPOLL_CREATE1 is not defined, it means epoll_create1 is not available. Return NULL */ diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index 06378bba25..df6b0e1e89 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -20,7 +20,7 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_EV_POLL #include "src/core/lib/iomgr/ev_poll_posix.h" @@ -1769,4 +1769,4 @@ const grpc_event_engine_vtable* grpc_init_poll_cv_posix(bool explicit_request) { return &vtable; } -#endif +#endif /* GRPC_POSIX_SOCKET_EV_POLL */ diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc index efa91045d4..82b21df7ba 100644 --- a/src/core/lib/iomgr/ev_posix.cc +++ b/src/core/lib/iomgr/ev_posix.cc @@ -20,7 +20,7 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_EV #include "src/core/lib/iomgr/ev_posix.h" @@ -343,4 +343,4 @@ void grpc_pollset_set_del_fd(grpc_pollset_set* pollset_set, grpc_fd* fd) { g_event_engine->pollset_set_del_fd(pollset_set, fd); } -#endif // GRPC_POSIX_SOCKET +#endif // GRPC_POSIX_SOCKET_EV diff --git a/src/core/lib/iomgr/iomgr_posix.cc b/src/core/lib/iomgr/iomgr_posix.cc index 66c9cb7ff7..ca7334c9a4 100644 --- a/src/core/lib/iomgr/iomgr_posix.cc +++ b/src/core/lib/iomgr/iomgr_posix.cc @@ -20,7 +20,7 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_IOMGR #include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/ev_posix.h" @@ -64,4 +64,4 @@ void grpc_set_default_iomgr_platform() { grpc_set_iomgr_platform_vtable(&vtable); } -#endif /* GRPC_POSIX_SOCKET */ +#endif /* GRPC_POSIX_SOCKET_IOMGR */ diff --git a/src/core/lib/iomgr/polling_entity.cc b/src/core/lib/iomgr/polling_entity.cc index 9f164f65b0..dea07cae53 100644 --- a/src/core/lib/iomgr/polling_entity.cc +++ b/src/core/lib/iomgr/polling_entity.cc @@ -61,8 +61,11 @@ bool grpc_polling_entity_is_empty(const grpc_polling_entity* pollent) { void grpc_polling_entity_add_to_pollset_set(grpc_polling_entity* pollent, grpc_pollset_set* pss_dst) { if (pollent->tag == GRPC_POLLS_POLLSET) { - GPR_ASSERT(pollent->pollent.pollset != nullptr); - grpc_pollset_set_add_pollset(pss_dst, pollent->pollent.pollset); + // CFStream does not use file destriptors. When CFStream is used, the fd + // pollset is possible to be null. + if (pollent->pollent.pollset != nullptr) { + grpc_pollset_set_add_pollset(pss_dst, pollent->pollent.pollset); + } } else if (pollent->tag == GRPC_POLLS_POLLSET_SET) { GPR_ASSERT(pollent->pollent.pollset_set != nullptr); grpc_pollset_set_add_pollset_set(pss_dst, pollent->pollent.pollset_set); @@ -75,8 +78,14 @@ void grpc_polling_entity_add_to_pollset_set(grpc_polling_entity* pollent, void grpc_polling_entity_del_from_pollset_set(grpc_polling_entity* pollent, grpc_pollset_set* pss_dst) { if (pollent->tag == GRPC_POLLS_POLLSET) { +#ifdef GRPC_CFSTREAM + if (pollent->pollent.pollset != nullptr) { + grpc_pollset_set_del_pollset(pss_dst, pollent->pollent.pollset); + } +#else GPR_ASSERT(pollent->pollent.pollset != nullptr); grpc_pollset_set_del_pollset(pss_dst, pollent->pollent.pollset); +#endif } else if (pollent->tag == GRPC_POLLS_POLLSET_SET) { GPR_ASSERT(pollent->pollent.pollset_set != nullptr); grpc_pollset_set_del_pollset_set(pss_dst, pollent->pollent.pollset_set); diff --git a/src/core/lib/iomgr/port.h b/src/core/lib/iomgr/port.h index a397012003..80d8e63cdd 100644 --- a/src/core/lib/iomgr/port.h +++ b/src/core/lib/iomgr/port.h @@ -97,7 +97,26 @@ #define GRPC_MSG_IOVLEN_TYPE int #define GRPC_POSIX_FORK 1 #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#ifdef GRPC_CFSTREAM +#define GRPC_POSIX_SOCKET_IOMGR 1 +#define GRPC_CFSTREAM_ENDPOINT 1 +#define GRPC_CFSTREAM_CLIENT 1 +#define GRPC_POSIX_SOCKET_ARES_EV_DRIVER 1 +#define GRPC_POSIX_SOCKET_EV 1 +#define GRPC_POSIX_SOCKET_EV_EPOLL1 1 +#define GRPC_POSIX_SOCKET_EV_EPOLLEX 1 +#define GRPC_POSIX_SOCKET_EV_EPOLLSIG 1 +#define GRPC_POSIX_SOCKET_EV_POLL 1 +#define GRPC_POSIX_SOCKET_RESOLVE_ADDRESS 1 +#define GRPC_POSIX_SOCKET_SOCKADDR 1 +#define GRPC_POSIX_SOCKET_SOCKET_FACTORY 1 +#define GRPC_POSIX_SOCKET_TCP 1 +#define GRPC_POSIX_SOCKET_TCP_SERVER 1 +#define GRPC_POSIX_SOCKET_TCP_SERVER_UTILS_COMMON 1 +#define GRPC_POSIX_SOCKET_UTILS_COMMON 1 +#else #define GRPC_POSIX_SOCKET 1 +#endif #define GRPC_POSIX_SOCKETUTILS 1 #define GRPC_POSIX_SYSCONF 1 #define GRPC_POSIX_WAKEUP_FD 1 @@ -131,12 +150,30 @@ #endif #if defined(GRPC_POSIX_SOCKET) + defined(GRPC_WINSOCK_SOCKET) + \ - defined(GRPC_CUSTOM_SOCKET) != \ + defined(GRPC_CUSTOM_SOCKET) + defined(GRPC_CFSTREAM) != \ 1 #error \ "Must define exactly one of GRPC_POSIX_SOCKET, GRPC_WINSOCK_SOCKET, GRPC_CUSTOM_SOCKET" #endif +#ifdef GRPC_POSIX_SOCKET +#define GRPC_POSIX_SOCKET_ARES_EV_DRIVER 1 +#define GRPC_POSIX_SOCKET_EV 1 +#define GRPC_POSIX_SOCKET_EV_EPOLLEX 1 +#define GRPC_POSIX_SOCKET_EV_EPOLLSIG 1 +#define GRPC_POSIX_SOCKET_EV_POLL 1 +#define GRPC_POSIX_SOCKET_EV_EPOLL1 1 +#define GRPC_POSIX_SOCKET_IOMGR 1 +#define GRPC_POSIX_SOCKET_RESOLVE_ADDRESS 1 +#define GRPC_POSIX_SOCKET_SOCKADDR 1 +#define GRPC_POSIX_SOCKET_SOCKET_FACTORY 1 +#define GRPC_POSIX_SOCKET_TCP 1 +#define GRPC_POSIX_SOCKET_TCP_CLIENT 1 +#define GRPC_POSIX_SOCKET_TCP_SERVER 1 +#define GRPC_POSIX_SOCKET_TCP_SERVER_UTILS_COMMON 1 +#define GRPC_POSIX_SOCKET_UTILS_COMMON 1 +#endif + #if defined(GRPC_POSIX_HOST_NAME_MAX) && defined(GRPC_POSIX_SYSCONF) #error "Cannot define both GRPC_POSIX_HOST_NAME_MAX and GRPC_POSIX_SYSCONF" #endif diff --git a/src/core/lib/iomgr/resolve_address.h b/src/core/lib/iomgr/resolve_address.h index fe0d834582..6afe94a7a9 100644 --- a/src/core/lib/iomgr/resolve_address.h +++ b/src/core/lib/iomgr/resolve_address.h @@ -33,7 +33,7 @@ #include <ws2tcpip.h> #endif -#ifdef GRPC_POSIX_SOCKET +#if defined(GRPC_POSIX_SOCKET) || defined(GRPC_CFSTREAM) #include <sys/socket.h> #endif diff --git a/src/core/lib/iomgr/resolve_address_posix.cc b/src/core/lib/iomgr/resolve_address_posix.cc index a82075542f..7a825643e1 100644 --- a/src/core/lib/iomgr/resolve_address_posix.cc +++ b/src/core/lib/iomgr/resolve_address_posix.cc @@ -19,7 +19,7 @@ #include <grpc/support/port_platform.h> #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_RESOLVE_ADDRESS #include "src/core/lib/iomgr/sockaddr.h" diff --git a/src/core/lib/iomgr/sockaddr_posix.h b/src/core/lib/iomgr/sockaddr_posix.h index 5b18bbc465..3cedd9082d 100644 --- a/src/core/lib/iomgr/sockaddr_posix.h +++ b/src/core/lib/iomgr/sockaddr_posix.h @@ -23,7 +23,7 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_SOCKADDR #include <arpa/inet.h> #include <netdb.h> #include <netinet/in.h> diff --git a/src/core/lib/iomgr/socket_factory_posix.cc b/src/core/lib/iomgr/socket_factory_posix.cc index 1d1e36c0e3..57137769c8 100644 --- a/src/core/lib/iomgr/socket_factory_posix.cc +++ b/src/core/lib/iomgr/socket_factory_posix.cc @@ -20,7 +20,7 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_SOCKET_FACTORY #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/useful.h" diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc index 04a1767731..caee652307 100644 --- a/src/core/lib/iomgr/socket_utils_common_posix.cc +++ b/src/core/lib/iomgr/socket_utils_common_posix.cc @@ -20,7 +20,7 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_UTILS_COMMON #include "src/core/lib/iomgr/socket_utils.h" #include "src/core/lib/iomgr/socket_utils_posix.h" diff --git a/src/core/lib/iomgr/tcp_client_cfstream.cc b/src/core/lib/iomgr/tcp_client_cfstream.cc new file mode 100644 index 0000000000..ffed3bbef6 --- /dev/null +++ b/src/core/lib/iomgr/tcp_client_cfstream.cc @@ -0,0 +1,216 @@ + +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include <grpc/support/port_platform.h> + +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_CFSTREAM_CLIENT + +#include <CoreFoundation/CoreFoundation.h> + +#include <string.h> + +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/sync.h> + +#include <netinet/in.h> + +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gpr/host_port.h" +#include "src/core/lib/iomgr/cfstream_handle.h" +#include "src/core/lib/iomgr/closure.h" +#include "src/core/lib/iomgr/endpoint_cfstream.h" +#include "src/core/lib/iomgr/error.h" +#include "src/core/lib/iomgr/error_cfstream.h" +#include "src/core/lib/iomgr/sockaddr_utils.h" +#include "src/core/lib/iomgr/tcp_client.h" +#include "src/core/lib/iomgr/timer.h" + +extern grpc_core::TraceFlag grpc_tcp_trace; + +typedef struct CFStreamConnect { + gpr_mu mu; + gpr_refcount refcount; + + CFReadStreamRef read_stream; + CFWriteStreamRef write_stream; + CFStreamHandle* stream_sync; + + grpc_timer alarm; + grpc_closure on_alarm; + grpc_closure on_open; + + bool read_stream_open; + bool write_stream_open; + bool failed; + + grpc_closure* closure; + grpc_endpoint** endpoint; + int refs; + char* addr_name; + grpc_resource_quota* resource_quota; +} CFStreamConnect; + +static void CFStreamConnectCleanup(CFStreamConnect* connect) { + grpc_resource_quota_unref_internal(connect->resource_quota); + CFSTREAM_HANDLE_UNREF(connect->stream_sync, "async connect clean up"); + CFRelease(connect->read_stream); + CFRelease(connect->write_stream); + gpr_mu_destroy(&connect->mu); + gpr_free(connect->addr_name); + gpr_free(connect); +} + +static void OnAlarm(void* arg, grpc_error* error) { + CFStreamConnect* connect = static_cast<CFStreamConnect*>(arg); + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CLIENT_CONNECT :%p OnAlarm, error:%p", connect, error); + } + gpr_mu_lock(&connect->mu); + grpc_closure* closure = connect->closure; + connect->closure = nil; + const bool done = (--connect->refs == 0); + gpr_mu_unlock(&connect->mu); + // Only schedule a callback once, by either OnAlarm or OnOpen. The + // first one issues callback while the second one does cleanup. + if (done) { + CFStreamConnectCleanup(connect); + } else { + grpc_error* error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("connect() timed out"); + GRPC_CLOSURE_SCHED(closure, error); + } +} + +static void OnOpen(void* arg, grpc_error* error) { + CFStreamConnect* connect = static_cast<CFStreamConnect*>(arg); + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CLIENT_CONNECT :%p OnOpen, error:%p", connect, error); + } + gpr_mu_lock(&connect->mu); + grpc_timer_cancel(&connect->alarm); + grpc_closure* closure = connect->closure; + connect->closure = nil; + + bool done = (--connect->refs == 0); + grpc_endpoint** endpoint = connect->endpoint; + + // Only schedule a callback once, by either OnAlarm or OnOpen. The + // first one issues callback while the second one does cleanup. + if (done) { + gpr_mu_unlock(&connect->mu); + CFStreamConnectCleanup(connect); + } else { + if (error == GRPC_ERROR_NONE) { + CFErrorRef stream_error = CFReadStreamCopyError(connect->read_stream); + if (stream_error == NULL) { + stream_error = CFWriteStreamCopyError(connect->write_stream); + } + if (stream_error) { + error = GRPC_ERROR_CREATE_FROM_CFERROR(stream_error, "connect() error"); + CFRelease(stream_error); + } + if (error == GRPC_ERROR_NONE) { + *endpoint = grpc_cfstream_endpoint_create( + connect->read_stream, connect->write_stream, connect->addr_name, + connect->resource_quota, connect->stream_sync); + } + } else { + GRPC_ERROR_REF(error); + } + gpr_mu_unlock(&connect->mu); + GRPC_CLOSURE_SCHED(closure, error); + } +} + +static void ParseResolvedAddress(const grpc_resolved_address* addr, + CFStringRef* host, int* port) { + char *host_port, *host_string, *port_string; + grpc_sockaddr_to_string(&host_port, addr, 1); + gpr_split_host_port(host_port, &host_string, &port_string); + *host = CFStringCreateWithCString(NULL, host_string, kCFStringEncodingUTF8); + gpr_free(host_string); + gpr_free(port_string); + gpr_free(host_port); + *port = grpc_sockaddr_get_port(addr); +} + +static void CFStreamClientConnect(grpc_closure* closure, grpc_endpoint** ep, + grpc_pollset_set* interested_parties, + const grpc_channel_args* channel_args, + const grpc_resolved_address* resolved_addr, + grpc_millis deadline) { + CFStreamConnect* connect; + + connect = (CFStreamConnect*)gpr_zalloc(sizeof(CFStreamConnect)); + connect->closure = closure; + connect->endpoint = ep; + connect->addr_name = grpc_sockaddr_to_uri(resolved_addr); + // connect->resource_quota = resource_quota; + connect->refs = 2; // One for the connect operation, one for the timer. + gpr_ref_init(&connect->refcount, 1); + gpr_mu_init(&connect->mu); + + if (grpc_tcp_trace.enabled()) { + gpr_log(GPR_DEBUG, "CLIENT_CONNECT: %s: asynchronously connecting", + connect->addr_name); + } + + grpc_resource_quota* resource_quota = grpc_resource_quota_create(NULL); + if (channel_args != NULL) { + for (size_t i = 0; i < channel_args->num_args; i++) { + if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) { + grpc_resource_quota_unref_internal(resource_quota); + resource_quota = grpc_resource_quota_ref_internal( + (grpc_resource_quota*)channel_args->args[i].value.pointer.p); + } + } + } + connect->resource_quota = resource_quota; + + CFReadStreamRef read_stream; + CFWriteStreamRef write_stream; + + CFStringRef host; + int port; + ParseResolvedAddress(resolved_addr, &host, &port); + CFStreamCreatePairWithSocketToHost(NULL, host, port, &read_stream, + &write_stream); + CFRelease(host); + connect->read_stream = read_stream; + connect->write_stream = write_stream; + connect->stream_sync = + CFStreamHandle::CreateStreamHandle(read_stream, write_stream); + GRPC_CLOSURE_INIT(&connect->on_open, OnOpen, static_cast<void*>(connect), + grpc_schedule_on_exec_ctx); + connect->stream_sync->NotifyOnOpen(&connect->on_open); + GRPC_CLOSURE_INIT(&connect->on_alarm, OnAlarm, connect, + grpc_schedule_on_exec_ctx); + gpr_mu_lock(&connect->mu); + CFReadStreamOpen(read_stream); + CFWriteStreamOpen(write_stream); + grpc_timer_init(&connect->alarm, deadline, &connect->on_alarm); + gpr_mu_unlock(&connect->mu); +} + +grpc_tcp_client_vtable grpc_posix_tcp_client_vtable = {CFStreamClientConnect}; + +#endif /* GRPC_CFSTREAM_CLIENT */ diff --git a/src/core/lib/iomgr/tcp_client_custom.cc b/src/core/lib/iomgr/tcp_client_custom.cc index 932c79ea0b..9389861d07 100644 --- a/src/core/lib/iomgr/tcp_client_custom.cc +++ b/src/core/lib/iomgr/tcp_client_custom.cc @@ -140,12 +140,12 @@ static void tcp_connect(grpc_closure* closure, grpc_endpoint** ep, socket, connect->addr_name); } - grpc_custom_socket_vtable->connect( - socket, (const grpc_sockaddr*)resolved_addr->addr, resolved_addr->len, - custom_connect_callback); GRPC_CLOSURE_INIT(&connect->on_alarm, on_alarm, socket, grpc_schedule_on_exec_ctx); grpc_timer_init(&connect->alarm, deadline, &connect->on_alarm); + grpc_custom_socket_vtable->connect( + socket, (const grpc_sockaddr*)resolved_addr->addr, resolved_addr->len, + custom_connect_callback); } grpc_tcp_client_vtable custom_tcp_client_vtable = {tcp_connect}; diff --git a/src/core/lib/iomgr/tcp_client_posix.cc b/src/core/lib/iomgr/tcp_client_posix.cc index 1b43258a91..71e08f1230 100644 --- a/src/core/lib/iomgr/tcp_client_posix.cc +++ b/src/core/lib/iomgr/tcp_client_posix.cc @@ -20,7 +20,7 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_TCP_CLIENT #include "src/core/lib/iomgr/tcp_client_posix.h" diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index b79ffe20f1..43d545846d 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -20,7 +20,7 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_TCP #include "src/core/lib/iomgr/network_status_tracker.h" #include "src/core/lib/iomgr/tcp_posix.h" @@ -70,7 +70,9 @@ struct grpc_tcp { grpc_endpoint base; grpc_fd* em_fd; int fd; - bool finished_edge; + /* Used by the endpoint read function to distinguish the very first read call + * from the rest */ + bool is_first_read; double target_length; double bytes_read_this_round; gpr_refcount refcount; @@ -377,7 +379,6 @@ static void tcp_do_read(grpc_tcp* tcp) { ssize_t read_bytes; size_t i; - GPR_ASSERT(!tcp->finished_edge); GPR_ASSERT(tcp->incoming_buffer->count <= MAX_READ_IOVEC); for (i = 0; i < tcp->incoming_buffer->count; i++) { @@ -473,7 +474,6 @@ static void tcp_continue_read(grpc_tcp* tcp) { static void tcp_handle_read(void* arg /* grpc_tcp */, grpc_error* error) { grpc_tcp* tcp = static_cast<grpc_tcp*>(arg); - GPR_ASSERT(!tcp->finished_edge); if (grpc_tcp_trace.enabled()) { gpr_log(GPR_INFO, "TCP:%p got_read: %s", tcp, grpc_error_string(error)); } @@ -497,10 +497,17 @@ static void tcp_read(grpc_endpoint* ep, grpc_slice_buffer* incoming_buffer, grpc_slice_buffer_reset_and_unref_internal(incoming_buffer); grpc_slice_buffer_swap(incoming_buffer, &tcp->last_read_buffer); TCP_REF(tcp, "read"); - if (tcp->finished_edge) { - tcp->finished_edge = false; + if (tcp->is_first_read) { + /* Endpoint read called for the very first time. Register read callback with + * the polling engine */ + tcp->is_first_read = false; notify_on_read(tcp); } else { + /* Not the first time. We may or may not have more bytes available. In any + * case call tcp->read_done_closure (i.e tcp_handle_read()) which does the + * right thing (i.e calls tcp_do_read() which either reads the available + * bytes or calls notify_on_read() to be notified when new bytes become + * available */ GRPC_CLOSURE_SCHED(&tcp->read_done_closure, GRPC_ERROR_NONE); } } @@ -778,7 +785,8 @@ grpc_endpoint* grpc_tcp_create(grpc_fd* em_fd, tcp->min_read_chunk_size = tcp_min_read_chunk_size; tcp->max_read_chunk_size = tcp_max_read_chunk_size; tcp->bytes_read_this_round = 0; - tcp->finished_edge = true; + /* Will be set to false by the very first endpoint read function */ + tcp->is_first_read = true; /* paired with unref in grpc_tcp_destroy */ gpr_ref_init(&tcp->refcount, 1); gpr_atm_no_barrier_store(&tcp->shutdown_count, 0); @@ -811,4 +819,4 @@ void grpc_tcp_destroy_and_release_fd(grpc_endpoint* ep, int* fd, TCP_UNREF(tcp, "destroy"); } -#endif +#endif /* GRPC_POSIX_SOCKET_TCP */ diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc index b39a0754ba..ce18ff99e6 100644 --- a/src/core/lib/iomgr/tcp_server_posix.cc +++ b/src/core/lib/iomgr/tcp_server_posix.cc @@ -25,7 +25,7 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_TCP_SERVER #include "src/core/lib/iomgr/tcp_server.h" @@ -559,4 +559,4 @@ grpc_tcp_server_vtable grpc_posix_tcp_server_vtable = { tcp_server_shutdown_starting_add, tcp_server_unref, tcp_server_shutdown_listeners}; -#endif +#endif /* GRPC_POSIX_SOCKET_TCP_SERVER */ diff --git a/src/core/lib/iomgr/tcp_server_utils_posix_common.cc b/src/core/lib/iomgr/tcp_server_utils_posix_common.cc index f21f4ad015..b9f8145572 100644 --- a/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +++ b/src/core/lib/iomgr/tcp_server_utils_posix_common.cc @@ -20,7 +20,7 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_POSIX_SOCKET +#ifdef GRPC_POSIX_SOCKET_TCP_SERVER_UTILS_COMMON #include "src/core/lib/iomgr/tcp_server_utils_posix.h" @@ -217,4 +217,4 @@ error: return ret; } -#endif /* GRPC_POSIX_SOCKET */ +#endif /* GRPC_POSIX_SOCKET_TCP_SERVER_UTILS_COMMON */ diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc index 2129029737..43dd68e874 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc @@ -219,9 +219,11 @@ static void on_oauth2_token_fetcher_http_response(void* user_data, gpr_mu_lock(&c->mu); c->token_fetch_pending = false; c->access_token_md = GRPC_MDELEM_REF(access_token_md); - c->token_expiration = status == GRPC_CREDENTIALS_OK - ? grpc_core::ExecCtx::Get()->Now() + token_lifetime - : 0; + c->token_expiration = + status == GRPC_CREDENTIALS_OK + ? gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_millis(token_lifetime, GPR_TIMESPAN)) + : gpr_inf_past(GPR_CLOCK_MONOTONIC); grpc_oauth2_pending_get_request_metadata* pending_request = c->pending_requests; c->pending_requests = nullptr; @@ -259,8 +261,10 @@ static bool oauth2_token_fetcher_get_request_metadata( grpc_mdelem cached_access_token_md = GRPC_MDNULL; gpr_mu_lock(&c->mu); if (!GRPC_MDISNULL(c->access_token_md) && - (c->token_expiration - grpc_core::ExecCtx::Get()->Now() > - refresh_threshold)) { + gpr_time_cmp( + gpr_time_sub(c->token_expiration, gpr_now(GPR_CLOCK_MONOTONIC)), + gpr_time_from_seconds(GRPC_SECURE_TOKEN_REFRESH_THRESHOLD_SECS, + GPR_TIMESPAN)) > 0) { cached_access_token_md = GRPC_MDELEM_REF(c->access_token_md); } if (!GRPC_MDISNULL(cached_access_token_md)) { @@ -333,7 +337,7 @@ static void init_oauth2_token_fetcher(grpc_oauth2_token_fetcher_credentials* c, c->base.type = GRPC_CALL_CREDENTIALS_TYPE_OAUTH2; gpr_ref_init(&c->base.refcount, 1); gpr_mu_init(&c->mu); - c->token_expiration = 0; + c->token_expiration = gpr_inf_past(GPR_CLOCK_MONOTONIC); c->fetch_func = fetch_func; c->pollent = grpc_polling_entity_create_from_pollset_set(grpc_pollset_set_create()); diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.h b/src/core/lib/security/credentials/oauth2/oauth2_credentials.h index c0dd1546e3..12a1d4484f 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.h @@ -71,7 +71,7 @@ typedef struct { grpc_call_credentials base; gpr_mu mu; grpc_mdelem access_token_md; - grpc_millis token_expiration; + gpr_timespec token_expiration; bool token_fetch_pending; grpc_oauth2_pending_get_request_metadata* pending_requests; grpc_httpcli_context httpcli_context; diff --git a/src/core/lib/security/util/json_util.cc b/src/core/lib/security/util/json_util.cc index 75512a19c9..fe9f5fe3d3 100644 --- a/src/core/lib/security/util/json_util.cc +++ b/src/core/lib/security/util/json_util.cc @@ -29,6 +29,10 @@ const char* grpc_json_get_string_property(const grpc_json* json, const char* prop_name) { grpc_json* child; for (child = json->child; child != nullptr; child = child->next) { + if (child->key == nullptr) { + gpr_log(GPR_ERROR, "Invalid (null) JSON key encountered"); + return nullptr; + } if (strcmp(child->key, prop_name) == 0) break; } if (child == nullptr || child->type != GRPC_JSON_STRING) { diff --git a/src/core/lib/slice/slice_buffer.cc b/src/core/lib/slice/slice_buffer.cc index fd56997388..1f1c08b159 100644 --- a/src/core/lib/slice/slice_buffer.cc +++ b/src/core/lib/slice/slice_buffer.cc @@ -333,14 +333,26 @@ void grpc_slice_buffer_trim_end(grpc_slice_buffer* sb, size_t n, size_t slice_len = GRPC_SLICE_LENGTH(slice); if (slice_len > n) { sb->slices[idx] = grpc_slice_split_head(&slice, slice_len - n); - grpc_slice_buffer_add_indexed(garbage, slice); + if (garbage) { + grpc_slice_buffer_add_indexed(garbage, slice); + } else { + grpc_slice_unref_internal(slice); + } return; } else if (slice_len == n) { - grpc_slice_buffer_add_indexed(garbage, slice); + if (garbage) { + grpc_slice_buffer_add_indexed(garbage, slice); + } else { + grpc_slice_unref_internal(slice); + } sb->count = idx; return; } else { - grpc_slice_buffer_add_indexed(garbage, slice); + if (garbage) { + grpc_slice_buffer_add_indexed(garbage, slice); + } else { + grpc_slice_unref_internal(slice); + } n -= slice_len; sb->count = idx; } diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 86e0afa6ee..1cf8ea94e7 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -516,7 +516,6 @@ static void release_call(void* call, grpc_error* error) { grpc_call* c = static_cast<grpc_call*>(call); grpc_channel* channel = c->channel; grpc_call_combiner_destroy(&c->call_combiner); - gpr_free((char*)c->peer_string); grpc_channel_update_call_size_estimate(channel, gpr_arena_destroy(c->arena)); GRPC_CHANNEL_INTERNAL_UNREF(channel, "call"); } diff --git a/src/core/lib/transport/transport.cc b/src/core/lib/transport/transport.cc index 6b41e4b37e..039d603394 100644 --- a/src/core/lib/transport/transport.cc +++ b/src/core/lib/transport/transport.cc @@ -184,7 +184,8 @@ void grpc_transport_set_pops(grpc_transport* transport, grpc_stream* stream, nullptr) { transport->vtable->set_pollset_set(transport, stream, pollset_set); } else { - abort(); + // No-op for empty pollset. Empty pollset is possible when using + // non-fd-based event engines such as CFStream. } } diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 10e9df0f7c..b2e252d939 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -168,13 +168,11 @@ struct grpc_transport_stream_op_batch_payload { /** Iff send_initial_metadata != NULL, flags associated with send_initial_metadata: a bitfield of GRPC_INITIAL_METADATA_xxx */ uint32_t send_initial_metadata_flags; - // If non-NULL, will be set by the transport to the peer string - // (a char*, which the caller takes ownership of). + // If non-NULL, will be set by the transport to the peer string (a char*). + // The transport retains ownership of the string. // Note: This pointer may be used by the transport after the // send_initial_metadata op is completed. It must remain valid // until the call is destroyed. - // Note: When a transport sets this, it must free the previous - // value, if any. gpr_atm* peer_string; } send_initial_metadata; @@ -202,13 +200,11 @@ struct grpc_transport_stream_op_batch_payload { // immediately available. This may be a signal that we received a // Trailers-Only response. bool* trailing_metadata_available; - // If non-NULL, will be set by the transport to the peer string - // (a char*, which the caller takes ownership of). + // If non-NULL, will be set by the transport to the peer string (a char*). + // The transport retains ownership of the string. // Note: This pointer may be used by the transport after the // recv_initial_metadata op is completed. It must remain valid // until the call is destroyed. - // Note: When a transport sets this, it must free the previous - // value, if any. gpr_atm* peer_string; } recv_initial_metadata; diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index e951801965..7f5b439dfb 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -39,8 +39,8 @@ static void do_plugin_list_init(void) { } ServerBuilder::ServerBuilder() - : max_receive_message_size_(-1), - max_send_message_size_(-1), + : max_receive_message_size_(INT_MIN), + max_send_message_size_(INT_MIN), sync_server_settings_(SyncServerSettings()), resource_quota_(nullptr), generic_service_(nullptr) { @@ -186,10 +186,12 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() { (*plugin)->UpdateChannelArguments(&args); } - if (max_receive_message_size_ >= 0) { + if (max_receive_message_size_ >= -1) { args.SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, max_receive_message_size_); } + // The default message size is -1 (max), so no need to explicitly set it for + // -1. if (max_send_message_size_ >= 0) { args.SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, max_send_message_size_); } diff --git a/src/csharp/Grpc.Core.NativeDebug.nuspec b/src/csharp/Grpc.Core.NativeDebug.nuspec new file mode 100644 index 0000000000..d4bb8ad223 --- /dev/null +++ b/src/csharp/Grpc.Core.NativeDebug.nuspec @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<package> + <metadata> + <id>Grpc.Core.NativeDebug</id> + <title>Grpc.Core: Native Debug Symbols</title> + <summary>Debug symbols for the native library contained in Grpc.Core</summary> + <description>Currently contains grpc_csharp_ext.pdb</description> + <version>$version$</version> + <authors>Google Inc.</authors> + <owners>grpc-packages</owners> + <licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl> + <projectUrl>https://github.com/grpc/grpc</projectUrl> + <requireLicenseAcceptance>false</requireLicenseAcceptance> + <releaseNotes>Release $version$</releaseNotes> + <copyright>Copyright 2015, Google Inc.</copyright> + <tags>gRPC RPC Protocol HTTP/2</tags> + </metadata> + <files> + <!-- forward slashes in src path enable building on Linux --> + <file src="nativelibs/csharp_ext_windows_x86/grpc_csharp_ext.dll" target="runtimes/win/native/grpc_csharp_ext.x86.dll" /> + <file src="nativelibs/csharp_ext_windows_x86/grpc_csharp_ext.pdb" target="runtimes/win/native/grpc_csharp_ext.x86.pdb" /> + <file src="nativelibs/csharp_ext_windows_x64/grpc_csharp_ext.dll" target="runtimes/win/native/grpc_csharp_ext.x64.dll" /> + <file src="nativelibs/csharp_ext_windows_x64/grpc_csharp_ext.pdb" target="runtimes/win/native/grpc_csharp_ext.x64.pdb" /> + </files> +</package> diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index 045708b947..a4739da81d 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -17,7 +17,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index a26f483981..ebd890e48d 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -20,7 +20,7 @@ // The canonical version of this proto can be found at // https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto // -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs index 20b933fdfa..e2a4b93cef 100644 --- a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs @@ -19,7 +19,7 @@ // // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.IntegrationTesting/EmptyService.cs b/src/csharp/Grpc.IntegrationTesting/EmptyService.cs new file mode 100644 index 0000000000..e9fe5b79ef --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/EmptyService.cs @@ -0,0 +1,38 @@ +// <auto-generated> +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: src/proto/grpc/testing/empty_service.proto +// </auto-generated> +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Grpc.Testing { + + /// <summary>Holder for reflection information generated from src/proto/grpc/testing/empty_service.proto</summary> + public static partial class EmptyServiceReflection { + + #region Descriptor + /// <summary>File descriptor for src/proto/grpc/testing/empty_service.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static EmptyServiceReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CipzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL2VtcHR5X3NlcnZpY2UucHJvdG8S", + "DGdycGMudGVzdGluZzIOCgxFbXB0eVNlcnZpY2ViBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null)); + } + #endregion + + } +} + +#endregion Designer generated code diff --git a/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs new file mode 100644 index 0000000000..2d233fbdc0 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs @@ -0,0 +1,85 @@ +// <auto-generated> +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: src/proto/grpc/testing/empty_service.proto +// </auto-generated> +// Original file comments: +// Copyright 2018 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Grpc.Testing { + /// <summary> + /// A service that has zero methods. + /// See https://github.com/grpc/grpc/issues/15574 + /// </summary> + public static partial class EmptyService + { + static readonly string __ServiceName = "grpc.testing.EmptyService"; + + + /// <summary>Service descriptor</summary> + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Grpc.Testing.EmptyServiceReflection.Descriptor.Services[0]; } + } + + /// <summary>Base class for server-side implementations of EmptyService</summary> + public abstract partial class EmptyServiceBase + { + } + + /// <summary>Client for EmptyService</summary> + public partial class EmptyServiceClient : grpc::ClientBase<EmptyServiceClient> + { + /// <summary>Creates a new client for EmptyService</summary> + /// <param name="channel">The channel to use to make remote calls.</param> + public EmptyServiceClient(grpc::Channel channel) : base(channel) + { + } + /// <summary>Creates a new client for EmptyService that uses a custom <c>CallInvoker</c>.</summary> + /// <param name="callInvoker">The callInvoker to use to make remote calls.</param> + public EmptyServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary> + protected EmptyServiceClient() : base() + { + } + /// <summary>Protected constructor to allow creation of configured clients.</summary> + /// <param name="configuration">The client configuration.</param> + protected EmptyServiceClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary> + protected override EmptyServiceClient NewInstance(ClientBaseConfiguration configuration) + { + return new EmptyServiceClient(configuration); + } + } + + /// <summary>Creates service definition that can be registered with a server</summary> + /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> + public static grpc::ServerServiceDefinition BindService(EmptyServiceBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder().Build(); + } + + } +} +#endregion diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index d18b9e7d5e..e8c566e167 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -23,7 +23,7 @@ // Currently, 'Gauge' (i.e a metric that represents the measured value of // something at an instant of time) is the only metric type supported by the // service. -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs index c9c6f75c8c..60a3890f21 100644 --- a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs @@ -19,7 +19,7 @@ // // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index 6c4b77f7ac..aec4ce7be7 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -20,7 +20,7 @@ // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. // -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs index ede3ace461..85f2cfd871 100644 --- a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs @@ -19,7 +19,7 @@ // // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs index e2263cfc90..387c9fb52f 100644 --- a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs +++ b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs @@ -19,7 +19,7 @@ // // Service exported by server reflection // -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 924d7b1697..f1111781e2 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -47,6 +47,7 @@ xcopy /Y /I nativelibs\csharp_ext_windows_x64\grpc_csharp_ext.dll ..\..\cmake\bu %DOTNET% pack --configuration Release Grpc.Reflection --output ..\..\..\artifacts || goto :error %NUGET% pack Grpc.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts || goto :error +%NUGET% pack Grpc.Core.NativeDebug.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts %NUGET% pack Grpc.Tools.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts @rem copy resulting nuget packages to artifacts directory diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index 5c73a8f95f..fb4138a4b2 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -46,6 +46,7 @@ dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts nuget pack Grpc.nuspec -Version "1.13.0-dev" -OutputDirectory ../../artifacts +nuget pack Grpc.Core.NativeDebug.nuspec -Version "1.13.0-dev" -OutputDirectory ../../artifacts nuget pack Grpc.Tools.nuspec -Version "1.13.0-dev" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/csharp/generate_proto_csharp.sh b/src/csharp/generate_proto_csharp.sh index 1a38f860e8..e79728ff95 100755 --- a/src/csharp/generate_proto_csharp.sh +++ b/src/csharp/generate_proto_csharp.sh @@ -42,4 +42,4 @@ $PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR/CoreStats --grpc_out=$TESTING # don't match the package names. Setting -I to the correct value src/proto # breaks the code generation. $PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR --grpc_out=$TESTING_DIR \ - -I . src/proto/grpc/testing/{control,echo_messages,empty,messages,metrics,payloads,benchmark_service,report_qps_scenario_service,worker_service,stats,test}.proto + -I . src/proto/grpc/testing/{control,echo_messages,empty,empty_service,messages,metrics,payloads,benchmark_service,report_qps_scenario_service,worker_service,stats,test}.proto diff --git a/src/objective-c/BoringSSL.podspec b/src/objective-c/BoringSSL.podspec index d55a56ec18..363983183e 100644 --- a/src/objective-c/BoringSSL.podspec +++ b/src/objective-c/BoringSSL.podspec @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL' - version = '10.0.4' + version = '10.0.5' s.version = version s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google’s needs.' # Adapted from the homepage: @@ -61,8 +61,7 @@ Pod::Spec.new do |s| Currently BoringSSL is the SSL library in Chrome/Chromium, Android (but it’s not part of the NDK) and a number of other apps/programs. DESC - s.homepage = 'https://boringssl.googlesource.com/boringssl/' - s.documentation_url = 'https://commondatastorage.googleapis.com/chromium-boringssl-docs/headers.html' + s.homepage = 'https://github.com/google/boringssl' s.license = { :type => 'Mixed', :file => 'LICENSE' } # "The name and email addresses of the library maintainers, not the Podspec maintainer." s.authors = 'Adam Langley', 'David Benjamin', 'Matt Braithwaite' diff --git a/src/objective-c/GRPCClient/GRPCCall+MobileLog.h b/src/objective-c/GRPCClient/GRPCCall+MobileLog.h deleted file mode 100644 index 53b347d9ca..0000000000 --- a/src/objective-c/GRPCClient/GRPCCall+MobileLog.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "GRPCCall.h" - -@interface GRPCCall (MobileLog) -// Set the object to be passed down along channel stack with channel arg -// GRPC_ARG_MOBILE_LOG_CONFIG. The setting may be used by custom channel -// filters for metrics logging. -+ (void)setLogConfig:(id)logConfig; - -// Obtain the object to be passed down along channel stack with channel arg -// GRPC_ARG_MOBILE_LOG_CONFIG. -+ (id)logConfig; -@end diff --git a/src/objective-c/GRPCClient/GRPCCall+MobileLog.m b/src/objective-c/GRPCClient/GRPCCall+MobileLog.m deleted file mode 100644 index 4dedb7de8b..0000000000 --- a/src/objective-c/GRPCClient/GRPCCall+MobileLog.m +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import "GRPCCall+MobileLog.h" - -static id globalLogConfig = nil; - -@implementation GRPCCall (MobileLog) - -+ (void)setLogConfig:(id)logConfig { - globalLogConfig = logConfig; -} - -+ (id)logConfig { - return globalLogConfig; -} - -@end diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m index 57dbde8d04..bda1c3360b 100644 --- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m @@ -20,6 +20,14 @@ #import <grpc/grpc.h> +#ifdef GRPC_CFSTREAM +const grpc_completion_queue_attributes kCompletionQueueAttr = {GRPC_CQ_CURRENT_VERSION, + GRPC_CQ_NEXT, GRPC_CQ_NON_POLLING}; +#else +const grpc_completion_queue_attributes kCompletionQueueAttr = { + GRPC_CQ_CURRENT_VERSION, GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING}; +#endif + @implementation GRPCCompletionQueue + (instancetype)completionQueue { @@ -33,7 +41,8 @@ - (instancetype)init { if ((self = [super init])) { - _unmanagedQueue = grpc_completion_queue_create_for_next(NULL); + _unmanagedQueue = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&kCompletionQueueAttr), &kCompletionQueueAttr, NULL); // This is for the following block to capture the pointer by value (instead // of retaining self and doing self->_unmanagedQueue). This is essential diff --git a/src/objective-c/GRPCClient/private/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCHost.h index 6697f61be4..d9916d9303 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.h +++ b/src/objective-c/GRPCClient/private/GRPCHost.h @@ -37,6 +37,7 @@ struct grpc_channel_credentials; @property(nonatomic) grpc_compression_algorithm compressAlgorithm; @property(nonatomic) int keepaliveInterval; @property(nonatomic) int keepaliveTimeout; +@property(nonatomic) id logContext; /** The following properties should only be modified for testing: */ diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m index c3ea9afc37..bd5fd94118 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -18,7 +18,6 @@ #import "GRPCHost.h" -#import <GRPCClient/GRPCCall+MobileLog.h> #import <GRPCClient/GRPCCall.h> #include <grpc/grpc.h> #include <grpc/grpc_security.h> @@ -223,9 +222,9 @@ static NSMutableDictionary *kHostCache; args[@GRPC_ARG_KEEPALIVE_TIMEOUT_MS] = [NSNumber numberWithInt:_keepaliveTimeout]; } - id logConfig = [GRPCCall logConfig]; - if (logConfig != nil) { - args[@GRPC_ARG_MOBILE_LOG_CONFIG] = logConfig; + id logContext = self.logContext; + if (logContext != nil) { + args[@GRPC_ARG_MOBILE_LOG_CONTEXT] = logContext; } if (useCronet) { diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj index ab7159cda2..cdd1c6c8f7 100644 --- a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -325,6 +325,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Sample/Info.plist; + LD_GENERATE_MAP_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.grpc.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -337,6 +338,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Sample/Info.plist; + LD_GENERATE_MAP_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.grpc.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme b/src/objective-c/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme index d399e22e46..e356ea22a6 100644 --- a/src/objective-c/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme @@ -42,7 +42,7 @@ </AdditionalOptions> </TestAction> <LaunchAction - buildConfiguration = "Debug" + buildConfiguration = "Release" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle = "0" diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index b6e389715a..3c2a34fb49 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -37,6 +37,27 @@ GRPC_LOCAL_SRC = '../../..' end %w( + InteropTestsRemoteCFStream + InteropTestsLocalSSLCFStream + InteropTestsLocalCleartextCFStream +).each do |target_name| + target target_name do + pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true + + pod '!ProtoCompiler', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" + pod '!ProtoCompiler-gRPCPlugin', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" + + pod 'BoringSSL', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true + + pod 'gRPC/CFStream', :path => GRPC_LOCAL_SRC + pod 'gRPC-Core/CFStream-Implementation', :path => GRPC_LOCAL_SRC + pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC + pod 'gRPC-ProtoRPC', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true + pod 'RemoteTest', :path => "RemoteTestClient", :inhibit_warnings => true + end +end + +%w( CoreCronetEnd2EndTests CronetUnitTests ).each do |target_name| @@ -65,7 +86,7 @@ end # TODO(jcanizales): Send a PR to Cocoapods to get rid of this need. pre_install do |installer| # This is the gRPC-Core podspec object, as initialized by its podspec file. - grpc_core_spec = installer.pod_targets.find{|t| t.name == 'gRPC-Core'}.root_spec + grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec # Copied from gRPC-Core.podspec, except for the adjusted src_root: src_root = "$(PODS_ROOT)/../#{GRPC_LOCAL_SRC}" @@ -96,7 +117,11 @@ post_install do |installer| # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void # function" warning config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO' - config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1' + if target.name.include?('CFStream') + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CFSTREAM=1' + else + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1' + end end end @@ -104,7 +129,7 @@ post_install do |installer| # the test target 'InteropTestsRemoteWithCronet' # Activate GRPCCall+InternalTests functions for the dedicated build configuration 'Test', which will # be used by all test targets using it. - if target.name == 'gRPC' + if target.name == 'gRPC' || target.name.start_with?('gRPC.') target.build_configurations.each do |config| if config.name == 'Cronet' config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1 GRPC_TEST_OBJC=1' diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index e0f220eaee..8ff4633582 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -13,11 +13,18 @@ 16A9E77B6E336B3C0B9BA6E0 /* libPods-InteropTestsLocalSSL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DBEDE45BDA60DF1E1C8950C0 /* libPods-InteropTestsLocalSSL.a */; }; 20DFDF829DD993A4A00D5662 /* libPods-RxLibraryUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A58BE6DF1C62D1739EBB2C78 /* libPods-RxLibraryUnitTests.a */; }; 333E8FC01C8285B7C547D799 /* libPods-InteropTestsLocalCleartext.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD346DB2C23F676C4842F3FF /* libPods-InteropTestsLocalCleartext.a */; }; - 3D7C85F6AA68C4A205E3BA16 /* libPods-Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 20DFF2F3C97EF098FE5A3171 /* libPods-Tests.a */; }; 5E8A5DA71D3840B4000F8BC4 /* CoreCronetEnd2EndTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E8A5DA61D3840B4000F8BC4 /* CoreCronetEnd2EndTests.mm */; }; 5E8A5DA91D3840B4000F8BC4 /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; 5EAD6D271E27047400002378 /* CronetUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EAD6D261E27047400002378 /* CronetUnitTests.m */; }; 5EAD6D291E27047400002378 /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; + 5EC5E42B2081782C000EF4AD /* InteropTestsRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 6379CC4F1BE16703001BC0A1 /* InteropTestsRemote.m */; }; + 5EC5E42C20817832000EF4AD /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; }; + 5EC5E43B208185A7000EF4AD /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; + 5EC5E43C208185AD000EF4AD /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; }; + 5EC5E43D208185B0000EF4AD /* GRPCClientTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6312AE4D1B1BF49B00341DEE /* GRPCClientTests.m */; }; + 5EC5E44C208185EC000EF4AD /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; }; + 5EC5E44D208185F0000EF4AD /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; + 5EC5E44E20818948000EF4AD /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; 5EE84BF41D4717E40050C6CC /* InteropTestsRemoteWithCronet.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EE84BF31D4717E40050C6CC /* InteropTestsRemoteWithCronet.m */; }; 5EE84BF61D4717E40050C6CC /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; 5EE84BFE1D471D400050C6CC /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; }; @@ -44,6 +51,9 @@ 63DC84501BE153AA000708E8 /* GRPCClientTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6312AE4D1B1BF49B00341DEE /* GRPCClientTests.m */; }; 63E240CE1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; 63E240D01B6C63DC005F3B0E /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; + 91D4B3C85B6D8562F409CB48 /* libPods-InteropTestsLocalSSLCFStream.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3AB031E0E26AC8EF30A2A2A /* libPods-InteropTestsLocalSSLCFStream.a */; }; + BC111C80CBF7068B62869352 /* libPods-InteropTestsRemoteCFStream.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F44AC3F44E3491A8C0D890FE /* libPods-InteropTestsRemoteCFStream.a */; }; + C3D6F4270A2FFF634D8849ED /* libPods-InteropTestsLocalCleartextCFStream.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0BDA4BA011779D5D25B5618C /* libPods-InteropTestsLocalCleartextCFStream.a */; }; F15EF7852DC70770EFDB1D2C /* libPods-AllTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CAE086D5B470DA367D415AB0 /* libPods-AllTests.a */; }; /* End PBXBuildFile section */ @@ -120,31 +130,41 @@ /* Begin PBXFileReference section */ 02192CF1FF9534E3D18C65FC /* Pods-CronetUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.release.xcconfig"; sourceTree = "<group>"; }; - 060EF32D7EC0DF67ED617507 /* Pods-Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig"; sourceTree = "<group>"; }; 07D10A965323BEA7FE59A74B /* Pods-RxLibraryUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.debug.xcconfig"; sourceTree = "<group>"; }; 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; }; + 0BDA4BA011779D5D25B5618C /* libPods-InteropTestsLocalCleartextCFStream.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalCleartextCFStream.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 0D2284C3DF7E57F0ED504E39 /* Pods-CoreCronetEnd2EndTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.debug.xcconfig"; sourceTree = "<group>"; }; 14B09A58FEE53A7A6B838920 /* Pods-InteropTestsLocalSSL.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.cronet.xcconfig"; sourceTree = "<group>"; }; 1588C85DEAF7FC0ACDEA4C02 /* Pods-InteropTestsLocalCleartext.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.test.xcconfig"; sourceTree = "<group>"; }; 17F60BF2871F6AF85FB3FA12 /* Pods-InteropTestsRemoteWithCronet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.debug.xcconfig"; sourceTree = "<group>"; }; 20DFF2F3C97EF098FE5A3171 /* libPods-Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 2B89F3037963E6EDDD48D8C3 /* Pods-InteropTestsRemoteWithCronet.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.test.xcconfig"; sourceTree = "<group>"; }; + 303F4A17EB1650FC44603D17 /* Pods-InteropTestsRemoteCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.release.xcconfig"; sourceTree = "<group>"; }; + 32748C4078AEB05F8F954361 /* Pods-InteropTestsRemoteCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.debug.xcconfig"; sourceTree = "<group>"; }; 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 386712AEACF7C2190C4B8B3F /* Pods-CronetUnitTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.cronet.xcconfig"; sourceTree = "<group>"; }; 3B0861FC805389C52DB260D4 /* Pods-RxLibraryUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.release.xcconfig"; sourceTree = "<group>"; }; + 3EB55EF291706E3DDE23C3B7 /* Pods-InteropTestsLocalSSLCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.debug.xcconfig"; sourceTree = "<group>"; }; 3F27B2E744482771EB93C394 /* Pods-InteropTestsRemoteWithCronet.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.cronet.xcconfig"; sourceTree = "<group>"; }; + 41AA59529240A6BBBD3DB904 /* Pods-InteropTestsLocalSSLCFStream.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.test.xcconfig"; sourceTree = "<group>"; }; + 4A1A42B2E941CCD453489E5B /* Pods-InteropTestsRemoteCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.cronet.xcconfig"; sourceTree = "<group>"; }; 4AD97096D13D7416DC91A72A /* Pods-CoreCronetEnd2EndTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.release.xcconfig"; sourceTree = "<group>"; }; 4ADEA1C8BBE10D90940AC68E /* Pods-InteropTestsRemote.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.cronet.xcconfig"; sourceTree = "<group>"; }; 51A275E86C141416ED63FF76 /* Pods-InteropTestsLocalCleartext.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.release.xcconfig"; sourceTree = "<group>"; }; 553BBBED24E4162D1F769D65 /* Pods-InteropTestsLocalSSL.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.debug.xcconfig"; sourceTree = "<group>"; }; + 55B630C1FF8C36D1EFC4E0A4 /* Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig"; sourceTree = "<group>"; }; 573450F334B331D0BED8B961 /* Pods-CoreCronetEnd2EndTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreCronetEnd2EndTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests.cronet.xcconfig"; sourceTree = "<group>"; }; 5761E98978DDDF136A58CB7E /* Pods-AllTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.release.xcconfig"; sourceTree = "<group>"; }; 5E8A5DA41D3840B4000F8BC4 /* CoreCronetEnd2EndTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CoreCronetEnd2EndTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 5E8A5DA61D3840B4000F8BC4 /* CoreCronetEnd2EndTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CoreCronetEnd2EndTests.mm; sourceTree = "<group>"; }; + 5EA908CF4CDA4CE218352A06 /* Pods-InteropTestsLocalSSLCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSLCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream.release.xcconfig"; sourceTree = "<group>"; }; 5EAD6D241E27047400002378 /* CronetUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CronetUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 5EAD6D261E27047400002378 /* CronetUnitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CronetUnitTests.m; sourceTree = "<group>"; }; 5EAD6D281E27047400002378 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 5EAFE8271F8EFB87007F2189 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = "<group>"; }; + 5EC5E421208177CC000EF4AD /* InteropTestsRemoteCFStream.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InteropTestsRemoteCFStream.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 5EC5E4312081856B000EF4AD /* InteropTestsLocalCleartextCFStream.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InteropTestsLocalCleartextCFStream.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 5EC5E442208185CE000EF4AD /* InteropTestsLocalSSLCFStream.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InteropTestsLocalSSLCFStream.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 5EE84BF11D4717E40050C6CC /* InteropTestsRemoteWithCronet.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InteropTestsRemoteWithCronet.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 5EE84BF31D4717E40050C6CC /* InteropTestsRemoteWithCronet.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InteropTestsRemoteWithCronet.m; sourceTree = "<group>"; }; 5EE84BF51D4717E40050C6CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; @@ -169,14 +189,17 @@ 781089FAE980F51F88A3BE0B /* Pods-RxLibraryUnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.test.xcconfig"; sourceTree = "<group>"; }; 79C68EFFCB5533475D810B79 /* Pods-RxLibraryUnitTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.cronet.xcconfig"; sourceTree = "<group>"; }; 7A2E97E3F469CC2A758D77DE /* Pods-InteropTestsLocalSSL.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.release.xcconfig"; sourceTree = "<group>"; }; + 7BA53C6D224288D5870FE6F3 /* Pods-InteropTestsLocalCleartextCFStream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.release.xcconfig"; sourceTree = "<group>"; }; + 8B498B05C6DA0818B2FA91D4 /* Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig"; sourceTree = "<group>"; }; + 943138072A9605B5B8DC1FC0 /* Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig"; sourceTree = "<group>"; }; 9E9444C764F0FFF64A7EB58E /* libPods-InteropTestsRemoteWithCronet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsRemoteWithCronet.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - A0361771A855917162911180 /* Pods-Tests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.test.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.test.xcconfig"; sourceTree = "<group>"; }; A58BE6DF1C62D1739EBB2C78 /* libPods-RxLibraryUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RxLibraryUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; A6F832FCEFA6F6881E620F12 /* Pods-InteropTestsRemote.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.test.xcconfig"; sourceTree = "<group>"; }; AA7CB64B4DD9915AE7C03163 /* Pods-InteropTestsLocalCleartext.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.cronet.xcconfig"; sourceTree = "<group>"; }; AC414EF7A6BF76ED02B6E480 /* Pods-InteropTestsRemoteWithCronet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteWithCronet.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet.release.xcconfig"; sourceTree = "<group>"; }; B226619DC4E709E0FFFF94B8 /* Pods-CronetUnitTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetUnitTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests.test.xcconfig"; sourceTree = "<group>"; }; B94C27C06733CF98CE1B2757 /* Pods-AllTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.debug.xcconfig"; sourceTree = "<group>"; }; + C17F57E5BCB989AB1C2F1F25 /* Pods-InteropTestsRemoteCFStream.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemoteCFStream.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream.test.xcconfig"; sourceTree = "<group>"; }; C6134277D2EB8B380862A03F /* libPods-CronetUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CronetUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; CAE086D5B470DA367D415AB0 /* libPods-AllTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AllTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; D13BEC8181B8E678A1B52F54 /* Pods-InteropTestsLocalSSL.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.test.xcconfig"; sourceTree = "<group>"; }; @@ -186,9 +209,10 @@ DC3CA1D948F068E76957A861 /* Pods-InteropTestsRemote.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.debug.xcconfig"; sourceTree = "<group>"; }; E1486220285AF123EB124008 /* Pods-InteropTestsLocalCleartext.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.debug.xcconfig"; sourceTree = "<group>"; }; E4275A759BDBDF143B9B438F /* Pods-InteropTestsRemote.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.release.xcconfig"; sourceTree = "<group>"; }; - E6733B838B28453434B556E2 /* Pods-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig"; sourceTree = "<group>"; }; + E4FD4606D4AB8D5A314D72F0 /* Pods-InteropTestsLocalCleartextCFStream.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartextCFStream.test.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream.test.xcconfig"; sourceTree = "<group>"; }; E7E4D3FD76E3B745D992AF5F /* Pods-AllTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.cronet.xcconfig"; sourceTree = "<group>"; }; - F671D4CAD2864FB203B920B4 /* Pods-Tests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.cronet.xcconfig"; sourceTree = "<group>"; }; + F3AB031E0E26AC8EF30A2A2A /* libPods-InteropTestsLocalSSLCFStream.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalSSLCFStream.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + F44AC3F44E3491A8C0D890FE /* libPods-InteropTestsRemoteCFStream.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsRemoteCFStream.a"; sourceTree = BUILT_PRODUCTS_DIR; }; FBD98AC417B9882D32B19F28 /* libPods-CoreCronetEnd2EndTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CoreCronetEnd2EndTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; FD346DB2C23F676C4842F3FF /* libPods-InteropTestsLocalCleartext.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalCleartext.a"; sourceTree = BUILT_PRODUCTS_DIR; }; FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; }; @@ -213,6 +237,30 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5EC5E41E208177CC000EF4AD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + BC111C80CBF7068B62869352 /* libPods-InteropTestsRemoteCFStream.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5EC5E42E2081856B000EF4AD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C3D6F4270A2FFF634D8849ED /* libPods-InteropTestsLocalCleartextCFStream.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5EC5E43F208185CE000EF4AD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 91D4B3C85B6D8562F409CB48 /* libPods-InteropTestsLocalSSLCFStream.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5EE84BEE1D4717E40050C6CC /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -235,7 +283,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 3D7C85F6AA68C4A205E3BA16 /* libPods-Tests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -291,6 +338,9 @@ FBD98AC417B9882D32B19F28 /* libPods-CoreCronetEnd2EndTests.a */, 9E9444C764F0FFF64A7EB58E /* libPods-InteropTestsRemoteWithCronet.a */, C6134277D2EB8B380862A03F /* libPods-CronetUnitTests.a */, + F44AC3F44E3491A8C0D890FE /* libPods-InteropTestsRemoteCFStream.a */, + 0BDA4BA011779D5D25B5618C /* libPods-InteropTestsLocalCleartextCFStream.a */, + F3AB031E0E26AC8EF30A2A2A /* libPods-InteropTestsLocalSSLCFStream.a */, ); name = Frameworks; sourceTree = "<group>"; @@ -310,8 +360,6 @@ E4275A759BDBDF143B9B438F /* Pods-InteropTestsRemote.release.xcconfig */, 07D10A965323BEA7FE59A74B /* Pods-RxLibraryUnitTests.debug.xcconfig */, 3B0861FC805389C52DB260D4 /* Pods-RxLibraryUnitTests.release.xcconfig */, - 060EF32D7EC0DF67ED617507 /* Pods-Tests.debug.xcconfig */, - E6733B838B28453434B556E2 /* Pods-Tests.release.xcconfig */, 0D2284C3DF7E57F0ED504E39 /* Pods-CoreCronetEnd2EndTests.debug.xcconfig */, 4AD97096D13D7416DC91A72A /* Pods-CoreCronetEnd2EndTests.release.xcconfig */, 17F60BF2871F6AF85FB3FA12 /* Pods-InteropTestsRemoteWithCronet.debug.xcconfig */, @@ -323,7 +371,6 @@ 4ADEA1C8BBE10D90940AC68E /* Pods-InteropTestsRemote.cronet.xcconfig */, 3F27B2E744482771EB93C394 /* Pods-InteropTestsRemoteWithCronet.cronet.xcconfig */, 79C68EFFCB5533475D810B79 /* Pods-RxLibraryUnitTests.cronet.xcconfig */, - F671D4CAD2864FB203B920B4 /* Pods-Tests.cronet.xcconfig */, 64F68A9A6A63CC930DD30A6E /* Pods-CronetUnitTests.debug.xcconfig */, 386712AEACF7C2190C4B8B3F /* Pods-CronetUnitTests.cronet.xcconfig */, 02192CF1FF9534E3D18C65FC /* Pods-CronetUnitTests.release.xcconfig */, @@ -335,7 +382,18 @@ A6F832FCEFA6F6881E620F12 /* Pods-InteropTestsRemote.test.xcconfig */, 2B89F3037963E6EDDD48D8C3 /* Pods-InteropTestsRemoteWithCronet.test.xcconfig */, 781089FAE980F51F88A3BE0B /* Pods-RxLibraryUnitTests.test.xcconfig */, - A0361771A855917162911180 /* Pods-Tests.test.xcconfig */, + 32748C4078AEB05F8F954361 /* Pods-InteropTestsRemoteCFStream.debug.xcconfig */, + C17F57E5BCB989AB1C2F1F25 /* Pods-InteropTestsRemoteCFStream.test.xcconfig */, + 4A1A42B2E941CCD453489E5B /* Pods-InteropTestsRemoteCFStream.cronet.xcconfig */, + 303F4A17EB1650FC44603D17 /* Pods-InteropTestsRemoteCFStream.release.xcconfig */, + 943138072A9605B5B8DC1FC0 /* Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig */, + E4FD4606D4AB8D5A314D72F0 /* Pods-InteropTestsLocalCleartextCFStream.test.xcconfig */, + 8B498B05C6DA0818B2FA91D4 /* Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig */, + 7BA53C6D224288D5870FE6F3 /* Pods-InteropTestsLocalCleartextCFStream.release.xcconfig */, + 3EB55EF291706E3DDE23C3B7 /* Pods-InteropTestsLocalSSLCFStream.debug.xcconfig */, + 41AA59529240A6BBBD3DB904 /* Pods-InteropTestsLocalSSLCFStream.test.xcconfig */, + 55B630C1FF8C36D1EFC4E0A4 /* Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig */, + 5EA908CF4CDA4CE218352A06 /* Pods-InteropTestsLocalSSLCFStream.release.xcconfig */, ); name = Pods; sourceTree = "<group>"; @@ -392,6 +450,9 @@ 5E8A5DA41D3840B4000F8BC4 /* CoreCronetEnd2EndTests.xctest */, 5EE84BF11D4717E40050C6CC /* InteropTestsRemoteWithCronet.xctest */, 5EAD6D241E27047400002378 /* CronetUnitTests.xctest */, + 5EC5E421208177CC000EF4AD /* InteropTestsRemoteCFStream.xctest */, + 5EC5E4312081856B000EF4AD /* InteropTestsLocalCleartextCFStream.xctest */, + 5EC5E442208185CE000EF4AD /* InteropTestsLocalSSLCFStream.xctest */, ); name = Products; sourceTree = "<group>"; @@ -433,7 +494,6 @@ 5E8A5DA11D3840B4000F8BC4 /* Frameworks */, 5E8A5DA21D3840B4000F8BC4 /* Resources */, E63468C760D0724F18861822 /* [CP] Embed Pods Frameworks */, - 6DFE9E77CAB5760196D79E0F /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -454,7 +514,6 @@ 5EAD6D211E27047400002378 /* Frameworks */, 5EAD6D221E27047400002378 /* Resources */, A686B9967BB4CB81B1CBF8F8 /* [CP] Embed Pods Frameworks */, - 051806D6A59B19C8A0B76BED /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -466,6 +525,63 @@ productReference = 5EAD6D241E27047400002378 /* CronetUnitTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 5EC5E420208177CC000EF4AD /* InteropTestsRemoteCFStream */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5EC5E42A208177CD000EF4AD /* Build configuration list for PBXNativeTarget "InteropTestsRemoteCFStream" */; + buildPhases = ( + 483CDBBAEAEFCB530ADDDDD5 /* [CP] Check Pods Manifest.lock */, + 5EC5E41D208177CC000EF4AD /* Sources */, + 5EC5E41E208177CC000EF4AD /* Frameworks */, + 5EC5E41F208177CC000EF4AD /* Resources */, + 95FBC48B743503845678584F /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = InteropTestsRemoteCFStream; + productName = InteropTestsRemoteCFStream; + productReference = 5EC5E421208177CC000EF4AD /* InteropTestsRemoteCFStream.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 5EC5E4302081856B000EF4AD /* InteropTestsLocalCleartextCFStream */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5EC5E4362081856C000EF4AD /* Build configuration list for PBXNativeTarget "InteropTestsLocalCleartextCFStream" */; + buildPhases = ( + 252A376345E38FD452A89C3D /* [CP] Check Pods Manifest.lock */, + 5EC5E42D2081856B000EF4AD /* Sources */, + 5EC5E42E2081856B000EF4AD /* Frameworks */, + 5EC5E42F2081856B000EF4AD /* Resources */, + A023FB55205A7EA37D413549 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = InteropTestsLocalCleartextCFStream; + productName = InteropTestsLocalCleartextCFStream; + productReference = 5EC5E4312081856B000EF4AD /* InteropTestsLocalCleartextCFStream.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 5EC5E441208185CE000EF4AD /* InteropTestsLocalSSLCFStream */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5EC5E447208185CE000EF4AD /* Build configuration list for PBXNativeTarget "InteropTestsLocalSSLCFStream" */; + buildPhases = ( + F3D5B2CDA172580341682830 /* [CP] Check Pods Manifest.lock */, + 5EC5E43E208185CE000EF4AD /* Sources */, + 5EC5E43F208185CE000EF4AD /* Frameworks */, + 5EC5E440208185CE000EF4AD /* Resources */, + 4EB2FFF40BB00AD0C545D7EF /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = InteropTestsLocalSSLCFStream; + productName = InteropTestsLocalSSLCFStream; + productReference = 5EC5E442208185CE000EF4AD /* InteropTestsLocalSSLCFStream.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 5EE84BF01D4717E40050C6CC /* InteropTestsRemoteWithCronet */ = { isa = PBXNativeTarget; buildConfigurationList = 5EE84BFB1D4717E40050C6CC /* Build configuration list for PBXNativeTarget "InteropTestsRemoteWithCronet" */; @@ -496,7 +612,6 @@ 63423F411B150A5F006CF63C /* Frameworks */, 63423F421B150A5F006CF63C /* Resources */, A441F71824DCB9D0CA297748 /* [CP] Copy Pods Resources */, - 5F14F59509E10C2852014F9E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -512,11 +627,9 @@ isa = PBXNativeTarget; buildConfigurationList = 635697DB1B14FC11007A7283 /* Build configuration list for PBXNativeTarget "Tests" */; buildPhases = ( - 796680C7599CB4ED736DD62A /* [CP] Check Pods Manifest.lock */, 635697C31B14FC11007A7283 /* Sources */, 635697C41B14FC11007A7283 /* Frameworks */, 635697C51B14FC11007A7283 /* CopyFiles */, - AEEBFC914CBAEE347382E8C4 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -535,7 +648,6 @@ 63DC840F1BE15179000708E8 /* Sources */, 63DC84101BE15179000708E8 /* Frameworks */, 63DC84111BE15179000708E8 /* Resources */, - 4F5690DC0E6AD6663FE78B8B /* [CP] Embed Pods Frameworks */, C977426A8727267BBAC7D48E /* [CP] Copy Pods Resources */, ); buildRules = ( @@ -556,7 +668,6 @@ 63DC841F1BE15267000708E8 /* Sources */, 63DC84201BE15267000708E8 /* Frameworks */, 63DC84211BE15267000708E8 /* Resources */, - 900B6EDD4D16BE7D765C3885 /* [CP] Embed Pods Frameworks */, C2E09DC4BD239F71160F0CC1 /* [CP] Copy Pods Resources */, ); buildRules = ( @@ -577,7 +688,6 @@ 63DC84301BE15294000708E8 /* Sources */, 63DC84311BE15294000708E8 /* Frameworks */, 63DC84321BE15294000708E8 /* Resources */, - C591129ACE9F6CC5EE03FCDE /* [CP] Embed Pods Frameworks */, 693DD0B453431D64EA24FD66 /* [CP] Copy Pods Resources */, ); buildRules = ( @@ -598,7 +708,6 @@ 63DC843F1BE152B5000708E8 /* Sources */, 63DC84401BE152B5000708E8 /* Frameworks */, 63DC84411BE152B5000708E8 /* Resources */, - A8E3AC66DF770B774114A30E /* [CP] Embed Pods Frameworks */, 8AD3130D3C58A0FB32FF2A36 /* [CP] Copy Pods Resources */, ); buildRules = ( @@ -626,6 +735,18 @@ 5EAD6D231E27047400002378 = { CreatedOnToolsVersion = 7.3.1; }; + 5EC5E420208177CC000EF4AD = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + 5EC5E4302081856B000EF4AD = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + 5EC5E441208185CE000EF4AD = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; 5EE84BF01D4717E40050C6CC = { CreatedOnToolsVersion = 7.3.1; }; @@ -670,6 +791,9 @@ 5E8A5DA31D3840B4000F8BC4 /* CoreCronetEnd2EndTests */, 5EE84BF01D4717E40050C6CC /* InteropTestsRemoteWithCronet */, 5EAD6D231E27047400002378 /* CronetUnitTests */, + 5EC5E420208177CC000EF4AD /* InteropTestsRemoteCFStream */, + 5EC5E4302081856B000EF4AD /* InteropTestsLocalCleartextCFStream */, + 5EC5E441208185CE000EF4AD /* InteropTestsLocalSSLCFStream */, ); }; /* End PBXProject section */ @@ -689,6 +813,28 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5EC5E41F208177CC000EF4AD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5EC5E42F2081856B000EF4AD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5EC5E440208185CE000EF4AD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5EC5E44E20818948000EF4AD /* TestCertificates.bundle in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5EE84BEF1D4717E40050C6CC /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -736,22 +882,22 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 051806D6A59B19C8A0B76BED /* [CP] Copy Pods Resources */ = { + 252A376345E38FD452A89C3D /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + "$(DERIVED_FILE_DIR)/Pods-InteropTestsLocalCleartextCFStream-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 31F8D1C407195CBF0C02929B /* [CP] Embed Pods Frameworks */ = { @@ -772,7 +918,7 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsRemoteWithCronet/Pods-InteropTestsRemoteWithCronet-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 4C406327D3907A5E5FBA8AC9 /* [CP] Check Pods Manifest.lock */ = { + 483CDBBAEAEFCB530ADDDDD5 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -783,29 +929,14 @@ ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-InteropTestsRemote-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-InteropTestsRemoteCFStream-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 4F5690DC0E6AD6663FE78B8B /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 5C20DCCB71C3991E6FE78C22 /* [CP] Check Pods Manifest.lock */ = { + 4C406327D3907A5E5FBA8AC9 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -816,53 +947,56 @@ ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-InteropTestsLocalSSL-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-InteropTestsRemote-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 5F14F59509E10C2852014F9E /* [CP] Embed Pods Frameworks */ = { + 4EB2FFF40BB00AD0C545D7EF /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC.default-CFStream/gRPCCertificates.bundle", ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AllTests/Pods-AllTests-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalSSLCFStream/Pods-InteropTestsLocalSSLCFStream-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 693DD0B453431D64EA24FD66 /* [CP] Copy Pods Resources */ = { + 5C20DCCB71C3991E6FE78C22 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + "$(DERIVED_FILE_DIR)/Pods-InteropTestsLocalSSL-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 6DFE9E77CAB5760196D79E0F /* [CP] Copy Pods Resources */ = { + 693DD0B453431D64EA24FD66 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests-resources.sh", + "${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL-resources.sh", "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; @@ -871,7 +1005,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL-resources.sh\"\n"; showEnvVarsInLog = 0; }; 7418AC7B3844B29E48D24FC7 /* [CP] Check Pods Manifest.lock */ = { @@ -892,24 +1026,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 796680C7599CB4ED736DD62A /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Tests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; 80E2DDD2EC04A4009F45E933 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -946,21 +1062,6 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 900B6EDD4D16BE7D765C3885 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 914ADDD7106BA9BB8A7E569F /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -979,14 +1080,14 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - A441F71824DCB9D0CA297748 /* [CP] Copy Pods Resources */ = { + 95FBC48B743503845678584F /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-AllTests/Pods-AllTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", + "${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC.default-CFStream/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -994,58 +1095,61 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AllTests/Pods-AllTests-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsRemoteCFStream/Pods-InteropTestsRemoteCFStream-resources.sh\"\n"; showEnvVarsInLog = 0; }; - A686B9967BB4CB81B1CBF8F8 /* [CP] Embed Pods Frameworks */ = { + A023FB55205A7EA37D413549 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests-frameworks.sh", - "${PODS_ROOT}/CronetFramework/Cronet.framework", + "${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC.default-CFStream/gRPCCertificates.bundle", ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Copy Pods Resources"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalCleartextCFStream/Pods-InteropTestsLocalCleartextCFStream-resources.sh\"\n"; showEnvVarsInLog = 0; }; - A8E3AC66DF770B774114A30E /* [CP] Embed Pods Frameworks */ = { + A441F71824DCB9D0CA297748 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-AllTests/Pods-AllTests-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AllTests/Pods-AllTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - AEEBFC914CBAEE347382E8C4 /* [CP] Copy Pods Resources */ = { + A686B9967BB4CB81B1CBF8F8 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", + "${SRCROOT}/Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests-frameworks.sh", + "${PODS_ROOT}/CronetFramework/Cronet.framework", ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CronetUnitTests/Pods-CronetUnitTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; B2986CEEE8CDD4901C97598B /* [CP] Check Pods Manifest.lock */ = { @@ -1102,21 +1206,6 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote-resources.sh\"\n"; showEnvVarsInLog = 0; }; - C591129ACE9F6CC5EE03FCDE /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; C977426A8727267BBAC7D48E /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1171,6 +1260,24 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CoreCronetEnd2EndTests/Pods-CoreCronetEnd2EndTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + F3D5B2CDA172580341682830 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-InteropTestsLocalSSLCFStream-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; F58F17E425446B15028B9F74 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1208,6 +1315,34 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5EC5E41D208177CC000EF4AD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5EC5E42B2081782C000EF4AD /* InteropTestsRemote.m in Sources */, + 5EC5E42C20817832000EF4AD /* InteropTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5EC5E42D2081856B000EF4AD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5EC5E43B208185A7000EF4AD /* InteropTestsLocalCleartext.m in Sources */, + 5EC5E43D208185B0000EF4AD /* GRPCClientTests.m in Sources */, + 5EC5E43C208185AD000EF4AD /* InteropTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5EC5E43E208185CE000EF4AD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5EC5E44D208185F0000EF4AD /* InteropTestsLocalSSL.m in Sources */, + 5EC5E44C208185EC000EF4AD /* InteropTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5EE84BED1D4717E40050C6CC /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1350,6 +1485,7 @@ "HOST_PORT_LOCALSSL=$(HOST_PORT_LOCALSSL)", "HOST_PORT_LOCAL=$(HOST_PORT_LOCAL)", "HOST_PORT_REMOTE=$(HOST_PORT_REMOTE)", + "GRPC_TEST_OBJC=1", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_TREAT_WARNINGS_AS_ERRORS = YES; @@ -1368,7 +1504,6 @@ }; 5E1228991E4D400F00E8504F /* Test */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A0361771A855917162911180 /* Pods-Tests.test.xcconfig */; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1668,7 +1803,6 @@ }; 5EC3C7A11D4FC18C000330E2 /* Cronet */ = { isa = XCBuildConfiguration; - baseConfigurationReference = F671D4CAD2864FB203B920B4 /* Pods-Tests.cronet.xcconfig */; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1797,6 +1931,360 @@ }; name = Cronet; }; + 5EC5E426208177CC000EF4AD /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 32748C4078AEB05F8F954361 /* Pods-InteropTestsRemoteCFStream.debug.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsRemoteCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 5EC5E427208177CC000EF4AD /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C17F57E5BCB989AB1C2F1F25 /* Pods-InteropTestsRemoteCFStream.test.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsRemoteCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Test; + }; + 5EC5E428208177CC000EF4AD /* Cronet */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4A1A42B2E941CCD453489E5B /* Pods-InteropTestsRemoteCFStream.cronet.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsRemoteCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Cronet; + }; + 5EC5E429208177CC000EF4AD /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 303F4A17EB1650FC44603D17 /* Pods-InteropTestsRemoteCFStream.release.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsRemoteCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 5EC5E4372081856C000EF4AD /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 943138072A9605B5B8DC1FC0 /* Pods-InteropTestsLocalCleartextCFStream.debug.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsLocalCleartextCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 5EC5E4382081856C000EF4AD /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E4FD4606D4AB8D5A314D72F0 /* Pods-InteropTestsLocalCleartextCFStream.test.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsLocalCleartextCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Test; + }; + 5EC5E4392081856C000EF4AD /* Cronet */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 8B498B05C6DA0818B2FA91D4 /* Pods-InteropTestsLocalCleartextCFStream.cronet.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsLocalCleartextCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Cronet; + }; + 5EC5E43A2081856C000EF4AD /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7BA53C6D224288D5870FE6F3 /* Pods-InteropTestsLocalCleartextCFStream.release.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsLocalCleartextCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 5EC5E448208185CE000EF4AD /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3EB55EF291706E3DDE23C3B7 /* Pods-InteropTestsLocalSSLCFStream.debug.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsLocalSSLCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 5EC5E449208185CE000EF4AD /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 41AA59529240A6BBBD3DB904 /* Pods-InteropTestsLocalSSLCFStream.test.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsLocalSSLCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Test; + }; + 5EC5E44A208185CE000EF4AD /* Cronet */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 55B630C1FF8C36D1EFC4E0A4 /* Pods-InteropTestsLocalSSLCFStream.cronet.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsLocalSSLCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Cronet; + }; + 5EC5E44B208185CE000EF4AD /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5EA908CF4CDA4CE218352A06 /* Pods-InteropTestsLocalSSLCFStream.release.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.InteropTestsLocalSSLCFStream; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; 5EE84BF91D4717E40050C6CC /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 17F60BF2871F6AF85FB3FA12 /* Pods-InteropTestsRemoteWithCronet.debug.xcconfig */; @@ -1953,7 +2441,6 @@ }; 635697DC1B14FC11007A7283 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 060EF32D7EC0DF67ED617507 /* Pods-Tests.debug.xcconfig */; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1963,7 +2450,6 @@ }; 635697DD1B14FC11007A7283 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E6733B838B28453434B556E2 /* Pods-Tests.release.xcconfig */; buildSettings = { GCC_TREAT_WARNINGS_AS_ERRORS = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2100,6 +2586,39 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 5EC5E42A208177CD000EF4AD /* Build configuration list for PBXNativeTarget "InteropTestsRemoteCFStream" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5EC5E426208177CC000EF4AD /* Debug */, + 5EC5E427208177CC000EF4AD /* Test */, + 5EC5E428208177CC000EF4AD /* Cronet */, + 5EC5E429208177CC000EF4AD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5EC5E4362081856C000EF4AD /* Build configuration list for PBXNativeTarget "InteropTestsLocalCleartextCFStream" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5EC5E4372081856C000EF4AD /* Debug */, + 5EC5E4382081856C000EF4AD /* Test */, + 5EC5E4392081856C000EF4AD /* Cronet */, + 5EC5E43A2081856C000EF4AD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5EC5E447208185CE000EF4AD /* Build configuration list for PBXNativeTarget "InteropTestsLocalSSLCFStream" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5EC5E448208185CE000EF4AD /* Debug */, + 5EC5E449208185CE000EF4AD /* Test */, + 5EC5E44A208185CE000EF4AD /* Cronet */, + 5EC5E44B208185CE000EF4AD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 5EE84BFB1D4717E40050C6CC /* Build configuration list for PBXNativeTarget "InteropTestsRemoteWithCronet" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme index a2560fee02..b0bb933764 100644 --- a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme @@ -26,6 +26,7 @@ buildConfiguration = "Test" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" shouldUseLaunchSchemeArgsEnv = "YES"> <Testables> <TestableReference @@ -66,6 +67,7 @@ buildConfiguration = "Test" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsLocalCleartext.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsLocalCleartext.xcscheme index 6d85b62fab..510115fc75 100644 --- a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsLocalCleartext.xcscheme +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsLocalCleartext.xcscheme @@ -26,6 +26,7 @@ buildConfiguration = "Test" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" shouldUseLaunchSchemeArgsEnv = "YES"> <Testables> <TestableReference @@ -57,6 +58,7 @@ buildConfiguration = "Test" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsLocalCleartextCFStream.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsLocalCleartextCFStream.xcscheme new file mode 100644 index 0000000000..fe766de928 --- /dev/null +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsLocalCleartextCFStream.xcscheme @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0920" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + </BuildAction> + <TestAction + buildConfiguration = "Test" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "5EC5E4302081856B000EF4AD" + BuildableName = "InteropTestsLocalCleartextCFStream.xctest" + BlueprintName = "InteropTestsLocalCleartextCFStream" + ReferencedContainer = "container:Tests.xcodeproj"> + </BuildableReference> + <SkippedTests> + <Test + Identifier = "InteropTests"> + </Test> + </SkippedTests> + </TestableReference> + </Testables> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsLocalSSLCFStream.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsLocalSSLCFStream.xcscheme new file mode 100644 index 0000000000..bd66327649 --- /dev/null +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsLocalSSLCFStream.xcscheme @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0920" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + </BuildAction> + <TestAction + buildConfiguration = "Test" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "5EC5E441208185CE000EF4AD" + BuildableName = "InteropTestsLocalSSLCFStream.xctest" + BlueprintName = "InteropTestsLocalSSLCFStream" + ReferencedContainer = "container:Tests.xcodeproj"> + </BuildableReference> + <SkippedTests> + <Test + Identifier = "InteropTests"> + </Test> + </SkippedTests> + </TestableReference> + </Testables> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsRemote.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsRemote.xcscheme index 412bf6a014..48837e57f9 100644 --- a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsRemote.xcscheme +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsRemote.xcscheme @@ -26,6 +26,7 @@ buildConfiguration = "Test" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" shouldUseLaunchSchemeArgsEnv = "YES"> <Testables> <TestableReference @@ -60,6 +61,7 @@ buildConfiguration = "Test" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsRemoteCFStream.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsRemoteCFStream.xcscheme new file mode 100644 index 0000000000..33a5ded038 --- /dev/null +++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/InteropTestsRemoteCFStream.xcscheme @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0920" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + </BuildAction> + <TestAction + buildConfiguration = "Test" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "5EC5E420208177CC000EF4AD" + BuildableName = "InteropTestsRemoteCFStream.xctest" + BlueprintName = "InteropTestsRemoteCFStream" + ReferencedContainer = "container:Tests.xcodeproj"> + </BuildableReference> + <SkippedTests> + <Test + Identifier = "InteropTests"> + </Test> + </SkippedTests> + </TestableReference> + </Testables> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/src/objective-c/tests/analyze_link_map.py b/src/objective-c/tests/analyze_link_map.py deleted file mode 100755 index 48e3441087..0000000000 --- a/src/objective-c/tests/analyze_link_map.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/python -# Copyright 2018 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script analyzes link map file generated by Xcode. It calculates and -# prints out the sizes of each dependent library and the total sizes of the -# symbols. -# The script takes one parameter, which is the path to the link map file. - -import sys -import re - -table_tag = {} -state = "start" - -table_stats_symbol = {} -table_stats_dead = {} -section_total_size = 0 -symbol_total_size = 0 - - -file_import = sys.argv[1] -lines = list(open(file_import)) -for line in lines: - line_stripped = line[:-1] - if "# Object files:" == line_stripped: - state = "object" - continue - elif "# Sections:" == line_stripped: - state = "section" - continue - elif "# Symbols:" == line_stripped: - state = "symbol" - continue - elif "# Dead Stripped Symbols:" == line_stripped: - state = "dead" - continue - - if state == "object": - segs = re.search('(\[ *[0-9]*\]) (.*)', line_stripped) - table_tag[segs.group(1)] = segs.group(2) - - if state == "section": - if len(line_stripped) == 0 or line_stripped[0] == '#': - continue - segs = re.search('^(.+?)\s+(.+?)\s+.*', line_stripped) - section_total_size += int(segs.group(2), 16) - - if state == "symbol": - if len(line_stripped) == 0 or line_stripped[0] == '#': - continue - segs = re.search('^.+?\s+(.+?)\s+(\[.+?\]).*', line_stripped) - target = table_tag[segs.group(2)] - target_stripped = re.search('^(.*?)(\(.+?\))?$', target).group(1) - size = int(segs.group(1), 16) - if not target_stripped in table_stats_symbol: - table_stats_symbol[target_stripped] = 0 - table_stats_symbol[target_stripped] += size - -print("Sections total size: %d" % section_total_size) - -for target in table_stats_symbol: - print(target) - print(table_stats_symbol[target]) - symbol_total_size += table_stats_symbol[target] - -print("Symbols total size: %d" % symbol_total_size) diff --git a/src/objective-c/tests/build_one_example.sh b/src/objective-c/tests/build_one_example.sh index 985d55f3cc..1eace541e6 100755 --- a/src/objective-c/tests/build_one_example.sh +++ b/src/objective-c/tests/build_one_example.sh @@ -42,6 +42,9 @@ xcodebuild \ build \ -workspace *.xcworkspace \ -scheme $SCHEME \ - -destination name="iPhone 6" \ + -destination generic/platform=iOS \ + -derivedDataPath Build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ | egrep -v "$XCODEBUILD_FILTER" \ | egrep -v "^$" - diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index 2fe2326207..9dde07d55c 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -53,7 +53,7 @@ while [ $retries -lt 3 ]; do out=$(xcodebuild \ -workspace Tests.xcworkspace \ -scheme AllTests \ - -destination name="iPhone 6" \ + -destination name="iPhone 8" \ HOST_PORT_LOCALSSL=localhost:5051 \ HOST_PORT_LOCAL=localhost:5050 \ HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ @@ -83,7 +83,7 @@ echo "TIME: $(date)" xcodebuild \ -workspace Tests.xcworkspace \ -scheme CoreCronetEnd2EndTests \ - -destination name="iPhone 6" \ + -destination name="iPhone 8" \ test \ | egrep -v "$XCODEBUILD_FILTER" \ | egrep -v '^$' \ @@ -113,7 +113,7 @@ echo "TIME: $(date)" xcodebuild \ -workspace Tests.xcworkspace \ -scheme CronetUnitTests \ - -destination name="iPhone 6" \ + -destination name="iPhone 8" \ test \ | egrep -v "$XCODEBUILD_FILTER" \ | egrep -v '^$' \ @@ -123,11 +123,44 @@ echo "TIME: $(date)" xcodebuild \ -workspace Tests.xcworkspace \ -scheme InteropTestsRemoteWithCronet \ - -destination name="iPhone 6" \ + -destination name="iPhone 8" \ + HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' \ + | egrep -v "(GPBDictionary|GPBArray)" - + +echo "TIME: $(date)" +xcodebuild \ + -workspace Tests.xcworkspace \ + -scheme InteropTestsRemoteCFStream \ + -destination name="iPhone 8" \ HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ test \ | egrep -v "$XCODEBUILD_FILTER" \ | egrep -v '^$' \ | egrep -v "(GPBDictionary|GPBArray)" - +echo "TIME: $(date)" +xcodebuild \ + -workspace Tests.xcworkspace \ + -scheme InteropTestsLocalCleartextCFStream \ + -destination name="iPhone 8" \ + HOST_PORT_LOCAL=localhost:5050 \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' \ + | egrep -v "(GPBDictionary|GPBArray)" - + +echo "TIME: $(date)" +xcodebuild \ + -workspace Tests.xcworkspace \ + -scheme InteropTestsLocalSSLCFStream \ + -destination name="iPhone 8" \ + HOST_PORT_LOCALSSL=localhost:5051 \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' \ + | egrep -v "(GPBDictionary|GPBArray)" - + exit 0 diff --git a/src/php/README.md b/src/php/README.md index 11f99e134c..36e242fe01 100644 --- a/src/php/README.md +++ b/src/php/README.md @@ -2,11 +2,14 @@ # Overview This directory contains source code for PHP implementation of gRPC layered on -shared C library. +shared C library. The same installation guides with more examples and +tutorials can be seen at [grpc.io](https://grpc.io/docs/quickstart/php.html). +gRPC PHP installation instructions for Google Cloud Platform is in +[cloud.google.com](https://cloud.google.com/php/grpc). ## Environment -**Prerequisite:** +###Prerequisite: * `php` 5.5 or above, 7.0 or above * `pecl` * `composer` @@ -25,6 +28,10 @@ For PHP7: ```sh $ sudo apt-get install php7.0 php7.0-dev php-pear phpunit ``` +or +```sh +$ sudo apt-get install php php-dev php-pear phpunit +``` **Install PHP and PECL on CentOS/RHEL 7:** ```sh @@ -33,8 +40,9 @@ $ sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm $ sudo yum install php56w php56w-devel php-pear phpunit gcc zlib-devel ``` -**Install PECL on Mac:** +**Install PHP and PECL on Mac:** ```sh +$ brew install homebrew/php/php56-grpc $ curl -O http://pear.php.net/go-pear.phar $ sudo php -d detect_unicode=0 go-pear.phar ``` @@ -52,50 +60,33 @@ $ chmod +x phpunit-old.phar $ sudo mv phpunit-old.phar /usr/bin/phpunit ``` -## Quick Install +## Install the gRPC PHP extension + +There are two ways to install gRPC PHP extension. +* `pecl` +* `build from source` -**Install the gRPC PHP extension** +### Using PECL ```sh sudo pecl install grpc ``` -This will compile and install the gRPC PHP extension into the standard PHP -extension directory. You should be able to run the [unit tests](#unit-tests), -with the PHP extension installed. - -Note: For users on CentOS/RHEL 6, unfortunately this step won't work. Please -follow the instructions below to compile the extension from source. - - -**Update php.ini** - -Add this line to your `php.ini` file, e.g. `/etc/php5/cli/php.ini` +or specific version ```sh -extension=grpc.so -``` - - -**Add the gRPC PHP library as a Composer dependency** - -You need to add this to your project's `composer.json` file. - +sudo pecl install grpc-1.12.0 ``` - "require": { - "grpc/grpc": "v1.1.0" - } -``` - -To run tests with generated stub code from `.proto` files, you will also need -the `composer` and `protoc` binaries. You can find out how to get these -[below](#generated-code-tests). +Note: for users on CentOS/RHEL 6, unfortunately this step won’t work. +Please follow the instructions below to compile the PECL extension from source. -## Build from Source +#### Install on Windows +You can download the pre-compiled gRPC extension from the PECL +[website](https://pecl.php.net/package/grpc) -### gRPC C core library +### Build from Source with gRPC C core library Clone this repository @@ -103,16 +94,16 @@ Clone this repository $ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc ``` -Build and install the gRPC C core library +#### Build and install the gRPC C core library ```sh $ cd grpc -$ git pull --recurse-submodules && git submodule update --init --recursive +$ git submodule update --init $ make $ sudo make install ``` -### gRPC PHP extension +#### Build and install gRPC PHP extension Compile the gRPC PHP extension @@ -124,44 +115,69 @@ $ make $ sudo make install ``` -## Unit Tests +This will compile and install the gRPC PHP extension into the +standard PHP extension directory. You should be able to run +the [unit tests](#unit-tests), with the PHP extension installed. -You will need the source code to run tests + +### Update php.ini + +After installing the gRPC extension, make sure you add this line +to your `php.ini` file, (e.g. `/etc/php5/cli/php.ini`, +`/etc/php5/apache2/php.ini`, or `/usr/local/etc/php/5.6/php.ini`), +depending on where your PHP installation is. ```sh -$ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc -$ cd grpc -$ git pull --recurse-submodules && git submodule update --init --recursive +extension=grpc.so ``` -Run unit tests +**Add the gRPC PHP library as a Composer dependency** -```sh -$ cd grpc/src/php -$ ./bin/run_tests.sh +You need to add this to your project's `composer.json` file. + +``` + "require": { + "grpc/grpc": "v1.12.0" + } ``` -## Generated Code Tests +To run tests with generated stub code from `.proto` files, you will also +need the `composer` and `protoc` binaries. You can find out how to get these below. -This section specifies the prerequisites for running the generated code tests, -as well as how to run the tests themselves. +## Install other prerequisites for both Mac OS X and Linux -### Composer +* `protoc: protobuf compiler` +* `protobuf.so: protobuf runtime library` +* `grpc_php_plugin: Generates PHP gRPC service interface out of Protobuf IDL` -Install the runtime dependencies via `composer install`. +### Install Protobuf compiler -```sh -$ cd grpc/src/php -$ composer install -``` +If you don't have it already, you need to install the protobuf compiler +`protoc`, version 3.5.0+ (the newer the better) for the current gRPC version. +If you installed already, make the protobuf version is compatible to the +grpc version you installed. If you build grpc.so from the souce, you can check +the version of grpc inside package.xml file. -### Protobuf compiler +The compatibility between the grpc and protobuf version is listed as table below: -Again if you don't have it already, you need to install the protobuf compiler -`protoc`, version 3.1.0+ (the newer the better). +grpc | protobuf +--- | --- +v1.0.0 | 3.0.0(GA) +v1.0.1 | 3.0.2 +v1.1.0 | 3.1.0 +v1.2.0 | 3.2.0 +v1.2.0 | 3.2.0 +v1.3.4 | 3.3.0 +v1.3.5 | 3.2.0 +v1.4.0 | 3.3.0 +v1.6.0 | 3.4.0 +v1.8.0 | 3.5.0 +v1.12.0 | 3.5.2 If `protoc` hasn't been installed, you can download the `protoc` binaries from [the protocol buffers Github repository](https://github.com/google/protobuf/releases). +Then unzip this file and update the environment variable `PATH` to include the path to +the protoc binary file. If you really must compile `protoc` from source, you can run the following commands, but this is risky because there is no easy way to uninstall / @@ -173,32 +189,44 @@ $ ./autogen.sh && ./configure && make $ sudo make install ``` - ### Protobuf Runtime library -There are two protobuf runtime libraries to choose from. They are idenfical in terms of APIs offered. +There are two protobuf runtime libraries to choose from. They are identical +in terms of APIs offered. The C implementation provides better performance, +while the native implementation is easier to install. Make sure the installed +protobuf version works with grpc version. -1. C implementation (for better performance) +#### 1. C implementation (for better performance) ``` sh $ sudo pecl install protobuf ``` +or specific version -2. PHP implementation (for easier installation) +``` sh +$ sudo pecl install protobuf-3.5.1.1 +``` +Add this to your `php.ini` file: + +```sh +extension=protobuf.so +``` + +#### 2. PHP implementation (for easier installation) Add this to your `composer.json` file: ``` "require": { - "google/protobuf": "^v3.3.0" + "google/protobuf": "^v3.5.0" } -``` - +``` ### PHP Protoc Plugin You need the gRPC PHP protoc plugin to generate the client stub classes. +It can generate server and client code from .proto service definitions. It should already been compiled when you run `make` from the root directory of this repo. The plugin can be found in the `bins/opt` directory. We are @@ -208,10 +236,47 @@ in the future. You can also just build the gRPC PHP protoc plugin by running: ```sh +$ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc $ cd grpc +$ git submodule update --init $ make grpc_php_plugin ``` +Plugin may use the new feature of the new protobuf version, thus please also +make sure that the protobuf version installed is compatible with the grpc version +you build this plugin. + +## Unit Tests + +You will need the source code to run tests + +```sh +$ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc +$ cd grpc +$ git submodule update --init +``` + +Run unit tests + +```sh +$ cd grpc/src/php +$ ./bin/run_tests.sh +``` + +## Generated Code Tests + +This section specifies the prerequisites for running the generated code tests, +as well as how to run the tests themselves. + +### Composer + +Install the runtime dependencies via `composer install`. + +```sh +$ cd grpc/src/php +$ composer install +``` + ### Client Stub diff --git a/src/php/tests/unit_tests/CallCredentials2Test.php b/src/php/tests/unit_tests/CallCredentials2Test.php index 1c7e0c0ff6..c63029f121 100644 --- a/src/php/tests/unit_tests/CallCredentials2Test.php +++ b/src/php/tests/unit_tests/CallCredentials2Test.php @@ -35,6 +35,7 @@ class CallCredentials2Test extends PHPUnit_Framework_TestCase $this->channel = new Grpc\Channel( 'localhost:'.$this->port, [ + 'force_new' => true, 'grpc.ssl_target_name_override' => $this->host_override, 'grpc.default_authority' => $this->host_override, 'credentials' => $credentials, diff --git a/src/php/tests/unit_tests/CallCredentialsTest.php b/src/php/tests/unit_tests/CallCredentialsTest.php index 4b5721d76a..818b823da7 100644 --- a/src/php/tests/unit_tests/CallCredentialsTest.php +++ b/src/php/tests/unit_tests/CallCredentialsTest.php @@ -41,6 +41,7 @@ class CallCredentialsTest extends PHPUnit_Framework_TestCase $this->channel = new Grpc\Channel( 'localhost:'.$this->port, [ + 'force_new' => true, 'grpc.ssl_target_name_override' => $this->host_override, 'grpc.default_authority' => $this->host_override, 'credentials' => $this->credentials, diff --git a/src/php/tests/unit_tests/CallTest.php b/src/php/tests/unit_tests/CallTest.php index c5e1890a98..be1d77fe7a 100644 --- a/src/php/tests/unit_tests/CallTest.php +++ b/src/php/tests/unit_tests/CallTest.php @@ -24,12 +24,14 @@ class CallTest extends PHPUnit_Framework_TestCase public static function setUpBeforeClass() { self::$server = new Grpc\Server([]); - self::$port = self::$server->addHttp2Port('0.0.0.0:0'); + self::$port = self::$server->addHttp2Port('0.0.0.0:53000'); } public function setUp() { - $this->channel = new Grpc\Channel('localhost:'.self::$port, []); + $this->channel = new Grpc\Channel('localhost:'.self::$port, [ + 'force_new' => true, + ]); $this->call = new Grpc\Call($this->channel, '/foo', Grpc\Timeval::infFuture()); diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index b54f1d87c9..d0965655e0 100644 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -22,13 +22,16 @@ class EndToEndTest extends PHPUnit_Framework_TestCase { $this->server = new Grpc\Server([]); $this->port = $this->server->addHttp2Port('0.0.0.0:0'); - $this->channel = new Grpc\Channel('localhost:'.$this->port, []); + $this->channel = new Grpc\Channel('localhost:'.$this->port, [ + "force_new" => true, + ]); $this->server->start(); } public function tearDown() { $this->channel->close(); + unset($this->server); } public function testSimpleRequestBody() diff --git a/src/php/tests/unit_tests/InterceptorTest.php b/src/php/tests/unit_tests/InterceptorTest.php index 11c5b4325a..d18c27c2c7 100644 --- a/src/php/tests/unit_tests/InterceptorTest.php +++ b/src/php/tests/unit_tests/InterceptorTest.php @@ -206,13 +206,16 @@ class InterceptorTest extends PHPUnit_Framework_TestCase { $this->server = new Grpc\Server([]); $this->port = $this->server->addHttp2Port('0.0.0.0:0'); - $this->channel = new Grpc\Channel('localhost:'.$this->port, ['credentials' => Grpc\ChannelCredentials::createInsecure()]); + $this->channel = new Grpc\Channel('localhost:'.$this->port, [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure()]); $this->server->start(); } public function tearDown() { $this->channel->close(); + unset($this->server); } @@ -222,6 +225,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase $channel_matadata_interceptor = new ChangeMetadataInterceptor(); $intercept_channel = Grpc\Interceptor::intercept($this->channel, $channel_matadata_interceptor); $client = new InterceptorClient('localhost:'.$this->port, [ + 'force_new' => true, 'credentials' => Grpc\ChannelCredentials::createInsecure(), ], $intercept_channel); $req = new SimpleRequest($req_text); @@ -250,6 +254,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase $intercept_channel1 = Grpc\Interceptor::intercept($this->channel, $channel_matadata_interceptor); $intercept_channel2 = Grpc\Interceptor::intercept($intercept_channel1, $channel_matadata_intercepto2); $client = new InterceptorClient('localhost:'.$this->port, [ + 'force_new' => true, 'credentials' => Grpc\ChannelCredentials::createInsecure(), ], $intercept_channel2); @@ -275,6 +280,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase $intercept_channel3 = Grpc\Interceptor::intercept($this->channel, [$channel_matadata_intercepto2, $channel_matadata_interceptor]); $client = new InterceptorClient('localhost:'.$this->port, [ + 'force_new' => true, 'credentials' => Grpc\ChannelCredentials::createInsecure(), ], $intercept_channel3); @@ -304,6 +310,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase $intercept_channel = Grpc\Interceptor::intercept($this->channel, $change_request_interceptor); $client = new InterceptorClient('localhost:'.$this->port, [ + 'force_new' => true, 'credentials' => Grpc\ChannelCredentials::createInsecure(), ], $intercept_channel); @@ -354,6 +361,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase $intercept_channel = Grpc\Interceptor::intercept($this->channel, $channel_request_interceptor); $client = new InterceptorClient('localhost:'.$this->port, [ + 'force_new' => true, 'credentials' => Grpc\ChannelCredentials::createInsecure(), ], $intercept_channel); @@ -374,7 +382,10 @@ class InterceptorTest extends PHPUnit_Framework_TestCase { $channel = new Grpc\Channel( 'localhost:0', - ['credentials' => Grpc\ChannelCredentials::createInsecure()] + [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure() + ] ); $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); $state = $interceptor_channel->getConnectivityState(); @@ -386,7 +397,10 @@ class InterceptorTest extends PHPUnit_Framework_TestCase { $channel = new Grpc\Channel( 'localhost:0', - ['credentials' => Grpc\ChannelCredentials::createInsecure()] + [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure() + ] ); $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); $now = Grpc\Timeval::now(); @@ -402,7 +416,10 @@ class InterceptorTest extends PHPUnit_Framework_TestCase { $channel = new Grpc\Channel( 'localhost:0', - ['credentials' => Grpc\ChannelCredentials::createInsecure()] + [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure() + ] ); $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); $this->assertNotNull($interceptor_channel); @@ -413,7 +430,10 @@ class InterceptorTest extends PHPUnit_Framework_TestCase { $channel = new Grpc\Channel( 'localhost:8888', - ['credentials' => Grpc\ChannelCredentials::createInsecure()] + [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure() + ] ); $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); $target = $interceptor_channel->getTarget(); diff --git a/src/php/tests/unit_tests/SecureEndToEndTest.php b/src/php/tests/unit_tests/SecureEndToEndTest.php index dff4e878ea..071598c4c1 100644 --- a/src/php/tests/unit_tests/SecureEndToEndTest.php +++ b/src/php/tests/unit_tests/SecureEndToEndTest.php @@ -34,6 +34,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase $this->channel = new Grpc\Channel( 'localhost:'.$this->port, [ + 'force_new' => true, 'grpc.ssl_target_name_override' => $this->host_override, 'grpc.default_authority' => $this->host_override, 'credentials' => $credentials, @@ -44,6 +45,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase public function tearDown() { $this->channel->close(); + unset($this->server); } public function testSimpleRequestBody() diff --git a/src/php/tests/unit_tests/ServerTest.php b/src/php/tests/unit_tests/ServerTest.php index ac6f2f0312..cab92e5941 100644 --- a/src/php/tests/unit_tests/ServerTest.php +++ b/src/php/tests/unit_tests/ServerTest.php @@ -55,7 +55,10 @@ class ServerTest extends PHPUnit_Framework_TestCase $port = $this->server->addHttp2Port('0.0.0.0:0'); $this->server->start(); $channel = new Grpc\Channel('localhost:'.$port, - ['credentials' => Grpc\ChannelCredentials::createInsecure()]); + [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure() + ]); $deadline = Grpc\Timeval::infFuture(); $call = new Grpc\Call($channel, 'dummy_method', $deadline); diff --git a/src/proto/grpc/testing/empty_service.proto b/src/proto/grpc/testing/empty_service.proto new file mode 100644 index 0000000000..157629b7a4 --- /dev/null +++ b/src/proto/grpc/testing/empty_service.proto @@ -0,0 +1,23 @@ + +// Copyright 2018 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package grpc.testing; + +// A service that has zero methods. +// See https://github.com/grpc/grpc/issues/15574 +service EmptyService { +} diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index b7ed0c8563..d1477fbeb5 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1250,19 +1250,20 @@ class Server(six.with_metaclass(abc.ABCMeta)): """Stops this Server. This method immediately stop service of new RPCs in all cases. + If a grace period is specified, this method returns immediately and all RPCs active at the end of the grace period are aborted. - - If a grace period is not specified, then all existing RPCs are - teriminated immediately and the this method blocks until the last - RPC handler terminates. + If a grace period is not specified (by passing None for `grace`), + all existing RPCs are aborted immediately and this method + blocks until the last RPC handler terminates. This method is idempotent and may be called at any time. - Passing a smaller grace value in subsequent call will have - the effect of stopping the Server sooner. Passing a larger - grace value in subsequent call *will not* have the effect of - stopping the server later (i.e. the most restrictive grace - value is used). + Passing a smaller grace value in a subsequent call will have + the effect of stopping the Server sooner (passing None will + have the effect of stopping the server immediately). Passing + a larger grace value in a subsequent call *will not* have the + effect of stopping the server later (i.e. the most restrictive + grace value is used). Args: grace: A duration of time in seconds or None. @@ -1481,7 +1482,7 @@ def ssl_server_credentials(private_key_certificate_chain_pairs, A ServerCredentials for use with an SSL-enabled Server. Typically, this object is an argument to add_secure_port() method during server setup. """ - if len(private_key_certificate_chain_pairs) == 0: + if not private_key_certificate_chain_pairs: raise ValueError( 'At least one private key-certificate chain pair is required!') elif require_client_auth and root_certificates is None: @@ -1511,15 +1512,15 @@ def ssl_server_certificate_configuration(private_key_certificate_chain_pairs, A ServerCertificateConfiguration that can be returned in the certificate configuration fetching callback. """ - if len(private_key_certificate_chain_pairs) == 0: - raise ValueError( - 'At least one private key-certificate chain pair is required!') - else: + if private_key_certificate_chain_pairs: return ServerCertificateConfiguration( _cygrpc.server_certificate_config_ssl(root_certificates, [ _cygrpc.SslPemKeyCertPair(key, pem) for key, pem in private_key_certificate_chain_pairs ])) + else: + raise ValueError( + 'At least one private key-certificate chain pair is required!') def dynamic_ssl_server_credentials(initial_certificate_configuration, diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index 2017d47130..e9246991df 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -24,6 +24,8 @@ from grpc import _grpcio_metadata from grpc._cython import cygrpc from grpc.framework.foundation import callable_util +_LOGGER = logging.getLogger(__name__) + _USER_AGENT = 'grpc-python/{}'.format(_grpcio_metadata.__version__) _EMPTY_FLAGS = 0 @@ -181,7 +183,7 @@ def _consume_request_iterator(request_iterator, state, call, request_serializer, except Exception: # pylint: disable=broad-except code = grpc.StatusCode.UNKNOWN details = 'Exception iterating requests!' - logging.exception(details) + _LOGGER.exception(details) call.cancel(_common.STATUS_CODE_TO_CYGRPC_STATUS_CODE[code], details) _abort(state, code, details) @@ -190,7 +192,7 @@ def _consume_request_iterator(request_iterator, state, call, request_serializer, with state.condition: if state.code is None and not state.cancelled: if serialized_request is None: - code = grpc.StatusCode.INTERNAL # pylint: disable=redefined-variable-type + code = grpc.StatusCode.INTERNAL details = 'Exception serializing request!' call.cancel( _common.STATUS_CODE_TO_CYGRPC_STATUS_CODE[code], @@ -811,10 +813,7 @@ def _poll_connectivity(state, channel, initial_try_to_connect): _common.CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY[ connectivity]) if not state.delivering: - # NOTE(nathaniel): The field is only ever used as a - # sequence so it's fine that both lists and tuples are - # assigned to it. - callbacks = _deliveries(state) # pylint: disable=redefined-variable-type + callbacks = _deliveries(state) if callbacks: _spawn_delivery(state, callbacks) diff --git a/src/python/grpcio/grpc/_common.py b/src/python/grpcio/grpc/_common.py index 862987a0cd..8358cbec5b 100644 --- a/src/python/grpcio/grpc/_common.py +++ b/src/python/grpcio/grpc/_common.py @@ -20,6 +20,8 @@ import six import grpc from grpc._cython import cygrpc +_LOGGER = logging.getLogger(__name__) + CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY = { cygrpc.ConnectivityState.idle: grpc.ChannelConnectivity.IDLE, @@ -73,7 +75,7 @@ def decode(b): try: return b.decode('utf8') except UnicodeDecodeError: - logging.exception('Invalid encoding on %s', b) + _LOGGER.exception('Invalid encoding on %s', b) return b.decode('latin1') @@ -84,7 +86,7 @@ def _transform(message, transformer, exception_message): try: return transformer(message) except Exception: # pylint: disable=broad-except - logging.exception(exception_message) + _LOGGER.exception(exception_message) return None diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi index 65de30884c..aecd3d7b11 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/arguments.pyx.pxi @@ -15,10 +15,12 @@ cimport cpython +# TODO(https://github.com/grpc/grpc/issues/15662): Reform this. cdef void* _copy_pointer(void* pointer): return pointer +# TODO(https://github.com/grpc/grpc/issues/15662): Reform this. cdef void _destroy_pointer(void* pointer): pass diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi index eefc685c0b..f067d76fab 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pxd.pxi @@ -69,3 +69,6 @@ cdef class Channel: cdef grpc_arg_pointer_vtable _vtable cdef _ChannelState _state + + # TODO(https://github.com/grpc/grpc/issues/15662): Eliminate this. + cdef tuple _arguments diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index 72e74e84ae..8c37a3cf85 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -390,6 +390,7 @@ cdef class Channel: def __cinit__( self, bytes target, object arguments, ChannelCredentials channel_credentials): + arguments = () if arguments is None else tuple(arguments) grpc_init() self._state = _ChannelState() self._vtable.copy = &_copy_pointer @@ -410,6 +411,7 @@ cdef class Channel: grpc_completion_queue_create_for_next(NULL)) self._state.c_connectivity_completion_queue = ( grpc_completion_queue_create_for_next(NULL)) + self._arguments = arguments def target(self): cdef char *c_target diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi index 7e9ea33ca0..8d73215247 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi @@ -57,6 +57,11 @@ cdef class ChannelCredentials: cdef grpc_channel_credentials *c_credentials +cdef class SSLSessionCacheLRU: + + cdef grpc_ssl_session_cache *_cache + + cdef class SSLChannelCredentials(ChannelCredentials): cdef readonly object _pem_root_certificates diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi index 500086f6cb..f4ccfbc016 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi @@ -17,6 +17,21 @@ cimport cpython import grpc import threading +from libc.stdint cimport uintptr_t + + +def _spawn_callback_in_thread(cb_func, args): + threading.Thread(target=cb_func, args=args).start() + +async_callback_func = _spawn_callback_in_thread + +def set_async_callback_func(callback_func): + global async_callback_func + async_callback_func = callback_func + +def _spawn_callback_async(callback, args): + async_callback_func(callback, args) + cdef class CallCredentials: @@ -40,7 +55,7 @@ cdef int _get_metadata( else: cb(user_data, NULL, 0, status, error_details) args = context.service_url, context.method_name, callback, - threading.Thread(target=<object>state, args=args).start() + _spawn_callback_async(<object>state, args) return 0 # Asynchronous return @@ -96,6 +111,21 @@ cdef class ChannelCredentials: raise NotImplementedError() +cdef class SSLSessionCacheLRU: + + def __cinit__(self, capacity): + grpc_init() + self._cache = grpc_ssl_session_cache_create_lru(capacity) + + def __int__(self): + return <uintptr_t>self._cache + + def __dealloc__(self): + if self._cache != NULL: + grpc_ssl_session_cache_destroy(self._cache) + grpc_shutdown() + + cdef class SSLChannelCredentials(ChannelCredentials): def __cinit__(self, pem_root_certificates, private_key, certificate_chain): diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index 2d6c900c54..cfefeaf938 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -131,6 +131,7 @@ cdef extern from "grpc/grpc.h": const char *GRPC_ARG_PRIMARY_USER_AGENT_STRING const char *GRPC_ARG_SECONDARY_USER_AGENT_STRING const char *GRPC_SSL_TARGET_NAME_OVERRIDE_ARG + const char *GRPC_SSL_SESSION_CACHE_ARG const char *GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM const char *GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL const char *GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET @@ -452,8 +453,16 @@ cdef extern from "grpc/grpc_security.h": # We don't care about the internals (and in fact don't know them) pass + + ctypedef struct grpc_ssl_session_cache: + # We don't care about the internals (and in fact don't know them) + pass + ctypedef void (*grpc_ssl_roots_override_callback)(char **pem_root_certs) + grpc_ssl_session_cache *grpc_ssl_session_cache_create_lru(size_t capacity) + void grpc_ssl_session_cache_destroy(grpc_ssl_session_cache* cache) + void grpc_set_ssl_roots_override_callback( grpc_ssl_roots_override_callback cb) nogil diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx index 31ef671aed..f9a1b2856d 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx @@ -418,6 +418,11 @@ def init_grpc_gevent(): g_event = gevent.event.Event() g_pool = gevent.pool.Group() + + def cb_func(cb, args): + _spawn_greenlet(cb, *args) + set_async_callback_func(cb_func) + gevent_resolver_vtable.resolve = socket_resolve gevent_resolver_vtable.resolve_async = socket_resolve_async diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi index 53e06a1596..00a1b23a67 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi @@ -14,6 +14,7 @@ import logging +_LOGGER = logging.getLogger(__name__) # This function will ascii encode unicode string inputs if neccesary. # In Python3, unicode strings are the default str type. @@ -49,5 +50,5 @@ cdef str _decode(bytes bytestring): try: return bytestring.decode('utf8') except UnicodeDecodeError: - logging.exception('Invalid encoding on %s', bytestring) + _LOGGER.exception('Invalid encoding on %s', bytestring) return bytestring.decode('latin1') diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi index ecd991685f..37b98ebbdb 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi @@ -51,6 +51,7 @@ class ChannelArgKey: default_authority = GRPC_ARG_DEFAULT_AUTHORITY primary_user_agent_string = GRPC_ARG_PRIMARY_USER_AGENT_STRING secondary_user_agent_string = GRPC_ARG_SECONDARY_USER_AGENT_STRING + ssl_session_cache = GRPC_SSL_SESSION_CACHE_ARG ssl_target_name_override = GRPC_SSL_TARGET_NAME_OVERRIDE_ARG diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi index 4588db30d3..52cfccb677 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pxd.pxi @@ -23,6 +23,7 @@ cdef class Server: cdef bint is_shutdown # notification of complete shutdown received # used at dealloc when user forgets to shutdown cdef CompletionQueue backup_shutdown_queue + # TODO(https://github.com/grpc/grpc/issues/15662): Elide this. cdef list references cdef list registered_completion_queues diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index 707ec742dd..da3dd21244 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -18,6 +18,8 @@ import logging import time import grpc +_LOGGER = logging.getLogger(__name__) + cdef grpc_ssl_certificate_config_reload_status _server_cert_config_fetcher_wrapper( void* user_data, grpc_ssl_server_certificate_config **config) with gil: # This is a credentials.ServerCertificateConfig @@ -34,13 +36,13 @@ cdef grpc_ssl_certificate_config_reload_status _server_cert_config_fetcher_wrapp try: cert_config_wrapper = user_cb() except Exception: - logging.exception('Error fetching certificate config') + _LOGGER.exception('Error fetching certificate config') return GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL if cert_config_wrapper is None: return GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED elif not isinstance( cert_config_wrapper, grpc.ServerCertificateConfiguration): - logging.error( + _LOGGER.error( 'Error fetching certificate configuration: certificate ' 'configuration must be of type grpc.ServerCertificateConfiguration, ' 'not %s' % type(cert_config_wrapper).__name__) diff --git a/src/python/grpcio/grpc/_interceptor.py b/src/python/grpcio/grpc/_interceptor.py index f465e35a9c..6b7a912a94 100644 --- a/src/python/grpcio/grpc/_interceptor.py +++ b/src/python/grpcio/grpc/_interceptor.py @@ -100,6 +100,12 @@ class _LocalFailure(grpc.RpcError, grpc.Future, grpc.Call): def cancelled(self): return False + def is_active(self): + return False + + def time_remaining(self): + return None + def running(self): return False @@ -115,6 +121,9 @@ class _LocalFailure(grpc.RpcError, grpc.Future, grpc.Call): def traceback(self, ignored_timeout=None): return self._traceback + def add_callback(self, callback): + return False + def add_done_callback(self, fn): fn(self) @@ -288,11 +297,11 @@ class _Channel(grpc.Channel): self._channel = channel self._interceptor = interceptor - def subscribe(self, *args, **kwargs): - self._channel.subscribe(*args, **kwargs) + def subscribe(self, callback, try_to_connect=False): + self._channel.subscribe(callback, try_to_connect=try_to_connect) - def unsubscribe(self, *args, **kwargs): - self._channel.unsubscribe(*args, **kwargs) + def unsubscribe(self, callback): + self._channel.unsubscribe(callback) def unary_unary(self, method, diff --git a/src/python/grpcio/grpc/_plugin_wrapping.py b/src/python/grpcio/grpc/_plugin_wrapping.py index 6785e5876a..916ee080b6 100644 --- a/src/python/grpcio/grpc/_plugin_wrapping.py +++ b/src/python/grpcio/grpc/_plugin_wrapping.py @@ -20,6 +20,8 @@ import grpc from grpc import _common from grpc._cython import cygrpc +_LOGGER = logging.getLogger(__name__) + class _AuthMetadataContext( collections.namedtuple('AuthMetadataContext', ( @@ -76,7 +78,7 @@ class _Plugin(object): _AuthMetadataPluginCallback( callback_state, callback)) except Exception as exception: # pylint: disable=broad-except - logging.exception( + _LOGGER.exception( 'AuthMetadataPluginCallback "%s" raised exception!', self._metadata_plugin) with callback_state.lock: diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index d849cadbee..2761022f21 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -27,6 +27,8 @@ from grpc import _interceptor from grpc._cython import cygrpc from grpc.framework.foundation import callable_util +_LOGGER = logging.getLogger(__name__) + _SHUTDOWN_TAG = 'shutdown' _REQUEST_CALL_TAG = 'request_call' @@ -279,7 +281,7 @@ class _Context(grpc.ServicerContext): def abort(self, code, details): # treat OK like other invalid arguments: fail the RPC if code == grpc.StatusCode.OK: - logging.error( + _LOGGER.error( 'abort() called with StatusCode.OK; returning UNKNOWN') code = grpc.StatusCode.UNKNOWN details = '' @@ -328,6 +330,8 @@ class _RequestIterator(object): self._state.request = None return request + raise AssertionError() # should never run + def _next(self): with self._state.condition: self._raise_or_start_receive_message() @@ -390,7 +394,7 @@ def _call_behavior(rpc_event, state, behavior, argument, request_deserializer): b'RPC Aborted') elif exception not in state.rpc_errors: details = 'Exception calling application: {}'.format(exception) - logging.exception(details) + _LOGGER.exception(details) _abort(state, rpc_event.call, cygrpc.StatusCode.unknown, _common.encode(details)) return None, False @@ -408,7 +412,7 @@ def _take_response_from_response_iterator(rpc_event, state, response_iterator): b'RPC Aborted') elif exception not in state.rpc_errors: details = 'Exception iterating responses: {}'.format(exception) - logging.exception(details) + _LOGGER.exception(details) _abort(state, rpc_event.call, cygrpc.StatusCode.unknown, _common.encode(details)) return None, False @@ -617,7 +621,7 @@ def _handle_call(rpc_event, generic_handlers, interceptor_pipeline, thread_pool, interceptor_pipeline) except Exception as exception: # pylint: disable=broad-except details = 'Exception servicing handler: {}'.format(exception) - logging.exception(details) + _LOGGER.exception(details) return _reject_rpc(rpc_event, cygrpc.StatusCode.unknown, b'Error in service handler!'), None if method_handler is None: diff --git a/src/python/grpcio/grpc/_utilities.py b/src/python/grpcio/grpc/_utilities.py index 25bd1ceae2..d90b34bcbd 100644 --- a/src/python/grpcio/grpc/_utilities.py +++ b/src/python/grpcio/grpc/_utilities.py @@ -116,6 +116,8 @@ class _ChannelReadyFuture(grpc.Future): callable_util.call_logging_exceptions( done_callback, _DONE_CALLBACK_EXCEPTION_LOG_MESSAGE, self) + return True + def cancelled(self): with self._condition: return self._cancelled diff --git a/src/python/grpcio/grpc/beta/_server_adaptations.py b/src/python/grpcio/grpc/beta/_server_adaptations.py index ccafec8951..80ac65b649 100644 --- a/src/python/grpcio/grpc/beta/_server_adaptations.py +++ b/src/python/grpcio/grpc/beta/_server_adaptations.py @@ -305,6 +305,7 @@ def _simple_method_handler(implementation, request_deserializer, response_serializer, None, None, None, _adapt_stream_stream_event( implementation.stream_stream_event)) + raise ValueError() def _flatten_method_pair_map(method_pair_map): diff --git a/src/python/grpcio/grpc/beta/utilities.py b/src/python/grpcio/grpc/beta/utilities.py index b5d8aac71a..fe3ce606c9 100644 --- a/src/python/grpcio/grpc/beta/utilities.py +++ b/src/python/grpcio/grpc/beta/utilities.py @@ -85,6 +85,8 @@ class _ChannelReadyFuture(future.Future): callable_util.call_logging_exceptions( done_callback, _DONE_CALLBACK_EXCEPTION_LOG_MESSAGE, self) + return True + def cancelled(self): with self._condition: return self._cancelled diff --git a/src/python/grpcio/grpc/experimental/session_cache.py b/src/python/grpcio/grpc/experimental/session_cache.py new file mode 100644 index 0000000000..5c55f7c327 --- /dev/null +++ b/src/python/grpcio/grpc/experimental/session_cache.py @@ -0,0 +1,45 @@ +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""gRPC's APIs for TLS Session Resumption support""" + +from grpc._cython import cygrpc as _cygrpc + + +def ssl_session_cache_lru(capacity): + """Creates an SSLSessionCache with LRU replacement policy + + Args: + capacity: Size of the cache + + Returns: + An SSLSessionCache with LRU replacement policy that can be passed as a value for + the grpc.ssl_session_cache option to a grpc.Channel. SSL session caches are used + to store session tickets, which clients can present to resume previous TLS sessions + with a server. + """ + return SSLSessionCache(_cygrpc.SSLSessionCacheLRU(capacity)) + + +class SSLSessionCache(object): + """An encapsulation of a session cache used for TLS session resumption. + + Instances of this class can be passed to a Channel as values for the + grpc.ssl_session_cache option + """ + + def __init__(self, cache): + self._cache = cache + + def __int__(self): + return int(self._cache) diff --git a/src/python/grpcio/grpc/framework/foundation/callable_util.py b/src/python/grpcio/grpc/framework/foundation/callable_util.py index b9b9c49f17..24daf3406f 100644 --- a/src/python/grpcio/grpc/framework/foundation/callable_util.py +++ b/src/python/grpcio/grpc/framework/foundation/callable_util.py @@ -21,6 +21,8 @@ import logging import six +_LOGGER = logging.getLogger(__name__) + class Outcome(six.with_metaclass(abc.ABCMeta)): """A sum type describing the outcome of some call. @@ -53,7 +55,7 @@ def _call_logging_exceptions(behavior, message, *args, **kwargs): return _EasyOutcome(Outcome.Kind.RETURNED, behavior(*args, **kwargs), None) except Exception as e: # pylint: disable=broad-except - logging.exception(message) + _LOGGER.exception(message) return _EasyOutcome(Outcome.Kind.RAISED, None, e) diff --git a/src/python/grpcio/grpc/framework/foundation/logging_pool.py b/src/python/grpcio/grpc/framework/foundation/logging_pool.py index f75df10042..216e3990db 100644 --- a/src/python/grpcio/grpc/framework/foundation/logging_pool.py +++ b/src/python/grpcio/grpc/framework/foundation/logging_pool.py @@ -17,6 +17,8 @@ import logging from concurrent import futures +_LOGGER = logging.getLogger(__name__) + def _wrap(behavior): """Wraps an arbitrary callable behavior in exception-logging.""" @@ -25,7 +27,7 @@ def _wrap(behavior): try: return behavior(*args, **kwargs) except Exception: - logging.exception( + _LOGGER.exception( 'Unexpected exception from %s executed in logging pool!', behavior) raise diff --git a/src/python/grpcio/grpc/framework/foundation/stream_util.py b/src/python/grpcio/grpc/framework/foundation/stream_util.py index 04631d9899..1faaf29bd7 100644 --- a/src/python/grpcio/grpc/framework/foundation/stream_util.py +++ b/src/python/grpcio/grpc/framework/foundation/stream_util.py @@ -19,6 +19,7 @@ import threading from grpc.framework.foundation import stream _NO_VALUE = object() +_LOGGER = logging.getLogger(__name__) class TransformingConsumer(stream.Consumer): @@ -46,10 +47,10 @@ class IterableConsumer(stream.Consumer): self._values = [] self._active = True - def consume(self, stock_reply): + def consume(self, value): with self._condition: if self._active: - self._values.append(stock_reply) + self._values.append(value) self._condition.notify() def terminate(self): @@ -57,10 +58,10 @@ class IterableConsumer(stream.Consumer): self._active = False self._condition.notify() - def consume_and_terminate(self, stock_reply): + def consume_and_terminate(self, value): with self._condition: if self._active: - self._values.append(stock_reply) + self._values.append(value) self._active = False self._condition.notify() @@ -103,7 +104,7 @@ class ThreadSwitchingConsumer(stream.Consumer): else: sink.consume(value) except Exception as e: # pylint:disable=broad-except - logging.exception(e) + _LOGGER.exception(e) with self._lock: if terminate: diff --git a/src/python/grpcio_testing/grpc_testing/__init__.py b/src/python/grpcio_testing/grpc_testing/__init__.py index e87d0ffc96..65fdd1b8ca 100644 --- a/src/python/grpcio_testing/grpc_testing/__init__.py +++ b/src/python/grpcio_testing/grpc_testing/__init__.py @@ -14,9 +14,9 @@ """Objects for use in testing gRPC Python-using application code.""" import abc +import six from google.protobuf import descriptor -import six import grpc diff --git a/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py b/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py index ebce652eeb..191b1c1726 100644 --- a/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py +++ b/src/python/grpcio_testing/grpc_testing/_channel/_invocation.py @@ -18,6 +18,7 @@ import threading import grpc _NOT_YET_OBSERVED = object() +_LOGGER = logging.getLogger(__name__) def _cancel(handler): @@ -248,7 +249,7 @@ def consume_requests(request_iterator, handler): break except Exception: # pylint: disable=broad-except details = 'Exception iterating requests!' - logging.exception(details) + _LOGGER.exception(details) handler.cancel(grpc.StatusCode.UNKNOWN, details) consumption = threading.Thread(target=_consume) diff --git a/src/python/grpcio_testing/grpc_testing/_server/_handler.py b/src/python/grpcio_testing/grpc_testing/_server/_handler.py index d4f50f6863..0e3404b0d0 100644 --- a/src/python/grpcio_testing/grpc_testing/_server/_handler.py +++ b/src/python/grpcio_testing/grpc_testing/_server/_handler.py @@ -105,10 +105,10 @@ class _Handler(Handler): self._expiration_future.cancel() self._condition.notify_all() - def add_termination_callback(self, termination_callback): + def add_termination_callback(self, callback): with self._condition: if self._code is None: - self._termination_callbacks.append(termination_callback) + self._termination_callbacks.append(callback) return True else: return False diff --git a/src/python/grpcio_testing/grpc_testing/_server/_rpc.py b/src/python/grpcio_testing/grpc_testing/_server/_rpc.py index 2060e8daff..b856da100f 100644 --- a/src/python/grpcio_testing/grpc_testing/_server/_rpc.py +++ b/src/python/grpcio_testing/grpc_testing/_server/_rpc.py @@ -18,6 +18,8 @@ import threading import grpc from grpc_testing import _common +_LOGGER = logging.getLogger(__name__) + class Rpc(object): @@ -47,7 +49,7 @@ class Rpc(object): try: callback() except Exception: # pylint: disable=broad-except - logging.exception('Exception calling server-side callback!') + _LOGGER.exception('Exception calling server-side callback!') callback_calling_thread = threading.Thread(target=call_back) callback_calling_thread.start() @@ -86,7 +88,7 @@ class Rpc(object): def application_exception_abort(self, exception): with self._condition: if exception not in self._rpc_errors: - logging.exception('Exception calling application!') + _LOGGER.exception('Exception calling application!') self._abort( grpc.StatusCode.UNKNOWN, 'Exception calling application: {}'.format(exception)) diff --git a/src/python/grpcio_testing/grpc_testing/_time.py b/src/python/grpcio_testing/grpc_testing/_time.py index afbdad3524..75e6db3458 100644 --- a/src/python/grpcio_testing/grpc_testing/_time.py +++ b/src/python/grpcio_testing/grpc_testing/_time.py @@ -21,13 +21,15 @@ import time as _time import grpc import grpc_testing +_LOGGER = logging.getLogger(__name__) + def _call(behaviors): for behavior in behaviors: try: behavior() except Exception: # pylint: disable=broad-except - logging.exception('Exception calling behavior "%r"!', behavior) + _LOGGER.exception('Exception calling behavior "%r"!', behavior) def _call_in_thread(behaviors): diff --git a/src/python/grpcio_tests/tests/_loader.py b/src/python/grpcio_tests/tests/_loader.py index be0af64646..80c107aa8e 100644 --- a/src/python/grpcio_tests/tests/_loader.py +++ b/src/python/grpcio_tests/tests/_loader.py @@ -48,12 +48,13 @@ class Loader(object): # measure unnecessarily suffers) coverage_context = coverage.Coverage(data_suffix=True) coverage_context.start() - modules = [importlib.import_module(name) for name in names] - for module in modules: - self.visit_module(module) - for module in modules: + imported_modules = tuple( + importlib.import_module(name) for name in names) + for imported_module in imported_modules: + self.visit_module(imported_module) + for imported_module in imported_modules: try: - package_paths = module.__path__ + package_paths = imported_module.__path__ except AttributeError: continue self.walk_packages(package_paths) diff --git a/src/python/grpcio_tests/tests/_result.py b/src/python/grpcio_tests/tests/_result.py index b105f18e78..e5378b7ea3 100644 --- a/src/python/grpcio_tests/tests/_result.py +++ b/src/python/grpcio_tests/tests/_result.py @@ -144,10 +144,6 @@ class AugmentedResult(unittest.TestResult): super(AugmentedResult, self).startTestRun() self.cases = dict() - def stopTestRun(self): - """See unittest.TestResult.stopTestRun.""" - super(AugmentedResult, self).stopTestRun() - def startTest(self, test): """See unittest.TestResult.startTest.""" super(AugmentedResult, self).startTest(test) @@ -155,19 +151,19 @@ class AugmentedResult(unittest.TestResult): self.cases[case_id] = CaseResult( id=case_id, name=test.id(), kind=CaseResult.Kind.RUNNING) - def addError(self, test, error): + def addError(self, test, err): """See unittest.TestResult.addError.""" - super(AugmentedResult, self).addError(test, error) + super(AugmentedResult, self).addError(test, err) case_id = self.id_map(test) self.cases[case_id] = self.cases[case_id].updated( - kind=CaseResult.Kind.ERROR, traceback=error) + kind=CaseResult.Kind.ERROR, traceback=err) - def addFailure(self, test, error): + def addFailure(self, test, err): """See unittest.TestResult.addFailure.""" - super(AugmentedResult, self).addFailure(test, error) + super(AugmentedResult, self).addFailure(test, err) case_id = self.id_map(test) self.cases[case_id] = self.cases[case_id].updated( - kind=CaseResult.Kind.FAILURE, traceback=error) + kind=CaseResult.Kind.FAILURE, traceback=err) def addSuccess(self, test): """See unittest.TestResult.addSuccess.""" @@ -183,12 +179,12 @@ class AugmentedResult(unittest.TestResult): self.cases[case_id] = self.cases[case_id].updated( kind=CaseResult.Kind.SKIP, skip_reason=reason) - def addExpectedFailure(self, test, error): + def addExpectedFailure(self, test, err): """See unittest.TestResult.addExpectedFailure.""" - super(AugmentedResult, self).addExpectedFailure(test, error) + super(AugmentedResult, self).addExpectedFailure(test, err) case_id = self.id_map(test) self.cases[case_id] = self.cases[case_id].updated( - kind=CaseResult.Kind.EXPECTED_FAILURE, traceback=error) + kind=CaseResult.Kind.EXPECTED_FAILURE, traceback=err) def addUnexpectedSuccess(self, test): """See unittest.TestResult.addUnexpectedSuccess.""" @@ -249,13 +245,6 @@ class CoverageResult(AugmentedResult): self.coverage_context.save() self.coverage_context = None - def stopTestRun(self): - """See unittest.TestResult.stopTestRun.""" - super(CoverageResult, self).stopTestRun() - # TODO(atash): Dig deeper into why the following line fails to properly - # combine coverage data from the Cython plugin. - #coverage.Coverage().combine() - class _Colors(object): """Namespaced constants for terminal color magic numbers.""" @@ -295,16 +284,16 @@ class TerminalResult(CoverageResult): self.out.write(summary(self)) self.out.flush() - def addError(self, test, error): + def addError(self, test, err): """See unittest.TestResult.addError.""" - super(TerminalResult, self).addError(test, error) + super(TerminalResult, self).addError(test, err) self.out.write( _Colors.FAIL + 'ERROR {}\n'.format(test.id()) + _Colors.END) self.out.flush() - def addFailure(self, test, error): + def addFailure(self, test, err): """See unittest.TestResult.addFailure.""" - super(TerminalResult, self).addFailure(test, error) + super(TerminalResult, self).addFailure(test, err) self.out.write( _Colors.FAIL + 'FAILURE {}\n'.format(test.id()) + _Colors.END) self.out.flush() @@ -323,9 +312,9 @@ class TerminalResult(CoverageResult): _Colors.INFO + 'SKIP {}\n'.format(test.id()) + _Colors.END) self.out.flush() - def addExpectedFailure(self, test, error): + def addExpectedFailure(self, test, err): """See unittest.TestResult.addExpectedFailure.""" - super(TerminalResult, self).addExpectedFailure(test, error) + super(TerminalResult, self).addExpectedFailure(test, err) self.out.write( _Colors.INFO + 'FAILURE_OK {}\n'.format(test.id()) + _Colors.END) self.out.flush() diff --git a/src/python/grpcio_tests/tests/interop/methods.py b/src/python/grpcio_tests/tests/interop/methods.py index b728ffd704..cda15a68a3 100644 --- a/src/python/grpcio_tests/tests/interop/methods.py +++ b/src/python/grpcio_tests/tests/interop/methods.py @@ -144,8 +144,8 @@ def _large_unary_common_behavior(stub, fill_username, fill_oauth_scope, def _empty_unary(stub): response = stub.EmptyCall(empty_pb2.Empty()) if not isinstance(response, empty_pb2.Empty): - raise TypeError('response is of type "%s", not empty_pb2.Empty!', - type(response)) + raise TypeError( + 'response is of type "%s", not empty_pb2.Empty!' % type(response)) def _large_unary(stub): diff --git a/src/python/grpcio_tests/tests/interop/server.py b/src/python/grpcio_tests/tests/interop/server.py index 0810de2394..fd28d498a1 100644 --- a/src/python/grpcio_tests/tests/interop/server.py +++ b/src/python/grpcio_tests/tests/interop/server.py @@ -26,6 +26,7 @@ from tests.interop import resources from tests.unit import test_common _ONE_DAY_IN_SECONDS = 60 * 60 * 24 +_LOGGER = logging.getLogger(__name__) def serve(): @@ -52,14 +53,14 @@ def serve(): server.add_insecure_port('[::]:{}'.format(args.port)) server.start() - logging.info('Server serving.') + _LOGGER.info('Server serving.') try: while True: time.sleep(_ONE_DAY_IN_SECONDS) except BaseException as e: - logging.info('Caught exception "%s"; stopping server...', e) + _LOGGER.info('Caught exception "%s"; stopping server...', e) server.stop(None) - logging.info('Server stopped; exiting.') + _LOGGER.info('Server stopped; exiting.') if __name__ == '__main__': diff --git a/src/python/grpcio_tests/tests/tests.json b/src/python/grpcio_tests/tests/tests.json index 0d94426413..65460a9540 100644 --- a/src/python/grpcio_tests/tests/tests.json +++ b/src/python/grpcio_tests/tests/tests.json @@ -53,6 +53,7 @@ "unit._server_ssl_cert_config_test.ServerSSLCertReloadTestCertConfigReuse", "unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithClientAuth", "unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithoutClientAuth", + "unit._session_cache_test.SSLSessionCacheTest", "unit.beta._beta_features_test.BetaFeaturesTest", "unit.beta._beta_features_test.ContextManagementAndLifecycleTest", "unit.beta._connectivity_channel_test.ConnectivityStatesTest", diff --git a/src/python/grpcio_tests/tests/unit/_auth_context_test.py b/src/python/grpcio_tests/tests/unit/_auth_context_test.py index 8c1a30e032..d174051070 100644 --- a/src/python/grpcio_tests/tests/unit/_auth_context_test.py +++ b/src/python/grpcio_tests/tests/unit/_auth_context_test.py @@ -18,6 +18,7 @@ import unittest import grpc from grpc import _channel +from grpc.experimental import session_cache import six from tests.unit import test_common @@ -140,6 +141,50 @@ class AuthContextTest(unittest.TestCase): self.assertSequenceEqual([b'*.test.google.com'], auth_ctx['x509_common_name']) + def _do_one_shot_client_rpc(self, channel_creds, channel_options, port, + expect_ssl_session_reused): + channel = grpc.secure_channel( + 'localhost:{}'.format(port), channel_creds, options=channel_options) + response = channel.unary_unary(_UNARY_UNARY)(_REQUEST) + auth_data = pickle.loads(response) + self.assertEqual(expect_ssl_session_reused, + auth_data[_AUTH_CTX]['ssl_session_reused']) + channel.close() + + def testSessionResumption(self): + # Set up a secure server + handler = grpc.method_handlers_generic_handler('test', { + 'UnaryUnary': + grpc.unary_unary_rpc_method_handler(handle_unary_unary) + }) + server = test_common.test_server() + server.add_generic_rpc_handlers((handler,)) + server_cred = grpc.ssl_server_credentials(_SERVER_CERTS) + port = server.add_secure_port('[::]:0', server_cred) + server.start() + + # Create a cache for TLS session tickets + cache = session_cache.ssl_session_cache_lru(1) + channel_creds = grpc.ssl_channel_credentials( + root_certificates=_TEST_ROOT_CERTIFICATES) + channel_options = _PROPERTY_OPTIONS + ( + ('grpc.ssl_session_cache', cache),) + + # Initial connection has no session to resume + self._do_one_shot_client_rpc( + channel_creds, + channel_options, + port, + expect_ssl_session_reused=[b'false']) + + # Subsequent connections resume sessions + self._do_one_shot_client_rpc( + channel_creds, + channel_options, + port, + expect_ssl_session_reused=[b'true']) + server.stop(None) + if __name__ == '__main__': unittest.main(verbosity=2) diff --git a/src/python/grpcio_tests/tests/unit/_junkdrawer/__init__.py b/src/python/grpcio_tests/tests/unit/_junkdrawer/__init__.py deleted file mode 100644 index 5fb4f3c3cf..0000000000 --- a/src/python/grpcio_tests/tests/unit/_junkdrawer/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. diff --git a/src/python/grpcio_tests/tests/unit/_junkdrawer/stock_pb2.py b/src/python/grpcio_tests/tests/unit/_junkdrawer/stock_pb2.py deleted file mode 100644 index 2bf1e1cc0d..0000000000 --- a/src/python/grpcio_tests/tests/unit/_junkdrawer/stock_pb2.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# TODO(nathaniel): Remove this from source control after having made -# generation from the stock.proto source part of GRPC's build-and-test -# process. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: stock.proto - -import sys -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1')) -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -from google.protobuf import descriptor_pb2 -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - -DESCRIPTOR = _descriptor.FileDescriptor( - name='stock.proto', - package='stock', - serialized_pb=_b( - '\n\x0bstock.proto\x12\x05stock\">\n\x0cStockRequest\x12\x0e\n\x06symbol\x18\x01 \x01(\t\x12\x1e\n\x13num_trades_to_watch\x18\x02 \x01(\x05:\x01\x30\"+\n\nStockReply\x12\r\n\x05price\x18\x01 \x01(\x02\x12\x0e\n\x06symbol\x18\x02 \x01(\t2\x96\x02\n\x05Stock\x12=\n\x11GetLastTradePrice\x12\x13.stock.StockRequest\x1a\x11.stock.StockReply\"\x00\x12I\n\x19GetLastTradePriceMultiple\x12\x13.stock.StockRequest\x1a\x11.stock.StockReply\"\x00(\x01\x30\x01\x12?\n\x11WatchFutureTrades\x12\x13.stock.StockRequest\x1a\x11.stock.StockReply\"\x00\x30\x01\x12\x42\n\x14GetHighestTradePrice\x12\x13.stock.StockRequest\x1a\x11.stock.StockReply\"\x00(\x01' - )) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -_STOCKREQUEST = _descriptor.Descriptor( - name='StockRequest', - full_name='stock.StockRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='symbol', - full_name='stock.StockRequest.symbol', - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode('utf-8'), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='num_trades_to_watch', - full_name='stock.StockRequest.num_trades_to_watch', - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=True, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - options=None), - ], - extensions=[], - nested_types=[], - enum_types=[], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[], - serialized_start=22, - serialized_end=84,) - -_STOCKREPLY = _descriptor.Descriptor( - name='StockReply', - full_name='stock.StockReply', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='price', - full_name='stock.StockReply.price', - index=0, - number=1, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='symbol', - full_name='stock.StockReply.symbol', - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=_b("").decode('utf-8'), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - options=None), - ], - extensions=[], - nested_types=[], - enum_types=[], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[], - serialized_start=86, - serialized_end=129,) - -DESCRIPTOR.message_types_by_name['StockRequest'] = _STOCKREQUEST -DESCRIPTOR.message_types_by_name['StockReply'] = _STOCKREPLY - -StockRequest = _reflection.GeneratedProtocolMessageType( - 'StockRequest', - (_message.Message,), - dict( - DESCRIPTOR=_STOCKREQUEST, - __module__='stock_pb2' - # @@protoc_insertion_point(class_scope:stock.StockRequest) - )) -_sym_db.RegisterMessage(StockRequest) - -StockReply = _reflection.GeneratedProtocolMessageType( - 'StockReply', - (_message.Message,), - dict( - DESCRIPTOR=_STOCKREPLY, - __module__='stock_pb2' - # @@protoc_insertion_point(class_scope:stock.StockReply) - )) -_sym_db.RegisterMessage(StockReply) - -# @@protoc_insertion_point(module_scope) diff --git a/src/python/grpcio_tests/tests/unit/_session_cache_test.py b/src/python/grpcio_tests/tests/unit/_session_cache_test.py new file mode 100644 index 0000000000..b4e4670fa7 --- /dev/null +++ b/src/python/grpcio_tests/tests/unit/_session_cache_test.py @@ -0,0 +1,145 @@ +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests experimental TLS Session Resumption API""" + +import pickle +import unittest + +import grpc +from grpc import _channel +from grpc.experimental import session_cache + +from tests.unit import test_common +from tests.unit import resources + +_REQUEST = b'\x00\x00\x00' +_RESPONSE = b'\x00\x00\x00' + +_UNARY_UNARY = '/test/UnaryUnary' + +_SERVER_HOST_OVERRIDE = 'foo.test.google.fr' +_ID = 'id' +_ID_KEY = 'id_key' +_AUTH_CTX = 'auth_ctx' + +_PRIVATE_KEY = resources.private_key() +_CERTIFICATE_CHAIN = resources.certificate_chain() +_TEST_ROOT_CERTIFICATES = resources.test_root_certificates() +_SERVER_CERTS = ((_PRIVATE_KEY, _CERTIFICATE_CHAIN),) +_PROPERTY_OPTIONS = (( + 'grpc.ssl_target_name_override', + _SERVER_HOST_OVERRIDE, +),) + + +def handle_unary_unary(request, servicer_context): + return pickle.dumps({ + _ID: servicer_context.peer_identities(), + _ID_KEY: servicer_context.peer_identity_key(), + _AUTH_CTX: servicer_context.auth_context() + }) + + +def start_secure_server(): + handler = grpc.method_handlers_generic_handler('test', { + 'UnaryUnary': + grpc.unary_unary_rpc_method_handler(handle_unary_unary) + }) + server = test_common.test_server() + server.add_generic_rpc_handlers((handler,)) + server_cred = grpc.ssl_server_credentials(_SERVER_CERTS) + port = server.add_secure_port('[::]:0', server_cred) + server.start() + + return server, port + + +class SSLSessionCacheTest(unittest.TestCase): + + def _do_one_shot_client_rpc(self, channel_creds, channel_options, port, + expect_ssl_session_reused): + channel = grpc.secure_channel( + 'localhost:{}'.format(port), channel_creds, options=channel_options) + response = channel.unary_unary(_UNARY_UNARY)(_REQUEST) + auth_data = pickle.loads(response) + self.assertEqual(expect_ssl_session_reused, + auth_data[_AUTH_CTX]['ssl_session_reused']) + channel.close() + + def testSSLSessionCacheLRU(self): + server_1, port_1 = start_secure_server() + + cache = session_cache.ssl_session_cache_lru(1) + channel_creds = grpc.ssl_channel_credentials( + root_certificates=_TEST_ROOT_CERTIFICATES) + channel_options = _PROPERTY_OPTIONS + ( + ('grpc.ssl_session_cache', cache),) + + # Initial connection has no session to resume + self._do_one_shot_client_rpc( + channel_creds, + channel_options, + port_1, + expect_ssl_session_reused=[b'false']) + + # Connection to server_1 resumes from initial session + self._do_one_shot_client_rpc( + channel_creds, + channel_options, + port_1, + expect_ssl_session_reused=[b'true']) + + # Connection to a different server with the same name overwrites the cache entry + server_2, port_2 = start_secure_server() + self._do_one_shot_client_rpc( + channel_creds, + channel_options, + port_2, + expect_ssl_session_reused=[b'false']) + self._do_one_shot_client_rpc( + channel_creds, + channel_options, + port_2, + expect_ssl_session_reused=[b'true']) + server_2.stop(None) + + # Connection to server_1 now falls back to full TLS handshake + self._do_one_shot_client_rpc( + channel_creds, + channel_options, + port_1, + expect_ssl_session_reused=[b'false']) + + # Re-creating server_1 causes old sessions to become invalid + server_1.stop(None) + server_1, port_1 = start_secure_server() + + # Old sessions should no longer be valid + self._do_one_shot_client_rpc( + channel_creds, + channel_options, + port_1, + expect_ssl_session_reused=[b'false']) + + # Resumption should work for subsequent connections + self._do_one_shot_client_rpc( + channel_creds, + channel_options, + port_1, + expect_ssl_session_reused=[b'true']) + server_1.stop(None) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index 06adb33739..435217bacd 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -35,7 +35,7 @@ def get_deps(target_dict): deps = [] - if target_dict.get('baselib', False): + if target_dict.get('baselib', False) or target_dict['name'] == 'address_sorting': deps.append("${_gRPC_BASELIB_LIBRARIES}") if target_dict.get('build', None) in ['protoc']: deps.append("${_gRPC_PROTOBUF_PROTOC_LIBRARIES}") diff --git a/templates/Makefile.template b/templates/Makefile.template index 901dbfc9c8..43fa904768 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -414,7 +414,6 @@ ifeq ($(HAS_PKG_CONFIG),true) OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl - OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl ZLIB_CHECK_CMD = $(PKG_CONFIG) --exists zlib PROTOBUF_CHECK_CMD = $(PKG_CONFIG) --atleast-version=3.5.0 protobuf CARES_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.11.0 libcares @@ -427,7 +426,6 @@ endif OPENSSL_ALPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) - OPENSSL_NPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-npn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) BORINGSSL_COMPILE_CHECK_CMD = $(CC) $(CPPFLAGS) ${defaults.boringssl.CPPFLAGS} $(CFLAGS) ${defaults.boringssl.CFLAGS} -o $(TMPOUT) test/build/boringssl.c $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) @@ -455,13 +453,7 @@ ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) HAS_SYSTEM_OPENSSL_ALPN ?= $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) - HAS_SYSTEM_OPENSSL_NPN = true CACHE_MK += HAS_SYSTEM_OPENSSL_ALPN = true, - else - HAS_SYSTEM_OPENSSL_NPN ?= $(shell $(OPENSSL_NPN_CHECK_CMD) 2> /dev/null && echo true || echo false) - endif - ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) - CACHE_MK += HAS_SYSTEM_OPENSSL_NPN = true, endif HAS_SYSTEM_ZLIB ?= $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_SYSTEM_ZLIB),true) @@ -478,7 +470,6 @@ else # override system libraries if the config requires a custom compiled library HAS_SYSTEM_OPENSSL_ALPN = false - HAS_SYSTEM_OPENSSL_NPN = false HAS_SYSTEM_ZLIB = false HAS_SYSTEM_PROTOBUF = false HAS_SYSTEM_CARES = false @@ -625,12 +616,7 @@ EMBED_OPENSSL ?= $(HAS_EMBEDDED_OPENSSL_ALPN) NO_SECURE ?= false else # HAS_EMBEDDED_OPENSSL_ALPN=false - ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) - EMBED_OPENSSL ?= false - NO_SECURE ?= false - else NO_SECURE ?= true - endif # HAS_SYSTEM_OPENSSL_NPN=true endif # HAS_EMBEDDED_OPENSSL_ALPN endif # HAS_SYSTEM_OPENSSL_ALPN @@ -664,10 +650,10 @@ else # HAS_PKG_CONFIG=false LIBS_SECURE = $(OPENSSL_LIBS) endif # HAS_PKG_CONFIG - ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) + ifeq ($(DISABLE_ALPN),true) CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 LIBS_SECURE = $(OPENSSL_LIBS) - endif # HAS_SYSTEM_OPENSSL_NPN + endif # DISABLE_ALPN PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) endif # EMBED_OPENSSL endif # NO_SECURE @@ -888,7 +874,6 @@ run_dep_checks: $(OPENSSL_ALPN_CHECK_CMD) || true - $(OPENSSL_NPN_CHECK_CMD) || true $(ZLIB_CHECK_CMD) || true $(PERFTOOLS_CHECK_CMD) || true $(PROTOBUF_CHECK_CMD) || true diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index af97d81834..a767a612a6 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -68,6 +68,14 @@ excl = grpc_private_files(libs) return [file for file in out if not file in excl] + def cfstream_private_headers(libs): + out = grpc_lib_files(libs, ("grpc_cfstream",), ("own_headers",)) + return out + + def cfstream_private_files(libs): + out = grpc_lib_files(libs, ("grpc_cfstream",), ("own_src", "own_headers")) + return out + def ruby_multiline_list(files, indent): return (',\n' + indent*' ').join('\'%s\'' % f for f in files) %> @@ -175,6 +183,16 @@ ss.private_header_files = ${ruby_multiline_list(grpc_private_headers(libs), 30)} end + s.subspec 'CFStream-Implementation' do |ss| + ss.header_mappings_dir = '.' + ss.dependency "#{s.name}/Implementation", version + ss.pod_target_xcconfig = { + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GRPC_CFSTREAM=1' + } + ss.source_files = ${ruby_multiline_list(cfstream_private_files(filegroups), 22)} + ss.private_header_files = ${ruby_multiline_list(cfstream_private_headers(filegroups), 30)} + end + s.subspec 'Cronet-Interface' do |ss| ss.header_mappings_dir = 'include/grpc' ss.source_files = ${ruby_multiline_list(grpc_cronet_public_headers(libs), 22)} diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index d2dcc429ef..96966784f1 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -43,12 +43,25 @@ s.header_dir = name src_dir = 'src/objective-c/ProtoRPC' - s.source_files = "#{src_dir}/*.{h,m}" - s.header_mappings_dir = "#{src_dir}" - s.dependency 'gRPC', version - s.dependency 'gRPC-RxLibrary', version - s.dependency 'Protobuf', '~> 3.0' + s.default_subspec = 'Main' + + s.subspec 'Main' do |ss| + ss.header_mappings_dir = "#{src_dir}" + ss.dependency 'gRPC', version + ss.dependency 'gRPC-RxLibrary', version + ss.dependency 'Protobuf', '~> 3.0' + + ss.source_files = "#{src_dir}/*.{h,m}" + end + s.subspec 'CFStream' do |ss| + ss.dependency 'gRPC/CFStream', version + ss.dependency "#{s.name}/Main", version + ss.pod_target_xcconfig = { + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GRPC_CFSTREAM=1' + } + end + s.pod_target_xcconfig = { # This is needed by all pods that depend on Protobuf: 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index 6616e74bd7..a3190c2d8e 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -65,6 +65,16 @@ ss.dependency 'gRPC-Core', version end + # This subspec is mutually exclusive with the `Main` subspec + s.subspec 'CFStream' do |ss| + ss.dependency 'gRPC-Core/CFStream-Implementation', version + ss.dependency "#{s.name}/Main", version + + ss.pod_target_xcconfig = { + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GRPC_CFSTREAM=1' + } + end + s.subspec 'GID' do |ss| ss.ios.deployment_target = '7.0' diff --git a/templates/grpc.gemspec.template b/templates/grpc.gemspec.template index fb54de1c8e..842035b664 100644 --- a/templates/grpc.gemspec.template +++ b/templates/grpc.gemspec.template @@ -22,7 +22,9 @@ s.files += Dir.glob('src/ruby/bin/**/*') s.files += Dir.glob('src/ruby/ext/**/*') s.files += Dir.glob('src/ruby/lib/**/*') - s.files += Dir.glob('src/ruby/pb/**/*') + s.files += Dir.glob('src/ruby/pb/**/*').reject do |f| + f.match(%r{^src/ruby/pb/test}) + end s.files += Dir.glob('include/grpc/**/*') s.test_files = Dir.glob('src/ruby/spec/**/*') s.bindir = 'src/ruby/bin' @@ -30,7 +32,6 @@ s.platform = Gem::Platform::RUBY s.add_dependency 'google-protobuf', '~> 3.1' - s.add_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.add_dependency 'googleapis-common-protos-types', '~> 1.0.0' s.add_development_dependency 'bundler', '~> 1.9' @@ -43,6 +44,7 @@ s.add_development_dependency 'rspec', '~> 3.6' s.add_development_dependency 'rubocop', '~> 0.49.1' s.add_development_dependency 'signet', '~> 0.7.0' + s.add_development_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.extensions = %w(src/ruby/ext/grpc/extconf.rb) diff --git a/templates/src/csharp/build_packages_dotnetcli.bat.template b/templates/src/csharp/build_packages_dotnetcli.bat.template index 1bf78c4d23..45010fec74 100755 --- a/templates/src/csharp/build_packages_dotnetcli.bat.template +++ b/templates/src/csharp/build_packages_dotnetcli.bat.template @@ -49,6 +49,7 @@ %%DOTNET% pack --configuration Release Grpc.Reflection --output ..\..\..\artifacts || goto :error %%NUGET% pack Grpc.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts || goto :error + %%NUGET% pack Grpc.Core.NativeDebug.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts %%NUGET% pack Grpc.Tools.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts @rem copy resulting nuget packages to artifacts directory diff --git a/templates/src/csharp/build_packages_dotnetcli.sh.template b/templates/src/csharp/build_packages_dotnetcli.sh.template index ddfea74744..1172582ebd 100755 --- a/templates/src/csharp/build_packages_dotnetcli.sh.template +++ b/templates/src/csharp/build_packages_dotnetcli.sh.template @@ -48,6 +48,7 @@ dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts nuget pack Grpc.nuspec -Version "${settings.csharp_version}" -OutputDirectory ../../artifacts + nuget pack Grpc.Core.NativeDebug.nuspec -Version "${settings.csharp_version}" -OutputDirectory ../../artifacts nuget pack Grpc.Tools.nuspec -Version "${settings.csharp_version}" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/templates/tools/dockerfile/apt_get_pyenv.include b/templates/tools/dockerfile/apt_get_pyenv.include index ef0964e597..e12b3e2c7f 100644 --- a/templates/tools/dockerfile/apt_get_pyenv.include +++ b/templates/tools/dockerfile/apt_get_pyenv.include @@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y ${'\\'} mercurial ${'\\'} zlib1g-dev && apt-get clean -# Install Pyenv and dev Python versions 3.5 and 3.6 +# Install Pyenv and dev Python versions 3.{5,6,7} RUN curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash ENV PATH /root/.pyenv/bin:$PATH RUN eval "$(pyenv init -)" @@ -18,5 +18,6 @@ RUN eval "$(pyenv virtualenv-init -)" RUN pyenv update RUN pyenv install 3.5-dev RUN pyenv install 3.6-dev +RUN pyenv install 3.7-dev RUN pyenv install pypy-5.3.1 -RUN pyenv local 3.5-dev 3.6-dev pypy-5.3.1 +RUN pyenv local 3.5-dev 3.6-dev 3.7-dev pypy-5.3.1 diff --git a/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template index ba65c06a3b..1e013b742c 100644 --- a/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template @@ -14,15 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM debian:jessie + FROM debian:stretch <%include file="../../apt_get_basic.include"/> <%include file="../../gcp_api_libraries.include"/> <%include file="../../python_deps.include"/> <%include file="../../apt_get_pyenv.include"/> - # Install pip and virtualenv for Python 3.4 - RUN curl https://bootstrap.pypa.io/get-pip.py | python3.4 - RUN python3.4 -m pip install virtualenv + # Install pip and virtualenv for Python 3.5 + RUN curl https://bootstrap.pypa.io/get-pip.py | python3.5 + RUN python3.5 -m pip install virtualenv <%include file="../../run_tests_addons.include"/> # Define the default command. diff --git a/test/build/openssl-npn.c b/test/build/openssl-npn.c deleted file mode 100644 index 9c71382720..0000000000 --- a/test/build/openssl-npn.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/* This is just a compilation test, to see if we have a version of OpenSSL with - NPN support installed. It's not meant to be run, and all of the values and - function calls there are non-sensical. The code is only meant to test the - presence of symbols, and we're expecting a compilation failure otherwise. */ - -#include <stdlib.h> -#include <openssl/ssl.h> - -int main() { - SSL_get0_next_proto_negotiated(NULL, NULL, NULL); - return OPENSSL_NPN_UNSUPPORTED; -} diff --git a/test/core/end2end/end2end_nosec_tests.cc b/test/core/end2end/end2end_nosec_tests.cc index 59eb643a93..a70128254a 100644 --- a/test/core/end2end/end2end_nosec_tests.cc +++ b/test/core/end2end/end2end_nosec_tests.cc @@ -100,6 +100,8 @@ extern void negative_deadline(grpc_end2end_test_config config); extern void negative_deadline_pre_init(void); extern void network_status_change(grpc_end2end_test_config config); extern void network_status_change_pre_init(void); +extern void no_error_on_hotpath(grpc_end2end_test_config config); +extern void no_error_on_hotpath_pre_init(void); extern void no_logging(grpc_end2end_test_config config); extern void no_logging_pre_init(void); extern void no_op(grpc_end2end_test_config config); @@ -222,6 +224,7 @@ void grpc_end2end_tests_pre_init(void) { max_message_length_pre_init(); negative_deadline_pre_init(); network_status_change_pre_init(); + no_error_on_hotpath_pre_init(); no_logging_pre_init(); no_op_pre_init(); payload_pre_init(); @@ -307,6 +310,7 @@ void grpc_end2end_tests(int argc, char **argv, max_message_length(config); negative_deadline(config); network_status_change(config); + no_error_on_hotpath(config); no_logging(config); no_op(config); payload(config); @@ -492,6 +496,10 @@ void grpc_end2end_tests(int argc, char **argv, network_status_change(config); continue; } + if (0 == strcmp("no_error_on_hotpath", argv[i])) { + no_error_on_hotpath(config); + continue; + } if (0 == strcmp("no_logging", argv[i])) { no_logging(config); continue; diff --git a/test/core/end2end/end2end_tests.cc b/test/core/end2end/end2end_tests.cc index 9f164b4ead..bf75dd4579 100644 --- a/test/core/end2end/end2end_tests.cc +++ b/test/core/end2end/end2end_tests.cc @@ -102,6 +102,8 @@ extern void negative_deadline(grpc_end2end_test_config config); extern void negative_deadline_pre_init(void); extern void network_status_change(grpc_end2end_test_config config); extern void network_status_change_pre_init(void); +extern void no_error_on_hotpath(grpc_end2end_test_config config); +extern void no_error_on_hotpath_pre_init(void); extern void no_logging(grpc_end2end_test_config config); extern void no_logging_pre_init(void); extern void no_op(grpc_end2end_test_config config); @@ -225,6 +227,7 @@ void grpc_end2end_tests_pre_init(void) { max_message_length_pre_init(); negative_deadline_pre_init(); network_status_change_pre_init(); + no_error_on_hotpath_pre_init(); no_logging_pre_init(); no_op_pre_init(); payload_pre_init(); @@ -311,6 +314,7 @@ void grpc_end2end_tests(int argc, char **argv, max_message_length(config); negative_deadline(config); network_status_change(config); + no_error_on_hotpath(config); no_logging(config); no_op(config); payload(config); @@ -500,6 +504,10 @@ void grpc_end2end_tests(int argc, char **argv, network_status_change(config); continue; } + if (0 == strcmp("no_error_on_hotpath", argv[i])) { + no_error_on_hotpath(config); + continue; + } if (0 == strcmp("no_logging", argv[i])) { no_logging(config); continue; diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index c355fc24b5..1851214191 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -138,6 +138,7 @@ END2END_TESTS = { 'max_message_length': default_test_options._replace(cpu_cost=LOWCPU), 'negative_deadline': default_test_options, 'network_status_change': default_test_options._replace(cpu_cost=LOWCPU), + 'no_error_on_hotpath': default_test_options._replace(proxyable=False), 'no_logging': default_test_options._replace(traceable=False), 'no_op': default_test_options, 'payload': default_test_options, diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl index 11fc576165..706f4fa86d 100755 --- a/test/core/end2end/generate_tests.bzl +++ b/test/core/end2end/generate_tests.bzl @@ -134,6 +134,7 @@ END2END_TESTS = { 'max_message_length': test_options(), 'negative_deadline': test_options(), 'network_status_change': test_options(), + 'no_error_on_hotpath': test_options(proxyable=False), 'no_logging': test_options(traceable=False), 'no_op': test_options(), 'payload': test_options(), diff --git a/test/core/end2end/tests/no_error_on_hotpath.cc b/test/core/end2end/tests/no_error_on_hotpath.cc new file mode 100644 index 0000000000..7afadf7d3a --- /dev/null +++ b/test/core/end2end/tests/no_error_on_hotpath.cc @@ -0,0 +1,246 @@ +/* + * + * Copyright 2016 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "test/core/end2end/end2end_tests.h" + +#include <stdio.h> +#include <string.h> + +#include <grpc/byte_buffer.h> +#include <grpc/grpc.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/string_util.h> +#include <grpc/support/time.h> +#include "src/core/lib/gpr/string.h" +#include "src/core/lib/iomgr/error.h" +#include "test/core/end2end/cq_verifier.h" + +static void* tag(intptr_t t) { return (void*)t; } + +static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, + const char* test_name, + grpc_channel_args* client_args, + grpc_channel_args* server_args) { + grpc_end2end_test_fixture f; + gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name); + f = config.create_fixture(client_args, server_args); + config.init_server(&f, server_args); + config.init_client(&f, client_args); + return f; +} + +static gpr_timespec n_seconds_from_now(int n) { + return grpc_timeout_seconds_to_deadline(n); +} + +static gpr_timespec five_seconds_from_now(void) { + return n_seconds_from_now(5); +} + +static void drain_cq(grpc_completion_queue* cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void shutdown_server(grpc_end2end_test_fixture* f) { + if (!f->server) return; + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + nullptr) + .type == GRPC_OP_COMPLETE); + grpc_server_destroy(f->server); + f->server = nullptr; +} + +static void shutdown_client(grpc_end2end_test_fixture* f) { + if (!f->client) return; + grpc_channel_destroy(f->client); + f->client = nullptr; +} + +static void end_test(grpc_end2end_test_fixture* f) { + shutdown_server(f); + shutdown_client(f); + + grpc_completion_queue_shutdown(f->cq); + drain_cq(f->cq); + grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); +} + +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture f) { + grpc_call* c; + grpc_call* s; + cq_verifier* cqv = cq_verifier_create(f.cq); + grpc_op ops[6]; + grpc_op* op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + grpc_slice details; + int was_cancelled = 2; + char* peer; + + gpr_timespec deadline = five_seconds_from_now(); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); + GPR_ASSERT(c); + + peer = grpc_call_get_peer(c); + GPR_ASSERT(peer != nullptr); + gpr_free(peer); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = nullptr; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = nullptr; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = nullptr; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->flags = 0; + op->reserved = nullptr; + op++; + error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), tag(1), + nullptr); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(101), 1); + cq_verify(cqv); + + peer = grpc_call_get_peer(s); + GPR_ASSERT(peer != nullptr); + gpr_free(peer); + peer = grpc_call_get_peer(c); + GPR_ASSERT(peer != nullptr); + gpr_free(peer); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = nullptr; + op++; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_OK; + op->data.send_status_from_server.status_details = nullptr; + op->flags = 0; + op->reserved = nullptr; + op++; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = nullptr; + op++; + error = grpc_call_start_batch(s, ops, static_cast<size_t>(op - ops), tag(102), + nullptr); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(102), 1); + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_OK); + GPR_ASSERT(GRPC_SLICE_LENGTH(details) == 0); + GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); + GPR_ASSERT(0 == call_details.flags); + GPR_ASSERT(was_cancelled == 0); + + grpc_slice_unref(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_unref(c); + grpc_call_unref(s); + + cq_verifier_destroy(cqv); +} + +static void test_no_error_on_hotpath_one_request( + grpc_end2end_test_config config) { + grpc_end2end_test_fixture f; + + f = begin_test(config, "test_invoke_simple_request_with_no_error_logging", + nullptr, nullptr); + // First RPC is not considered the hotpath, since there are lots of things to + // set up. + simple_request_body(config, f); + grpc_disable_error_creation(); + simple_request_body(config, f); + grpc_enable_error_creation(); + end_test(&f); + config.tear_down_data(&f); +} + +static void test_no_error_on_hotpath_10_requests( + grpc_end2end_test_config config) { + int i; + grpc_end2end_test_fixture f = begin_test( + config, "test_no_error_on_hotpath_in_one_request", nullptr, nullptr); + // First RPC is not considered the hotpath, since there are lots of things to + // set up. + simple_request_body(config, f); + grpc_disable_error_creation(); + for (i = 0; i < 10; i++) { + simple_request_body(config, f); + } + grpc_enable_error_creation(); + end_test(&f); + config.tear_down_data(&f); +} + +void no_error_on_hotpath(grpc_end2end_test_config config) { + test_no_error_on_hotpath_one_request(config); + test_no_error_on_hotpath_10_requests(config); +} + +void no_error_on_hotpath_pre_init(void) {} diff --git a/test/core/end2end/tests/retry_server_pushback_delay.cc b/test/core/end2end/tests/retry_server_pushback_delay.cc index f6a979613d..221b416828 100644 --- a/test/core/end2end/tests/retry_server_pushback_delay.cc +++ b/test/core/end2end/tests/retry_server_pushback_delay.cc @@ -249,7 +249,7 @@ static void test_retry_server_pushback_delay(grpc_end2end_test_config config) { retry_delay.tv_sec, retry_delay.tv_nsec); GPR_ASSERT(retry_delay.tv_sec >= 1); if (retry_delay.tv_sec == 1) { - GPR_ASSERT(retry_delay.tv_nsec >= 900000000); + GPR_ASSERT(retry_delay.tv_nsec >= 800000000); } peer = grpc_call_get_peer(s); diff --git a/test/core/gpr/arena_test.cc b/test/core/gpr/arena_test.cc index 111414ea3e..3e7c906591 100644 --- a/test/core/gpr/arena_test.cc +++ b/test/core/gpr/arena_test.cc @@ -71,7 +71,7 @@ static void test(const char* name, size_t init_size, const size_t* allocs, static const size_t allocs_##name[] = {__VA_ARGS__}; \ test(#name, init_size, allocs_##name, GPR_ARRAY_SIZE(allocs_##name)) -#define CONCURRENT_TEST_THREADS 100 +#define CONCURRENT_TEST_THREADS 10 size_t concurrent_test_iterations() { if (sizeof(void*) < 8) return 1000; diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm b/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm new file mode 100644 index 0000000000..414b6c78c0 --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm @@ -0,0 +1,201 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import <XCTest/XCTest.h> + +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_CFSTREAM + +#include <netinet/in.h> + +#include <grpc/impl/codegen/sync.h> +#include <grpc/support/sync.h> + +#include "src/core/lib/iomgr/endpoint.h" +#include "src/core/lib/iomgr/resolve_address.h" +#include "src/core/lib/iomgr/tcp_client.h" +#include "test/core/util/test_config.h" + +// static int g_connections_complete = 0; +static gpr_mu g_mu; +static int g_connections_complete = 0; +static grpc_endpoint* g_connecting = nullptr; + +static void finish_connection() { + gpr_mu_lock(&g_mu); + g_connections_complete++; + gpr_mu_unlock(&g_mu); +} + +static void must_succeed(void* arg, grpc_error* error) { + GPR_ASSERT(g_connecting != nullptr); + GPR_ASSERT(error == GRPC_ERROR_NONE); + grpc_endpoint_shutdown(g_connecting, GRPC_ERROR_CREATE_FROM_STATIC_STRING("must_succeed called")); + grpc_endpoint_destroy(g_connecting); + g_connecting = nullptr; + finish_connection(); +} + +static void must_fail(void* arg, grpc_error* error) { + GPR_ASSERT(g_connecting == nullptr); + GPR_ASSERT(error != GRPC_ERROR_NONE); + const char* error_str = grpc_error_string(error); + NSLog(@"%s", error_str); + finish_connection(); +} + +@interface CFStreamClientTests : XCTestCase + +@end + +@implementation CFStreamClientTests + ++ (void)setUp { + grpc_init(); + gpr_mu_init(&g_mu); +} + ++ (void)tearDown { + grpc_shutdown(); +} + +- (void)testSucceeds { + grpc_resolved_address resolved_addr; + struct sockaddr_in* addr = reinterpret_cast<struct sockaddr_in*>(resolved_addr.addr); + int svr_fd; + int r; + int connections_complete_before; + grpc_closure done; + grpc_core::ExecCtx exec_ctx; + + gpr_log(GPR_DEBUG, "test_succeeds"); + + memset(&resolved_addr, 0, sizeof(resolved_addr)); + resolved_addr.len = sizeof(struct sockaddr_in); + addr->sin_family = AF_INET; + + /* create a dummy server */ + svr_fd = socket(AF_INET, SOCK_STREAM, 0); + GPR_ASSERT(svr_fd >= 0); + GPR_ASSERT(0 == bind(svr_fd, (struct sockaddr*)addr, (socklen_t)resolved_addr.len)); + GPR_ASSERT(0 == listen(svr_fd, 1)); + + gpr_mu_lock(&g_mu); + connections_complete_before = g_connections_complete; + gpr_mu_unlock(&g_mu); + + /* connect to it */ + GPR_ASSERT(getsockname(svr_fd, (struct sockaddr*)addr, (socklen_t*)&resolved_addr.len) == 0); + GRPC_CLOSURE_INIT(&done, must_succeed, nullptr, grpc_schedule_on_exec_ctx); + grpc_tcp_client_connect(&done, &g_connecting, nullptr, nullptr, &resolved_addr, + GRPC_MILLIS_INF_FUTURE); + + /* await the connection */ + do { + resolved_addr.len = sizeof(addr); + r = accept(svr_fd, reinterpret_cast<struct sockaddr*>(addr), + reinterpret_cast<socklen_t*>(&resolved_addr.len)); + } while (r == -1 && errno == EINTR); + GPR_ASSERT(r >= 0); + close(r); + + grpc_core::ExecCtx::Get()->Flush(); + + /* wait for the connection callback to finish */ + gpr_mu_lock(&g_mu); + NSDate* deadline = [NSDate dateWithTimeIntervalSinceNow:5]; + while (connections_complete_before == g_connections_complete) { + gpr_mu_unlock(&g_mu); + [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:deadline]; + gpr_mu_lock(&g_mu); + } + XCTAssertGreaterThan(g_connections_complete, connections_complete_before); + + gpr_mu_unlock(&g_mu); +} + +- (void)testFails { + grpc_core::ExecCtx exec_ctx; + + grpc_resolved_address resolved_addr; + struct sockaddr_in* addr = reinterpret_cast<struct sockaddr_in*>(resolved_addr.addr); + int connections_complete_before; + grpc_closure done; + int svr_fd; + + gpr_log(GPR_DEBUG, "test_fails"); + + memset(&resolved_addr, 0, sizeof(resolved_addr)); + resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in)); + addr->sin_family = AF_INET; + + svr_fd = socket(AF_INET, SOCK_STREAM, 0); + GPR_ASSERT(svr_fd >= 0); + GPR_ASSERT(0 == bind(svr_fd, (struct sockaddr*)addr, (socklen_t)resolved_addr.len)); + GPR_ASSERT(0 == listen(svr_fd, 1)); + GPR_ASSERT(getsockname(svr_fd, (struct sockaddr*)addr, (socklen_t*)&resolved_addr.len) == 0); + close(svr_fd); + + gpr_mu_lock(&g_mu); + connections_complete_before = g_connections_complete; + gpr_mu_unlock(&g_mu); + + /* connect to a broken address */ + GRPC_CLOSURE_INIT(&done, must_fail, nullptr, grpc_schedule_on_exec_ctx); + grpc_tcp_client_connect(&done, &g_connecting, nullptr, nullptr, &resolved_addr, + GRPC_MILLIS_INF_FUTURE); + + grpc_core::ExecCtx::Get()->Flush(); + + /* wait for the connection callback to finish */ + gpr_mu_lock(&g_mu); + NSDate* deadline = [NSDate dateWithTimeIntervalSinceNow:5]; + while (g_connections_complete == connections_complete_before) { + gpr_mu_unlock(&g_mu); + [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:deadline]; + gpr_mu_lock(&g_mu); + } + + XCTAssertGreaterThan(g_connections_complete, connections_complete_before); + + gpr_mu_unlock(&g_mu); +} + +@end + +#else // GRPC_CFSTREAM + +// Dummy test suite +@interface CFStreamClientTests : XCTestCase + +@end + +@implementation CFStreamClientTests + +- (void)setUp { + [super setUp]; +} + +- (void)tearDown { + [super tearDown]; +} + +@end + +#endif // GRPC_CFSTREAM diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm b/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm new file mode 100644 index 0000000000..fbc34c74d6 --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm @@ -0,0 +1,344 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import <XCTest/XCTest.h> + +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_CFSTREAM + +#include <netinet/in.h> + +#include <grpc/impl/codegen/sync.h> +#include <grpc/support/sync.h> + +#include "src/core/lib/iomgr/endpoint.h" +#include "src/core/lib/iomgr/resolve_address.h" +#include "src/core/lib/iomgr/tcp_client.h" +#include "test/core/util/test_config.h" + +static const int kConnectTimeout = 5; +static const int kWriteTimeout = 5; +static const int kReadTimeout = 5; + +static const int kBufferSize = 10000; + +static const int kRunLoopTimeout = 1; + +static void set_atm(void *arg, grpc_error *error) { + gpr_atm *p = static_cast<gpr_atm *>(arg); + gpr_atm_full_cas(p, -1, reinterpret_cast<gpr_atm>(error)); +} + +static void init_event_closure(grpc_closure *closure, gpr_atm *atm) { + *atm = -1; + GRPC_CLOSURE_INIT(closure, set_atm, static_cast<void *>(atm), grpc_schedule_on_exec_ctx); +} + +static bool compare_slice_buffer_with_buffer(grpc_slice_buffer *slices, const char *buffer, + size_t buffer_len) { + if (slices->length != buffer_len) { + return false; + } + + for (int i = 0; i < slices->count; i++) { + grpc_slice slice = slices->slices[i]; + if (0 != memcmp(buffer, GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice))) { + return false; + } + buffer += GRPC_SLICE_LENGTH(slice); + } + + return true; +} + +@interface CFStreamEndpointTests : XCTestCase + +@end + +@implementation CFStreamEndpointTests { + grpc_endpoint *ep_; + int svr_fd_; +} + +- (BOOL)waitForEvent:(gpr_atm *)event timeout:(int)timeout { + grpc_core::ExecCtx::Get()->Flush(); + + NSDate *deadline = [NSDate dateWithTimeIntervalSinceNow:kConnectTimeout]; + while (gpr_atm_acq_load(event) == -1 && [deadline timeIntervalSinceNow] > 0) { + NSDate *deadline = [NSDate dateWithTimeIntervalSinceNow:kRunLoopTimeout]; + [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:deadline]; + } + + return (gpr_atm_acq_load(event) != -1); +} + ++ (void)setUp { + grpc_init(); +} + ++ (void)tearDown { + grpc_shutdown(); +} + +- (void)setUp { + self.continueAfterFailure = NO; + + // Set up CFStream connection before testing the endpoint + + grpc_core::ExecCtx exec_ctx; + + grpc_resolved_address resolved_addr; + struct sockaddr_in *addr = reinterpret_cast<struct sockaddr_in *>(resolved_addr.addr); + int svr_fd; + int r; + gpr_atm connected = -1; + grpc_closure done; + + gpr_log(GPR_DEBUG, "test_succeeds"); + + memset(&resolved_addr, 0, sizeof(resolved_addr)); + resolved_addr.len = sizeof(struct sockaddr_in); + addr->sin_family = AF_INET; + + /* create a dummy server */ + svr_fd = socket(AF_INET, SOCK_STREAM, 0); + XCTAssertGreaterThanOrEqual(svr_fd, 0); + XCTAssertEqual(bind(svr_fd, (struct sockaddr *)addr, (socklen_t)resolved_addr.len), 0); + XCTAssertEqual(listen(svr_fd, 1), 0); + + /* connect to it */ + XCTAssertEqual(getsockname(svr_fd, (struct sockaddr *)addr, (socklen_t *)&resolved_addr.len), 0); + init_event_closure(&done, &connected); + grpc_tcp_client_connect(&done, &ep_, nullptr, nullptr, &resolved_addr, GRPC_MILLIS_INF_FUTURE); + + /* await the connection */ + do { + resolved_addr.len = sizeof(addr); + r = accept(svr_fd, reinterpret_cast<struct sockaddr *>(addr), + reinterpret_cast<socklen_t *>(&resolved_addr.len)); + } while (r == -1 && errno == EINTR); + XCTAssertGreaterThanOrEqual(r, 0); + svr_fd_ = r; + + /* wait for the connection callback to finish */ + XCTAssertEqual([self waitForEvent:&connected timeout:kConnectTimeout], YES); + XCTAssertEqual(reinterpret_cast<grpc_error *>(connected), GRPC_ERROR_NONE); +} + +- (void)tearDown { + grpc_core::ExecCtx exec_ctx; + close(svr_fd_); + grpc_endpoint_destroy(ep_); +} + +- (void)testReadWrite { + grpc_core::ExecCtx exec_ctx; + + gpr_atm read; + grpc_closure read_done; + grpc_slice_buffer read_slices; + grpc_slice_buffer read_one_slice; + gpr_atm write; + grpc_closure write_done; + grpc_slice_buffer write_slices; + + grpc_slice slice; + char write_buffer[kBufferSize]; + char read_buffer[kBufferSize]; + size_t recv_size = 0; + + grpc_slice_buffer_init(&write_slices); + slice = grpc_slice_from_static_buffer(write_buffer, kBufferSize); + grpc_slice_buffer_add(&write_slices, slice); + init_event_closure(&write_done, &write); + grpc_endpoint_write(ep_, &write_slices, &write_done); + + XCTAssertEqual([self waitForEvent:&write timeout:kWriteTimeout], YES); + XCTAssertEqual(reinterpret_cast<grpc_error *>(write), GRPC_ERROR_NONE); + + while (recv_size < kBufferSize) { + ssize_t size = recv(svr_fd_, read_buffer, kBufferSize, 0); + XCTAssertGreaterThanOrEqual(size, 0); + recv_size += size; + } + + XCTAssertEqual(recv_size, kBufferSize); + XCTAssertEqual(memcmp(read_buffer, write_buffer, kBufferSize), 0); + ssize_t send_size = send(svr_fd_, read_buffer, kBufferSize, 0); + XCTAssertGreaterThanOrEqual(send_size, 0); + + grpc_slice_buffer_init(&read_slices); + grpc_slice_buffer_init(&read_one_slice); + while (read_slices.length < kBufferSize) { + init_event_closure(&read_done, &read); + grpc_endpoint_read(ep_, &read_one_slice, &read_done); + XCTAssertEqual([self waitForEvent:&read timeout:kReadTimeout], YES); + XCTAssertEqual(reinterpret_cast<grpc_error *>(read), GRPC_ERROR_NONE); + grpc_slice_buffer_move_into(&read_one_slice, &read_slices); + XCTAssertLessThanOrEqual(read_slices.length, kBufferSize); + } + XCTAssertTrue(compare_slice_buffer_with_buffer(&read_slices, read_buffer, kBufferSize)); + + grpc_endpoint_shutdown(ep_, GRPC_ERROR_NONE); + grpc_slice_buffer_reset_and_unref(&read_slices); + grpc_slice_buffer_reset_and_unref(&write_slices); + grpc_slice_buffer_reset_and_unref(&read_one_slice); +} + +- (void)testShutdownBeforeRead { + grpc_core::ExecCtx exec_ctx; + + gpr_atm read; + grpc_closure read_done; + grpc_slice_buffer read_slices; + gpr_atm write; + grpc_closure write_done; + grpc_slice_buffer write_slices; + + grpc_slice slice; + char write_buffer[kBufferSize]; + char read_buffer[kBufferSize]; + size_t recv_size = 0; + + grpc_slice_buffer_init(&read_slices); + init_event_closure(&read_done, &read); + grpc_endpoint_read(ep_, &read_slices, &read_done); + + grpc_slice_buffer_init(&write_slices); + slice = grpc_slice_from_static_buffer(write_buffer, kBufferSize); + grpc_slice_buffer_add(&write_slices, slice); + init_event_closure(&write_done, &write); + grpc_endpoint_write(ep_, &write_slices, &write_done); + + XCTAssertEqual([self waitForEvent:&write timeout:kWriteTimeout], YES); + XCTAssertEqual(reinterpret_cast<grpc_error *>(write), GRPC_ERROR_NONE); + + while (recv_size < kBufferSize) { + ssize_t size = recv(svr_fd_, read_buffer, kBufferSize, 0); + XCTAssertGreaterThanOrEqual(size, 0); + recv_size += size; + } + + XCTAssertEqual(recv_size, kBufferSize); + XCTAssertEqual(memcmp(read_buffer, write_buffer, kBufferSize), 0); + + XCTAssertEqual([self waitForEvent:&read timeout:kReadTimeout], NO); + + grpc_endpoint_shutdown(ep_, GRPC_ERROR_NONE); + + grpc_core::ExecCtx::Get()->Flush(); + XCTAssertEqual([self waitForEvent:&read timeout:kReadTimeout], YES); + XCTAssertNotEqual(reinterpret_cast<grpc_error *>(read), GRPC_ERROR_NONE); + + grpc_slice_buffer_reset_and_unref(&read_slices); + grpc_slice_buffer_reset_and_unref(&write_slices); +} + +- (void)testRemoteClosed { + grpc_core::ExecCtx exec_ctx; + + gpr_atm read; + grpc_closure read_done; + grpc_slice_buffer read_slices; + gpr_atm write; + grpc_closure write_done; + grpc_slice_buffer write_slices; + + grpc_slice slice; + char write_buffer[kBufferSize]; + char read_buffer[kBufferSize]; + size_t recv_size = 0; + + init_event_closure(&read_done, &read); + grpc_slice_buffer_init(&read_slices); + grpc_endpoint_read(ep_, &read_slices, &read_done); + + grpc_slice_buffer_init(&write_slices); + slice = grpc_slice_from_static_buffer(write_buffer, kBufferSize); + grpc_slice_buffer_add(&write_slices, slice); + init_event_closure(&write_done, &write); + grpc_endpoint_write(ep_, &write_slices, &write_done); + + XCTAssertEqual([self waitForEvent:&write timeout:kWriteTimeout], YES); + XCTAssertEqual(reinterpret_cast<grpc_error *>(write), GRPC_ERROR_NONE); + + while (recv_size < kBufferSize) { + ssize_t size = recv(svr_fd_, read_buffer, kBufferSize, 0); + XCTAssertGreaterThanOrEqual(size, 0); + recv_size += size; + } + + XCTAssertEqual(recv_size, kBufferSize); + XCTAssertEqual(memcmp(read_buffer, write_buffer, kBufferSize), 0); + + close(svr_fd_); + + XCTAssertEqual([self waitForEvent:&read timeout:kReadTimeout], YES); + XCTAssertNotEqual(reinterpret_cast<grpc_error *>(read), GRPC_ERROR_NONE); + + grpc_endpoint_shutdown(ep_, GRPC_ERROR_NONE); + grpc_slice_buffer_reset_and_unref(&read_slices); + grpc_slice_buffer_reset_and_unref(&write_slices); +} + +- (void)testRemoteReset { + grpc_core::ExecCtx exec_ctx; + + gpr_atm read; + grpc_closure read_done; + grpc_slice_buffer read_slices; + + init_event_closure(&read_done, &read); + grpc_slice_buffer_init(&read_slices); + grpc_endpoint_read(ep_, &read_slices, &read_done); + + struct linger so_linger; + so_linger.l_onoff = 1; + so_linger.l_linger = 0; + setsockopt(svr_fd_, SOL_SOCKET, SO_LINGER, &so_linger, sizeof(so_linger)); + + close(svr_fd_); + + XCTAssertEqual([self waitForEvent:&read timeout:kReadTimeout], YES); + XCTAssertNotEqual(reinterpret_cast<grpc_error *>(read), GRPC_ERROR_NONE); + + grpc_endpoint_shutdown(ep_, GRPC_ERROR_NONE); + grpc_slice_buffer_reset_and_unref(&read_slices); +} + +@end + +#else // GRPC_CFSTREAM + +// Dummy test suite +@interface CFStreamEndpointTests : XCTestCase +@end + +@implementation CFStreamEndpointTests +- (void)setUp { + [super setUp]; +} + +- (void)tearDown { + [super tearDown]; +} + +@end + +#endif // GRPC_CFSTREAM diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/project.pbxproj b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..2218f129ae --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/project.pbxproj @@ -0,0 +1,338 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 5E143B892069D72200715A6E /* CFStreamClientTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E143B882069D72200715A6E /* CFStreamClientTests.mm */; }; + 5E143B8C206B5F9F00715A6E /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5E143B8A2069D72700715A6E /* Info.plist */; }; + 5E143B8E206C5B9A00715A6E /* CFStreamEndpointTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E143B8D206C5B9A00715A6E /* CFStreamEndpointTests.mm */; }; + 604EA96D9CD477A8EA411BDF /* libPods-CFStreamTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AFFA154D492751CEAC05D591 /* libPods-CFStreamTests.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 5E143B792069D67300715A6E /* CFStreamTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CFStreamTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 5E143B882069D72200715A6E /* CFStreamClientTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CFStreamClientTests.mm; sourceTree = "<group>"; }; + 5E143B8A2069D72700715A6E /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + 5E143B8D206C5B9A00715A6E /* CFStreamEndpointTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CFStreamEndpointTests.mm; sourceTree = "<group>"; }; + 8CB4409E07E180CCA59987DF /* Pods-CFStreamTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CFStreamTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CFStreamTests/Pods-CFStreamTests.release.xcconfig"; sourceTree = "<group>"; }; + 9E3FAF9DA6B98ED4FE6D6848 /* Pods-CFStreamTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CFStreamTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CFStreamTests/Pods-CFStreamTests.debug.xcconfig"; sourceTree = "<group>"; }; + AFFA154D492751CEAC05D591 /* libPods-CFStreamTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-CFStreamTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 5E143B762069D67300715A6E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 604EA96D9CD477A8EA411BDF /* libPods-CFStreamTests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 5E143B582069D67300715A6E = { + isa = PBXGroup; + children = ( + 5E143B8D206C5B9A00715A6E /* CFStreamEndpointTests.mm */, + 5E143B8A2069D72700715A6E /* Info.plist */, + 5E143B882069D72200715A6E /* CFStreamClientTests.mm */, + 5E143B622069D67300715A6E /* Products */, + A331D95F7F230B507FBF6D22 /* Pods */, + 6AC36F6C5DB5CA8F717D1B67 /* Frameworks */, + ); + sourceTree = "<group>"; + }; + 5E143B622069D67300715A6E /* Products */ = { + isa = PBXGroup; + children = ( + 5E143B792069D67300715A6E /* CFStreamTests.xctest */, + ); + name = Products; + sourceTree = "<group>"; + }; + 6AC36F6C5DB5CA8F717D1B67 /* Frameworks */ = { + isa = PBXGroup; + children = ( + AFFA154D492751CEAC05D591 /* libPods-CFStreamTests.a */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; + A331D95F7F230B507FBF6D22 /* Pods */ = { + isa = PBXGroup; + children = ( + 9E3FAF9DA6B98ED4FE6D6848 /* Pods-CFStreamTests.debug.xcconfig */, + 8CB4409E07E180CCA59987DF /* Pods-CFStreamTests.release.xcconfig */, + ); + name = Pods; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 5E143B782069D67300715A6E /* CFStreamTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5E143B852069D67300715A6E /* Build configuration list for PBXNativeTarget "CFStreamTests" */; + buildPhases = ( + 4EBA55D3E23FC6C84596E3D5 /* [CP] Check Pods Manifest.lock */, + 5E143B752069D67300715A6E /* Sources */, + 5E143B762069D67300715A6E /* Frameworks */, + 5E143B772069D67300715A6E /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CFStreamTests; + productName = CFStreamTestsTests; + productReference = 5E143B792069D67300715A6E /* CFStreamTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 5E143B592069D67300715A6E /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0920; + ORGANIZATIONNAME = gRPC; + TargetAttributes = { + 5E143B782069D67300715A6E = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 5E143B5C2069D67300715A6E /* Build configuration list for PBXProject "CFStreamTests" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 5E143B582069D67300715A6E; + productRefGroup = 5E143B622069D67300715A6E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 5E143B782069D67300715A6E /* CFStreamTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 5E143B772069D67300715A6E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5E143B8C206B5F9F00715A6E /* Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 4EBA55D3E23FC6C84596E3D5 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-CFStreamTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 5E143B752069D67300715A6E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5E143B892069D72200715A6E /* CFStreamClientTests.mm in Sources */, + 5E143B8E206C5B9A00715A6E /* CFStreamEndpointTests.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 5E143B802069D67300715A6E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 5E143B812069D67300715A6E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 5E143B862069D67300715A6E /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9E3FAF9DA6B98ED4FE6D6848 /* Pods-CFStreamTests.debug.xcconfig */; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "COCOAPODS=1", + "$(inherited)", + "PB_FIELD_32BIT=1", + "PB_NO_PACKED_STRUCTS=1", + "GRPC_CFSTREAM=1", + ); + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.CFStreamTestsTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../../../..; + }; + name = Debug; + }; + 5E143B872069D67300715A6E /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 8CB4409E07E180CCA59987DF /* Pods-CFStreamTests.release.xcconfig */; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.CFStreamTestsTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../../../..; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 5E143B5C2069D67300715A6E /* Build configuration list for PBXProject "CFStreamTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5E143B802069D67300715A6E /* Debug */, + 5E143B812069D67300715A6E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5E143B852069D67300715A6E /* Build configuration list for PBXNativeTarget "CFStreamTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5E143B862069D67300715A6E /* Debug */, + 5E143B872069D67300715A6E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 5E143B592069D67300715A6E /* Project object */; +} diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests.xcscheme b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests.xcscheme new file mode 100644 index 0000000000..25d6f780a1 --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests.xcscheme @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0920" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "5E143B782069D67300715A6E" + BuildableName = "CFStreamTests.xctest" + BlueprintName = "CFStreamTests" + ReferencedContainer = "container:CFStreamTests.xcodeproj"> + </BuildableReference> + </TestableReference> + </Testables> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests_Asan.xcscheme b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests_Asan.xcscheme new file mode 100644 index 0000000000..6c5c43aa72 --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests_Asan.xcscheme @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0920" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + enableAddressSanitizer = "YES" + enableASanStackUseAfterReturn = "YES" + language = "" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "5E143B782069D67300715A6E" + BuildableName = "CFStreamTests.xctest" + BlueprintName = "CFStreamTests" + ReferencedContainer = "container:CFStreamTests.xcodeproj"> + </BuildableReference> + </TestableReference> + </Testables> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + enableASanStackUseAfterReturn = "YES" + language = "" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests_Msan.xcscheme b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests_Msan.xcscheme new file mode 100644 index 0000000000..3e39ff84d0 --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests_Msan.xcscheme @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0920" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "5E143B782069D67300715A6E" + BuildableName = "CFStreamTests.xctest" + BlueprintName = "CFStreamTests" + ReferencedContainer = "container:CFStreamTests.xcodeproj"> + </BuildableReference> + </TestableReference> + </Testables> + <AdditionalOptions> + <AdditionalOption + key = "DYLD_INSERT_LIBRARIES" + value = "/usr/lib/libgmalloc.dylib" + isEnabled = "YES"> + </AdditionalOption> + <AdditionalOption + key = "NSZombieEnabled" + value = "YES" + isEnabled = "YES"> + </AdditionalOption> + <AdditionalOption + key = "MallocGuardEdges" + value = "" + isEnabled = "YES"> + </AdditionalOption> + <AdditionalOption + key = "MallocScribble" + value = "" + isEnabled = "YES"> + </AdditionalOption> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests_Tsan.xcscheme b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests_Tsan.xcscheme new file mode 100644 index 0000000000..f0bde837c5 --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamTests.xcodeproj/xcshareddata/xcschemes/CFStreamTests_Tsan.xcscheme @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0920" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + enableThreadSanitizer = "YES" + language = "" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "5E143B782069D67300715A6E" + BuildableName = "CFStreamTests.xctest" + BlueprintName = "CFStreamTests" + ReferencedContainer = "container:CFStreamTests.xcodeproj"> + </BuildableReference> + </TestableReference> + </Testables> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + stopOnEveryThreadSanitizerIssue = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/test/core/iomgr/ios/CFStreamTests/Info.plist b/test/core/iomgr/ios/CFStreamTests/Info.plist new file mode 100644 index 0000000000..6c40a6cd0c --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/Info.plist @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>BNDL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> +</dict> +</plist> diff --git a/test/core/iomgr/ios/CFStreamTests/Podfile b/test/core/iomgr/ios/CFStreamTests/Podfile new file mode 100644 index 0000000000..630168a363 --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/Podfile @@ -0,0 +1,50 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '8.0' + +install! 'cocoapods', :deterministic_uuids => false + +# Location of gRPC's repo root relative to this file. +GRPC_LOCAL_SRC = '../../../../..' + +# Install the dependencies in the main target plus all test targets. +target 'CFStreamTests' do + pod 'gRPC-Core/CFStream-Implementation', :path => GRPC_LOCAL_SRC +end + +pre_install do |installer| + # This is the gRPC-Core podspec object, as initialized by its podspec file. + grpc_core_spec = installer.pod_targets.find{|t| t.name == 'gRPC-Core'}.root_spec + + # Copied from gRPC-Core.podspec, except for the adjusted src_root: + src_root = "$(PODS_ROOT)/../#{GRPC_LOCAL_SRC}" + grpc_core_spec.pod_target_xcconfig = { + 'GRPC_SRC_ROOT' => src_root, + 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', + 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', + # If we don't set these two settings, `include/grpc/support/time.h` and + # `src/core/lib/gpr/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the + # build. + 'USE_HEADERMAP' => 'NO', + 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + } +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES' + end + + # CocoaPods creates duplicated library targets of gRPC-Core when the test targets include + # non-default subspecs of gRPC-Core. All of these library targets start with prefix 'gRPC-Core' + # and require the same error suppresion. + if target.name.start_with?('gRPC-Core') + target.build_configurations.each do |config| + # TODO(zyc): Remove this setting after the issue is resolved + # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void + # function" warning + config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO' + end + end + end +end diff --git a/test/core/iomgr/ios/CFStreamTests/build_tests.sh b/test/core/iomgr/ios/CFStreamTests/build_tests.sh new file mode 100755 index 0000000000..d23f26f5db --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/build_tests.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l objc + +set -e + +# CocoaPods requires the terminal to be using UTF-8 encoding. +export LANG=en_US.UTF-8 + +cd "$(dirname "$0")" + +hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; } +hash xcodebuild 2>/dev/null || { + echo >&2 "XCode command-line tools need to be installed." + exit 1 +} + +# clean the directory +rm -rf Pods +rm -rf CFStreamTests.xcworkspace +rm -f Podfile.lock + +echo "TIME: $(date)" +pod install + diff --git a/test/core/iomgr/ios/CFStreamTests/run_tests.sh b/test/core/iomgr/ios/CFStreamTests/run_tests.sh new file mode 100755 index 0000000000..1045ec10a8 --- /dev/null +++ b/test/core/iomgr/ios/CFStreamTests/run_tests.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l objc + +set -ev + +cd "$(dirname "$0")" + +echo "TIME: $(date)" + +XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' + +xcodebuild \ + -workspace CFStreamTests.xcworkspace \ + -scheme CFStreamTests \ + -destination name="iPhone 8" \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' \ + | egrep -v "(GPBDictionary|GPBArray)" - + +echo "TIME: $(date)" + +xcodebuild \ + -workspace CFStreamTests.xcworkspace \ + -scheme CFStreamTests_Asan \ + -destination name="iPhone 8" \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' \ + | egrep -v "(GPBDictionary|GPBArray)" - + +echo "TIME: $(date)" + +xcodebuild \ + -workspace CFStreamTests.xcworkspace \ + -scheme CFStreamTests_Tsan \ + -destination name="iPhone 8" \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' \ + | egrep -v "(GPBDictionary|GPBArray)" - + +echo "TIME: $(date)" + +xcodebuild \ + -workspace CFStreamTests.xcworkspace \ + -scheme CFStreamTests_Msan \ + -destination name="iPhone 8" \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' \ + | egrep -v "(GPBDictionary|GPBArray)" - diff --git a/test/core/transport/chttp2/hpack_encoder_test.cc b/test/core/transport/chttp2/hpack_encoder_test.cc index d3ba50a91c..2a57198ab6 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.cc +++ b/test/core/transport/chttp2/hpack_encoder_test.cc @@ -160,6 +160,8 @@ static void encode_int_to_str(int i, char* p) { } static void test_decode_table_overflow() { + // Decrease the default table size to make decode table overflow easier. + grpc_chttp2_hpack_compressor_set_max_table_size(&g_compressor, 1024); int i; char key[3], value[3]; char* expect; @@ -170,27 +172,20 @@ static void test_decode_table_overflow() { false, }; - for (i = 0; i < 114; i++) { + for (i = 0; i < 29; i++) { encode_int_to_str(i, key); encode_int_to_str(i + 1, value); - - if (i + 61 >= 127) { + if (i == 0) { + // 3fe107 corresponds to the table size update. gpr_asprintf(&expect, - "000009 0104 deadbeef ff%02x 40 02%02x%02x 02%02x%02x", - i + 61 - 127, key[0], key[1], value[0], value[1]); - } else if (i > 0) { + "00000a 0104 deadbeef 3fe107 40 02%02x%02x 02%02x%02x", + key[0], key[1], value[0], value[1]); + verify(params, expect, 1, key, value); + } else { gpr_asprintf(&expect, "000008 0104 deadbeef %02x 40 02%02x%02x 02%02x%02x", 0x80 + 61 + i, key[0], key[1], value[0], value[1]); - } else { - gpr_asprintf(&expect, "000007 0104 deadbeef 40 02%02x%02x 02%02x%02x", - key[0], key[1], value[0], value[1]); - } - - if (i > 0) { verify(params, expect, 2, "aa", "ba", key, value); - } else { - verify(params, expect, 1, key, value); } gpr_free(expect); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 60238e930d..3c1d48cc1e 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -1209,8 +1209,13 @@ TEST_P(End2endTest, ExpectErrorTest) { std::vector<ErrorStatus> expected_status; expected_status.emplace_back(); expected_status.back().set_code(13); // INTERNAL + // No Error message or details + + expected_status.emplace_back(); + expected_status.back().set_code(13); // INTERNAL expected_status.back().set_error_message("text error message"); expected_status.back().set_binary_error_details("text error details"); + expected_status.emplace_back(); expected_status.back().set_code(13); // INTERNAL expected_status.back().set_error_message("text error message"); diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index 7aab035e76..28f9ae6f40 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -1380,7 +1380,7 @@ TEST_F(SingleBalancerTest, DropAll) { class SingleBalancerWithClientLoadReportingTest : public GrpclbEnd2endTest { public: - SingleBalancerWithClientLoadReportingTest() : GrpclbEnd2endTest(4, 1, 2) {} + SingleBalancerWithClientLoadReportingTest() : GrpclbEnd2endTest(4, 1, 3) {} }; TEST_F(SingleBalancerWithClientLoadReportingTest, Vanilla) { diff --git a/test/cpp/end2end/round_robin_end2end_test.cc b/test/cpp/end2end/round_robin_end2end_test.cc deleted file mode 100644 index 846347e110..0000000000 --- a/test/cpp/end2end/round_robin_end2end_test.cc +++ /dev/null @@ -1,226 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include <memory> -#include <mutex> -#include <thread> - -#include <grpc/grpc.h> -#include <grpc/support/log.h> -#include <grpc/support/time.h> -#include <grpcpp/channel.h> -#include <grpcpp/client_context.h> -#include <grpcpp/create_channel.h> -#include <grpcpp/server.h> -#include <grpcpp/server_builder.h> - -#include "src/proto/grpc/testing/echo.grpc.pb.h" -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" -#include "test/cpp/end2end/test_service_impl.h" - -#include <gtest/gtest.h> - -using grpc::testing::EchoRequest; -using grpc::testing::EchoResponse; -using std::chrono::system_clock; - -namespace grpc { -namespace testing { -namespace { - -// Subclass of TestServiceImpl that increments a request counter for -// every call to the Echo RPC. -class MyTestServiceImpl : public TestServiceImpl { - public: - MyTestServiceImpl() : request_count_(0) {} - - Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) override { - { - std::unique_lock<std::mutex> lock(mu_); - ++request_count_; - } - return TestServiceImpl::Echo(context, request, response); - } - - int request_count() { - std::unique_lock<std::mutex> lock(mu_); - return request_count_; - } - - private: - std::mutex mu_; - int request_count_; -}; - -class RoundRobinEnd2endTest : public ::testing::Test { - protected: - RoundRobinEnd2endTest() : server_host_("localhost") {} - - void StartServers(size_t num_servers, - std::vector<int> ports = std::vector<int>()) { - for (size_t i = 0; i < num_servers; ++i) { - int port = 0; - if (ports.size() == num_servers) port = ports[i]; - servers_.emplace_back(new ServerData(server_host_, port)); - } - } - - void TearDown() override { - for (size_t i = 0; i < servers_.size(); ++i) { - servers_[i]->Shutdown(); - } - } - - void ResetStub(bool round_robin) { - ChannelArguments args; - if (round_robin) args.SetLoadBalancingPolicyName("round_robin"); - std::ostringstream uri; - uri << "ipv4:///"; - for (size_t i = 0; i < servers_.size() - 1; ++i) { - uri << "127.0.0.1:" << servers_[i]->port_ << ","; - } - uri << "127.0.0.1:" << servers_[servers_.size() - 1]->port_; - channel_ = - CreateCustomChannel(uri.str(), InsecureChannelCredentials(), args); - stub_ = grpc::testing::EchoTestService::NewStub(channel_); - } - - void SendRpc(int num_rpcs, bool expect_ok = true) { - EchoRequest request; - EchoResponse response; - request.set_message("Live long and prosper."); - for (int i = 0; i < num_rpcs; i++) { - ClientContext context; - Status status = stub_->Echo(&context, request, &response); - if (expect_ok) { - EXPECT_TRUE(status.ok()); - EXPECT_EQ(response.message(), request.message()); - } else { - EXPECT_FALSE(status.ok()); - } - } - } - - struct ServerData { - int port_; - std::unique_ptr<Server> server_; - MyTestServiceImpl service_; - - explicit ServerData(const grpc::string& server_host, int port = 0) { - port_ = port > 0 ? port : grpc_pick_unused_port_or_die(); - gpr_log(GPR_INFO, "starting server on port %d", port_); - std::ostringstream server_address; - server_address << server_host << ":" << port_; - ServerBuilder builder; - builder.AddListeningPort(server_address.str(), - InsecureServerCredentials()); - builder.RegisterService(&service_); - server_ = builder.BuildAndStart(); - gpr_log(GPR_INFO, "server startup complete"); - } - - void Shutdown() { server_->Shutdown(); } - }; - - const grpc::string server_host_; - std::shared_ptr<Channel> channel_; - std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_; - std::vector<std::unique_ptr<ServerData>> servers_; -}; - -TEST_F(RoundRobinEnd2endTest, PickFirst) { - // Start servers and send one RPC per server. - const int kNumServers = 3; - StartServers(kNumServers); - ResetStub(false /* round_robin */); - SendRpc(kNumServers); - // All requests should have gone to a single server. - bool found = false; - for (size_t i = 0; i < servers_.size(); ++i) { - const int request_count = servers_[i]->service_.request_count(); - if (request_count == kNumServers) { - found = true; - } else { - EXPECT_EQ(0, request_count); - } - } - EXPECT_TRUE(found); - // Check LB policy name for the channel. - EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName()); -} - -TEST_F(RoundRobinEnd2endTest, RoundRobin) { - // Start servers and send one RPC per server. - const int kNumServers = 3; - StartServers(kNumServers); - ResetStub(true /* round_robin */); - // Send one RPC per backend and make sure they are used in order. - // Note: This relies on the fact that the subchannels are reported in - // state READY in the order in which the addresses are specified, - // which is only true because the backends are all local. - for (size_t i = 0; i < servers_.size(); ++i) { - SendRpc(1); - EXPECT_EQ(1, servers_[i]->service_.request_count()) << "for backend #" << i; - } - // Check LB policy name for the channel. - EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName()); -} - -TEST_F(RoundRobinEnd2endTest, RoundRobinReconnect) { - // Start servers and send one RPC per server. - const int kNumServers = 1; - std::vector<int> ports; - ports.push_back(grpc_pick_unused_port_or_die()); - StartServers(kNumServers, ports); - ResetStub(true /* round_robin */); - // Send one RPC per backend and make sure they are used in order. - // Note: This relies on the fact that the subchannels are reported in - // state READY in the order in which the addresses are specified, - // which is only true because the backends are all local. - for (size_t i = 0; i < servers_.size(); ++i) { - SendRpc(1); - EXPECT_EQ(1, servers_[i]->service_.request_count()) << "for backend #" << i; - } - // Check LB policy name for the channel. - EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName()); - - // Kill all servers - for (size_t i = 0; i < servers_.size(); ++i) { - servers_[i]->Shutdown(); - } - // Client request should fail. - SendRpc(1, false); - - // Bring servers back up on the same port (we aren't recreating the channel). - StartServers(kNumServers, ports); - - // Client request should succeed. - SendRpc(1); -} - -} // namespace -} // namespace testing -} // namespace grpc - -int main(int argc, char** argv) { - grpc_test_init(argc, argv); - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc index 195b6bd304..840ca07d2b 100644 --- a/test/cpp/util/grpc_tool.cc +++ b/test/cpp/util/grpc_tool.cc @@ -471,17 +471,26 @@ bool GrpcTool::CallMethod(int argc, const char** argv, std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(server_address, cred.GetCredentials()); - parser.reset(new grpc::testing::ProtoFileParser( - FLAGS_remotedb ? channel : nullptr, FLAGS_proto_path, FLAGS_protofiles)); + if (!FLAGS_binary_input || !FLAGS_binary_output) { + parser.reset( + new grpc::testing::ProtoFileParser(FLAGS_remotedb ? channel : nullptr, + FLAGS_proto_path, FLAGS_protofiles)); + if (parser->HasError()) { + fprintf( + stderr, + "Failed to find remote reflection service and local proto files.\n"); + return false; + } + } if (FLAGS_binary_input) { formatted_method_name = method_name; } else { formatted_method_name = parser->GetFormattedMethodName(method_name); - } - - if (parser->HasError()) { - return false; + if (parser->HasError()) { + fprintf(stderr, "Failed to find method %s in proto files.\n", + method_name.c_str()); + } } if (argc == 3) { @@ -711,6 +720,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv, serialized_request_proto = parser->GetSerializedProtoFromMethod( method_name, request_text, true /* is_request */); if (parser->HasError()) { + fprintf(stderr, "Failed to parse request.\n"); return false; } } @@ -735,6 +745,7 @@ bool GrpcTool::CallMethod(int argc, const char** argv, serialized_response_proto = parser->GetTextFormatFromMethod( method_name, serialized_response_proto, false /* is_request */); if (parser->HasError()) { + fprintf(stderr, "Failed to parse response.\n"); return false; } } @@ -814,6 +825,9 @@ bool GrpcTool::ParseMessage(int argc, const char** argv, new grpc::testing::ProtoFileParser(FLAGS_remotedb ? channel : nullptr, FLAGS_proto_path, FLAGS_protofiles)); if (parser->HasError()) { + fprintf( + stderr, + "Failed to find remote reflection service and local proto files.\n"); return false; } } @@ -824,6 +838,7 @@ bool GrpcTool::ParseMessage(int argc, const char** argv, serialized_request_proto = parser->GetSerializedProtoFromMessageType(type_name, message_text); if (parser->HasError()) { + fprintf(stderr, "Failed to serialize the message.\n"); return false; } } @@ -834,6 +849,7 @@ bool GrpcTool::ParseMessage(int argc, const char** argv, grpc::string output_text = parser->GetTextFormatFromMessageType( type_name, serialized_request_proto); if (parser->HasError()) { + fprintf(stderr, "Failed to deserialize the message.\n"); return false; } output_ss << output_text << std::endl; diff --git a/test/distrib/csharp/DistribTest/packages.config b/test/distrib/csharp/DistribTest/packages.config index 84be8f76b5..3cb2c46bcf 100644 --- a/test/distrib/csharp/DistribTest/packages.config +++ b/test/distrib/csharp/DistribTest/packages.config @@ -6,6 +6,7 @@ <package id="Grpc" version="__GRPC_NUGET_VERSION__" targetFramework="net45" /> <package id="Grpc.Auth" version="__GRPC_NUGET_VERSION__" targetFramework="net45" /> <package id="Grpc.Core" version="__GRPC_NUGET_VERSION__" targetFramework="net45" /> + <package id="Grpc.Tools" version="__GRPC_NUGET_VERSION__" targetFramework="net45" /> <package id="System.Interactive.Async" version="3.0.0" targetFramework="net45" /> <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/test/distrib/csharp/run_distrib_test.sh b/test/distrib/csharp/run_distrib_test.sh index eee24d0e57..f9371410e7 100755 --- a/test/distrib/csharp/run_distrib_test.sh +++ b/test/distrib/csharp/run_distrib_test.sh @@ -26,3 +26,6 @@ nuget restore xbuild DistribTest.sln mono DistribTest/bin/Debug/DistribTest.exe + +# test that codegen work +test_codegen/test_codegen.sh diff --git a/test/distrib/csharp/test_codegen/test_codegen.sh b/test/distrib/csharp/test_codegen/test_codegen.sh new file mode 100755 index 0000000000..fa101889f6 --- /dev/null +++ b/test/distrib/csharp/test_codegen/test_codegen.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Copyright 2018 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ex + +cd "$(dirname "$0")" + +ls -lR "../packages/Grpc.Tools.__GRPC_NUGET_VERSION__/tools" + +PLATFORM_ARCH=linux_x64 +if [ "$(uname)" == "Darwin" ] +then + PLATFORM_ARCH=macosx_x64 +elif [ "$(getconf LONG_BIT)" == "32" ] +then + PLATFORM_ARCH=linux_x86 +fi + +PROTOC=../packages/Grpc.Tools.__GRPC_NUGET_VERSION__/tools/${PLATFORM_ARCH}/protoc +PLUGIN=../packages/Grpc.Tools.__GRPC_NUGET_VERSION__/tools/${PLATFORM_ARCH}/grpc_csharp_plugin + +"${PROTOC}" --plugin="protoc-gen-grpc=${PLUGIN}" --csharp_out=. --grpc_out=. -I . testcodegen.proto + +ls ./*.cs + +echo 'Code generation works.' diff --git a/test/distrib/csharp/test_codegen/testcodegen.proto b/test/distrib/csharp/test_codegen/testcodegen.proto new file mode 100644 index 0000000000..5c228b81db --- /dev/null +++ b/test/distrib/csharp/test_codegen/testcodegen.proto @@ -0,0 +1,29 @@ +// Copyright 2018 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package testcodegen; + +service Greeter { + rpc SayHello (HelloRequest) returns (HelloReply) {} +} + +message HelloRequest { + string name = 1; +} + +message HelloReply { + string message = 1; +} diff --git a/test/distrib/csharp/update_version.sh b/test/distrib/csharp/update_version.sh index 9759cc5648..0e47ed3abd 100755 --- a/test/distrib/csharp/update_version.sh +++ b/test/distrib/csharp/update_version.sh @@ -28,4 +28,4 @@ then fi # Replaces version placeholder with value provided as first argument. -sed -ibak "s/__GRPC_NUGET_VERSION__/${CSHARP_VERSION}/g" DistribTest/packages.config DistribTest/DistribTest.csproj DistribTest/DistribTestDotNet.csproj +sed -ibak "s/__GRPC_NUGET_VERSION__/${CSHARP_VERSION}/g" DistribTest/packages.config DistribTest/DistribTest.csproj DistribTest/DistribTestDotNet.csproj test_codegen/test_codegen.sh diff --git a/tools/distrib/pylint_code.sh b/tools/distrib/pylint_code.sh index 013b6660eb..82a818cce5 100755 --- a/tools/distrib/pylint_code.sh +++ b/tools/distrib/pylint_code.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2017 gRPC authors. +# Copyright 2017 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,14 +35,15 @@ python -m virtualenv $VIRTUALENV PYTHON=$VIRTUALENV/bin/python $PYTHON -m pip install --upgrade pip==10.0.1 -$PYTHON -m pip install pylint==1.6.5 +$PYTHON -m pip install pylint==1.9.2 +EXIT=0 for dir in "${DIRS[@]}"; do - $PYTHON -m pylint --rcfile=.pylintrc -rn "$dir" || exit $? + $PYTHON -m pylint --rcfile=.pylintrc -rn "$dir" || EXIT=1 done for dir in "${TEST_DIRS[@]}"; do - $PYTHON -m pylint --rcfile=.pylintrc-tests -rn "$dir" || exit $? + $PYTHON -m pylint --rcfile=.pylintrc-tests -rn "$dir" || EXIT=1 done -exit 0 +exit $EXIT diff --git a/tools/dockerfile/distribtest/csharp_centos7_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_centos7_x64/Dockerfile index 088635b0ea..3e1faafdc0 100644 --- a/tools/dockerfile/distribtest/csharp_centos7_x64/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_centos7_x64/Dockerfile @@ -14,21 +14,11 @@ FROM centos:7 -RUN rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -RUN yum-config-manager --add-repo http://download.mono-project.com/repo/centos/ +RUN rpm --import "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" +RUN curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo -RUN yum install -y mono +RUN yum install -y mono-devel -RUN yum install -y unzip - -# --nogpgcheck because nuget-2.12 package is not signed. -RUN yum install -y nuget --nogpgcheck +RUN yum install -y nuget -# Help mono correctly locate libMonoPosixHelper.so -# as a workaround for issue https://bugzilla.xamarin.com/show_bug.cgi?id=42820 -# The error message you'll get without this workaround: -# ``` -# WARNING: /usr/lib/libMonoPosixHelper.so -# WARNING: Unable to read package from path 'Grpc.1.1.0-dev.nupkg'. -# ``` -RUN cp /usr/lib64/libMonoPosixHelper.so /usr/lib/ +RUN yum install -y unzip diff --git a/tools/dockerfile/distribtest/csharp_jessie_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_jessie_x64/Dockerfile index 02ec4c278a..03fb7a5343 100644 --- a/tools/dockerfile/distribtest/csharp_jessie_x64/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_jessie_x64/Dockerfile @@ -14,14 +14,13 @@ FROM debian:jessie +RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean + RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian jessie main" | tee /etc/apt/sources.list.d/mono-official.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list +RUN echo "deb https://download.mono-project.com/repo/debian stable-jessie main" | tee /etc/apt/sources.list.d/mono-official-stable.list RUN apt-get update && apt-get install -y \ mono-devel \ - ca-certificates-mono \ nuget \ && apt-get clean diff --git a/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile b/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile index 758f314572..f2fa61a691 100644 --- a/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile @@ -14,14 +14,13 @@ FROM 32bit/debian:jessie +RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean + RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian jessie main" | tee /etc/apt/sources.list.d/mono-official.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list +RUN echo "deb https://download.mono-project.com/repo/debian stable-jessie main" | tee /etc/apt/sources.list.d/mono-official-stable.list RUN apt-get update && apt-get install -y \ mono-devel \ - ca-certificates-mono \ nuget \ && apt-get clean diff --git a/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile index 10279c5925..3edc31e170 100644 --- a/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile @@ -14,15 +14,17 @@ FROM ubuntu:14.04 -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list +RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean + +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-trusty main" | tee /etc/apt/sources.list.d/mono-official-stable.list RUN apt-get update && apt-get install -y \ mono-devel \ - ca-certificates-mono \ - nuget + nuget \ + && apt-get clean -RUN apt-get update && apt-get install -y unzip +RUN apt-get update && apt-get install -y unzip && apt-get clean # Install dotnet CLI RUN apt-get install -y apt-transport-https diff --git a/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile index 0f40f18e38..1a58f9784b 100644 --- a/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile @@ -14,19 +14,14 @@ FROM ubuntu:16.04 +RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean + +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | tee /etc/apt/sources.list.d/mono-official-stable.list + RUN apt-get update && apt-get install -y \ mono-devel \ - ca-certificates-mono \ nuget \ && apt-get clean -# make sure we have nuget 2.12+ (in case there's an older cached docker image) -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list -RUN apt-get update && apt-get install -y nuget && apt-get clean - -# Prevent "Error: SendFailure (Error writing headers)" when fetching nuget packages -# See https://github.com/tianon/docker-brew-ubuntu-core/issues/86 -RUN apt-get update && apt-get install -y tzdata && apt-get clean - RUN apt-get update && apt-get install -y unzip && apt-get clean diff --git a/tools/dockerfile/distribtest/csharp_wheezy_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_wheezy_x64/Dockerfile deleted file mode 100644 index fb9c82c92b..0000000000 --- a/tools/dockerfile/distribtest/csharp_wheezy_x64/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM mono:4.4.2.11 - -# make sure we have nuget 2.12+ (in case there's an older cached docker image) -RUN apt-get update && apt-get install -y nuget - -RUN apt-get update && apt-get install -y unzip diff --git a/tools/dockerfile/interoptest/grpc_interop_python/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_python/build_interop.sh index a8898f85fa..7917e1cd60 100755 --- a/tools/dockerfile/interoptest/grpc_interop_python/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_python/build_interop.sh @@ -28,4 +28,5 @@ cp -r /var/local/jenkins/service_account $HOME || true cd /var/local/git/grpc -tools/run_tests/run_tests.py -l python -c opt --build_only +# interop tests only run using python2.7 currently (and python build is slow) +tools/run_tests/run_tests.py -l python --compiler python2.7 -c opt --build_only diff --git a/tools/dockerfile/test/python_pyenv_x64/Dockerfile b/tools/dockerfile/test/python_pyenv_x64/Dockerfile index 43854aa689..c23e67c904 100644 --- a/tools/dockerfile/test/python_pyenv_x64/Dockerfile +++ b/tools/dockerfile/test/python_pyenv_x64/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM debian:jessie +FROM debian:stretch # Install Git and basic packages. RUN apt-get update && apt-get install -y \ @@ -80,7 +80,7 @@ RUN apt-get update && apt-get install -y \ mercurial \ zlib1g-dev && apt-get clean -# Install Pyenv and dev Python versions 3.5 and 3.6 +# Install Pyenv and dev Python versions 3.{5,6,7} RUN curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash ENV PATH /root/.pyenv/bin:$PATH RUN eval "$(pyenv init -)" @@ -88,12 +88,13 @@ RUN eval "$(pyenv virtualenv-init -)" RUN pyenv update RUN pyenv install 3.5-dev RUN pyenv install 3.6-dev +RUN pyenv install 3.7-dev RUN pyenv install pypy-5.3.1 -RUN pyenv local 3.5-dev 3.6-dev pypy-5.3.1 +RUN pyenv local 3.5-dev 3.6-dev 3.7-dev pypy-5.3.1 -# Install pip and virtualenv for Python 3.4 -RUN curl https://bootstrap.pypa.io/get-pip.py | python3.4 -RUN python3.4 -m pip install virtualenv +# Install pip and virtualenv for Python 3.5 +RUN curl https://bootstrap.pypa.io/get-pip.py | python3.5 +RUN python3.5 -m pip install virtualenv RUN mkdir /var/local/jenkins diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index d2b77691d4..2f12471a85 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -34,7 +34,8 @@ sudo systemsetup -setusingnetworktime on date # Add GCP credentials for BQ access -pip install google-api-python-client --user python +# pin google-api-python-client to avoid https://github.com/grpc/grpc/issues/15600 +pip install google-api-python-client==1.6.7 --user python export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json # If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests diff --git a/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh b/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh index 7881e3a7fb..d2dded051d 100755 --- a/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh +++ b/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh @@ -22,8 +22,8 @@ mkdir -p ${KOKORO_KEYSTORE_DIR} cp ${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json ${KOKORO_KEYSTORE_DIR}/4321_grpc-testing-service temp_dir=$(mktemp -d) -ln -f "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" ${temp_dir}/bazel -chmod 755 "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" +ln -f "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" ${temp_dir}/bazel +chmod 755 "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" export PATH="${temp_dir}:${PATH}" # This should show ${temp_dir}/bazel which bazel @@ -49,9 +49,12 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --strategy=Closure=remote \ --genrule_strategy=remote \ --experimental_strict_action_env=true \ - --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-debian8@sha256:1ede2a929b44d629ec5abe86eee6d7ffea1d5a4d247489a8867d46cfde3e38bd" }' \ - --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/debian8_clang/0.3.0/bazel_0.10.0:toolchain \ + --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-ubuntu16-04@sha256:59bf0e191a6b5cc1ab62c2224c810681d1326bad5a27b1d36c9f40113e79da7f" }' \ + --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/default:toolchain \ --define GRPC_PORT_ISOLATED_RUNTIME=1 \ + --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 \ + --extra_toolchains=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/cpp:cc-toolchain-clang-x86_64-default \ + --extra_execution_platforms=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604 \ $1 \ -- //test/... || FAILED="true" diff --git a/tools/internal_ci/linux/grpc_msan_on_foundry.sh b/tools/internal_ci/linux/grpc_msan_on_foundry.sh index 5e644793ad..e8ef249aa5 100644 --- a/tools/internal_ci/linux/grpc_msan_on_foundry.sh +++ b/tools/internal_ci/linux/grpc_msan_on_foundry.sh @@ -23,8 +23,8 @@ mkdir -p ${KOKORO_KEYSTORE_DIR} cp ${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json ${KOKORO_KEYSTORE_DIR}/4321_grpc-testing-service temp_dir=$(mktemp -d) -ln -f "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" ${temp_dir}/bazel -chmod 755 "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" +ln -f "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" ${temp_dir}/bazel +chmod 755 "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" export PATH="${temp_dir}:${PATH}" # This should show ${temp_dir}/bazel which bazel @@ -50,7 +50,7 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --strategy=Closure=remote \ --genrule_strategy=remote \ --experimental_strict_action_env=true \ - --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/asci-toolchain/nosla-debian8-clang-msan@sha256:8f381d55c0456fb65821c90ada902c2584977e03a1eaca8fba8ce77e644c775b" }' \ + --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-ubuntu16-04@sha256:59bf0e191a6b5cc1ab62c2224c810681d1326bad5a27b1d36c9f40113e79da7f" }' \ --define GRPC_PORT_ISOLATED_RUNTIME=1 \ --copt=-gmlt \ --strip=never \ @@ -59,8 +59,11 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --linkopt=-fsanitize=memory \ --copt=-fsanitize-memory-track-origins \ --action_env=LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \ - --host_crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/debian8_clang/0.3.0/bazel_0.10.0:toolchain \ - --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/experimental/debian8_clang/0.3.0/bazel_0.10.0/msan:msan_experimental_toolchain \ + --host_crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/default:toolchain \ + --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/msan:toolchain \ + --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 \ + --extra_toolchains=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/cpp:cc-toolchain-clang-x86_64-default \ + --extra_execution_platforms=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604 \ -- //test/... || FAILED="true" # Sleep to let ResultStore finish writing results before querying diff --git a/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh b/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh index 5c0e2df09d..f5c12c27a3 100644 --- a/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh +++ b/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh @@ -23,8 +23,8 @@ mkdir -p ${KOKORO_KEYSTORE_DIR} cp ${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json ${KOKORO_KEYSTORE_DIR}/4321_grpc-testing-service temp_dir=$(mktemp -d) -ln -f "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" ${temp_dir}/bazel -chmod 755 "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" +ln -f "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" ${temp_dir}/bazel +chmod 755 "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" export PATH="${temp_dir}:${PATH}" # This should show ${temp_dir}/bazel which bazel @@ -50,13 +50,16 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --strategy=Closure=remote \ --genrule_strategy=remote \ --experimental_strict_action_env=true \ - --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-debian8@sha256:1ede2a929b44d629ec5abe86eee6d7ffea1d5a4d247489a8867d46cfde3e38bd" }' \ + --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-ubuntu16-04@sha256:59bf0e191a6b5cc1ab62c2224c810681d1326bad5a27b1d36c9f40113e79da7f" }' \ --define GRPC_PORT_ISOLATED_RUNTIME=1 \ --copt=-gmlt \ --strip=never \ --copt=-fsanitize=undefined \ --linkopt=-fsanitize=undefined \ - --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/experimental/debian8_clang/0.3.0/bazel_0.12.0/ubsan:toolchain \ + --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/experimental/ubuntu16_04_clang/1.0/bazel_0.13.0/ubsan:toolchain \ + --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 \ + --extra_toolchains=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/cpp:cc-toolchain-clang-x86_64-default \ + --extra_execution_platforms=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604 \ -- //test/... || FAILED="true" # Sleep to let ResultStore finish writing results before querying diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index 2d43e3ea12..d6a704681a 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -326,7 +326,14 @@ LANG_RELEASE_MATRIX = { }, ], 'csharp': [ - #{'v1.0.1': None}, + { + 'v1.0.1': { + 'patch': [ + 'tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile', + 'tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile', + ] + } + }, { 'v1.1.4': None }, @@ -377,6 +384,7 @@ TESTCASES_VERSION_MATRIX = { 'node_v1.4.2': 'node__v1.1.4', 'node_v1.6.6': 'node__v1.1.4', 'ruby_v1.0.1': 'ruby__v1.0.1', + 'csharp_v1.0.1': 'csharp__v1.1.4', 'csharp_v1.1.4': 'csharp__v1.1.4', 'csharp_v1.2.5': 'csharp__v1.1.4', 'python_v1.0.x': 'python__v1.0.x', diff --git a/tools/interop_matrix/create_matrix_images.py b/tools/interop_matrix/create_matrix_images.py index ef9f6a5990..c2568efba0 100755 --- a/tools/interop_matrix/create_matrix_images.py +++ b/tools/interop_matrix/create_matrix_images.py @@ -97,6 +97,12 @@ argp.add_argument( 'reusing the repo can cause git checkout error if you switch ' 'between releases.') +argp.add_argument( + '--upload_images', + action='store_true', + help='If set, images will be uploaded to container registry after building.' +) + args = argp.parse_args() @@ -166,8 +172,10 @@ def build_all_images_for_lang(lang): """Build all docker images for a language across releases and runtimes.""" if not args.git_checkout: if args.release != 'master': - print('WARNING: --release is set but will be ignored\n') - releases = ['master'] + print( + 'Cannot use --release without also enabling --git_checkout.\n') + sys.exit(1) + releases = [args.release] else: if args.release == 'all': releases = client_matrix.get_release_tags(lang) @@ -268,6 +276,13 @@ def maybe_apply_patches_on_git_tag(stack_base, lang, release): sys.exit(1) subprocess.check_output( ['git', 'apply', patch_file], cwd=stack_base, stderr=subprocess.STDOUT) + + # TODO(jtattermusch): this really would need simplification and refactoring + # - "git add" and "git commit" can easily be done in a single command + # - it looks like the only reason for the existence of the "files_to_patch" + # entry is to perform "git add" - which is clumsy and fragile. + # - we only allow a single patch with name "git_repo.patch". A better design + # would be to allow multiple patches that can have more descriptive names. for repo_relative_path in files_to_patch: subprocess.check_output( ['git', 'add', repo_relative_path], @@ -334,8 +349,12 @@ languages = args.language if args.language != ['all'] else _LANGUAGES for lang in languages: docker_images = build_all_images_for_lang(lang) for image in docker_images: - jobset.message('START', 'Uploading %s' % image, do_newline=True) - # docker image name must be in the format <gcr_path>/<image>:<gcr_tag> - assert image.startswith(args.gcr_path) and image.find(':') != -1 - - subprocess.call(['gcloud', 'docker', '--', 'push', image]) + if args.upload_images: + jobset.message('START', 'Uploading %s' % image, do_newline=True) + # docker image name must be in the format <gcr_path>/<image>:<gcr_tag> + assert image.startswith(args.gcr_path) and image.find(':') != -1 + subprocess.call(['gcloud', 'docker', '--', 'push', image]) + else: + # Uploading (and overwriting images) by default can easily break things. + print('Not uploading image %s, run with --upload_images to upload.' + % image) diff --git a/tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch b/tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch new file mode 100644 index 0000000000..e07b9c80f8 --- /dev/null +++ b/tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch @@ -0,0 +1,81 @@ +diff --git a/third_party/boringssl b/third_party/boringssl +index c880e42ba1..70ef9596bb 160000 +--- a/third_party/boringssl ++++ b/third_party/boringssl +@@ -1 +1 @@ +-Subproject commit c880e42ba1c8032d4cdde2aba0541d8a9d9fa2e9 ++Subproject commit 70ef9596bbcc11353b9bb8d4e91478694dd21439 +diff --git a/third_party/gflags b/third_party/gflags +index 05b155ff59..30dbc81fb5 160000 +--- a/third_party/gflags ++++ b/third_party/gflags +@@ -1 +1 @@ +-Subproject commit 05b155ff59114735ec8cd089f669c4c3d8f59029 ++Subproject commit 30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e +diff --git a/third_party/googletest b/third_party/googletest +index c99458533a..ec44c6c167 160000 +--- a/third_party/googletest ++++ b/third_party/googletest +@@ -1 +1 @@ +-Subproject commit c99458533a9b4c743ed51537e25989ea55944908 ++Subproject commit ec44c6c1675c25b9827aacd08c02433cccde7780 +diff --git a/third_party/protobuf b/third_party/protobuf +index 1a58673508..b5fbb742af 160000 +--- a/third_party/protobuf ++++ b/third_party/protobuf +@@ -1 +1 @@ +-Subproject commit 1a586735085e817b1f52e53feec92ce418049f69 ++Subproject commit b5fbb742af122b565925987e65c08957739976a7 +diff --git a/third_party/zlib b/third_party/zlib +index 5089329162..cacf7f1d4e 160000 +--- a/third_party/zlib ++++ b/third_party/zlib +@@ -1 +1 @@ +-Subproject commit 50893291621658f355bc5b4d450a8d06a563053d ++Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f +diff --git a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile +index da1d2c645e..f405994293 100644 +--- a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile ++++ b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile +@@ -67,11 +67,10 @@ RUN apt-get update && apt-get install -y time && apt-get clean + # C# dependencies + + # Update to a newer version of mono +-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +-RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list ++RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF ++RUN echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/4.6 main" | tee /etc/apt/sources.list.d/official.list + RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list + RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list +-RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list + + # Install dependencies + RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ +diff --git a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile +index 65f67d3650..26223753ed 100644 +--- a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile ++++ b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile +@@ -82,11 +82,10 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2 + # C# dependencies + + # Update to a newer version of mono +-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +-RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list ++RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF ++RUN echo "deb http://download.mono-project.com/repo/debian jessie main" | tee /etc/apt/sources.list.d/mono-official.list + RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list + RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list +-RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list + + # Install dependencies + RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ +@@ -99,7 +98,8 @@ RUN nuget update -self + + # Install dotnet SDK based on https://www.microsoft.com/net/core#debian + RUN apt-get update && apt-get install -y curl libunwind8 gettext +-RUN curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 ++# https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.0.1-preview2-download.md ++RUN curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 + RUN mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet + RUN ln -s /opt/dotnet/dotnet /usr/local/bin + diff --git a/tools/interop_matrix/run_interop_matrix_tests.py b/tools/interop_matrix/run_interop_matrix_tests.py index eb8b7d6944..9d442346a7 100755 --- a/tools/interop_matrix/run_interop_matrix_tests.py +++ b/tools/interop_matrix/run_interop_matrix_tests.py @@ -116,6 +116,10 @@ def find_all_images_for_lang(lang): return {} releases = [args.release] + # TODO(jtattermusch): why do we need to query the existing images/tags? + # From LANG_RUNTIME_MATRIX and LANG_RELEASE_MATRIX it should be obvious + # which tags we want to test - and it should be an error if they are + # missing. # Images tuples keyed by runtime. images = {} for runtime in client_matrix.LANG_RUNTIME_MATRIX[lang]: diff --git a/tools/profiling/ios_bin/binary_diff.py b/tools/profiling/ios_bin/binary_diff.py new file mode 100755 index 0000000000..6d5ae65e46 --- /dev/null +++ b/tools/profiling/ios_bin/binary_diff.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python2.7 +# +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse +import glob +import multiprocessing +import os +import shutil +import subprocess +import sys +from parse_link_map import parse_link_map + +sys.path.append( + os.path.join( + os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils')) +import comment_on_pr + +size_labels = ('Core', 'ObjC', 'BoringSSL', 'Protobuf', 'Total') + +argp = argparse.ArgumentParser( + description='Binary size diff of gRPC Objective-C sample') + +argp.add_argument( + '-d', + '--diff_base', + type=str, + help='Commit or branch to compare the current one to') + +args = argp.parse_args() + + +def dir_size(dir): + total = 0 + for dirpath, dirnames, filenames in os.walk(dir): + for f in filenames: + fp = os.path.join(dirpath, f) + total += os.stat(fp).st_size + return total + + +def get_size(where, frameworks): + build_dir = 'src/objective-c/examples/Sample/Build-%s/' % where + if not frameworks: + link_map_filename = 'Build/Intermediates.noindex/Sample.build/Release-iphoneos/Sample.build/Sample-LinkMap-normal-arm64.txt' + return parse_link_map(build_dir + link_map_filename) + else: + framework_dir = 'Build/Products/Release-iphoneos/Sample.app/Frameworks/' + boringssl_size = dir_size( + build_dir + framework_dir + 'openssl.framework') + core_size = dir_size(build_dir + framework_dir + 'grpc.framework') + objc_size = dir_size(build_dir + framework_dir + 'GRPCClient.framework') + \ + dir_size(build_dir + framework_dir + 'RxLibrary.framework') + \ + dir_size(build_dir + framework_dir + 'ProtoRPC.framework') + protobuf_size = dir_size( + build_dir + framework_dir + 'Protobuf.framework') + app_size = dir_size( + build_dir + 'Build/Products/Release-iphoneos/Sample.app') + return core_size, objc_size, boringssl_size, protobuf_size, app_size + + +def build(where, frameworks): + shutil.rmtree( + 'src/objective-c/examples/Sample/Build-%s' % where, ignore_errors=True) + subprocess.check_call( + 'CONFIG=opt EXAMPLE_PATH=src/objective-c/examples/Sample SCHEME=Sample FRAMEWORKS=%s ./build_one_example.sh' + % ('YES' if frameworks else 'NO'), + shell=True, + cwd='src/objective-c/tests') + os.rename('src/objective-c/examples/Sample/Build', + 'src/objective-c/examples/Sample/Build-%s' % where) + + +text = '' +for frameworks in [False, True]: + build('new', frameworks) + new_size = get_size('new', frameworks) + old_size = None + + if args.diff_base: + old = 'old' + where_am_i = subprocess.check_output( + ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() + subprocess.check_call(['git', 'checkout', '--', '.']) + subprocess.check_call(['git', 'checkout', args.diff_base]) + subprocess.check_call(['git', 'submodule', 'update']) + try: + build('old', frameworks) + old_size = get_size('old', frameworks) + finally: + subprocess.check_call(['git', 'checkout', '--', '.']) + subprocess.check_call(['git', 'checkout', where_am_i]) + subprocess.check_call(['git', 'submodule', 'update']) + + text += ('****************FRAMEWORKS*****************\n' + if frameworks else '******************STATIC*******************\n') + row_format = "{:>10}{:>15}{:>15}" + '\n' + text += row_format.format('New size', '', 'Old size') + for i in range(0, len(size_labels)): + if old_size == None: + diff_sign = ' ' + elif new_size[i] == old_size[i]: + diff_sign = ' (=)' + elif new_size[i] > old_size[i]: + diff_sign = ' (>)' + else: + diff_sign = ' (<)' + text += ('\n' if i == len(size_labels) - 1 else '') + row_format.format( + '{:,}'.format(new_size[i]), size_labels[i] + diff_sign, + '{:,}'.format(old_size[i]) if old_size != None else '') + text += '\n' + +print text + +comment_on_pr.comment_on_pr('```\n%s\n```' % text) diff --git a/tools/profiling/ios_bin/parse_link_map.py b/tools/profiling/ios_bin/parse_link_map.py new file mode 100755 index 0000000000..eaa1d6e060 --- /dev/null +++ b/tools/profiling/ios_bin/parse_link_map.py @@ -0,0 +1,104 @@ +#!/usr/bin/python +# Copyright 2018 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script analyzes link map file generated by Xcode. It calculates and +# prints out the sizes of each dependent library and the total sizes of the +# symbols. +# The script takes one parameter, which is the path to the link map file. + +import sys +import re + + +def parse_link_map(filename): + table_tag = {} + state = "start" + + table_stats_symbol = {} + table_stats_dead = {} + section_total_size = 0 + symbol_total_size = 0 + + boringssl_size = 0 + core_size = 0 + objc_size = 0 + protobuf_size = 0 + + lines = list(open(filename)) + for line in lines: + line_stripped = line[:-1] + if "# Object files:" == line_stripped: + state = "object" + continue + elif "# Sections:" == line_stripped: + state = "section" + continue + elif "# Symbols:" == line_stripped: + state = "symbol" + continue + elif "# Dead Stripped Symbols:" == line_stripped: + state = "dead" + continue + + if state == "object": + segs = re.search('(\[ *[0-9]*\]) (.*)', line_stripped) + table_tag[segs.group(1)] = segs.group(2) + + if state == "section": + if len(line_stripped) == 0 or line_stripped[0] == '#': + continue + segs = re.search('^(.+?)\s+(.+?)\s+.*', line_stripped) + section_total_size += int(segs.group(2), 16) + + if state == "symbol": + if len(line_stripped) == 0 or line_stripped[0] == '#': + continue + segs = re.search('^.+?\s+(.+?)\s+(\[.+?\]).*', line_stripped) + target = table_tag[segs.group(2)] + target_stripped = re.search('^(.*?)(\(.+?\))?$', target).group(1) + size = int(segs.group(1), 16) + if not target_stripped in table_stats_symbol: + table_stats_symbol[target_stripped] = 0 + table_stats_symbol[target_stripped] += size + if 'BoringSSL' in target_stripped: + boringssl_size += size + elif 'libgRPC-Core' in target_stripped: + core_size += size + elif 'libgRPC-RxLibrary' in target_stripped or \ + 'libgRPC' in target_stripped or \ + 'libgRPC-ProtoLibrary' in target_stripped: + objc_size += size + elif 'libProtobuf' in target_stripped: + protobuf_size += size + + for target in table_stats_symbol: + symbol_total_size += table_stats_symbol[target] + + return core_size, objc_size, boringssl_size, protobuf_size, symbol_total_size + + +def main(): + filename = sys.argv[1] + core_size, objc_size, boringssl_size, protobuf_size, total_size = parse_link_map( + filename) + print('Core size:{:,}'.format(core_size)) + print('ObjC size:{:,}'.format(objc_size)) + print('BoringSSL size:{:,}'.format(boringssl_size)) + print('Protobuf size:{:,}\n'.format(protobuf_size)) + print('Total size:{:,}'.format(total_size)) + + +if __name__ == "__main__": + main() diff --git a/tools/run_tests/artifacts/build_artifact_csharp.bat b/tools/run_tests/artifacts/build_artifact_csharp.bat index a84bc54157..ac2c92b716 100644 --- a/tools/run_tests/artifacts/build_artifact_csharp.bat +++ b/tools/run_tests/artifacts/build_artifact_csharp.bat @@ -19,11 +19,12 @@ set GRPC_SKIP_DOTNET_RESTORE=true @call tools\run_tests\helper_scripts\pre_build_csharp.bat %ARCHITECTURE% || goto :error cd cmake\build\%ARCHITECTURE% -cmake --build . --target grpc_csharp_ext --config Release +cmake --build . --target grpc_csharp_ext --config RelWithDebInfo cd ..\..\.. mkdir -p %ARTIFACTS_OUT% -copy /Y cmake\build\Win32\Release\grpc_csharp_ext.dll %ARTIFACTS_OUT% || copy /Y cmake\build\x64\Release\grpc_csharp_ext.dll %ARTIFACTS_OUT% || goto :error +copy /Y cmake\build\Win32\RelWithDebInfo\grpc_csharp_ext.dll %ARTIFACTS_OUT% || copy /Y cmake\build\x64\RelWithDebInfo\grpc_csharp_ext.dll %ARTIFACTS_OUT% || goto :error +copy /Y cmake\build\Win32\RelWithDebInfo\grpc_csharp_ext.pdb %ARTIFACTS_OUT% || copy /Y cmake\build\x64\RelWithDebInfo\grpc_csharp_ext.pdb %ARTIFACTS_OUT% || goto :error goto :EOF diff --git a/tools/run_tests/artifacts/distribtest_targets.py b/tools/run_tests/artifacts/distribtest_targets.py index 213325439e..e02f4bffcd 100644 --- a/tools/run_tests/artifacts/distribtest_targets.py +++ b/tools/run_tests/artifacts/distribtest_targets.py @@ -303,7 +303,6 @@ def targets(): CppDistribTest('linux', 'x64', 'jessie', 'cmake_as_submodule'), CppDistribTest('windows', 'x86', testcase='cmake'), CppDistribTest('windows', 'x86', testcase='cmake_as_externalproject'), - CSharpDistribTest('linux', 'x64', 'wheezy'), CSharpDistribTest('linux', 'x64', 'jessie'), CSharpDistribTest('linux', 'x86', 'jessie'), CSharpDistribTest('linux', 'x64', 'centos7'), diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 0af4e19a1a..585f68140a 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -8746,6 +8746,7 @@ "test/core/end2end/tests/max_message_length.cc", "test/core/end2end/tests/negative_deadline.cc", "test/core/end2end/tests/network_status_change.cc", + "test/core/end2end/tests/no_error_on_hotpath.cc", "test/core/end2end/tests/no_logging.cc", "test/core/end2end/tests/no_op.cc", "test/core/end2end/tests/payload.cc", @@ -8845,6 +8846,7 @@ "test/core/end2end/tests/max_message_length.cc", "test/core/end2end/tests/negative_deadline.cc", "test/core/end2end/tests/network_status_change.cc", + "test/core/end2end/tests/no_error_on_hotpath.cc", "test/core/end2end/tests/no_logging.cc", "test/core/end2end/tests/no_op.cc", "test/core/end2end/tests/payload.cc", @@ -9747,6 +9749,32 @@ { "deps": [ "gpr", + "gpr_base_headers", + "grpc_base_headers" + ], + "headers": [ + "src/core/lib/iomgr/cfstream_handle.h", + "src/core/lib/iomgr/endpoint_cfstream.h", + "src/core/lib/iomgr/error_cfstream.h" + ], + "is_filegroup": true, + "language": "c", + "name": "grpc_cfstream", + "src": [ + "src/core/lib/iomgr/cfstream_handle.cc", + "src/core/lib/iomgr/cfstream_handle.h", + "src/core/lib/iomgr/endpoint_cfstream.cc", + "src/core/lib/iomgr/endpoint_cfstream.h", + "src/core/lib/iomgr/error_cfstream.cc", + "src/core/lib/iomgr/error_cfstream.h", + "src/core/lib/iomgr/tcp_client_cfstream.cc" + ], + "third_party": false, + "type": "filegroup" + }, + { + "deps": [ + "gpr", "grpc_base" ], "headers": [ diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 00604f181c..902ddbf257 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -7798,6 +7798,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_census_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -9550,6 +9573,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -11243,6 +11289,28 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_fakesec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -12813,6 +12881,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_fd_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -14151,6 +14242,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -15755,6 +15869,25 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -17324,6 +17457,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_op" ], "ci_platforms": [ @@ -19053,6 +19209,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+workarounds_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -20837,6 +21016,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_http_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -22653,6 +22856,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_load_reporting_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -24437,6 +24663,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_oauth2_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -27293,6 +27543,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -28517,6 +28791,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_op" ], "ci_platforms": [ @@ -29777,6 +30075,32 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [ + "msan" + ], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -31155,6 +31479,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -34033,6 +34380,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -35505,6 +35875,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "inproc_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -36705,6 +37098,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_census_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -38434,6 +38850,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -39998,6 +40437,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_fd_nosec_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -41313,6 +41775,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -42898,6 +43383,25 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_nosec_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -44444,6 +44948,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_op" ], "ci_platforms": [ @@ -46150,6 +46677,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+workarounds_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -47910,6 +48460,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_http_proxy_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -49703,6 +50277,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_load_reporting_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -52471,6 +53068,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -53671,6 +54292,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_op" ], "ci_platforms": [ @@ -54905,6 +55550,32 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [ + "msan" + ], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -56210,6 +56881,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_uds_nosec_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -57659,6 +58353,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "inproc_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ diff --git a/tools/run_tests/python_utils/upload_rbe_results.py b/tools/run_tests/python_utils/upload_rbe_results.py index 5955b3792f..a2dd0bc39d 100644 --- a/tools/run_tests/python_utils/upload_rbe_results.py +++ b/tools/run_tests/python_utils/upload_rbe_results.py @@ -175,8 +175,8 @@ if __name__ == "__main__": 'build_id': os.getenv('KOKORO_BUILD_NUMBER'), 'build_url': - 'https://sponge.corp.google.com/invocation?id=%s' % - os.getenv('KOKORO_BUILD_ID'), + 'https://source.cloud.google.com/results/invocations/%s' % + invocation_id, 'test_target': action['id']['targetId'], 'test_case': diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index ea4c7c3c65..67aa641e2d 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1114,6 +1114,12 @@ class ObjCLanguage(object): 'SCHEME': 'SwiftSample', 'EXAMPLE_PATH': 'src/objective-c/examples/SwiftSample' }), + self.config.job_spec( + ['test/core/iomgr/ios/CFStreamTests/run_tests.sh'], + timeout_seconds=10 * 60, + shortname='cfstream-tests', + cpu_cost=1e6, + environ=_FORCE_ENVIRON_FOR_WRAPPERS), ] def pre_build_steps(self): @@ -1126,7 +1132,10 @@ class ObjCLanguage(object): return [] def build_steps(self): - return [['src/objective-c/tests/build_tests.sh']] + return [ + ['src/objective-c/tests/build_tests.sh'], + ['test/core/iomgr/ios/CFStreamTests/build_tests.sh'], + ] def post_tests_steps(self): return [] diff --git a/tools/run_tests/sanity/check_sources_and_headers.py b/tools/run_tests/sanity/check_sources_and_headers.py deleted file mode 100755 index 57ae5c5acc..0000000000 --- a/tools/run_tests/sanity/check_sources_and_headers.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import print_function - -import json -import os -import re -import sys - -root = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../../..')) -with open( - os.path.join(root, 'tools', 'run_tests', 'generated', - 'sources_and_headers.json')) as f: - js = json.loads(f.read()) - -re_inc1 = re.compile(r'^#\s*include\s*"([^"]*)"') -assert re_inc1.match('#include "foo"').group(1) == 'foo' -re_inc2 = re.compile(r'^#\s*include\s*<((grpc|grpc\+\+)/[^"]*)>') -assert re_inc2.match('#include <grpc++/foo>').group(1) == 'grpc++/foo' - - -def get_target(name): - for target in js: - if target['name'] == name: - return target - assert False, 'no target %s' % name - - -def get_headers_transitive(): - """Computes set of headers transitively provided by each target""" - target_headers_transitive = {} - for target in js: - target_name = target['name'] - assert not target_headers_transitive.has_key(target_name) - target_headers_transitive[target_name] = set(target['headers']) - - # Make sure each target's transitive headers contain those - # of their dependencies. If not, add them and continue doing - # so until we get a full pass over all targets without any updates. - closure_changed = True - while closure_changed: - closure_changed = False - for target in js: - target_name = target['name'] - for dep in target['deps']: - headers = target_headers_transitive[target_name] - old_count = len(headers) - headers.update(target_headers_transitive[dep]) - if old_count != len(headers): - closure_changed = True - return target_headers_transitive - - -# precompute transitive closure of headers provided by each target -target_headers_transitive = get_headers_transitive() - - -def target_has_header(target, name): - if name in target_headers_transitive[target['name']]: - return True - if name.startswith('absl/'): - return True - if name in [ - 'src/core/lib/profiling/stap_probes.h', - 'src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h' - ]: - return True - return False - - -def produces_object(name): - return os.path.splitext(name)[1] in ['.c', '.cc'] - - -c_ish = {} -obj_producer_to_source = {'c': c_ish, 'c++': c_ish, 'csharp': {}} - -errors = 0 -for target in js: - if not target['third_party']: - for fn in target['src']: - with open(os.path.join(root, fn)) as f: - src = f.read().splitlines() - for line in src: - m = re_inc1.match(line) - if m: - if not target_has_header(target, m.group(1)): - print( - 'target %s (%s) does not name header %s as a dependency' - % (target['name'], fn, m.group(1))) - errors += 1 - m = re_inc2.match(line) - if m: - if not target_has_header(target, 'include/' + m.group(1)): - print( - 'target %s (%s) does not name header %s as a dependency' - % (target['name'], fn, m.group(1))) - errors += 1 - if target['type'] in ['lib', 'filegroup']: - for fn in target['src']: - language = target['language'] - if produces_object(fn): - obj_base = os.path.splitext(os.path.basename(fn))[0] - if obj_base in obj_producer_to_source[language]: - if obj_producer_to_source[language][obj_base] != fn: - print( - 'target %s (%s) produces an aliased object file with %s' - % (target['name'], fn, - obj_producer_to_source[language][obj_base])) - else: - obj_producer_to_source[language][obj_base] = fn - -assert errors == 0 diff --git a/tools/run_tests/sanity/core_banned_functions.py b/tools/run_tests/sanity/core_banned_functions.py index 1d3f2eba8a..8afd826453 100755 --- a/tools/run_tests/sanity/core_banned_functions.py +++ b/tools/run_tests/sanity/core_banned_functions.py @@ -30,7 +30,8 @@ BANNED_EXCEPT = { ['src/core/lib/slice/slice_buffer.cc'], 'grpc_slice_ref(': ['src/core/lib/slice/slice.cc'], 'grpc_slice_unref(': ['src/core/lib/slice/slice.cc'], - 'grpc_error_create(': ['src/core/lib/iomgr/error.cc'], + 'grpc_error_create(': + ['src/core/lib/iomgr/error.cc', 'src/core/lib/iomgr/error_cfstream.cc'], 'grpc_error_ref(': ['src/core/lib/iomgr/error.cc'], 'grpc_error_unref(': ['src/core/lib/iomgr/error.cc'], 'grpc_os_error(': ['src/core/lib/iomgr/error.cc'], diff --git a/tools/run_tests/sanity/sanity_tests.yaml b/tools/run_tests/sanity/sanity_tests.yaml index a15473db0f..ac0d4c70e5 100644 --- a/tools/run_tests/sanity/sanity_tests.yaml +++ b/tools/run_tests/sanity/sanity_tests.yaml @@ -2,7 +2,6 @@ - script: tools/run_tests/sanity/check_bazel_workspace.py - script: tools/run_tests/sanity/check_cache_mk.sh - script: tools/run_tests/sanity/check_owners.sh -- script: tools/run_tests/sanity/check_sources_and_headers.py - script: tools/run_tests/sanity/check_shellcheck.sh - script: tools/run_tests/sanity/check_submodules.sh - script: tools/run_tests/sanity/check_test_filtering.py |