aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-03-05 15:45:46 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-03-05 15:45:46 -0800
commit68de8e91cc8e991b7f70c0ce988dcc8e1488a187 (patch)
tree9870605ed36886b10ffc50d9b7af23280bebcf25 /tools/run_tests
parent0642863b7338e031ae3ab34aede53a2f764380fd (diff)
parent2f364c0bb00b07e7f841809d266d53ab5c18b358 (diff)
Merge github.com:grpc/grpc into credit
Diffstat (limited to 'tools/run_tests')
-rwxr-xr-xtools/run_tests/build_node.sh8
-rwxr-xr-xtools/run_tests/jobset.py6
-rwxr-xr-xtools/run_tests/python_tests.json18
-rwxr-xr-xtools/run_tests/run_node.sh4
-rwxr-xr-xtools/run_tests/run_python.sh22
-rwxr-xr-xtools/run_tests/run_tests.py91
6 files changed, 108 insertions, 41 deletions
diff --git a/tools/run_tests/build_node.sh b/tools/run_tests/build_node.sh
index c3e88c565d..c85ecf1b25 100755
--- a/tools/run_tests/build_node.sh
+++ b/tools/run_tests/build_node.sh
@@ -36,12 +36,8 @@ CONFIG=${CONFIG:-opt}
# change to grpc repo root
cd $(dirname $0)/../..
-# tells npm install to look for files in that directory
-export GRPC_ROOT=`pwd`
-# tells npm install the subdirectory with library files
-export GRPC_LIB_SUBDIR=libs/$CONFIG
-# tells npm install not to use default locations
-export GRPC_NO_INSTALL=yes
+export CXXFLAGS=-I`pwd`/include
+export LDFLAGS=-L`pwd`/libs/$CONFIG
cd src/node
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py
index ad65da535b..26caf031c3 100755
--- a/tools/run_tests/jobset.py
+++ b/tools/run_tests/jobset.py
@@ -136,7 +136,7 @@ def which(filename):
class JobSpec(object):
"""Specifies what to run for a job."""
- def __init__(self, cmdline, shortname=None, environ={}, hash_targets=[]):
+ def __init__(self, cmdline, shortname=None, environ=None, hash_targets=None):
"""
Arguments:
cmdline: a list of arguments to pass as the command line
@@ -144,6 +144,10 @@ class JobSpec(object):
hash_targets: which files to include in the hash representing the jobs version
(or empty, indicating the job should not be hashed)
"""
+ if environ is None:
+ environ = {}
+ if hash_targets is None:
+ hash_targets = []
self.cmdline = cmdline
self.environ = environ
self.shortname = cmdline[0] if shortname is None else shortname
diff --git a/tools/run_tests/python_tests.json b/tools/run_tests/python_tests.json
new file mode 100755
index 0000000000..9e5b1365e6
--- /dev/null
+++ b/tools/run_tests/python_tests.json
@@ -0,0 +1,18 @@
+[
+ "grpc._adapter._blocking_invocation_inline_service_test",
+ "grpc._adapter._c_test",
+ "grpc._adapter._event_invocation_synchronous_event_service_test",
+ "grpc._adapter._future_invocation_asynchronous_event_service_test",
+ "grpc._adapter._links_test",
+ "grpc._adapter._lonely_rear_link_test",
+ "grpc._adapter._low_test",
+ "grpc.early_adopter.implementations_test",
+ "grpc.framework.assembly.implementations_test",
+ "grpc.framework.base.packets.implementations_test",
+ "grpc.framework.face.blocking_invocation_inline_service_test",
+ "grpc.framework.face.event_invocation_synchronous_event_service_test",
+ "grpc.framework.face.future_invocation_asynchronous_event_service_test",
+ "grpc.framework.foundation._later_test",
+ "grpc.framework.foundation._logging_pool_test"
+]
+
diff --git a/tools/run_tests/run_node.sh b/tools/run_tests/run_node.sh
index ccf1b9d6f5..3a82c04a8e 100755
--- a/tools/run_tests/run_node.sh
+++ b/tools/run_tests/run_node.sh
@@ -30,9 +30,13 @@
set -ex
+CONFIG=${CONFIG:-opt}
+
# change to grpc repo root
cd $(dirname $0)/../..
root=`pwd`
+export LD_LIBRARY_PATH=$root/libs/$CONFIG
+
$root/src/node/node_modules/mocha/bin/mocha $root/src/node/test
diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh
index 9c7dea008d..403862b0a0 100755
--- a/tools/run_tests/run_python.sh
+++ b/tools/run_tests/run_python.sh
@@ -36,24 +36,4 @@ cd $(dirname $0)/../..
root=`pwd`
export LD_LIBRARY_PATH=$root/libs/opt
source python2.7_virtual_environment/bin/activate
-# TODO(issue 215): Properly itemize these in run_tests.py so that they can be parallelized.
-# TODO(atash): Enable dynamic unused port discovery for this test.
-# TODO(mlumish): Re-enable this test when we can install protoc
-# python2.7 -B test/compiler/python_plugin_test.py --build_mode=opt
-python2.7 -B -m grpc._adapter._blocking_invocation_inline_service_test
-python2.7 -B -m grpc._adapter._c_test
-python2.7 -B -m grpc._adapter._event_invocation_synchronous_event_service_test
-python2.7 -B -m grpc._adapter._future_invocation_asynchronous_event_service_test
-python2.7 -B -m grpc._adapter._links_test
-python2.7 -B -m grpc._adapter._lonely_rear_link_test
-python2.7 -B -m grpc._adapter._low_test
-python2.7 -B -m grpc.early_adopter.implementations_test
-python2.7 -B -m grpc.framework.assembly.implementations_test
-python2.7 -B -m grpc.framework.base.packets.implementations_test
-python2.7 -B -m grpc.framework.face.blocking_invocation_inline_service_test
-python2.7 -B -m grpc.framework.face.event_invocation_synchronous_event_service_test
-python2.7 -B -m grpc.framework.face.future_invocation_asynchronous_event_service_test
-python2.7 -B -m grpc.framework.foundation._later_test
-python2.7 -B -m grpc.framework.foundation._logging_pool_test
-# TODO(nathaniel): Get tests working under 3.4 (requires 3.X-friendly protobuf)
-# python3.4 -B -m unittest discover -s src/python -p '*.py'
+python2.7 -B -m $*
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 23ef475db6..baad727e51 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -51,14 +51,28 @@ os.chdir(ROOT)
# SimpleConfig: just compile with CONFIG=config, and run the binary to test
class SimpleConfig(object):
- def __init__(self, config, environ={}):
+ def __init__(self, config, environ=None):
+ if environ is None:
+ environ = {}
self.build_config = config
self.maxjobs = 2 * multiprocessing.cpu_count()
self.allow_hashing = (config != 'gcov')
self.environ = environ
-
- def job_spec(self, binary, hash_targets):
- return jobset.JobSpec(cmdline=[binary],
+ self.environ['CONFIG'] = config
+
+ def job_spec(self, cmdline, hash_targets):
+ """Construct a jobset.JobSpec for a test under this config
+
+ Args:
+ cmdline: a list of strings specifying the command line the test
+ would like to run
+ hash_targets: either None (don't do caching of test results), or
+ a list of strings specifying files to include in a
+ binary hash to check if a test has changed
+ -- if used, all artifacts needed to run the test must
+ be listed
+ """
+ return jobset.JobSpec(cmdline=cmdline,
environ=self.environ,
hash_targets=hash_targets
if self.allow_hashing else None)
@@ -67,16 +81,18 @@ class SimpleConfig(object):
# ValgrindConfig: compile with some CONFIG=config, but use valgrind to run
class ValgrindConfig(object):
- def __init__(self, config, tool, args=[]):
+ def __init__(self, config, tool, args=None):
+ if args is None:
+ args = []
self.build_config = config
self.tool = tool
self.args = args
self.maxjobs = 2 * multiprocessing.cpu_count()
self.allow_hashing = False
- def job_spec(self, binary, hash_targets):
+ def job_spec(self, cmdline, hash_targets):
return jobset.JobSpec(cmdline=['valgrind', '--tool=%s' % self.tool] +
- self.args + [binary],
+ self.args + cmdline,
shortname='valgrind %s' % binary,
hash_targets=None)
@@ -95,7 +111,7 @@ class CLanguage(object):
if travis and target['flaky']:
continue
binary = 'bins/%s/%s' % (config.build_config, target['name'])
- out.append(config.job_spec(binary, [binary]))
+ out.append(config.job_spec([binary], [binary]))
return out
def make_targets(self):
@@ -104,11 +120,17 @@ class CLanguage(object):
def build_steps(self):
return []
+ def supports_multi_config(self):
+ return True
+
+ def __str__(self):
+ return self.make_target
+
class NodeLanguage(object):
def test_specs(self, config, travis):
- return [config.job_spec('tools/run_tests/run_node.sh', None)]
+ return [config.job_spec(['tools/run_tests/run_node.sh'], None)]
def make_targets(self):
return ['static_c']
@@ -116,11 +138,17 @@ class NodeLanguage(object):
def build_steps(self):
return [['tools/run_tests/build_node.sh']]
+ def supports_multi_config(self):
+ return False
+
+ def __str__(self):
+ return 'node'
+
class PhpLanguage(object):
def test_specs(self, config, travis):
- return [config.job_spec('src/php/bin/run_tests.sh', None)]
+ return [config.job_spec(['src/php/bin/run_tests.sh'], None)]
def make_targets(self):
return ['static_c']
@@ -128,11 +156,22 @@ class PhpLanguage(object):
def build_steps(self):
return [['tools/run_tests/build_php.sh']]
+ def supports_multi_config(self):
+ return False
+
+ def __str__(self):
+ return 'php'
+
class PythonLanguage(object):
+ def __init__(self):
+ with open('tools/run_tests/python_tests.json') as f:
+ self._tests = json.load(f)
+
def test_specs(self, config, travis):
- return [config.job_spec('tools/run_tests/run_python.sh', None)]
+ return [config.job_spec(['tools/run_tests/run_python.sh', test], None)
+ for test in self._tests]
def make_targets(self):
return ['static_c']
@@ -140,10 +179,16 @@ class PythonLanguage(object):
def build_steps(self):
return [['tools/run_tests/build_python.sh']]
+ def supports_multi_config(self):
+ return False
+
+ def __str__(self):
+ return 'python'
+
class RubyLanguage(object):
def test_specs(self, config, travis):
- return [config.job_spec('tools/run_tests/run_ruby.sh', None)]
+ return [config.job_spec(['tools/run_tests/run_ruby.sh'], None)]
def make_targets(self):
return ['static_c']
@@ -151,6 +196,12 @@ class RubyLanguage(object):
def build_steps(self):
return [['tools/run_tests/build_ruby.sh']]
+ def supports_multi_config(self):
+ return False
+
+ def __str__(self):
+ return 'ruby'
+
class CSharpLanguage(object):
def test_specs(self, config, travis):
@@ -162,6 +213,12 @@ class CSharpLanguage(object):
def build_steps(self):
return [['tools/run_tests/build_csharp.sh']]
+ def supports_multi_config(self):
+ return False
+
+ def __str__(self):
+ return 'csharp'
+
# different configurations we can run under
_CONFIGS = {
'dbg': SimpleConfig('dbg'),
@@ -226,6 +283,13 @@ build_configs = set(cfg.build_config for cfg in run_configs)
make_targets = []
languages = set(_LANGUAGES[l] for l in args.language)
+
+if len(build_configs) > 1:
+ for language in languages:
+ if not language.supports_multi_config():
+ print language, 'does not support multiple build configurations'
+ sys.exit(1)
+
build_steps = [jobset.JobSpec(['make',
'-j', '%d' % (multiprocessing.cpu_count() + 1),
'EXTRA_DEFINES=GRPC_TEST_SLOWDOWN_MACHINE_FACTOR=%f' % args.slowdown,
@@ -233,7 +297,8 @@ build_steps = [jobset.JobSpec(['make',
itertools.chain.from_iterable(
l.make_targets() for l in languages))))
for cfg in build_configs] + list(set(
- jobset.JobSpec(cmdline)
+ jobset.JobSpec(cmdline, environ={'CONFIG': cfg})
+ for cfg in build_configs
for l in languages
for cmdline in l.build_steps()))
one_run = set(