mirror of https://github.com/grpc/grpc.git
commit
5d7b6a21df
275 changed files with 2777 additions and 572 deletions
@ -0,0 +1,6 @@ |
|||||||
|
-Isrc/ruby |
||||||
|
-Isrc/ruby/pb |
||||||
|
--backtrace |
||||||
|
--require spec/spec_helper |
||||||
|
--format documentation |
||||||
|
--color |
@ -0,0 +1,416 @@ |
|||||||
|
# -*- ruby -*- |
||||||
|
# encoding: utf-8 |
||||||
|
$LOAD_PATH.push File.expand_path('../src/ruby/lib', __FILE__) |
||||||
|
require 'grpc/version' |
||||||
|
|
||||||
|
Gem::Specification.new do |s| |
||||||
|
s.name = 'grpc' |
||||||
|
s.version = GRPC::VERSION |
||||||
|
s.authors = ['gRPC Authors'] |
||||||
|
s.email = 'temiola@google.com' |
||||||
|
s.homepage = 'https://github.com/google/grpc/tree/master/src/ruby' |
||||||
|
s.summary = 'GRPC system in Ruby' |
||||||
|
s.description = 'Send RPCs from Ruby using GRPC' |
||||||
|
s.license = 'BSD-3-Clause' |
||||||
|
|
||||||
|
s.required_ruby_version = '>= 2.0.0' |
||||||
|
s.requirements << 'libgrpc ~> 0.11.0 needs to be installed' |
||||||
|
|
||||||
|
s.files = %w( Rakefile Makefile ) |
||||||
|
s.files += %w( etc/roots.pem ) |
||||||
|
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('include/grpc/**/*') |
||||||
|
s.test_files = Dir.glob('src/ruby/spec/**/*') |
||||||
|
s.bindir = 'src/ruby/bin' |
||||||
|
%w(math noproto).each do |b| |
||||||
|
s.executables += ["#{b}_client.rb", "#{b}_server.rb"] |
||||||
|
end |
||||||
|
s.executables += %w(grpc_ruby_interop_client grpc_ruby_interop_server) |
||||||
|
s.require_paths = %w( src/ruby/bin src/ruby/lib src/ruby/pb ) |
||||||
|
s.platform = Gem::Platform::RUBY |
||||||
|
|
||||||
|
s.add_dependency 'google-protobuf', '~> 3.0.0alpha.1.1' |
||||||
|
s.add_dependency 'googleauth', '~> 0.5.1' |
||||||
|
|
||||||
|
s.add_development_dependency 'bundler', '~> 1.9' |
||||||
|
s.add_development_dependency 'logging', '~> 2.0' |
||||||
|
s.add_development_dependency 'simplecov', '~> 0.9' |
||||||
|
s.add_development_dependency 'rake', '~> 10.4' |
||||||
|
s.add_development_dependency 'rake-compiler', '~> 0.9' |
||||||
|
s.add_development_dependency 'rspec', '~> 3.2' |
||||||
|
s.add_development_dependency 'rubocop', '~> 0.30.0' |
||||||
|
s.add_development_dependency 'signet', '~>0.7.0' |
||||||
|
|
||||||
|
s.extensions = %w(src/ruby/ext/grpc/extconf.rb) |
||||||
|
|
||||||
|
s.files += %w( include/grpc/support/alloc.h ) |
||||||
|
s.files += %w( include/grpc/support/atm.h ) |
||||||
|
s.files += %w( include/grpc/support/atm_gcc_atomic.h ) |
||||||
|
s.files += %w( include/grpc/support/atm_gcc_sync.h ) |
||||||
|
s.files += %w( include/grpc/support/atm_win32.h ) |
||||||
|
s.files += %w( include/grpc/support/avl.h ) |
||||||
|
s.files += %w( include/grpc/support/cmdline.h ) |
||||||
|
s.files += %w( include/grpc/support/cpu.h ) |
||||||
|
s.files += %w( include/grpc/support/histogram.h ) |
||||||
|
s.files += %w( include/grpc/support/host_port.h ) |
||||||
|
s.files += %w( include/grpc/support/log.h ) |
||||||
|
s.files += %w( include/grpc/support/log_win32.h ) |
||||||
|
s.files += %w( include/grpc/support/port_platform.h ) |
||||||
|
s.files += %w( include/grpc/support/slice.h ) |
||||||
|
s.files += %w( include/grpc/support/slice_buffer.h ) |
||||||
|
s.files += %w( include/grpc/support/string_util.h ) |
||||||
|
s.files += %w( include/grpc/support/subprocess.h ) |
||||||
|
s.files += %w( include/grpc/support/sync.h ) |
||||||
|
s.files += %w( include/grpc/support/sync_generic.h ) |
||||||
|
s.files += %w( include/grpc/support/sync_posix.h ) |
||||||
|
s.files += %w( include/grpc/support/sync_win32.h ) |
||||||
|
s.files += %w( include/grpc/support/thd.h ) |
||||||
|
s.files += %w( include/grpc/support/time.h ) |
||||||
|
s.files += %w( include/grpc/support/tls.h ) |
||||||
|
s.files += %w( include/grpc/support/tls_gcc.h ) |
||||||
|
s.files += %w( include/grpc/support/tls_msvc.h ) |
||||||
|
s.files += %w( include/grpc/support/tls_pthread.h ) |
||||||
|
s.files += %w( include/grpc/support/useful.h ) |
||||||
|
s.files += %w( src/core/profiling/timers.h ) |
||||||
|
s.files += %w( src/core/support/block_annotate.h ) |
||||||
|
s.files += %w( src/core/support/env.h ) |
||||||
|
s.files += %w( src/core/support/file.h ) |
||||||
|
s.files += %w( src/core/support/murmur_hash.h ) |
||||||
|
s.files += %w( src/core/support/stack_lockfree.h ) |
||||||
|
s.files += %w( src/core/support/string.h ) |
||||||
|
s.files += %w( src/core/support/string_win32.h ) |
||||||
|
s.files += %w( src/core/support/thd_internal.h ) |
||||||
|
s.files += %w( src/core/support/time_precise.h ) |
||||||
|
s.files += %w( src/core/profiling/basic_timers.c ) |
||||||
|
s.files += %w( src/core/profiling/stap_timers.c ) |
||||||
|
s.files += %w( src/core/support/alloc.c ) |
||||||
|
s.files += %w( src/core/support/avl.c ) |
||||||
|
s.files += %w( src/core/support/cmdline.c ) |
||||||
|
s.files += %w( src/core/support/cpu_iphone.c ) |
||||||
|
s.files += %w( src/core/support/cpu_linux.c ) |
||||||
|
s.files += %w( src/core/support/cpu_posix.c ) |
||||||
|
s.files += %w( src/core/support/cpu_windows.c ) |
||||||
|
s.files += %w( src/core/support/env_linux.c ) |
||||||
|
s.files += %w( src/core/support/env_posix.c ) |
||||||
|
s.files += %w( src/core/support/env_win32.c ) |
||||||
|
s.files += %w( src/core/support/file.c ) |
||||||
|
s.files += %w( src/core/support/file_posix.c ) |
||||||
|
s.files += %w( src/core/support/file_win32.c ) |
||||||
|
s.files += %w( src/core/support/histogram.c ) |
||||||
|
s.files += %w( src/core/support/host_port.c ) |
||||||
|
s.files += %w( src/core/support/log.c ) |
||||||
|
s.files += %w( src/core/support/log_android.c ) |
||||||
|
s.files += %w( src/core/support/log_linux.c ) |
||||||
|
s.files += %w( src/core/support/log_posix.c ) |
||||||
|
s.files += %w( src/core/support/log_win32.c ) |
||||||
|
s.files += %w( src/core/support/murmur_hash.c ) |
||||||
|
s.files += %w( src/core/support/slice.c ) |
||||||
|
s.files += %w( src/core/support/slice_buffer.c ) |
||||||
|
s.files += %w( src/core/support/stack_lockfree.c ) |
||||||
|
s.files += %w( src/core/support/string.c ) |
||||||
|
s.files += %w( src/core/support/string_posix.c ) |
||||||
|
s.files += %w( src/core/support/string_win32.c ) |
||||||
|
s.files += %w( src/core/support/subprocess_posix.c ) |
||||||
|
s.files += %w( src/core/support/sync.c ) |
||||||
|
s.files += %w( src/core/support/sync_posix.c ) |
||||||
|
s.files += %w( src/core/support/sync_win32.c ) |
||||||
|
s.files += %w( src/core/support/thd.c ) |
||||||
|
s.files += %w( src/core/support/thd_posix.c ) |
||||||
|
s.files += %w( src/core/support/thd_win32.c ) |
||||||
|
s.files += %w( src/core/support/time.c ) |
||||||
|
s.files += %w( src/core/support/time_posix.c ) |
||||||
|
s.files += %w( src/core/support/time_precise.c ) |
||||||
|
s.files += %w( src/core/support/time_win32.c ) |
||||||
|
s.files += %w( src/core/support/tls_pthread.c ) |
||||||
|
s.files += %w( include/grpc/grpc_security.h ) |
||||||
|
s.files += %w( include/grpc/byte_buffer.h ) |
||||||
|
s.files += %w( include/grpc/byte_buffer_reader.h ) |
||||||
|
s.files += %w( include/grpc/compression.h ) |
||||||
|
s.files += %w( include/grpc/grpc.h ) |
||||||
|
s.files += %w( include/grpc/status.h ) |
||||||
|
s.files += %w( include/grpc/census.h ) |
||||||
|
s.files += %w( src/core/security/auth_filters.h ) |
||||||
|
s.files += %w( src/core/security/base64.h ) |
||||||
|
s.files += %w( src/core/security/credentials.h ) |
||||||
|
s.files += %w( src/core/security/handshake.h ) |
||||||
|
s.files += %w( src/core/security/json_token.h ) |
||||||
|
s.files += %w( src/core/security/jwt_verifier.h ) |
||||||
|
s.files += %w( src/core/security/secure_endpoint.h ) |
||||||
|
s.files += %w( src/core/security/security_connector.h ) |
||||||
|
s.files += %w( src/core/security/security_context.h ) |
||||||
|
s.files += %w( src/core/tsi/fake_transport_security.h ) |
||||||
|
s.files += %w( src/core/tsi/ssl_transport_security.h ) |
||||||
|
s.files += %w( src/core/tsi/ssl_types.h ) |
||||||
|
s.files += %w( src/core/tsi/transport_security.h ) |
||||||
|
s.files += %w( src/core/tsi/transport_security_interface.h ) |
||||||
|
s.files += %w( src/core/census/grpc_filter.h ) |
||||||
|
s.files += %w( src/core/channel/channel_args.h ) |
||||||
|
s.files += %w( src/core/channel/channel_stack.h ) |
||||||
|
s.files += %w( src/core/channel/client_channel.h ) |
||||||
|
s.files += %w( src/core/channel/client_uchannel.h ) |
||||||
|
s.files += %w( src/core/channel/compress_filter.h ) |
||||||
|
s.files += %w( src/core/channel/connected_channel.h ) |
||||||
|
s.files += %w( src/core/channel/context.h ) |
||||||
|
s.files += %w( src/core/channel/http_client_filter.h ) |
||||||
|
s.files += %w( src/core/channel/http_server_filter.h ) |
||||||
|
s.files += %w( src/core/channel/subchannel_call_holder.h ) |
||||||
|
s.files += %w( src/core/client_config/client_config.h ) |
||||||
|
s.files += %w( src/core/client_config/connector.h ) |
||||||
|
s.files += %w( src/core/client_config/initial_connect_string.h ) |
||||||
|
s.files += %w( src/core/client_config/lb_policies/pick_first.h ) |
||||||
|
s.files += %w( src/core/client_config/lb_policies/round_robin.h ) |
||||||
|
s.files += %w( src/core/client_config/lb_policy.h ) |
||||||
|
s.files += %w( src/core/client_config/lb_policy_factory.h ) |
||||||
|
s.files += %w( src/core/client_config/lb_policy_registry.h ) |
||||||
|
s.files += %w( src/core/client_config/resolver.h ) |
||||||
|
s.files += %w( src/core/client_config/resolver_factory.h ) |
||||||
|
s.files += %w( src/core/client_config/resolver_registry.h ) |
||||||
|
s.files += %w( src/core/client_config/resolvers/dns_resolver.h ) |
||||||
|
s.files += %w( src/core/client_config/resolvers/sockaddr_resolver.h ) |
||||||
|
s.files += %w( src/core/client_config/subchannel.h ) |
||||||
|
s.files += %w( src/core/client_config/subchannel_factory.h ) |
||||||
|
s.files += %w( src/core/client_config/uri_parser.h ) |
||||||
|
s.files += %w( src/core/compression/algorithm_metadata.h ) |
||||||
|
s.files += %w( src/core/compression/message_compress.h ) |
||||||
|
s.files += %w( src/core/debug/trace.h ) |
||||||
|
s.files += %w( src/core/httpcli/format_request.h ) |
||||||
|
s.files += %w( src/core/httpcli/httpcli.h ) |
||||||
|
s.files += %w( src/core/httpcli/parser.h ) |
||||||
|
s.files += %w( src/core/iomgr/closure.h ) |
||||||
|
s.files += %w( src/core/iomgr/endpoint.h ) |
||||||
|
s.files += %w( src/core/iomgr/endpoint_pair.h ) |
||||||
|
s.files += %w( src/core/iomgr/exec_ctx.h ) |
||||||
|
s.files += %w( src/core/iomgr/executor.h ) |
||||||
|
s.files += %w( src/core/iomgr/fd_posix.h ) |
||||||
|
s.files += %w( src/core/iomgr/iocp_windows.h ) |
||||||
|
s.files += %w( src/core/iomgr/iomgr.h ) |
||||||
|
s.files += %w( src/core/iomgr/iomgr_internal.h ) |
||||||
|
s.files += %w( src/core/iomgr/iomgr_posix.h ) |
||||||
|
s.files += %w( src/core/iomgr/pollset.h ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_posix.h ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_set.h ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_set_posix.h ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_set_windows.h ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_windows.h ) |
||||||
|
s.files += %w( src/core/iomgr/resolve_address.h ) |
||||||
|
s.files += %w( src/core/iomgr/sockaddr.h ) |
||||||
|
s.files += %w( src/core/iomgr/sockaddr_posix.h ) |
||||||
|
s.files += %w( src/core/iomgr/sockaddr_utils.h ) |
||||||
|
s.files += %w( src/core/iomgr/sockaddr_win32.h ) |
||||||
|
s.files += %w( src/core/iomgr/socket_utils_posix.h ) |
||||||
|
s.files += %w( src/core/iomgr/socket_windows.h ) |
||||||
|
s.files += %w( src/core/iomgr/tcp_client.h ) |
||||||
|
s.files += %w( src/core/iomgr/tcp_posix.h ) |
||||||
|
s.files += %w( src/core/iomgr/tcp_server.h ) |
||||||
|
s.files += %w( src/core/iomgr/tcp_windows.h ) |
||||||
|
s.files += %w( src/core/iomgr/time_averaged_stats.h ) |
||||||
|
s.files += %w( src/core/iomgr/timer.h ) |
||||||
|
s.files += %w( src/core/iomgr/timer_heap.h ) |
||||||
|
s.files += %w( src/core/iomgr/timer_internal.h ) |
||||||
|
s.files += %w( src/core/iomgr/udp_server.h ) |
||||||
|
s.files += %w( src/core/iomgr/wakeup_fd_pipe.h ) |
||||||
|
s.files += %w( src/core/iomgr/wakeup_fd_posix.h ) |
||||||
|
s.files += %w( src/core/iomgr/workqueue.h ) |
||||||
|
s.files += %w( src/core/iomgr/workqueue_posix.h ) |
||||||
|
s.files += %w( src/core/iomgr/workqueue_windows.h ) |
||||||
|
s.files += %w( src/core/json/json.h ) |
||||||
|
s.files += %w( src/core/json/json_common.h ) |
||||||
|
s.files += %w( src/core/json/json_reader.h ) |
||||||
|
s.files += %w( src/core/json/json_writer.h ) |
||||||
|
s.files += %w( src/core/statistics/census_interface.h ) |
||||||
|
s.files += %w( src/core/statistics/census_rpc_stats.h ) |
||||||
|
s.files += %w( src/core/surface/api_trace.h ) |
||||||
|
s.files += %w( src/core/surface/call.h ) |
||||||
|
s.files += %w( src/core/surface/call_test_only.h ) |
||||||
|
s.files += %w( src/core/surface/channel.h ) |
||||||
|
s.files += %w( src/core/surface/completion_queue.h ) |
||||||
|
s.files += %w( src/core/surface/event_string.h ) |
||||||
|
s.files += %w( src/core/surface/init.h ) |
||||||
|
s.files += %w( src/core/surface/server.h ) |
||||||
|
s.files += %w( src/core/surface/surface_trace.h ) |
||||||
|
s.files += %w( src/core/transport/byte_stream.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/alpn.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/bin_encoder.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_data.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_goaway.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_ping.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_rst_stream.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_settings.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_window_update.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/hpack_encoder.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/hpack_parser.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/hpack_table.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/http2_errors.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/huffsyms.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/incoming_metadata.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/internal.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/status_conversion.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/stream_map.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/timeout_encoding.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2/varint.h ) |
||||||
|
s.files += %w( src/core/transport/chttp2_transport.h ) |
||||||
|
s.files += %w( src/core/transport/connectivity_state.h ) |
||||||
|
s.files += %w( src/core/transport/metadata.h ) |
||||||
|
s.files += %w( src/core/transport/metadata_batch.h ) |
||||||
|
s.files += %w( src/core/transport/static_metadata.h ) |
||||||
|
s.files += %w( src/core/transport/transport.h ) |
||||||
|
s.files += %w( src/core/transport/transport_impl.h ) |
||||||
|
s.files += %w( src/core/census/aggregation.h ) |
||||||
|
s.files += %w( src/core/census/context.h ) |
||||||
|
s.files += %w( src/core/census/rpc_metric_id.h ) |
||||||
|
s.files += %w( src/core/httpcli/httpcli_security_connector.c ) |
||||||
|
s.files += %w( src/core/security/base64.c ) |
||||||
|
s.files += %w( src/core/security/client_auth_filter.c ) |
||||||
|
s.files += %w( src/core/security/credentials.c ) |
||||||
|
s.files += %w( src/core/security/credentials_metadata.c ) |
||||||
|
s.files += %w( src/core/security/credentials_posix.c ) |
||||||
|
s.files += %w( src/core/security/credentials_win32.c ) |
||||||
|
s.files += %w( src/core/security/google_default_credentials.c ) |
||||||
|
s.files += %w( src/core/security/handshake.c ) |
||||||
|
s.files += %w( src/core/security/json_token.c ) |
||||||
|
s.files += %w( src/core/security/jwt_verifier.c ) |
||||||
|
s.files += %w( src/core/security/secure_endpoint.c ) |
||||||
|
s.files += %w( src/core/security/security_connector.c ) |
||||||
|
s.files += %w( src/core/security/security_context.c ) |
||||||
|
s.files += %w( src/core/security/server_auth_filter.c ) |
||||||
|
s.files += %w( src/core/security/server_secure_chttp2.c ) |
||||||
|
s.files += %w( src/core/surface/init_secure.c ) |
||||||
|
s.files += %w( src/core/surface/secure_channel_create.c ) |
||||||
|
s.files += %w( src/core/tsi/fake_transport_security.c ) |
||||||
|
s.files += %w( src/core/tsi/ssl_transport_security.c ) |
||||||
|
s.files += %w( src/core/tsi/transport_security.c ) |
||||||
|
s.files += %w( src/core/census/grpc_context.c ) |
||||||
|
s.files += %w( src/core/census/grpc_filter.c ) |
||||||
|
s.files += %w( src/core/channel/channel_args.c ) |
||||||
|
s.files += %w( src/core/channel/channel_stack.c ) |
||||||
|
s.files += %w( src/core/channel/client_channel.c ) |
||||||
|
s.files += %w( src/core/channel/client_uchannel.c ) |
||||||
|
s.files += %w( src/core/channel/compress_filter.c ) |
||||||
|
s.files += %w( src/core/channel/connected_channel.c ) |
||||||
|
s.files += %w( src/core/channel/http_client_filter.c ) |
||||||
|
s.files += %w( src/core/channel/http_server_filter.c ) |
||||||
|
s.files += %w( src/core/channel/subchannel_call_holder.c ) |
||||||
|
s.files += %w( src/core/client_config/client_config.c ) |
||||||
|
s.files += %w( src/core/client_config/connector.c ) |
||||||
|
s.files += %w( src/core/client_config/default_initial_connect_string.c ) |
||||||
|
s.files += %w( src/core/client_config/initial_connect_string.c ) |
||||||
|
s.files += %w( src/core/client_config/lb_policies/pick_first.c ) |
||||||
|
s.files += %w( src/core/client_config/lb_policies/round_robin.c ) |
||||||
|
s.files += %w( src/core/client_config/lb_policy.c ) |
||||||
|
s.files += %w( src/core/client_config/lb_policy_factory.c ) |
||||||
|
s.files += %w( src/core/client_config/lb_policy_registry.c ) |
||||||
|
s.files += %w( src/core/client_config/resolver.c ) |
||||||
|
s.files += %w( src/core/client_config/resolver_factory.c ) |
||||||
|
s.files += %w( src/core/client_config/resolver_registry.c ) |
||||||
|
s.files += %w( src/core/client_config/resolvers/dns_resolver.c ) |
||||||
|
s.files += %w( src/core/client_config/resolvers/sockaddr_resolver.c ) |
||||||
|
s.files += %w( src/core/client_config/subchannel.c ) |
||||||
|
s.files += %w( src/core/client_config/subchannel_factory.c ) |
||||||
|
s.files += %w( src/core/client_config/uri_parser.c ) |
||||||
|
s.files += %w( src/core/compression/algorithm.c ) |
||||||
|
s.files += %w( src/core/compression/message_compress.c ) |
||||||
|
s.files += %w( src/core/debug/trace.c ) |
||||||
|
s.files += %w( src/core/httpcli/format_request.c ) |
||||||
|
s.files += %w( src/core/httpcli/httpcli.c ) |
||||||
|
s.files += %w( src/core/httpcli/parser.c ) |
||||||
|
s.files += %w( src/core/iomgr/closure.c ) |
||||||
|
s.files += %w( src/core/iomgr/endpoint.c ) |
||||||
|
s.files += %w( src/core/iomgr/endpoint_pair_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/endpoint_pair_windows.c ) |
||||||
|
s.files += %w( src/core/iomgr/exec_ctx.c ) |
||||||
|
s.files += %w( src/core/iomgr/executor.c ) |
||||||
|
s.files += %w( src/core/iomgr/fd_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/iocp_windows.c ) |
||||||
|
s.files += %w( src/core/iomgr/iomgr.c ) |
||||||
|
s.files += %w( src/core/iomgr/iomgr_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/iomgr_windows.c ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_multipoller_with_epoll.c ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_multipoller_with_poll_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_set_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_set_windows.c ) |
||||||
|
s.files += %w( src/core/iomgr/pollset_windows.c ) |
||||||
|
s.files += %w( src/core/iomgr/resolve_address_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/resolve_address_windows.c ) |
||||||
|
s.files += %w( src/core/iomgr/sockaddr_utils.c ) |
||||||
|
s.files += %w( src/core/iomgr/socket_utils_common_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/socket_utils_linux.c ) |
||||||
|
s.files += %w( src/core/iomgr/socket_utils_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/socket_windows.c ) |
||||||
|
s.files += %w( src/core/iomgr/tcp_client_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/tcp_client_windows.c ) |
||||||
|
s.files += %w( src/core/iomgr/tcp_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/tcp_server_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/tcp_server_windows.c ) |
||||||
|
s.files += %w( src/core/iomgr/tcp_windows.c ) |
||||||
|
s.files += %w( src/core/iomgr/time_averaged_stats.c ) |
||||||
|
s.files += %w( src/core/iomgr/timer.c ) |
||||||
|
s.files += %w( src/core/iomgr/timer_heap.c ) |
||||||
|
s.files += %w( src/core/iomgr/udp_server.c ) |
||||||
|
s.files += %w( src/core/iomgr/wakeup_fd_eventfd.c ) |
||||||
|
s.files += %w( src/core/iomgr/wakeup_fd_nospecial.c ) |
||||||
|
s.files += %w( src/core/iomgr/wakeup_fd_pipe.c ) |
||||||
|
s.files += %w( src/core/iomgr/wakeup_fd_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/workqueue_posix.c ) |
||||||
|
s.files += %w( src/core/iomgr/workqueue_windows.c ) |
||||||
|
s.files += %w( src/core/json/json.c ) |
||||||
|
s.files += %w( src/core/json/json_reader.c ) |
||||||
|
s.files += %w( src/core/json/json_string.c ) |
||||||
|
s.files += %w( src/core/json/json_writer.c ) |
||||||
|
s.files += %w( src/core/surface/api_trace.c ) |
||||||
|
s.files += %w( src/core/surface/byte_buffer.c ) |
||||||
|
s.files += %w( src/core/surface/byte_buffer_reader.c ) |
||||||
|
s.files += %w( src/core/surface/call.c ) |
||||||
|
s.files += %w( src/core/surface/call_details.c ) |
||||||
|
s.files += %w( src/core/surface/call_log_batch.c ) |
||||||
|
s.files += %w( src/core/surface/channel.c ) |
||||||
|
s.files += %w( src/core/surface/channel_connectivity.c ) |
||||||
|
s.files += %w( src/core/surface/channel_create.c ) |
||||||
|
s.files += %w( src/core/surface/channel_ping.c ) |
||||||
|
s.files += %w( src/core/surface/completion_queue.c ) |
||||||
|
s.files += %w( src/core/surface/event_string.c ) |
||||||
|
s.files += %w( src/core/surface/init.c ) |
||||||
|
s.files += %w( src/core/surface/lame_client.c ) |
||||||
|
s.files += %w( src/core/surface/metadata_array.c ) |
||||||
|
s.files += %w( src/core/surface/server.c ) |
||||||
|
s.files += %w( src/core/surface/server_chttp2.c ) |
||||||
|
s.files += %w( src/core/surface/server_create.c ) |
||||||
|
s.files += %w( src/core/surface/validate_metadata.c ) |
||||||
|
s.files += %w( src/core/surface/version.c ) |
||||||
|
s.files += %w( src/core/transport/byte_stream.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/alpn.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/bin_encoder.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_data.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_goaway.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_ping.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_rst_stream.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_settings.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/frame_window_update.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/hpack_encoder.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/hpack_parser.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/hpack_table.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/huffsyms.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/incoming_metadata.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/parsing.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/status_conversion.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/stream_lists.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/stream_map.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/timeout_encoding.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/varint.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2/writing.c ) |
||||||
|
s.files += %w( src/core/transport/chttp2_transport.c ) |
||||||
|
s.files += %w( src/core/transport/connectivity_state.c ) |
||||||
|
s.files += %w( src/core/transport/metadata.c ) |
||||||
|
s.files += %w( src/core/transport/metadata_batch.c ) |
||||||
|
s.files += %w( src/core/transport/static_metadata.c ) |
||||||
|
s.files += %w( src/core/transport/transport.c ) |
||||||
|
s.files += %w( src/core/transport/transport_op_string.c ) |
||||||
|
s.files += %w( src/core/census/context.c ) |
||||||
|
s.files += %w( src/core/census/initialize.c ) |
||||||
|
s.files += %w( src/core/census/operation.c ) |
||||||
|
s.files += %w( src/core/census/tracing.c ) |
||||||
|
end |
@ -0,0 +1,73 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2016, Google Inc. |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* * Redistributions in binary form must reproduce the above |
||||||
|
* copyright notice, this list of conditions and the following disclaimer |
||||||
|
* in the documentation and/or other materials provided with the |
||||||
|
* distribution. |
||||||
|
* * Neither the name of Google Inc. nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <stdlib.h> |
||||||
|
#include <string.h> |
||||||
|
|
||||||
|
#include <grpc/support/port_platform.h> |
||||||
|
|
||||||
|
static int conforms_to(const char *s, size_t len, const uint8_t *legal_bits) { |
||||||
|
const char *p = s; |
||||||
|
const char *e = s + len; |
||||||
|
for (; p != e; p++) { |
||||||
|
int idx = *p; |
||||||
|
int byte = idx / 8; |
||||||
|
int bit = idx % 8; |
||||||
|
if ((legal_bits[byte] & (1 << bit)) == 0) return 0; |
||||||
|
} |
||||||
|
return 1; |
||||||
|
} |
||||||
|
|
||||||
|
int grpc_header_key_is_legal(const char *key, size_t length) { |
||||||
|
static const uint8_t legal_header_bits[256 / 8] = { |
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xff, 0x03, 0x00, 0x00, 0x00, |
||||||
|
0x80, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
||||||
|
if (length == 0) { |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return conforms_to(key, length, legal_header_bits); |
||||||
|
} |
||||||
|
|
||||||
|
int grpc_header_nonbin_value_is_legal(const char *value, size_t length) { |
||||||
|
static const uint8_t legal_header_bits[256 / 8] = { |
||||||
|
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
||||||
|
0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
||||||
|
return conforms_to(value, length, legal_header_bits); |
||||||
|
} |
||||||
|
|
||||||
|
int grpc_is_binary_header(const char *key, size_t length) { |
||||||
|
if (length < 5) return 0; |
||||||
|
return 0 == memcmp(key + length - 4, "-bin", 4); |
||||||
|
} |
@ -1,6 +0,0 @@ |
|||||||
-I. |
|
||||||
-Ipb |
|
||||||
--backtrace |
|
||||||
--require spec_helper |
|
||||||
--format documentation |
|
||||||
--color |
|
@ -0,0 +1,153 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2016, Google Inc. |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* * Redistributions in binary form must reproduce the above |
||||||
|
* copyright notice, this list of conditions and the following disclaimer |
||||||
|
* in the documentation and/or other materials provided with the |
||||||
|
* distribution. |
||||||
|
* * Neither the name of Google Inc. nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
#include "rb_event_thread.h" |
||||||
|
|
||||||
|
#include <stdbool.h> |
||||||
|
|
||||||
|
#include <ruby/ruby.h> |
||||||
|
#include <ruby/thread.h> |
||||||
|
#include <grpc/support/alloc.h> |
||||||
|
#include <grpc/support/sync.h> |
||||||
|
#include <grpc/support/time.h> |
||||||
|
#include <grpc/support/log.h> |
||||||
|
|
||||||
|
typedef struct grpc_rb_event { |
||||||
|
// callback will be called with argument while holding the GVL
|
||||||
|
void (*callback)(void*); |
||||||
|
void *argument; |
||||||
|
|
||||||
|
struct grpc_rb_event *next; |
||||||
|
} grpc_rb_event; |
||||||
|
|
||||||
|
typedef struct grpc_rb_event_queue { |
||||||
|
grpc_rb_event *head; |
||||||
|
grpc_rb_event *tail; |
||||||
|
|
||||||
|
gpr_mu mu; |
||||||
|
gpr_cv cv; |
||||||
|
|
||||||
|
// Indicates that the thread should stop waiting
|
||||||
|
bool abort; |
||||||
|
} grpc_rb_event_queue; |
||||||
|
|
||||||
|
static grpc_rb_event_queue event_queue; |
||||||
|
|
||||||
|
void grpc_rb_event_queue_enqueue(void (*callback)(void*), |
||||||
|
void *argument) { |
||||||
|
grpc_rb_event *event = gpr_malloc(sizeof(grpc_rb_event)); |
||||||
|
event->callback = callback; |
||||||
|
event->argument = argument; |
||||||
|
event->next = NULL; |
||||||
|
gpr_mu_lock(&event_queue.mu); |
||||||
|
if (event_queue.tail == NULL) { |
||||||
|
event_queue.head = event_queue.tail = event; |
||||||
|
} else { |
||||||
|
event_queue.tail->next = event; |
||||||
|
event_queue.tail = event; |
||||||
|
} |
||||||
|
gpr_cv_signal(&event_queue.cv); |
||||||
|
gpr_mu_unlock(&event_queue.mu); |
||||||
|
} |
||||||
|
|
||||||
|
static grpc_rb_event *grpc_rb_event_queue_dequeue() { |
||||||
|
grpc_rb_event *event; |
||||||
|
if (event_queue.head == NULL) { |
||||||
|
event = NULL; |
||||||
|
} else { |
||||||
|
event = event_queue.head; |
||||||
|
if (event_queue.head->next == NULL) { |
||||||
|
event_queue.head = event_queue.tail = NULL; |
||||||
|
} else { |
||||||
|
event_queue.head = event_queue.head->next; |
||||||
|
} |
||||||
|
} |
||||||
|
return event; |
||||||
|
} |
||||||
|
|
||||||
|
static void grpc_rb_event_queue_destroy() { |
||||||
|
gpr_mu_destroy(&event_queue.mu); |
||||||
|
gpr_cv_destroy(&event_queue.cv); |
||||||
|
} |
||||||
|
|
||||||
|
static void *grpc_rb_wait_for_event_no_gil(void *param) { |
||||||
|
grpc_rb_event *event = NULL; |
||||||
|
gpr_mu_lock(&event_queue.mu); |
||||||
|
while ((event = grpc_rb_event_queue_dequeue()) == NULL) { |
||||||
|
gpr_cv_wait(&event_queue.cv, |
||||||
|
&event_queue.mu, |
||||||
|
gpr_inf_future(GPR_CLOCK_REALTIME)); |
||||||
|
if (event_queue.abort) { |
||||||
|
gpr_mu_unlock(&event_queue.mu); |
||||||
|
return NULL; |
||||||
|
} |
||||||
|
} |
||||||
|
gpr_mu_unlock(&event_queue.mu); |
||||||
|
return event; |
||||||
|
} |
||||||
|
|
||||||
|
static void grpc_rb_event_unblocking_func(void *arg) { |
||||||
|
gpr_mu_lock(&event_queue.mu); |
||||||
|
event_queue.abort = true; |
||||||
|
gpr_cv_signal(&event_queue.cv); |
||||||
|
gpr_mu_unlock(&event_queue.mu); |
||||||
|
} |
||||||
|
|
||||||
|
/* This is the implementation of the thread that handles auth metadata plugin
|
||||||
|
* events */ |
||||||
|
static VALUE grpc_rb_event_thread(VALUE arg) { |
||||||
|
grpc_rb_event *event; |
||||||
|
while(true) { |
||||||
|
event = (grpc_rb_event*)rb_thread_call_without_gvl( |
||||||
|
grpc_rb_wait_for_event_no_gil, NULL, |
||||||
|
grpc_rb_event_unblocking_func, NULL); |
||||||
|
if (event == NULL) { |
||||||
|
// Indicates that the thread needs to shut down
|
||||||
|
break; |
||||||
|
} else { |
||||||
|
event->callback(event->argument); |
||||||
|
gpr_free(event); |
||||||
|
} |
||||||
|
} |
||||||
|
grpc_rb_event_queue_destroy(); |
||||||
|
return Qnil; |
||||||
|
} |
||||||
|
|
||||||
|
void grpc_rb_event_queue_thread_start() { |
||||||
|
event_queue.head = event_queue.tail = NULL; |
||||||
|
event_queue.abort = false; |
||||||
|
gpr_mu_init(&event_queue.mu); |
||||||
|
gpr_cv_init(&event_queue.cv); |
||||||
|
|
||||||
|
rb_thread_create(grpc_rb_event_thread, NULL); |
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
/*
|
||||||
|
* |
||||||
|
* Copyright 2016, Google Inc. |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* * Redistributions in binary form must reproduce the above |
||||||
|
* copyright notice, this list of conditions and the following disclaimer |
||||||
|
* in the documentation and/or other materials provided with the |
||||||
|
* distribution. |
||||||
|
* * Neither the name of Google Inc. nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
void grpc_rb_event_queue_thread_start(); |
||||||
|
|
||||||
|
void grpc_rb_event_queue_enqueue(void (*callback)(void*), |
||||||
|
void *argument); |
@ -1,45 +0,0 @@ |
|||||||
# -*- ruby -*- |
|
||||||
# encoding: utf-8 |
|
||||||
$LOAD_PATH.push File.expand_path('../lib', __FILE__) |
|
||||||
require 'grpc/version' |
|
||||||
|
|
||||||
Gem::Specification.new do |s| |
|
||||||
s.name = 'grpc' |
|
||||||
s.version = GRPC::VERSION |
|
||||||
s.authors = ['gRPC Authors'] |
|
||||||
s.email = 'temiola@google.com' |
|
||||||
s.homepage = 'https://github.com/google/grpc/tree/master/src/ruby' |
|
||||||
s.summary = 'GRPC system in Ruby' |
|
||||||
s.description = 'Send RPCs from Ruby using GRPC' |
|
||||||
s.license = 'BSD-3-Clause' |
|
||||||
|
|
||||||
s.required_ruby_version = '>= 2.0.0' |
|
||||||
s.requirements << 'libgrpc ~> 0.11.0 needs to be installed' |
|
||||||
|
|
||||||
s.files = %w( Rakefile ) |
|
||||||
s.files += Dir.glob('bin/**/*') |
|
||||||
s.files += Dir.glob('ext/**/*') |
|
||||||
s.files += Dir.glob('lib/**/*') |
|
||||||
s.files += Dir.glob('pb/**/*') |
|
||||||
s.test_files = Dir.glob('spec/**/*') |
|
||||||
%w(math noproto).each do |b| |
|
||||||
s.executables += ["#{b}_client.rb", "#{b}_server.rb"] |
|
||||||
end |
|
||||||
s.executables += %w(grpc_ruby_interop_client grpc_ruby_interop_server) |
|
||||||
s.require_paths = %w( bin lib pb ) |
|
||||||
s.platform = Gem::Platform::RUBY |
|
||||||
|
|
||||||
s.add_dependency 'google-protobuf', '~> 3.0.0alpha.1.1' |
|
||||||
s.add_dependency 'googleauth', '~> 0.4' |
|
||||||
|
|
||||||
s.add_development_dependency 'bundler', '~> 1.9' |
|
||||||
s.add_development_dependency 'logging', '~> 2.0' |
|
||||||
s.add_development_dependency 'simplecov', '~> 0.9' |
|
||||||
s.add_development_dependency 'rake', '~> 10.4' |
|
||||||
s.add_development_dependency 'rake-compiler', '~> 0.9' |
|
||||||
s.add_development_dependency 'rspec', '~> 3.2' |
|
||||||
s.add_development_dependency 'rubocop', '~> 0.30.0' |
|
||||||
s.add_development_dependency 'signet', '~>0.6.0' |
|
||||||
|
|
||||||
s.extensions = %w(ext/grpc/extconf.rb) |
|
||||||
end |
|
@ -0,0 +1,58 @@ |
|||||||
|
%YAML 1.2 |
||||||
|
--- | |
||||||
|
# -*- ruby -*- |
||||||
|
# encoding: utf-8 |
||||||
|
$LOAD_PATH.push File.expand_path('../src/ruby/lib', __FILE__) |
||||||
|
require 'grpc/version' |
||||||
|
|
||||||
|
Gem::Specification.new do |s| |
||||||
|
s.name = 'grpc' |
||||||
|
s.version = GRPC::VERSION |
||||||
|
s.authors = ['gRPC Authors'] |
||||||
|
s.email = 'temiola@google.com' |
||||||
|
s.homepage = 'https://github.com/google/grpc/tree/master/src/ruby' |
||||||
|
s.summary = 'GRPC system in Ruby' |
||||||
|
s.description = 'Send RPCs from Ruby using GRPC' |
||||||
|
s.license = 'BSD-3-Clause' |
||||||
|
|
||||||
|
s.required_ruby_version = '>= 2.0.0' |
||||||
|
s.requirements << 'libgrpc ~> 0.11.0 needs to be installed' |
||||||
|
|
||||||
|
s.files = %w( Rakefile Makefile ) |
||||||
|
s.files += %w( etc/roots.pem ) |
||||||
|
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('include/grpc/**/*') |
||||||
|
s.test_files = Dir.glob('src/ruby/spec/**/*') |
||||||
|
s.bindir = 'src/ruby/bin' |
||||||
|
${'%'}w(math noproto).each do |b| |
||||||
|
s.executables += ["#{b}_client.rb", "#{b}_server.rb"] |
||||||
|
end |
||||||
|
s.executables += %w(grpc_ruby_interop_client grpc_ruby_interop_server) |
||||||
|
s.require_paths = %w( src/ruby/bin src/ruby/lib src/ruby/pb ) |
||||||
|
s.platform = Gem::Platform::RUBY |
||||||
|
|
||||||
|
s.add_dependency 'google-protobuf', '~> 3.0.0alpha.1.1' |
||||||
|
s.add_dependency 'googleauth', '~> 0.5.1' |
||||||
|
|
||||||
|
s.add_development_dependency 'bundler', '~> 1.9' |
||||||
|
s.add_development_dependency 'logging', '~> 2.0' |
||||||
|
s.add_development_dependency 'simplecov', '~> 0.9' |
||||||
|
s.add_development_dependency 'rake', '~> 10.4' |
||||||
|
s.add_development_dependency 'rake-compiler', '~> 0.9' |
||||||
|
s.add_development_dependency 'rspec', '~> 3.2' |
||||||
|
s.add_development_dependency 'rubocop', '~> 0.30.0' |
||||||
|
s.add_development_dependency 'signet', '~>0.7.0' |
||||||
|
|
||||||
|
s.extensions = %w(src/ruby/ext/grpc/extconf.rb) |
||||||
|
|
||||||
|
% for lib in libs: |
||||||
|
% if lib.name in ('gpr', 'grpc'): |
||||||
|
% for file in lib.public_headers + lib.headers + lib.src: |
||||||
|
s.files += %w( ${file} ) |
||||||
|
% endfor |
||||||
|
% endif |
||||||
|
% endfor |
||||||
|
end |
@ -0,0 +1,74 @@ |
|||||||
|
%YAML 1.2 |
||||||
|
--- | |
||||||
|
{ |
||||||
|
"name": "grpc", |
||||||
|
"version": "0.12.0", |
||||||
|
"author": "Google Inc.", |
||||||
|
"description": "gRPC Library for Node", |
||||||
|
"homepage": "http://www.grpc.io/", |
||||||
|
"repository": { |
||||||
|
"type": "git", |
||||||
|
"url": "https://github.com/grpc/grpc.git" |
||||||
|
}, |
||||||
|
"bugs": "https://github.com/grpc/grpc/issues", |
||||||
|
"contributors": [ |
||||||
|
{ |
||||||
|
"name": "Michael Lumish", |
||||||
|
"email": "mlumish@google.com" |
||||||
|
} |
||||||
|
], |
||||||
|
"directories": { |
||||||
|
"lib": "src/node/src" |
||||||
|
}, |
||||||
|
"scripts": { |
||||||
|
"lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/interop src/node/index.js", |
||||||
|
"test": "./node_modules/.bin/mocha src/node/test && npm run-script lint", |
||||||
|
"gen_docs": "./node_modules/.bin/jsdoc -c src/node/jsdoc_conf.json", |
||||||
|
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test" |
||||||
|
}, |
||||||
|
"dependencies": { |
||||||
|
"bindings": "^1.2.0", |
||||||
|
"lodash": "^3.9.3", |
||||||
|
"nan": "^2.0.0", |
||||||
|
"protobufjs": "^4.0.0" |
||||||
|
}, |
||||||
|
"devDependencies": { |
||||||
|
"async": "^1.5.0", |
||||||
|
"google-auth-library": "^0.9.2", |
||||||
|
"istanbul": "^0.3.21", |
||||||
|
"jsdoc": "^3.3.2", |
||||||
|
"jshint": "^2.5.0", |
||||||
|
"minimist": "^1.1.0", |
||||||
|
"mocha": "^2.3.4", |
||||||
|
"mocha-jenkins-reporter": "^0.1.9", |
||||||
|
"mustache": "^2.0.0", |
||||||
|
"poisson-process": "^0.2.1" |
||||||
|
}, |
||||||
|
"engines": { |
||||||
|
"node": ">=0.10.13" |
||||||
|
}, |
||||||
|
"files": [ |
||||||
|
"LICENSE", |
||||||
|
"src/node/README.md", |
||||||
|
"src/node/health_check", |
||||||
|
"src/proto", |
||||||
|
"etc", |
||||||
|
% for module in node_modules: |
||||||
|
% for file in module.headers + module.src + module.js: |
||||||
|
"${file}", |
||||||
|
% endfor |
||||||
|
% for dep in module.transitive_deps: |
||||||
|
% for lib in libs: |
||||||
|
% if lib.name == dep: |
||||||
|
% for file in lib.get('public_headers', []) + lib.headers + lib.src: |
||||||
|
"${file}", |
||||||
|
% endfor |
||||||
|
% endif |
||||||
|
% endfor |
||||||
|
% endfor |
||||||
|
% endfor |
||||||
|
"binding.gyp" |
||||||
|
], |
||||||
|
"main": "src/node/index.js", |
||||||
|
"license": "BSD-3-Clause" |
||||||
|
} |
@ -0,0 +1,86 @@ |
|||||||
|
#!/bin/bash |
||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
# |
||||||
|
# This script is invoked by run_interop_tests.py to build the docker image |
||||||
|
# for interop testing. You should never need to call this script on your own. |
||||||
|
|
||||||
|
set -x |
||||||
|
|
||||||
|
# Params: |
||||||
|
# INTEROP_IMAGE - name of tag of the final interop image |
||||||
|
# BASE_NAME - base name used to locate the base Dockerfile and build script |
||||||
|
# TTY_FLAG - optional -t flag to make docker allocate tty |
||||||
|
# BUILD_INTEROP_DOCKER_EXTRA_ARGS - optional args to be passed to the |
||||||
|
# docker run command |
||||||
|
|
||||||
|
cd `dirname $0`/../.. |
||||||
|
GRPC_ROOT=`pwd` |
||||||
|
MOUNT_ARGS="-v $GRPC_ROOT:/var/local/jenkins/grpc:ro" |
||||||
|
|
||||||
|
mkdir -p /tmp/ccache |
||||||
|
|
||||||
|
# Mount service account dir if available. |
||||||
|
# If service_directory does not contain the service account JSON file, |
||||||
|
# some of the tests will fail. |
||||||
|
if [ -e $HOME/service_account ] |
||||||
|
then |
||||||
|
MOUNT_ARGS+=" -v $HOME/service_account:/var/local/jenkins/service_account:ro" |
||||||
|
fi |
||||||
|
|
||||||
|
# Use image name based on Dockerfile checksum |
||||||
|
BASE_IMAGE=${BASE_NAME}_base:`sha1sum tools/jenkins/$BASE_NAME/Dockerfile | cut -f1 -d\ ` |
||||||
|
|
||||||
|
# Make sure base docker image has been built. Should be instantaneous if so. |
||||||
|
docker build -t $BASE_IMAGE --force-rm=true tools/jenkins/$BASE_NAME || exit $? |
||||||
|
|
||||||
|
# Create a local branch so the child Docker script won't complain |
||||||
|
git branch -f jenkins-docker |
||||||
|
|
||||||
|
CONTAINER_NAME="build_${BASE_NAME}_$(uuidgen)" |
||||||
|
|
||||||
|
# Prepare image for interop tests, commit it on success. |
||||||
|
(docker run \ |
||||||
|
-e CCACHE_DIR=/tmp/ccache \ |
||||||
|
-e THIS_IS_REALLY_NEEDED='see https://github.com/docker/docker/issues/14203 for why docker is awful' \ |
||||||
|
-i $TTY_FLAG \ |
||||||
|
$MOUNT_ARGS \ |
||||||
|
$BUILD_INTEROP_DOCKER_EXTRA_ARGS \ |
||||||
|
-v /tmp/ccache:/tmp/ccache \ |
||||||
|
--name=$CONTAINER_NAME \ |
||||||
|
$BASE_IMAGE \ |
||||||
|
bash -l /var/local/jenkins/grpc/tools/jenkins/$BASE_NAME/build_interop_stress.sh \ |
||||||
|
&& docker commit $CONTAINER_NAME $INTEROP_IMAGE \ |
||||||
|
&& echo "Successfully built image $INTEROP_IMAGE") |
||||||
|
EXITCODE=$? |
||||||
|
|
||||||
|
# remove intermediate container, possibly killing it first |
||||||
|
docker rm -f $CONTAINER_NAME |
||||||
|
|
||||||
|
exit $EXITCODE |
@ -0,0 +1,75 @@ |
|||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
|
||||||
|
# A work-in-progress Dockerfile that allows running gRPC test suites |
||||||
|
# inside a docker container. |
||||||
|
|
||||||
|
FROM debian:jessie |
||||||
|
|
||||||
|
# Install Git. |
||||||
|
RUN apt-get update && apt-get install -y \ |
||||||
|
autoconf \ |
||||||
|
autotools-dev \ |
||||||
|
build-essential \ |
||||||
|
bzip2 \ |
||||||
|
ccache \ |
||||||
|
curl \ |
||||||
|
gcc \ |
||||||
|
gcc-multilib \ |
||||||
|
git \ |
||||||
|
gyp \ |
||||||
|
libc6 \ |
||||||
|
libc6-dbg \ |
||||||
|
libc6-dev \ |
||||||
|
libgtest-dev \ |
||||||
|
libtool \ |
||||||
|
make \ |
||||||
|
strace \ |
||||||
|
python-dev \ |
||||||
|
python-setuptools \ |
||||||
|
python-yaml \ |
||||||
|
telnet \ |
||||||
|
unzip \ |
||||||
|
wget \ |
||||||
|
zip && apt-get clean |
||||||
|
|
||||||
|
# Prepare ccache |
||||||
|
RUN ln -s /usr/bin/ccache /usr/local/bin/gcc |
||||||
|
RUN ln -s /usr/bin/ccache /usr/local/bin/g++ |
||||||
|
RUN ln -s /usr/bin/ccache /usr/local/bin/cc |
||||||
|
RUN ln -s /usr/bin/ccache /usr/local/bin/c++ |
||||||
|
RUN ln -s /usr/bin/ccache /usr/local/bin/clang |
||||||
|
RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ |
||||||
|
|
||||||
|
################## |
||||||
|
# C++ dependencies |
||||||
|
RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang |
||||||
|
|
||||||
|
# Define the default command. |
||||||
|
CMD ["bash"] |
@ -0,0 +1,45 @@ |
|||||||
|
#!/bin/bash |
||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
# |
||||||
|
# Builds C++ interop server and client in a base image. |
||||||
|
set -e |
||||||
|
|
||||||
|
mkdir -p /var/local/git |
||||||
|
git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc |
||||||
|
|
||||||
|
# copy service account keys if available |
||||||
|
cp -r /var/local/jenkins/service_account $HOME || true |
||||||
|
|
||||||
|
cd /var/local/git/grpc |
||||||
|
|
||||||
|
make install-certs |
||||||
|
|
||||||
|
# build C++ interop stress client, interop client and server |
||||||
|
make stress_test interop_client interop_server |
@ -0,0 +1,37 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
# |
||||||
|
# This script is invoked by Jenkins and runs interop test suite. |
||||||
|
set -ex |
||||||
|
|
||||||
|
# Enter the gRPC repo root |
||||||
|
cd $(dirname $0)/../.. |
||||||
|
|
||||||
|
tools/run_tests/run_stress_tests.py -l all -s all -j 12 $@ || true |
@ -0,0 +1,328 @@ |
|||||||
|
#!/usr/bin/env python |
||||||
|
# Copyright 2015, Google Inc. |
||||||
|
# All rights reserved. |
||||||
|
# |
||||||
|
# Redistribution and use in source and binary forms, with or without |
||||||
|
# modification, are permitted provided that the following conditions are |
||||||
|
# met: |
||||||
|
# |
||||||
|
# * Redistributions of source code must retain the above copyright |
||||||
|
# notice, this list of conditions and the following disclaimer. |
||||||
|
# * Redistributions in binary form must reproduce the above |
||||||
|
# copyright notice, this list of conditions and the following disclaimer |
||||||
|
# in the documentation and/or other materials provided with the |
||||||
|
# distribution. |
||||||
|
# * Neither the name of Google Inc. nor the names of its |
||||||
|
# contributors may be used to endorse or promote products derived from |
||||||
|
# this software without specific prior written permission. |
||||||
|
# |
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
"""Run stress test in C++""" |
||||||
|
|
||||||
|
import argparse |
||||||
|
import atexit |
||||||
|
import dockerjob |
||||||
|
import itertools |
||||||
|
import jobset |
||||||
|
import json |
||||||
|
import multiprocessing |
||||||
|
import os |
||||||
|
import re |
||||||
|
import subprocess |
||||||
|
import sys |
||||||
|
import tempfile |
||||||
|
import time |
||||||
|
import uuid |
||||||
|
|
||||||
|
# Docker doesn't clean up after itself, so we do it on exit. |
||||||
|
atexit.register(lambda: subprocess.call(['stty', 'echo'])) |
||||||
|
|
||||||
|
ROOT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../..')) |
||||||
|
os.chdir(ROOT) |
||||||
|
|
||||||
|
_DEFAULT_SERVER_PORT = 8080 |
||||||
|
_DEFAULT_METRICS_PORT = 8081 |
||||||
|
_DEFAULT_TEST_CASES = 'empty_unary:20,large_unary:20,client_streaming:20,server_streaming:20,empty_stream:20' |
||||||
|
_DEFAULT_NUM_CHANNELS_PER_SERVER = 5 |
||||||
|
_DEFAULT_NUM_STUBS_PER_CHANNEL = 10 |
||||||
|
|
||||||
|
# 15 mins default |
||||||
|
_DEFAULT_TEST_DURATION_SECS = 900 |
||||||
|
|
||||||
|
class CXXLanguage: |
||||||
|
|
||||||
|
def __init__(self): |
||||||
|
self.client_cwd = None |
||||||
|
self.server_cwd = None |
||||||
|
self.safename = 'cxx' |
||||||
|
|
||||||
|
def client_cmd(self, args): |
||||||
|
return ['bins/opt/stress_test'] + args |
||||||
|
|
||||||
|
def server_cmd(self, args): |
||||||
|
return ['bins/opt/interop_server'] + args |
||||||
|
|
||||||
|
def global_env(self): |
||||||
|
return {} |
||||||
|
|
||||||
|
def __str__(self): |
||||||
|
return 'c++' |
||||||
|
|
||||||
|
|
||||||
|
_LANGUAGES = {'c++': CXXLanguage(),} |
||||||
|
|
||||||
|
# languages supported as cloud_to_cloud servers |
||||||
|
_SERVERS = ['c++'] |
||||||
|
|
||||||
|
DOCKER_WORKDIR_ROOT = '/var/local/git/grpc' |
||||||
|
|
||||||
|
|
||||||
|
def docker_run_cmdline(cmdline, image, docker_args=[], cwd=None, environ=None): |
||||||
|
"""Wraps given cmdline array to create 'docker run' cmdline from it.""" |
||||||
|
docker_cmdline = ['docker', 'run', '-i', '--rm=true'] |
||||||
|
|
||||||
|
# turn environ into -e docker args |
||||||
|
if environ: |
||||||
|
for k, v in environ.iteritems(): |
||||||
|
docker_cmdline += ['-e', '%s=%s' % (k, v)] |
||||||
|
|
||||||
|
# set working directory |
||||||
|
workdir = DOCKER_WORKDIR_ROOT |
||||||
|
if cwd: |
||||||
|
workdir = os.path.join(workdir, cwd) |
||||||
|
docker_cmdline += ['-w', workdir] |
||||||
|
|
||||||
|
docker_cmdline += docker_args + [image] + cmdline |
||||||
|
return docker_cmdline |
||||||
|
|
||||||
|
|
||||||
|
def bash_login_cmdline(cmdline): |
||||||
|
"""Creates bash -l -c cmdline from args list.""" |
||||||
|
# Use login shell: |
||||||
|
# * rvm and nvm require it |
||||||
|
# * makes error messages clearer if executables are missing |
||||||
|
return ['bash', '-l', '-c', ' '.join(cmdline)] |
||||||
|
|
||||||
|
|
||||||
|
def _job_kill_handler(job): |
||||||
|
if job._spec.container_name: |
||||||
|
dockerjob.docker_kill(job._spec.container_name) |
||||||
|
# When the job times out and we decide to kill it, |
||||||
|
# we need to wait a before restarting the job |
||||||
|
# to prevent "container name already in use" error. |
||||||
|
# TODO(jtattermusch): figure out a cleaner way to to this. |
||||||
|
time.sleep(2) |
||||||
|
|
||||||
|
|
||||||
|
def cloud_to_cloud_jobspec(language, |
||||||
|
test_cases, |
||||||
|
server_addresses, |
||||||
|
test_duration_secs, |
||||||
|
num_channels_per_server, |
||||||
|
num_stubs_per_channel, |
||||||
|
metrics_port, |
||||||
|
docker_image=None): |
||||||
|
"""Creates jobspec for cloud-to-cloud interop test""" |
||||||
|
cmdline = bash_login_cmdline(language.client_cmd([ |
||||||
|
'--test_cases=%s' % test_cases, '--server_addresses=%s' % |
||||||
|
server_addresses, '--test_duration_secs=%s' % test_duration_secs, |
||||||
|
'--num_stubs_per_channel=%s' % num_stubs_per_channel, |
||||||
|
'--num_channels_per_server=%s' % num_channels_per_server, |
||||||
|
'--metrics_port=%s' % metrics_port |
||||||
|
])) |
||||||
|
print cmdline |
||||||
|
cwd = language.client_cwd |
||||||
|
environ = language.global_env() |
||||||
|
if docker_image: |
||||||
|
container_name = dockerjob.random_name('interop_client_%s' % |
||||||
|
language.safename) |
||||||
|
cmdline = docker_run_cmdline( |
||||||
|
cmdline, |
||||||
|
image=docker_image, |
||||||
|
environ=environ, |
||||||
|
cwd=cwd, |
||||||
|
docker_args=['--net=host', '--name', container_name]) |
||||||
|
cwd = None |
||||||
|
|
||||||
|
test_job = jobset.JobSpec(cmdline=cmdline, |
||||||
|
cwd=cwd, |
||||||
|
environ=environ, |
||||||
|
shortname='cloud_to_cloud:%s:%s_server:stress_test' % ( |
||||||
|
language, server_name), |
||||||
|
timeout_seconds=test_duration_secs * 2, |
||||||
|
flake_retries=0, |
||||||
|
timeout_retries=0, |
||||||
|
kill_handler=_job_kill_handler) |
||||||
|
test_job.container_name = container_name |
||||||
|
return test_job |
||||||
|
|
||||||
|
|
||||||
|
def server_jobspec(language, docker_image, test_duration_secs): |
||||||
|
"""Create jobspec for running a server""" |
||||||
|
container_name = dockerjob.random_name('interop_server_%s' % |
||||||
|
language.safename) |
||||||
|
cmdline = bash_login_cmdline(language.server_cmd(['--port=%s' % |
||||||
|
_DEFAULT_SERVER_PORT])) |
||||||
|
environ = language.global_env() |
||||||
|
docker_cmdline = docker_run_cmdline( |
||||||
|
cmdline, |
||||||
|
image=docker_image, |
||||||
|
cwd=language.server_cwd, |
||||||
|
environ=environ, |
||||||
|
docker_args=['-p', str(_DEFAULT_SERVER_PORT), '--name', container_name]) |
||||||
|
|
||||||
|
server_job = jobset.JobSpec(cmdline=docker_cmdline, |
||||||
|
environ=environ, |
||||||
|
shortname='interop_server_%s' % language, |
||||||
|
timeout_seconds=test_duration_secs * 3) |
||||||
|
server_job.container_name = container_name |
||||||
|
return server_job |
||||||
|
|
||||||
|
|
||||||
|
def build_interop_stress_image_jobspec(language, tag=None): |
||||||
|
"""Creates jobspec for building stress test docker image for a language""" |
||||||
|
if not tag: |
||||||
|
tag = 'grpc_interop_stress_%s:%s' % (language.safename, uuid.uuid4()) |
||||||
|
env = {'INTEROP_IMAGE': tag, |
||||||
|
'BASE_NAME': 'grpc_interop_stress_%s' % language.safename} |
||||||
|
build_job = jobset.JobSpec(cmdline=['tools/jenkins/build_interop_stress_image.sh'], |
||||||
|
environ=env, |
||||||
|
shortname='build_docker_%s' % (language), |
||||||
|
timeout_seconds=30 * 60) |
||||||
|
build_job.tag = tag |
||||||
|
return build_job |
||||||
|
|
||||||
|
argp = argparse.ArgumentParser(description='Run stress tests.') |
||||||
|
argp.add_argument('-l', |
||||||
|
'--language', |
||||||
|
choices=['all'] + sorted(_LANGUAGES), |
||||||
|
nargs='+', |
||||||
|
default=['all'], |
||||||
|
help='Clients to run.') |
||||||
|
argp.add_argument('-j', '--jobs', default=multiprocessing.cpu_count(), type=int) |
||||||
|
argp.add_argument( |
||||||
|
'-s', |
||||||
|
'--server', |
||||||
|
choices=['all'] + sorted(_SERVERS), |
||||||
|
action='append', |
||||||
|
help='Run cloud_to_cloud servers in a separate docker ' + 'image.', |
||||||
|
default=[]) |
||||||
|
argp.add_argument( |
||||||
|
'--override_server', |
||||||
|
action='append', |
||||||
|
type=lambda kv: kv.split('='), |
||||||
|
help= |
||||||
|
'Use servername=HOST:PORT to explicitly specify a server. E.g. ' |
||||||
|
'csharp=localhost:50000', |
||||||
|
default=[]) |
||||||
|
argp.add_argument('--test_duration_secs', |
||||||
|
help='The duration of the test in seconds', |
||||||
|
default=_DEFAULT_TEST_DURATION_SECS) |
||||||
|
|
||||||
|
args = argp.parse_args() |
||||||
|
|
||||||
|
servers = set( |
||||||
|
s |
||||||
|
for s in itertools.chain.from_iterable(_SERVERS if x == 'all' else [x] |
||||||
|
for x in args.server)) |
||||||
|
|
||||||
|
languages = set(_LANGUAGES[l] |
||||||
|
for l in itertools.chain.from_iterable(_LANGUAGES.iterkeys( |
||||||
|
) if x == 'all' else [x] for x in args.language)) |
||||||
|
|
||||||
|
docker_images = {} |
||||||
|
# languages for which to build docker images |
||||||
|
languages_to_build = set( |
||||||
|
_LANGUAGES[k] |
||||||
|
for k in set([str(l) for l in languages] + [s for s in servers])) |
||||||
|
build_jobs = [] |
||||||
|
for l in languages_to_build: |
||||||
|
job = build_interop_stress_image_jobspec(l) |
||||||
|
docker_images[str(l)] = job.tag |
||||||
|
build_jobs.append(job) |
||||||
|
|
||||||
|
if build_jobs: |
||||||
|
jobset.message('START', 'Building interop docker images.', do_newline=True) |
||||||
|
num_failures, _ = jobset.run(build_jobs, |
||||||
|
newline_on_success=True, |
||||||
|
maxjobs=args.jobs) |
||||||
|
if num_failures == 0: |
||||||
|
jobset.message('SUCCESS', |
||||||
|
'All docker images built successfully.', |
||||||
|
do_newline=True) |
||||||
|
else: |
||||||
|
jobset.message('FAILED', |
||||||
|
'Failed to build interop docker images.', |
||||||
|
do_newline=True) |
||||||
|
for image in docker_images.itervalues(): |
||||||
|
dockerjob.remove_image(image, skip_nonexistent=True) |
||||||
|
sys.exit(1) |
||||||
|
|
||||||
|
# Start interop servers. |
||||||
|
server_jobs = {} |
||||||
|
server_addresses = {} |
||||||
|
try: |
||||||
|
for s in servers: |
||||||
|
lang = str(s) |
||||||
|
spec = server_jobspec(_LANGUAGES[lang], docker_images.get(lang), args.test_duration_secs) |
||||||
|
job = dockerjob.DockerJob(spec) |
||||||
|
server_jobs[lang] = job |
||||||
|
server_addresses[lang] = ('localhost', |
||||||
|
job.mapped_port(_DEFAULT_SERVER_PORT)) |
||||||
|
|
||||||
|
jobs = [] |
||||||
|
|
||||||
|
for server in args.override_server: |
||||||
|
server_name = server[0] |
||||||
|
(server_host, server_port) = server[1].split(':') |
||||||
|
server_addresses[server_name] = (server_host, server_port) |
||||||
|
|
||||||
|
for server_name, server_address in server_addresses.iteritems(): |
||||||
|
(server_host, server_port) = server_address |
||||||
|
for language in languages: |
||||||
|
test_job = cloud_to_cloud_jobspec( |
||||||
|
language, |
||||||
|
_DEFAULT_TEST_CASES, |
||||||
|
('%s:%s' % (server_host, server_port)), |
||||||
|
args.test_duration_secs, |
||||||
|
_DEFAULT_NUM_CHANNELS_PER_SERVER, |
||||||
|
_DEFAULT_NUM_STUBS_PER_CHANNEL, |
||||||
|
_DEFAULT_METRICS_PORT, |
||||||
|
docker_image=docker_images.get(str(language))) |
||||||
|
jobs.append(test_job) |
||||||
|
|
||||||
|
if not jobs: |
||||||
|
print 'No jobs to run.' |
||||||
|
for image in docker_images.itervalues(): |
||||||
|
dockerjob.remove_image(image, skip_nonexistent=True) |
||||||
|
sys.exit(1) |
||||||
|
|
||||||
|
num_failures, resultset = jobset.run(jobs, |
||||||
|
newline_on_success=True, |
||||||
|
maxjobs=args.jobs) |
||||||
|
if num_failures: |
||||||
|
jobset.message('FAILED', 'Some tests failed', do_newline=True) |
||||||
|
else: |
||||||
|
jobset.message('SUCCESS', 'All tests passed', do_newline=True) |
||||||
|
|
||||||
|
finally: |
||||||
|
# Check if servers are still running. |
||||||
|
for server, job in server_jobs.iteritems(): |
||||||
|
if not job.is_running(): |
||||||
|
print 'Server "%s" has exited prematurely.' % server |
||||||
|
|
||||||
|
dockerjob.finish_jobs([j for j in server_jobs.itervalues()]) |
||||||
|
|
||||||
|
for image in docker_images.itervalues(): |
||||||
|
print 'Removing docker image %s' % image |
||||||
|
dockerjob.remove_image(image) |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue