Merge github.com:grpc/grpc into fix-c++

pull/4921/head
Craig Tiller 9 years ago
commit 324426b654
  1. 71
      Makefile
  2. 385
      binding.gyp
  3. 2
      build.yaml
  4. 1
      include/grpc++/client_context.h
  5. 4
      include/grpc++/server.h
  6. 441
      package.json
  7. 4
      src/core/census/initialize.c
  8. 4
      src/core/client_config/lb_policies/pick_first.c
  9. 9
      src/core/client_config/subchannel.c
  10. 6
      src/core/surface/init.c
  11. 2
      src/core/surface/version.c
  12. 3
      src/cpp/client/client_context.cc
  13. 19
      src/cpp/server/server.cc
  14. 4
      src/cpp/util/byte_buffer.cc
  15. 2
      src/csharp/Grpc.Core/VersionInfo.cs
  16. 4
      src/node/ext/byte_buffer.cc
  17. 4
      src/node/index.js
  18. 4
      src/node/src/client.js
  19. 4
      src/node/src/credentials.js
  20. 40
      src/node/src/grpc_extension.js
  21. 2
      src/node/src/metadata.js
  22. 4
      src/node/src/server.js
  23. 4
      src/node/test/call_test.js
  24. 4
      src/node/test/channel_test.js
  25. 4
      src/node/test/constant_test.js
  26. 4
      src/node/test/end_to_end_test.js
  27. 4
      src/node/test/server_test.js
  28. 14
      src/node/test/surface_test.js
  29. 3
      src/proto/grpc/testing/control.proto
  30. 7
      src/python/grpcio/grpc/framework/foundation/logging_pool.py
  31. 26
      src/python/grpcio/tests/unit/framework/foundation/_logging_pool_test.py
  32. 50
      src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py
  33. 55
      src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py
  34. 6
      src/python/grpcio/tests/unit/framework/interfaces/face/_receiver.py
  35. 6
      src/ruby/ext/grpc/rb_call.c
  36. 2
      src/ruby/ext/grpc/rb_call_credentials.c
  37. 3
      src/ruby/ext/grpc/rb_event_thread.c
  38. 71
      templates/Makefile.template
  39. 78
      templates/binding.gyp.template
  40. 14
      templates/package.json.template
  41. 2
      templates/src/core/surface/version.c.template
  42. 2
      templates/src/csharp/Grpc.Core/VersionInfo.cs.template
  43. 6
      test/cpp/qps/driver.cc
  44. 2
      test/cpp/qps/generic_async_streaming_ping_pong_test.cc
  45. 4
      test/cpp/qps/qps_driver.cc
  46. 24
      test/cpp/qps/qps_worker.cc
  47. 1
      test/cpp/qps/server.h
  48. 2
      test/cpp/qps/server_async.cc
  49. 3
      tools/buildgen/generate_projects.py
  50. 0
      tools/dockerfile/grpc_artifact_linux_x64/Dockerfile
  51. 0
      tools/dockerfile/grpc_artifact_linux_x86/Dockerfile
  52. 2
      tools/dockerfile/grpc_interop_csharp/Dockerfile
  53. 0
      tools/dockerfile/grpc_interop_csharp/build_interop.sh
  54. 0
      tools/dockerfile/grpc_interop_cxx/Dockerfile
  55. 2
      tools/dockerfile/grpc_interop_cxx/build_interop.sh
  56. 2
      tools/dockerfile/grpc_interop_go/Dockerfile
  57. 2
      tools/dockerfile/grpc_interop_go/build_interop.sh
  58. 2
      tools/dockerfile/grpc_interop_http2/Dockerfile
  59. 2
      tools/dockerfile/grpc_interop_http2/build_interop.sh
  60. 2
      tools/dockerfile/grpc_interop_java/Dockerfile
  61. 2
      tools/dockerfile/grpc_interop_java/build_interop.sh
  62. 2
      tools/dockerfile/grpc_interop_node/Dockerfile
  63. 4
      tools/dockerfile/grpc_interop_node/build_interop.sh
  64. 2
      tools/dockerfile/grpc_interop_php/Dockerfile
  65. 2
      tools/dockerfile/grpc_interop_php/build_interop.sh
  66. 2
      tools/dockerfile/grpc_interop_python/Dockerfile
  67. 2
      tools/dockerfile/grpc_interop_python/build_interop.sh
  68. 2
      tools/dockerfile/grpc_interop_ruby/Dockerfile
  69. 2
      tools/dockerfile/grpc_interop_ruby/build_interop.sh
  70. 2
      tools/dockerfile/grpc_interop_stress_cxx/Dockerfile
  71. 0
      tools/dockerfile/grpc_interop_stress_cxx/build_interop_stress.sh
  72. 0
      tools/dockerfile/grpc_jenkins_slave_x64/Dockerfile
  73. 0
      tools/dockerfile/grpc_jenkins_slave_x86/Dockerfile
  74. 2
      tools/dockerfile/grpc_linuxbrew/Dockerfile
  75. 12
      tools/jenkins/build_docker_and_run_tests.sh
  76. 6
      tools/jenkins/build_interop_image.sh
  77. 6
      tools/jenkins/build_interop_stress_image.sh
  78. 6
      tools/jenkins/run_distribution.sh
  79. 44
      tools/jenkins/run_jenkins.sh
  80. 5
      tools/jenkins/run_portability.sh
  81. 2
      tools/run_tests/build_artifacts.py
  82. 4
      tools/run_tests/build_node.sh
  83. 4
      tools/run_tests/run_node.sh
  84. 112
      tools/run_tests/run_tests.py
  85. 4
      tools/run_tests/sanity_tests.yaml
  86. 2
      tools/tsan_suppressions.txt

@ -226,26 +226,44 @@ DEFINES_mutrace = _DEBUG DEBUG
prefix ?= /usr/local prefix ?= /usr/local
PROTOC = protoc PROTOC ?= protoc
DTRACE = dtrace DTRACE ?= dtrace
CONFIG ?= opt CONFIG ?= opt
# Doing X ?= Y is the same as:
# ifeq ($(origin X), undefined)
# X = Y
# endif
# but some variables, such as CC, CXX, LD or AR, have defaults.
# So instead of using ?= on them, we need to check their origin.
# See:
# https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
# https://www.gnu.org/software/make/manual/html_node/Flavors.html#index-_003f_003d
# https://www.gnu.org/software/make/manual/html_node/Origin-Function.html
ifeq ($(origin CC), default)
CC = $(CC_$(CONFIG)) CC = $(CC_$(CONFIG))
endif
ifeq ($(origin CXX), default)
CXX = $(CXX_$(CONFIG)) CXX = $(CXX_$(CONFIG))
endif
ifeq ($(origin LD), default)
LD = $(LD_$(CONFIG)) LD = $(LD_$(CONFIG))
LDXX = $(LDXX_$(CONFIG)) endif
LDXX ?= $(LDXX_$(CONFIG))
ifeq ($(origin AR), default)
AR = ar AR = ar
endif
ifeq ($(SYSTEM),Linux) ifeq ($(SYSTEM),Linux)
STRIP = strip --strip-unneeded STRIP ?= strip --strip-unneeded
else else
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
STRIP = strip -x STRIP ?= strip -x
else else
STRIP = strip STRIP ?= strip
endif endif
endif endif
INSTALL = install INSTALL ?= install
RM = rm -f RM ?= rm -f
PKG_CONFIG = pkg-config PKG_CONFIG ?= pkg-config
ifndef VALID_CONFIG_$(CONFIG) ifndef VALID_CONFIG_$(CONFIG)
$(error Invalid CONFIG value '$(CONFIG)') $(error Invalid CONFIG value '$(CONFIG)')
@ -261,15 +279,21 @@ endif
CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc
HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false) HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false)
CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD = $(CC) -std=c99 -Werror -Wno-shift-negative-value -o $(TMPOUT) -c test/build/empty.c
HAS_NO_SHIFT_NEGATIVE_VALUE = $(shell $(CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD) 2> /dev/null && echo true || echo false)
ifeq ($(HAS_NO_SHIFT_NEGATIVE_VALUE),true)
W_NO_SHIFT_NEGATIVE_VALUE=-Wno-shift-negative-value
endif
# The HOST compiler settings are used to compile the protoc plugins. # The HOST compiler settings are used to compile the protoc plugins.
# In most cases, you won't have to change anything, but if you are # In most cases, you won't have to change anything, but if you are
# cross-compiling, you can override these variables from GNU make's # cross-compiling, you can override these variables from GNU make's
# command line: make CC=cross-gcc HOST_CC=gcc # command line: make CC=cross-gcc HOST_CC=gcc
HOST_CC = $(CC) HOST_CC ?= $(CC)
HOST_CXX = $(CXX) HOST_CXX ?= $(CXX)
HOST_LD = $(LD) HOST_LD ?= $(LD)
HOST_LDXX = $(LDXX) HOST_LDXX ?= $(LDXX)
ifdef EXTRA_DEFINES ifdef EXTRA_DEFINES
DEFINES += $(EXTRA_DEFINES) DEFINES += $(EXTRA_DEFINES)
@ -400,14 +424,6 @@ else
IS_GIT_FOLDER = true IS_GIT_FOLDER = true
endif endif
ifeq ($(SYSTEM),Linux)
OPENSSL_REQUIRES_DL = true
endif
ifeq ($(SYSTEM),Darwin)
OPENSSL_REQUIRES_DL = true
endif
ifeq ($(HAS_PKG_CONFIG),true) ifeq ($(HAS_PKG_CONFIG),true)
OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl
OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl
@ -426,11 +442,6 @@ OPENSSL_NPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/open
ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS)
PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS)
ifeq ($(OPENSSL_REQUIRES_DL),true)
OPENSSL_ALPN_CHECK_CMD += -ldl
OPENSSL_NPN_CHECK_CMD += -ldl
endif
endif # HAS_PKG_CONFIG endif # HAS_PKG_CONFIG
PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS) PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS)
@ -594,9 +605,6 @@ OPENSSL_DEP += $(LIBDIR)/$(CONFIG)/libboringssl.a
OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/libboringssl.a OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/libboringssl.a
# need to prefix these to ensure overriding system libraries # need to prefix these to ensure overriding system libraries
CPPFLAGS := -Ithird_party/boringssl/include $(CPPFLAGS) CPPFLAGS := -Ithird_party/boringssl/include $(CPPFLAGS)
ifeq ($(OPENSSL_REQUIRES_DL),true)
LIBS_SECURE = dl
endif # OPENSSL_REQUIRES_DL
else # EMBED_OPENSSL=false else # EMBED_OPENSSL=false
ifeq ($(HAS_PKG_CONFIG),true) ifeq ($(HAS_PKG_CONFIG),true)
OPENSSL_PKG_CONFIG = true OPENSSL_PKG_CONFIG = true
@ -616,10 +624,7 @@ ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true)
CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0
LIBS_SECURE = $(OPENSSL_LIBS) LIBS_SECURE = $(OPENSSL_LIBS)
endif # HAS_SYSTEM_OPENSSL_NPN endif # HAS_SYSTEM_OPENSSL_NPN
ifeq ($(OPENSSL_REQUIRES_DL),true)
LIBS_SECURE += dl
PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE))
endif # OPENSSL_REQUIRES_DL=true
endif # EMBED_OPENSSL endif # EMBED_OPENSSL
endif # NO_SECURE endif # NO_SECURE
@ -5486,7 +5491,7 @@ LIBZ_SRC = \
LIBZ_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBZ_SRC)))) LIBZ_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBZ_SRC))))
$(LIBZ_OBJS): CFLAGS := $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration -fvisibility=hidden $(LIBZ_OBJS): CFLAGS := $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration $(W_NO_SHIFT_NEGATIVE_VALUE) -fvisibility=hidden
$(LIBDIR)/$(CONFIG)/libz.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(LIBZ_OBJS) $(LIBDIR)/$(CONFIG)/libz.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(LIBZ_OBJS)
$(E) "[AR] Creating $@" $(E) "[AR] Creating $@"

