aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2016-02-08 12:57:34 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2016-02-08 12:57:34 -0800
commit2d3bed911ead4aa92ca90be087df00a3b69606df (patch)
tree61e524ac7d8dc216979f8ea17f380def2b01773e
parentf008f067f82d88cbcd70a104e20479d4ed3a3386 (diff)
parent81b780b84b77a093ac2273865cd1af8a0f6f69bf (diff)
Merge github.com:grpc/grpc into version_number
-rw-r--r--test/cpp/end2end/thread_stress_test.cc18
-rwxr-xr-xtest/distrib/csharp/run_distrib_test.sh2
-rwxr-xr-xtest/distrib/csharp/update_version.sh2
-rw-r--r--tools/run_tests/distribtest_targets.py36
4 files changed, 42 insertions, 16 deletions
diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc
index 4c7caa9b87..dd7a8e5ed2 100644
--- a/test/cpp/end2end/thread_stress_test.cc
+++ b/test/cpp/end2end/thread_stress_test.cc
@@ -55,7 +55,9 @@ using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using std::chrono::system_clock;
-const int kNumThreads = 100; // Number of threads
+const int kNumThreads = 100; // Number of threads
+const int kNumAsyncSendThreads = 2;
+const int kNumAsyncReceiveThreads = 50;
const int kNumRpcs = 1000; // Number of RPCs per thread
namespace grpc {
@@ -273,7 +275,7 @@ class AsyncClientEnd2endTest : public ::testing::Test {
for (int i = 0; i < num_rpcs; ++i) {
AsyncClientCall* call = new AsyncClientCall;
EchoRequest request;
- request.set_message("Hello");
+ request.set_message("Hello: " + std::to_string(i));
call->response_reader =
common_.GetStub()->AsyncEcho(&call->context, request, &cq_);
call->response_reader->Finish(&call->response, &call->status,
@@ -290,7 +292,9 @@ class AsyncClientEnd2endTest : public ::testing::Test {
bool ok = false;
if (!cq_.Next(&got_tag, &ok)) break;
AsyncClientCall* call = static_cast<AsyncClientCall*>(got_tag);
- GPR_ASSERT(ok);
+ if (!ok) {
+ gpr_log(GPR_DEBUG, "Error: %d", call->status.error_code());
+ }
delete call;
bool notify;
@@ -315,22 +319,22 @@ class AsyncClientEnd2endTest : public ::testing::Test {
TEST_F(AsyncClientEnd2endTest, ThreadStress) {
common_.ResetStub();
std::vector<std::thread*> send_threads, completion_threads;
- for (int i = 0; i < kNumThreads / 2; ++i) {
+ for (int i = 0; i < kNumAsyncReceiveThreads; ++i) {
completion_threads.push_back(new std::thread(
&AsyncClientEnd2endTest_ThreadStress_Test::AsyncCompleteRpc, this));
}
- for (int i = 0; i < kNumThreads / 2; ++i) {
+ for (int i = 0; i < kNumAsyncSendThreads; ++i) {
send_threads.push_back(
new std::thread(&AsyncClientEnd2endTest_ThreadStress_Test::AsyncSendRpc,
this, kNumRpcs));
}
- for (int i = 0; i < kNumThreads / 2; ++i) {
+ for (int i = 0; i < kNumAsyncSendThreads; ++i) {
send_threads[i]->join();
delete send_threads[i];
}
Wait();
- for (int i = 0; i < kNumThreads / 2; ++i) {
+ for (int i = 0; i < kNumAsyncReceiveThreads; ++i) {
completion_threads[i]->join();
delete completion_threads[i];
}
diff --git a/test/distrib/csharp/run_distrib_test.sh b/test/distrib/csharp/run_distrib_test.sh
index 5a01c91875..8ddb4c4bff 100755
--- a/test/distrib/csharp/run_distrib_test.sh
+++ b/test/distrib/csharp/run_distrib_test.sh
@@ -32,7 +32,7 @@ set -ex
cd $(dirname $0)
-unzip "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets.zip" -d TestNugetFeed
+unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets.zip" -d TestNugetFeed
# TODO(jtattermusch): replace the version number
./update_version.sh 0.13.0
diff --git a/test/distrib/csharp/update_version.sh b/test/distrib/csharp/update_version.sh
index 569f7ff4bd..f2554e8998 100755
--- a/test/distrib/csharp/update_version.sh
+++ b/test/distrib/csharp/update_version.sh
@@ -33,4 +33,4 @@ set -e
cd $(dirname $0)
# Replaces version placeholder with value provided as first argument.
-sed -i "s/__GRPC_NUGET_VERSION__/$1/g" DistribTest/packages.config DistribTest/DistribTest.csproj
+sed -ibak "s/__GRPC_NUGET_VERSION__/$1/g" DistribTest/packages.config DistribTest/DistribTest.csproj
diff --git a/tools/run_tests/distribtest_targets.py b/tools/run_tests/distribtest_targets.py
index f3ebc00b4e..fc7dd17145 100644
--- a/tools/run_tests/distribtest_targets.py
+++ b/tools/run_tests/distribtest_targets.py
@@ -55,28 +55,49 @@ def create_docker_jobspec(name, dockerfile_dir, shell_command, environ={},
return jobspec
+def create_jobspec(name, cmdline, environ=None, shell=False,
+ flake_retries=0, timeout_retries=0):
+ """Creates jobspec."""
+ jobspec = jobset.JobSpec(
+ cmdline=cmdline,
+ environ=environ,
+ shortname='distribtest.%s' % (name),
+ timeout_seconds=10*60,
+ flake_retries=flake_retries,
+ timeout_retries=timeout_retries,
+ shell=shell)
+ return jobspec
+
+
class CSharpDistribTest(object):
"""Tests C# NuGet package"""
- def __init__(self, platform, arch, docker_suffix):
- self.name = 'csharp_nuget_%s_%s_%s' % (platform, arch, docker_suffix)
+ def __init__(self, platform, arch, docker_suffix=None):
+ self.name = 'csharp_nuget_%s_%s' % (platform, arch)
self.platform = platform
self.arch = arch
self.docker_suffix = docker_suffix
- self.labels = ['distribtest', 'csharp', platform, arch, docker_suffix]
+ self.labels = ['distribtest', 'csharp', platform, arch]
+ if docker_suffix:
+ self.name += '_%s' % docker_suffix
+ self.labels.append(docker_suffix)
def pre_build_jobspecs(self):
return []
def build_jobspec(self):
- if not self.platform == 'linux':
- raise Exception("Not supported yet.")
-
- return create_docker_jobspec(self.name,
+ if self.platform == 'linux':
+ return create_docker_jobspec(self.name,
'tools/dockerfile/distribtest/csharp_%s_%s' % (
self.docker_suffix,
self.arch),
'test/distrib/csharp/run_distrib_test.sh')
+ elif self.platform == 'macos':
+ return create_jobspec(self.name,
+ ['test/distrib/csharp/run_distrib_test.sh'],
+ environ={'EXTERNAL_GIT_ROOT': '../../..'})
+ else:
+ raise Exception("Not supported yet.")
def __str__(self):
return self.name
@@ -175,6 +196,7 @@ def targets():
CSharpDistribTest('linux', 'x64', 'ubuntu1504'),
CSharpDistribTest('linux', 'x64', 'ubuntu1510'),
CSharpDistribTest('linux', 'x64', 'ubuntu1604'),
+ CSharpDistribTest('macos', 'x86'),
PythonDistribTest('linux', 'x64', 'wheezy'),
PythonDistribTest('linux', 'x64', 'jessie'),
PythonDistribTest('linux', 'x86', 'jessie'),