aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-07-12 14:10:47 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-07-12 14:10:47 -0700
commit6f6f59ae4b480d809d3e7f8af2b1a0cc3801117b (patch)
treee85462ef455c9d1db6e55f126f2097ddba04c6db /tools/run_tests
parent3c945ee2b3c3bf0fd01cc995332e252d1e10e51e (diff)
parent6b8a8e4a74fc83153a6fd3fbb7ec1ed2b288b4b4 (diff)
Merge remote-tracking branch 'upstream/master' into filter_call_init_failure
Diffstat (limited to 'tools/run_tests')
-rw-r--r--tools/run_tests/build_artifact_python.bat48
-rwxr-xr-xtools/run_tests/build_python.sh171
-rw-r--r--tools/run_tests/build_python_msys2.sh36
-rwxr-xr-xtools/run_tests/jobset.py7
-rwxr-xr-xtools/run_tests/performance/run_worker_python.sh2
-rw-r--r--tools/run_tests/performance/scenario_config.py25
-rwxr-xr-xtools/run_tests/port_server.py9
-rwxr-xr-xtools/run_tests/run_interop_tests.py14
-rwxr-xr-xtools/run_tests/run_python.sh17
-rwxr-xr-xtools/run_tests/run_tests.py129
-rwxr-xr-xtools/run_tests/sanity/check_submodules.sh2
-rw-r--r--tools/run_tests/sources_and_headers.json29
-rw-r--r--tools/run_tests/tests.json21
13 files changed, 365 insertions, 145 deletions
diff --git a/tools/run_tests/build_artifact_python.bat b/tools/run_tests/build_artifact_python.bat
index 295347e947..7c8c2aa12d 100644
--- a/tools/run_tests/build_artifact_python.bat
+++ b/tools/run_tests/build_artifact_python.bat
@@ -28,33 +28,24 @@
@rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-set NUGET=C:\nuget\nuget.exe
-%NUGET% restore vsprojects\grpc.sln || goto :error
-
-
-@call vsprojects\build_vs2013.bat vsprojects\grpc.sln /t:grpc_dll /p:Configuration=Release /p:PlatformToolset=v120 /p:Platform=Win32 || goto :error
-@call vsprojects\build_vs2013.bat vsprojects\grpc.sln /t:grpc_dll /p:Configuration=Release /p:PlatformToolset=v120 /p:Platform=x64 || goto :error
-
-mkdir src\python\grpcio\grpc\_cython\_windows
-
-@rem TODO(atash): maybe we could avoid the grpc_c.(32|64).python shim below if
-@rem this used the right python build?
-copy /Y vsprojects\Release\grpc_dll.dll src\python\grpcio\grpc\_cython\_windows\grpc_c.32.python || goto :error
-copy /Y vsprojects\x64\Release\grpc_dll.dll src\python\grpcio\grpc\_cython\_windows\grpc_c.64.python || goto :error
-
set PATH=C:\%1;C:\%1\scripts;C:\msys64\mingw%2\bin;%PATH%
pip install --upgrade six
pip install --upgrade setuptools
pip install -rrequirements.txt
-set GRPC_PYTHON_USE_CUSTOM_BDIST=0
-set GRPC_PYTHON_BUILD_WITH_CYTHON=1
-
@rem Because this is windows and *everything seems to hate Windows* we have to
@rem set all of these flags ourselves because Python won't help us (see the
@rem setup.py of the grpcio_tools project).
set GRPC_PYTHON_CFLAGS=-fno-wrapv -frtti -std=c++11
+
+@rem See https://sourceforge.net/p/mingw-w64/bugs/363/
+if %2 == 32 (
+ set GRPC_PYTHON_CFLAGS=%GRPC_PYTHON_CFLAGS% -D_ftime=_ftime32 -D_timeb=__timeb32 -D_ftime_s=_ftime32_s
+) else (
+ set GRPC_PYTHON_CFLAGS=%GRPC_PYTHON_CFLAGS% -D_ftime=_ftime64 -D_timeb=__timeb64
+)
+
@rem Further confusing things, MSYS2's mingw64 tries to dynamically link
@rem libgcc, libstdc++, and winpthreads. We have to override this or our
@rem extensions end up linking to MSYS2 DLLs, which the normal Python on
@@ -66,23 +57,18 @@ python -c "from distutils.cygwinccompiler import get_msvcr; print(get_msvcr()[0]
set /p PYTHON_MSVCR=<temp.txt
set GRPC_PYTHON_LDFLAGS=-static-libgcc -static-libstdc++ -mcrtdll=%PYTHON_MSVCR% -static -lpthread
-
-@rem Build gRPC
-if %2 == 32 (
- python setup.py build_ext -c mingw32
-) else (
- python setup.py build_ext -c mingw32 -DMS_WIN64
-)
-python setup.py bdist_wheel
+set GRPC_PYTHON_BUILD_WITH_CYTHON=1
-@rem Build gRPC Python tools
+@rem Set up gRPC Python tools
python tools\distrib\python\make_grpcio_tools.py
-if %2 == 32 (
- python tools\distrib\python\grpcio_tools\setup.py build_ext -c mingw32
-) else (
- python tools\distrib\python\grpcio_tools\setup.py build_ext -c mingw32 -DMS_WIN64
-)
+
+@rem Build gRPC Python extensions
+python setup.py build_ext -c mingw32
+python tools\distrib\python\grpcio_tools\setup.py build_ext -c mingw32
+
+@rem Build gRPC Python distributions
+python setup.py bdist_wheel
python tools\distrib\python\grpcio_tools\setup.py bdist_wheel
mkdir artifacts
diff --git a/tools/run_tests/build_python.sh b/tools/run_tests/build_python.sh
index b1c90df824..a3fa8200d5 100755
--- a/tools/run_tests/build_python.sh
+++ b/tools/run_tests/build_python.sh
@@ -33,44 +33,151 @@ set -ex
# change to grpc repo root
cd $(dirname $0)/../..
-TOX_PYTHON_ENV="$1"
-PY_VERSION="${TOX_PYTHON_ENV: -2}"
+##########################
+# Portability operations #
+##########################
+
+PLATFORM=`uname -s`
+
+function is_mingw() {
+ if [ "${PLATFORM/MINGW}" != "$PLATFORM" ]; then
+ echo true
+ else
+ exit 1
+ fi
+}
+
+function is_darwin() {
+ if [ "${PLATFORM/Darwin}" != "$PLATFORM" ]; then
+ echo true
+ else
+ exit 1
+ fi
+}
+
+function is_linux() {
+ if [ "${PLATFORM/Linux}" != "$PLATFORM" ]; then
+ echo true
+ else
+ exit 1
+ fi
+}
+
+# Associated virtual environment name for the given python command.
+function venv() {
+ $1 -c "import sys; print('py{}{}'.format(*sys.version_info[:2]))"
+}
+
+# Path to python executable within a virtual environment depending on the
+# system.
+function venv_relative_python() {
+ if [ $(is_mingw) ]; then
+ echo 'Scripts/python.exe'
+ else
+ echo 'bin/python'
+ fi
+}
+
+# Distutils toolchain to use depending on the system.
+function toolchain() {
+ if [ $(is_mingw) ]; then
+ echo 'mingw32'
+ else
+ echo 'unix'
+ fi
+}
+
+# Command to invoke the linux command `realpath` or equivalent.
+function script_realpath() {
+ # Find `realpath`
+ if [ -x "$(command -v realpath)" ]; then
+ realpath "$@"
+ elif [ -x "$(command -v grealpath)" ]; then
+ grealpath "$@"
+ else
+ exit 1
+ fi
+}
+
+####################
+# Script Arguments #
+####################
+
+PYTHON=${1:-python2.7}
+VENV=${2:-$(venv $PYTHON)}
+VENV_RELATIVE_PYTHON=${3:-$(venv_relative_python)}
+TOOLCHAIN=${4:-$(toolchain)}
ROOT=`pwd`
-export LD_LIBRARY_PATH=$ROOT/libs/$CONFIG
-export DYLD_LIBRARY_PATH=$ROOT/libs/$CONFIG
-export PATH=$ROOT/bins/$CONFIG:$ROOT/bins/$CONFIG/protobuf:$PATH
-export CFLAGS="-I$ROOT/include -std=gnu99"
-export LDFLAGS="-L$ROOT/libs/$CONFIG"
+export CFLAGS="-I$ROOT/include -std=gnu99 -fno-wrapv $CFLAGS"
export GRPC_PYTHON_BUILD_WITH_CYTHON=1
-export GRPC_PYTHON_USE_PRECOMPILED_BINARIES=0
-
-if [ "$CONFIG" = "gcov" ]
-then
- export GRPC_PYTHON_ENABLE_CYTHON_TRACING=1
-fi
-tox -e ${TOX_PYTHON_ENV} --notest
+# Default python on the host to fall back to when instantiating e.g. the
+# virtualenv.
+HOST_PYTHON=${HOST_PYTHON:-python}
-# We force the .so naming convention in PEP 3149 for side by side installation support
-# Note this is the default in Python3, but explicitly disabled for Darwin, so we only
-# use this hack for our testing environment.
-if [ "$PY_VERSION" -gt "27" ]
-then
- mv $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so.backup || true
+# If ccache is available on Linux, use it.
+if [ $(is_linux) ]; then
+ # We're not on Darwin (Mac OS X)
+ if [ -x "$(command -v ccache)" ]; then
+ if [ -x "$(command -v gcc)" ]; then
+ export CC='ccache gcc'
+ elif [ -x "$(command -v clang)" ]; then
+ export CC='ccache clang'
+ fi
+ fi
+fi
+# TODO(atash) consider conceptualizing MinGW as a first-class platform and move
+# these flags into our `setup.py`s
+if [ $(is_mingw) ]; then
+ # We're on MinGW, and our CFLAGS and LDFLAGS will be eaten by the void. Use
+ # our work-around environment variables instead.
+ PYTHON_MSVCR=`$PYTHON -c "from distutils.cygwinccompiler import get_msvcr; print(get_msvcr()[0])"`
+ export GRPC_PYTHON_LDFLAGS="-static-libgcc -static-libstdc++ -mcrtdll=$PYTHON_MSVCR -static -lpthread"
+ # See https://sourceforge.net/p/mingw-w64/bugs/363/
+ export GRPC_PYTHON_CFLAGS="-D_ftime=_ftime64 -D_timeb=__timeb64"
+ # TODO(atash) set these flags for only grpcio-tools (they don't do any harm to
+ # grpcio, but they result in noisy warnings).
+ export GRPC_PYTHON_CFLAGS="-frtti -std=c++11 $GRPC_PYTHON_CFLAGS"
fi
-$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py build
-$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py build_py
-$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py build_ext --inplace
-$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py gather --test
+############################
+# Perform build operations #
+############################
-if [ "$PY_VERSION" -gt "27" ]
-then
- mv $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so $ROOT/src/python/grpcio/grpc/_cython/cygrpc.cpython-${PY_VERSION}m.so || true
- mv $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so.backup $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so || true
-fi
+# Instnatiate the virtualenv, preferring to do so from the relevant python
+# version. Even if these commands fail (e.g. on Windows due to name conflicts)
+# it's possible that the virtualenv is still usable and we trust the tester to
+# be able to 'figure it out' instead of us e.g. doing potentially expensive and
+# unnecessary error recovery by `rm -rf`ing the virtualenv.
+($PYTHON -m virtualenv $VENV ||
+ $HOST_PYTHON -m virtualenv -p $PYTHON $VENV ||
+ true)
+VENV_PYTHON=`script_realpath -s "$VENV/$VENV_RELATIVE_PYTHON"`
+
+# pip-installs the directory specified. Used because on MSYS the vanilla Windows
+# Python gets confused when parsing paths.
+pip_install_dir() {
+ PWD=`pwd`
+ cd $1
+ ($VENV_PYTHON setup.py build_ext -c $TOOLCHAIN || true)
+ # install the dependencies
+ $VENV_PYTHON -m pip install --upgrade .
+ # ensure that we've reinstalled the test packages
+ $VENV_PYTHON -m pip install --upgrade --force-reinstall --no-deps .
+ cd $PWD
+}
-# Build the health checker
-$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/src/python/grpcio_health_checking/setup.py build
-$ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/src/python/grpcio_health_checking/setup.py build_py
+$VENV_PYTHON -m pip install --upgrade pip setuptools
+$VENV_PYTHON -m pip install cython
+pip_install_dir $ROOT
+$VENV_PYTHON $ROOT/tools/distrib/python/make_grpcio_tools.py
+pip_install_dir $ROOT/tools/distrib/python/grpcio_tools
+# TODO(atash) figure out namespace packages and grpcio-tools and auditwheel
+# etc...
+pip_install_dir $ROOT
+$VENV_PYTHON $ROOT/src/python/grpcio_health_checking/setup.py preprocess
+pip_install_dir $ROOT/src/python/grpcio_health_checking
+$VENV_PYTHON $ROOT/src/python/grpcio_tests/setup.py preprocess
+$VENV_PYTHON $ROOT/src/python/grpcio_tests/setup.py build_proto_modules
+pip_install_dir $ROOT/src/python/grpcio_tests
diff --git a/tools/run_tests/build_python_msys2.sh b/tools/run_tests/build_python_msys2.sh
new file mode 100644
index 0000000000..6e9d369018
--- /dev/null
+++ b/tools/run_tests/build_python_msys2.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# 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.
+
+set -ex
+
+BUILD_PYTHON=`realpath "$(dirname $0)/build_python.sh"`
+export MSYSTEM=$1
+shift 1
+bash --login $BUILD_PYTHON "$@"
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py
index 4fe77487f9..3999537c40 100755
--- a/tools/run_tests/jobset.py
+++ b/tools/run_tests/jobset.py
@@ -47,6 +47,12 @@ measure_cpu_costs = False
_DEFAULT_MAX_JOBS = 16 * multiprocessing.cpu_count()
_MAX_RESULT_SIZE = 8192
+def sanitized_environment(env):
+ sanitized = {}
+ for key, value in env.items():
+ sanitized[str(key).encode()] = str(value).encode()
+ return sanitized
+
def platform_string():
if platform.system() == 'Windows':
return 'windows'
@@ -219,6 +225,7 @@ class Job(object):
env = dict(os.environ)
env.update(self._spec.environ)
env.update(self._add_env)
+ env = sanitized_environment(env)
self._start = time.time()
cmdline = self._spec.cmdline
if measure_cpu_costs:
diff --git a/tools/run_tests/performance/run_worker_python.sh b/tools/run_tests/performance/run_worker_python.sh
index 0da8deda58..06cf172d6f 100755
--- a/tools/run_tests/performance/run_worker_python.sh
+++ b/tools/run_tests/performance/run_worker_python.sh
@@ -32,4 +32,4 @@ set -ex
cd $(dirname $0)/../../..
-PYTHONPATH=src/python/grpcio:src/python/gens .tox/py27/bin/python src/python/grpcio/tests/qps/qps_worker.py $@
+PYTHONPATH=src/python/grpcio_tests:src/python/gens py27/bin/python src/python/grpcio_tests/tests/qps/qps_worker.py $@
diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py
index 2d5130e1e8..4dfd01fc66 100644
--- a/tools/run_tests/performance/scenario_config.py
+++ b/tools/run_tests/performance/scenario_config.py
@@ -387,45 +387,44 @@ class PythonLanguage:
return 500
def scenarios(self):
- # TODO(issue #6522): Empty streaming requests does not work for python
- #yield _ping_pong_scenario(
- # 'python_generic_async_streaming_ping_pong', rpc_type='STREAMING',
- # client_type='ASYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
- # use_generic_payload=True,
- # categories=[SMOKETEST])
+ yield _ping_pong_scenario(
+ 'python_generic_sync_streaming_ping_pong', rpc_type='STREAMING',
+ client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER',
+ use_generic_payload=True,
+ categories=[SMOKETEST])
yield _ping_pong_scenario(
'python_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
- client_type='SYNC_CLIENT', server_type='SYNC_SERVER')
+ client_type='SYNC_CLIENT', server_type='ASYNC_SERVER')
yield _ping_pong_scenario(
'python_protobuf_async_unary_ping_pong', rpc_type='UNARY',
- client_type='ASYNC_CLIENT', server_type='SYNC_SERVER')
+ client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER')
yield _ping_pong_scenario(
'python_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
- client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
+ client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
categories=[SMOKETEST])
yield _ping_pong_scenario(
'python_protobuf_sync_unary_qps_unconstrained', rpc_type='UNARY',
- client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
+ client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
unconstrained_client='sync')
yield _ping_pong_scenario(
'python_protobuf_sync_streaming_qps_unconstrained', rpc_type='STREAMING',
- client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
+ client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
unconstrained_client='sync')
yield _ping_pong_scenario(
'python_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY',
- client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
+ client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
server_language='c++', server_core_limit=1, async_server_threads=1,
categories=[SMOKETEST])
yield _ping_pong_scenario(
'python_to_cpp_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING',
- client_type='SYNC_CLIENT', server_type='SYNC_SERVER',
+ client_type='SYNC_CLIENT', server_type='ASYNC_SERVER',
server_language='c++', server_core_limit=1, async_server_threads=1)
def __str__(self):
diff --git a/tools/run_tests/port_server.py b/tools/run_tests/port_server.py
index 14e82b601e..83f8e6cd35 100755
--- a/tools/run_tests/port_server.py
+++ b/tools/run_tests/port_server.py
@@ -42,7 +42,7 @@ import time
# increment this number whenever making a change to ensure that
# the changes are picked up by running CI servers
# note that all changes must be backwards compatible
-_MY_VERSION = 7
+_MY_VERSION = 9
if len(sys.argv) == 2 and sys.argv[1] == 'dump_version':
@@ -70,7 +70,7 @@ in_use = {}
def refill_pool(max_timeout, req):
"""Scan for ports not marked for being in use"""
- for i in range(1025, 32767):
+ for i in range(1025, 32766):
if len(pool) > 100: break
if i in in_use:
age = time.time() - in_use[i]
@@ -110,6 +110,11 @@ keep_running = True
class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
+
+ def setup(self):
+ # If the client is unreachable for 5 seconds, close the connection
+ self.timeout = 5
+ BaseHTTPServer.BaseHTTPRequestHandler.setup(self)
def do_GET(self):
global keep_running
diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py
index adf9adaf13..13a4a49325 100755
--- a/tools/run_tests/run_interop_tests.py
+++ b/tools/run_tests/run_interop_tests.py
@@ -304,8 +304,11 @@ class PythonLanguage:
def client_cmd(self, args):
return [
- 'tox -einterop_client --',
- ' '.join(args)
+ 'py27/bin/python',
+ 'src/python/grpcio_tests/setup.py',
+ 'run_interop',
+ '--client',
+ '--args="{}"'.format(' '.join(args))
]
def cloud_to_prod_env(self):
@@ -313,8 +316,11 @@ class PythonLanguage:
def server_cmd(self, args):
return [
- 'tox -einterop_server --',
- ' '.join(args) + ' --use_tls=true'
+ 'py27/bin/python',
+ 'src/python/grpcio_tests/setup.py',
+ 'run_interop',
+ '--server',
+ '--args="{}"'.format(' '.join(args) + ' --use_tls=true')
]
def global_env(self):
diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh
index 8059059d41..17e0186f2a 100755
--- a/tools/run_tests/run_python.sh
+++ b/tools/run_tests/run_python.sh
@@ -33,24 +33,11 @@ set -ex
# change to grpc repo root
cd $(dirname $0)/../..
-TOX_PYTHON_ENV="$1"
+PYTHON=`realpath -s "${1:-py27/bin/python}"`
ROOT=`pwd`
-export LD_LIBRARY_PATH=$ROOT/libs/$CONFIG
-export DYLD_LIBRARY_PATH=$ROOT/libs/$CONFIG
-export PATH=$ROOT/bins/$CONFIG:$ROOT/bins/$CONFIG/protobuf:$PATH
-export CFLAGS="-I$ROOT/include -std=c89"
-export LDFLAGS="-L$ROOT/libs/$CONFIG"
-export GRPC_PYTHON_BUILD_WITH_CYTHON=1
-export GRPC_PYTHON_USE_PRECOMPILED_BINARIES=0
-if [ "$CONFIG" = "gcov" ]
-then
- export GRPC_PYTHON_ENABLE_CYTHON_TRACING=1
- tox -e ${TOX_PYTHON_ENV}
-else
- $ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py test_lite
-fi
+$PYTHON $ROOT/src/python/grpcio_tests/setup.py test_lite
mkdir -p $ROOT/reports
rm -rf $ROOT/reports/python-coverage
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index c1254275e6..f081887fc0 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -32,11 +32,13 @@
import argparse
import ast
+import collections
import glob
import itertools
import json
import multiprocessing
import os
+import os.path
import platform
import random
import re
@@ -372,50 +374,42 @@ class PhpLanguage(object):
return 'php'
+class PythonConfig(collections.namedtuple('PythonConfig', [
+ 'name', 'build', 'run'])):
+ """Tuple of commands (named s.t. 'what it says on the tin' applies)"""
+
class PythonLanguage(object):
def configure(self, config, args):
self.config = config
self.args = args
- self._tox_envs = self._get_tox_envs(self.args.compiler)
+ self.pythons = self._get_pythons(self.args)
def test_specs(self):
# load list of known test suites
- with open('src/python/grpcio/tests/tests.json') as tests_json_file:
+ with open('src/python/grpcio_tests/tests/tests.json') as tests_json_file:
tests_json = json.load(tests_json_file)
environment = dict(_FORCE_ENVIRON_FOR_WRAPPERS)
- environment['PYTHONPATH'] = '{}:{}'.format(
- os.path.abspath('src/python/gens'),
- os.path.abspath('src/python/grpcio_health_checking'))
- if self.config.build_config != 'gcov':
- return [self.config.job_spec(
- ['tools/run_tests/run_python.sh', tox_env],
- environ=dict(environment.items() +
- [('GRPC_PYTHON_TESTRUNNER_FILTER', suite_name)]),
- shortname='%s.test.%s' % (tox_env, suite_name),
- timeout_seconds=5*60)
- for suite_name in tests_json
- for tox_env in self._tox_envs]
- else:
- return [self.config.job_spec(['tools/run_tests/run_python.sh', tox_env],
- environ=environment,
- shortname='%s.test.coverage' % tox_env,
- timeout_seconds=15*60)
- for tox_env in self._tox_envs]
-
+ return [self.config.job_spec(
+ config.run,
+ timeout_seconds=5*60,
+ environ=dict(environment.items() +
+ [('GRPC_PYTHON_TESTRUNNER_FILTER', suite_name)]),
+ shortname='%s.test.%s' % (config.name, suite_name),)
+ for suite_name in tests_json
+ for config in self.pythons]
def pre_build_steps(self):
return []
def make_targets(self):
- return ['static_c', 'grpc_python_plugin', 'shared_c']
+ return []
def make_options(self):
return []
def build_steps(self):
- return [['tools/run_tests/build_python.sh', tox_env]
- for tox_env in self._tox_envs]
+ return [config.build for config in self.pythons]
def post_tests_steps(self):
return []
@@ -426,16 +420,50 @@ class PythonLanguage(object):
def dockerfile_dir(self):
return 'tools/dockerfile/test/python_jessie_%s' % _docker_arch_suffix(self.args.arch)
- def _get_tox_envs(self, compiler):
- """Returns name of tox environment based on selected compiler."""
- if compiler == 'default':
- return ('py27', 'py34')
- elif compiler == 'python2.7':
- return ('py27',)
- elif compiler == 'python3.4':
- return ('py34',)
+ def _get_pythons(self, args):
+ if args.arch == 'x86':
+ bits = '32'
else:
- raise Exception('Compiler %s not supported.' % compiler)
+ bits = '64'
+ if os.name == 'nt':
+ shell = ['bash']
+ builder = [os.path.abspath('tools/run_tests/build_python_msys2.sh')]
+ builder_prefix_arguments = ['MINGW{}'.format(bits)]
+ venv_relative_python = ['Scripts/python.exe']
+ toolchain = ['mingw32']
+ python_pattern_function = lambda major, minor, bits: (
+ '/c/Python{major}{minor}/python.exe'.format(major=major, minor=minor, bits=bits)
+ if bits == '64' else
+ '/c/Python{major}{minor}_{bits}bits/python.exe'.format(
+ major=major, minor=minor, bits=bits))
+ else:
+ shell = []
+ builder = [os.path.abspath('tools/run_tests/build_python.sh')]
+ builder_prefix_arguments = []
+ venv_relative_python = ['bin/python']
+ toolchain = ['unix']
+ # Bit-ness is handled by the test machine's environment
+ python_pattern_function = lambda major, minor, bits: 'python{major}.{minor}'.format(major=major, minor=minor)
+ runner = [os.path.abspath('tools/run_tests/run_python.sh')]
+ python_config_generator = lambda name, major, minor, bits: PythonConfig(
+ name,
+ shell + builder + builder_prefix_arguments
+ + [python_pattern_function(major=major, minor=minor, bits=bits)]
+ + [name] + venv_relative_python + toolchain,
+ shell + runner + [os.path.join(name, venv_relative_python[0])])
+ python27_config = python_config_generator(name='py27', major='2', minor='7', bits=bits)
+ python34_config = python_config_generator(name='py34', major='3', minor='4', bits=bits)
+ if args.compiler == 'default':
+ if os.name == 'nt':
+ return (python27_config,)
+ else:
+ return (python27_config, python34_config,)
+ elif args.compiler == 'python2.7':
+ return (python27_config,)
+ elif args.compiler == 'python3.4':
+ return (python34_config,)
+ else:
+ raise Exception('Compiler %s not supported.' % args.compiler)
def __str__(self):
return 'python'
@@ -621,10 +649,13 @@ class ObjCLanguage(object):
_check_compiler(self.args.compiler, ['default'])
def test_specs(self):
- return [self.config.job_spec(['src/objective-c/tests/run_tests.sh'], None,
- environ=_FORCE_ENVIRON_FOR_WRAPPERS),
+ return [self.config.job_spec(['src/objective-c/tests/run_tests.sh'],
+ timeout_seconds=None,
+ shortname='objc-tests',
+ environ=_FORCE_ENVIRON_FOR_WRAPPERS),
self.config.job_spec(['src/objective-c/tests/build_example_test.sh'],
- None, timeout_seconds=15*60,
+ timeout_seconds=15*60,
+ shortname='objc-examples-build',
environ=_FORCE_ENVIRON_FOR_WRAPPERS)]
def pre_build_steps(self):
@@ -1050,6 +1081,30 @@ runs_per_test = args.runs_per_test
forever = args.forever
+def _shut_down_legacy_server(legacy_server_port):
+ try:
+ version = int(urllib2.urlopen(
+ 'http://localhost:%d/version_number' % legacy_server_port,
+ timeout=10).read())
+ except:
+ pass
+ else:
+ urllib2.urlopen(
+ 'http://localhost:%d/quitquitquit' % legacy_server_port).read()
+
+
+def _shut_down_legacy_server(legacy_server_port):
+ try:
+ version = int(urllib2.urlopen(
+ 'http://localhost:%d/version_number' % legacy_server_port,
+ timeout=10).read())
+ except:
+ pass
+ else:
+ urllib2.urlopen(
+ 'http://localhost:%d/quitquitquit' % legacy_server_port).read()
+
+
def _start_port_server(port_server_port):
# check if a compatible port server is running
# if incompatible (version mismatch) ==> start a new one
@@ -1186,7 +1241,7 @@ def _build_and_run(
# start antagonists
antagonists = [subprocess.Popen(['tools/run_tests/antagonist.py'])
for _ in range(0, args.antagonists)]
- port_server_port = 32767
+ port_server_port = 32766
_start_port_server(port_server_port)
resultset = None
num_test_failures = 0
diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh
index f2d7a1429e..b602d69564 100755
--- a/tools/run_tests/sanity/check_submodules.sh
+++ b/tools/run_tests/sanity/check_submodules.sh
@@ -45,7 +45,7 @@ cat << EOF | awk '{ print $1 }' | sort > $want_submodules
05b155ff59114735ec8cd089f669c4c3d8f59029 third_party/gflags (v2.1.0-45-g05b155f)
c99458533a9b4c743ed51537e25989ea55944908 third_party/googletest (release-1.7.0)
f8ac463766281625ad710900479130c7fcb4d63b third_party/nanopb (nanopb-0.3.4-29-gf8ac463)
- d4d13a4349e4e59d67f311185ddcc1890d956d7a third_party/protobuf (v3.0.0-beta-3.2)
+ bdeb215cab2985195325fcd5e70c3fa751f46e0f third_party/protobuf (v3.0.0-beta-3.3)
50893291621658f355bc5b4d450a8d06a563053d third_party/zlib (v1.2.8)
EOF
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index fa2ee3031a..125fdd2119 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -81,6 +81,23 @@
},
{
"deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util",
+ "test_tcp_server"
+ ],
+ "headers": [],
+ "language": "c",
+ "name": "bad_server_response_test",
+ "src": [
+ "test/core/end2end/bad_server_response_test.c"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
+ {
+ "deps": [
"grpc",
"grpc_test_util"
],
@@ -805,9 +822,7 @@
{
"deps": [
"gpr",
- "gpr_test_util",
- "grpc",
- "grpc_test_util"
+ "grpc"
],
"headers": [],
"language": "c",
@@ -901,9 +916,7 @@
{
"deps": [
"gpr",
- "gpr_test_util",
- "grpc",
- "grpc_test_util"
+ "grpc"
],
"headers": [],
"language": "c",
@@ -933,9 +946,7 @@
{
"deps": [
"gpr",
- "gpr_test_util",
- "grpc",
- "grpc_test_util"
+ "grpc"
],
"headers": [],
"language": "c",
diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json
index 8fdf947a19..765b306e30 100644
--- a/tools/run_tests/tests.json
+++ b/tools/run_tests/tests.json
@@ -98,6 +98,27 @@
"flaky": false,
"gtest": false,
"language": "c",
+ "name": "bad_server_response_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ]
+ },
+ {
+ "args": [],
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ],
+ "cpu_cost": 1.0,
+ "exclude_configs": [],
+ "flaky": false,
+ "gtest": false,
+ "language": "c",
"name": "bin_decoder_test",
"platforms": [
"linux",