[Lldb-commits] [PATCH] D43333: Add SBDebugger::GetBuildConfiguration and use it to skip an XML test
labath created this revision. labath added reviewers: zturner, jingham, clayborg, davide. This adds a SBDebugger::GetBuildConfiguration static function, which returns a SBStructuredData describing the the build parameters of liblldb. Right now, it just contains one entry: whether we were built with XML support. I use the new functionality to skip a test which requires XML support, but concievably the new function could be useful to other liblldb clients as well (making sure the library supports the feature they are about to use). https://reviews.llvm.org/D4 Files: include/lldb/API/SBDebugger.h packages/Python/lldbsuite/test/decorators.py packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py scripts/interface/SBDebugger.i source/API/SBDebugger.cpp Index: source/API/SBDebugger.cpp === --- source/API/SBDebugger.cpp +++ 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,15 @@ return lldb_private::StateAsCString(state); } +SBStructuredData SBDebugger::GetBuildConfiguration() { + auto config_up = llvm::make_unique(); + config_up->AddBooleanItem("xml", XMLDocument::XMLEnabled()); + + SBStructuredData data; + data.m_impl_up->SetObjectSP(std::move(config_up)); + return data; +} + bool SBDebugger::StateIsRunningState(StateType state) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); Index: scripts/interface/SBDebugger.i === --- scripts/interface/SBDebugger.i +++ 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: packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py === --- packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py +++ 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"]) def test(self): """ Index: packages/Python/lldbsuite/test/decorators.py === --- packages/Python/lldbsuite/test/decorators.py +++ packages/Python/lldbsuite/test/decorators.py @@ -763,3 +763,9 @@ return "Compiler cannot compile with -fsanitize=address" return None return skipTestIfFn(is_compiler_with_address_sanitizer)(func) + +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) Index: include/lldb/API/SBDebugger.h === --- include/lldb/API/SBDebugger.h +++ 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: source/API/SBDebugger.cpp === --- source/API/SBDebugger.cpp +++ 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,15 @@ return lldb_private::StateAsCString(state); } +SBStructuredData SBDebugger::GetBuildConfiguration() { + auto config_up = llvm::make_unique(); + config_up->AddBooleanItem("xml", XMLDocument::XMLEnabled()); + + SBStructuredData data; + data.m_impl_up->SetObjectSP(std::move(config_up)); + return data; +} + bool SBDebugger::StateIsRunningState(StateType state) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); Index: scripts/interface/SBDebugger.i === --- scripts/interface/SBDebugger.i +++ scripts/interface/SBDebugger.i @@ -320,6 +320,8 @@ static
[Lldb-commits] [PATCH] D43335: [dosep] Run tests in a more parallel fashion
labath created this revision. labath added a reviewer: aprantl. Due to in-tree builds, we were parallelizing the tests at the directory level. Now that the tests are built out-of-tree, we can remove this limitation and paralelize at file level instead. This decreases test suite time by about 10% for me, which is not world-shattering, but it makes the code slightly simpler and will also allow us to merge tests which were artificially spread over multiple folders (TestConcurrentEvents...) to work-around this limitation. To make this work, I've also needed to include the test file name in the build directory name, as just the test method name is not unique enough (plenty of tests have a test method called "test" or similar). While doing this, I've found a couple of tests that are taking waaay longer then they ought to (TestBreakpointCaseSensitivity -- 90 seconds), which I plan to look into in the future. https://reviews.llvm.org/D43335 Files: packages/Python/lldbsuite/test/dosep.py packages/Python/lldbsuite/test/lldbtest.py Index: packages/Python/lldbsuite/test/lldbtest.py === --- packages/Python/lldbsuite/test/lldbtest.py +++ packages/Python/lldbsuite/test/lldbtest.py @@ -705,13 +705,16 @@ """Return the full path to the current test.""" return os.path.join(os.environ["LLDB_TEST"], self.mydir) +def getBuildDirBasename(self): +return self.__class__.__module__ + "." + self.testMethodName + def getBuildDir(self): """Return the full path to the current test.""" variant = self.getDebugInfo() if variant is None: variant = 'default' return os.path.join(os.environ["LLDB_BUILD"], self.mydir, -self.testMethodName) +self.getBuildDirBasename()) def makeBuildDir(self): @@ -1504,7 +1507,7 @@ clean=True): """Platform specific way to build the default binaries.""" testdir = self.mydir -testname = self.testMethodName +testname = self.getBuildDirBasename() if self.getDebugInfo(): raise Exception("buildDefault tests must set NO_DEBUG_INFO_TESTCASE") module = builder_module() @@ -1522,7 +1525,7 @@ clean=True): """Platform specific way to build binaries with dsym info.""" testdir = self.mydir -testname = self.testMethodName +testname = self.getBuildDirBasename() if self.getDebugInfo() != "dsym": raise Exception("NO_DEBUG_INFO_TESTCASE must build with buildDefault") @@ -1540,7 +1543,7 @@ clean=True): """Platform specific way to build binaries with dwarf maps.""" testdir = self.mydir -testname = self.testMethodName +testname = self.getBuildDirBasename() if self.getDebugInfo() != "dwarf": raise Exception("NO_DEBUG_INFO_TESTCASE must build with buildDefault") @@ -1558,7 +1561,7 @@ clean=True): """Platform specific way to build binaries with dwarf maps.""" testdir = self.mydir -testname = self.testMethodName +testname = self.getBuildDirBasename() if self.getDebugInfo() != "dwo": raise Exception("NO_DEBUG_INFO_TESTCASE must build with buildDefault") @@ -1576,7 +1579,7 @@ clean=True): """Platform specific way to build binaries with gmodules info.""" testdir = self.mydir -testname = self.testMethodName +testname = self.getBuildDirBasename() if self.getDebugInfo() != "gmodules": raise Exception("NO_DEBUG_INFO_TESTCASE must build with buildDefault") Index: packages/Python/lldbsuite/test/dosep.py === --- packages/Python/lldbsuite/test/dosep.py +++ packages/Python/lldbsuite/test/dosep.py @@ -470,28 +470,29 @@ return process_driver.results -def process_dir(root, files, dotest_argv, inferior_pid_events): -"""Examine a directory for tests, and invoke any found within it.""" +def process_file(test_file, dotest_argv, inferior_pid_events): +"""Run tests in the specified file in a subprocess and gather the results.""" results = [] -for (base_name, full_test_path) in files: -import __main__ as main -global dotest_options -if dotest_options.p and not re.search(dotest_options.p, base_name): -continue +base_name = os.path.basename(test_file) -script_file = main.__file__ -command = ([sys.executable, script_file] + - dotest_argv + - ["-S", dotest_options.session_file_format] + - ["--inferior", "-p", base_name, root]) +import __main__ as main +global dotest_options +if dotest_options.p and not re.search(dotest_options.p, base_name): +return + +scr
[Lldb-commits] [lldb] r325250 - @skipIfRemote TestTargetXMLArch
Author: labath Date: Thu Feb 15 07:24:32 2018 New Revision: 325250 URL: http://llvm.org/viewvc/llvm-project?rev=325250&view=rev Log: @skipIfRemote TestTargetXMLArch The test does not actually connect to any remote targets. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py?rev=325250&r1=325249&r2=325250&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py Thu Feb 15 07:24:32 2018 @@ -8,6 +8,7 @@ class TestTargetXMLArch(GDBRemoteTestBas @skipIf(hostoslist=no_match(lldbplatformutil.getDarwinOSTriples())) @expectedFailureAll(archs=["i386"]) +@skipIfRemote def test(self): """ Test lldb's parsing of the tag in the target.xml register ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r324792 - Add test case for x86_64 architecture recognition in the
This test was failing when run against a "remote" target (at least android, but possibly others). I've skipped it because it's not really applicable to the remote test suite, but I did notice something you may want to know about while investigating: The test verifies that the target triple is deduced as "x86_64--", which is true when we run it with the "host" as the currently selected platform. However, if the currently selected platform is "remote-android", then something interesting happens: The platform of the newly created target is set to "host" (which I presume is correct, as that's the platform which is selected in the non-remote case as well), however, the *triple* is deduced as "x86_64-apple-macosx" (which seems a bit odd). I don't really know what this means, but I'm writing it here in case that's something you want to know about. On 10 February 2018 at 01:13, Jason Molenda via lldb-commits wrote: > Author: jmolenda > Date: Fri Feb 9 17:13:34 2018 > New Revision: 324792 > > URL: http://llvm.org/viewvc/llvm-project?rev=324792&view=rev > Log: > Add test case for x86_64 architecture recognition in the > target.xml packet if it is included. > > Added: > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py > Modified: > > lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py > > Added: > lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py?rev=324792&view=auto > == > --- > lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py > (added) > +++ > lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestTargetXMLArch.py > Fri Feb 9 17:13:34 2018 > @@ -0,0 +1,121 @@ > +from __future__ import print_function > +import lldb > +from lldbsuite.test.lldbtest import * > +from lldbsuite.test.decorators import * > +from gdbclientutils import * > + > +class TestTargetXMLArch(GDBRemoteTestBase): > + > +def test(self): > +""" > +Test lldb's parsing of the tag in the target.xml > register > +description packet. > +""" > +class MyResponder(MockGDBServerResponder): > + > +def qXferRead(self, obj, annex, offset, length): > +if annex == "target.xml": > +return """ > + > + i386:x86-64 > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="data_ptr" group="general"/> > + type="data_ptr" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="code_ptr" group="general"/> > + type="i386_eflags" group="general"/> > + > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + type="int" group="general"/> > + > + type="i387_ext" group="float"/> > + type="i387_ext" group="float"/> > + type="i387_ext" group="float"/> > + type="i3
[Lldb-commits] [PATCH] D43335: [dosep] Run tests in a more parallel fashion
aprantl accepted this revision. aprantl added a comment. This revision is now accepted and ready to land. This is very cool! I imagine that this will help a lot with TestIntegerTypes and other really long-running ones. Thanks. https://reviews.llvm.org/D43335 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D43333: Add SBDebugger::GetBuildConfiguration and use it to skip an XML test
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/D4 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D43333: Add SBDebugger::GetBuildConfiguration and use it to skip an XML test
jingham accepted this revision. jingham added a comment. Caching this value wouldn't hurt, but the the multi-process runner will mostly defeat that so it doesn't seem crucial. The API is fine, the name is pretty obvious, but still some doc wouldn't hurt. I was wondering if there was a straightforward way we could document the elements. Be nice not to have to read source to see what these mean. OTOH, I don't think we want to produce it in this dictionary, that makes the checks more expensive. So if we find we need it we can add a doc API that generates a parallel doc tree. But I don't think it's necessary to do that right now. https://reviews.llvm.org/D4 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D43335: [dosep] Run tests in a more parallel fashion
jingham added a comment. Very nice! Thanks for working on this! https://reviews.llvm.org/D43335 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D43333: Add SBDebugger::GetBuildConfiguration and use it to skip an XML test
clayborg added inline comments. Comment at: source/API/SBDebugger.cpp:497 + auto config_up = llvm::make_unique(); + config_up->AddBooleanItem("xml", XMLDocument::XMLEnabled()); + Do we want a more self documenting format of the JSON? Maybe "xml" is a dictionary instead of just a value? ``` { "xml" : { "value" : true, "description" : "A boolean value that indicates if XML support is enabled in LLDB" } } ``` https://reviews.llvm.org/D4 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits