summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/dotest.py
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2019-06-17 09:49:05 +0000
committerMichal Gorny <mgorny@gentoo.org>2019-06-17 09:49:05 +0000
commit43cf5ae48a0c823d40d78e24cafce4ef6dfa76a9 (patch)
treec01f50b22c759b5479bb6628681798896fb5b517 /lldb/packages/Python/lldbsuite/test/dotest.py
parent4bde5d3c08182dec9faa3f6d0d66f584f7366c9a (diff)
downloadbcm5719-llvm-43cf5ae48a0c823d40d78e24cafce4ef6dfa76a9.tar.gz
bcm5719-llvm-43cf5ae48a0c823d40d78e24cafce4ef6dfa76a9.zip
[lldb] [test] Skip watchpoint tests on NetBSD if userdbregs is disabled
Skip watchpoint tests if security.models.extensions.user_set_dbregs is disabled. This indicates that unprivileged processes are not allowed to write to debug registers which is a prerequisite for using hardware watchpoints. Differential Revision: https://reviews.llvm.org/D63380 llvm-svn: 363536
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 b406def22f7..77ce5828c99 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1181,6 +1181,30 @@ def checkLibstdcxxSupport():
print("libstdcxx tests will not be run because: " + reason)
configuration.skipCategories.append("libstdcxx")
+def canRunWatchpointTests():
+ from lldbsuite.test import lldbplatformutil
+
+ platform = lldbplatformutil.getPlatform()
+ if platform == "netbsd":
+ try:
+ output = subprocess.check_output(["/sbin/sysctl", "-n",
+ "security.models.extensions.user_set_dbregs"]).decode().strip()
+ if output == "1":
+ return True, "security.models.extensions.user_set_dbregs enabled"
+ except subprocess.CalledProcessError:
+ pass
+ return False, "security.models.extensions.user_set_dbregs disabled"
+ return True, "watchpoint support available"
+
+def checkWatchpointSupport():
+ result, reason = canRunWatchpointTests()
+ if result:
+ return # watchpoints supported
+ if "watchpoint" in configuration.categoriesList:
+ return # watchpoint category explicitly requested, let it run.
+ print("watchpoint tests will not be run because: " + reason)
+ configuration.skipCategories.append("watchpoint")
+
def checkDebugInfoSupport():
import lldb
@@ -1305,6 +1329,7 @@ def run_suite():
checkLibcxxSupport()
checkLibstdcxxSupport()
+ checkWatchpointSupport()
checkDebugInfoSupport()
# Don't do debugserver tests on anything except OS X.
OpenPOWER on IntegriCloud