diff --git a/.travis.yml b/.travis.yml
index d8c9e385bbc..d770e7261f5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,11 +4,11 @@ before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv
script:
- - ./tools/run_tests/run_tests.py -l c -t -j 16 -c dbg
- - ./tools/run_tests/run_tests.py -l c++ -t -j 16 -c dbg
+ - ./tools/run_tests/run_tests.py -l c -t -j 16 -c dbg -s 2.0
+ - ./tools/run_tests/run_tests.py -l c++ -t -j 16 -c dbg -s 2.0
- make clean
- - ./tools/run_tests/run_tests.py -l c -t -j 16 -c opt
- - ./tools/run_tests/run_tests.py -l c++ -t -j 16 -c opt
+ - ./tools/run_tests/run_tests.py -l c -t -j 16 -c opt -s 2.0
+ - ./tools/run_tests/run_tests.py -l c++ -t -j 16 -c opt -s 2.0
- ./tools/run_tests/run_tests.py -l node -t -j 16 -c opt
notifications:
email: false
diff --git a/Makefile b/Makefile
index 7b8bf62a1d3..e390a3efe63 100644
--- a/Makefile
+++ b/Makefile
@@ -77,7 +77,7 @@ LDXX_valgrind = g++
CPPFLAGS_valgrind = -O0
OPENSSL_CFLAGS_valgrind = -DPURIFY
LDFLAGS_valgrind =
-DEFINES_valgrind = _DEBUG DEBUG GRPC_TEST_SLOWDOWN_FACTOR=20
+DEFINES_valgrind = _DEBUG DEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=20
VALID_CONFIG_tsan = 1
REQUIRE_CUSTOM_LIBRARIES_tsan = 1
@@ -87,7 +87,7 @@ LD_tsan = clang
LDXX_tsan = clang++
CPPFLAGS_tsan = -O1 -fsanitize=thread -fno-omit-frame-pointer
LDFLAGS_tsan = -fsanitize=thread
-DEFINES_tsan = NDEBUG GRPC_TEST_SLOWDOWN_FACTOR=10
+DEFINES_tsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=10
VALID_CONFIG_asan = 1
REQUIRE_CUSTOM_LIBRARIES_asan = 1
@@ -97,7 +97,7 @@ LD_asan = clang
LDXX_asan = clang++
CPPFLAGS_asan = -O1 -fsanitize=address -fno-omit-frame-pointer
LDFLAGS_asan = -fsanitize=address
-DEFINES_asan = NDEBUG GRPC_TEST_SLOWDOWN_FACTOR=5
+DEFINES_asan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=5
VALID_CONFIG_msan = 1
REQUIRE_CUSTOM_LIBRARIES_msan = 1
@@ -108,7 +108,7 @@ LDXX_msan = clang++-libc++
CPPFLAGS_msan = -O1 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1
OPENSSL_CFLAGS_msan = -DPURIFY
LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1
-DEFINES_msan = NDEBUG GRPC_TEST_SLOWDOWN_FACTOR=20
+DEFINES_msan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=20
VALID_CONFIG_ubsan = 1
REQUIRE_CUSTOM_LIBRARIES_ubsan = 1
@@ -119,7 +119,7 @@ LDXX_ubsan = clang++
CPPFLAGS_ubsan = -O1 -fsanitize=undefined -fno-omit-frame-pointer
OPENSSL_CFLAGS_ubsan = -DPURIFY
LDFLAGS_ubsan = -fsanitize=undefined
-DEFINES_ubsan = NDEBUG GRPC_TEST_SLOWDOWN_FACTOR=10
+DEFINES_ubsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=10
VALID_CONFIG_gcov = 1
CC_gcov = gcc
@@ -178,6 +178,10 @@ CPPFLAGS += $(CPPFLAGS_$(CONFIG))
DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\"
LDFLAGS += $(LDFLAGS_$(CONFIG))
+ifdef EXTRA_DEFINES
+DEFINES += $(EXTRA_DEFINES)
+endif
+
CFLAGS += -std=c89 -pedantic
ifeq ($(HAS_CXX11),true)
CXXFLAGS += -std=c++11
diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj
index 183c4423583..de742f99add 100644
--- a/src/csharp/Grpc.Core/Grpc.Core.csproj
+++ b/src/csharp/Grpc.Core/Grpc.Core.csproj
@@ -76,7 +76,7 @@
-
+
\ No newline at end of file
diff --git a/src/csharp/Grpc.Core/Server.cs b/src/csharp/Grpc.Core/Server.cs
index 002592a3d88..152cc2176c0 100644
--- a/src/csharp/Grpc.Core/Server.cs
+++ b/src/csharp/Grpc.Core/Server.cs
@@ -124,6 +124,17 @@ namespace Grpc.Core
handle.Dispose();
}
+ ///
+ /// To allow awaiting termination of the server.
+ ///
+ public Task ShutdownTask
+ {
+ get
+ {
+ return shutdownTcs.Task;
+ }
+ }
+
public void Kill() {
handle.Dispose();
}
diff --git a/src/csharp/Grpc.IntegrationTesting.Client/.gitignore b/src/csharp/Grpc.IntegrationTesting.Client/.gitignore
new file mode 100644
index 00000000000..a382af2294f
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting.Client/.gitignore
@@ -0,0 +1,3 @@
+bin
+obj
+
diff --git a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj
new file mode 100644
index 00000000000..b1a4a81916a
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj
@@ -0,0 +1,49 @@
+
+
+
+ Debug
+ x86
+ 10.0.0
+ 2.0
+ {3D166931-BA2D-416E-95A3-D36E8F6E90B9}
+ Exe
+ Grpc.IntegrationTesting.Client
+ Grpc.IntegrationTesting.Client
+ Grpc.IntegrationTesting.Client.Program
+ v4.5
+
+
+ true
+ full
+ false
+ bin\Debug
+ DEBUG;
+ prompt
+ 4
+ true
+ x86
+
+
+ full
+ true
+ bin\Release
+ prompt
+ 4
+ true
+ x86
+
+
+
+
+
+
+
+
+
+
+
+ {C61154BA-DD4A-4838-8420-0162A28925E0}
+ Grpc.IntegrationTesting
+
+
+
\ No newline at end of file
diff --git a/src/csharp/Grpc.IntegrationTesting.Client/Program.cs b/src/csharp/Grpc.IntegrationTesting.Client/Program.cs
new file mode 100644
index 00000000000..2e1c9aaac25
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting.Client/Program.cs
@@ -0,0 +1,46 @@
+#region Copyright notice and license
+
+// Copyright 2015, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using Grpc.IntegrationTesting;
+
+namespace Grpc.IntegrationTesting.Client
+{
+ class Program
+ {
+ public static void Main(string[] args)
+ {
+ InteropClient.Run(args);
+ }
+ }
+}
diff --git a/src/csharp/Grpc.IntegrationTesting.Client/Properties/AssemblyInfo.cs b/src/csharp/Grpc.IntegrationTesting.Client/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000000..d1f9e8560dc
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting.Client/Properties/AssemblyInfo.cs
@@ -0,0 +1,22 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+[assembly: AssemblyTitle("Grpc.IntegrationTesting.Client")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+[assembly: AssemblyVersion("0.1.*")]
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
diff --git a/src/csharp/Grpc.IntegrationTesting.Server/.gitignore b/src/csharp/Grpc.IntegrationTesting.Server/.gitignore
new file mode 100644
index 00000000000..a382af2294f
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting.Server/.gitignore
@@ -0,0 +1,3 @@
+bin
+obj
+
diff --git a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj
new file mode 100644
index 00000000000..73c9f2d2077
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj
@@ -0,0 +1,49 @@
+
+
+
+ Debug
+ x86
+ 10.0.0
+ 2.0
+ {A654F3B8-E859-4E6A-B30D-227527DBEF0D}
+ Exe
+ Grpc.IntegrationTesting.Server
+ Grpc.IntegrationTesting.Server
+ Grpc.IntegrationTesting.Server.Program
+ v4.5
+
+
+ true
+ full
+ false
+ bin\Debug
+ DEBUG;
+ prompt
+ 4
+ true
+ x86
+
+
+ full
+ true
+ bin\Release
+ prompt
+ 4
+ true
+ x86
+
+
+
+
+
+
+
+
+
+
+
+ {C61154BA-DD4A-4838-8420-0162A28925E0}
+ Grpc.IntegrationTesting
+
+
+
\ No newline at end of file
diff --git a/src/csharp/Grpc.IntegrationTesting.Server/Program.cs b/src/csharp/Grpc.IntegrationTesting.Server/Program.cs
new file mode 100644
index 00000000000..01bcc6e3081
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting.Server/Program.cs
@@ -0,0 +1,45 @@
+#region Copyright notice and license
+
+// Copyright 2015, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+
+namespace Grpc.IntegrationTesting.Server
+{
+ class Program
+ {
+ public static void Main(string[] args)
+ {
+ InteropServer.Run(args);
+ }
+ }
+}
diff --git a/src/csharp/Grpc.IntegrationTesting.Server/Properties/AssemblyInfo.cs b/src/csharp/Grpc.IntegrationTesting.Server/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000000..4ef93f328d2
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting.Server/Properties/AssemblyInfo.cs
@@ -0,0 +1,22 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+[assembly: AssemblyTitle("Grpc.IntegrationTesting.Server")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+[assembly: AssemblyVersion("0.1.*")]
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
index e66f708a945..6d6aaf57473 100644
--- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
+++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
@@ -6,10 +6,9 @@
10.0.0
2.0
{C61154BA-DD4A-4838-8420-0162A28925E0}
- Exe
+ Library
Grpc.IntegrationTesting
Grpc.IntegrationTesting
- Grpc.IntegrationTesting.Client
v4.5
@@ -43,12 +42,13 @@
-
+
+
diff --git a/src/csharp/Grpc.IntegrationTesting/Client.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
similarity index 98%
rename from src/csharp/Grpc.IntegrationTesting/Client.cs
rename to src/csharp/Grpc.IntegrationTesting/InteropClient.cs
index fa1c7cd051b..a7a3c63e032 100644
--- a/src/csharp/Grpc.IntegrationTesting/Client.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
@@ -44,7 +44,7 @@ using grpc.testing;
namespace Grpc.IntegrationTesting
{
- class Client
+ public class InteropClient
{
private class ClientOptions
{
@@ -59,12 +59,12 @@ namespace Grpc.IntegrationTesting
ClientOptions options;
- private Client(ClientOptions options)
+ private InteropClient(ClientOptions options)
{
this.options = options;
}
- public static void Main(string[] args)
+ public static void Run(string[] args)
{
Console.WriteLine("gRPC C# interop testing client");
ClientOptions options = ParseArguments(args);
@@ -89,7 +89,7 @@ namespace Grpc.IntegrationTesting
Environment.Exit(1);
}
- var interopClient = new Client(options);
+ var interopClient = new InteropClient(options);
interopClient.Run();
}
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
index 87d25b0a98c..4bb0b9ee51f 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
@@ -77,37 +77,37 @@ namespace Grpc.IntegrationTesting
[Test]
public void EmptyUnary()
{
- Client.RunEmptyUnary(client);
+ InteropClient.RunEmptyUnary(client);
}
[Test]
public void LargeUnary()
{
- Client.RunEmptyUnary(client);
+ InteropClient.RunEmptyUnary(client);
}
[Test]
public void ClientStreaming()
{
- Client.RunClientStreaming(client);
+ InteropClient.RunClientStreaming(client);
}
[Test]
public void ServerStreaming()
{
- Client.RunServerStreaming(client);
+ InteropClient.RunServerStreaming(client);
}
[Test]
public void PingPong()
{
- Client.RunPingPong(client);
+ InteropClient.RunPingPong(client);
}
[Test]
public void EmptyStream()
{
- Client.RunEmptyStream(client);
+ InteropClient.RunEmptyStream(client);
}
// TODO: add cancel_after_begin
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs
new file mode 100644
index 00000000000..a25d3b3530f
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs
@@ -0,0 +1,140 @@
+#region Copyright notice and license
+
+// Copyright 2015, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using Google.ProtocolBuffers;
+using Grpc.Core;
+using Grpc.Core.Utils;
+using NUnit.Framework;
+using grpc.testing;
+
+namespace Grpc.IntegrationTesting
+{
+ public class InteropServer
+ {
+ private class ServerOptions
+ {
+ public bool help;
+ public int? port;
+ public bool useTls;
+ }
+
+ ServerOptions options;
+
+ private InteropServer(ServerOptions options)
+ {
+ this.options = options;
+ }
+
+ public static void Run(string[] args)
+ {
+ Console.WriteLine("gRPC C# interop testing server");
+ ServerOptions options = ParseArguments(args);
+
+ if (!options.port.HasValue)
+ {
+ Console.WriteLine("Missing required argument.");
+ Console.WriteLine();
+ options.help = true;
+ }
+
+ if (options.help)
+ {
+ Console.WriteLine("Usage:");
+ Console.WriteLine(" --port=PORT");
+ Console.WriteLine(" --use_tls=BOOLEAN");
+ Console.WriteLine();
+ Environment.Exit(1);
+ }
+
+ var interopServer = new InteropServer(options);
+ interopServer.Run();
+ }
+
+ private void Run()
+ {
+ GrpcEnvironment.Initialize();
+
+ var server = new Server();
+ server.AddServiceDefinition(TestServiceGrpc.BindService(new TestServiceImpl()));
+
+ string addr = "0.0.0.0:" + options.port;
+ server.AddPort(addr);
+ Console.WriteLine("Running server on " + addr);
+ server.Start();
+
+ server.ShutdownTask.Wait();
+
+ GrpcEnvironment.Shutdown();
+ }
+
+ private static ServerOptions ParseArguments(string[] args)
+ {
+ var options = new ServerOptions();
+ foreach(string arg in args)
+ {
+ ParseArgument(arg, options);
+ if (options.help)
+ {
+ break;
+ }
+ }
+ return options;
+ }
+
+ private static void ParseArgument(string arg, ServerOptions options)
+ {
+ Match match;
+ match = Regex.Match(arg, "--port=(.*)");
+ if (match.Success)
+ {
+ options.port = int.Parse(match.Groups[1].Value.Trim());
+ return;
+ }
+
+ match = Regex.Match(arg, "--use_tls=(.*)");
+ if (match.Success)
+ {
+ options.useTls = bool.Parse(match.Groups[1].Value.Trim());
+ return;
+ }
+
+ Console.WriteLine(string.Format("Unrecognized argument \"{0}\"", arg));
+ options.help = true;
+ }
+ }
+}
diff --git a/src/csharp/Grpc.sln b/src/csharp/Grpc.sln
index a544eb1c338..2e6d2886993 100644
--- a/src/csharp/Grpc.sln
+++ b/src/csharp/Grpc.sln
@@ -13,6 +13,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Examples.MathClient",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting", "Grpc.IntegrationTesting\Grpc.IntegrationTesting.csproj", "{C61154BA-DD4A-4838-8420-0162A28925E0}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.Client", "Grpc.IntegrationTesting.Client\Grpc.IntegrationTesting.Client.csproj", "{3D166931-BA2D-416E-95A3-D36E8F6E90B9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.Server", "Grpc.IntegrationTesting.Server\Grpc.IntegrationTesting.Server.csproj", "{A654F3B8-E859-4E6A-B30D-227527DBEF0D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@@ -23,6 +27,10 @@ Global
{143B1C29-C442-4BE0-BF3F-A8F92288AC9F}.Debug|x86.Build.0 = Debug|Any CPU
{143B1C29-C442-4BE0-BF3F-A8F92288AC9F}.Release|x86.ActiveCfg = Release|Any CPU
{143B1C29-C442-4BE0-BF3F-A8F92288AC9F}.Release|x86.Build.0 = Release|Any CPU
+ {3D166931-BA2D-416E-95A3-D36E8F6E90B9}.Debug|x86.ActiveCfg = Debug|x86
+ {3D166931-BA2D-416E-95A3-D36E8F6E90B9}.Debug|x86.Build.0 = Debug|x86
+ {3D166931-BA2D-416E-95A3-D36E8F6E90B9}.Release|x86.ActiveCfg = Release|x86
+ {3D166931-BA2D-416E-95A3-D36E8F6E90B9}.Release|x86.Build.0 = Release|x86
{61ECB8EE-0C96-4F8E-B187-8E4D227417C0}.Debug|x86.ActiveCfg = Debug|x86
{61ECB8EE-0C96-4F8E-B187-8E4D227417C0}.Debug|x86.Build.0 = Debug|x86
{61ECB8EE-0C96-4F8E-B187-8E4D227417C0}.Release|x86.ActiveCfg = Release|x86
@@ -35,6 +43,10 @@ Global
{86EC5CB4-4EA2-40A2-8057-86542A0353BB}.Debug|x86.Build.0 = Debug|Any CPU
{86EC5CB4-4EA2-40A2-8057-86542A0353BB}.Release|x86.ActiveCfg = Release|Any CPU
{86EC5CB4-4EA2-40A2-8057-86542A0353BB}.Release|x86.Build.0 = Release|Any CPU
+ {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Debug|x86.ActiveCfg = Debug|x86
+ {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Debug|x86.Build.0 = Debug|x86
+ {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Release|x86.ActiveCfg = Release|x86
+ {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Release|x86.Build.0 = Release|x86
{C61154BA-DD4A-4838-8420-0162A28925E0}.Debug|x86.ActiveCfg = Debug|x86
{C61154BA-DD4A-4838-8420-0162A28925E0}.Debug|x86.Build.0 = Debug|x86
{C61154BA-DD4A-4838-8420-0162A28925E0}.Release|x86.ActiveCfg = Release|x86
diff --git a/src/csharp/README.md b/src/csharp/README.md
index 55739a1f83c..21aab521180 100755
--- a/src/csharp/README.md
+++ b/src/csharp/README.md
@@ -9,7 +9,7 @@ Status
**This gRPC C# implementation is work-in-progress and is not expected to work yet.**
- The implementation is a wrapper around gRPC C core library
-- Code only runs under mono currently, building gGRPC C core library under Windows
+- Code only runs under mono currently, building gRPC C core library under Windows
is in progress.
- It is very possible that some parts of the code will be heavily refactored or
completely rewritten.
diff --git a/src/node/package.json b/src/node/package.json
index 8e0a7bdb25c..0ef1c990b1e 100644
--- a/src/node/package.json
+++ b/src/node/package.json
@@ -1,14 +1,24 @@
{
"name": "grpc",
- "version": "0.5.0",
+ "version": "0.5.1",
"author": "Google Inc.",
"description": "gRPC Library for Node",
+ "homepage": "http://www.grpc.io/",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/grpc/grpc.git"
+ },
+ "bugs": "https://github.com/grpc/grpc/issues",
"contributors": [
{
"name": "Michael Lumish",
"email": "mlumish@google.com"
}
],
+ "directories": {
+ "lib": "src",
+ "example": "examples"
+ },
"scripts": {
"lint": "node ./node_modules/jshint/bin/jshint src test examples interop index.js",
"test": "node ./node_modules/mocha/bin/mocha && npm run-script lint"
diff --git a/templates/Makefile.template b/templates/Makefile.template
index 491f142142e..0413f19e44e 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -94,7 +94,7 @@ LDXX_valgrind = g++
CPPFLAGS_valgrind = -O0
OPENSSL_CFLAGS_valgrind = -DPURIFY
LDFLAGS_valgrind =
-DEFINES_valgrind = _DEBUG DEBUG GRPC_TEST_SLOWDOWN_FACTOR=20
+DEFINES_valgrind = _DEBUG DEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=20
VALID_CONFIG_tsan = 1
REQUIRE_CUSTOM_LIBRARIES_tsan = 1
@@ -104,7 +104,7 @@ LD_tsan = clang
LDXX_tsan = clang++
CPPFLAGS_tsan = -O1 -fsanitize=thread -fno-omit-frame-pointer
LDFLAGS_tsan = -fsanitize=thread
-DEFINES_tsan = NDEBUG GRPC_TEST_SLOWDOWN_FACTOR=10
+DEFINES_tsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=10
VALID_CONFIG_asan = 1
REQUIRE_CUSTOM_LIBRARIES_asan = 1
@@ -114,7 +114,7 @@ LD_asan = clang
LDXX_asan = clang++
CPPFLAGS_asan = -O1 -fsanitize=address -fno-omit-frame-pointer
LDFLAGS_asan = -fsanitize=address
-DEFINES_asan = NDEBUG GRPC_TEST_SLOWDOWN_FACTOR=5
+DEFINES_asan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=5
VALID_CONFIG_msan = 1
REQUIRE_CUSTOM_LIBRARIES_msan = 1
@@ -125,7 +125,7 @@ LDXX_msan = clang++-libc++
CPPFLAGS_msan = -O1 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1
OPENSSL_CFLAGS_msan = -DPURIFY
LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1
-DEFINES_msan = NDEBUG GRPC_TEST_SLOWDOWN_FACTOR=20
+DEFINES_msan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=20
VALID_CONFIG_ubsan = 1
REQUIRE_CUSTOM_LIBRARIES_ubsan = 1
@@ -136,7 +136,7 @@ LDXX_ubsan = clang++
CPPFLAGS_ubsan = -O1 -fsanitize=undefined -fno-omit-frame-pointer
OPENSSL_CFLAGS_ubsan = -DPURIFY
LDFLAGS_ubsan = -fsanitize=undefined
-DEFINES_ubsan = NDEBUG GRPC_TEST_SLOWDOWN_FACTOR=10
+DEFINES_ubsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=10
VALID_CONFIG_gcov = 1
CC_gcov = gcc
@@ -195,6 +195,10 @@ CPPFLAGS += $(CPPFLAGS_$(CONFIG))
DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\"
LDFLAGS += $(LDFLAGS_$(CONFIG))
+ifdef EXTRA_DEFINES
+DEFINES += EXTRA_DEFINES
+endif
+
CFLAGS += -std=c89 -pedantic
ifeq ($(HAS_CXX11),true)
CXXFLAGS += -std=c++11
diff --git a/test/build/c++11.cc b/test/build/c++11.cc
index 519395f20a4..4822a20e7f2 100644
--- a/test/build/c++11.cc
+++ b/test/build/c++11.cc
@@ -31,7 +31,7 @@
*
*/
-/* This is just a compilation test, to see if we have zlib installed. */
+/* This is just a compilation test, to see if we have C++11. */
#include
#include
diff --git a/test/compiler/python_plugin_test.py b/test/compiler/python_plugin_test.py
index 3919de14509..1981f49fbb8 100644
--- a/test/compiler/python_plugin_test.py
+++ b/test/compiler/python_plugin_test.py
@@ -57,7 +57,6 @@ LONG_DELAY = 1
# Assigned in __main__.
_build_mode = None
-_port = None
class _ServicerMethods(object):
@@ -87,14 +86,14 @@ class _ServicerMethods(object):
while self._paused:
time.sleep(0)
- def UnaryCall(self, request, context):
+ def UnaryCall(self, request, unused_context):
response = self.test_pb2.SimpleResponse()
response.payload.payload_type = self.test_pb2.COMPRESSABLE
response.payload.payload_compressable = 'a' * request.response_size
self._control()
return response
- def StreamingOutputCall(self, request, context):
+ def StreamingOutputCall(self, request, unused_context):
for parameter in request.response_parameters:
response = self.test_pb2.StreamingOutputCallResponse()
response.payload.payload_type = self.test_pb2.COMPRESSABLE
@@ -102,7 +101,7 @@ class _ServicerMethods(object):
self._control()
yield response
- def StreamingInputCall(self, request_iter, context):
+ def StreamingInputCall(self, request_iter, unused_context):
response = self.test_pb2.StreamingInputCallResponse()
aggregated_payload_size = 0
for request in request_iter:
@@ -111,7 +110,7 @@ class _ServicerMethods(object):
self._control()
return response
- def FullDuplexCall(self, request_iter, context):
+ def FullDuplexCall(self, request_iter, unused_context):
for request in request_iter:
for parameter in request.response_parameters:
response = self.test_pb2.StreamingOutputCallResponse()
@@ -120,7 +119,7 @@ class _ServicerMethods(object):
self._control()
yield response
- def HalfDuplexCall(self, request_iter, context):
+ def HalfDuplexCall(self, request_iter, unused_context):
responses = []
for request in request_iter:
for parameter in request.response_parameters:
@@ -133,6 +132,7 @@ class _ServicerMethods(object):
yield response
+@contextlib.contextmanager
def _CreateService(test_pb2, delay):
"""Provides a servicer backend and a stub.
@@ -148,9 +148,11 @@ def _CreateService(test_pb2, delay):
test_pb2: the test_pb2 module generated by this test
delay: delay in seconds per response from the servicer
timeout: how long the stub will wait for the servicer by default.
- Returns:
- A two-tuple (servicer, stub), where the servicer is the back-end of the
- service bound to the stub.
+
+ Yields:
+ A three-tuple (servicer_methods, servicer, stub), where the servicer is
+ the back-end of the service bound to the stub and the server and stub
+ are both activated and ready for use.
"""
servicer_methods = _ServicerMethods(test_pb2, delay)
@@ -172,10 +174,13 @@ def _CreateService(test_pb2, delay):
return servicer_methods.HalfDuplexCall(request_iter, context)
servicer = Servicer()
- server = getattr(test_pb2, SERVER_FACTORY_IDENTIFIER)(servicer, _port,
- None, None)
- stub = getattr(test_pb2, STUB_FACTORY_IDENTIFIER)('localhost', _port)
- return servicer_methods, stub, server
+ server = getattr(
+ test_pb2, SERVER_FACTORY_IDENTIFIER)(servicer, 0, None, None)
+ with server:
+ port = server.port()
+ stub = getattr(test_pb2, STUB_FACTORY_IDENTIFIER)('localhost', port)
+ with stub:
+ yield servicer_methods, stub, server
def StreamingInputRequest(test_pb2):
@@ -255,25 +260,23 @@ class PythonPluginTest(unittest.TestCase):
def testUpDown(self):
import test_pb2
- servicer, stub, server = _CreateService(test_pb2, DOES_NOT_MATTER_DELAY)
- request = test_pb2.SimpleRequest(response_size=13)
- with server, stub:
- pass
+ with _CreateService(
+ test_pb2, DOES_NOT_MATTER_DELAY) as (servicer, stub, unused_server):
+ request = test_pb2.SimpleRequest(response_size=13)
def testUnaryCall(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, NO_DELAY)
- request = test_pb2.SimpleRequest(response_size=13)
- with server, stub:
+ with _CreateService(test_pb2, NO_DELAY) as (servicer, stub, unused_server):
+ request = test_pb2.SimpleRequest(response_size=13)
response = stub.UnaryCall(request, NORMAL_TIMEOUT)
expected_response = servicer.UnaryCall(request, None)
self.assertEqual(expected_response, response)
def testUnaryCallAsync(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, LONG_DELAY)
request = test_pb2.SimpleRequest(response_size=13)
- with server, stub:
+ with _CreateService(test_pb2, LONG_DELAY) as (
+ servicer, stub, unused_server):
start_time = time.clock()
response_future = stub.UnaryCall.async(request, LONG_TIMEOUT)
# Check that we didn't block on the asynchronous call.
@@ -285,10 +288,9 @@ class PythonPluginTest(unittest.TestCase):
def testUnaryCallAsyncExpired(self):
import test_pb2 # pylint: disable=g-import-not-at-top
# set the timeout super low...
- servicer, stub, server = _CreateService(test_pb2,
- delay=DOES_NOT_MATTER_DELAY)
- request = test_pb2.SimpleRequest(response_size=13)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
+ request = test_pb2.SimpleRequest(response_size=13)
with servicer.pause():
response_future = stub.UnaryCall.async(request, SHORT_TIMEOUT)
with self.assertRaises(exceptions.ExpirationError):
@@ -296,9 +298,9 @@ class PythonPluginTest(unittest.TestCase):
def testUnaryCallAsyncCancelled(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, DOES_NOT_MATTER_DELAY)
request = test_pb2.SimpleRequest(response_size=13)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
with servicer.pause():
response_future = stub.UnaryCall.async(request, 1)
response_future.cancel()
@@ -306,18 +308,17 @@ class PythonPluginTest(unittest.TestCase):
def testUnaryCallAsyncFailed(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, DOES_NOT_MATTER_DELAY)
request = test_pb2.SimpleRequest(response_size=13)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
with servicer.fail():
response_future = stub.UnaryCall.async(request, NORMAL_TIMEOUT)
self.assertIsNotNone(response_future.exception())
def testStreamingOutputCall(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, NO_DELAY)
request = StreamingOutputRequest(test_pb2)
- with server, stub:
+ with _CreateService(test_pb2, NO_DELAY) as (servicer, stub, unused_server):
responses = stub.StreamingOutputCall(request, NORMAL_TIMEOUT)
expected_responses = servicer.StreamingOutputCall(request, None)
for check in itertools.izip_longest(expected_responses, responses):
@@ -326,9 +327,9 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingOutputCallExpired(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, DOES_NOT_MATTER_DELAY)
request = StreamingOutputRequest(test_pb2)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
with servicer.pause():
responses = stub.StreamingOutputCall(request, SHORT_TIMEOUT)
with self.assertRaises(exceptions.ExpirationError):
@@ -336,10 +337,9 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingOutputCallCancelled(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- unused_servicer, stub, server = _CreateService(test_pb2,
- DOES_NOT_MATTER_DELAY)
request = StreamingOutputRequest(test_pb2)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ unused_servicer, stub, unused_server):
responses = stub.StreamingOutputCall(request, SHORT_TIMEOUT)
next(responses)
responses.cancel()
@@ -350,9 +350,9 @@ class PythonPluginTest(unittest.TestCase):
'instead of raising the proper error.')
def testStreamingOutputCallFailed(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, DOES_NOT_MATTER_DELAY)
request = StreamingOutputRequest(test_pb2)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
with servicer.fail():
responses = stub.StreamingOutputCall(request, 1)
self.assertIsNotNone(responses)
@@ -361,8 +361,7 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingInputCall(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, NO_DELAY)
- with server, stub:
+ with _CreateService(test_pb2, NO_DELAY) as (servicer, stub, unused_server):
response = stub.StreamingInputCall(StreamingInputRequest(test_pb2),
NORMAL_TIMEOUT)
expected_response = servicer.StreamingInputCall(
@@ -371,9 +370,8 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingInputCallAsync(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(
- test_pb2, LONG_DELAY)
- with server, stub:
+ with _CreateService(test_pb2, LONG_DELAY) as (
+ servicer, stub, unused_server):
start_time = time.clock()
response_future = stub.StreamingInputCall.async(
StreamingInputRequest(test_pb2), LONG_TIMEOUT)
@@ -386,8 +384,8 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingInputCallAsyncExpired(self):
import test_pb2 # pylint: disable=g-import-not-at-top
# set the timeout super low...
- servicer, stub, server = _CreateService(test_pb2, DOES_NOT_MATTER_DELAY)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
with servicer.pause():
response_future = stub.StreamingInputCall.async(
StreamingInputRequest(test_pb2), SHORT_TIMEOUT)
@@ -398,8 +396,8 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingInputCallAsyncCancelled(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, DOES_NOT_MATTER_DELAY)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
with servicer.pause():
response_future = stub.StreamingInputCall.async(
StreamingInputRequest(test_pb2), NORMAL_TIMEOUT)
@@ -410,8 +408,8 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingInputCallAsyncFailed(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, DOES_NOT_MATTER_DELAY)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
with servicer.fail():
response_future = stub.StreamingInputCall.async(
StreamingInputRequest(test_pb2), SHORT_TIMEOUT)
@@ -419,8 +417,7 @@ class PythonPluginTest(unittest.TestCase):
def testFullDuplexCall(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, NO_DELAY)
- with server, stub:
+ with _CreateService(test_pb2, NO_DELAY) as (servicer, stub, unused_server):
responses = stub.FullDuplexCall(FullDuplexRequest(test_pb2),
NORMAL_TIMEOUT)
expected_responses = servicer.FullDuplexCall(FullDuplexRequest(test_pb2),
@@ -431,9 +428,9 @@ class PythonPluginTest(unittest.TestCase):
def testFullDuplexCallExpired(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, DOES_NOT_MATTER_DELAY)
request = FullDuplexRequest(test_pb2)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
with servicer.pause():
responses = stub.FullDuplexCall(request, SHORT_TIMEOUT)
with self.assertRaises(exceptions.ExpirationError):
@@ -441,8 +438,7 @@ class PythonPluginTest(unittest.TestCase):
def testFullDuplexCallCancelled(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- unused_servicer, stub, server = _CreateService(test_pb2, NO_DELAY)
- with server, stub:
+ with _CreateService(test_pb2, NO_DELAY) as (servicer, stub, unused_server):
request = FullDuplexRequest(test_pb2)
responses = stub.FullDuplexCall(request, NORMAL_TIMEOUT)
next(responses)
@@ -454,9 +450,9 @@ class PythonPluginTest(unittest.TestCase):
'and fix.')
def testFullDuplexCallFailed(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, DOES_NOT_MATTER_DELAY)
request = FullDuplexRequest(test_pb2)
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
with servicer.fail():
responses = stub.FullDuplexCall(request, NORMAL_TIMEOUT)
self.assertIsNotNone(responses)
@@ -465,16 +461,16 @@ class PythonPluginTest(unittest.TestCase):
def testHalfDuplexCall(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- servicer, stub, server = _CreateService(test_pb2, NO_DELAY)
- def HalfDuplexRequest():
- request = test_pb2.StreamingOutputCallRequest()
- request.response_parameters.add(size=1, interval_us=0)
- yield request
- request = test_pb2.StreamingOutputCallRequest()
- request.response_parameters.add(size=2, interval_us=0)
- request.response_parameters.add(size=3, interval_us=0)
- yield request
- with server, stub:
+ with _CreateService(test_pb2, DOES_NOT_MATTER_DELAY) as (
+ servicer, stub, unused_server):
+ def HalfDuplexRequest():
+ request = test_pb2.StreamingOutputCallRequest()
+ request.response_parameters.add(size=1, interval_us=0)
+ yield request
+ request = test_pb2.StreamingOutputCallRequest()
+ request.response_parameters.add(size=2, interval_us=0)
+ request.response_parameters.add(size=3, interval_us=0)
+ yield request
responses = stub.HalfDuplexCall(HalfDuplexRequest(), NORMAL_TIMEOUT)
expected_responses = servicer.HalfDuplexCall(HalfDuplexRequest(), None)
for check in itertools.izip_longest(expected_responses, responses):
@@ -483,7 +479,6 @@ class PythonPluginTest(unittest.TestCase):
def testHalfDuplexCallWedged(self):
import test_pb2 # pylint: disable=g-import-not-at-top
- _, stub, server = _CreateService(test_pb2, NO_DELAY)
wait_flag = [False]
@contextlib.contextmanager
def wait(): # pylint: disable=invalid-name
@@ -497,7 +492,7 @@ class PythonPluginTest(unittest.TestCase):
yield request
while wait_flag[0]:
time.sleep(0.1)
- with server, stub:
+ with _CreateService(test_pb2, NO_DELAY) as (servicer, stub, unused_server):
with wait():
responses = stub.HalfDuplexCall(HalfDuplexRequest(), NORMAL_TIMEOUT)
# half-duplex waits for the client to send all info
@@ -516,6 +511,5 @@ if __name__ == '__main__':
parser.add_argument('--port', dest='port', type=int, default=0)
args, remainder = parser.parse_known_args()
_build_mode = args.build_mode
- _port = args.port
sys.argv[1:] = remainder
unittest.main()
diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c
index 55150a7cedc..36f13e1b51e 100644
--- a/test/core/util/port_posix.c
+++ b/test/core/util/port_posix.c
@@ -117,9 +117,10 @@ int grpc_pick_unused_port(void) {
for (;;) {
int port;
- if (try == 0) {
+ try++;
+ if (try == 1) {
port = getpid() % (65536 - 30000) + 30000;
- } else if (try < NUM_RANDOM_PORTS_TO_PICK) {
+ } else if (try <= NUM_RANDOM_PORTS_TO_PICK) {
port = rand() % (65536 - 30000) + 30000;
} else {
port = 0;
diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c
index 1c464073114..1f0f0175b1c 100644
--- a/test/core/util/test_config.c
+++ b/test/core/util/test_config.c
@@ -34,6 +34,7 @@
#include "test/core/util/test_config.h"
#include
+#include
#include
#include
@@ -52,6 +53,9 @@ void grpc_test_init(int argc, char **argv) {
/* disable SIGPIPE */
signal(SIGPIPE, SIG_IGN);
#endif
+ gpr_log(GPR_DEBUG, "test slowdown: machine=%f build=%f total=%f",
+ GRPC_TEST_SLOWDOWN_MACHINE_FACTOR, GRPC_TEST_SLOWDOWN_BUILD_FACTOR,
+ GRPC_TEST_SLOWDOWN_FACTOR);
/* seed rng with pid, so we don't end up with the same random numbers as a
concurrently running test binary */
srand(seed());
diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h
index 74c2a3cf1b1..5292c7b525e 100644
--- a/test/core/util/test_config.h
+++ b/test/core/util/test_config.h
@@ -40,16 +40,23 @@
extern "C" {
#endif /* __cplusplus */
-#ifndef GRPC_TEST_SLOWDOWN_FACTOR
-#define GRPC_TEST_SLOWDOWN_FACTOR 1.0
+#ifndef GRPC_TEST_SLOWDOWN_BUILD_FACTOR
+#define GRPC_TEST_SLOWDOWN_BUILD_FACTOR 1.0
#endif
+#ifndef GRPC_TEST_SLOWDOWN_MACHINE_FACTOR
+#define GRPC_TEST_SLOWDOWN_MACHINE_FACTOR 1.0
+#endif
+
+#define GRPC_TEST_SLOWDOWN_FACTOR \
+ (GRPC_TEST_SLOWDOWN_BUILD_FACTOR * GRPC_TEST_SLOWDOWN_MACHINE_FACTOR)
+
#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \
gpr_time_add(gpr_now(), \
gpr_time_from_micros(GRPC_TEST_SLOWDOWN_FACTOR * 1e6 * (x)))
#define GRPC_TIMEOUT_MILLIS_TO_DEADLINE(x) \
- gpr_time_add(gpr_now(), \
+ gpr_time_add(gpr_now(), \
gpr_time_from_micros(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)))
void grpc_test_init(int argc, char **argv);
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py
index b8178ffebf1..ad65da535b4 100755
--- a/tools/run_tests/jobset.py
+++ b/tools/run_tests/jobset.py
@@ -99,6 +99,7 @@ _CLEAR_LINE = '\x1b[2K'
_TAG_COLOR = {
'FAILED': 'red',
+ 'TIMEOUT': 'red',
'PASSED': 'green',
'START': 'gray',
'WAITING': 'yellow',
diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh
index 19f1458fabb..06ddb8e41ac 100755
--- a/tools/run_tests/run_python.sh
+++ b/tools/run_tests/run_python.sh
@@ -38,7 +38,7 @@ export LD_LIBRARY_PATH=$root/libs/opt
source python2.7_virtual_environment/bin/activate
# TODO(issue 215): Properly itemize these in run_tests.py so that they can be parallelized.
# TODO(atash): Enable dynamic unused port discovery for this test.
-python2.7 -B test/compiler/python_plugin_test.py --build_mode=opt --port=40987
+python2.7 -B test/compiler/python_plugin_test.py --build_mode=opt
python2.7 -B -m grpc._adapter._blocking_invocation_inline_service_test
python2.7 -B -m grpc._adapter._c_test
python2.7 -B -m grpc._adapter._event_invocation_synchronous_event_service_test
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 22f12b019a6..4e0ff85c59d 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -171,6 +171,7 @@ argp.add_argument('-c', '--config',
argp.add_argument('-n', '--runs_per_test', default=1, type=int)
argp.add_argument('-r', '--regex', default='.*', type=str)
argp.add_argument('-j', '--jobs', default=1000, type=int)
+argp.add_argument('-s', '--slowdown', default=1.0, type=float)
argp.add_argument('-f', '--forever',
default=False,
action='store_const',
@@ -200,6 +201,7 @@ make_targets = []
languages = set(_LANGUAGES[l] for l in args.language)
build_steps = [jobset.JobSpec(['make',
'-j', '%d' % (multiprocessing.cpu_count() + 1),
+ 'EXTRA_DEFINES=GRPC_TEST_SLOWDOWN_MACHINE_FACTOR=%f' % args.slowdown,
'CONFIG=%s' % cfg] + list(set(
itertools.chain.from_iterable(
l.make_targets() for l in languages))))