cleanup sanity tests

pull/4906/head
Jan Tattermusch 9 years ago
parent 06300f7b5d
commit 788ee23ab3
  1. 2
      tools/dockerfile/grpc_jenkins_slave_x64/Dockerfile
  2. 2
      tools/dockerfile/grpc_jenkins_slave_x86/Dockerfile
  3. 92
      tools/dockerfile/grpc_sanity/Dockerfile
  4. 10
      tools/jenkins/docker_run_tests.sh
  5. 59
      tools/run_tests/run_tests.py
  6. 0
      tools/run_tests/sanity/check_cache_mk.sh
  7. 66
      tools/run_tests/sanity/check_sources_and_headers.py
  8. 2
      tools/run_tests/sanity/check_submodules.sh
  9. 6
      tools/run_tests/sanity/sanity_tests.yaml

@ -95,8 +95,6 @@ RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \
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

@ -95,8 +95,6 @@ RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \
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

@ -0,0 +1,92 @@
# 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
##################
# Sanity test dependencies
RUN apt-get update && apt-get install -y python-pip
RUN pip install simplejson mako
##################
# 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"]

@ -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 @@ chown `whoami` $XDG_CACHE_HOME
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

@ -183,6 +183,9 @@ class CLanguage(object):
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 @@ class NodeLanguage(object):
def supports_multi_config(self):
return False
def dockerfile_dir(self, config, arch):
return None
def __str__(self):
return 'node'
@ -246,6 +252,9 @@ class PhpLanguage(object):
def supports_multi_config(self):
return False
def dockerfile_dir(self, config, arch):
return None
def __str__(self):
return 'php'
@ -299,6 +308,9 @@ class PythonLanguage(object):
def supports_multi_config(self):
return False
def dockerfile_dir(self, config, arch):
return None
def __str__(self):
return 'python'
@ -330,6 +342,9 @@ class RubyLanguage(object):
def supports_multi_config(self):
return False
def dockerfile_dir(self, config, arch):
return None
def __str__(self):
return 'ruby'
@ -412,6 +427,9 @@ class CSharpLanguage(object):
def supports_multi_config(self):
return False
def dockerfile_dir(self, config, arch):
return None
def __str__(self):
return 'csharp'
@ -443,6 +461,9 @@ class ObjCLanguage(object):
def supports_multi_config(self):
return False
def dockerfile_dir(self, config, arch):
return None
def __str__(self):
return 'objc'
@ -451,8 +472,10 @@ class Sanity(object):
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 @@ class Sanity(object):
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 @@ class Build(object):
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 @@ def _windows_arch_option(arch):
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 @@ def _windows_toolset_option(compiler):
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_jenkins_slave_x64'
elif arch == 'x86':
return 'tools/dockerfile/grpc_jenkins_slave_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.
@ -775,7 +808,9 @@ if args.use_docker:
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 @@ if args.use_docker:
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)

@ -33,9 +33,9 @@ import os
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 @@ re_inc2 = re.compile(r'^#\s*include\s*<((grpc|grpc\+\+)/[^"]*)>')
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

@ -34,7 +34,7 @@ set -e
export TEST=true
cd `dirname $0`/../..
cd `dirname $0`/../../..
submodules=`mktemp /tmp/submXXXXXX`
want_submodules=`mktemp /tmp/submXXXXXX`

@ -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
Loading…
Cancel
Save