diff options
author | yang-g <yangg@google.com> | 2016-02-12 14:54:16 -0800 |
---|---|---|
committer | yang-g <yangg@google.com> | 2016-02-12 14:54:16 -0800 |
commit | a3c968d9c263b7e380f524bcb27195a76ff3d4b7 (patch) | |
tree | 23907ff5633e431a4497d8ddffe035941bba263c /test | |
parent | 1945ae42854689afa398e46d3086e55706fee655 (diff) | |
parent | 017f84ead8fe1709ecd9a9f7f532464d2a170ff9 (diff) |
Merge remote-tracking branch 'upstream/master' into inherit_from_grpc_library
Diffstat (limited to 'test')
-rwxr-xr-x | test/core/bad_client/gen_build_yaml.py | 8 | ||||
-rwxr-xr-x | test/core/bad_ssl/gen_build_yaml.py | 12 | ||||
-rwxr-xr-x | test/core/end2end/gen_build_yaml.py | 8 | ||||
-rw-r--r-- | test/core/fling/client.c | 12 | ||||
-rw-r--r-- | test/cpp/common/alarm_cpp_test.cc (renamed from test/cpp/common/alarm_test.cc) | 29 | ||||
-rw-r--r-- | test/cpp/end2end/async_end2end_test.cc | 4 | ||||
-rwxr-xr-x | test/distrib/csharp/run_distrib_test.sh | 5 | ||||
-rwxr-xr-x | test/distrib/node/run_distrib_test.sh | 7 | ||||
-rw-r--r-- | test/distrib/python/distribtest.py | 2 | ||||
-rwxr-xr-x | test/distrib/python/run_distrib_test.sh | 8 | ||||
-rw-r--r-- | test/distrib/ruby/Gemfile | 11 | ||||
-rw-r--r-- | test/distrib/ruby/distribtest.gemspec | 19 | ||||
-rwxr-xr-x | test/distrib/ruby/distribtest.rb | 39 | ||||
-rwxr-xr-x | test/distrib/ruby/run_distrib_test.sh | 10 |
14 files changed, 130 insertions, 44 deletions
diff --git a/test/core/bad_client/gen_build_yaml.py b/test/core/bad_client/gen_build_yaml.py index f37aa66c5f..c538bffd71 100755 --- a/test/core/bad_client/gen_build_yaml.py +++ b/test/core/bad_client/gen_build_yaml.py @@ -67,7 +67,9 @@ def main(): 'vs_proj_dir': 'test/bad_client', 'deps': [ 'grpc_test_util_unsecure', - 'grpc_unsecure' + 'grpc_unsecure', + 'gpr_test_util', + 'gpr' ] }], 'targets': [ @@ -82,7 +84,9 @@ def main(): 'deps': [ 'bad_client_test', 'grpc_test_util_unsecure', - 'grpc_unsecure' + 'grpc_unsecure', + 'gpr_test_util', + 'gpr' ] } for t in sorted(BAD_CLIENT_TESTS.keys())]} diff --git a/test/core/bad_ssl/gen_build_yaml.py b/test/core/bad_ssl/gen_build_yaml.py index 9f05fed485..cc097a8fdf 100755 --- a/test/core/bad_ssl/gen_build_yaml.py +++ b/test/core/bad_ssl/gen_build_yaml.py @@ -58,7 +58,9 @@ def main(): 'platforms': ['linux', 'posix', 'mac'], 'deps': [ 'grpc_test_util', - 'grpc' + 'grpc', + 'gpr_test_util', + 'gpr' ] } ], @@ -74,7 +76,9 @@ def main(): 'deps': [ 'bad_ssl_test_server', 'grpc_test_util', - 'grpc' + 'grpc', + 'gpr_test_util', + 'gpr' ] } for t in sorted(BAD_CLIENT_TESTS.keys())] + [ @@ -88,7 +92,9 @@ def main(): 'platforms': ['linux', 'posix', 'mac'], 'deps': [ 'grpc_test_util', - 'grpc' + 'grpc', + 'gpr_test_util', + 'gpr' ] } for t in sorted(BAD_CLIENT_TESTS.keys())]} diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index d4fa7ab518..f24dbe72cf 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -152,11 +152,15 @@ def main(): sec_deps = [ 'end2end_certs', 'grpc_test_util', - 'grpc' + 'grpc', + 'gpr_test_util', + 'gpr' ] unsec_deps = [ 'grpc_test_util_unsecure', - 'grpc_unsecure' + 'grpc_unsecure', + 'gpr_test_util', + 'gpr' ] json = { '#': 'generated with test/end2end/gen_build_json.py', diff --git a/test/core/fling/client.c b/test/core/fling/client.c index 02db681cfd..b36aef3093 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -51,7 +51,7 @@ static grpc_channel *channel; static grpc_completion_queue *cq; static grpc_call *call; static grpc_op ops[6]; -static grpc_op stream_init_op; +static grpc_op stream_init_ops[2]; static grpc_op stream_step_ops[2]; static grpc_metadata_array initial_metadata_recv; static grpc_metadata_array trailing_metadata_recv; @@ -105,13 +105,17 @@ static void step_ping_pong_request(void) { } static void init_ping_pong_stream(void) { + grpc_metadata_array_init(&initial_metadata_recv); + grpc_call_error error; call = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/Reflector/reflectStream", "localhost", gpr_inf_future(GPR_CLOCK_REALTIME), NULL); - stream_init_op.op = GRPC_OP_SEND_INITIAL_METADATA; - stream_init_op.data.send_initial_metadata.count = 0; - error = grpc_call_start_batch(call, &stream_init_op, 1, (void *)1, NULL); + stream_init_ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; + stream_init_ops[0].data.send_initial_metadata.count = 0; + stream_init_ops[1].op = GRPC_OP_RECV_INITIAL_METADATA; + stream_init_ops[1].data.recv_initial_metadata = &initial_metadata_recv; + error = grpc_call_start_batch(call, stream_init_ops, 2, (void *)1, NULL); GPR_ASSERT(GRPC_CALL_OK == error); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); diff --git a/test/cpp/common/alarm_test.cc b/test/cpp/common/alarm_cpp_test.cc index 09df6852a5..4745ef14ec 100644 --- a/test/cpp/common/alarm_test.cc +++ b/test/cpp/common/alarm_cpp_test.cc @@ -35,58 +35,47 @@ #include <grpc++/completion_queue.h> #include <gtest/gtest.h> -#include <grpc++/completion_queue.h> #include "test/core/util/test_config.h" namespace grpc { namespace { -class TestTag : public CompletionQueueTag { - public: - TestTag() : tag_(0) {} - TestTag(intptr_t tag) : tag_(tag) {} - bool FinalizeResult(void** tag, bool* status) { return true; } - intptr_t tag() { return tag_; } - - private: - intptr_t tag_; -}; - TEST(AlarmTest, RegularExpiry) { CompletionQueue cq; - TestTag input_tag(1618033); - Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), &input_tag); + void* junk = reinterpret_cast<void*>(1618033); + Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), junk); - TestTag* output_tag; + void* output_tag; bool ok; const CompletionQueue::NextStatus status = cq.AsyncNext( (void**)&output_tag, &ok, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2)); EXPECT_EQ(status, CompletionQueue::GOT_EVENT); EXPECT_TRUE(ok); - EXPECT_EQ(output_tag->tag(), input_tag.tag()); + EXPECT_EQ(junk, output_tag); } TEST(AlarmTest, Cancellation) { CompletionQueue cq; - TestTag input_tag(1618033); - Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), &input_tag); + void* junk = reinterpret_cast<void*>(1618033); + Alarm alarm(&cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2), junk); alarm.Cancel(); - TestTag* output_tag; + void* output_tag; bool ok; const CompletionQueue::NextStatus status = cq.AsyncNext( (void**)&output_tag, &ok, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1)); EXPECT_EQ(status, CompletionQueue::GOT_EVENT); EXPECT_FALSE(ok); - EXPECT_EQ(output_tag->tag(), input_tag.tag()); + EXPECT_EQ(junk, output_tag); } } // namespace } // namespace grpc int main(int argc, char** argv) { + grpc_test_init(argc, argv); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 252bda3798..a194c615cd 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -479,8 +479,10 @@ TEST_P(AsyncEnd2endTest, ClientInitialMetadataRpc) { send_request.set_message("Hello"); std::pair<grpc::string, grpc::string> meta1("key1", "val1"); std::pair<grpc::string, grpc::string> meta2("key2", "val2"); + std::pair<grpc::string, grpc::string> meta3("g.r.d-bin", "xyz"); cli_ctx.AddMetadata(meta1.first, meta1.second); cli_ctx.AddMetadata(meta2.first, meta2.second); + cli_ctx.AddMetadata(meta3.first, meta3.second); std::unique_ptr<ClientAsyncResponseReader<EchoResponse>> response_reader( stub_->AsyncEcho(&cli_ctx, send_request, cq_.get())); @@ -494,6 +496,8 @@ TEST_P(AsyncEnd2endTest, ClientInitialMetadataRpc) { ToString(client_initial_metadata.find(meta1.first)->second)); EXPECT_EQ(meta2.second, ToString(client_initial_metadata.find(meta2.first)->second)); + EXPECT_EQ(meta3.second, + ToString(client_initial_metadata.find(meta3.first)->second)); EXPECT_GE(client_initial_metadata.size(), static_cast<size_t>(2)); send_response.set_message(recv_request.message()); diff --git a/test/distrib/csharp/run_distrib_test.sh b/test/distrib/csharp/run_distrib_test.sh index 8ddb4c4bff..1de62041b3 100755 --- a/test/distrib/csharp/run_distrib_test.sh +++ b/test/distrib/csharp/run_distrib_test.sh @@ -34,8 +34,9 @@ cd $(dirname $0) unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets.zip" -d TestNugetFeed -# TODO(jtattermusch): replace the version number -./update_version.sh 0.13.0 +# Extract the version number from Grpc nuget package name. +CSHARP_VERSION=$(ls TestNugetFeed | grep '^Grpc\.[0-9].*\.nupkg$' | sed s/^Grpc\.// | sed s/\.nupkg$//) +./update_version.sh $CSHARP_VERSION nuget restore diff --git a/test/distrib/node/run_distrib_test.sh b/test/distrib/node/run_distrib_test.sh index ac9e7d7090..99a51f01f7 100755 --- a/test/distrib/node/run_distrib_test.sh +++ b/test/distrib/node/run_distrib_test.sh @@ -28,15 +28,12 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +NODE_VERSION=$1 +source ~/.nvm/nvm.sh set -ex cd $(dirname $0) -NODE_VERSION="$1" - -# make sure nvm is available -source ~/.nvm/nvm.sh || true - nvm install $NODE_VERSION npm install -g node-static diff --git a/test/distrib/python/distribtest.py b/test/distrib/python/distribtest.py index 66c1f88796..dc20688140 100644 --- a/test/distrib/python/distribtest.py +++ b/test/distrib/python/distribtest.py @@ -1,4 +1,4 @@ -# Copyright 2015-2016, Google Inc. +# Copyright 2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/test/distrib/python/run_distrib_test.sh b/test/distrib/python/run_distrib_test.sh index 08856ad388..8fd7ffb54c 100755 --- a/test/distrib/python/run_distrib_test.sh +++ b/test/distrib/python/run_distrib_test.sh @@ -32,11 +32,11 @@ set -ex cd $(dirname $0) -# TODO(jtattermusch): replace the version number -SDIST_ARCHIVE="$EXTERNAL_GIT_ROOT/input_artifacts/grpcio-0.12.0b8.tar.gz" +# Pick up the source dist archive whatever its version is +SDIST_ARCHIVE=$EXTERNAL_GIT_ROOT/input_artifacts/grpcio-*.tar.gz BDIST_DIR="file://$EXTERNAL_GIT_ROOT/input_artifacts" -if [ ! -f "${SDIST_ARCHIVE}" ] +if [ ! -f ${SDIST_ARCHIVE} ] then echo "Archive ${SDIST_ARCHIVE} does not exist." exit 1 @@ -52,7 +52,7 @@ $PIP install --upgrade six GRPC_PYTHON_BINARIES_REPOSITORY="${BDIST_DIR}" \ $PIP install \ - "${SDIST_ARCHIVE}" + ${SDIST_ARCHIVE} $PYTHON distribtest.py diff --git a/test/distrib/ruby/Gemfile b/test/distrib/ruby/Gemfile new file mode 100644 index 0000000000..96e68e9c34 --- /dev/null +++ b/test/distrib/ruby/Gemfile @@ -0,0 +1,11 @@ +# -*- ruby -*- +# encoding: utf-8 + +source 'https://rubygems.org/' + +# TODO(jtattermusch): don't hardcode the absolute path the local gem source +source "file:///var/local/git/grpc/gem_source" do + gem 'grpc' +end + +gemspec diff --git a/test/distrib/ruby/distribtest.gemspec b/test/distrib/ruby/distribtest.gemspec new file mode 100644 index 0000000000..d72892f46c --- /dev/null +++ b/test/distrib/ruby/distribtest.gemspec @@ -0,0 +1,19 @@ +# -*- ruby -*- +# encoding: utf-8 + +Gem::Specification.new do |s| + s.name = 'distribtest' + s.version = '0.0.1' + s.authors = ['gRPC Authors'] + s.email = 'jtattermusch@google.com' + s.homepage = 'https://github.com/grpc/grpc' + s.summary = 'gRPC Distribution test' + + s.files = ['distribtest.rb'] + s.executables = ['distribtest.rb'] + s.platform = Gem::Platform::RUBY + + s.add_dependency 'grpc', '>=0' + + s.add_development_dependency 'bundler', '~> 1.7' +end diff --git a/test/distrib/ruby/distribtest.rb b/test/distrib/ruby/distribtest.rb new file mode 100755 index 0000000000..3f656a89f3 --- /dev/null +++ b/test/distrib/ruby/distribtest.rb @@ -0,0 +1,39 @@ +#!/usr/bin/env ruby + +# 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. + +require 'grpc' + +# This code doesn't do much but makes sure the native extension is loaded +# which is what we are testing here. +ch = GRPC::Core::Channel.new('localhost:1000', nil, :this_channel_is_insecure) +ch.destroy + +puts "Success!" diff --git a/test/distrib/ruby/run_distrib_test.sh b/test/distrib/ruby/run_distrib_test.sh index ae409f8dc5..be60e44b63 100755 --- a/test/distrib/ruby/run_distrib_test.sh +++ b/test/distrib/ruby/run_distrib_test.sh @@ -32,5 +32,13 @@ set -ex cd $(dirname $0) -# do something ruby-ish +# Create an indexed local gem source with gRPC gems to test +GEM_SOURCE=../../../gem_source +mkdir -p ${GEM_SOURCE}/gems +cp -r $EXTERNAL_GIT_ROOT/input_artifacts/*.gem ${GEM_SOURCE}/gems +gem install builder +gem generate_index --directory ${GEM_SOURCE} +bundle install + +bundle exec ./distribtest.rb |