aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests/run_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/run_tests/run_tests.py')
-rwxr-xr-xtools/run_tests/run_tests.py38
1 files changed, 32 insertions, 6 deletions
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 7b2bc53716..75de4cb71d 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -160,12 +160,38 @@ class CLanguage(object):
else:
binary = 'bins/%s/%s' % (self.config.build_config, target['name'])
if os.path.isfile(binary):
- cmdline = [binary] + target['args']
- out.append(self.config.job_spec(cmdline, [binary],
- shortname=' '.join(cmdline),
- cpu_cost=target['cpu_cost'],
- environ={'GRPC_DEFAULT_SSL_ROOTS_FILE_PATH':
- _ROOT + '/src/core/tsi/test_creds/ca.pem'}))
+ if 'gtest' in target and target['gtest']:
+ # here we parse the output of --gtest_list_tests to build up a
+ # complete list of the tests contained in a binary
+ # for each test, we then add a job to run, filtering for just that
+ # test
+ with open(os.devnull, 'w') as fnull:
+ tests = subprocess.check_output([binary, '--gtest_list_tests'],
+ stderr=fnull)
+ base = None
+ for line in tests.split('\n'):
+ i = line.find('#')
+ if i >= 0: line = line[:i]
+ if not line: continue
+ if line[0] != ' ':
+ base = line.strip()
+ else:
+ assert base is not None
+ assert line[1] == ' '
+ test = base + line.strip()
+ cmdline = [binary] + ['--gtest_filter=%s' % test]
+ out.append(self.config.job_spec(cmdline, [binary],
+ shortname='%s:%s' % (binary, test),
+ cpu_cost=target['cpu_cost'],
+ environ={'GRPC_DEFAULT_SSL_ROOTS_FILE_PATH':
+ _ROOT + '/src/core/tsi/test_creds/ca.pem'}))
+ else:
+ cmdline = [binary] + target['args']
+ out.append(self.config.job_spec(cmdline, [binary],
+ shortname=' '.join(cmdline),
+ cpu_cost=target['cpu_cost'],
+ environ={'GRPC_DEFAULT_SSL_ROOTS_FILE_PATH':
+ _ROOT + '/src/core/tsi/test_creds/ca.pem'}))
elif self.args.regex == '.*' or self.platform == 'windows':
print '\nWARNING: binary not found, skipping', binary
return sorted(out)