diff options
Diffstat (limited to 'utils/lit/lit/formats/googletest.py')
-rw-r--r-- | utils/lit/lit/formats/googletest.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/utils/lit/lit/formats/googletest.py b/utils/lit/lit/formats/googletest.py index 342c8153a3fc..29a92c4e960b 100644 --- a/utils/lit/lit/formats/googletest.py +++ b/utils/lit/lit/formats/googletest.py @@ -30,22 +30,19 @@ class GoogleTest(TestFormat): localConfig: TestingConfig instance""" try: - output = subprocess.check_output([path, '--gtest_list_tests'], - env=localConfig.environment) - except subprocess.CalledProcessError as exc: - litConfig.warning( - "unable to discover google-tests in %r: %s. Process output: %s" - % (path, sys.exc_info()[1], exc.output)) + lines = lit.util.capture([path, '--gtest_list_tests'], + env=localConfig.environment) + if kIsWindows: + lines = lines.replace('\r', '') + lines = lines.split('\n') + except Exception as exc: + out = exc.output if isinstance(exc, subprocess.CalledProcessError) else '' + litConfig.warning("unable to discover google-tests in %r: %s. Process output: %s" + % (path, sys.exc_info()[1], out)) raise StopIteration nested_tests = [] - for ln in output.splitlines(False): # Don't keep newlines. - if 'Running main() from gtest_main.cc' in ln: - # Upstream googletest prints this to stdout prior to running - # tests. LLVM removed that print statement in r61540, but we - # handle it here in case upstream googletest is being used. - continue - + for ln in lines: # The test name list includes trailing comments beginning with # a '#' on some lines, so skip those. We don't support test names # that use escaping to embed '#' into their name as the names come @@ -55,6 +52,12 @@ class GoogleTest(TestFormat): if not ln.lstrip(): continue + if 'Running main() from gtest_main.cc' in ln: + # Upstream googletest prints this to stdout prior to running + # tests. LLVM removed that print statement in r61540, but we + # handle it here in case upstream googletest is being used. + continue + index = 0 while ln[index*2:index*2+2] == ' ': index += 1 |