@ -5,7 +5,7 @@
# This file can be regenerated from the template by running # This file can be regenerated from the template by running
# tools/buildgen/generate_projects.sh # tools/buildgen/generate_projects.sh
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -54,12 +54,16 @@
], ],
'include_dirs': [ 'include_dirs': [
'.', '.',
'include', 'include'
],
'conditions': [
['OS == "win"', {
"include_dirs": [ "third_party/boringssl/include" ]
}, {
'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include', '<(node_root_dir)/deps/openssl/openssl/include',
'<(node_root_dir)/deps/zlib' '<(node_root_dir)/deps/zlib'
], ],
'conditions': [
['OS != "win"', {
'conditions': [ 'conditions': [
['config=="gcov"', { ['config=="gcov"', {
'cflags': [ 'cflags': [
@ -72,9 +76,7 @@
'-fprofile-arcs' '-fprofile-arcs'
] ]
} }
] ],
]
}],
["target_arch=='ia32'", { ["target_arch=='ia32'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ]
}], }],
@ -85,7 +87,355 @@
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ]
}] }]
] ]
}]
]
}, },
'conditions': [
['OS == "win"', {
'targets': [
# Only want to compile BoringSSL and zlib under Windows
{
'cflags': [
'-std=c99',
'-Wall',
'-Werror'
],
'target_name': 'boringssl',
'product_prefix': 'lib',
'type': 'static_library',
'dependencies': [
],
'sources': [
'src/boringssl/err_data.c',
'third_party/boringssl/crypto/aes/aes.c',
'third_party/boringssl/crypto/aes/mode_wrappers.c',
'third_party/boringssl/crypto/asn1/a_bitstr.c',
'third_party/boringssl/crypto/asn1/a_bool.c',
'third_party/boringssl/crypto/asn1/a_bytes.c',
'third_party/boringssl/crypto/asn1/a_d2i_fp.c',
'third_party/boringssl/crypto/asn1/a_dup.c',
'third_party/boringssl/crypto/asn1/a_enum.c',
'third_party/boringssl/crypto/asn1/a_gentm.c',
'third_party/boringssl/crypto/asn1/a_i2d_fp.c',
'third_party/boringssl/crypto/asn1/a_int.c',
'third_party/boringssl/crypto/asn1/a_mbstr.c',
'third_party/boringssl/crypto/asn1/a_object.c',
'third_party/boringssl/crypto/asn1/a_octet.c',
'third_party/boringssl/crypto/asn1/a_print.c',
'third_party/boringssl/crypto/asn1/a_strnid.c',
'third_party/boringssl/crypto/asn1/a_time.c',
'third_party/boringssl/crypto/asn1/a_type.c',
'third_party/boringssl/crypto/asn1/a_utctm.c',
'third_party/boringssl/crypto/asn1/a_utf8.c',
'third_party/boringssl/crypto/asn1/asn1_lib.c',
'third_party/boringssl/crypto/asn1/asn1_par.c',
'third_party/boringssl/crypto/asn1/asn_pack.c',
'third_party/boringssl/crypto/asn1/bio_asn1.c',
'third_party/boringssl/crypto/asn1/bio_ndef.c',
'third_party/boringssl/crypto/asn1/f_enum.c',
'third_party/boringssl/crypto/asn1/f_int.c',
'third_party/boringssl/crypto/asn1/f_string.c',
'third_party/boringssl/crypto/asn1/t_bitst.c',
'third_party/boringssl/crypto/asn1/t_pkey.c',
'third_party/boringssl/crypto/asn1/tasn_dec.c',
'third_party/boringssl/crypto/asn1/tasn_enc.c',
'third_party/boringssl/crypto/asn1/tasn_fre.c',
'third_party/boringssl/crypto/asn1/tasn_new.c',
'third_party/boringssl/crypto/asn1/tasn_prn.c',
'third_party/boringssl/crypto/asn1/tasn_typ.c',
'third_party/boringssl/crypto/asn1/tasn_utl.c',
'third_party/boringssl/crypto/asn1/x_bignum.c',
'third_party/boringssl/crypto/asn1/x_long.c',
'third_party/boringssl/crypto/base64/base64.c',
'third_party/boringssl/crypto/bio/bio.c',
'third_party/boringssl/crypto/bio/bio_mem.c',
'third_party/boringssl/crypto/bio/buffer.c',
'third_party/boringssl/crypto/bio/connect.c',
'third_party/boringssl/crypto/bio/fd.c',
'third_party/boringssl/crypto/bio/file.c',
'third_party/boringssl/crypto/bio/hexdump.c',
'third_party/boringssl/crypto/bio/pair.c',
'third_party/boringssl/crypto/bio/printf.c',
'third_party/boringssl/crypto/bio/socket.c',
'third_party/boringssl/crypto/bio/socket_helper.c',
'third_party/boringssl/crypto/bn/add.c',
'third_party/boringssl/crypto/bn/asm/x86_64-gcc.c',
'third_party/boringssl/crypto/bn/bn.c',
'third_party/boringssl/crypto/bn/bn_asn1.c',
'third_party/boringssl/crypto/bn/cmp.c',
'third_party/boringssl/crypto/bn/convert.c',
'third_party/boringssl/crypto/bn/ctx.c',
'third_party/boringssl/crypto/bn/div.c',
'third_party/boringssl/crypto/bn/exponentiation.c',
'third_party/boringssl/crypto/bn/gcd.c',
'third_party/boringssl/crypto/bn/generic.c',
'third_party/boringssl/crypto/bn/kronecker.c',
'third_party/boringssl/crypto/bn/montgomery.c',
'third_party/boringssl/crypto/bn/mul.c',
'third_party/boringssl/crypto/bn/prime.c',
'third_party/boringssl/crypto/bn/random.c',
'third_party/boringssl/crypto/bn/rsaz_exp.c',
'third_party/boringssl/crypto/bn/shift.c',
'third_party/boringssl/crypto/bn/sqrt.c',
'third_party/boringssl/crypto/buf/buf.c',
'third_party/boringssl/crypto/bytestring/ber.c',
'third_party/boringssl/crypto/bytestring/cbb.c',
'third_party/boringssl/crypto/bytestring/cbs.c',
'third_party/boringssl/crypto/chacha/chacha_generic.c',
'third_party/boringssl/crypto/chacha/chacha_vec.c',
'third_party/boringssl/crypto/cipher/aead.c',
'third_party/boringssl/crypto/cipher/cipher.c',
'third_party/boringssl/crypto/cipher/derive_key.c',
'third_party/boringssl/crypto/cipher/e_aes.c',
'third_party/boringssl/crypto/cipher/e_chacha20poly1305.c',
'third_party/boringssl/crypto/cipher/e_des.c',
'third_party/boringssl/crypto/cipher/e_null.c',
'third_party/boringssl/crypto/cipher/e_rc2.c',
'third_party/boringssl/crypto/cipher/e_rc4.c',
'third_party/boringssl/crypto/cipher/e_ssl3.c',
'third_party/boringssl/crypto/cipher/e_tls.c',
'third_party/boringssl/crypto/cipher/tls_cbc.c',
'third_party/boringssl/crypto/cmac/cmac.c',
'third_party/boringssl/crypto/conf/conf.c',
'third_party/boringssl/crypto/cpu-arm.c',
'third_party/boringssl/crypto/cpu-intel.c',
'third_party/boringssl/crypto/crypto.c',
'third_party/boringssl/crypto/curve25519/curve25519.c',
'third_party/boringssl/crypto/des/des.c',
'third_party/boringssl/crypto/dh/check.c',
'third_party/boringssl/crypto/dh/dh.c',
'third_party/boringssl/crypto/dh/dh_asn1.c',
'third_party/boringssl/crypto/dh/params.c',
'third_party/boringssl/crypto/digest/digest.c',
'third_party/boringssl/crypto/digest/digests.c',
'third_party/boringssl/crypto/directory_posix.c',
'third_party/boringssl/crypto/directory_win.c',
'third_party/boringssl/crypto/dsa/dsa.c',
'third_party/boringssl/crypto/dsa/dsa_asn1.c',
'third_party/boringssl/crypto/ec/ec.c',
'third_party/boringssl/crypto/ec/ec_asn1.c',
'third_party/boringssl/crypto/ec/ec_key.c',
'third_party/boringssl/crypto/ec/ec_montgomery.c',
'third_party/boringssl/crypto/ec/oct.c',
'third_party/boringssl/crypto/ec/p224-64.c',
'third_party/boringssl/crypto/ec/p256-64.c',
'third_party/boringssl/crypto/ec/p256-x86_64.c',
'third_party/boringssl/crypto/ec/simple.c',
'third_party/boringssl/crypto/ec/util-64.c',
'third_party/boringssl/crypto/ec/wnaf.c',
'third_party/boringssl/crypto/ecdh/ecdh.c',
'third_party/boringssl/crypto/ecdsa/ecdsa.c',
'third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c',
'third_party/boringssl/crypto/engine/engine.c',
'third_party/boringssl/crypto/err/err.c',
'third_party/boringssl/crypto/evp/algorithm.c',
'third_party/boringssl/crypto/evp/digestsign.c',
'third_party/boringssl/crypto/evp/evp.c',
'third_party/boringssl/crypto/evp/evp_asn1.c',
'third_party/boringssl/crypto/evp/evp_ctx.c',
'third_party/boringssl/crypto/evp/p_dsa_asn1.c',
'third_party/boringssl/crypto/evp/p_ec.c',
'third_party/boringssl/crypto/evp/p_ec_asn1.c',
'third_party/boringssl/crypto/evp/p_rsa.c',
'third_party/boringssl/crypto/evp/p_rsa_asn1.c',
'third_party/boringssl/crypto/evp/pbkdf.c',
'third_party/boringssl/crypto/evp/sign.c',
'third_party/boringssl/crypto/ex_data.c',
'third_party/boringssl/crypto/hkdf/hkdf.c',
'third_party/boringssl/crypto/hmac/hmac.c',
'third_party/boringssl/crypto/lhash/lhash.c',
'third_party/boringssl/crypto/md4/md4.c',
'third_party/boringssl/crypto/md5/md5.c',
'third_party/boringssl/crypto/mem.c',
'third_party/boringssl/crypto/modes/cbc.c',
'third_party/boringssl/crypto/modes/cfb.c',
'third_party/boringssl/crypto/modes/ctr.c',
'third_party/boringssl/crypto/modes/gcm.c',
'third_party/boringssl/crypto/modes/ofb.c',
'third_party/boringssl/crypto/obj/obj.c',
'third_party/boringssl/crypto/obj/obj_xref.c',
'third_party/boringssl/crypto/pem/pem_all.c',
'third_party/boringssl/crypto/pem/pem_info.c',
'third_party/boringssl/crypto/pem/pem_lib.c',
'third_party/boringssl/crypto/pem/pem_oth.c',
'third_party/boringssl/crypto/pem/pem_pk8.c',
'third_party/boringssl/crypto/pem/pem_pkey.c',
'third_party/boringssl/crypto/pem/pem_x509.c',
'third_party/boringssl/crypto/pem/pem_xaux.c',
'third_party/boringssl/crypto/pkcs8/p5_pbe.c',
'third_party/boringssl/crypto/pkcs8/p5_pbev2.c',
'third_party/boringssl/crypto/pkcs8/p8_pkey.c',
'third_party/boringssl/crypto/pkcs8/pkcs8.c',
'third_party/boringssl/crypto/poly1305/poly1305.c',
'third_party/boringssl/crypto/poly1305/poly1305_arm.c',
'third_party/boringssl/crypto/poly1305/poly1305_vec.c',
'third_party/boringssl/crypto/rand/rand.c',
'third_party/boringssl/crypto/rand/urandom.c',
'third_party/boringssl/crypto/rand/windows.c',
'third_party/boringssl/crypto/rc4/rc4.c',
'third_party/boringssl/crypto/refcount_c11.c',
'third_party/boringssl/crypto/refcount_lock.c',
'third_party/boringssl/crypto/rsa/blinding.c',
'third_party/boringssl/crypto/rsa/padding.c',
'third_party/boringssl/crypto/rsa/rsa.c',
'third_party/boringssl/crypto/rsa/rsa_asn1.c',
'third_party/boringssl/crypto/rsa/rsa_impl.c',
'third_party/boringssl/crypto/sha/sha1.c',
'third_party/boringssl/crypto/sha/sha256.c',
'third_party/boringssl/crypto/sha/sha512.c',
'third_party/boringssl/crypto/stack/stack.c',
'third_party/boringssl/crypto/thread.c',
'third_party/boringssl/crypto/thread_none.c',
'third_party/boringssl/crypto/thread_pthread.c',
'third_party/boringssl/crypto/thread_win.c',
'third_party/boringssl/crypto/time_support.c',
'third_party/boringssl/crypto/x509/a_digest.c',
'third_party/boringssl/crypto/x509/a_sign.c',
'third_party/boringssl/crypto/x509/a_strex.c',
'third_party/boringssl/crypto/x509/a_verify.c',
'third_party/boringssl/crypto/x509/asn1_gen.c',
'third_party/boringssl/crypto/x509/by_dir.c',
'third_party/boringssl/crypto/x509/by_file.c',
'third_party/boringssl/crypto/x509/i2d_pr.c',
'third_party/boringssl/crypto/x509/pkcs7.c',
'third_party/boringssl/crypto/x509/t_crl.c',
'third_party/boringssl/crypto/x509/t_req.c',
'third_party/boringssl/crypto/x509/t_x509.c',
'third_party/boringssl/crypto/x509/t_x509a.c',
'third_party/boringssl/crypto/x509/x509.c',
'third_party/boringssl/crypto/x509/x509_att.c',
'third_party/boringssl/crypto/x509/x509_cmp.c',
'third_party/boringssl/crypto/x509/x509_d2.c',
'third_party/boringssl/crypto/x509/x509_def.c',
'third_party/boringssl/crypto/x509/x509_ext.c',
'third_party/boringssl/crypto/x509/x509_lu.c',
'third_party/boringssl/crypto/x509/x509_obj.c',
'third_party/boringssl/crypto/x509/x509_r2x.c',
'third_party/boringssl/crypto/x509/x509_req.c',
'third_party/boringssl/crypto/x509/x509_set.c',
'third_party/boringssl/crypto/x509/x509_trs.c',
'third_party/boringssl/crypto/x509/x509_txt.c',
'third_party/boringssl/crypto/x509/x509_v3.c',
'third_party/boringssl/crypto/x509/x509_vfy.c',
'third_party/boringssl/crypto/x509/x509_vpm.c',
'third_party/boringssl/crypto/x509/x509cset.c',
'third_party/boringssl/crypto/x509/x509name.c',
'third_party/boringssl/crypto/x509/x509rset.c',
'third_party/boringssl/crypto/x509/x509spki.c',
'third_party/boringssl/crypto/x509/x509type.c',
'third_party/boringssl/crypto/x509/x_algor.c',
'third_party/boringssl/crypto/x509/x_all.c',
'third_party/boringssl/crypto/x509/x_attrib.c',
'third_party/boringssl/crypto/x509/x_crl.c',
'third_party/boringssl/crypto/x509/x_exten.c',
'third_party/boringssl/crypto/x509/x_info.c',
'third_party/boringssl/crypto/x509/x_name.c',
'third_party/boringssl/crypto/x509/x_pkey.c',
'third_party/boringssl/crypto/x509/x_pubkey.c',
'third_party/boringssl/crypto/x509/x_req.c',
'third_party/boringssl/crypto/x509/x_sig.c',
'third_party/boringssl/crypto/x509/x_spki.c',
'third_party/boringssl/crypto/x509/x_val.c',
'third_party/boringssl/crypto/x509/x_x509.c',
'third_party/boringssl/crypto/x509/x_x509a.c',
'third_party/boringssl/crypto/x509v3/pcy_cache.c',
'third_party/boringssl/crypto/x509v3/pcy_data.c',
'third_party/boringssl/crypto/x509v3/pcy_lib.c',
'third_party/boringssl/crypto/x509v3/pcy_map.c',
'third_party/boringssl/crypto/x509v3/pcy_node.c',
'third_party/boringssl/crypto/x509v3/pcy_tree.c',
'third_party/boringssl/crypto/x509v3/v3_akey.c',
'third_party/boringssl/crypto/x509v3/v3_akeya.c',
'third_party/boringssl/crypto/x509v3/v3_alt.c',
'third_party/boringssl/crypto/x509v3/v3_bcons.c',
'third_party/boringssl/crypto/x509v3/v3_bitst.c',
'third_party/boringssl/crypto/x509v3/v3_conf.c',
'third_party/boringssl/crypto/x509v3/v3_cpols.c',
'third_party/boringssl/crypto/x509v3/v3_crld.c',
'third_party/boringssl/crypto/x509v3/v3_enum.c',
'third_party/boringssl/crypto/x509v3/v3_extku.c',
'third_party/boringssl/crypto/x509v3/v3_genn.c',
'third_party/boringssl/crypto/x509v3/v3_ia5.c',
'third_party/boringssl/crypto/x509v3/v3_info.c',
'third_party/boringssl/crypto/x509v3/v3_int.c',
'third_party/boringssl/crypto/x509v3/v3_lib.c',
'third_party/boringssl/crypto/x509v3/v3_ncons.c',
'third_party/boringssl/crypto/x509v3/v3_pci.c',
'third_party/boringssl/crypto/x509v3/v3_pcia.c',
'third_party/boringssl/crypto/x509v3/v3_pcons.c',
'third_party/boringssl/crypto/x509v3/v3_pku.c',
'third_party/boringssl/crypto/x509v3/v3_pmaps.c',
'third_party/boringssl/crypto/x509v3/v3_prn.c',
'third_party/boringssl/crypto/x509v3/v3_purp.c',
'third_party/boringssl/crypto/x509v3/v3_skey.c',
'third_party/boringssl/crypto/x509v3/v3_sxnet.c',
'third_party/boringssl/crypto/x509v3/v3_utl.c',
'third_party/boringssl/ssl/custom_extensions.c',
'third_party/boringssl/ssl/d1_both.c',
'third_party/boringssl/ssl/d1_clnt.c',
'third_party/boringssl/ssl/d1_lib.c',
'third_party/boringssl/ssl/d1_meth.c',
'third_party/boringssl/ssl/d1_pkt.c',
'third_party/boringssl/ssl/d1_srtp.c',
'third_party/boringssl/ssl/d1_srvr.c',
'third_party/boringssl/ssl/dtls_record.c',
'third_party/boringssl/ssl/pqueue/pqueue.c',
'third_party/boringssl/ssl/s3_both.c',
'third_party/boringssl/ssl/s3_clnt.c',
'third_party/boringssl/ssl/s3_enc.c',
'third_party/boringssl/ssl/s3_lib.c',
'third_party/boringssl/ssl/s3_meth.c',
'third_party/boringssl/ssl/s3_pkt.c',
'third_party/boringssl/ssl/s3_srvr.c',
'third_party/boringssl/ssl/ssl_aead_ctx.c',
'third_party/boringssl/ssl/ssl_asn1.c',
'third_party/boringssl/ssl/ssl_buffer.c',
'third_party/boringssl/ssl/ssl_cert.c',
'third_party/boringssl/ssl/ssl_cipher.c',
'third_party/boringssl/ssl/ssl_file.c',
'third_party/boringssl/ssl/ssl_lib.c',
'third_party/boringssl/ssl/ssl_rsa.c',
'third_party/boringssl/ssl/ssl_session.c',
'third_party/boringssl/ssl/ssl_stat.c',
'third_party/boringssl/ssl/t1_enc.c',
'third_party/boringssl/ssl/t1_lib.c',
'third_party/boringssl/ssl/tls_record.c',
],
"include_dirs": [ "third_party/boringssl/include" ]
},
{
'cflags': [
'-std=c99',
'-Wall',
'-Werror'
],
'target_name': 'z',
'product_prefix': 'lib',
'type': 'static_library',
'dependencies': [
],
'sources': [
'third_party/zlib/adler32.c',
'third_party/zlib/compress.c',
'third_party/zlib/crc32.c',
'third_party/zlib/deflate.c',
'third_party/zlib/gzclose.c',
'third_party/zlib/gzlib.c',
'third_party/zlib/gzread.c',
'third_party/zlib/gzwrite.c',
'third_party/zlib/infback.c',
'third_party/zlib/inffast.c',
'third_party/zlib/inflate.c',
'third_party/zlib/inftrees.c',
'third_party/zlib/trees.c',
'third_party/zlib/uncompr.c',
'third_party/zlib/zutil.c',
],
"include_dirs": [ "third_party/boringssl/include" ]
},
]
}]
],
'targets': [ 'targets': [
{ {
'cflags': [ 'cflags': [
@ -147,7 +497,7 @@
'MACOSX_DEPLOYMENT_TARGET': '10.9' 'MACOSX_DEPLOYMENT_TARGET': '10.9'
} }
}] }]
], ]
}, },
{ {
'cflags': [ 'cflags': [
@ -321,7 +671,7 @@
'MACOSX_DEPLOYMENT_TARGET': '10.9' 'MACOSX_DEPLOYMENT_TARGET': '10.9'
} }
}] }]
], ]
}, },
{ {
'include_dirs': [ 'include_dirs': [
@ -347,6 +697,12 @@
'-stdlib=libc++' '-stdlib=libc++'
] ]
} }
}],
['OS=="win"', {
'dependencies': [
"boringssl",
"z",
]
}] }]
], ],
"target_name": "grpc_node", "target_name": "grpc_node",
@ -367,5 +723,16 @@
"gpr", "gpr",
] ]
}, },
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node"],
"destination": "<(module_path)"
}
]
}
] ]
} }

