[Lldb-commits] [PATCH] D43333: Add	SBDebugger::GetBuildConfiguration and use it to skip an XML test
    Greg Clayton via Phabricator via lldb-commits 
    lldb-commits at lists.llvm.org
       
    Thu Feb 15 08:08:02 PST 2018
    
    
  
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.
Think if we want to cache the configuration in case we start using this a lot more in the test suite. Doesn't need to be done now.
================
Comment at: packages/Python/lldbsuite/test/decorators.py:767-771
+def skipIfXmlSupportMissing(func):
+    config = lldb.SBDebugger.GetBuildConfiguration()
+    fail_value = True # More likely to notice if something goes wrong
+    have_xml = config.GetValueForKey("xml").GetBooleanValue(fail_value)
+    return unittest2.skipIf(not have_xml, "requires xml support")(func)
----------------
Might be nice to read all values from lldb.SBDebugger.GetBuildConfiguration() and store them one time? If we start using this all the time for many decorators, it would be a good idea to cache it. Thinking something like:
```
lldb_config = None
def getLLDBConfig():
  global lldb_config
  if lldb_config is None:
      lldb_config = lldb.SBDebugger.GetBuildConfiguration()
  return lldb_config
def skipIfXmlSupportMissing(func):
  config = getLLDBConfig()
  ...
```
https://reviews.llvm.org/D43333
    
    
More information about the lldb-commits
mailing list