[Lldb-commits] [lldb] r370658 - [dotest] Add @skipIfCursesSupportMissing and annotate the new gui test

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 2 06:33:13 PDT 2019


Author: labath
Date: Mon Sep  2 06:33:12 2019
New Revision: 370658

URL: http://llvm.org/viewvc/llvm-project?rev=370658&view=rev
Log:
[dotest] Add @skipIfCursesSupportMissing and annotate the new gui test

Summary:
The gui command requires curses support, which can be disabled at
compile time. This patch adds the ability to detect this situation in
the test suite and skip the test accordingly.

Reviewers: teemperor, jankratochvil

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D67073

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py
    lldb/trunk/packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py
    lldb/trunk/packages/Python/lldbsuite/test/decorators.py
    lldb/trunk/source/API/SBDebugger.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py?rev=370658&r1=370657&r2=370658&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py Mon Sep  2 06:33:12 2019
@@ -11,6 +11,7 @@ class BasicGuiCommandTest(PExpectTest):
 
     mydir = TestBase.compute_mydir(__file__)
 
+    @skipIfCursesSupportMissing
     def test_gui(self):
         self.build()
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py?rev=370658&r1=370657&r2=370658&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py Mon Sep  2 06:33:12 2019
@@ -6,10 +6,8 @@ class GuiTestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
 
-    def setUp(self):
-        TestBase.setUp(self)
-
     @no_debug_info_test
+    @skipIfCursesSupportMissing
     def test_reproducer_generate_invalid_invocation(self):
         self.expect("gui blub", error=True,
                     substrs=["the gui command takes no arguments."])

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=370658&r1=370657&r2=370658&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Mon Sep  2 06:33:12 2019
@@ -783,13 +783,18 @@ def skipUnlessAddressSanitizer(func):
         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()

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=370658&r1=370657&r2=370658&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Mon Sep  2 06:33:12 2019
@@ -624,6 +624,13 @@ SBStructuredData SBDebugger::GetBuildCon
   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;




More information about the lldb-commits mailing list