Merge github.com:grpc/grpc into one-pass

Conflicts:
	Makefile
pull/1369/head
Craig Tiller 10 years ago
commit f0ebc99dc1
  1. 1275
      Makefile
  2. 42
      build.json
  3. 6
      src/node/README.md
  4. 22
      src/node/ext/completion_queue_async_worker.cc
  5. 5
      src/node/ext/completion_queue_async_worker.h
  6. 2
      src/node/package.json
  7. 4
      src/ruby/bin/interop/interop_client.rb
  8. 29
      templates/Makefile.template
  9. 4
      test/core/end2end/gen_build_json.py
  10. 66
      test/cpp/end2end/end2end_test.cc
  11. 2
      tools/dockerfile/grpc_ruby/Dockerfile
  12. 1
      tools/gce_setup/grpc_docker.sh
  13. 11
      vsprojects/grpc.sln
  14. 4
      vsprojects/grpc_test_util/grpc_test_util.vcxproj
  15. 117
      vsprojects/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj

1275
Makefile

File diff suppressed because it is too large Load Diff

@ -277,6 +277,19 @@
"src/core/transport/transport.c",
"src/core/transport/transport_op_string.c"
]
},
{
"name": "grpc_test_util_base",
"src": [
"test/core/end2end/cq_verifier.c",
"test/core/iomgr/endpoint_tests.c",
"test/core/statistics/census_log_tests.c",
"test/core/util/grpc_profiler.c",
"test/core/util/parse_hexstring.c",
"test/core/util/port_posix.c",
"test/core/util/port_windows.c",
"test/core/util/slice_splitter.c"
]
}
],
"libs": [
@ -373,6 +386,7 @@
"deps": [
"gpr"
],
"secure": "no",
"vs_project_guid": "{EAB0A629-17A9-44DB-B5FF-E91A721FE037}"
},
{
@ -436,25 +450,35 @@
"build": "private",
"language": "c",
"src": [
"test/core/end2end/cq_verifier.c",
"test/core/end2end/data/server1_cert.c",
"test/core/end2end/data/server1_key.c",
"test/core/end2end/data/test_root_cert.c",
"test/core/iomgr/endpoint_tests.c",
"test/core/statistics/census_log_tests.c",
"test/core/util/grpc_profiler.c",
"test/core/util/parse_hexstring.c",
"test/core/util/port_posix.c",
"test/core/util/port_windows.c",
"test/core/util/slice_splitter.c"
"test/core/end2end/data/test_root_cert.c"
],
"deps": [
"gpr",
"gpr_test_util",
"grpc"
],
"filegroups": [
"grpc_test_util_base"
],
"vs_project_guid": "{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}"
},
{
"name": "grpc_test_util_unsecure",
"build": "private",
"language": "c",
"deps": [
"gpr",
"gpr_test_util",
"grpc"
],
"filegroups": [
"grpc_test_util_base"
],
"secure": "no",
"vs_project_guid": "{0A7E7F92-FDEA-40F1-A9EC-3BA484F98BBF}"
},
{
"name": "grpc_unsecure",
"build": "all",

@ -14,6 +14,12 @@ This requires `node` to be installed. If you instead have the `nodejs` executabl
2. Follow the instructions in the `INSTALL` file in the root of that repository to install the C core library that this package depends on.
3. Run `npm install`.
If you install the gRPC C core library in a custom location, then you need to set some environment variables to install this library. The command will look like this:
```sh
CXXFLAGS=-I<custom location>/include LDFLAGS=-L<custom location>/lib npm install [grpc]
```
## Tests
To run the test suite, simply run `npm test` in the install location.

@ -43,6 +43,8 @@
namespace grpc {
namespace node {
const int max_queue_threads = 2;
using v8::Function;
using v8::Handle;
using v8::Object;
@ -51,6 +53,9 @@ using v8::Value;
grpc_completion_queue *CompletionQueueAsyncWorker::queue;
int CompletionQueueAsyncWorker::current_threads;
int CompletionQueueAsyncWorker::waiting_next_calls;
CompletionQueueAsyncWorker::CompletionQueueAsyncWorker()
: NanAsyncWorker(NULL) {}
@ -67,17 +72,30 @@ grpc_completion_queue *CompletionQueueAsyncWorker::GetQueue() { return queue; }
void CompletionQueueAsyncWorker::Next() {
NanScope();
CompletionQueueAsyncWorker *worker = new CompletionQueueAsyncWorker();
NanAsyncQueueWorker(worker);
if (current_threads < max_queue_threads) {
CompletionQueueAsyncWorker *worker = new CompletionQueueAsyncWorker();
NanAsyncQueueWorker(worker);
} else {
waiting_next_calls += 1;
}
}
void CompletionQueueAsyncWorker::Init(Handle<Object> exports) {
NanScope();
current_threads = 0;
waiting_next_calls = 0;
queue = grpc_completion_queue_create();
}
void CompletionQueueAsyncWorker::HandleOKCallback() {
NanScope();
if (waiting_next_calls > 0) {
waiting_next_calls -= 1;
CompletionQueueAsyncWorker *worker = new CompletionQueueAsyncWorker();
NanAsyncQueueWorker(worker);
} else {
current_threads -= 1;
}
NanCallback *callback = GetTagCallback(result->tag);
Handle<Value> argv[] = {NanNull(), GetTagNodeValue(result->tag)};
callback->Call(2, argv);

@ -73,6 +73,11 @@ class CompletionQueueAsyncWorker : public NanAsyncWorker {
grpc_event *result;
static grpc_completion_queue *queue;
// Number of grpc_completion_queue_next calls in the thread pool
static int current_threads;
// Number of grpc_completion_queue_next calls waiting to enter the thread pool
static int waiting_next_calls;
};
} // namespace node

@ -1,6 +1,6 @@
{
"name": "grpc",
"version": "0.6.1",
"version": "0.6.2",
"author": "Google Inc.",
"description": "gRPC Library for Node",
"homepage": "http://www.grpc.io/",

@ -277,13 +277,13 @@ class NamedTests
p 'OK: cancel_after_begin'
end
def cancel_after_first
def cancel_after_first_response
msg_sizes = [[27_182, 31_415], [8, 9], [1828, 2653], [45_904, 58_979]]
ppp = PingPongPlayer.new(msg_sizes)
op = @stub.full_duplex_call(ppp.each_item, return_op: true)
ppp.canceller_op = op # causes ppp to cancel after the 1st message
assert_raises(GRPC::Cancelled) { op.execute.each { |r| ppp.queue.push(r) } }
p 'OK: cancel_after_first'
p 'OK: cancel_after_first_response'
end
def all

@ -42,6 +42,9 @@
if not m:
return filename
return '$(GENDIR)/' + m.group(1) + '.pb.cc $(GENDIR)/' + m.group(1) + '.grpc.pb.cc'
sources_that_need_openssl = set()
sources_that_don_t_need_openssl = set()
%>
@ -1080,15 +1083,6 @@ endif
else
% endif
ifneq ($(OPENSSL_DEP),)
# This is to ensure the embedded OpenSSL is built beforehand, properly
# installing headers to their final destination on the drive. We need this
# otherwise parallel compilation will fail if a source is compiled first.
% for src in lib.src:
${src}: $(OPENSSL_DEP)
% endfor
endif
$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP)\
## The else here corresponds to the if secure earlier.
% else:
@ -1136,6 +1130,7 @@ ifeq ($(SYSTEM),Darwin)
endif
<%
if lib.language == 'c++':
ld = '$(LDXX)'
else:
@ -1158,6 +1153,11 @@ endif
if lib.get('secure', 'check') == 'yes':
common = common + ' $(LDLIBS_SECURE) $(OPENSSL_MERGE_LIBS)'
for src in lib.src:
sources_that_need_openssl.add(src)
else:
for src in lib.src:
sources_that_don_t_need_openssl.add(src)
if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check':
lib_deps = lib_deps + ' $(OPENSSL_DEP)'
@ -1340,6 +1340,17 @@ endif
% endif
</%def>
ifneq ($(OPENSSL_DEP),)
# This is to ensure the embedded OpenSSL is built beforehand, properly
# installing headers to their final destination on the drive. We need this
# otherwise parallel compilation will fail if a source is compiled first.
% for src in sorted(sources_that_need_openssl):
% if src not in sources_that_don_t_need_openssl:
${src}: $(OPENSSL_DEP)
% endif
% endfor
endif
.PHONY: all strip tools \
dep_error openssl_dep_error openssl_dep_message git_update stop \
buildtests buildtests_c buildtests_cxx \

@ -110,7 +110,7 @@ def main():
'name': 'end2end_fixture_%s' % f,
'build': 'private',
'language': 'c',
'secure': 'check',
'secure': 'check' if END2END_FIXTURES[f] else 'no',
'src': ['test/core/end2end/fixtures/%s.c' % f]
}
for f in sorted(END2END_FIXTURES.keys())] + [
@ -163,7 +163,7 @@ def main():
'deps': [
'end2end_fixture_%s' % f,
'end2end_test_%s' % t,
'grpc_test_util',
'grpc_test_util_unsecure',
'grpc_unsecure',
'gpr_test_util',
'gpr'

@ -491,6 +491,72 @@ TEST_F(End2endTest, ServerCancelsRpc) {
EXPECT_TRUE(s.details().empty());
}
// Client cancels server stream after sending some messages
TEST_F(End2endTest, ClientCancelsResponseStream) {
ResetStub();
EchoRequest request;
EchoResponse response;
ClientContext context;
request.set_message("hello");
auto stream = stub_->ResponseStream(&context, request);
EXPECT_TRUE(stream->Read(&response));
EXPECT_EQ(response.message(), request.message() + "0");
EXPECT_TRUE(stream->Read(&response));
EXPECT_EQ(response.message(), request.message() + "1");
context.TryCancel();
// The cancellation races with responses, so there might be zero or
// one responses pending, read till failure
if (stream->Read(&response)) {
EXPECT_EQ(response.message(), request.message() + "2");
// Since we have cancelled, we expect the next attempt to read to fail
EXPECT_FALSE(stream->Read(&response));
}
Status s = stream->Finish();
// The final status could be either of CANCELLED or OK depending on
// who won the race.
EXPECT_GE(grpc::StatusCode::CANCELLED, s.code());
}
// Client cancels bidi stream after sending some messages
TEST_F(End2endTest, ClientCancelsBidi) {
ResetStub();
EchoRequest request;
EchoResponse response;
ClientContext context;
grpc::string msg("hello");
auto stream = stub_->BidiStream(&context);
request.set_message(msg + "0");
EXPECT_TRUE(stream->Write(request));
EXPECT_TRUE(stream->Read(&response));
EXPECT_EQ(response.message(), request.message());
request.set_message(msg + "1");
EXPECT_TRUE(stream->Write(request));
context.TryCancel();
// The cancellation races with responses, so there might be zero or
// one responses pending, read till failure
if (stream->Read(&response)) {
EXPECT_EQ(response.message(), request.message());
// Since we have cancelled, we expect the next attempt to read to fail
EXPECT_FALSE(stream->Read(&response));
}
Status s = stream->Finish();
EXPECT_EQ(grpc::StatusCode::CANCELLED, s.code());
}
} // namespace testing
} // namespace grpc

@ -42,7 +42,7 @@ RUN make clean -C /var/local/git/grpc
RUN make install_c -j12 -C /var/local/git/grpc
# Build ruby gRPC and run its tests
RUN /bin/bash -l -c 'cd /var/local/git/grpc/src/ruby && bundle && rake'
RUN /bin/bash -l -c 'cd /var/local/git/grpc/src/ruby && gem update bundler && bundle && rake'
# Add a cacerts directory containing the Google root pem file, allowing the
# ruby client to access the production test instance

@ -1173,7 +1173,6 @@ grpc_cloud_prod_auth_jwt_token_creds_gen_ruby_cmd() {
local test_script="/var/local/git/grpc/src/ruby/bin/interop/interop_client.rb"
local test_script+=" --use_tls"
local gfe_flags=$(_grpc_prod_gfe_flags)
local added_gfe_flags=$(_grpc_jwt_token_test_flags)
local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem"
env_prefix+=" GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-7dd63462c60c.json"
local the_cmd="$cmd_prefix '$env_prefix ruby $test_script $gfe_flags $added_gfe_flags $@'"

@ -22,6 +22,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_test_util", "grpc_test
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_test_util_unsecure", "grpc_test_util_unsecure\grpc_test_util_unsecure.vcxproj", "{0A7E7F92-FDEA-40F1-A9EC-3BA484F98BBF}"
ProjectSection(ProjectDependencies) = postProject
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
{EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_unsecure", "grpc_unsecure\grpc_unsecure.vcxproj", "{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}"
ProjectSection(ProjectDependencies) = postProject
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
@ -61,6 +68,10 @@ Global
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Debug|Win32.Build.0 = Debug|Win32
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Release|Win32.ActiveCfg = Release|Win32
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Release|Win32.Build.0 = Release|Win32
{0A7E7F92-FDEA-40F1-A9EC-3BA484F98BBF}.Debug|Win32.ActiveCfg = Debug|Win32
{0A7E7F92-FDEA-40F1-A9EC-3BA484F98BBF}.Debug|Win32.Build.0 = Debug|Win32
{0A7E7F92-FDEA-40F1-A9EC-3BA484F98BBF}.Release|Win32.ActiveCfg = Release|Win32
{0A7E7F92-FDEA-40F1-A9EC-3BA484F98BBF}.Release|Win32.Build.0 = Release|Win32
{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}.Debug|Win32.ActiveCfg = Debug|Win32
{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}.Debug|Win32.Build.0 = Debug|Win32
{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}.Release|Win32.ActiveCfg = Release|Win32

@ -83,14 +83,14 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\test\core\end2end\cq_verifier.c">
</ClCompile>
<ClCompile Include="..\..\test\core\end2end\data\server1_cert.c">
</ClCompile>
<ClCompile Include="..\..\test\core\end2end\data\server1_key.c">
</ClCompile>
<ClCompile Include="..\..\test\core\end2end\data\test_root_cert.c">
</ClCompile>
<ClCompile Include="..\..\test\core\end2end\cq_verifier.c">
</ClCompile>
<ClCompile Include="..\..\test\core\iomgr\endpoint_tests.c">
</ClCompile>
<ClCompile Include="..\..\test\core\statistics\census_log_tests.c">

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{0A7E7F92-FDEA-40F1-A9EC-3BA484F98BBF}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration">
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration">
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration">
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\global.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\global.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>grpc_test_util_unsecure</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>grpc_test_util_unsecure</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\test\core\end2end\cq_verifier.c">
</ClCompile>
<ClCompile Include="..\..\test\core\iomgr\endpoint_tests.c">
</ClCompile>
<ClCompile Include="..\..\test\core\statistics\census_log_tests.c">
</ClCompile>
<ClCompile Include="..\..\test\core\util\grpc_profiler.c">
</ClCompile>
<ClCompile Include="..\..\test\core\util\parse_hexstring.c">
</ClCompile>
<ClCompile Include="..\..\test\core\util\port_posix.c">
</ClCompile>
<ClCompile Include="..\..\test\core\util\port_windows.c">
</ClCompile>
<ClCompile Include="..\..\test\core\util\slice_splitter.c">
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\gpr\gpr.vcxproj">
<Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project>
</ProjectReference>
<ProjectReference Include="..\gpr_test_util\gpr_test_util.vcxproj">
<Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project>
</ProjectReference>
<ProjectReference Include="..\grpc\grpc.vcxproj">
<Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Loading…
Cancel
Save