diff options
author | Craig Tiller <ctiller@google.com> | 2016-02-24 22:22:57 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-02-24 22:22:57 -0800 |
commit | ca62ff014b4a33f9ce6bf5f75786c1b282f48c60 (patch) | |
tree | 0998a1401eb93b1764fd05b0b3c6880b522b3a41 /tools/run_tests/run_tests.py | |
parent | c333cc9305f92434af132e7a3c328467faa28bd0 (diff) |
Expand gtest suites into individual run_tests tests
Diffstat (limited to 'tools/run_tests/run_tests.py')
-rwxr-xr-x | tools/run_tests/run_tests.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 7b2bc53716..bdda368674 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -160,12 +160,34 @@ 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']: + 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 + else: + assert base is not None + assert line[1] == ' ' + test = base + line[2:] + 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) |