Merge pull request #23717 from jtattermusch/run_tests_using_cmake2

Use cmake for C/C++ build in run_tests.py
pull/23665/head
Jan Tattermusch 5 years ago committed by GitHub
commit 1a37d291ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      templates/tools/dockerfile/cmake.include
  2. 1
      templates/tools/dockerfile/test/cxx_buster_x64/Dockerfile.template
  3. 32
      templates/tools/dockerfile/test/cxx_sanitizers_jessie_x64/Dockerfile.template
  4. 25
      templates/tools/dockerfile/test/cxx_ubuntu1404_x64/Dockerfile.template
  5. 1
      templates/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile.template
  6. 1
      templates/tools/dockerfile/test/cxx_ubuntu1804_x64/Dockerfile.template
  7. 2
      tools/buildgen/plugins/make_fuzzer_tests.py
  8. 6
      tools/dockerfile/test/cxx_buster_x64/Dockerfile
  9. 81
      tools/dockerfile/test/cxx_sanitizers_jessie_x64/Dockerfile
  10. 79
      tools/dockerfile/test/cxx_ubuntu1404_x64/Dockerfile
  11. 6
      tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile
  12. 6
      tools/dockerfile/test/cxx_ubuntu1804_x64/Dockerfile
  13. 5676
      tools/run_tests/generated/tests.json
  14. 5
      tools/run_tests/helper_scripts/pre_build_cmake.bat
  15. 2
      tools/run_tests/helper_scripts/pre_build_cmake.sh
  16. 147
      tools/run_tests/run_tests.py
  17. 24
      tools/run_tests/run_tests_matrix.py

@ -0,0 +1,5 @@
#=================
# Install cmake
# Note that this step should be only used for distributions that have new enough cmake to satisfy gRPC's cmake version requirement.
RUN apt-get update && apt-get install -y cmake && apt-get clean

@ -20,6 +20,7 @@
<%include file="../../python_deps.include"/>
<%include file="../../gcp_api_libraries.include"/>
<%include file="../../cxx_deps.include"/>
<%include file="../../cmake.include"/>
<%include file="../../run_tests_addons.include"/>
# Define the default command.

@ -1,32 +0,0 @@
%YAML 1.2
--- |
# Copyright 2018 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This is the base Docker image we use for running tests on RBE
FROM gcr.io/cloud-marketplace/google/rbe-debian8@sha256:1ede2a929b44d629ec5abe86eee6d7ffea1d5a4d247489a8867d46cfde3e38bd
RUN sed -i '/deb http:\/\/httpredir.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
<%include file="../../apt_get_basic.include"/>
<%include file="../../python_deps.include"/>
<%include file="../../gcp_api_libraries.include"/>
#=================
# C++ dependencies (purposely excluding Clang because it's part of the base image)
RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev && apt-get clean
# Link llvm-symbolizer to where our test scripts expect to find it
RUN ln -s /usr/local/bin/llvm-symbolizer /usr/bin/llvm-symbolizer
# Define the default command.
CMD ["bash"]

@ -1,25 +0,0 @@
%YAML 1.2
--- |
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:14.04
<%include file="../../apt_get_basic.include"/>
<%include file="../../python_deps.include"/>
<%include file="../../gcp_api_libraries.include"/>
<%include file="../../cxx_deps.include"/>
<%include file="../../run_tests_addons.include"/>
# Define the default command.
CMD ["bash"]

@ -20,6 +20,7 @@
<%include file="../../python_deps.include"/>
<%include file="../../gcp_api_libraries.include"/>
<%include file="../../cxx_deps.include"/>
<%include file="../../cmake.include"/>
<%include file="../../run_tests_addons.include"/>
# The clang-3.6 symlink for the default clang version was added

@ -20,6 +20,7 @@
<%include file="../../python_deps.include"/>
<%include file="../../gcp_api_libraries.include"/>
<%include file="../../cxx_deps.include"/>
<%include file="../../cmake.include"/>
<%include file="../../run_tests_addons.include"/>
# Define the default command.

@ -50,6 +50,6 @@ def mako_plugin(dictionary):
'platforms': ['mac', 'linux'],
'ci_platforms': ['linux'],
'flaky': False,
'language': 'c',
'language': 'c++',
'cpu_cost': 0.1,
})

@ -72,6 +72,12 @@ RUN pip install --upgrade google-api-python-client oauth2client
# C++ dependencies
RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang && apt-get clean
#=================
# Install cmake
# Note that this step should be only used for distributions that have new enough cmake to satisfy gRPC's cmake version requirement.
RUN apt-get update && apt-get install -y cmake && apt-get clean
RUN mkdir /var/local/jenkins

