[llvm] r280455 - [lit] Fail testing if a googletest executable crashes during test discovery
Greg Parker via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 1 19:44:07 PDT 2016
Author: gparker
Date: Thu Sep 1 21:44:07 2016
New Revision: 280455
URL: http://llvm.org/viewvc/llvm-project?rev=280455&view=rev
Log:
[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.
Modified:
llvm/trunk/utils/lit/lit/formats/googletest.py
llvm/trunk/utils/lit/lit/util.py
Modified: llvm/trunk/utils/lit/lit/formats/googletest.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/formats/googletest.py?rev=280455&r1=280454&r2=280455&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/formats/googletest.py (original)
+++ llvm/trunk/utils/lit/lit/formats/googletest.py Thu Sep 1 21:44:07 2016
@@ -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 = []
Modified: llvm/trunk/utils/lit/lit/util.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/util.py?rev=280455&r1=280454&r2=280455&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/util.py (original)
+++ llvm/trunk/utils/lit/lit/util.py Thu Sep 1 21:44:07 2016
@@ -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):
More information about the llvm-commits
mailing list