aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2015-12-07 22:22:56 -0800
committerGravatar yang-g <yangg@google.com>2015-12-07 22:22:56 -0800
commitb50ae4651bf1043a30e4db20cd4b4d3ca2cadfe4 (patch)
treeaddc94dc99fb5d161fe91b54e638eb7f764ad47b /tools/run_tests
parentf1183300ce40c957fc9010e8513c15a15d11afd4 (diff)
parent045c8483c2d78421d40bf88112e012e1624a0d93 (diff)
merge with head
Diffstat (limited to 'tools/run_tests')
-rwxr-xr-xtools/run_tests/build_python.sh79
-rwxr-xr-xtools/run_tests/run_interop_tests.py149
-rwxr-xr-xtools/run_tests/run_python.sh14
-rw-r--r--tools/run_tests/sources_and_headers.json14
-rw-r--r--tools/run_tests/tests.json18
5 files changed, 139 insertions, 135 deletions
diff --git a/tools/run_tests/build_python.sh b/tools/run_tests/build_python.sh
index 24cf6ba7c8..57080ce934 100755
--- a/tools/run_tests/build_python.sh
+++ b/tools/run_tests/build_python.sh
@@ -34,71 +34,16 @@ set -ex
cd $(dirname $0)/../..
ROOT=`pwd`
-PATH=$ROOT/bins/$CONFIG:$ROOT/bins/$CONFIG/protobuf:$PATH
GRPCIO=$ROOT/src/python/grpcio
-GRPCIO_TEST=$ROOT/src/python/grpcio_test
-GRPCIO_HEALTH_CHECKING=$ROOT/src/python/grpcio_health_checking
-
-install_grpcio_deps() {
- cd $GRPCIO
- pip install -r requirements.txt
-}
-install_grpcio_test_deps() {
- cd $GRPCIO_TEST
- pip install -r requirements.txt
-}
-
-install_grpcio() {
- CFLAGS="-I$ROOT/include -std=c89" LDFLAGS=-L$ROOT/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install $GRPCIO
-}
-install_grpcio_test() {
- pip install $GRPCIO_TEST
-}
-install_grpcio_health_checking() {
- pip install $GRPCIO_HEALTH_CHECKING
-}
-
-# Cleans the environment of previous installations
-clean_grpcio_all() {
- (yes | pip uninstall grpcio) || true
- (yes | pip uninstall grpcio_test) || true
- (yes | pip uninstall grpcio_health_checking) || true
-}
-
-# Builds the testing environment.
-make_virtualenv() {
- virtualenv_name="python"$1"_virtual_environment"
- if [ ! -d $virtualenv_name ]
- then
- # Build the entire virtual environment
- virtualenv -p `which "python"$1` $virtualenv_name
- source $virtualenv_name/bin/activate
-
- # Install grpcio
- install_grpcio_deps
- install_grpcio
-
- # Install grpcio_test
- install_grpcio_test_deps
- install_grpcio_test
-
- # Install grpcio_health_checking
- install_grpcio_health_checking
- else
- source $virtualenv_name/bin/activate
- # Uninstall and re-install the packages we care about. Don't use
- # --force-reinstall or --ignore-installed to avoid propagating this
- # unnecessarily to dependencies. Don't use --no-deps to avoid missing
- # dependency upgrades.
- clean_grpcio_all
- install_grpcio || (
- # Fall back to rebuilding the entire environment
- rm -rf $virtualenv_name
- make_virtualenv $1
- )
- install_grpcio_test
- install_grpcio_health_checking
- fi
-}
-
-make_virtualenv $1
+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_ENABLE_CYTHON_TRACING=1
+
+cd $GRPCIO
+tox --notest
+
+$GRPCIO/.tox/py27/bin/python $GRPCIO/setup.py build
diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py
index 5feb4f0c38..37b631bd0d 100755
--- a/tools/run_tests/run_interop_tests.py
+++ b/tools/run_tests/run_interop_tests.py
@@ -60,14 +60,14 @@ class CXXLanguage:
self.server_cwd = None
self.safename = 'cxx'
- def client_args(self):
- return ['bins/opt/interop_client']
+ def client_cmd(self, args):
+ return ['bins/opt/interop_client'] + args
def cloud_to_prod_env(self):
return {}
- def server_args(self):
- return ['bins/opt/interop_server', '--use_tls=true']
+ def server_cmd(self, args):
+ return ['bins/opt/interop_server', '--use_tls=true'] + args
def global_env(self):
return {}
@@ -86,14 +86,14 @@ class CSharpLanguage:
self.server_cwd = 'src/csharp/Grpc.IntegrationTesting.Server/bin/Debug'
self.safename = str(self)
- def client_args(self):
- return ['mono', 'Grpc.IntegrationTesting.Client.exe']
+ def client_cmd(self, args):
+ return ['mono', 'Grpc.IntegrationTesting.Client.exe'] + args
def cloud_to_prod_env(self):
return _SSL_CERT_ENV
- def server_args(self):
- return ['mono', 'Grpc.IntegrationTesting.Server.exe', '--use_tls=true']
+ def server_cmd(self, args):
+ return ['mono', 'Grpc.IntegrationTesting.Server.exe', '--use_tls=true'] + args
def global_env(self):
return {}
@@ -112,14 +112,14 @@ class JavaLanguage:
self.server_cwd = '../grpc-java'
self.safename = str(self)
- def client_args(self):
- return ['./run-test-client.sh']
+ def client_cmd(self, args):
+ return ['./run-test-client.sh'] + args
def cloud_to_prod_env(self):
return {}
- def server_args(self):
- return ['./run-test-server.sh', '--use_tls=true']
+ def server_cmd(self, args):
+ return ['./run-test-server.sh', '--use_tls=true'] + args
def global_env(self):
return {}
@@ -139,14 +139,14 @@ class GoLanguage:
self.server_cwd = '/go/src/google.golang.org/grpc/interop/server'
self.safename = str(self)
- def client_args(self):
- return ['go', 'run', 'client.go']
+ def client_cmd(self, args):
+ return ['go', 'run', 'client.go'] + args
def cloud_to_prod_env(self):
return {}
- def server_args(self):
- return ['go', 'run', 'server.go', '--use_tls=true']
+ def server_cmd(self, args):
+ return ['go', 'run', 'server.go', '--use_tls=true'] + args
def global_env(self):
return {}
@@ -168,8 +168,8 @@ class Http2Client:
self.client_cwd = None
self.safename = str(self)
- def client_args(self):
- return ['tools/http2_interop/http2_interop.test', '-test.v']
+ def client_cmd(self, args):
+ return ['tools/http2_interop/http2_interop.test', '-test.v'] + args
def cloud_to_prod_env(self):
return {}
@@ -190,14 +190,14 @@ class NodeLanguage:
self.server_cwd = None
self.safename = str(self)
- def client_args(self):
- return ['node', 'src/node/interop/interop_client.js']
+ def client_cmd(self, args):
+ return ['node', 'src/node/interop/interop_client.js'] + args
def cloud_to_prod_env(self):
return _SSL_CERT_ENV
- def server_args(self):
- return ['node', 'src/node/interop/interop_server.js', '--use_tls=true']
+ def server_cmd(self, args):
+ return ['node', 'src/node/interop/interop_server.js', '--use_tls=true'] + args
def global_env(self):
return {}
@@ -215,8 +215,8 @@ class PHPLanguage:
self.client_cwd = None
self.safename = str(self)
- def client_args(self):
- return ['src/php/bin/interop_client.sh']
+ def client_cmd(self, args):
+ return ['src/php/bin/interop_client.sh'] + args
def cloud_to_prod_env(self):
return _SSL_CERT_ENV
@@ -238,14 +238,14 @@ class RubyLanguage:
self.server_cwd = None
self.safename = str(self)
- def client_args(self):
- return ['ruby', 'src/ruby/bin/interop/interop_client.rb']
+ def client_cmd(self, args):
+ return ['ruby', 'src/ruby/bin/interop/interop_client.rb'] + args
def cloud_to_prod_env(self):
return _SSL_CERT_ENV
- def server_args(self):
- return ['ruby', 'src/ruby/bin/interop/interop_server.rb', '--use_tls=true']
+ def server_cmd(self, args):
+ return ['ruby', 'src/ruby/bin/interop/interop_server.rb', '--use_tls=true'] + args
def global_env(self):
return {}
@@ -264,17 +264,29 @@ class PythonLanguage:
self.server_cwd = None
self.safename = str(self)
- def client_args(self):
- return ['python2.7_virtual_environment/bin/python', '-m', 'grpc_interop.client']
+ def client_cmd(self, args):
+ return [
+ 'src/python/grpcio/.tox/py27/bin/python',
+ 'src/python/grpcio/setup.py',
+ 'run_interop',
+ '--client',
+ '--args=\'{}\''.format(' '.join(args))
+ ]
def cloud_to_prod_env(self):
return _SSL_CERT_ENV
- def server_args(self):
- return ['python2.7_virtual_environment/bin/python', '-m', 'grpc_interop.server', '--use_tls=true']
+ def server_cmd(self, args):
+ return [
+ 'src/python/grpcio/.tox/py27/bin/python',
+ 'src/python/grpcio/setup.py',
+ 'run_interop',
+ '--server',
+ '--args=\'{}\''.format(' '.join(args) + ' --use_tls=true')
+ ]
def global_env(self):
- return {'LD_LIBRARY_PATH': 'libs/opt'}
+ return {'LD_LIBRARY_PATH': '{}/libs/opt'.format(DOCKER_WORKDIR_ROOT)}
def unimplemented_test_cases(self):
return ['jwt_token_creds', 'per_rpc_creds']
@@ -307,6 +319,8 @@ _AUTH_TEST_CASES = ['compute_engine_creds', 'jwt_token_creds',
_HTTP2_TEST_CASES = ["tls", "framing"]
+DOCKER_WORKDIR_ROOT = '/var/local/git/grpc'
+
def docker_run_cmdline(cmdline, image, docker_args=[], cwd=None, environ=None):
"""Wraps given cmdline array to create 'docker run' cmdline from it."""
docker_cmdline = ['docker', 'run', '-i', '--rm=true']
@@ -317,7 +331,7 @@ def docker_run_cmdline(cmdline, image, docker_args=[], cwd=None, environ=None):
docker_cmdline += ['-e', '%s=%s' % (k,v)]
# set working directory
- workdir = '/var/local/git/grpc'
+ workdir = DOCKER_WORKDIR_ROOT
if cwd:
workdir = os.path.join(workdir, cwd)
docker_cmdline += ['-w', workdir]
@@ -334,12 +348,12 @@ def bash_login_cmdline(cmdline):
return ['bash', '-l', '-c', ' '.join(cmdline)]
-def add_auth_options(language, test_case, cmdline, env):
+def auth_options(language, test_case):
"""Returns (cmdline, env) tuple with cloud_to_prod_auth test options."""
language = str(language)
- cmdline = list(cmdline)
- env = env.copy()
+ cmdargs = []
+ env = {}
# TODO(jtattermusch): this file path only works inside docker
key_filepath = '/root/service_account/stubbyCloudTestingTest-ee3fce360ac5.json'
@@ -351,19 +365,19 @@ def add_auth_options(language, test_case, cmdline, env):
if language in ['csharp', 'node', 'php', 'python', 'ruby']:
env['GOOGLE_APPLICATION_CREDENTIALS'] = key_filepath
else:
- cmdline += [key_file_arg]
+ cmdargs += [key_file_arg]
if test_case in ['per_rpc_creds', 'oauth2_auth_token']:
- cmdline += [oauth_scope_arg]
+ cmdargs += [oauth_scope_arg]
if test_case == 'oauth2_auth_token' and language == 'c++':
# C++ oauth2 test uses GCE creds and thus needs to know the default account
- cmdline += [default_account_arg]
+ cmdargs += [default_account_arg]
if test_case == 'compute_engine_creds':
- cmdline += [oauth_scope_arg, default_account_arg]
+ cmdargs += [oauth_scope_arg, default_account_arg]
- return (cmdline, env)
+ return (cmdargs, env)
def _job_kill_handler(job):
@@ -378,18 +392,20 @@ def _job_kill_handler(job):
def cloud_to_prod_jobspec(language, test_case, docker_image=None, auth=False):
"""Creates jobspec for cloud-to-prod interop test"""
- cmdline = language.client_args() + [
+ container_name = None
+ cmdargs = [
'--server_host_override=grpc-test.sandbox.google.com',
'--server_host=grpc-test.sandbox.google.com',
'--server_port=443',
'--use_tls=true',
'--test_case=%s' % test_case]
- cwd = language.client_cwd
environ = dict(language.cloud_to_prod_env(), **language.global_env())
- container_name = None
if auth:
- cmdline, environ = add_auth_options(language, test_case, cmdline, environ)
- cmdline = bash_login_cmdline(cmdline)
+ auth_cmdargs, auth_env = auth_options(language, test_case)
+ cmdargs += auth_cmdargs
+ environ.update(auth_env)
+ cmdline = bash_login_cmdline(language.client_cmd(cmdargs))
+ cwd = language.client_cwd
if docker_image:
container_name = dockerjob.random_name('interop_client_%s' % language.safename)
@@ -419,13 +435,13 @@ def cloud_to_prod_jobspec(language, test_case, docker_image=None, auth=False):
def cloud_to_cloud_jobspec(language, test_case, server_name, server_host,
server_port, docker_image=None):
"""Creates jobspec for cloud-to-cloud interop test"""
- cmdline = bash_login_cmdline(language.client_args() +
- ['--server_host_override=foo.test.google.fr',
- '--use_tls=true',
- '--use_test_ca=true',
- '--test_case=%s' % test_case,
- '--server_host=%s' % server_host,
- '--server_port=%s' % server_port])
+ cmdline = bash_login_cmdline(language.client_cmd([
+ '--server_host_override=foo.test.google.fr',
+ '--use_tls=true',
+ '--use_test_ca=true',
+ '--test_case=%s' % test_case,
+ '--server_host=%s' % server_host,
+ '--server_port=%s' % server_port]))
cwd = language.client_cwd
environ = language.global_env()
if docker_image:
@@ -455,8 +471,8 @@ def cloud_to_cloud_jobspec(language, test_case, server_name, server_host,
def server_jobspec(language, docker_image):
"""Create jobspec for running a server"""
container_name = dockerjob.random_name('interop_server_%s' % language.safename)
- cmdline = bash_login_cmdline(language.server_args() +
- ['--port=%s' % _DEFAULT_SERVER_PORT])
+ cmdline = bash_login_cmdline(
+ language.server_cmd(['--port=%s' % _DEFAULT_SERVER_PORT]))
environ = language.global_env()
docker_cmdline = docker_run_cmdline(cmdline,
image=docker_image,
@@ -547,7 +563,7 @@ argp.add_argument('--http2_interop',
action='store_const',
const=True,
help='Enable HTTP/2 interop tests')
-
+
args = argp.parse_args()
servers = set(s for s in itertools.chain.from_iterable(_SERVERS
@@ -571,7 +587,7 @@ languages = set(_LANGUAGES[l]
for l in itertools.chain.from_iterable(
_LANGUAGES.iterkeys() if x == 'all' else [x]
for x in args.language))
-
+
http2Interop = Http2Client() if args.http2_interop else None
docker_images={}
@@ -593,10 +609,10 @@ if args.use_docker:
num_failures, _ = jobset.run(
build_jobs, newline_on_success=True, maxjobs=args.jobs)
if num_failures == 0:
- jobset.message('SUCCESS', 'All docker images built successfully.',
+ jobset.message('SUCCESS', 'All docker images built successfully.',
do_newline=True)
else:
- jobset.message('FAILED', 'Failed to build interop docker images.',
+ jobset.message('FAILED', 'Failed to build interop docker images.',
do_newline=True)
for image in docker_images.itervalues():
dockerjob.remove_image(image, skip_nonexistent=True)
@@ -622,7 +638,7 @@ try:
test_job = cloud_to_prod_jobspec(language, test_case,
docker_image=docker_images.get(str(language)))
jobs.append(test_job)
-
+
# TODO(carl-mastrangelo): Currently prod TLS terminators aren't spec compliant. Reenable
# this once a better solution is in place.
if args.http2_interop and False:
@@ -630,7 +646,7 @@ try:
test_job = cloud_to_prod_jobspec(http2Interop, test_case,
docker_image=docker_images.get(str(http2Interop)))
jobs.append(test_job)
-
+
if args.cloud_to_prod_auth:
for language in languages:
@@ -658,9 +674,12 @@ try:
server_port,
docker_image=docker_images.get(str(language)))
jobs.append(test_job)
-
+
if args.http2_interop:
for test_case in _HTTP2_TEST_CASES:
+ if server_name == "go":
+ # TODO(carl-mastrangelo): Reenable after https://github.com/grpc/grpc-go/issues/434
+ continue
test_job = cloud_to_cloud_jobspec(http2Interop,
test_case,
server_name,
@@ -675,7 +694,7 @@ try:
dockerjob.remove_image(image, skip_nonexistent=True)
sys.exit(1)
- num_failures, resultset = jobset.run(jobs, newline_on_success=True,
+ num_failures, resultset = jobset.run(jobs, newline_on_success=True,
maxjobs=args.jobs)
if num_failures:
jobset.message('FAILED', 'Some tests failed', do_newline=True)
@@ -683,7 +702,7 @@ try:
jobset.message('SUCCESS', 'All tests passed', do_newline=True)
report_utils.render_junit_xml_report(resultset, 'report.xml')
-
+
report_utils.render_interop_html_report(
set([str(l) for l in languages]), servers, _TEST_CASES, _AUTH_TEST_CASES,
_HTTP2_TEST_CASES, resultset, num_failures,
diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh
index 848775e9b1..042b40485d 100755
--- a/tools/run_tests/run_python.sh
+++ b/tools/run_tests/run_python.sh
@@ -34,10 +34,18 @@ set -ex
cd $(dirname $0)/../..
ROOT=`pwd`
-GRPCIO_TEST=$ROOT/src/python/grpcio_test
+GRPCIO=$ROOT/src/python/grpcio
export LD_LIBRARY_PATH=$ROOT/libs/$CONFIG
export DYLD_LIBRARY_PATH=$ROOT/libs/$CONFIG
export PATH=$ROOT/bins/$CONFIG:$ROOT/bins/$CONFIG/protobuf:$PATH
-source "python"$PYVER"_virtual_environment"/bin/activate
+export CFLAGS="-I$ROOT/include -std=c89"
+export LDFLAGS="-L$ROOT/libs/$CONFIG"
+export GRPC_PYTHON_BUILD_WITH_CYTHON=1
+export GRPC_PYTHON_ENABLE_CYTHON_TRACING=1
-"python"$PYVER $GRPCIO_TEST/setup.py test -a "-n8 --cov=grpc --junitxml=./report.xml --timeout=300 -v --boxed --timeout_method=thread"
+cd $GRPCIO
+tox
+
+mkdir -p $ROOT/reports
+rm -rf $ROOT/reports/python-coverage
+(mv -T $GRPCIO/htmlcov $ROOT/reports/python-coverage) || true
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 28f6ae50a0..ac3c420ec0 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -705,6 +705,20 @@
{
"deps": [
"gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "language": "c",
+ "name": "invalid_call_argument_test",
+ "src": [
+ "test/core/end2end/invalid_call_argument_test.c"
+ ]
+ },
+ {
+ "deps": [
+ "gpr",
"grpc"
],
"headers": [],
diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json
index d57a12ee8a..c97120928c 100644
--- a/tools/run_tests/tests.json
+++ b/tools/run_tests/tests.json
@@ -807,6 +807,24 @@
"exclude_configs": [],
"flaky": false,
"language": "c",
+ "name": "invalid_call_argument_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ]
+ },
+ {
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ],
+ "exclude_configs": [],
+ "flaky": false,
+ "language": "c",
"name": "json_rewrite_test",
"platforms": [
"linux",