@ -1,81 +0,0 @@
# Copyright 2018 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This is the base Docker image we use for running tests on RBE
FROM gcr.io/cloud-marketplace/google/rbe-debian8@sha256:1ede2a929b44d629ec5abe86eee6d7ffea1d5a4d247489a8867d46cfde3e38bd
RUN sed -i '/deb http:\/\/httpredir.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
# Install Git and basic packages.
RUN apt-get update && apt-get install -y \
autoconf \
autotools-dev \
build-essential \
bzip2 \
ccache \
curl \
dnsutils \
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
#================
# Build profiling
RUN apt-get update && apt-get install -y time && apt-get clean
#====================
# Python dependencies
# Install dependencies
RUN apt-get update && apt-get install -y \
python-all-dev \
python3-all-dev \
python-setuptools
# Install Python packages from PyPI
RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7
RUN pip install --upgrade pip==19.3.1
RUN pip install virtualenv==16.7.9
RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 twisted==17.5.0
# Google Cloud platform API libraries
RUN pip install --upgrade google-api-python-client oauth2client
#=================
# C++ dependencies (purposely excluding Clang because it's part of the base image)
RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev && apt-get clean
# Link llvm-symbolizer to where our test scripts expect to find it
RUN ln -s /usr/local/bin/llvm-symbolizer /usr/bin/llvm-symbolizer
# Define the default command.
CMD ["bash"]

@ -1,79 +0,0 @@
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:14.04
# Install Git and basic packages.
RUN apt-get update && apt-get install -y \
autoconf \
autotools-dev \
build-essential \
bzip2 \
ccache \
curl \
dnsutils \
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
#================
# Build profiling
RUN apt-get update && apt-get install -y time && apt-get clean
#====================
# Python dependencies
# Install dependencies
RUN apt-get update && apt-get install -y \
python-all-dev \
python3-all-dev \
python-setuptools
# Install Python packages from PyPI
RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7
RUN pip install --upgrade pip==19.3.1
RUN pip install virtualenv==16.7.9
RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 twisted==17.5.0
# Google Cloud platform API libraries
RUN pip install --upgrade google-api-python-client oauth2client
#=================
# C++ dependencies
RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang && apt-get clean
RUN mkdir /var/local/jenkins
# Define the default command.
CMD ["bash"]

@ -72,6 +72,12 @@ RUN pip install --upgrade google-api-python-client oauth2client
# C++ dependencies
RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang && apt-get clean
#=================
# Install cmake
# Note that this step should be only used for distributions that have new enough cmake to satisfy gRPC's cmake version requirement.
RUN apt-get update && apt-get install -y cmake && apt-get clean
RUN mkdir /var/local/jenkins

@ -72,6 +72,12 @@ RUN pip install --upgrade google-api-python-client oauth2client
# C++ dependencies
RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang && apt-get clean
#=================
# Install cmake
# Note that this step should be only used for distributions that have new enough cmake to satisfy gRPC's cmake version requirement.
RUN apt-get update && apt-get install -y cmake && apt-get clean
RUN mkdir /var/local/jenkins

File diff suppressed because it is too large Load Diff

@ -14,9 +14,6 @@
setlocal
set GENERATOR=%1
set ARCHITECTURE=%2
cd /d %~dp0\..\..\..
mkdir cmake
@ -24,7 +21,7 @@ cd cmake
mkdir build
cd build
cmake -G %GENERATOR% -A %ARCHITECTURE% -DgRPC_BUILD_TESTS=ON ../.. || goto :error
cmake -DgRPC_BUILD_TESTS=ON %* ../.. || goto :error
endlocal

@ -21,4 +21,4 @@ mkdir -p cmake/build
cd cmake/build
# MSBUILD_CONFIG's values are suitable for cmake as well
cmake -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE="${MSBUILD_CONFIG}" ../..
cmake -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE="${MSBUILD_CONFIG}" "$@" ../..

