Merge pull request #4906 from jtattermusch/runtest_more_cleanup
More cleanup of run_tests.py
diff --git a/tools/dockerfile/grpc_jenkins_slave_x64/Dockerfile b/tools/dockerfile/grpc_jenkins_slave_x64/Dockerfile
deleted file mode 100644
index 48541b0..0000000
--- a/tools/dockerfile/grpc_jenkins_slave_x64/Dockerfile
+++ /dev/null
@@ -1,172 +0,0 @@
-# Copyright 2015-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.
-
-# A work-in-progress Dockerfile that allows running gRPC test suites
-# inside a docker container.
-
-FROM debian:jessie
-
-# Install Git and basic packages.
-RUN apt-get update && apt-get install -y \
- autoconf \
- autotools-dev \
- build-essential \
- bzip2 \
- ccache \
- curl \
- gcc \
- gcc-multilib \
- git \
- golang \
- gyp \
- lcov \
- libc6 \
- libc6-dbg \
- libc6-dev \
- libgtest-dev \
- libtool \
- make \
- perl \
- strace \
- python-dev \
- python-setuptools \
- python-yaml \
- telnet \
- unzip \
- wget \
- zip && apt-get clean
-
-# Prepare ccache
-RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
-RUN ln -s /usr/bin/ccache /usr/local/bin/g++
-RUN ln -s /usr/bin/ccache /usr/local/bin/cc
-RUN ln -s /usr/bin/ccache /usr/local/bin/c++
-RUN ln -s /usr/bin/ccache /usr/local/bin/clang
-RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
-
-##################
-# C++ dependencies
-RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang
-
-#################
-# C# dependencies
-
-# Update to a newer version of mono
-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
-RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list
-RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list
-RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list
-RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list
-
-# Install dependencies
-RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \
- mono-devel \
- nunit \
- nunit-console \
- monodevelop
-
-# Download NuGet
-RUN cd /var/local && wget www.nuget.org/NuGet.exe
-ENV NUGET mono /var/local/NuGet.exe
-
-# TODO(jtattermusch): add dependencies for other languages
-
-##################
-# Node dependencies
-
-# Install nvm
-RUN touch .profile
-RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
-RUN /bin/bash -l -c "nvm install 0.12 && npm config set cache /tmp/npm-cache"
-
-##################
-# Ruby dependencies
-
-# Install rvm
-RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
-RUN \curl -sSL https://get.rvm.io | bash -s stable
-
-# Install Ruby 2.1
-RUN /bin/bash -l -c "rvm install ruby-2.1"
-RUN /bin/bash -l -c "rvm use --default ruby-2.1"
-RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
-RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
-RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc"
-RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
-
-##################
-# Python dependencies
-
-# Install dependencies
-
-RUN apt-get update && apt-get install -y \
- python-all-dev \
- python3-all-dev \
- python-pip
-
-# Install Python packages from PyPI
-RUN pip install pip --upgrade
-RUN pip install virtualenv
-RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2 tox
-
-# For sanity test
-RUN pip install simplejson mako
-
-##################
-# PHP dependencies
-
-# Install dependencies
-
-RUN /bin/bash -l -c "echo 'deb http://packages.dotdeb.org wheezy-php55 all' \
- >> /etc/apt/sources.list.d/dotdeb.list"
-RUN /bin/bash -l -c "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 -
-
-RUN apt-get update && apt-get install -y \
- git php5 php5-dev phpunit unzip
-
-##################
-# Zookeeper dependencies
-
-# Install dependencies
-
-RUN apt-get install -y libzookeeper-mt-dev
-
-##################
-# Docker "inception".
-# Note this is quite the ugly hack.
-# This makes sure that the docker binary we inject has its dependencies.
-RUN curl https://get.docker.com/ | sh
-RUN apt-get remove --purge -y docker-engine
-
-RUN mkdir /var/local/jenkins
-
-# Define the default command.
-CMD ["bash"]
diff --git a/tools/run_tests/check_submodules.sh b/tools/dockerfile/grpc_sanity/Dockerfile
old mode 100755
new mode 100644
similarity index 62%
copy from tools/run_tests/check_submodules.sh
copy to tools/dockerfile/grpc_sanity/Dockerfile
index b4ca4fa..6f7797d
--- a/tools/run_tests/check_submodules.sh
+++ b/tools/dockerfile/grpc_sanity/Dockerfile
@@ -1,5 +1,3 @@
-#!/bin/sh
-
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
@@ -29,26 +27,53 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Dockerfile for running gRPC sanity tests
-set -e
+FROM debian:jessie
-export TEST=true
+# Install Git and basic packages.
+RUN apt-get update && apt-get install -y \
+ autoconf \
+ autotools-dev \
+ build-essential \
+ bzip2 \
+ ccache \
+ curl \
+ gcc \
+ gcc-multilib \
+ git \
+ golang \
+ gyp \
+ lcov \
+ libc6 \
+ libc6-dbg \
+ libc6-dev \
+ libgtest-dev \
+ libtool \
+ make \
+ perl \
+ strace \
+ python-dev \
+ python-setuptools \
+ python-yaml \
+ telnet \
+ unzip \
+ wget \
+ zip && apt-get clean
-cd `dirname $0`/../..
+##################
+# Sanity test dependencies
+RUN apt-get update && apt-get install -y python-pip
+RUN pip install simplejson mako
-submodules=`mktemp /tmp/submXXXXXX`
-want_submodules=`mktemp /tmp/submXXXXXX`
+##################
+# Docker "inception".
+# Note this is quite the ugly hack.
+# This makes sure that the docker binary we inject has its dependencies.
+RUN curl https://get.docker.com/ | sh
+RUN apt-get remove --purge -y docker-engine
-git submodule | awk '{ print $1 }' | sort > $submodules
-cat << EOF | awk '{ print $1 }' | sort > $want_submodules
- 9f897b25800d2f54f5c442ef01a60721aeca6d87 third_party/boringssl (version_for_cocoapods_1.0-67-g9f897b2)
- 05b155ff59114735ec8cd089f669c4c3d8f59029 third_party/gflags (v2.1.0-45-g05b155f)
- c99458533a9b4c743ed51537e25989ea55944908 third_party/googletest (release-1.7.0)
- d5fb408ddc281ffcadeb08699e65bb694656d0bd third_party/protobuf (v3.0.0-beta-2)
- 50893291621658f355bc5b4d450a8d06a563053d third_party/zlib (v1.2.8)
-EOF
+RUN mkdir /var/local/jenkins
-diff -u $submodules $want_submodules
-
-rm $submodules $want_submodules
-
+# Define the default command.
+CMD ["bash"]
diff --git a/tools/dockerfile/grpc_jenkins_slave_x86/Dockerfile b/tools/dockerfile/grpc_tests_multilang_x64/Dockerfile
similarity index 93%
copy from tools/dockerfile/grpc_jenkins_slave_x86/Dockerfile
copy to tools/dockerfile/grpc_tests_multilang_x64/Dockerfile
index 2323f23..7785f3d 100644
--- a/tools/dockerfile/grpc_jenkins_slave_x86/Dockerfile
+++ b/tools/dockerfile/grpc_tests_multilang_x64/Dockerfile
@@ -27,10 +27,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# A work-in-progress Dockerfile that allows running gRPC test suites
-# inside a docker container.
+# Dockerfile for running gRPC test suites inside a docker container.
-FROM 32bit/debian:jessie
+FROM debian:jessie
# Install Git and basic packages.
RUN apt-get update && apt-get install -y \
@@ -95,8 +94,6 @@
RUN cd /var/local && wget www.nuget.org/NuGet.exe
ENV NUGET mono /var/local/NuGet.exe
-# TODO(jtattermusch): add dependencies for other languages
-
##################
# Node dependencies
@@ -128,11 +125,12 @@
RUN apt-get update && apt-get install -y \
python-all-dev \
python3-all-dev \
- python-pip \
- python-virtualenv
+ python-pip
# Install Python packages from PyPI
-RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2
+RUN pip install pip --upgrade
+RUN pip install virtualenv
+RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2 tox
# For sanity test
RUN pip install simplejson mako
@@ -153,12 +151,8 @@
##################
# Zookeeper dependencies
-
-# Install dependencies
-
RUN apt-get install -y libzookeeper-mt-dev
-
RUN mkdir /var/local/jenkins
# Define the default command.
diff --git a/tools/dockerfile/grpc_jenkins_slave_x86/Dockerfile b/tools/dockerfile/grpc_tests_multilang_x86/Dockerfile
similarity index 96%
rename from tools/dockerfile/grpc_jenkins_slave_x86/Dockerfile
rename to tools/dockerfile/grpc_tests_multilang_x86/Dockerfile
index 2323f23..c5cd45e 100644
--- a/tools/dockerfile/grpc_jenkins_slave_x86/Dockerfile
+++ b/tools/dockerfile/grpc_tests_multilang_x86/Dockerfile
@@ -27,8 +27,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# A work-in-progress Dockerfile that allows running gRPC test suites
-# inside a docker container.
+# Dockerfile for running gRPC test suites inside a docker container.
FROM 32bit/debian:jessie
@@ -95,8 +94,6 @@
RUN cd /var/local && wget www.nuget.org/NuGet.exe
ENV NUGET mono /var/local/NuGet.exe
-# TODO(jtattermusch): add dependencies for other languages
-
##################
# Node dependencies
@@ -153,9 +150,6 @@
##################
# Zookeeper dependencies
-
-# Install dependencies
-
RUN apt-get install -y libzookeeper-mt-dev
diff --git a/tools/jenkins/docker_run_tests.sh b/tools/jenkins/docker_run_tests.sh
index 148a0f5..26e5585 100755
--- a/tools/jenkins/docker_run_tests.sh
+++ b/tools/jenkins/docker_run_tests.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -43,8 +43,12 @@
mkdir -p /var/local/git
git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc
-nvm use 0.12
-rvm use ruby-2.1
+nvm use 0.12 || true
+
+if [ -x "$(command -v rvm)" ]
+then
+ rvm use ruby-2.1
+fi
mkdir -p reports
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index c8f5d6f..fa4a37a 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -183,6 +183,9 @@
def supports_multi_config(self):
return True
+ def dockerfile_dir(self, config, arch):
+ return None
+
def __str__(self):
return self.make_target
@@ -215,6 +218,9 @@
def supports_multi_config(self):
return False
+ def dockerfile_dir(self, config, arch):
+ return None
+
def __str__(self):
return 'node'
@@ -246,6 +252,9 @@
def supports_multi_config(self):
return False
+ def dockerfile_dir(self, config, arch):
+ return None
+
def __str__(self):
return 'php'
@@ -299,6 +308,9 @@
def supports_multi_config(self):
return False
+ def dockerfile_dir(self, config, arch):
+ return None
+
def __str__(self):
return 'python'
@@ -330,6 +342,9 @@
def supports_multi_config(self):
return False
+ def dockerfile_dir(self, config, arch):
+ return None
+
def __str__(self):
return 'ruby'
@@ -412,6 +427,9 @@
def supports_multi_config(self):
return False
+ def dockerfile_dir(self, config, arch):
+ return None
+
def __str__(self):
return 'csharp'
@@ -443,6 +461,9 @@
def supports_multi_config(self):
return False
+ def dockerfile_dir(self, config, arch):
+ return None
+
def __str__(self):
return 'objc'
@@ -451,8 +472,10 @@
def test_specs(self, config, args):
import yaml
- with open('tools/run_tests/sanity_tests.yaml', 'r') as f:
- return [config.job_spec(cmd['script'].split(), None, timeout_seconds=None, environ={'TEST': 'true'}, cpu_cost=cmd.get('cpu_cost', 1))
+ with open('tools/run_tests/sanity/sanity_tests.yaml', 'r') as f:
+ return [config.job_spec(cmd['script'].split(), None,
+ timeout_seconds=None, environ={'TEST': 'true'},
+ cpu_cost=cmd.get('cpu_cost', 1))
for cmd in yaml.load(f)]
def pre_build_steps(self):
@@ -476,6 +499,9 @@
def supports_multi_config(self):
return False
+ def dockerfile_dir(self, config, arch):
+ return 'tools/dockerfile/grpc_sanity'
+
def __str__(self):
return 'sanity'
@@ -506,6 +532,9 @@
def supports_multi_config(self):
return True
+ def dockerfile_dir(self, config, arch):
+ return None
+
def __str__(self):
return self.make_target
@@ -545,7 +574,7 @@
else:
print 'Architecture %s not supported.' % arch
sys.exit(1)
-
+
def _check_arch_option(arch):
"""Checks that architecture option is valid."""
@@ -595,15 +624,19 @@
sys.exit(1)
-def _get_dockerfile_dir(arch):
+def _get_dockerfile_dir(language, cfg, arch):
"""Returns dockerfile to use"""
- if arch == 'default' or arch == 'x64':
- return 'tools/dockerfile/grpc_jenkins_slave_x64'
- elif arch == 'x86':
- return 'tools/dockerfile/grpc_jenkins_slave_x86'
+ custom = language.dockerfile_dir(cfg, arch)
+ if custom:
+ return custom
else:
- print 'Architecture %s not supported with current settings.' % arch
- sys.exit(1)
+ if arch == 'default' or arch == 'x64':
+ return 'tools/dockerfile/grpc_tests_multilang_x64'
+ elif arch == 'x86':
+ return 'tools/dockerfile/grpc_tests_multilang_x86'
+ else:
+ print 'Architecture %s not supported with current settings.' % arch
+ sys.exit(1)
def runs_per_test_type(arg_str):
"""Auxilary function to parse the "runs_per_test" flag.
@@ -771,11 +804,13 @@
time.sleep(5)
child_argv = [ arg for arg in sys.argv if not arg == '--use_docker' ]
- run_tests_cmd = 'tools/run_tests/run_tests.py %s' % ' '.join(child_argv[1:])
+ run_tests_cmd = 'python tools/run_tests/run_tests.py %s' % ' '.join(child_argv[1:])
env = os.environ.copy()
env['RUN_TESTS_COMMAND'] = run_tests_cmd
- env['DOCKERFILE_DIR'] = _get_dockerfile_dir(args.arch)
+ env['DOCKERFILE_DIR'] = _get_dockerfile_dir(next(iter(languages)),
+ next(iter(build_configs)),
+ args.arch)
env['DOCKER_RUN_SCRIPT'] = 'tools/jenkins/docker_run_tests.sh'
if args.xml_report:
env['XML_REPORT'] = args.xml_report
@@ -786,7 +821,7 @@
shell=True,
env=env)
sys.exit(0)
-
+
if platform_string() != 'windows' and args.compiler != 'default':
print 'Compiler %s not supported on current platform.' % args.compiler
sys.exit(1)
diff --git a/tools/run_tests/check_cache_mk.sh b/tools/run_tests/sanity/check_cache_mk.sh
similarity index 100%
rename from tools/run_tests/check_cache_mk.sh
rename to tools/run_tests/sanity/check_cache_mk.sh
diff --git a/tools/run_tests/check_sources_and_headers.py b/tools/run_tests/sanity/check_sources_and_headers.py
similarity index 66%
rename from tools/run_tests/check_sources_and_headers.py
rename to tools/run_tests/sanity/check_sources_and_headers.py
index 50574f4..3974af0 100755
--- a/tools/run_tests/check_sources_and_headers.py
+++ b/tools/run_tests/sanity/check_sources_and_headers.py
@@ -33,9 +33,9 @@
import re
import sys
-root = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../..'))
+root = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../../..'))
with open(os.path.join(root, 'tools', 'run_tests', 'sources_and_headers.json')) as f:
- js = json.loads(f.read())
+ js = json.loads(f.read())
re_inc1 = re.compile(r'^#\s*include\s*"([^"]*)"')
assert re_inc1.match('#include "foo"').group(1) == 'foo'
@@ -43,41 +43,41 @@
assert re_inc2.match('#include <grpc++/foo>').group(1) == 'grpc++/foo'
def get_target(name):
- for target in js:
- if target['name'] == name:
- return target
- assert False, 'no target %s' % name
+ for target in js:
+ if target['name'] == name:
+ return target
+ assert False, 'no target %s' % name
def target_has_header(target, name):
-# print target['name'], name
- if name in target['headers']:
- return True
- for dep in target['deps']:
- if target_has_header(get_target(dep), name):
- return True
- if name == 'src/core/profiling/stap_probes.h':
- return True
- return False
+ # print target['name'], name
+ if name in target['headers']:
+ return True
+ for dep in target['deps']:
+ if target_has_header(get_target(dep), name):
+ return True
+ if name == 'src/core/profiling/stap_probes.h':
+ return True
+ return False
errors = 0
for target in js:
- for fn in target['src']:
- with open(os.path.join(root, fn)) as f:
- src = f.read().splitlines()
- for line in src:
- m = re_inc1.match(line)
- if m:
- if not target_has_header(target, m.group(1)):
- print (
- 'target %s (%s) does not name header %s as a dependency' % (
- target['name'], fn, m.group(1)))
- errors += 1
- m = re_inc2.match(line)
- if m:
- if not target_has_header(target, 'include/' + m.group(1)):
- print (
- 'target %s (%s) does not name header %s as a dependency' % (
- target['name'], fn, m.group(1)))
- errors += 1
+ for fn in target['src']:
+ with open(os.path.join(root, fn)) as f:
+ src = f.read().splitlines()
+ for line in src:
+ m = re_inc1.match(line)
+ if m:
+ if not target_has_header(target, m.group(1)):
+ print (
+ 'target %s (%s) does not name header %s as a dependency' % (
+ target['name'], fn, m.group(1)))
+ errors += 1
+ m = re_inc2.match(line)
+ if m:
+ if not target_has_header(target, 'include/' + m.group(1)):
+ print (
+ 'target %s (%s) does not name header %s as a dependency' % (
+ target['name'], fn, m.group(1)))
+ errors += 1
assert errors == 0
diff --git a/tools/run_tests/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh
similarity index 98%
rename from tools/run_tests/check_submodules.sh
rename to tools/run_tests/sanity/check_submodules.sh
index b4ca4fa..f49230e 100755
--- a/tools/run_tests/check_submodules.sh
+++ b/tools/run_tests/sanity/check_submodules.sh
@@ -34,7 +34,7 @@
export TEST=true
-cd `dirname $0`/../..
+cd `dirname $0`/../../..
submodules=`mktemp /tmp/submXXXXXX`
want_submodules=`mktemp /tmp/submXXXXXX`
diff --git a/tools/run_tests/sanity_tests.yaml b/tools/run_tests/sanity/sanity_tests.yaml
similarity index 61%
rename from tools/run_tests/sanity_tests.yaml
rename to tools/run_tests/sanity/sanity_tests.yaml
index 757bcd9..809e6ce 100644
--- a/tools/run_tests/sanity_tests.yaml
+++ b/tools/run_tests/sanity/sanity_tests.yaml
@@ -1,7 +1,7 @@
# a set of tests that are run in parallel for sanity tests
-- script: tools/run_tests/check_sources_and_headers.py
-- script: tools/run_tests/check_submodules.sh
-- script: tools/run_tests/check_cache_mk.sh
+- script: tools/run_tests/sanity/check_sources_and_headers.py
+- script: tools/run_tests/sanity/check_submodules.sh
+- script: tools/run_tests/sanity/check_cache_mk.sh
- script: tools/buildgen/generate_projects.sh -j 3
cpu_cost: 3
- script: tools/distrib/check_copyright.py