diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-04-10 22:39:44 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-04-10 22:39:44 +0200 |
commit | 7a6d8fde095501016dc98f43299be2facc79f17e (patch) | |
tree | f88972d1f17e78920ee1228dee061878562dd27b /tools | |
parent | f0863b02270f1b95d5c8b9f3f962959e4cbbdd42 (diff) | |
parent | 046c6656c961bb65508d725edb9adc60f63e3424 (diff) |
Merge branch 'master' of github.com:grpc/grpc into freebsd
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/distpackages/build_deb_packages.sh | 33 | ||||
-rw-r--r-- | tools/distpackages/templates/libgrpc/DEBIAN/control | 3 | ||||
-rwxr-xr-x | tools/distrib/python/submit.py | 54 | ||||
-rw-r--r-- | tools/dockerfile/grpc_build_deb/Dockerfile | 13 | ||||
-rw-r--r-- | tools/dockerfile/grpc_build_deb/version.txt | 1 | ||||
-rw-r--r-- | tools/dockerfile/grpc_dist_proto/version.txt | 2 | ||||
-rw-r--r-- | tools/dockerfile/grpc_java_base/Dockerfile | 2 | ||||
-rw-r--r-- | tools/dockerfile/grpc_php/Dockerfile | 6 | ||||
-rw-r--r-- | tools/dockerfile/grpc_php_base/Dockerfile | 26 | ||||
-rw-r--r-- | tools/dockerfile/grpc_scan_build/Dockerfile | 47 | ||||
-rwxr-xr-x | tools/gce_setup/grpc_docker.sh | 94 | ||||
-rwxr-xr-x | tools/gce_setup/interop_test_runner.sh | 2 | ||||
-rwxr-xr-x | tools/gce_setup/shared_startup_funcs.sh | 6 | ||||
-rwxr-xr-x | tools/run_tests/run_tests.py | 21 | ||||
-rw-r--r-- | tools/run_tests/tests.json | 10 |
15 files changed, 287 insertions, 33 deletions
diff --git a/tools/distpackages/build_deb_packages.sh b/tools/distpackages/build_deb_packages.sh index 7b2acb6577..0beb41ed0a 100755 --- a/tools/distpackages/build_deb_packages.sh +++ b/tools/distpackages/build_deb_packages.sh @@ -30,11 +30,28 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Where to put resulting .deb packages. -deb_dest="deb_out" +set -x +deb_dest="/tmp/deb_out" mkdir -p $deb_dest -version='0.5.0.0' +# Where the grpc disto is +grpc_root="/var/local/git/grpc" + +# Update version from default values if the file /version.txt exists +# +# - when present, /version.txt will added by the docker build. pkg_version='0.5.0' +if [ -f /version.txt ]; then + pkg_version=$(cat /version.txt) +fi +version="${pkg_version}.0" +release_tag="release-${pkg_version//./_}" +echo "Target release => $pkg_version, will checkout tag $release_tag" + +# Switch grpc_root to the release tag +pushd $grpc_root +git checkout $release_tag || { echo "bad release tag ${release_tag}"; exit 1; } +popd if [ -f /.dockerinit ]; then # We're in Docker where uname -p returns "unknown". @@ -64,7 +81,9 @@ do if [ $pkg_name == "libgrpc" ] then # Copy shared libraries - (cd ../..; make install-shared_c prefix=$tmp_dir/$pkg_name/usr/lib) + pushd $grpc_root + make install-shared_c prefix=$tmp_dir/$pkg_name/usr/lib + popd mv $tmp_dir/$pkg_name/usr/lib/lib $arch_lib_dir # non-dev package should contain so.0 symlinks @@ -77,7 +96,10 @@ do if [ $pkg_name == "libgrpc-dev" ] then # Copy headers and static libraries - (cd ../..; make install-headers_c install-static_c prefix=$tmp_dir/$pkg_name/usr/lib) + pushd $grpc_root + make install-headers_c install-static_c prefix=$tmp_dir/$pkg_name/usr/lib + popd + mv $tmp_dir/$pkg_name/usr/lib/include $tmp_dir/$pkg_name/usr/include mv $tmp_dir/$pkg_name/usr/lib/lib $arch_lib_dir @@ -110,8 +132,5 @@ do dpkg-deb -c $deb_path echo "Problems reported by lintian:" lintian $deb_path - echo done - - diff --git a/tools/distpackages/templates/libgrpc/DEBIAN/control b/tools/distpackages/templates/libgrpc/DEBIAN/control index 417a825827..5854b1f4a1 100644 --- a/tools/distpackages/templates/libgrpc/DEBIAN/control +++ b/tools/distpackages/templates/libgrpc/DEBIAN/control @@ -2,7 +2,8 @@ Package: libgrpc Version: 0.5.0 Architecture: amd64 Maintainer: Jan Tattermusch <jtattermusch@google.com> -Depends: libc6 +Depends: libc6, openssl (1.0.2-1) +Build-Depends-Indep: openssl (1.0.2-1) Section: libs Priority: optional Homepage: https://github.com/grpc/grpc diff --git a/tools/distrib/python/submit.py b/tools/distrib/python/submit.py new file mode 100755 index 0000000000..79ebb93e57 --- /dev/null +++ b/tools/distrib/python/submit.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +import argparse +import os +import shutil +import subprocess + +parser = argparse.ArgumentParser( + description='Submit the package to a PyPI repository.') +parser.add_argument( + '--repository', '-r', metavar='r', type=str, default='pypi', + help='The repository to push the package to. ' + 'Ensure the value appears in your .pypirc file. ' + 'Defaults to "pypi".' +) +parser.add_argument( + '--identity', '-i', metavar='i', type=str, + help='GPG identity to sign the files with.' +) +parser.add_argument( + '--username', '-u', metavar='u', type=str, + help='Username to authenticate with the repository. Not needed if you have ' + 'configured your .pypirc to include your username.' +) +parser.add_argument( + '--password', '-p', metavar='p', type=str, + help='Password to authenticate with the repository. Not needed if you have ' + 'configured your .pypirc to include your password.' +) +args = parser.parse_args() + +# Move to the root directory of Python GRPC. +pkgdir = os.path.join(os.path.dirname(os.path.abspath(__file__)), + '../../../src/python/src') +# Remove previous distributions; they somehow confuse twine. +try: + shutil.rmtree(os.path.join(pkgdir, 'dist/')) +except: + pass + +# Make the push. +cmd = ['python', 'setup.py', 'sdist'] +subprocess.call(cmd, cwd=pkgdir) + +cmd = ['twine', 'upload', '-r', args.repository] +if args.identity is not None: + cmd.extend(['-i', args.identity]) +if args.username is not None: + cmd.extend(['-u', args.username]) +if args.password is not None: + cmd.extend(['-p', args.password]) +cmd.append('dist/*') + +subprocess.call(cmd, cwd=pkgdir) diff --git a/tools/dockerfile/grpc_build_deb/Dockerfile b/tools/dockerfile/grpc_build_deb/Dockerfile index 24ffc7379c..7f025b6712 100644 --- a/tools/dockerfile/grpc_build_deb/Dockerfile +++ b/tools/dockerfile/grpc_build_deb/Dockerfile @@ -30,8 +30,17 @@ # Dockerfile to build Debian packages for gRPC C core. FROM grpc/base +# Add the file containing the gRPC version +ADD version.txt version.txt + +# Add the update-to-date distpackages folder +ADD distpackages distpackages + # Install dependencies -RUN apt-get update && apt-get install -y lintian +RUN echo 'deb http://http.debian.net/debian experimental main contrib non-free' >> /etc/apt/sources.list +RUN apt-get update \ + && apt-get -t experimental install -y openssl=1.0.2-1 \ + && apt-get install -y lintian # Get the source from GitHub RUN git clone https://github.com/grpc/grpc.git /var/local/git/grpc @@ -39,4 +48,4 @@ RUN cd /var/local/git/grpc && \ git pull --recurse-submodules && \ git submodule update --init --recursive -RUN /bin/bash -l -c 'cd /var/local/git/grpc/tools/distpackages && ./build_deb_packages.sh' +RUN /bin/bash -l -c 'cd /distpackages && ./build_deb_packages.sh' diff --git a/tools/dockerfile/grpc_build_deb/version.txt b/tools/dockerfile/grpc_build_deb/version.txt new file mode 100644 index 0000000000..a918a2aa18 --- /dev/null +++ b/tools/dockerfile/grpc_build_deb/version.txt @@ -0,0 +1 @@ +0.6.0 diff --git a/tools/dockerfile/grpc_dist_proto/version.txt b/tools/dockerfile/grpc_dist_proto/version.txt index 8f0916f768..a918a2aa18 100644 --- a/tools/dockerfile/grpc_dist_proto/version.txt +++ b/tools/dockerfile/grpc_dist_proto/version.txt @@ -1 +1 @@ -0.5.0 +0.6.0 diff --git a/tools/dockerfile/grpc_java_base/Dockerfile b/tools/dockerfile/grpc_java_base/Dockerfile index 2ee0a623c7..57b1b90fcd 100644 --- a/tools/dockerfile/grpc_java_base/Dockerfile +++ b/tools/dockerfile/grpc_java_base/Dockerfile @@ -57,8 +57,6 @@ RUN wget -O - https://github.com/google/protobuf/archive/v3.0.0-alpha-2.tar.gz | ./autogen.sh && \ ./configure --prefix=/usr && \ make -j12 && make check && make install && \ - cd java && mvn install && cd .. && \ - cd javanano && mvn install && cd .. && \ rm -r "$(pwd)" # Trigger download of as many Maven and Gradle artifacts as possible. We don't build grpc-java diff --git a/tools/dockerfile/grpc_php/Dockerfile b/tools/dockerfile/grpc_php/Dockerfile index 100d7b3bdb..770d0d2627 100644 --- a/tools/dockerfile/grpc_php/Dockerfile +++ b/tools/dockerfile/grpc_php/Dockerfile @@ -45,3 +45,9 @@ RUN cd /var/local/git/grpc/src/php/ext/grpc && git pull && phpize RUN cd /var/local/git/grpc/src/php/ext/grpc \ && ./configure \ && make + +RUN cd /var/local/git/grpc/src/php && composer install + +RUN cd /var/local/git/grpc/src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto + +RUN cd /var/local/git/grpc/src/php && ./bin/run_tests.sh
\ No newline at end of file diff --git a/tools/dockerfile/grpc_php_base/Dockerfile b/tools/dockerfile/grpc_php_base/Dockerfile index cc874fd7c5..c49d3fef66 100644 --- a/tools/dockerfile/grpc_php_base/Dockerfile +++ b/tools/dockerfile/grpc_php_base/Dockerfile @@ -32,6 +32,10 @@ # Includes PHP installation dependencies, things that are unlikely to vary. FROM grpc/base +RUN echo "deb http://packages.dotdeb.org wheezy-php55 all" >> /etc/apt/sources.list.d/dotdeb.list +RUN echo "deb-src http://packages.dotdeb.org wheezy-php55 all" >> /etc/apt/sources.list.d/dotdeb.list +RUN wget http://www.dotdeb.org/dotdeb.gpg -O- |apt-key add - + # Install RVM dependencies and other packages RUN apt-get update && apt-get install -y \ autoconf \ @@ -50,29 +54,25 @@ RUN apt-get update && apt-get install -y \ libsqlite3-dev \ libssl-dev \ libtool \ + libxml2 \ libyaml-dev \ make \ patch \ procps \ -# TODO(mlumish): Uncomment these lines when building against them works -# php5-common \ -# php5-cli \ -# php5-dev \ -# php-pear \ + php5-common \ + php5-cli \ + php5-dev \ + php-pear \ pkg-config \ procps \ sqlite3 \ zlib1g-dev -# Install the version of PHP gRPC is tested against ENV DEBIAN_FRONTEND noniteractive -RUN apt-get update && apt-get install -y libxml2 libxml2-dev # used by PHP -RUN cd /var/local \ - && curl -o php-5.5.17.tar.gz http://php.net/distributions/php-5.5.17.tar.gz \ - && tar -xf php-5.5.17.tar.gz \ - && cd php-5.5.17 \ - && ./configure --with-zlib=/usr --with-libxml-dir=ext/libxml \ - && make -j12 && make install + +# Install composer +RUN curl -sS https://getcomposer.org/installer | php +RUN mv composer.phar /usr/local/bin/composer # Download the patched PHP protobuf so that PHP gRPC clients can be generated # from proto3 schemas. diff --git a/tools/dockerfile/grpc_scan_build/Dockerfile b/tools/dockerfile/grpc_scan_build/Dockerfile new file mode 100644 index 0000000000..9f263849c9 --- /dev/null +++ b/tools/dockerfile/grpc_scan_build/Dockerfile @@ -0,0 +1,47 @@ +# 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. + +FROM grpc/clang:latest + +RUN apt-get update && apt-get install -y \ + autoconf \ + libtool \ + libgflags-dev \ + libgtest-dev \ + && apt-get clean + +RUN git clone --recursive https://github.com/grpc/grpc.git + +EXPOSE 8181 + +CMD \ + (cd grpc ; git pull) && \ + (cd grpc ; git submodule update --init --recursive) && \ + llvm/tools/clang/tools/scan-build/scan-build -o /tmp/grpc --use-analyzer=/usr/local/bin/clang make -C grpc buildtests && \ + llvm/tools/clang/tools/scan-view/scan-view /tmp/grpc/`ls /tmp/grpc` --host 0.0.0.0 --no-browser --allow-all-hosts diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 497112ce39..40634291cf 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -673,7 +673,7 @@ _grpc_build_proto_bins_args() { } # grpc_build_proto_bins -# +# # - rebuilds the dist_proto docker image # * doing this builds the protoc and the ruby, python and cpp bins statically # @@ -693,11 +693,11 @@ grpc_build_proto_bins() { gce_has_instance $grpc_project $host || return 1; local project_opt="--project $grpc_project" local zone_opt="--zone $grpc_zone" - + # rebuild the dist_proto image local label='dist_proto' grpc_update_image -- -h $host $label || return 1 - + # run a command to copy the generated archive to the docker host local docker_prefix='sudo docker run -v /tmp:/tmp/proto_bins_out' local tar_name='proto-bins*.tar.gz' @@ -715,6 +715,63 @@ grpc_build_proto_bins() { gcloud compute copy-files $rmt_tar $local_copy $project_opt $zone_opt || return 1 } +_grpc_build_debs_args() { + [[ -n $1 ]] && { # host + host=$1 + shift + } || { + host='grpc-docker-builder' + } +} + +# grpc_build_debs +# +# - rebuilds the build_debs +# * doing this builds a deb package for release debs +# +# - runs a docker command that copies the debs from the docker instance to its +# host +# - copies the debs from the host to the local machine +grpc_build_debs() { + _grpc_ensure_gcloud_ssh || return 1; + + # declare vars local so that they don't pollute the shell environment + # where this func is used. + local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone + # set by _grpc_build_debs_args + local host + + # set the project zone and check that all necessary args are provided + _grpc_set_project_and_zone -f _grpc_build_debs_args "$@" || return 1 + gce_has_instance $grpc_project $host || return 1; + local project_opt="--project $grpc_project" + local zone_opt="--zone $grpc_zone" + + # Update the remote distpackages_dir + local src_dist_dir='tools/distpackages' + local rmt_dist_dir="$host:~" + gcloud compute copy-files $src_dist_dir $rmt_dist_dir $project_opt $zone_opt || return 1 + + # rebuild the build_deb image + local label='build_deb' + grpc_update_image -- -h $host $label || return 1 + + # run a command to copy the debs from the docker instance to the host. + local docker_prefix='sudo docker run -v /tmp:/tmp/host_deb_out' + local cp_cmd="/bin/bash -c 'cp -v /tmp/deb_out/*.deb /tmp/host_deb_out'" + local cmd="$docker_prefix grpc/$label $cp_cmd" + local ssh_cmd="bash -l -c \"$cmd\"" + echo "will run:" + echo " $ssh_cmd" + echo "on $host" + gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" || return 1 + + # copy the debs from host machine to the local one. + local rmt_debs="$host:/tmp/*.deb" + local local_copy="$(pwd)" + gcloud compute copy-files $rmt_debs $local_copy $project_opt $zone_opt || return 1 +} + _grpc_launch_servers_args() { [[ -n $1 ]] && { # host host=$1 @@ -984,6 +1041,35 @@ grpc_interop_gen_python_cmd() { echo $the_cmd } +# constructs the full dockerized python service_account auth interop test cmd. +# +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_cloud_prod_auth_service_account_creds_gen_python_cmd() { + local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; + local gfe_flags=$(_grpc_prod_gfe_flags) + local added_gfe_flags=$(_grpc_default_creds_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 python -B -m interop.client --use_tls $gfe_flags $added_gfe_flags $@'" + echo $the_cmd +} + +# constructs the full dockerized python gce auth interop test cmd. +# +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_cloud_prod_auth_compute_engine_creds_gen_python_cmd() { + local cmd_prefix="sudo docker run grpc/ruby bin/bash -l -c"; + local gfe_flags=$(_grpc_prod_gfe_flags) + local added_gfe_flags=$(_grpc_gce_test_flags) + local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" + local the_cmd="$cmd_prefix '$env_prefix python -B -m interop.client --use_tls $gfe_flags $added_gfe_flags $@'" + echo $the_cmd +} + # constructs the full dockerized java interop test cmd. # # call-seq: @@ -1310,5 +1396,3 @@ _grpc_default_creds_test_flags() { _grpc_gce_test_flags() { echo " --default_service_account=155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel@developer.gserviceaccount.com --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" } - -# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh index 7f0b5bab1a..1c6122e9ae 100755 --- a/tools/gce_setup/interop_test_runner.sh +++ b/tools/gce_setup/interop_test_runner.sh @@ -36,7 +36,7 @@ echo $result_file_name main() { source grpc_docker.sh test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming cancel_after_begin cancel_after_first_response) - clients=(cxx java go ruby node python csharp_mono) + clients=(cxx java go ruby node python csharp_mono php) servers=(cxx java go ruby node python csharp_mono) for test_case in "${test_cases[@]}" do diff --git a/tools/gce_setup/shared_startup_funcs.sh b/tools/gce_setup/shared_startup_funcs.sh index e6eecc56db..c4a076757a 100755 --- a/tools/gce_setup/shared_startup_funcs.sh +++ b/tools/gce_setup/shared_startup_funcs.sh @@ -434,6 +434,12 @@ grpc_dockerfile_install() { grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; } + # For deb builds, copy the distpackages folder into the docker directory so + # that it can be installed using ADD distpackages distpackages. + [[ $image_label == "grpc/build_deb" ]] && { + cp -vR ~/distpackages $dockerfile_dir + } + # TODO(temiola): maybe make cache/no-cache a func option? sudo docker build $cache_opt -t $image_label $dockerfile_dir || { echo "$FUNCNAME:: build of $image_label <- $dockerfile_dir" diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 6b8cd1111e..14ee1790c6 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -224,6 +224,24 @@ class CSharpLanguage(object): def __str__(self): return 'csharp' +class Build(object): + + def test_specs(self, config, travis): + return [] + + def make_targets(self): + return ['all'] + + def build_steps(self): + return [] + + def supports_multi_config(self): + return True + + def __str__(self): + return self.make_target + + # different configurations we can run under _CONFIGS = { 'dbg': SimpleConfig('dbg'), @@ -248,7 +266,8 @@ _LANGUAGES = { 'php': PhpLanguage(), 'python': PythonLanguage(), 'ruby': RubyLanguage(), - 'csharp': CSharpLanguage() + 'csharp': CSharpLanguage(), + 'build': Build(), } # parse command line diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 355d5735cd..eab07040e7 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -349,11 +349,21 @@ { "flaky": false, "language": "c++", + "name": "cli_call_test" + }, + { + "flaky": false, + "language": "c++", "name": "credentials_test" }, { "flaky": false, "language": "c++", + "name": "cxx_time_test" + }, + { + "flaky": false, + "language": "c++", "name": "end2end_test" }, { |