diff options
author | Pavel Labath <pavel@labath.sk> | 2019-09-02 13:33:12 +0000 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2019-09-02 13:33:12 +0000 |
commit | eafede2afeb45c826957d49c7895a04655f1f08d (patch) | |
tree | f33f594fa43974a0fc452e74bce5c4317cca8bea | |
parent | 491fc23a600a0aa4903b4be4eefa9b503295d70b (diff) | |
download | bcm5719-llvm-eafede2afeb45c826957d49c7895a04655f1f08d.tar.gz bcm5719-llvm-eafede2afeb45c826957d49c7895a04655f1f08d.zip |
[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
4 files changed, 19 insertions, 8 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py b/lldb/packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py index 7edddf3ff97..89bd3e1109e 100644 --- a/lldb/packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py +++ b/lldb/packages/Python/lldbsuite/test/commands/gui/basic/TestGuiBasic.py @@ -11,6 +11,7 @@ class BasicGuiCommandTest(PExpectTest): mydir = TestBase.compute_mydir(__file__) + @skipIfCursesSupportMissing def test_gui(self): self.build() diff --git a/lldb/packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py b/lldb/packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py index 92ead9f4fa7..11fdc92243b 100644 --- a/lldb/packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py +++ b/lldb/packages/Python/lldbsuite/test/commands/gui/invalid-args/TestInvalidArgsGui.py @@ -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."]) diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index fd0aecfef50..17b97d572bd 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -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() diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index f5da4677b4e..7e6f8d2c6e9 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -624,6 +624,13 @@ SBStructuredData SBDebugger::GetBuildConfiguration() { 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; |