Skip to content

Commit eafede2

Browse files
committed
[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 llvm-svn: 370658
1 parent 491fc23 commit eafede2

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

lldb/packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class BasicGuiCommandTest(PExpectTest):
1111

1212
mydir = TestBase.compute_mydir(__file__)
1313

14+
@skipIfCursesSupportMissing
1415
def test_gui(self):
1516
self.build()
1617

lldb/packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ class GuiTestCase(TestBase):
66

77
mydir = TestBase.compute_mydir(__file__)
88

9-
def setUp(self):
10-
TestBase.setUp(self)
11-
129
@no_debug_info_test
10+
@skipIfCursesSupportMissing
1311
def test_reproducer_generate_invalid_invocation(self):
1412
self.expect("gui blub", error=True,
1513
substrs=["the gui command takes no arguments."])

lldb/packages/Python/lldbsuite/test/decorators.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -783,13 +783,18 @@ def is_compiler_with_address_sanitizer(self):
783783
return None
784784
return skipTestIfFn(is_compiler_with_address_sanitizer)(func)
785785

786-
def skipIfXmlSupportMissing(func):
786+
def _get_bool_config_skip_if_decorator(key):
787787
config = lldb.SBDebugger.GetBuildConfiguration()
788-
xml = config.GetValueForKey("xml")
789-
788+
value_node = config.GetValueForKey(key)
790789
fail_value = True # More likely to notice if something goes wrong
791-
have_xml = xml.GetValueForKey("value").GetBooleanValue(fail_value)
792-
return unittest2.skipIf(not have_xml, "requires xml support")(func)
790+
have = value_node.GetValueForKey("value").GetBooleanValue(fail_value)
791+
return unittest2.skipIf(not have, "requires " + key)
792+
793+
def skipIfCursesSupportMissing(func):
794+
return _get_bool_config_skip_if_decorator("curses")(func)
795+
796+
def skipIfXmlSupportMissing(func):
797+
return _get_bool_config_skip_if_decorator("xml")(func)
793798

794799
def skipIfLLVMTargetMissing(target):
795800
config = lldb.SBDebugger.GetBuildConfiguration()

lldb/source/API/SBDebugger.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,13 @@ SBStructuredData SBDebugger::GetBuildConfiguration() {
624624
AddBoolConfigEntry(
625625
*config_up, "xml", XMLDocument::XMLEnabled(),
626626
"A boolean value that indicates if XML support is enabled in LLDB");
627+
bool have_curses = true;
628+
#ifdef LLDB_DISABLE_CURSES
629+
have_curses = false;
630+
#endif
631+
AddBoolConfigEntry(
632+
*config_up, "curses", have_curses,
633+
"A boolean value that indicates if curses support is enabled in LLDB");
627634
AddLLVMTargets(*config_up);
628635

629636
SBStructuredData data;

0 commit comments

Comments
 (0)