aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tools/run_tests')
-rwxr-xr-xtools/run_tests/build_artifacts.py2
-rwxr-xr-xtools/run_tests/build_node.sh4
-rwxr-xr-xtools/run_tests/run_tests.py126
-rw-r--r--tools/run_tests/sanity_tests.yaml4
4 files changed, 83 insertions, 53 deletions
diff --git a/tools/run_tests/build_artifacts.py b/tools/run_tests/build_artifacts.py
index ff9dd4735a..0337f1b3d7 100755
--- a/tools/run_tests/build_artifacts.py
+++ b/tools/run_tests/build_artifacts.py
@@ -135,7 +135,7 @@ class CSharpExtArtifact:
'EMBED_ZLIB': 'true'}
if self.platform == 'linux':
return create_docker_jobspec(self.name,
- 'tools/jenkins/grpc_artifact_linux_%s' % self.arch,
+ 'tools/dockerfile/grpc_artifact_linux_%s' % self.arch,
'tools/run_tests/build_artifact_csharp.sh')
else:
environ.update(macos_arch_env(self.arch))
diff --git a/tools/run_tests/build_node.sh b/tools/run_tests/build_node.sh
index faa7b624b8..8f2ab4413a 100755
--- a/tools/run_tests/build_node.sh
+++ b/tools/run_tests/build_node.sh
@@ -1,6 +1,6 @@
#!/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
@@ -36,4 +36,4 @@ CONFIG=${CONFIG:-opt}
# change to grpc repo root
cd $(dirname $0)/../..
-npm install --unsafe-perm
+npm install --unsafe-perm --build-from-source
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index f8b01021c8..488af3b4da 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -452,7 +452,7 @@ 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']], None, timeout_seconds=None, environ={'TEST': 'true'}, cpu_cost=cmd.get('cpu_cost', 1))
+ 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):
@@ -538,15 +538,37 @@ _WINDOWS_CONFIG = {
def _windows_arch_option(arch):
"""Returns msbuild cmdline option for selected architecture."""
- if arch == 'default' or arch == 'windows_x86':
+ if arch == 'default' or arch == 'x86':
return '/p:Platform=Win32'
- elif arch == 'windows_x64':
+ elif arch == 'x64':
return '/p:Platform=x64'
else:
- print 'Architecture %s not supported on current platform.' % arch
+ print 'Architecture %s not supported.' % arch
sys.exit(1)
-
+
+def _check_arch_option(arch):
+ """Checks that architecture option is valid."""
+ if platform_string() == 'windows':
+ _windows_arch_option(arch)
+ elif platform_string() == 'linux':
+ # On linux, we need to be running under docker with the right architecture.
+ runtime_arch = platform.architecture()[0]
+ if arch == 'default':
+ return
+ elif runtime_arch == '64bit' and arch == 'x64':
+ return
+ elif runtime_arch == '32bit' and arch == 'x86':
+ return
+ else:
+ print 'Architecture %s does not match current runtime architecture.' % arch
+ sys.exit(1)
+ else:
+ if args.arch != 'default':
+ print 'Architecture %s not supported on current platform.' % args.arch
+ sys.exit(1)
+
+
def _windows_build_bat(compiler):
"""Returns name of build.bat for selected compiler."""
if compiler == 'default' or compiler == 'vs2013':
@@ -558,8 +580,8 @@ def _windows_build_bat(compiler):
else:
print 'Compiler %s not supported.' % compiler
sys.exit(1)
-
-
+
+
def _windows_toolset_option(compiler):
"""Returns msbuild PlatformToolset for selected compiler."""
if compiler == 'default' or compiler == 'vs2013':
@@ -571,7 +593,17 @@ def _windows_toolset_option(compiler):
else:
print 'Compiler %s not supported.' % compiler
sys.exit(1)
-
+
+
+def _get_dockerfile_dir(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'
+ 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.
@@ -638,7 +670,7 @@ argp.add_argument('--allow_flakes',
const=True,
help='Allow flaky tests to show as passing (re-runs failed tests up to five times)')
argp.add_argument('--arch',
- choices=['default', 'windows_x86', 'windows_x64'],
+ choices=['default', 'x86', 'x64'],
default='default',
help='Selects architecture to target. For some platforms "default" is the only supported choice.')
argp.add_argument('--compiler',
@@ -662,36 +694,6 @@ args = argp.parse_args()
jobset.measure_cpu_costs = args.measure_cpu_costs
-if args.use_docker:
- if not args.travis:
- print 'Seen --use_docker flag, will run tests under docker.'
- print
- print 'IMPORTANT: The changes you are testing need to be locally committed'
- print 'because only the committed changes in the current branch will be'
- print 'copied to the docker environment.'
- time.sleep(5)
-
- child_argv = [ arg for arg in sys.argv if not arg == '--use_docker' ]
- run_tests_cmd = 'tools/run_tests/run_tests.py %s' % ' '.join(child_argv[1:])
-
- # TODO(jtattermusch): revisit if we need special handling for arch here
- # set arch command prefix in case we are working with different arch.
- arch_env = os.getenv('arch')
- if arch_env:
- run_test_cmd = 'arch %s %s' % (arch_env, run_test_cmd)
-
- env = os.environ.copy()
- env['RUN_TESTS_COMMAND'] = run_tests_cmd
- if args.xml_report:
- env['XML_REPORT'] = args.xml_report
- if not args.travis:
- env['TTY_FLAG'] = '-t' # enables Ctrl-C when not on Jenkins.
-
- subprocess.check_call(['tools/jenkins/build_docker_and_run_tests.sh'],
- shell=True,
- env=env)
- sys.exit(0)
-
# update submodules if necessary
need_to_regenerate_projects = False
for spec in args.update_submodules:
@@ -755,16 +757,44 @@ if any(language.make_options() for language in languages):
else:
language_make_options = next(iter(languages)).make_options()
-if platform_string() != 'windows':
- if args.arch != 'default':
- print 'Architecture %s not supported on current platform.' % args.arch
- sys.exit(1)
- if args.compiler != 'default':
+if len(languages) != 1 or len(build_configs) != 1:
+ print 'Multi-language and multi-config testing is not supported.'
+ sys.exit(1)
+
+if args.use_docker:
+ if not args.travis:
+ print 'Seen --use_docker flag, will run tests under docker.'
+ print
+ print 'IMPORTANT: The changes you are testing need to be locally committed'
+ print 'because only the committed changes in the current branch will be'
+ print 'copied to the docker environment.'
+ time.sleep(5)
+
+ child_argv = [ arg for arg in sys.argv if not arg == '--use_docker' ]
+ run_tests_cmd = 'tools/run_tests/run_tests.py %s' % ' '.join(child_argv[1:])
+
+ env = os.environ.copy()
+ env['RUN_TESTS_COMMAND'] = run_tests_cmd
+ env['DOCKERFILE_DIR'] = _get_dockerfile_dir(args.arch)
+ env['DOCKER_RUN_SCRIPT'] = 'tools/jenkins/docker_run_tests.sh'
+ if args.xml_report:
+ env['XML_REPORT'] = args.xml_report
+ if not args.travis:
+ env['TTY_FLAG'] = '-t' # enables Ctrl-C when not on Jenkins.
+
+ subprocess.check_call(['tools/jenkins/build_docker_and_run_tests.sh'],
+ 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)
-if platform_string() == 'windows':
- def make_jobspec(cfg, targets, makefile='Makefile'):
+_check_arch_option(args.arch)
+
+def make_jobspec(cfg, targets, makefile='Makefile'):
+ if platform_string() == 'windows':
extra_args = []
# better do parallel compilation
# empirically /m:2 gives the best performance/price and should prevent
@@ -782,8 +812,7 @@ if platform_string() == 'windows':
language_make_options,
shell=True, timeout_seconds=None)
for target in targets]
-else:
- def make_jobspec(cfg, targets, makefile='Makefile'):
+ else:
if targets:
return [jobset.JobSpec([os.getenv('MAKE', 'make'),
'-f', makefile,
@@ -796,6 +825,7 @@ else:
timeout_seconds=None)]
else:
return []
+
make_targets = {}
for l in languages:
makefile = l.makefile_name()
diff --git a/tools/run_tests/sanity_tests.yaml b/tools/run_tests/sanity_tests.yaml
index 160acde565..757bcd9d34 100644
--- a/tools/run_tests/sanity_tests.yaml
+++ b/tools/run_tests/sanity_tests.yaml
@@ -2,8 +2,8 @@
- 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/buildgen/generate_projects.sh
- cpu_cost: 100
+- script: tools/buildgen/generate_projects.sh -j 3
+ cpu_cost: 3
- script: tools/distrib/check_copyright.py
- script: tools/distrib/clang_format_code.sh
- script: tools/distrib/check_trailing_newlines.sh