aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar kpayson64 <kpayson@google.com>2018-03-28 10:04:12 -0700
committerGravatar GitHub <noreply@github.com>2018-03-28 10:04:12 -0700
commitc39496540ca03fbf288a7f5837b6af1bec67b448 (patch)
tree9d309e4a8baba1062eb0254c4a563558830c80d2 /tools
parenta99dd83e58c3f9ba1532ab00923d4d8259a91cc1 (diff)
parent1bfff8eec05a8892efbe8541143e3f90e96b48e4 (diff)
Merge pull request #14561 from kpayson64/gevent_2
Initial Gevent Compatibility
Diffstat (limited to 'tools')
-rwxr-xr-xtools/run_tests/helper_scripts/build_python.sh6
-rwxr-xr-xtools/run_tests/helper_scripts/run_python.sh2
-rwxr-xr-xtools/run_tests/run_interop_tests.py6
-rwxr-xr-xtools/run_tests/run_tests.py31
-rwxr-xr-xtools/run_tests/run_tests_matrix.py86
5 files changed, 81 insertions, 50 deletions
diff --git a/tools/run_tests/helper_scripts/build_python.sh b/tools/run_tests/helper_scripts/build_python.sh
index b809fe012f..dac29b91dd 100755
--- a/tools/run_tests/helper_scripts/build_python.sh
+++ b/tools/run_tests/helper_scripts/build_python.sh
@@ -152,6 +152,12 @@ pip_install_dir() {
cd "$PWD"
}
+case "$VENV" in
+ *gevent*)
+ $VENV_PYTHON -m pip install gevent
+ ;;
+esac
+
$VENV_PYTHON -m pip install --upgrade pip==9.0.1
$VENV_PYTHON -m pip install setuptools
$VENV_PYTHON -m pip install cython
diff --git a/tools/run_tests/helper_scripts/run_python.sh b/tools/run_tests/helper_scripts/run_python.sh
index bcfe3a6577..2b7321e527 100755
--- a/tools/run_tests/helper_scripts/run_python.sh
+++ b/tools/run_tests/helper_scripts/run_python.sh
@@ -22,7 +22,7 @@ PYTHON=$(realpath "${1:-py27/bin/python}")
ROOT=$(pwd)
-$PYTHON "$ROOT/src/python/grpcio_tests/setup.py" test_lite
+$PYTHON "$ROOT/src/python/grpcio_tests/setup.py" "$2"
mkdir -p "$ROOT/reports"
rm -rf "$ROOT/reports/python-coverage"
diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py
index ba4ab3bd36..970b0d7902 100755
--- a/tools/run_tests/run_interop_tests.py
+++ b/tools/run_tests/run_interop_tests.py
@@ -545,13 +545,13 @@ class PythonLanguage:
def client_cmd(self, args):
return [
- 'py27/bin/python', 'src/python/grpcio_tests/setup.py',
+ 'py27_native/bin/python', 'src/python/grpcio_tests/setup.py',
'run_interop', '--client', '--args="{}"'.format(' '.join(args))
]
def client_cmd_http2interop(self, args):
return [
- 'py27/bin/python',
+ 'py27_native/bin/python',
'src/python/grpcio_tests/tests/http2/negative_http2_client.py',
] + args
@@ -560,7 +560,7 @@ class PythonLanguage:
def server_cmd(self, args):
return [
- 'py27/bin/python', 'src/python/grpcio_tests/setup.py',
+ 'py27_native/bin/python', 'src/python/grpcio_tests/setup.py',
'run_interop', '--server', '--args="{}"'.format(' '.join(args))
]
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 85c7f5c4dc..4146eec42d 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -204,19 +204,28 @@ def _is_use_docker_child():
_PythonConfigVars = collections.namedtuple('_ConfigVars', [
- 'shell', 'builder', 'builder_prefix_arguments', 'venv_relative_python',
- 'toolchain', 'runner'
+ 'shell',
+ 'builder',
+ 'builder_prefix_arguments',
+ 'venv_relative_python',
+ 'toolchain',
+ 'runner',
+ 'test_name',
+ 'iomgr_platform',
])
def _python_config_generator(name, major, minor, bits, config_vars):
+ name += '_' + config_vars.iomgr_platform
return PythonConfig(
name, config_vars.shell + config_vars.builder +
config_vars.builder_prefix_arguments + [
_python_pattern_function(major=major, minor=minor, bits=bits)
] + [name] + config_vars.venv_relative_python + config_vars.toolchain,
- config_vars.shell + config_vars.runner +
- [os.path.join(name, config_vars.venv_relative_python[0])])
+ config_vars.shell + config_vars.runner + [
+ os.path.join(name, config_vars.venv_relative_python[0]),
+ config_vars.test_name
+ ])
def _pypy_config_generator(name, major, config_vars):
@@ -281,7 +290,7 @@ class CLanguage(object):
self._docker_distro, self._make_options = self._compiler_options(
self.args.use_docker, self.args.compiler)
if args.iomgr_platform == "uv":
- cflags = '-DGRPC_UV -DGRPC_CUSTOM_IOMGR_THREAD_CHECK '
+ cflags = '-DGRPC_UV -DGRPC_CUSTOM_IOMGR_THREAD_CHECK -DGRPC_CUSTOM_SOCKET '
try:
cflags += subprocess.check_output(
['pkg-config', '--cflags', 'libuv']).strip() + ' '
@@ -770,12 +779,16 @@ class PythonLanguage(object):
venv_relative_python = ['bin/python']
toolchain = ['unix']
+ test_command = 'test_lite'
+ if args.iomgr_platform == 'gevent':
+ test_command = 'test_gevent'
runner = [
os.path.abspath('tools/run_tests/helper_scripts/run_python.sh')
]
- config_vars = _PythonConfigVars(shell, builder,
- builder_prefix_arguments,
- venv_relative_python, toolchain, runner)
+
+ config_vars = _PythonConfigVars(
+ shell, builder, builder_prefix_arguments, venv_relative_python,
+ toolchain, runner, test_command, args.iomgr_platform)
python27_config = _python_config_generator(
name='py27',
major='2',
@@ -1341,7 +1354,7 @@ argp.add_argument(
)
argp.add_argument(
'--iomgr_platform',
- choices=['native', 'uv'],
+ choices=['native', 'uv', 'gevent'],
default='native',
help='Selects iomgr platform to build on')
argp.add_argument(
diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py
index 1c99e794a9..e43319beba 100755
--- a/tools/run_tests/run_tests_matrix.py
+++ b/tools/run_tests/run_tests_matrix.py
@@ -114,7 +114,7 @@ def _workspace_jobspec(name,
def _generate_jobs(languages,
configs,
platforms,
- iomgr_platform='native',
+ iomgr_platforms=['native'],
arch=None,
compiler=None,
labels=[],
@@ -125,40 +125,43 @@ def _generate_jobs(languages,
result = []
for language in languages:
for platform in platforms:
- for config in configs:
- name = '%s_%s_%s_%s' % (language, platform, config,
- iomgr_platform)
- runtests_args = [
- '-l', language, '-c', config, '--iomgr_platform',
- iomgr_platform
- ]
- if arch or compiler:
- name += '_%s_%s' % (arch, compiler)
- runtests_args += ['--arch', arch, '--compiler', compiler]
- if '--build_only' in extra_args:
- name += '_buildonly'
- for extra_env in extra_envs:
- name += '_%s_%s' % (extra_env, extra_envs[extra_env])
-
- runtests_args += extra_args
- if platform == 'linux':
- job = _docker_jobspec(
- name=name,
- runtests_args=runtests_args,
- runtests_envs=extra_envs,
- inner_jobs=inner_jobs,
- timeout_seconds=timeout_seconds)
- else:
- job = _workspace_jobspec(
- name=name,
- runtests_args=runtests_args,
- runtests_envs=extra_envs,
- inner_jobs=inner_jobs,
- timeout_seconds=timeout_seconds)
-
- job.labels = [platform, config, language, iomgr_platform
- ] + labels
- result.append(job)
+ for iomgr_platform in iomgr_platforms:
+ for config in configs:
+ name = '%s_%s_%s_%s' % (language, platform, config,
+ iomgr_platform)
+ runtests_args = [
+ '-l', language, '-c', config, '--iomgr_platform',
+ iomgr_platform
+ ]
+ if arch or compiler:
+ name += '_%s_%s' % (arch, compiler)
+ runtests_args += [
+ '--arch', arch, '--compiler', compiler
+ ]
+ if '--build_only' in extra_args:
+ name += '_buildonly'
+ for extra_env in extra_envs:
+ name += '_%s_%s' % (extra_env, extra_envs[extra_env])
+
+ runtests_args += extra_args
+ if platform == 'linux':
+ job = _docker_jobspec(
+ name=name,
+ runtests_args=runtests_args,
+ runtests_envs=extra_envs,
+ inner_jobs=inner_jobs,
+ timeout_seconds=timeout_seconds)
+ else:
+ job = _workspace_jobspec(
+ name=name,
+ runtests_args=runtests_args,
+ runtests_envs=extra_envs,
+ inner_jobs=inner_jobs,
+ timeout_seconds=timeout_seconds)
+
+ job.labels = [platform, config, language, iomgr_platform
+ ] + labels
+ result.append(job)
return result
@@ -184,13 +187,22 @@ def _create_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS):
timeout_seconds=_CPP_RUNTESTS_TIMEOUT)
test_jobs += _generate_jobs(
- languages=['csharp', 'python'],
+ languages=['csharp'],
configs=['dbg', 'opt'],
platforms=['linux', 'macos', 'windows'],
labels=['basictests', 'multilang'],
extra_args=extra_args,
inner_jobs=inner_jobs)
+ test_jobs += _generate_jobs(
+ languages=['python'],
+ configs=['opt'],
+ platforms=['linux', 'macos', 'windows'],
+ iomgr_platforms=['native', 'gevent'],
+ labels=['basictests', 'multilang'],
+ extra_args=extra_args,
+ inner_jobs=inner_jobs)
+
# supported on linux and mac.
test_jobs += _generate_jobs(
languages=['c++'],
@@ -377,7 +389,7 @@ def _create_portability_test_jobs(extra_args=[],
languages=['c'],
configs=['dbg'],
platforms=['linux'],
- iomgr_platform='uv',
+ iomgr_platforms=['uv'],
labels=['portability', 'corelang'],
extra_args=extra_args,
inner_jobs=inner_jobs,