summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorJordan Rupprecht <rupprecht@google.com>2019-12-10 16:48:33 -0800
committerJordan Rupprecht <rupprecht@google.com>2019-12-11 13:38:05 -0800
commit34ef51b5f97933ba12d857d2da8b0d7c133320ce (patch)
tree1041963ac43ec0bf123cc3f8b607e053288753c7 /lldb/packages/Python/lldbsuite
parent5c9816b84e94dd380e7b07ac15f619513a7911a8 (diff)
downloadbcm5719-llvm-34ef51b5f97933ba12d857d2da8b0d7c133320ce.tar.gz
bcm5719-llvm-34ef51b5f97933ba12d857d2da8b0d7c133320ce.zip
[lldb][dotest] Improve libc++ detection
Summary: The test logic for running libc++ tests only looks to see if `/usr/include/c++/v1` exists. This adds a fallback for including libc++ tests as long as `$(CC) -stdlib=libc++` works. Reviewers: labath, EricWF Subscribers: ldionne, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71319
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index b7a52663a43..fa2b3cb15a9 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -32,6 +32,7 @@ import re
import signal
import subprocess
import sys
+import tempfile
# Third-party modules
import six
@@ -850,9 +851,15 @@ def canRunLibcxxTests():
return True, "libc++ always present"
if platform == "linux":
- if not os.path.isdir("/usr/include/c++/v1"):
- return False, "Unable to find libc++ installation"
- return True, "Headers found, let's hope they work"
+ if os.path.isdir("/usr/include/c++/v1"):
+ return True, "Headers found, let's hope they work"
+ with tempfile.NamedTemporaryFile() as f:
+ cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-o", f.name, "-"]
+ p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
+ _, stderr = p.communicate("int main() {}")
+ if not p.returncode:
+ return True, "Compiling with -stdlib=libc++ works"
+ return False, "Compiling with -stdlib=libc++ fails with the error: %s" % stderr
return False, "Don't know how to build with libc++ on %s" % platform
OpenPOWER on IntegriCloud