[Lldb-commits] [lldb] r363536 - [lldb] [test] Skip watchpoint tests on NetBSD if userdbregs is disabled

Michal Gorny via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 17 02:49:06 PDT 2019


Author: mgorny
Date: Mon Jun 17 02:49:05 2019
New Revision: 363536

URL: http://llvm.org/viewvc/llvm-project?rev=363536&view=rev
Log:
[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

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/dotest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=363536&r1=363535&r2=363536&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Jun 17 02:49:05 2019
@@ -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.




More information about the lldb-commits mailing list