summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Parker <gparker@apple.com>2016-09-02 02:44:07 +0000
committerGreg Parker <gparker@apple.com>2016-09-02 02:44:07 +0000
commita9bac92890fdad806cc6b84261b2aff4f2a36e86 (patch)
tree59f125edb43361e3fc3781917665b55011f55e84
parenta39fd4bc532a8d277aa5d19d07a26a97e123ae8c (diff)
downloadbcm5719-llvm-a9bac92890fdad806cc6b84261b2aff4f2a36e86.tar.gz
bcm5719-llvm-a9bac92890fdad806cc6b84261b2aff4f2a36e86.zip
[lit] Fail testing if a googletest executable crashes during test discovery
googletest formatted tests are discovered by running the test executable. Previously testing would silently succeed if the test executable crashed during the discovery process. Now testing fails with "error: unable to discover google-tests ..." if the test executable exits with a non-zero status. llvm-svn: 280455
-rw-r--r--llvm/utils/lit/lit/formats/googletest.py3
-rw-r--r--llvm/utils/lit/lit/util.py5
2 files changed, 6 insertions, 2 deletions
diff --git a/llvm/utils/lit/lit/formats/googletest.py b/llvm/utils/lit/lit/formats/googletest.py
index f0250a3f96d..8796eb5af22 100644
--- a/llvm/utils/lit/lit/formats/googletest.py
+++ b/llvm/utils/lit/lit/formats/googletest.py
@@ -35,7 +35,8 @@ class GoogleTest(TestFormat):
lines = lines.replace('\r', '')
lines = lines.split('\n')
except:
- litConfig.error("unable to discover google-tests in %r" % path)
+ litConfig.error("unable to discover google-tests in %r: %s"
+ % (path, sys.exc_info()[1]))
raise StopIteration
nested_tests = []
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index 40a57716869..288931a10ab 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -65,10 +65,13 @@ def mkdir_p(path):
def capture(args, env=None):
"""capture(command) - Run the given command (or argv list) in a shell and
- return the standard output."""
+ return the standard output. Raises a CalledProcessError if the command
+ exits with a non-zero status."""
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env)
out,_ = p.communicate()
+ if p.returncode != 0:
+ raise subprocess.CalledProcessError(cmd=args, returncode=p.returncode)
return convert_string(out)
def which(command, paths = None):
OpenPOWER on IntegriCloud