@ -65,41 +65,6 @@ _POLLING_STRATEGIES = {
'mac': ['poll'],
}
BigQueryTestData = collections.namedtuple('BigQueryTestData', 'name flaky cpu')
def get_bqtest_data(limit=None):
import big_query_utils
bq = big_query_utils.create_big_query()
query = """
SELECT
filtered_test_name,
SUM(result != 'PASSED' AND result != 'SKIPPED') > 0 as flaky,
MAX(cpu_measured) + 0.01 as cpu
FROM (
SELECT
REGEXP_REPLACE(test_name, r'/\d+', '') AS filtered_test_name,
result, cpu_measured
FROM
[grpc-testing:jenkins_test_results.aggregate_results]
WHERE
timestamp >= DATE_ADD(CURRENT_DATE(), -1, "WEEK")
AND platform = '""" + platform_string() + """'
AND NOT REGEXP_MATCH(job_name, '.*portability.*') )
GROUP BY
filtered_test_name"""
if limit:
query += " limit {}".format(limit)
query_job = big_query_utils.sync_query_job(bq, 'grpc-testing', query)
page = bq.jobs().getQueryResults(
pageToken=None, **query_job['jobReference']).execute(num_retries=3)
test_data = [
BigQueryTestData(row['f'][0]['v'], row['f'][1]['v'] == 'true',
float(row['f'][2]['v'])) for row in page['rows']
]
return test_data
def platform_string():
return jobset.platform_string()
@ -272,24 +237,34 @@ class CLanguage(object):
def configure(self, config, args):
self.config = config
self.args = args
self._make_options = []
self._use_cmake = True
if self.platform == 'windows':
_check_compiler(
self.args.compiler,
['default', 'cmake', 'cmake_vs2015', 'cmake_vs2017'])
_check_arch(self.args.arch, ['default', 'x64', 'x86'])
self._cmake_generator_option = 'Visual Studio 15 2017' if self.args.compiler == 'cmake_vs2017' else 'Visual Studio 14 2015'
self._cmake_arch_option = 'x64' if self.args.arch == 'x64' else 'Win32'
self._use_cmake = True
self._make_options = []
elif self.args.compiler == 'cmake':
_check_arch(self.args.arch, ['default'])
self._use_cmake = True
self._docker_distro = 'jessie'
self._make_options = []
cmake_generator_option = 'Visual Studio 15 2017' if self.args.compiler == 'cmake_vs2017' else 'Visual Studio 14 2015'
cmake_arch_option = 'x64' if self.args.arch == 'x64' else 'Win32'
self._cmake_configure_extra_args = [
'-G', cmake_generator_option, '-A', cmake_arch_option
]
else:
self._use_cmake = False
self._docker_distro, self._make_options = self._compiler_options(
if self.platform == 'linux':
# Allow all the known architectures. _check_arch_option has already checked that we're not doing
# something illegal when not running under docker.
_check_arch(self.args.arch, ['default', 'x64', 'x86'])
else:
_check_arch(self.args.arch, ['default'])
self._docker_distro, self._cmake_configure_extra_args = self._compiler_options(
self.args.use_docker, self.args.compiler)
if self.args.arch == 'x86':
# disable boringssl asm optimizations when on x86
# see https://github.com/grpc/grpc/blob/b5b8578b3f8b4a9ce61ed6677e19d546e43c5c68/tools/run_tests/artifacts/artifact_targets.py#L253
self._cmake_configure_extra_args.append('-DOPENSSL_NO_ASM=ON')
if args.iomgr_platform == "uv":
cflags = '-DGRPC_UV -DGRPC_CUSTOM_IOMGR_THREAD_CHECK -DGRPC_CUSTOM_SOCKET '
try:
@ -457,12 +432,11 @@ class CLanguage(object):
def pre_build_steps(self):
if self.platform == 'windows':
return [[
'tools\\run_tests\\helper_scripts\\pre_build_cmake.bat',
self._cmake_generator_option, self._cmake_arch_option
]]
return [['tools\\run_tests\\helper_scripts\\pre_build_cmake.bat'] +
self._cmake_configure_extra_args]
elif self._use_cmake:
return [['tools/run_tests/helper_scripts/pre_build_cmake.sh']]
return [['tools/run_tests/helper_scripts/pre_build_cmake.sh'] +
self._cmake_configure_extra_args]
else:
return []
@ -481,36 +455,20 @@ class CLanguage(object):
else:
return 'Makefile'
def _clang_make_options(self, version_suffix=''):
if self.args.config == 'ubsan':
return [
'CC=clang%s' % version_suffix,
'CXX=clang++%s' % version_suffix,
'LD=clang++%s' % version_suffix,
'LDXX=clang++%s' % version_suffix
]
return [
'CC=clang%s' % version_suffix,
'CXX=clang++%s' % version_suffix,
'LD=clang%s' % version_suffix,
'LDXX=clang++%s' % version_suffix
]
def _gcc_make_options(self, version_suffix):
def _clang_cmake_configure_extra_args(self, version_suffix=''):
return [
'CC=gcc%s' % version_suffix,
'CXX=g++%s' % version_suffix,
'LD=gcc%s' % version_suffix,
'LDXX=g++%s' % version_suffix
'-DCMAKE_C_COMPILER=clang%s' % version_suffix,
'-DCMAKE_CXX_COMPILER=clang++%s' % version_suffix,
]
def _compiler_options(self, use_docker, compiler):
"""Returns docker distro and make options to use for given compiler."""
"""Returns docker distro and cmake configure args to use for given compiler."""
if not use_docker and not _is_use_docker_child():
_check_compiler(compiler, ['default'])
# if not running under docker, we cannot ensure the right compiler version will be used,
# so we only allow the non-specific choices.
_check_compiler(compiler, ['default', 'cmake'])
if compiler == 'gcc4.9' or compiler == 'default':
if compiler == 'gcc4.9' or compiler == 'default' or compiler == 'cmake':
return ('jessie', [])
elif compiler == 'gcc5.3':
return ('ubuntu1604', [])
@ -520,21 +478,14 @@ class CLanguage(object):
return ('buster', [])
elif compiler == 'gcc_musl':
return ('alpine', [])
elif compiler == 'clang3.4':
# on ubuntu1404, clang-3.4 alias doesn't exist, just use 'clang'
return ('ubuntu1404', self._clang_make_options())
elif compiler == 'clang3.5':
return ('jessie', self._clang_make_options(version_suffix='-3.5'))
elif compiler == 'clang3.6':
return ('ubuntu1604',
self._clang_make_options(version_suffix='-3.6'))
self._clang_cmake_configure_extra_args(
version_suffix='-3.6'))
elif compiler == 'clang3.7':
return ('ubuntu1604',
self._clang_make_options(version_suffix='-3.7'))
elif compiler == 'clang7.0':
# clang++-7.0 alias doesn't exist and there are no other clang versions
# installed.
return ('sanitizers_jessie', self._clang_make_options())
self._clang_cmake_configure_extra_args(
version_suffix='-3.7'))
else:
raise Exception('Compiler %s not supported.' % compiler)
@ -1496,10 +1447,10 @@ argp.add_argument(
'--compiler',
choices=[
'default', 'gcc4.9', 'gcc5.3', 'gcc7.4', 'gcc8.3', 'gcc_musl',
'clang3.4', 'clang3.5', 'clang3.6', 'clang3.7', 'clang7.0', 'python2.7',
'python3.5', 'python3.6', 'python3.7', 'python3.8', 'pypy', 'pypy3',
'python_alpine', 'all_the_cpythons', 'electron1.3', 'electron1.6',
'coreclr', 'cmake', 'cmake_vs2015', 'cmake_vs2017'
'clang3.6', 'clang3.7', 'python2.7', 'python3.5', 'python3.6',
'python3.7', 'python3.8', 'pypy', 'pypy3', 'python_alpine',
'all_the_cpythons', 'electron1.3', 'electron1.6', 'coreclr', 'cmake',
'cmake_vs2015', 'cmake_vs2017'
],
default='default',
help=
@ -1575,26 +1526,10 @@ argp.add_argument('--bq_result_table',
type=str,
nargs='?',
help='Upload test results to a specified BQ table.')
argp.add_argument(
'--auto_set_flakes',
default=False,
const=True,
action='store_const',
help=
'Allow repeated runs for tests that have been failing recently (based on BQ historical data).'
)
args = argp.parse_args()
flaky_tests = set()
shortname_to_cpu = {}
if args.auto_set_flakes:
try:
for test in get_bqtest_data():
if test.flaky: flaky_tests.add(test.name)
if test.cpu > 0: shortname_to_cpu[test.name] = test.cpu
except:
print("Unexpected error getting flaky tests: %s" %
traceback.format_exc())
if args.force_default_poller:
_POLLING_STRATEGIES = {}

@ -275,8 +275,8 @@ def _create_portability_test_jobs(extra_args=[],
# portability C and C++ on x64
for compiler in [
'gcc4.9', 'gcc5.3', 'gcc7.4', 'gcc8.3', 'gcc_musl', 'clang3.5',
'clang3.6', 'clang3.7', 'clang7.0'
'gcc4.9', 'gcc5.3', 'gcc7.4', 'gcc8.3', 'gcc_musl', 'clang3.6',
'clang3.7'
]:
test_jobs += _generate_jobs(languages=['c', 'c++'],
configs=['dbg'],
@ -339,26 +339,6 @@ def _create_portability_test_jobs(extra_args=[],
extra_args=extra_args,
timeout_seconds=_CPP_RUNTESTS_TIMEOUT)
# TODO(zyc): Turn on this test after adding c-ares support on windows.
# C with the c-ares DNS resolver on Windows
# test_jobs += _generate_jobs(languages=['c'],
# configs=['dbg'], platforms=['windows'],
# labels=['portability', 'corelang'],
# extra_args=extra_args,
# extra_envs={'GRPC_DNS_RESOLVER': 'ares'})
# C and C++ build with cmake on Linux
# TODO(jtattermusch): some of the tests are failing, so we force --build_only
# to make sure it's buildable at least.
test_jobs += _generate_jobs(languages=['c', 'c++'],
configs=['dbg'],
platforms=['linux'],
arch='default',
compiler='cmake',
labels=['portability', 'corelang'],
extra_args=extra_args + ['--build_only'],
inner_jobs=inner_jobs)
test_jobs += _generate_jobs(languages=['python'],
configs=['dbg'],
platforms=['linux'],

Loading…
Cancel
Save