From: Ivan Krasin Date: Fri, 2 Sep 2016 22:31:24 +0000 (+0000) Subject: lit: print process output, if getting the list of google-tests failed. X-Git-Tag: android-x86-7.1-r4~27647 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0c194fe701c8efe7159076997d8102ec7192b517;p=android-x86%2Fexternal-llvm.git lit: print process output, if getting the list of google-tests failed. Summary: This is a follow up to r280455, where a check for the process exit code was introduced. Some ASAN bots throw this error now, but it's impossible to understand what's wrong with them, and the issue is not reproducible. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D24210 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280550 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/lit/lit/formats/googletest.py b/utils/lit/lit/formats/googletest.py index 8796eb5af22..0cfe964d655 100644 --- a/utils/lit/lit/formats/googletest.py +++ b/utils/lit/lit/formats/googletest.py @@ -1,5 +1,6 @@ from __future__ import absolute_import import os +import subprocess import sys import lit.Test @@ -34,9 +35,10 @@ class GoogleTest(TestFormat): if kIsWindows: lines = lines.replace('\r', '') lines = lines.split('\n') - except: - litConfig.error("unable to discover google-tests in %r: %s" - % (path, sys.exc_info()[1])) + except Exception as exc: + out = exc.output if isinstance(exc, subprocess.CalledProcessError) else '' + litConfig.error("unable to discover google-tests in %r: %s. Process output: %s" + % (path, sys.exc_info()[1], out)) raise StopIteration nested_tests = [] @@ -136,4 +138,3 @@ class GoogleTest(TestFormat): return lit.Test.UNRESOLVED, msg return lit.Test.PASS,'' - diff --git a/utils/lit/lit/util.py b/utils/lit/lit/util.py index 288931a10ab..b458a94fc1d 100644 --- a/utils/lit/lit/util.py +++ b/utils/lit/lit/util.py @@ -69,9 +69,13 @@ def capture(args, env=None): exits with a non-zero status.""" p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) - out,_ = p.communicate() + out, err = p.communicate() + out = convert_string(out) + err = convert_string(err) if p.returncode != 0: - raise subprocess.CalledProcessError(cmd=args, returncode=p.returncode) + raise subprocess.CalledProcessError(cmd=args, + returncode=p.returncode, + output="{}\n{}".format(out, err)) return convert_string(out) def which(command, paths = None):