[Lldb-commits] [PATCH] D43333: Add SBDebugger::GetBuildConfiguration and use it to skip an XML test
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 19 07:08:34 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL325504: Add SBDebugger::GetBuildConfiguration and use it to skip an XML test (authored by labath, committed by ).
Herald added a subscriber: llvm-commits.
Repository:
rL LLVM
https://reviews.llvm.org/D43333
Files:
lldb/trunk/include/lldb/API/SBDebugger.h
lldb/trunk/packages/Python/lldbsuite/test/decorators.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
lldb/trunk/scripts/interface/SBDebugger.i
lldb/trunk/source/API/SBDebugger.cpp
Index: lldb/trunk/scripts/interface/SBDebugger.i
===================================================================
--- lldb/trunk/scripts/interface/SBDebugger.i
+++ lldb/trunk/scripts/interface/SBDebugger.i
@@ -320,6 +320,8 @@
static const char *
StateAsCString (lldb::StateType state);
+ static SBStructuredData GetBuildConfiguration();
+
static bool
StateIsRunningState (lldb::StateType state);
Index: lldb/trunk/include/lldb/API/SBDebugger.h
===================================================================
--- lldb/trunk/include/lldb/API/SBDebugger.h
+++ lldb/trunk/include/lldb/API/SBDebugger.h
@@ -181,6 +181,8 @@
static const char *StateAsCString(lldb::StateType state);
+ static SBStructuredData GetBuildConfiguration();
+
static bool StateIsRunningState(lldb::StateType state);
static bool StateIsStoppedState(lldb::StateType state);
Index: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py
@@ -763,3 +763,11 @@
return "Compiler cannot compile with -fsanitize=address"
return None
return skipTestIfFn(is_compiler_with_address_sanitizer)(func)
+
+def skipIfXmlSupportMissing(func):
+ config = lldb.SBDebugger.GetBuildConfiguration()
+ xml = config.GetValueForKey("xml")
+
+ 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)
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py
@@ -6,7 +6,7 @@
class TestTargetXMLArch(GDBRemoteTestBase):
- @skipIf(hostoslist=no_match(lldbplatformutil.getDarwinOSTriples()))
+ @skipIfXmlSupportMissing
@expectedFailureAll(archs=["i386"])
@skipIfRemote
def test(self):
Index: lldb/trunk/source/API/SBDebugger.cpp
===================================================================
--- lldb/trunk/source/API/SBDebugger.cpp
+++ lldb/trunk/source/API/SBDebugger.cpp
@@ -43,6 +43,7 @@
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/DataFormatters/DataVisualization.h"
+#include "lldb/Host/XML.h"
#include "lldb/Initialization/SystemLifetimeManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -491,6 +492,26 @@
return lldb_private::StateAsCString(state);
}
+static void AddBoolConfigEntry(StructuredData::Dictionary &dict,
+ llvm::StringRef name, bool value,
+ llvm::StringRef description) {
+ auto entry_up = llvm::make_unique<StructuredData::Dictionary>();
+ entry_up->AddBooleanItem("value", value);
+ entry_up->AddStringItem("description", description);
+ dict.AddItem(name, std::move(entry_up));
+}
+
+SBStructuredData SBDebugger::GetBuildConfiguration() {
+ auto config_up = llvm::make_unique<StructuredData::Dictionary>();
+ AddBoolConfigEntry(
+ *config_up, "xml", XMLDocument::XMLEnabled(),
+ "A boolean value that indicates if XML support is enabled in LLDB");
+
+ SBStructuredData data;
+ data.m_impl_up->SetObjectSP(std::move(config_up));
+ return data;
+}
+
bool SBDebugger::StateIsRunningState(StateType state) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43333.134909.patch
Type: text/x-patch
Size: 3787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180219/5179294a/attachment-0001.bin>
More information about the lldb-commits
mailing list