@ -2602,6 +2602,8 @@ node_modules:
- deps: - deps:
- grpc - grpc
- gpr - gpr
- boringssl
- z
headers: headers:
- src/node/ext/byte_buffer.h - src/node/ext/byte_buffer.h
- src/node/ext/call.h - src/node/ext/call.h

@ -286,6 +286,7 @@ class ClientContext {
/// a client context is constructed and destructed. /// a client context is constructed and destructed.
class GlobalCallbacks { class GlobalCallbacks {
public: public:
virtual ~GlobalCallbacks() {}
virtual void DefaultConstructor(ClientContext* context) = 0; virtual void DefaultConstructor(ClientContext* context) = 0;
virtual void Destructor(ClientContext* context) = 0; virtual void Destructor(ClientContext* context) = 0;
}; };

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -304,6 +304,8 @@ class Server GRPC_FINAL : public GrpcLibrary, private CallHook {
int num_running_cb_; int num_running_cb_;
grpc::condition_variable callback_cv_; grpc::condition_variable callback_cv_;
std::shared_ptr<GlobalCallbacks> global_callbacks_;
std::list<SyncRequest>* sync_methods_; std::list<SyncRequest>* sync_methods_;
std::unique_ptr<RpcServiceMethod> unknown_method_; std::unique_ptr<RpcServiceMethod> unknown_method_;
bool has_generic_service_; bool has_generic_service_;

@ -22,12 +22,14 @@
"lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/interop src/node/index.js", "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", "test": "./node_modules/.bin/mocha src/node/test && npm run-script lint",
"gen_docs": "./node_modules/.bin/jsdoc -c src/node/jsdoc_conf.json", "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" "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test",
"preinstall": "npm install node-pre-gyp",
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build"
}, },
"dependencies": { "dependencies": {
"bindings": "^1.2.0",
"lodash": "^3.9.3", "lodash": "^3.9.3",
"nan": "^2.0.0", "nan": "^2.0.0",
"node-pre-gyp": "^0.6.19",
"protobufjs": "^4.0.0" "protobufjs": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
@ -45,6 +47,14 @@
"engines": { "engines": {
"node": ">=0.10.13" "node": ">=0.10.13"
}, },
"binary": {
"module_name": "grpc_node",
"module_path": "./build/Release/",
"host": "https://storage.googleapis.com/",
"remote_path": "grpc-precompiled-binaries/node/{name}/v{version}",
"package_name": "{node_abi}-{platform}-{arch}.tar.gz",
"module_path": "src/node/extension_binary"
},
"files": [ "files": [
"LICENSE", "LICENSE",
"src/node/README.md", "src/node/README.md",
@ -365,6 +375,32 @@
"src/core/census/operation.c", "src/core/census/operation.c",
"src/core/census/tag_set.c", "src/core/census/tag_set.c",
"src/core/census/tracing.c", "src/core/census/tracing.c",
"third_party/zlib/crc32.h",
"third_party/zlib/deflate.h",
"third_party/zlib/gzguts.h",
"third_party/zlib/inffast.h",
"third_party/zlib/inffixed.h",
"third_party/zlib/inflate.h",
"third_party/zlib/inftrees.h",
"third_party/zlib/trees.h",
"third_party/zlib/zconf.h",
"third_party/zlib/zlib.h",
"third_party/zlib/zutil.h",
"third_party/zlib/adler32.c",
"third_party/zlib/compress.c",
"third_party/zlib/crc32.c",
"third_party/zlib/deflate.c",
"third_party/zlib/gzclose.c",
"third_party/zlib/gzlib.c",
"third_party/zlib/gzread.c",
"third_party/zlib/gzwrite.c",
"third_party/zlib/infback.c",
"third_party/zlib/inffast.c",
"third_party/zlib/inflate.c",
"third_party/zlib/inftrees.c",
"third_party/zlib/trees.c",
"third_party/zlib/uncompr.c",
"third_party/zlib/zutil.c",
"include/grpc/support/alloc.h", "include/grpc/support/alloc.h",
"include/grpc/support/atm.h", "include/grpc/support/atm.h",
"include/grpc/support/atm_gcc_atomic.h", "include/grpc/support/atm_gcc_atomic.h",
@ -444,6 +480,407 @@
"src/core/support/time_precise.c", "src/core/support/time_precise.c",
"src/core/support/time_win32.c", "src/core/support/time_win32.c",
"src/core/support/tls_pthread.c", "src/core/support/tls_pthread.c",
"third_party/boringssl/crypto/aes/internal.h",
"third_party/boringssl/crypto/asn1/asn1_locl.h",
"third_party/boringssl/crypto/bio/internal.h",
"third_party/boringssl/crypto/bn/internal.h",
"third_party/boringssl/crypto/bn/rsaz_exp.h",
"third_party/boringssl/crypto/bytestring/internal.h",
"third_party/boringssl/crypto/cipher/internal.h",
"third_party/boringssl/crypto/conf/conf_def.h",
"third_party/boringssl/crypto/conf/internal.h",
"third_party/boringssl/crypto/des/internal.h",
"third_party/boringssl/crypto/dh/internal.h",
"third_party/boringssl/crypto/digest/internal.h",
"third_party/boringssl/crypto/digest/md32_common.h",
"third_party/boringssl/crypto/directory.h",
"third_party/boringssl/crypto/dsa/internal.h",
"third_party/boringssl/crypto/ec/internal.h",
"third_party/boringssl/crypto/ec/p256-x86_64-table.h",
"third_party/boringssl/crypto/evp/internal.h",
"third_party/boringssl/crypto/internal.h",
"third_party/boringssl/crypto/modes/internal.h",
"third_party/boringssl/crypto/obj/obj_dat.h",
"third_party/boringssl/crypto/obj/obj_xref.h",
"third_party/boringssl/crypto/pkcs8/internal.h",
"third_party/boringssl/crypto/rand/internal.h",
"third_party/boringssl/crypto/rsa/internal.h",
"third_party/boringssl/crypto/test/scoped_types.h",
"third_party/boringssl/crypto/test/test_util.h",
"third_party/boringssl/crypto/x509/charmap.h",
"third_party/boringssl/crypto/x509/vpm_int.h",
"third_party/boringssl/crypto/x509v3/ext_dat.h",
"third_party/boringssl/crypto/x509v3/pcy_int.h",
"third_party/boringssl/include/openssl/aead.h",
"third_party/boringssl/include/openssl/aes.h",
"third_party/boringssl/include/openssl/arm_arch.h",
"third_party/boringssl/include/openssl/asn1.h",
"third_party/boringssl/include/openssl/asn1_mac.h",
"third_party/boringssl/include/openssl/asn1t.h",
"third_party/boringssl/include/openssl/base.h",
"third_party/boringssl/include/openssl/base64.h",
"third_party/boringssl/include/openssl/bio.h",
"third_party/boringssl/include/openssl/blowfish.h",
"third_party/boringssl/include/openssl/bn.h",
"third_party/boringssl/include/openssl/buf.h",
"third_party/boringssl/include/openssl/buffer.h",
"third_party/boringssl/include/openssl/bytestring.h",
"third_party/boringssl/include/openssl/cast.h",
"third_party/boringssl/include/openssl/chacha.h",
"third_party/boringssl/include/openssl/cipher.h",
"third_party/boringssl/include/openssl/cmac.h",
"third_party/boringssl/include/openssl/conf.h",
"third_party/boringssl/include/openssl/cpu.h",
"third_party/boringssl/include/openssl/crypto.h",
"third_party/boringssl/include/openssl/curve25519.h",
"third_party/boringssl/include/openssl/des.h",
"third_party/boringssl/include/openssl/dh.h",
"third_party/boringssl/include/openssl/digest.h",
"third_party/boringssl/include/openssl/dsa.h",
"third_party/boringssl/include/openssl/dtls1.h",
"third_party/boringssl/include/openssl/ec.h",
"third_party/boringssl/include/openssl/ec_key.h",
"third_party/boringssl/include/openssl/ecdh.h",
"third_party/boringssl/include/openssl/ecdsa.h",
"third_party/boringssl/include/openssl/engine.h",
"third_party/boringssl/include/openssl/err.h",
"third_party/boringssl/include/openssl/evp.h",
"third_party/boringssl/include/openssl/ex_data.h",
"third_party/boringssl/include/openssl/hkdf.h",
"third_party/boringssl/include/openssl/hmac.h",
"third_party/boringssl/include/openssl/lhash.h",
"third_party/boringssl/include/openssl/lhash_macros.h",
"third_party/boringssl/include/openssl/md4.h",
"third_party/boringssl/include/openssl/md5.h",
"third_party/boringssl/include/openssl/mem.h",
"third_party/boringssl/include/openssl/obj.h",
"third_party/boringssl/include/openssl/obj_mac.h",
"third_party/boringssl/include/openssl/objects.h",
"third_party/boringssl/include/openssl/opensslfeatures.h",
"third_party/boringssl/include/openssl/opensslv.h",
"third_party/boringssl/include/openssl/ossl_typ.h",
"third_party/boringssl/include/openssl/pem.h",
"third_party/boringssl/include/openssl/pkcs12.h",
"third_party/boringssl/include/openssl/pkcs7.h",
"third_party/boringssl/include/openssl/pkcs8.h",
"third_party/boringssl/include/openssl/poly1305.h",
"third_party/boringssl/include/openssl/pqueue.h",
"third_party/boringssl/include/openssl/rand.h",
"third_party/boringssl/include/openssl/rc4.h",
"third_party/boringssl/include/openssl/rsa.h",
"third_party/boringssl/include/openssl/safestack.h",
"third_party/boringssl/include/openssl/sha.h",
"third_party/boringssl/include/openssl/srtp.h",
"third_party/boringssl/include/openssl/ssl.h",
"third_party/boringssl/include/openssl/ssl3.h",
"third_party/boringssl/include/openssl/stack.h",
"third_party/boringssl/include/openssl/stack_macros.h",
"third_party/boringssl/include/openssl/thread.h",
"third_party/boringssl/include/openssl/time_support.h",
"third_party/boringssl/include/openssl/tls1.h",
"third_party/boringssl/include/openssl/type_check.h",
"third_party/boringssl/include/openssl/x509.h",
"third_party/boringssl/include/openssl/x509_vfy.h",
"third_party/boringssl/include/openssl/x509v3.h",
"third_party/boringssl/ssl/internal.h",
"third_party/boringssl/ssl/test/async_bio.h",
"third_party/boringssl/ssl/test/packeted_bio.h",
"third_party/boringssl/ssl/test/scoped_types.h",
"third_party/boringssl/ssl/test/test_config.h",
"src/boringssl/err_data.c",
"third_party/boringssl/crypto/aes/aes.c",
"third_party/boringssl/crypto/aes/mode_wrappers.c",
"third_party/boringssl/crypto/asn1/a_bitstr.c",
"third_party/boringssl/crypto/asn1/a_bool.c",
"third_party/boringssl/crypto/asn1/a_bytes.c",
"third_party/boringssl/crypto/asn1/a_d2i_fp.c",
"third_party/boringssl/crypto/asn1/a_dup.c",
"third_party/boringssl/crypto/asn1/a_enum.c",
"third_party/boringssl/crypto/asn1/a_gentm.c",
"third_party/boringssl/crypto/asn1/a_i2d_fp.c",
"third_party/boringssl/crypto/asn1/a_int.c",
"third_party/boringssl/crypto/asn1/a_mbstr.c",
"third_party/boringssl/crypto/asn1/a_object.c",
"third_party/boringssl/crypto/asn1/a_octet.c",
"third_party/boringssl/crypto/asn1/a_print.c",
"third_party/boringssl/crypto/asn1/a_strnid.c",
"third_party/boringssl/crypto/asn1/a_time.c",
"third_party/boringssl/crypto/asn1/a_type.c",
"third_party/boringssl/crypto/asn1/a_utctm.c",
"third_party/boringssl/crypto/asn1/a_utf8.c",
"third_party/boringssl/crypto/asn1/asn1_lib.c",
"third_party/boringssl/crypto/asn1/asn1_par.c",
"third_party/boringssl/crypto/asn1/asn_pack.c",
"third_party/boringssl/crypto/asn1/bio_asn1.c",
"third_party/boringssl/crypto/asn1/bio_ndef.c",
"third_party/boringssl/crypto/asn1/f_enum.c",
"third_party/boringssl/crypto/asn1/f_int.c",
"third_party/boringssl/crypto/asn1/f_string.c",
"third_party/boringssl/crypto/asn1/t_bitst.c",
"third_party/boringssl/crypto/asn1/t_pkey.c",
"third_party/boringssl/crypto/asn1/tasn_dec.c",
"third_party/boringssl/crypto/asn1/tasn_enc.c",
"third_party/boringssl/crypto/asn1/tasn_fre.c",
"third_party/boringssl/crypto/asn1/tasn_new.c",
"third_party/boringssl/crypto/asn1/tasn_prn.c",
"third_party/boringssl/crypto/asn1/tasn_typ.c",
"third_party/boringssl/crypto/asn1/tasn_utl.c",
"third_party/boringssl/crypto/asn1/x_bignum.c",
"third_party/boringssl/crypto/asn1/x_long.c",
"third_party/boringssl/crypto/base64/base64.c",
"third_party/boringssl/crypto/bio/bio.c",
"third_party/boringssl/crypto/bio/bio_mem.c",
"third_party/boringssl/crypto/bio/buffer.c",
"third_party/boringssl/crypto/bio/connect.c",
"third_party/boringssl/crypto/bio/fd.c",
"third_party/boringssl/crypto/bio/file.c",
"third_party/boringssl/crypto/bio/hexdump.c",
"third_party/boringssl/crypto/bio/pair.c",
"third_party/boringssl/crypto/bio/printf.c",
"third_party/boringssl/crypto/bio/socket.c",
"third_party/boringssl/crypto/bio/socket_helper.c",
"third_party/boringssl/crypto/bn/add.c",
"third_party/boringssl/crypto/bn/asm/x86_64-gcc.c",
"third_party/boringssl/crypto/bn/bn.c",
"third_party/boringssl/crypto/bn/bn_asn1.c",
"third_party/boringssl/crypto/bn/cmp.c",
"third_party/boringssl/crypto/bn/convert.c",
"third_party/boringssl/crypto/bn/ctx.c",
"third_party/boringssl/crypto/bn/div.c",
"third_party/boringssl/crypto/bn/exponentiation.c",
"third_party/boringssl/crypto/bn/gcd.c",
"third_party/boringssl/crypto/bn/generic.c",
"third_party/boringssl/crypto/bn/kronecker.c",
"third_party/boringssl/crypto/bn/montgomery.c",
"third_party/boringssl/crypto/bn/mul.c",
"third_party/boringssl/crypto/bn/prime.c",
"third_party/boringssl/crypto/bn/random.c",
"third_party/boringssl/crypto/bn/rsaz_exp.c",
"third_party/boringssl/crypto/bn/shift.c",
"third_party/boringssl/crypto/bn/sqrt.c",
"third_party/boringssl/crypto/buf/buf.c",
"third_party/boringssl/crypto/bytestring/ber.c",
"third_party/boringssl/crypto/bytestring/cbb.c",
"third_party/boringssl/crypto/bytestring/cbs.c",
"third_party/boringssl/crypto/chacha/chacha_generic.c",
"third_party/boringssl/crypto/chacha/chacha_vec.c",
"third_party/boringssl/crypto/cipher/aead.c",
"third_party/boringssl/crypto/cipher/cipher.c",
"third_party/boringssl/crypto/cipher/derive_key.c",
"third_party/boringssl/crypto/cipher/e_aes.c",
"third_party/boringssl/crypto/cipher/e_chacha20poly1305.c",
"third_party/boringssl/crypto/cipher/e_des.c",
"third_party/boringssl/crypto/cipher/e_null.c",
"third_party/boringssl/crypto/cipher/e_rc2.c",
"third_party/boringssl/crypto/cipher/e_rc4.c",
"third_party/boringssl/crypto/cipher/e_ssl3.c",
"third_party/boringssl/crypto/cipher/e_tls.c",
"third_party/boringssl/crypto/cipher/tls_cbc.c",
"third_party/boringssl/crypto/cmac/cmac.c",
"third_party/boringssl/crypto/conf/conf.c",
"third_party/boringssl/crypto/cpu-arm.c",
"third_party/boringssl/crypto/cpu-intel.c",
"third_party/boringssl/crypto/crypto.c",
"third_party/boringssl/crypto/curve25519/curve25519.c",
"third_party/boringssl/crypto/des/des.c",
"third_party/boringssl/crypto/dh/check.c",
"third_party/boringssl/crypto/dh/dh.c",
"third_party/boringssl/crypto/dh/dh_asn1.c",
"third_party/boringssl/crypto/dh/params.c",
"third_party/boringssl/crypto/digest/digest.c",
"third_party/boringssl/crypto/digest/digests.c",
"third_party/boringssl/crypto/directory_posix.c",
"third_party/boringssl/crypto/directory_win.c",
"third_party/boringssl/crypto/dsa/dsa.c",
"third_party/boringssl/crypto/dsa/dsa_asn1.c",
"third_party/boringssl/crypto/ec/ec.c",
"third_party/boringssl/crypto/ec/ec_asn1.c",
"third_party/boringssl/crypto/ec/ec_key.c",
"third_party/boringssl/crypto/ec/ec_montgomery.c",
"third_party/boringssl/crypto/ec/oct.c",
"third_party/boringssl/crypto/ec/p224-64.c",
"third_party/boringssl/crypto/ec/p256-64.c",
"third_party/boringssl/crypto/ec/p256-x86_64.c",
"third_party/boringssl/crypto/ec/simple.c",
"third_party/boringssl/crypto/ec/util-64.c",
"third_party/boringssl/crypto/ec/wnaf.c",
"third_party/boringssl/crypto/ecdh/ecdh.c",
"third_party/boringssl/crypto/ecdsa/ecdsa.c",
"third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c",
"third_party/boringssl/crypto/engine/engine.c",
"third_party/boringssl/crypto/err/err.c",
"third_party/boringssl/crypto/evp/algorithm.c",
"third_party/boringssl/crypto/evp/digestsign.c",
"third_party/boringssl/crypto/evp/evp.c",
"third_party/boringssl/crypto/evp/evp_asn1.c",
"third_party/boringssl/crypto/evp/evp_ctx.c",
"third_party/boringssl/crypto/evp/p_dsa_asn1.c",
"third_party/boringssl/crypto/evp/p_ec.c",
"third_party/boringssl/crypto/evp/p_ec_asn1.c",
"third_party/boringssl/crypto/evp/p_rsa.c",
"third_party/boringssl/crypto/evp/p_rsa_asn1.c",
"third_party/boringssl/crypto/evp/pbkdf.c",
"third_party/boringssl/crypto/evp/sign.c",
"third_party/boringssl/crypto/ex_data.c",
"third_party/boringssl/crypto/hkdf/hkdf.c",
"third_party/boringssl/crypto/hmac/hmac.c",
"third_party/boringssl/crypto/lhash/lhash.c",
"third_party/boringssl/crypto/md4/md4.c",
"third_party/boringssl/crypto/md5/md5.c",
"third_party/boringssl/crypto/mem.c",
"third_party/boringssl/crypto/modes/cbc.c",
"third_party/boringssl/crypto/modes/cfb.c",
"third_party/boringssl/crypto/modes/ctr.c",
"third_party/boringssl/crypto/modes/gcm.c",
"third_party/boringssl/crypto/modes/ofb.c",
"third_party/boringssl/crypto/obj/obj.c",
"third_party/boringssl/crypto/obj/obj_xref.c",
"third_party/boringssl/crypto/pem/pem_all.c",
"third_party/boringssl/crypto/pem/pem_info.c",
"third_party/boringssl/crypto/pem/pem_lib.c",
"third_party/boringssl/crypto/pem/pem_oth.c",
"third_party/boringssl/crypto/pem/pem_pk8.c",
"third_party/boringssl/crypto/pem/pem_pkey.c",
"third_party/boringssl/crypto/pem/pem_x509.c",
"third_party/boringssl/crypto/pem/pem_xaux.c",
"third_party/boringssl/crypto/pkcs8/p5_pbe.c",
"third_party/boringssl/crypto/pkcs8/p5_pbev2.c",
"third_party/boringssl/crypto/pkcs8/p8_pkey.c",
"third_party/boringssl/crypto/pkcs8/pkcs8.c",
"third_party/boringssl/crypto/poly1305/poly1305.c",
"third_party/boringssl/crypto/poly1305/poly1305_arm.c",
"third_party/boringssl/crypto/poly1305/poly1305_vec.c",
"third_party/boringssl/crypto/rand/rand.c",
"third_party/boringssl/crypto/rand/urandom.c",
"third_party/boringssl/crypto/rand/windows.c",
"third_party/boringssl/crypto/rc4/rc4.c",
"third_party/boringssl/crypto/refcount_c11.c",
"third_party/boringssl/crypto/refcount_lock.c",
"third_party/boringssl/crypto/rsa/blinding.c",
"third_party/boringssl/crypto/rsa/padding.c",
"third_party/boringssl/crypto/rsa/rsa.c",
"third_party/boringssl/crypto/rsa/rsa_asn1.c",
"third_party/boringssl/crypto/rsa/rsa_impl.c",
"third_party/boringssl/crypto/sha/sha1.c",
"third_party/boringssl/crypto/sha/sha256.c",
"third_party/boringssl/crypto/sha/sha512.c",
"third_party/boringssl/crypto/stack/stack.c",
"third_party/boringssl/crypto/thread.c",
"third_party/boringssl/crypto/thread_none.c",
"third_party/boringssl/crypto/thread_pthread.c",
"third_party/boringssl/crypto/thread_win.c",
"third_party/boringssl/crypto/time_support.c",
"third_party/boringssl/crypto/x509/a_digest.c",
"third_party/boringssl/crypto/x509/a_sign.c",
"third_party/boringssl/crypto/x509/a_strex.c",
"third_party/boringssl/crypto/x509/a_verify.c",
"third_party/boringssl/crypto/x509/asn1_gen.c",
"third_party/boringssl/crypto/x509/by_dir.c",
"third_party/boringssl/crypto/x509/by_file.c",
"third_party/boringssl/crypto/x509/i2d_pr.c",
"third_party/boringssl/crypto/x509/pkcs7.c",
"third_party/boringssl/crypto/x509/t_crl.c",
"third_party/boringssl/crypto/x509/t_req.c",
"third_party/boringssl/crypto/x509/t_x509.c",
"third_party/boringssl/crypto/x509/t_x509a.c",
"third_party/boringssl/crypto/x509/x509.c",
"third_party/boringssl/crypto/x509/x509_att.c",
"third_party/boringssl/crypto/x509/x509_cmp.c",
"third_party/boringssl/crypto/x509/x509_d2.c",
"third_party/boringssl/crypto/x509/x509_def.c",
"third_party/boringssl/crypto/x509/x509_ext.c",
"third_party/boringssl/crypto/x509/x509_lu.c",
"third_party/boringssl/crypto/x509/x509_obj.c",
"third_party/boringssl/crypto/x509/x509_r2x.c",
"third_party/boringssl/crypto/x509/x509_req.c",
"third_party/boringssl/crypto/x509/x509_set.c",
"third_party/boringssl/crypto/x509/x509_trs.c",
"third_party/boringssl/crypto/x509/x509_txt.c",
"third_party/boringssl/crypto/x509/x509_v3.c",
"third_party/boringssl/crypto/x509/x509_vfy.c",
"third_party/boringssl/crypto/x509/x509_vpm.c",
"third_party/boringssl/crypto/x509/x509cset.c",
"third_party/boringssl/crypto/x509/x509name.c",
"third_party/boringssl/crypto/x509/x509rset.c",
"third_party/boringssl/crypto/x509/x509spki.c",
"third_party/boringssl/crypto/x509/x509type.c",
"third_party/boringssl/crypto/x509/x_algor.c",
"third_party/boringssl/crypto/x509/x_all.c",
"third_party/boringssl/crypto/x509/x_attrib.c",
"third_party/boringssl/crypto/x509/x_crl.c",
"third_party/boringssl/crypto/x509/x_exten.c",
"third_party/boringssl/crypto/x509/x_info.c",
"third_party/boringssl/crypto/x509/x_name.c",
"third_party/boringssl/crypto/x509/x_pkey.c",
"third_party/boringssl/crypto/x509/x_pubkey.c",
"third_party/boringssl/crypto/x509/x_req.c",
"third_party/boringssl/crypto/x509/x_sig.c",
"third_party/boringssl/crypto/x509/x_spki.c",
"third_party/boringssl/crypto/x509/x_val.c",
"third_party/boringssl/crypto/x509/x_x509.c",
"third_party/boringssl/crypto/x509/x_x509a.c",
"third_party/boringssl/crypto/x509v3/pcy_cache.c",
"third_party/boringssl/crypto/x509v3/pcy_data.c",
"third_party/boringssl/crypto/x509v3/pcy_lib.c",
"third_party/boringssl/crypto/x509v3/pcy_map.c",
"third_party/boringssl/crypto/x509v3/pcy_node.c",
"third_party/boringssl/crypto/x509v3/pcy_tree.c",
"third_party/boringssl/crypto/x509v3/v3_akey.c",
"third_party/boringssl/crypto/x509v3/v3_akeya.c",
"third_party/boringssl/crypto/x509v3/v3_alt.c",
"third_party/boringssl/crypto/x509v3/v3_bcons.c",
"third_party/boringssl/crypto/x509v3/v3_bitst.c",
"third_party/boringssl/crypto/x509v3/v3_conf.c",
"third_party/boringssl/crypto/x509v3/v3_cpols.c",
"third_party/boringssl/crypto/x509v3/v3_crld.c",
"third_party/boringssl/crypto/x509v3/v3_enum.c",
"third_party/boringssl/crypto/x509v3/v3_extku.c",
"third_party/boringssl/crypto/x509v3/v3_genn.c",
"third_party/boringssl/crypto/x509v3/v3_ia5.c",
"third_party/boringssl/crypto/x509v3/v3_info.c",
"third_party/boringssl/crypto/x509v3/v3_int.c",
"third_party/boringssl/crypto/x509v3/v3_lib.c",
"third_party/boringssl/crypto/x509v3/v3_ncons.c",
"third_party/boringssl/crypto/x509v3/v3_pci.c",
"third_party/boringssl/crypto/x509v3/v3_pcia.c",
"third_party/boringssl/crypto/x509v3/v3_pcons.c",
"third_party/boringssl/crypto/x509v3/v3_pku.c",
"third_party/boringssl/crypto/x509v3/v3_pmaps.c",
"third_party/boringssl/crypto/x509v3/v3_prn.c",
"third_party/boringssl/crypto/x509v3/v3_purp.c",
"third_party/boringssl/crypto/x509v3/v3_skey.c",
"third_party/boringssl/crypto/x509v3/v3_sxnet.c",
"third_party/boringssl/crypto/x509v3/v3_utl.c",
"third_party/boringssl/ssl/custom_extensions.c",
"third_party/boringssl/ssl/d1_both.c",
"third_party/boringssl/ssl/d1_clnt.c",
"third_party/boringssl/ssl/d1_lib.c",
"third_party/boringssl/ssl/d1_meth.c",
"third_party/boringssl/ssl/d1_pkt.c",
"third_party/boringssl/ssl/d1_srtp.c",
"third_party/boringssl/ssl/d1_srvr.c",
"third_party/boringssl/ssl/dtls_record.c",
"third_party/boringssl/ssl/pqueue/pqueue.c",
"third_party/boringssl/ssl/s3_both.c",
"third_party/boringssl/ssl/s3_clnt.c",
"third_party/boringssl/ssl/s3_enc.c",
"third_party/boringssl/ssl/s3_lib.c",
"third_party/boringssl/ssl/s3_meth.c",
"third_party/boringssl/ssl/s3_pkt.c",
"third_party/boringssl/ssl/s3_srvr.c",
"third_party/boringssl/ssl/ssl_aead_ctx.c",
"third_party/boringssl/ssl/ssl_asn1.c",
"third_party/boringssl/ssl/ssl_buffer.c",
"third_party/boringssl/ssl/ssl_cert.c",
"third_party/boringssl/ssl/ssl_cipher.c",
"third_party/boringssl/ssl/ssl_file.c",
"third_party/boringssl/ssl/ssl_lib.c",
"third_party/boringssl/ssl/ssl_rsa.c",
"third_party/boringssl/ssl/ssl_session.c",
"third_party/boringssl/ssl/ssl_stat.c",
"third_party/boringssl/ssl/t1_enc.c",
"third_party/boringssl/ssl/t1_lib.c",
"third_party/boringssl/ssl/tls_record.c",
"binding.gyp" "binding.gyp"
], ],
"main": "src/node/index.js", "main": "src/node/index.js",

@ -37,9 +37,7 @@ static int features_enabled = CENSUS_FEATURE_NONE;
int census_initialize(int features) { int census_initialize(int features) {
if (features_enabled != CENSUS_FEATURE_NONE) { if (features_enabled != CENSUS_FEATURE_NONE) {
return 1; // Must have been a previous call to census_initialize; return error
}
if (features == CENSUS_FEATURE_NONE) {
return 1; return 1;
} }
features_enabled = features; features_enabled = features;

@ -76,7 +76,7 @@ typedef struct {
} pick_first_lb_policy; } pick_first_lb_policy;
#define GET_SELECTED(p) \ #define GET_SELECTED(p) \
((grpc_connected_subchannel *)gpr_atm_no_barrier_load(&(p)->selected)) ((grpc_connected_subchannel *)gpr_atm_acq_load(&(p)->selected))
void pf_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { void pf_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
pick_first_lb_policy *p = (pick_first_lb_policy *)pol; pick_first_lb_policy *p = (pick_first_lb_policy *)pol;
@ -268,10 +268,10 @@ static void pf_connectivity_changed(grpc_exec_ctx *exec_ctx, void *arg,
selected = selected =
grpc_subchannel_get_connected_subchannel(selected_subchannel); grpc_subchannel_get_connected_subchannel(selected_subchannel);
GPR_ASSERT(selected != NULL); GPR_ASSERT(selected != NULL);
gpr_atm_no_barrier_store(&p->selected, (gpr_atm)selected);
GRPC_CONNECTED_SUBCHANNEL_REF(selected, "picked_first"); GRPC_CONNECTED_SUBCHANNEL_REF(selected, "picked_first");
/* drop the pick list: we are connected now */ /* drop the pick list: we are connected now */
GRPC_LB_POLICY_WEAK_REF(&p->base, "destroy_subchannels"); GRPC_LB_POLICY_WEAK_REF(&p->base, "destroy_subchannels");
gpr_atm_rel_store(&p->selected, (gpr_atm)selected);
grpc_exec_ctx_enqueue(exec_ctx, grpc_exec_ctx_enqueue(exec_ctx,
grpc_closure_create(destroy_subchannels, p), 1); grpc_closure_create(destroy_subchannels, p), 1);
/* update any calls that were waiting for a pick */ /* update any calls that were waiting for a pick */

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -519,7 +519,12 @@ static void publish_transport(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
} }
/* publish */ /* publish */
GPR_ASSERT(gpr_atm_no_barrier_cas(&c->connected_subchannel, 0, (gpr_atm)con)); /* TODO(ctiller): this full barrier seems to clear up a TSAN failure.
I'd have expected the rel_cas below to be enough, but
seemingly it's not.
Re-evaluate if we really need this. */
gpr_atm_full_barrier();
GPR_ASSERT(gpr_atm_rel_cas(&c->connected_subchannel, 0, (gpr_atm)con));
c->connecting = 0; c->connecting = 0;
/* setup subchannel watching connected subchannel for changes; subchannel ref /* setup subchannel watching connected subchannel for changes; subchannel ref

@ -117,8 +117,10 @@ void grpc_init(void) {
grpc_iomgr_init(); grpc_iomgr_init();
grpc_executor_init(); grpc_executor_init();
grpc_tracer_init("GRPC_TRACE"); grpc_tracer_init("GRPC_TRACE");
/* Only initialize census if noone else has. */ /* Only initialize census if no one else has and some features are
if (census_enabled() == CENSUS_FEATURE_NONE) { * available. */
if (census_enabled() == CENSUS_FEATURE_NONE &&
census_supported() != CENSUS_FEATURE_NONE) {
if (census_initialize(census_supported())) { /* enable all features. */ if (census_initialize(census_supported())) { /* enable all features. */
gpr_log(GPR_ERROR, "Could not initialize census."); gpr_log(GPR_ERROR, "Could not initialize census.");
} }

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -48,6 +48,7 @@ namespace grpc {
class DefaultGlobalClientCallbacks GRPC_FINAL class DefaultGlobalClientCallbacks GRPC_FINAL
: public ClientContext::GlobalCallbacks { : public ClientContext::GlobalCallbacks {
public: public:
~DefaultGlobalClientCallbacks() GRPC_OVERRIDE {}
void DefaultConstructor(ClientContext* context) GRPC_OVERRIDE {} void DefaultConstructor(ClientContext* context) GRPC_OVERRIDE {}
void Destructor(ClientContext* context) GRPC_OVERRIDE {} void Destructor(ClientContext* context) GRPC_OVERRIDE {}
}; };

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -53,17 +53,17 @@ namespace grpc {
class DefaultGlobalCallbacks GRPC_FINAL : public Server::GlobalCallbacks { class DefaultGlobalCallbacks GRPC_FINAL : public Server::GlobalCallbacks {
public: public:
~DefaultGlobalCallbacks() GRPC_OVERRIDE {}
void PreSynchronousRequest(ServerContext* context) GRPC_OVERRIDE {} void PreSynchronousRequest(ServerContext* context) GRPC_OVERRIDE {}
void PostSynchronousRequest(ServerContext* context) GRPC_OVERRIDE {} void PostSynchronousRequest(ServerContext* context) GRPC_OVERRIDE {}
}; };
static Server::GlobalCallbacks* g_callbacks = nullptr; static std::shared_ptr<Server::GlobalCallbacks> g_callbacks = nullptr;
static gpr_once g_once_init_callbacks = GPR_ONCE_INIT; static gpr_once g_once_init_callbacks = GPR_ONCE_INIT;
static void InitGlobalCallbacks() { static void InitGlobalCallbacks() {
if (g_callbacks == nullptr) { if (g_callbacks == nullptr) {
static DefaultGlobalCallbacks default_global_callbacks; g_callbacks.reset(new DefaultGlobalCallbacks());
g_callbacks = &default_global_callbacks;
} }
} }
@ -234,12 +234,12 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag {
} }
} }
void Run() { void Run(std::shared_ptr<GlobalCallbacks> global_callbacks) {
ctx_.BeginCompletionOp(&call_); ctx_.BeginCompletionOp(&call_);
g_callbacks->PreSynchronousRequest(&ctx_); global_callbacks->PreSynchronousRequest(&ctx_);
method_->handler()->RunHandler(MethodHandler::HandlerParameter( method_->handler()->RunHandler(MethodHandler::HandlerParameter(
&call_, &ctx_, request_payload_, call_.max_message_size())); &call_, &ctx_, request_payload_, call_.max_message_size()));
g_callbacks->PostSynchronousRequest(&ctx_); global_callbacks->PostSynchronousRequest(&ctx_);
request_payload_ = nullptr; request_payload_ = nullptr;
void* ignored_tag; void* ignored_tag;
bool ignored_ok; bool ignored_ok;
@ -287,6 +287,7 @@ Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned,
thread_pool_(thread_pool), thread_pool_(thread_pool),
thread_pool_owned_(thread_pool_owned) { thread_pool_owned_(thread_pool_owned) {
gpr_once_init(&g_once_init_callbacks, InitGlobalCallbacks); gpr_once_init(&g_once_init_callbacks, InitGlobalCallbacks);
global_callbacks_ = g_callbacks;
grpc_server_register_completion_queue(server_, cq_.cq(), nullptr); grpc_server_register_completion_queue(server_, cq_.cq(), nullptr);
} }
@ -311,7 +312,7 @@ Server::~Server() {
void Server::SetGlobalCallbacks(GlobalCallbacks* callbacks) { void Server::SetGlobalCallbacks(GlobalCallbacks* callbacks) {
GPR_ASSERT(g_callbacks == nullptr); GPR_ASSERT(g_callbacks == nullptr);
GPR_ASSERT(callbacks != nullptr); GPR_ASSERT(callbacks != nullptr);
g_callbacks = callbacks; g_callbacks.reset(callbacks);
} }
bool Server::RegisterService(const grpc::string* host, RpcService* service) { bool Server::RegisterService(const grpc::string* host, RpcService* service) {
@ -569,7 +570,7 @@ void Server::RunRpc() {
} }
} }
GPR_TIMER_SCOPE("cd.Run()", 0); GPR_TIMER_SCOPE("cd.Run()", 0);
cd.Run(); cd.Run(global_callbacks_);
} }
} }

@ -31,8 +31,8 @@
* *
*/ */
#include <grpc/byte_buffer_reader.h>
#include <grpc++/support/byte_buffer.h> #include <grpc++/support/byte_buffer.h>
#include <grpc/byte_buffer_reader.h>
namespace grpc { namespace grpc {
@ -85,7 +85,9 @@ ByteBuffer::ByteBuffer(const ByteBuffer& buf)
ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) { ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) {
Clear(); // first remove existing data Clear(); // first remove existing data
if (buf.buffer_) {
buffer_ = grpc_byte_buffer_copy(buf.buffer_); // then copy buffer_ = grpc_byte_buffer_copy(buf.buffer_); // then copy
}
return *this; return *this;
} }

@ -1,6 +1,6 @@
#region Copyright notice and license #region Copyright notice and license
// Copyright 2015, Google Inc. // Copyright 2015-2016, Google Inc.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -69,7 +69,7 @@ Local<Value> ByteBufferToBuffer(grpc_byte_buffer *buffer) {
return scope.Escape(Nan::Null()); return scope.Escape(Nan::Null());
} }
size_t length = grpc_byte_buffer_length(buffer); size_t length = grpc_byte_buffer_length(buffer);
char *result = reinterpret_cast<char *>(calloc(length, sizeof(char))); char *result = new char[length];
size_t offset = 0; size_t offset = 0;
grpc_byte_buffer_reader reader; grpc_byte_buffer_reader reader;
grpc_byte_buffer_reader_init(&reader, buffer); grpc_byte_buffer_reader_init(&reader, buffer);

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -51,7 +51,7 @@ var server = require('./src/server.js');
var Metadata = require('./src/metadata.js'); var Metadata = require('./src/metadata.js');
var grpc = require('bindings')('grpc_node'); var grpc = require('./src/grpc_extension');
/** /**
* Load a gRPC object from an existing ProtoBuf.Reflect object. * Load a gRPC object from an existing ProtoBuf.Reflect object.

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -51,7 +51,7 @@
var _ = require('lodash'); var _ = require('lodash');
var grpc = require('bindings')('grpc_node'); var grpc = require('./grpc_extension');
var common = require('./common'); var common = require('./common');

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -61,7 +61,7 @@
'use strict'; 'use strict';
var grpc = require('bindings')('grpc_node.node'); var grpc = require('./grpc_extension');
var CallCredentials = grpc.CallCredentials; var CallCredentials = grpc.CallCredentials;

@ -0,0 +1,40 @@
/*
*
* 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.
*
*/
var binary = require('node-pre-gyp');
var path = require('path');
var binding_path = binary.find(path.resolve(
path.join(__dirname,'../../../package.json')));
var binding = require(binding_path);
module.exports = binding;

