[Lldb-commits] [PATCH] D67073: [dotest] Add @skipIfCursesSupportMissing and annotate the new gui test

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 2 05:51:32 PDT 2019


labath updated this revision to Diff 218345.
labath added a comment.

Rename the function to _get_bool_config_skip_if_decorator


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67073/new/

https://reviews.llvm.org/D67073

Files:
  packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py
  packages/Python/lldbsuite/test/decorators.py
  source/API/SBDebugger.cpp


Index: source/API/SBDebugger.cpp
===================================================================
--- source/API/SBDebugger.cpp
+++ source/API/SBDebugger.cpp
@@ -624,6 +624,13 @@
   AddBoolConfigEntry(
       *config_up, "xml", XMLDocument::XMLEnabled(),
       "A boolean value that indicates if XML support is enabled in LLDB");
+  bool have_curses = true;
+#ifdef LLDB_DISABLE_CURSES
+  have_curses = false;
+#endif
+  AddBoolConfigEntry(
+      *config_up, "curses", have_curses,
+      "A boolean value that indicates if curses support is enabled in LLDB");
   AddLLVMTargets(*config_up);
 
   SBStructuredData data;
Index: packages/Python/lldbsuite/test/decorators.py
===================================================================
--- packages/Python/lldbsuite/test/decorators.py
+++ packages/Python/lldbsuite/test/decorators.py
@@ -783,13 +783,18 @@
         return None
     return skipTestIfFn(is_compiler_with_address_sanitizer)(func)
 
-def skipIfXmlSupportMissing(func):
+def _get_bool_config_skip_if_decorator(key):
     config = lldb.SBDebugger.GetBuildConfiguration()
-    xml = config.GetValueForKey("xml")
-
+    value_node = config.GetValueForKey(key)
     fail_value = True # More likely to notice if something goes wrong
-    have_xml = xml.GetValueForKey("value").GetBooleanValue(fail_value)
-    return unittest2.skipIf(not have_xml, "requires xml support")(func)
+    have = value_node.GetValueForKey("value").GetBooleanValue(fail_value)
+    return unittest2.skipIf(not have, "requires " + key)
+
+def skipIfCursesSupportMissing(func):
+    return _get_bool_config_skip_if_decorator("curses")(func)
+
+def skipIfXmlSupportMissing(func):
+    return _get_bool_config_skip_if_decorator("xml")(func)
 
 def skipIfLLVMTargetMissing(target):
     config = lldb.SBDebugger.GetBuildConfiguration()
Index: packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py
===================================================================
--- packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py
+++ packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py
@@ -11,6 +11,7 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
+    @skipIfCursesSupportMissing
     def test_gui(self):
         self.build()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67073.218345.patch
Type: text/x-patch
Size: 2254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190902/715e033f/attachment.bin>


More information about the lldb-commits mailing list