aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test/dotest.py
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-03-29 21:01:14 +0000
committerPavel Labath <labath@google.com>2017-03-29 21:01:14 +0000
commit01a28ca7f8f0999527ffa2d86f6e77b374ef1ed6 (patch)
tree3231941a45c8d56f0cb2c56c86d5772798a7a5d8 /lldb/packages/Python/lldbsuite/test/dotest.py
parent32093a1c28250bc08a8b69d63aa91c358f7d42fb (diff)
downloadllvm-01a28ca7f8f0999527ffa2d86f6e77b374ef1ed6.zip
llvm-01a28ca7f8f0999527ffa2d86f6e77b374ef1ed6.tar.gz
llvm-01a28ca7f8f0999527ffa2d86f6e77b374ef1ed6.tar.bz2
Centralize libc++ test skipping logic
Summary: This aims to replace the different decorators we've had on each libc++ test with a single solution. Each libc++ will be assigned to the "libc++" category and a single central piece of code will decide whether we are actually able to run libc++ test in the given configuration by enabling or disabling the category (while giving the user the opportunity to override this). I started this effort because I wanted to get libc++ tests running on android, and none of the existing decorators worked for this use case: - skipIfGcc - incorrect, we can build libc++ executables on android with gcc (in fact, after this, we can now do it on linux as well) - lldbutil.skip_if_library_missing - this checks whether libc++.so is loaded in the proces, which fails in case of a statically linked libc++ (this makes copying executables to the remote target easier to manage). To make this work I needed to split out the pseudo_barrier code from the force-included file, as libc++'s atomic does not play well with gcc on linux, and this made every test fail, even though we need the code only in the threading tests. So far, I am only annotating one of the tests with this category. If this does not break anything, I'll proceed to update the rest. Reviewers: jingham, zturner, EricWF Subscribers: srhines, lldb-commits Differential Revision: https://reviews.llvm.org/D30984 llvm-svn: 299028
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/dotest.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index a6bb01e..7d739ac 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1061,6 +1061,29 @@ def checkCompiler():
configuration.compiler = cmd_output.split('\n')[0]
print("'xcrun -find %s' returning %s" % (c, configuration.compiler))
+def canRunLibcxxTests():
+ from lldbsuite.test import lldbplatformutil
+
+ platform = lldbplatformutil.getPlatform()
+
+ if lldbplatformutil.target_is_android() or lldbplatformutil.platformIsDarwin():
+ 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"
+
+ return False, "Don't know how to build with libc++ on %s" % platform
+
+def checkLibcxxSupport():
+ result, reason = canRunLibcxxTests()
+ if result:
+ return # libc++ supported
+ if "libc++" in configuration.categoriesList:
+ return # libc++ category explicitly requested, let it run.
+ print("Libc++ tests will not be run because: " + reason)
+ configuration.skipCategories.append("libc++")
def run_suite():
# On MacOS X, check to make sure that domain for com.apple.DebugSymbols defaults
@@ -1164,6 +1187,8 @@ def run_suite():
target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+ checkLibcxxSupport()
+
# Don't do debugserver tests on everything except OS X.
configuration.dont_do_debugserver_test = "linux" in target_platform or "freebsd" in target_platform or "windows" in target_platform