@ -49,7 +49,7 @@
var _ = require('lodash'); var _ = require('lodash');
var grpc = require('bindings')('grpc_node'); var grpc = require('./grpc_extension');
/** /**
* Class for storing metadata. Keys are normalized to lowercase ASCII. * Class for storing metadata. Keys are normalized to lowercase ASCII.

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -51,7 +51,7 @@
var _ = require('lodash'); var _ = require('lodash');
var grpc = require('bindings')('grpc_node'); var grpc = require('./grpc_extension');
var common = require('./common'); var common = require('./common');

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -34,7 +34,7 @@
'use strict'; 'use strict';
var assert = require('assert'); var assert = require('assert');
var grpc = require('bindings')('grpc_node'); var grpc = require('../src/grpc_extension');
/** /**
* Helper function to return an absolute deadline given a relative timeout in * Helper function to return an absolute deadline given a relative timeout in

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -34,7 +34,7 @@
'use strict'; 'use strict';
var assert = require('assert'); var assert = require('assert');
var grpc = require('bindings')('grpc_node'); var grpc = require('../src/grpc_extension');
/** /**
* This is used for testing functions with multiple asynchronous calls that * This is used for testing functions with multiple asynchronous calls that

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -34,7 +34,7 @@
'use strict'; 'use strict';
var assert = require('assert'); var assert = require('assert');
var grpc = require('bindings')('grpc_node'); var grpc = require('../src/grpc_extension');
/** /**
* List of all status names * List of all status names

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -34,7 +34,7 @@
'use strict'; 'use strict';
var assert = require('assert'); var assert = require('assert');
var grpc = require('bindings')('grpc_node'); var grpc = require('../src/grpc_extension');
/** /**
* This is used for testing functions with multiple asynchronous calls that * This is used for testing functions with multiple asynchronous calls that

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -36,7 +36,7 @@
var assert = require('assert'); var assert = require('assert');
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var grpc = require('bindings')('grpc_node'); var grpc = require('../src/grpc_extension');
describe('server', function() { describe('server', function() {
describe('constructor', function() { describe('constructor', function() {

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -952,6 +952,7 @@ describe('Call propagation', function() {
describe('Cancellation', function() { describe('Cancellation', function() {
it('With a unary call', function(done) { it('With a unary call', function(done) {
done = multiDone(done, 2); done = multiDone(done, 2);
var call;
proxy_impl.unary = function(parent, callback) { proxy_impl.unary = function(parent, callback) {
client.unary(parent.request, function(err, value) { client.unary(parent.request, function(err, value) {
try { try {
@ -969,12 +970,13 @@ describe('Call propagation', function() {
proxy.start(); proxy.start();
var proxy_client = new Client('localhost:' + proxy_port, var proxy_client = new Client('localhost:' + proxy_port,
grpc.credentials.createInsecure()); grpc.credentials.createInsecure());
var call = proxy_client.unary({}, function(err, value) { call = proxy_client.unary({}, function(err, value) {
done(); done();
}); });
}); });
it('With a client stream call', function(done) { it('With a client stream call', function(done) {
done = multiDone(done, 2); done = multiDone(done, 2);
var call;
proxy_impl.clientStream = function(parent, callback) { proxy_impl.clientStream = function(parent, callback) {
client.clientStream(function(err, value) { client.clientStream(function(err, value) {
try { try {
@ -992,12 +994,13 @@ describe('Call propagation', function() {
proxy.start(); proxy.start();
var proxy_client = new Client('localhost:' + proxy_port, var proxy_client = new Client('localhost:' + proxy_port,
grpc.credentials.createInsecure()); grpc.credentials.createInsecure());
var call = proxy_client.clientStream(function(err, value) { call = proxy_client.clientStream(function(err, value) {
done(); done();
}); });
}); });
it('With a server stream call', function(done) { it('With a server stream call', function(done) {
done = multiDone(done, 2); done = multiDone(done, 2);
var call;
proxy_impl.serverStream = function(parent) { proxy_impl.serverStream = function(parent) {
var child = client.serverStream(parent.request, null, var child = client.serverStream(parent.request, null,
{parent: parent}); {parent: parent});
@ -1013,13 +1016,14 @@ describe('Call propagation', function() {
proxy.start(); proxy.start();
var proxy_client = new Client('localhost:' + proxy_port, var proxy_client = new Client('localhost:' + proxy_port,
grpc.credentials.createInsecure()); grpc.credentials.createInsecure());
var call = proxy_client.serverStream({}); call = proxy_client.serverStream({});
call.on('error', function(err) { call.on('error', function(err) {
done(); done();
}); });
}); });
it('With a bidi stream call', function(done) { it('With a bidi stream call', function(done) {
done = multiDone(done, 2); done = multiDone(done, 2);
var call;
proxy_impl.bidiStream = function(parent) { proxy_impl.bidiStream = function(parent) {
var child = client.bidiStream(null, {parent: parent}); var child = client.bidiStream(null, {parent: parent});
child.on('error', function(err) { child.on('error', function(err) {
@ -1034,7 +1038,7 @@ describe('Call propagation', function() {
proxy.start(); proxy.start();
var proxy_client = new Client('localhost:' + proxy_port, var proxy_client = new Client('localhost:' + proxy_port,
grpc.credentials.createInsecure()); grpc.credentials.createInsecure());
var call = proxy_client.bidiStream(); call = proxy_client.bidiStream();
call.on('error', function(err) { call.on('error', function(err) {
done(); done();
}); });

@ -1,4 +1,4 @@
// Copyright 2015, Google Inc. // Copyright 2015-2016, Google Inc.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
@ -42,6 +42,7 @@ enum ClientType {
enum ServerType { enum ServerType {
SYNC_SERVER = 0; SYNC_SERVER = 0;
ASYNC_SERVER = 1; ASYNC_SERVER = 1;
ASYNC_GENERIC_SERVER = 2;
} }
enum RpcType { enum RpcType {

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -29,7 +29,6 @@
"""A thread pool that logs exceptions raised by tasks executed within it.""" """A thread pool that logs exceptions raised by tasks executed within it."""
import functools
import logging import logging
from concurrent import futures from concurrent import futures
@ -37,12 +36,12 @@ from concurrent import futures
def _wrap(behavior): def _wrap(behavior):
"""Wraps an arbitrary callable behavior in exception-logging.""" """Wraps an arbitrary callable behavior in exception-logging."""
@functools.wraps(behavior)
def _wrapping(*args, **kwargs): def _wrapping(*args, **kwargs):
try: try:
return behavior(*args, **kwargs) return behavior(*args, **kwargs)
except Exception as e: except Exception as e:
logging.exception('Unexpected exception from task run in logging pool!') logging.exception(
'Unexpected exception from %s executed in logging pool!', behavior)
raise raise
return _wrapping return _wrapping

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -29,6 +29,7 @@
"""Tests for grpc.framework.foundation.logging_pool.""" """Tests for grpc.framework.foundation.logging_pool."""
import threading
import unittest import unittest
from grpc.framework.foundation import logging_pool from grpc.framework.foundation import logging_pool
@ -36,6 +37,21 @@ from grpc.framework.foundation import logging_pool
_POOL_SIZE = 16 _POOL_SIZE = 16
class _CallableObject(object):
def __init__(self):
self._lock = threading.Lock()
self._passed_values = []
def __call__(self, value):
with self._lock:
self._passed_values.append(value)
def passed_values(self):
with self._lock:
return tuple(self._passed_values)
class LoggingPoolTest(unittest.TestCase): class LoggingPoolTest(unittest.TestCase):
def testUpAndDown(self): def testUpAndDown(self):
@ -59,6 +75,14 @@ class LoggingPoolTest(unittest.TestCase):
self.assertIsNotNone(raised_exception) self.assertIsNotNone(raised_exception)
def testCallableObjectExecuted(self):
callable_object = _CallableObject()
passed_object = object()
with logging_pool.pool(_POOL_SIZE) as pool:
future = pool.submit(callable_object, passed_object)
self.assertIsNone(future.result())
self.assertSequenceEqual((passed_object,), callable_object.passed_values())
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(verbosity=2) unittest.main(verbosity=2)

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -30,9 +30,12 @@
"""Test code for the Face layer of RPC Framework.""" """Test code for the Face layer of RPC Framework."""
import abc import abc
import itertools
import unittest import unittest
from concurrent import futures
# test_interfaces is referenced from specification in this module. # test_interfaces is referenced from specification in this module.
from grpc.framework.foundation import logging_pool
from grpc.framework.interfaces.face import face from grpc.framework.interfaces.face import face
from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_constants
from tests.unit.framework.common import test_control from tests.unit.framework.common import test_control
@ -139,13 +142,50 @@ class TestCase(test_coverage.Coverage, unittest.TestCase):
test_messages.verify(second_request, second_response, self) test_messages.verify(second_request, second_response, self)
@unittest.skip('Parallel invocations impossible with blocking control flow!')
def testParallelInvocations(self): def testParallelInvocations(self):
raise NotImplementedError() pool = logging_pool.pool(test_constants.PARALLELISM)
for (group, method), test_messages_sequence in (
self._digest.unary_unary_messages_sequences.iteritems()):
for test_messages in test_messages_sequence:
requests = []
response_futures = []
for _ in range(test_constants.PARALLELISM):
request = test_messages.request()
response_future = pool.submit(
self._invoker.blocking(group, method), request,
test_constants.LONG_TIMEOUT)
requests.append(request)
response_futures.append(response_future)
responses = [
response_future.result() for response_future in response_futures]
for request, response in zip(requests, responses):
test_messages.verify(request, response, self)
pool.shutdown(wait=True)
@unittest.skip('Parallel invocations impossible with blocking control flow!')
def testWaitingForSomeButNotAllParallelInvocations(self): def testWaitingForSomeButNotAllParallelInvocations(self):
raise NotImplementedError() pool = logging_pool.pool(test_constants.PARALLELISM)
for (group, method), test_messages_sequence in (
self._digest.unary_unary_messages_sequences.iteritems()):
for test_messages in test_messages_sequence:
requests = []
response_futures_to_indices = {}
for index in range(test_constants.PARALLELISM):
request = test_messages.request()
response_future = pool.submit(
self._invoker.blocking(group, method), request,
test_constants.LONG_TIMEOUT)
requests.append(request)
response_futures_to_indices[response_future] = index
some_completed_response_futures_iterator = itertools.islice(
futures.as_completed(response_futures_to_indices),
test_constants.PARALLELISM / 2)
for response_future in some_completed_response_futures_iterator:
index = response_futures_to_indices[response_future]
test_messages.verify(requests[index], response_future.result(), self)
pool.shutdown(wait=True)
@unittest.skip('Cancellation impossible with blocking control flow!') @unittest.skip('Cancellation impossible with blocking control flow!')
def testCancelledUnaryRequestUnaryResponse(self): def testCancelledUnaryRequestUnaryResponse(self):

@ -31,8 +31,10 @@
import abc import abc
import contextlib import contextlib
import itertools
import threading import threading
import unittest import unittest
from concurrent import futures
# test_interfaces is referenced from specification in this module. # test_interfaces is referenced from specification in this module.
from grpc.framework.foundation import logging_pool from grpc.framework.foundation import logging_pool
@ -219,6 +221,23 @@ class TestCase(test_coverage.Coverage, unittest.TestCase):
test_messages.verify(second_request, second_response, self) test_messages.verify(second_request, second_response, self)
def testParallelInvocations(self):
for (group, method), test_messages_sequence in (
self._digest.unary_unary_messages_sequences.iteritems()):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
second_request = test_messages.request()
first_response_future = self._invoker.future(group, method)(
first_request, test_constants.LONG_TIMEOUT)
second_response_future = self._invoker.future(group, method)(
second_request, test_constants.LONG_TIMEOUT)
first_response = first_response_future.result()
second_response = second_response_future.result()
test_messages.verify(first_request, first_response, self)
test_messages.verify(second_request, second_response, self)
for (group, method), test_messages_sequence in ( for (group, method), test_messages_sequence in (
self._digest.unary_unary_messages_sequences.iteritems()): self._digest.unary_unary_messages_sequences.iteritems()):
for test_messages in test_messages_sequence: for test_messages in test_messages_sequence:
@ -237,26 +256,28 @@ class TestCase(test_coverage.Coverage, unittest.TestCase):
for request, response in zip(requests, responses): for request, response in zip(requests, responses):
test_messages.verify(request, response, self) test_messages.verify(request, response, self)
def testParallelInvocations(self): def testWaitingForSomeButNotAllParallelInvocations(self):
pool = logging_pool.pool(test_constants.PARALLELISM)
for (group, method), test_messages_sequence in ( for (group, method), test_messages_sequence in (
self._digest.unary_unary_messages_sequences.iteritems()): self._digest.unary_unary_messages_sequences.iteritems()):
for test_messages in test_messages_sequence: for test_messages in test_messages_sequence:
first_request = test_messages.request() requests = []
second_request = test_messages.request() response_futures_to_indices = {}
for index in range(test_constants.PARALLELISM):
first_response_future = self._invoker.future(group, method)( request = test_messages.request()
first_request, test_constants.LONG_TIMEOUT) inner_response_future = self._invoker.future(group, method)(
second_response_future = self._invoker.future(group, method)( request, test_constants.LONG_TIMEOUT)
second_request, test_constants.LONG_TIMEOUT) outer_response_future = pool.submit(inner_response_future.result)
first_response = first_response_future.result() requests.append(request)
second_response = second_response_future.result() response_futures_to_indices[outer_response_future] = index
test_messages.verify(first_request, first_response, self) some_completed_response_futures_iterator = itertools.islice(
test_messages.verify(second_request, second_response, self) futures.as_completed(response_futures_to_indices),
test_constants.PARALLELISM / 2)
@unittest.skip('TODO(nathaniel): implement.') for response_future in some_completed_response_futures_iterator:
def testWaitingForSomeButNotAllParallelInvocations(self): index = response_futures_to_indices[response_future]
raise NotImplementedError() test_messages.verify(requests[index], response_future.result(), self)
pool.shutdown(wait=True)
def testCancelledUnaryRequestUnaryResponse(self): def testCancelledUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in ( for (group, method), test_messages_sequence in (

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -76,7 +76,7 @@ class Receiver(face.ResponseReceiver):
def unary_response(self): def unary_response(self):
with self._condition: with self._condition:
if self._abortion is not None: if self._abortion is not None:
raise AssertionError('Aborted with abortion "%s"!' % self._abortion) raise AssertionError('Aborted: "{}"!'.format(self._abortion))
elif len(self._responses) != 1: elif len(self._responses) != 1:
raise AssertionError( raise AssertionError(
'%d responses received, not exactly one!', len(self._responses)) '%d responses received, not exactly one!', len(self._responses))
@ -88,7 +88,7 @@ class Receiver(face.ResponseReceiver):
if self._abortion is None: if self._abortion is None:
return list(self._responses) return list(self._responses)
else: else:
raise AssertionError('Aborted with abortion "%s"!' % self._abortion) raise AssertionError('Aborted: "{}"!'.format(self._abortion))
def abortion(self): def abortion(self):
with self._condition: with self._condition:

@ -525,12 +525,12 @@ typedef struct run_batch_stack {
grpc_status_code recv_status; grpc_status_code recv_status;
char *recv_status_details; char *recv_status_details;
size_t recv_status_details_capacity; size_t recv_status_details_capacity;
uint write_flag; unsigned write_flag;
} run_batch_stack; } run_batch_stack;
/* grpc_run_batch_stack_init ensures the run_batch_stack is properly /* grpc_run_batch_stack_init ensures the run_batch_stack is properly
* initialized */ * initialized */
static void grpc_run_batch_stack_init(run_batch_stack *st, uint write_flag) { static void grpc_run_batch_stack_init(run_batch_stack *st, unsigned write_flag) {
MEMZERO(st, run_batch_stack, 1); MEMZERO(st, run_batch_stack, 1);
grpc_metadata_array_init(&st->send_metadata); grpc_metadata_array_init(&st->send_metadata);
grpc_metadata_array_init(&st->send_trailing_metadata); grpc_metadata_array_init(&st->send_trailing_metadata);
@ -696,7 +696,7 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE cqueue, VALUE tag,
grpc_call_error err; grpc_call_error err;
VALUE result = Qnil; VALUE result = Qnil;
VALUE rb_write_flag = rb_ivar_get(self, id_write_flag); VALUE rb_write_flag = rb_ivar_get(self, id_write_flag);
uint write_flag = 0; unsigned write_flag = 0;
TypedData_Get_Struct(self, grpc_call, &grpc_call_data_type, call); TypedData_Get_Struct(self, grpc_call, &grpc_call_data_type, call);
/* Validate the ops args, adding them to a ruby array */ /* Validate the ops args, adding them to a ruby array */

@ -79,6 +79,7 @@ static VALUE grpc_rb_call_credentials_callback(VALUE callback_args) {
static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args, static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args,
VALUE exception_object) { VALUE exception_object) {
VALUE result = rb_hash_new(); VALUE result = rb_hash_new();
(void)args;
rb_hash_aset(result, rb_str_new2("metadata"), Qnil); rb_hash_aset(result, rb_str_new2("metadata"), Qnil);
/* Currently only gives the exception class name. It should be possible get /* Currently only gives the exception class name. It should be possible get
more details */ more details */
@ -132,6 +133,7 @@ static void grpc_rb_call_credentials_plugin_get_metadata(
} }
static void grpc_rb_call_credentials_plugin_destroy(void *state) { static void grpc_rb_call_credentials_plugin_destroy(void *state) {
(void)state;
// Not sure what needs to be done here // Not sure what needs to be done here
} }

@ -102,6 +102,7 @@ static void grpc_rb_event_queue_destroy() {
static void *grpc_rb_wait_for_event_no_gil(void *param) { static void *grpc_rb_wait_for_event_no_gil(void *param) {
grpc_rb_event *event = NULL; grpc_rb_event *event = NULL;
(void)param;
gpr_mu_lock(&event_queue.mu); gpr_mu_lock(&event_queue.mu);
while ((event = grpc_rb_event_queue_dequeue()) == NULL) { while ((event = grpc_rb_event_queue_dequeue()) == NULL) {
gpr_cv_wait(&event_queue.cv, gpr_cv_wait(&event_queue.cv,
@ -117,6 +118,7 @@ static void *grpc_rb_wait_for_event_no_gil(void *param) {
} }
static void grpc_rb_event_unblocking_func(void *arg) { static void grpc_rb_event_unblocking_func(void *arg) {
(void)arg;
gpr_mu_lock(&event_queue.mu); gpr_mu_lock(&event_queue.mu);
event_queue.abort = true; event_queue.abort = true;
gpr_cv_signal(&event_queue.cv); gpr_cv_signal(&event_queue.cv);
@ -127,6 +129,7 @@ static void grpc_rb_event_unblocking_func(void *arg) {
* events */ * events */
static VALUE grpc_rb_event_thread(VALUE arg) { static VALUE grpc_rb_event_thread(VALUE arg) {
grpc_rb_event *event; grpc_rb_event *event;
(void)arg;
while(true) { while(true) {
event = (grpc_rb_event*)rb_thread_call_without_gvl( event = (grpc_rb_event*)rb_thread_call_without_gvl(
grpc_rb_wait_for_event_no_gil, NULL, grpc_rb_wait_for_event_no_gil, NULL,

@ -130,26 +130,44 @@
prefix ?= /usr/local prefix ?= /usr/local
PROTOC = protoc PROTOC ?= protoc
DTRACE = dtrace DTRACE ?= dtrace
CONFIG ?= opt CONFIG ?= opt
# Doing X ?= Y is the same as:
# ifeq ($(origin X), undefined)
# X = Y
# endif
# but some variables, such as CC, CXX, LD or AR, have defaults.
# So instead of using ?= on them, we need to check their origin.
# See:
# https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
# https://www.gnu.org/software/make/manual/html_node/Flavors.html#index-_003f_003d
# https://www.gnu.org/software/make/manual/html_node/Origin-Function.html
ifeq ($(origin CC), default)
CC = $(CC_$(CONFIG)) CC = $(CC_$(CONFIG))
endif
ifeq ($(origin CXX), default)
CXX = $(CXX_$(CONFIG)) CXX = $(CXX_$(CONFIG))
endif
ifeq ($(origin LD), default)
LD = $(LD_$(CONFIG)) LD = $(LD_$(CONFIG))
LDXX = $(LDXX_$(CONFIG)) endif
LDXX ?= $(LDXX_$(CONFIG))
ifeq ($(origin AR), default)
AR = ar AR = ar
endif
ifeq ($(SYSTEM),Linux) ifeq ($(SYSTEM),Linux)
STRIP = strip --strip-unneeded STRIP ?= strip --strip-unneeded
else else
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
STRIP = strip -x STRIP ?= strip -x
else else
STRIP = strip STRIP ?= strip
endif endif
endif endif
INSTALL = install INSTALL ?= install
RM = rm -f RM ?= rm -f
PKG_CONFIG = pkg-config PKG_CONFIG ?= pkg-config
ifndef VALID_CONFIG_$(CONFIG) ifndef VALID_CONFIG_$(CONFIG)
$(error Invalid CONFIG value '$(CONFIG)') $(error Invalid CONFIG value '$(CONFIG)')
@ -165,15 +183,21 @@
CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc
HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false) HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false)
CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD = $(CC) -std=c99 -Werror -Wno-shift-negative-value -o $(TMPOUT) -c test/build/empty.c
HAS_NO_SHIFT_NEGATIVE_VALUE = $(shell $(CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD) 2> /dev/null && echo true || echo false)
ifeq ($(HAS_NO_SHIFT_NEGATIVE_VALUE),true)
W_NO_SHIFT_NEGATIVE_VALUE=-Wno-shift-negative-value
endif
# The HOST compiler settings are used to compile the protoc plugins. # The HOST compiler settings are used to compile the protoc plugins.
# In most cases, you won't have to change anything, but if you are # In most cases, you won't have to change anything, but if you are
# cross-compiling, you can override these variables from GNU make's # cross-compiling, you can override these variables from GNU make's
# command line: make CC=cross-gcc HOST_CC=gcc # command line: make CC=cross-gcc HOST_CC=gcc
HOST_CC = $(CC) HOST_CC ?= $(CC)
HOST_CXX = $(CXX) HOST_CXX ?= $(CXX)
HOST_LD = $(LD) HOST_LD ?= $(LD)
HOST_LDXX = $(LDXX) HOST_LDXX ?= $(LDXX)
ifdef EXTRA_DEFINES ifdef EXTRA_DEFINES
DEFINES += $(EXTRA_DEFINES) DEFINES += $(EXTRA_DEFINES)
@ -315,14 +339,6 @@
IS_GIT_FOLDER = true IS_GIT_FOLDER = true
endif endif
ifeq ($(SYSTEM),Linux)
OPENSSL_REQUIRES_DL = true
endif
ifeq ($(SYSTEM),Darwin)
OPENSSL_REQUIRES_DL = true
endif
ifeq ($(HAS_PKG_CONFIG),true) ifeq ($(HAS_PKG_CONFIG),true)
OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl
OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl
@ -341,11 +357,6 @@
ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS)
PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS)
ifeq ($(OPENSSL_REQUIRES_DL),true)
OPENSSL_ALPN_CHECK_CMD += -ldl
OPENSSL_NPN_CHECK_CMD += -ldl
endif
endif # HAS_PKG_CONFIG endif # HAS_PKG_CONFIG
PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS) PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS)
@ -509,9 +520,6 @@
OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/libboringssl.a OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/libboringssl.a
# need to prefix these to ensure overriding system libraries # need to prefix these to ensure overriding system libraries
CPPFLAGS := -Ithird_party/boringssl/include $(CPPFLAGS) CPPFLAGS := -Ithird_party/boringssl/include $(CPPFLAGS)
ifeq ($(OPENSSL_REQUIRES_DL),true)
LIBS_SECURE = dl
endif # OPENSSL_REQUIRES_DL
else # EMBED_OPENSSL=false else # EMBED_OPENSSL=false
ifeq ($(HAS_PKG_CONFIG),true) ifeq ($(HAS_PKG_CONFIG),true)
OPENSSL_PKG_CONFIG = true OPENSSL_PKG_CONFIG = true
@ -531,10 +539,7 @@
CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0
LIBS_SECURE = $(OPENSSL_LIBS) LIBS_SECURE = $(OPENSSL_LIBS)
endif # HAS_SYSTEM_OPENSSL_NPN endif # HAS_SYSTEM_OPENSSL_NPN
ifeq ($(OPENSSL_REQUIRES_DL),true)
LIBS_SECURE += dl
PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE))
endif # OPENSSL_REQUIRES_DL=true
endif # EMBED_OPENSSL endif # EMBED_OPENSSL
endif # NO_SECURE endif # NO_SECURE
@ -1438,7 +1443,7 @@
$(LIB${lib.name.upper()}_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -fvisibility=hidden $(LIB${lib.name.upper()}_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -fvisibility=hidden
$(LIB${lib.name.upper()}_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE $(LIB${lib.name.upper()}_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE
% elif lib.zlib: % elif lib.zlib:
$(LIB${lib.name.upper()}_OBJS): CFLAGS := $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration -fvisibility=hidden $(LIB${lib.name.upper()}_OBJS): CFLAGS := $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration $(W_NO_SHIFT_NEGATIVE_VALUE) -fvisibility=hidden
% else: % else:
% endif % endif

@ -7,7 +7,7 @@
# This file can be regenerated from the template by running # This file can be regenerated from the template by running
# tools/buildgen/generate_projects.sh # tools/buildgen/generate_projects.sh
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -56,12 +56,16 @@
], ],
'include_dirs': [ 'include_dirs': [
'.', '.',
'include', 'include'
],
'conditions': [
['OS == "win"', {
"include_dirs": [ "third_party/boringssl/include" ]
}, {
'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include', '<(node_root_dir)/deps/openssl/openssl/include',
'<(node_root_dir)/deps/zlib' '<(node_root_dir)/deps/zlib'
], ],
'conditions': [
['OS != "win"', {
'conditions': [ 'conditions': [
['config=="gcov"', { ['config=="gcov"', {
'cflags': [ 'cflags': [
@ -74,9 +78,7 @@
'-fprofile-arcs' '-fprofile-arcs'
] ]
} }
] ],
]
}],
["target_arch=='ia32'", { ["target_arch=='ia32'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ] "include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ]
}], }],
@ -87,11 +89,47 @@
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ] "include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ]
}] }]
] ]
}]
]
}, },
'conditions': [
['OS == "win"', {
'targets': [ 'targets': [
# Only want to compile BoringSSL and zlib under Windows
% for module in node_modules: % for module in node_modules:
% for lib in libs: % for lib in libs:
% if lib.name in module.transitive_deps: % if lib.name in module.transitive_deps and lib.name in ('boringssl', 'z'):
{
'cflags': [
'-std=c99',
'-Wall',
'-Werror'
],
'target_name': '${lib.name}',
'product_prefix': 'lib',
'type': 'static_library',
'dependencies': [
% for dep in getattr(lib, 'deps', []):
'${dep}',
% endfor
],
'sources': [
% for source in lib.src:
'${source}',
% endfor
],
"include_dirs": [ "third_party/boringssl/include" ]
},
% endif
% endfor
% endfor
]
}]
],
'targets': [
% for module in node_modules:
% for lib in libs:
% if lib.name in module.transitive_deps and lib.name not in ('boringssl', 'z'):
{ {
'cflags': [ 'cflags': [
'-std=c99', '-std=c99',
@ -117,7 +155,7 @@
'MACOSX_DEPLOYMENT_TARGET': '10.9' 'MACOSX_DEPLOYMENT_TARGET': '10.9'
} }
}] }]
], ]
}, },
% endif % endif
% endfor % endfor
@ -145,6 +183,15 @@
'-stdlib=libc++' '-stdlib=libc++'
] ]
} }
}],
['OS=="win"', {
'dependencies': [
% for dep in getattr(module, 'deps', []):
% if dep in ('boringssl', 'z'):
"${dep}",
% endif
% endfor
]
}] }]
], ],
"target_name": "${module.name}", "target_name": "${module.name}",
@ -155,10 +202,23 @@
], ],
"dependencies": [ "dependencies": [
% for dep in getattr(module, 'deps', []): % for dep in getattr(module, 'deps', []):
% if dep not in ('boringssl', 'z'):
"${dep}", "${dep}",
% endif
% endfor % endfor
] ]
}, },
% endfor % endfor
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node"],
"destination": "<(module_path)"
}
]
}
] ]
} }

@ -24,12 +24,14 @@
"lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/interop src/node/index.js", "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", "test": "./node_modules/.bin/mocha src/node/test && npm run-script lint",
"gen_docs": "./node_modules/.bin/jsdoc -c src/node/jsdoc_conf.json", "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" "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test",
"preinstall": "npm install node-pre-gyp",
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build"
}, },
"dependencies": { "dependencies": {
"bindings": "^1.2.0",
"lodash": "^3.9.3", "lodash": "^3.9.3",
"nan": "^2.0.0", "nan": "^2.0.0",
"node-pre-gyp": "^0.6.19",
"protobufjs": "^4.0.0" "protobufjs": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
@ -47,6 +49,14 @@
"engines": { "engines": {
"node": ">=0.10.13" "node": ">=0.10.13"
}, },
"binary": {
"module_name": "grpc_node",
"module_path": "./build/Release/",
"host": "https://storage.googleapis.com/",
"remote_path": "grpc-precompiled-binaries/node/{name}/v{version}",
"package_name": "{node_abi}-{platform}-{arch}.tar.gz",
"module_path": "src/node/extension_binary"
},
"files": [ "files": [
"LICENSE", "LICENSE",
"src/node/README.md", "src/node/README.md",

@ -2,7 +2,7 @@
--- | --- |
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

@ -2,7 +2,7 @@
--- | --- |
#region Copyright notice and license #region Copyright notice and license
// Copyright 2015, Google Inc. // Copyright 2015-2016, Google Inc.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -161,6 +161,8 @@ std::unique_ptr<ScenarioResult> RunScenario(
// where class contained in std::vector must have a copy constructor // where class contained in std::vector must have a copy constructor
auto* servers = new ServerData[num_servers]; auto* servers = new ServerData[num_servers];
for (size_t i = 0; i < num_servers; i++) { for (size_t i = 0; i < num_servers; i++) {
gpr_log(GPR_INFO, "Starting server on %s (worker #%d)", workers[i].c_str(),
i);
servers[i].stub = WorkerService::NewStub( servers[i].stub = WorkerService::NewStub(
CreateChannel(workers[i], InsecureChannelCredentials())); CreateChannel(workers[i], InsecureChannelCredentials()));
ServerArgs args; ServerArgs args;
@ -188,6 +190,8 @@ std::unique_ptr<ScenarioResult> RunScenario(
// where class contained in std::vector must have a copy constructor // where class contained in std::vector must have a copy constructor
auto* clients = new ClientData[num_clients]; auto* clients = new ClientData[num_clients];
for (size_t i = 0; i < num_clients; i++) { for (size_t i = 0; i < num_clients; i++) {
gpr_log(GPR_INFO, "Starting client on %s (worker #%d)",
workers[i + num_servers].c_str(), i + num_servers);
clients[i].stub = WorkerService::NewStub( clients[i].stub = WorkerService::NewStub(
CreateChannel(workers[i + num_servers], InsecureChannelCredentials())); CreateChannel(workers[i + num_servers], InsecureChannelCredentials()));
ClientArgs args; ClientArgs args;

@ -60,7 +60,7 @@ static void RunGenericAsyncStreamingPingPong() {
bbuf->set_req_size(0); bbuf->set_req_size(0);
ServerConfig server_config; ServerConfig server_config;
server_config.set_server_type(ASYNC_SERVER); server_config.set_server_type(ASYNC_GENERIC_SERVER);
server_config.set_host("localhost"); server_config.set_host("localhost");
server_config.set_async_server_threads(1); server_config.set_async_server_threads(1);

@ -153,7 +153,7 @@ static void QpsDriver() {
ServerConfig server_config; ServerConfig server_config;
server_config.set_server_type(server_type); server_config.set_server_type(server_type);
server_config.set_host("localhost"); server_config.set_host("::"); // Use the wildcard server address
server_config.set_async_server_threads(FLAGS_async_server_threads); server_config.set_async_server_threads(FLAGS_async_server_threads);
if (FLAGS_secure_test) { if (FLAGS_secure_test) {
@ -170,7 +170,7 @@ static void QpsDriver() {
GPR_ASSERT(!client_config.payload_config().has_bytebuf_params() || GPR_ASSERT(!client_config.payload_config().has_bytebuf_params() ||
(client_config.client_type() == ASYNC_CLIENT && (client_config.client_type() == ASYNC_CLIENT &&
client_config.rpc_type() == STREAMING && client_config.rpc_type() == STREAMING &&
server_config.server_type() == ASYNC_SERVER)); server_config.server_type() == ASYNC_GENERIC_SERVER));
const auto result = RunScenario( const auto result = RunScenario(
client_config, FLAGS_num_clients, server_config, FLAGS_num_servers, client_config, FLAGS_num_clients, server_config, FLAGS_num_servers,

@ -61,6 +61,11 @@ namespace grpc {
namespace testing { namespace testing {
static std::unique_ptr<Client> CreateClient(const ClientConfig& config) { static std::unique_ptr<Client> CreateClient(const ClientConfig& config) {
gpr_log(GPR_INFO, "Starting client of type %s %s %d",
ClientType_Name(config.client_type()).c_str(),
RpcType_Name(config.rpc_type()).c_str(),
config.payload_config().has_bytebuf_params());
switch (config.client_type()) { switch (config.client_type()) {
case ClientType::SYNC_CLIENT: case ClientType::SYNC_CLIENT:
return (config.rpc_type() == RpcType::UNARY) return (config.rpc_type() == RpcType::UNARY)
@ -81,6 +86,9 @@ static std::unique_ptr<Client> CreateClient(const ClientConfig& config) {
static void LimitCores(int cores) {} static void LimitCores(int cores) {}
static std::unique_ptr<Server> CreateServer(const ServerConfig& config) { static std::unique_ptr<Server> CreateServer(const ServerConfig& config) {
gpr_log(GPR_INFO, "Starting server of type %s",
ServerType_Name(config.server_type()).c_str());
if (config.core_limit() > 0) { if (config.core_limit() > 0) {
LimitCores(config.core_limit()); LimitCores(config.core_limit());
} }
@ -89,6 +97,8 @@ static std::unique_ptr<Server> CreateServer(const ServerConfig& config) {
return CreateSynchronousServer(config); return CreateSynchronousServer(config);
case ServerType::ASYNC_SERVER: case ServerType::ASYNC_SERVER:
return CreateAsyncServer(config); return CreateAsyncServer(config);
case ServerType::ASYNC_GENERIC_SERVER:
return CreateAsyncGenericServer(config);
default: default:
abort(); abort();
} }
@ -169,22 +179,29 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
if (!args.has_setup()) { if (!args.has_setup()) {
return Status(StatusCode::INVALID_ARGUMENT, ""); return Status(StatusCode::INVALID_ARGUMENT, "");
} }
gpr_log(GPR_INFO, "RunClientBody: about to create client");
auto client = CreateClient(args.setup()); auto client = CreateClient(args.setup());
if (!client) { if (!client) {
return Status(StatusCode::INVALID_ARGUMENT, ""); return Status(StatusCode::INVALID_ARGUMENT, "");
} }
gpr_log(GPR_INFO, "RunClientBody: client created");
ClientStatus status; ClientStatus status;
if (!stream->Write(status)) { if (!stream->Write(status)) {
return Status(StatusCode::UNKNOWN, ""); return Status(StatusCode::UNKNOWN, "");
} }
gpr_log(GPR_INFO, "RunClientBody: creation status reported");
while (stream->Read(&args)) { while (stream->Read(&args)) {
gpr_log(GPR_INFO, "RunClientBody: Message read");
if (!args.has_mark()) { if (!args.has_mark()) {
gpr_log(GPR_INFO, "RunClientBody: Message is not a mark!");
return Status(StatusCode::INVALID_ARGUMENT, ""); return Status(StatusCode::INVALID_ARGUMENT, "");
} }
*status.mutable_stats() = client->Mark(args.mark().reset()); *status.mutable_stats() = client->Mark(args.mark().reset());
stream->Write(status); stream->Write(status);
gpr_log(GPR_INFO, "RunClientBody: Mark response given");
} }
gpr_log(GPR_INFO, "RunClientBody: Returning");
return Status::OK; return Status::OK;
} }
@ -200,24 +217,31 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
if (server_port_ != 0) { if (server_port_ != 0) {
args.mutable_setup()->set_port(server_port_); args.mutable_setup()->set_port(server_port_);
} }
gpr_log(GPR_INFO, "RunServerBody: about to create server");
auto server = CreateServer(args.setup()); auto server = CreateServer(args.setup());
if (!server) { if (!server) {
return Status(StatusCode::INVALID_ARGUMENT, ""); return Status(StatusCode::INVALID_ARGUMENT, "");
} }
gpr_log(GPR_INFO, "RunServerBody: server created");
ServerStatus status; ServerStatus status;
status.set_port(server->port()); status.set_port(server->port());
status.set_cores(server->cores()); status.set_cores(server->cores());
if (!stream->Write(status)) { if (!stream->Write(status)) {
return Status(StatusCode::UNKNOWN, ""); return Status(StatusCode::UNKNOWN, "");
} }
gpr_log(GPR_INFO, "RunServerBody: creation status reported");
while (stream->Read(&args)) { while (stream->Read(&args)) {
gpr_log(GPR_INFO, "RunServerBody: Message read");
if (!args.has_mark()) { if (!args.has_mark()) {
gpr_log(GPR_INFO, "RunServerBody: Message not a mark!");
return Status(StatusCode::INVALID_ARGUMENT, ""); return Status(StatusCode::INVALID_ARGUMENT, "");
} }
*status.mutable_stats() = server->Mark(args.mark().reset()); *status.mutable_stats() = server->Mark(args.mark().reset());
stream->Write(status); stream->Write(status);
gpr_log(GPR_INFO, "RunServerBody: Mark response given");
} }
gpr_log(GPR_INFO, "RunServerBody: Returning");
return Status::OK; return Status::OK;
} }

@ -108,6 +108,7 @@ class Server {
std::unique_ptr<Server> CreateSynchronousServer(const ServerConfig& config); std::unique_ptr<Server> CreateSynchronousServer(const ServerConfig& config);
std::unique_ptr<Server> CreateAsyncServer(const ServerConfig& config); std::unique_ptr<Server> CreateAsyncServer(const ServerConfig& config);
std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig& config);
} // namespace testing } // namespace testing
} // namespace grpc } // namespace grpc

@ -373,7 +373,7 @@ static Status ProcessGenericRPC(const PayloadConfig &payload_config,
const ByteBuffer *request, const ByteBuffer *request,
ByteBuffer *response) { ByteBuffer *response) {
int resp_size = payload_config.bytebuf_params().resp_size(); int resp_size = payload_config.bytebuf_params().resp_size();
std::unique_ptr<char> buf(new char[resp_size]); std::unique_ptr<char[]> buf(new char[resp_size]);
gpr_slice s = gpr_slice_from_copied_buffer(buf.get(), resp_size); gpr_slice s = gpr_slice_from_copied_buffer(buf.get(), resp_size);
Slice slice(s, Slice::STEAL_REF); Slice slice(s, Slice::STEAL_REF);
*response = ByteBuffer(&slice, 1); *response = ByteBuffer(&slice, 1);

@ -47,6 +47,7 @@ os.chdir(os.path.join(os.path.dirname(sys.argv[0]), '..', '..'))
argp = argparse.ArgumentParser() argp = argparse.ArgumentParser()
argp.add_argument('json', nargs='+') argp.add_argument('json', nargs='+')
argp.add_argument('--templates', nargs='+', default=[]) argp.add_argument('--templates', nargs='+', default=[])
argp.add_argument('--jobs', '-j', default=multiprocessing.cpu_count(), type=int)
args = argp.parse_args() args = argp.parse_args()
json = args.json json = args.json
@ -87,7 +88,7 @@ for template in templates:
cmd.append(root + '/' + f) cmd.append(root + '/' + f)
jobs.append(jobset.JobSpec(cmd, shortname=out, timeout_seconds=None)) jobs.append(jobset.JobSpec(cmd, shortname=out, timeout_seconds=None))
jobset.run(jobs, maxjobs=multiprocessing.cpu_count()) jobset.run(jobs, maxjobs=args.jobs)
if test is not None: if test is not None:
for s, g in test.iteritems(): for s, g in test.iteritems():

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -45,4 +45,4 @@ make install-certs
# build Node interop client & server # build Node interop client & server
npm install -g node-gyp npm install -g node-gyp
(npm install && node-gyp rebuild) npm install --unsafe-perm --build-from-source

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without

@ -47,11 +47,15 @@ mkdir -p /tmp/xdg-cache-home
# Create a local branch so the child Docker script won't complain # Create a local branch so the child Docker script won't complain
git branch -f jenkins-docker git branch -f jenkins-docker
# Use image name based on Dockerfile checksum # Inputs
DOCKER_IMAGE_NAME=grpc_jenkins_slave${docker_suffix}_`sha1sum tools/jenkins/grpc_jenkins_slave/Dockerfile | cut -f1 -d\ ` # DOCKERFILE_DIR - Directory in which Dockerfile file is located.
# DOCKER_RUN_SCRIPT - Script to run under docker (relative to grpc repo root)
# Use image name based on Dockerfile location checksum
DOCKER_IMAGE_NAME=$(basename $DOCKERFILE_DIR)_$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ )
# Make sure docker image has been built. Should be instantaneous if so. # Make sure docker image has been built. Should be instantaneous if so.
docker build -t $DOCKER_IMAGE_NAME tools/jenkins/grpc_jenkins_slave$docker_suffix docker build -t $DOCKER_IMAGE_NAME $DOCKERFILE_DIR
# Choose random name for docker container # Choose random name for docker container
CONTAINER_NAME="run_tests_$(uuidgen)" CONTAINER_NAME="run_tests_$(uuidgen)"
@ -76,7 +80,7 @@ docker run \
-w /var/local/git/grpc \ -w /var/local/git/grpc \
--name=$CONTAINER_NAME \ --name=$CONTAINER_NAME \
$DOCKER_IMAGE_NAME \ $DOCKER_IMAGE_NAME \
bash -l /var/local/jenkins/grpc/tools/jenkins/docker_run_tests.sh || DOCKER_FAILED="true" bash -l "/var/local/jenkins/grpc/$DOCKER_RUN_SCRIPT" || DOCKER_FAILED="true"
if [ "$XML_REPORT" != "" ] if [ "$XML_REPORT" != "" ]
then then

@ -71,10 +71,10 @@ then
fi fi
# Use image name based on Dockerfile checksum # Use image name based on Dockerfile checksum
BASE_IMAGE=${BASE_NAME}_base:`sha1sum tools/jenkins/$BASE_NAME/Dockerfile | cut -f1 -d\ ` BASE_IMAGE=${BASE_NAME}_base:`sha1sum tools/dockerfile/$BASE_NAME/Dockerfile | cut -f1 -d\ `
# Make sure base docker image has been built. Should be instantaneous if so. # 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 $? docker build -t $BASE_IMAGE --force-rm=true tools/dockerfile/$BASE_NAME || exit $?
# Create a local branch so the child Docker script won't complain # Create a local branch so the child Docker script won't complain
git branch -f jenkins-docker git branch -f jenkins-docker
@ -92,7 +92,7 @@ CONTAINER_NAME="build_${BASE_NAME}_$(uuidgen)"
-v /tmp/ccache:/tmp/ccache \ -v /tmp/ccache:/tmp/ccache \
--name=$CONTAINER_NAME \ --name=$CONTAINER_NAME \
$BASE_IMAGE \ $BASE_IMAGE \
bash -l /var/local/jenkins/grpc/tools/jenkins/$BASE_NAME/build_interop.sh \ bash -l /var/local/jenkins/grpc/tools/dockerfile/$BASE_NAME/build_interop.sh \
&& docker commit $CONTAINER_NAME $INTEROP_IMAGE \ && docker commit $CONTAINER_NAME $INTEROP_IMAGE \
&& echo "Successfully built image $INTEROP_IMAGE") && echo "Successfully built image $INTEROP_IMAGE")
EXITCODE=$? EXITCODE=$?

@ -55,10 +55,10 @@ then
fi fi
# Use image name based on Dockerfile checksum # Use image name based on Dockerfile checksum
BASE_IMAGE=${BASE_NAME}_base:`sha1sum tools/jenkins/$BASE_NAME/Dockerfile | cut -f1 -d\ ` BASE_IMAGE=${BASE_NAME}_base:`sha1sum tools/dockerfile/$BASE_NAME/Dockerfile | cut -f1 -d\ `
# Make sure base docker image has been built. Should be instantaneous if so. # 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 $? docker build -t $BASE_IMAGE --force-rm=true tools/dockerfile/$BASE_NAME || exit $?
# Create a local branch so the child Docker script won't complain # Create a local branch so the child Docker script won't complain
git branch -f jenkins-docker git branch -f jenkins-docker
@ -75,7 +75,7 @@ CONTAINER_NAME="build_${BASE_NAME}_$(uuidgen)"
-v /tmp/ccache:/tmp/ccache \ -v /tmp/ccache:/tmp/ccache \
--name=$CONTAINER_NAME \ --name=$CONTAINER_NAME \
$BASE_IMAGE \ $BASE_IMAGE \
bash -l /var/local/jenkins/grpc/tools/jenkins/$BASE_NAME/build_interop_stress.sh \ bash -l /var/local/jenkins/grpc/tools/dockerfile/$BASE_NAME/build_interop_stress.sh \
&& docker commit $CONTAINER_NAME $INTEROP_IMAGE \ && docker commit $CONTAINER_NAME $INTEROP_IMAGE \
&& echo "Successfully built image $INTEROP_IMAGE") && echo "Successfully built image $INTEROP_IMAGE")
EXITCODE=$? EXITCODE=$?

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -47,11 +47,11 @@ if [ "$platform" == "linux" ]; then
if [ "$dist_channel" == "homebrew" ]; then if [ "$dist_channel" == "homebrew" ]; then
sha1=$(sha1sum tools/jenkins/grpc_linuxbrew/Dockerfile | cut -f1 -d\ ) sha1=$(sha1sum tools/dockerfile/grpc_linuxbrew/Dockerfile | cut -f1 -d\ )
DOCKER_IMAGE_NAME=grpc_linuxbrew_$sha1 DOCKER_IMAGE_NAME=grpc_linuxbrew_$sha1
# build docker image, contains all pre-requisites # build docker image, contains all pre-requisites
docker build -t $DOCKER_IMAGE_NAME tools/jenkins/grpc_linuxbrew docker build -t $DOCKER_IMAGE_NAME tools/dockerfile/grpc_linuxbrew
# run per-language homebrew installation script # run per-language homebrew installation script
docker run --rm=true $DOCKER_IMAGE_NAME bash -l \ docker run --rm=true $DOCKER_IMAGE_NAME bash -l \

@ -39,51 +39,17 @@
# NOTE: No empty lines should appear in this file before igncr is set! # NOTE: No empty lines should appear in this file before igncr is set!
set -ex -o igncr || set -ex set -ex -o igncr || set -ex
# Grabbing the machine's architecture
arch=`uname -m`
case $platform in
i386)
arch="i386"
platform="linux"
docker_suffix=_32bits
;;
esac
if [ "$platform" == "linux" ] if [ "$platform" == "linux" ]
then then
echo "building $language on Linux" USE_DOCKER_MAYBE="--use_docker"
./tools/run_tests/run_tests.py --use_docker -t -l $language -c $config -x report.xml -j 3 $@ || TESTS_FAILED="true"
elif [ "$platform" == "windows" ]
then
echo "building $language on Windows"
# Prevent msbuild from picking up "platform" env variable, which would break the build
unset platform
python tools/run_tests/run_tests.py -t -l $language -c $config -x report.xml -j 3 $@ || TESTS_FAILED="true"
elif [ "$platform" == "macos" ]
then
echo "building $language on MacOS"
# Prevent msbuild from picking up "platform" env variable, which would break the build
unset platform
./tools/run_tests/run_tests.py -t -l $language -c $config -x report.xml -j 3 $@ || TESTS_FAILED="true"
elif [ "$platform" == "freebsd" ] elif [ "$platform" == "freebsd" ]
then then
echo "building $language on FreeBSD" export MAKE=gmake
fi
MAKE=gmake ./tools/run_tests/run_tests.py -t -l $language -c $config -x report.xml -j 3 $@ || TESTS_FAILED="true" unset platform # variable named 'platform' breaks the windows build
else python tools/run_tests/run_tests.py $USE_DOCKER_MAYBE -t -l $language -c $config -x report.xml -j 3 $@ || TESTS_FAILED="true"
echo "Unknown platform $platform"
exit 1
fi
if [ ! -e reports/index.html ] if [ ! -e reports/index.html ]
then then

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -52,8 +52,7 @@ maybe_build_only='--build_only'
if [ "$curr_platform" == "windows" ] if [ "$curr_platform" == "windows" ]
then then
win_arch="windows_${curr_arch}" python tools/run_tests/run_tests.py -t -l $language -c $config --arch ${curr_arch} --compiler ${curr_compiler} ${maybe_build_only} -x report.xml $@
python tools/run_tests/run_tests.py -t -l $language -c $config --arch ${win_arch} --compiler ${curr_compiler} ${maybe_build_only} -x report.xml $@
else else
echo "Unsupported scenario." echo "Unsupported scenario."
exit 1 exit 1

@ -135,7 +135,7 @@ class CSharpExtArtifact:
'EMBED_ZLIB': 'true'} 'EMBED_ZLIB': 'true'}
if self.platform == 'linux': if self.platform == 'linux':
return create_docker_jobspec(self.name, return create_docker_jobspec(self.name,
'tools/jenkins/grpc_artifact_linux_%s' % self.arch, 'tools/dockerfile/grpc_artifact_linux_%s' % self.arch,
'tools/run_tests/build_artifact_csharp.sh') 'tools/run_tests/build_artifact_csharp.sh')
else: else:
environ.update(macos_arch_env(self.arch)) environ.update(macos_arch_env(self.arch))

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -36,4 +36,4 @@ CONFIG=${CONFIG:-opt}
# change to grpc repo root # change to grpc repo root
cd $(dirname $0)/../.. cd $(dirname $0)/../..
npm install --unsafe-perm npm install --unsafe-perm --build-from-source

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -51,5 +51,5 @@ then
echo '<html><head><meta http-equiv="refresh" content="0;URL=lcov-report/index.html"></head></html>' > \ echo '<html><head><meta http-equiv="refresh" content="0;URL=lcov-report/index.html"></head></html>' > \
../reports/node_coverage/index.html ../reports/node_coverage/index.html
else else
JUNIT_REPORT_PATH=src/node/reports.xml JUNIT_REPORT_STACK=1 ./node_modules/.bin/mocha --reporter mocha-jenkins-reporter src/node/test || true JUNIT_REPORT_PATH=src/node/reports.xml JUNIT_REPORT_STACK=1 ./node_modules/.bin/mocha --reporter mocha-jenkins-reporter src/node/test
fi fi

@ -452,7 +452,7 @@ class Sanity(object):
def test_specs(self, config, args): def test_specs(self, config, args):
import yaml import yaml
with open('tools/run_tests/sanity_tests.yaml', 'r') as f: with open('tools/run_tests/sanity_tests.yaml', 'r') as f:
return [config.job_spec([cmd['script']], None, timeout_seconds=None, environ={'TEST': 'true'}, cpu_cost=cmd.get('cpu_cost', 1)) return [config.job_spec(cmd['script'].split(), None, timeout_seconds=None, environ={'TEST': 'true'}, cpu_cost=cmd.get('cpu_cost', 1))
for cmd in yaml.load(f)] for cmd in yaml.load(f)]
def pre_build_steps(self): def pre_build_steps(self):
@ -538,12 +538,34 @@ _WINDOWS_CONFIG = {
def _windows_arch_option(arch): def _windows_arch_option(arch):
"""Returns msbuild cmdline option for selected architecture.""" """Returns msbuild cmdline option for selected architecture."""
if arch == 'default' or arch == 'windows_x86': if arch == 'default' or arch == 'x86':
return '/p:Platform=Win32' return '/p:Platform=Win32'
elif arch == 'windows_x64': elif arch == 'x64':
return '/p:Platform=x64' return '/p:Platform=x64'
else: else:
print 'Architecture %s not supported on current platform.' % arch print 'Architecture %s not supported.' % arch
sys.exit(1)
def _check_arch_option(arch):
"""Checks that architecture option is valid."""
if platform_string() == 'windows':
_windows_arch_option(arch)
elif platform_string() == 'linux':
# On linux, we need to be running under docker with the right architecture.
runtime_arch = platform.architecture()[0]
if arch == 'default':
return
elif runtime_arch == '64bit' and arch == 'x64':
return
elif runtime_arch == '32bit' and arch == 'x86':
return
else:
print 'Architecture %s does not match current runtime architecture.' % arch
sys.exit(1)
else:
if args.arch != 'default':
print 'Architecture %s not supported on current platform.' % args.arch
sys.exit(1) sys.exit(1)
@ -573,6 +595,16 @@ def _windows_toolset_option(compiler):
sys.exit(1) sys.exit(1)
def _get_dockerfile_dir(arch):
"""Returns dockerfile to use"""
if arch == 'default' or arch == 'x64':
return 'tools/dockerfile/grpc_jenkins_slave_x64'
elif arch == 'x86':
return 'tools/dockerfile/grpc_jenkins_slave_x86'
else:
print 'Architecture %s not supported with current settings.' % arch
sys.exit(1)
def runs_per_test_type(arg_str): def runs_per_test_type(arg_str):
"""Auxilary function to parse the "runs_per_test" flag. """Auxilary function to parse the "runs_per_test" flag.
@ -638,7 +670,7 @@ argp.add_argument('--allow_flakes',
const=True, const=True,
help='Allow flaky tests to show as passing (re-runs failed tests up to five times)') help='Allow flaky tests to show as passing (re-runs failed tests up to five times)')
argp.add_argument('--arch', argp.add_argument('--arch',
choices=['default', 'windows_x86', 'windows_x64'], choices=['default', 'x86', 'x64'],
default='default', default='default',
help='Selects architecture to target. For some platforms "default" is the only supported choice.') help='Selects architecture to target. For some platforms "default" is the only supported choice.')
argp.add_argument('--compiler', argp.add_argument('--compiler',
@ -662,36 +694,6 @@ args = argp.parse_args()
jobset.measure_cpu_costs = args.measure_cpu_costs jobset.measure_cpu_costs = args.measure_cpu_costs
if args.use_docker:
if not args.travis:
print 'Seen --use_docker flag, will run tests under docker.'
print
print 'IMPORTANT: The changes you are testing need to be locally committed'
print 'because only the committed changes in the current branch will be'
print 'copied to the docker environment.'
time.sleep(5)
child_argv = [ arg for arg in sys.argv if not arg == '--use_docker' ]
run_tests_cmd = 'tools/run_tests/run_tests.py %s' % ' '.join(child_argv[1:])
# TODO(jtattermusch): revisit if we need special handling for arch here
# set arch command prefix in case we are working with different arch.
arch_env = os.getenv('arch')
if arch_env:
run_test_cmd = 'arch %s %s' % (arch_env, run_test_cmd)
env = os.environ.copy()
env['RUN_TESTS_COMMAND'] = run_tests_cmd
if args.xml_report:
env['XML_REPORT'] = args.xml_report
if not args.travis:
env['TTY_FLAG'] = '-t' # enables Ctrl-C when not on Jenkins.
subprocess.check_call(['tools/jenkins/build_docker_and_run_tests.sh'],
shell=True,
env=env)
sys.exit(0)
# update submodules if necessary # update submodules if necessary
need_to_regenerate_projects = False need_to_regenerate_projects = False
for spec in args.update_submodules: for spec in args.update_submodules:
@ -755,16 +757,44 @@ if any(language.make_options() for language in languages):
else: else:
language_make_options = next(iter(languages)).make_options() language_make_options = next(iter(languages)).make_options()
if platform_string() != 'windows': if len(languages) != 1 or len(build_configs) != 1:
if args.arch != 'default': print 'Multi-language and multi-config testing is not supported.'
print 'Architecture %s not supported on current platform.' % args.arch
sys.exit(1) sys.exit(1)
if args.compiler != 'default':
if args.use_docker:
if not args.travis:
print 'Seen --use_docker flag, will run tests under docker.'
print
print 'IMPORTANT: The changes you are testing need to be locally committed'
print 'because only the committed changes in the current branch will be'
print 'copied to the docker environment.'
time.sleep(5)
child_argv = [ arg for arg in sys.argv if not arg == '--use_docker' ]
run_tests_cmd = 'tools/run_tests/run_tests.py %s' % ' '.join(child_argv[1:])
env = os.environ.copy()
env['RUN_TESTS_COMMAND'] = run_tests_cmd
env['DOCKERFILE_DIR'] = _get_dockerfile_dir(args.arch)
env['DOCKER_RUN_SCRIPT'] = 'tools/jenkins/docker_run_tests.sh'
if args.xml_report:
env['XML_REPORT'] = args.xml_report
if not args.travis:
env['TTY_FLAG'] = '-t' # enables Ctrl-C when not on Jenkins.
subprocess.check_call(['tools/jenkins/build_docker_and_run_tests.sh'],
shell=True,
env=env)
sys.exit(0)
if platform_string() != 'windows' and args.compiler != 'default':
print 'Compiler %s not supported on current platform.' % args.compiler print 'Compiler %s not supported on current platform.' % args.compiler
sys.exit(1) sys.exit(1)
if platform_string() == 'windows': _check_arch_option(args.arch)
def make_jobspec(cfg, targets, makefile='Makefile'): def make_jobspec(cfg, targets, makefile='Makefile'):
if platform_string() == 'windows':
extra_args = [] extra_args = []
# better do parallel compilation # better do parallel compilation
# empirically /m:2 gives the best performance/price and should prevent # empirically /m:2 gives the best performance/price and should prevent
@ -783,7 +813,6 @@ if platform_string() == 'windows':
shell=True, timeout_seconds=None) shell=True, timeout_seconds=None)
for target in targets] for target in targets]
else: else:
def make_jobspec(cfg, targets, makefile='Makefile'):
if targets: if targets:
return [jobset.JobSpec([os.getenv('MAKE', 'make'), return [jobset.JobSpec([os.getenv('MAKE', 'make'),
'-f', makefile, '-f', makefile,
@ -796,6 +825,7 @@ else:
timeout_seconds=None)] timeout_seconds=None)]
else: else:
return [] return []
make_targets = {} make_targets = {}
for l in languages: for l in languages:
makefile = l.makefile_name() makefile = l.makefile_name()

@ -2,8 +2,8 @@
- script: tools/run_tests/check_sources_and_headers.py - script: tools/run_tests/check_sources_and_headers.py
- script: tools/run_tests/check_submodules.sh - script: tools/run_tests/check_submodules.sh
- script: tools/run_tests/check_cache_mk.sh - script: tools/run_tests/check_cache_mk.sh
- script: tools/buildgen/generate_projects.sh - script: tools/buildgen/generate_projects.sh -j 3
cpu_cost: 100 cpu_cost: 3
- script: tools/distrib/check_copyright.py - script: tools/distrib/check_copyright.py
- script: tools/distrib/clang_format_code.sh - script: tools/distrib/clang_format_code.sh
- script: tools/distrib/check_trailing_newlines.sh - script: tools/distrib/check_trailing_newlines.sh

@ -5,4 +5,4 @@ race:cleanse_ctr
# https://www.mail-archive.com/openssl-dev@openssl.org/msg09019.html # https://www.mail-archive.com/openssl-dev@openssl.org/msg09019.html
race:ssleay_rand_add race:ssleay_rand_add
race:ssleay_rand_bytes race:ssleay_rand_bytes
race:__sleep_for

Loading…
Cancel
Save