[lldb][tests] Automatically call compute_mydir (NFC)Eliminate boilerplate of having each test manually assign to `mydir` by calling`compute_mydir` in lldbtest.py.Differential Revision: https://r
[lldb][tests] Automatically call compute_mydir (NFC)Eliminate boilerplate of having each test manually assign to `mydir` by calling`compute_mydir` in lldbtest.py.Differential Revision: https://reviews.llvm.org/D128077
show more ...
[lldb] Introduce createTestTarget for creating a valid target in API testsAt the moment nearly every test calls something similar to`self.dbg.CreateTarget(self.getBuildArtifact("a.out"))` and them
[lldb] Introduce createTestTarget for creating a valid target in API testsAt the moment nearly every test calls something similar to`self.dbg.CreateTarget(self.getBuildArtifact("a.out"))` and them sometimeschecks if the created target is actually valid with something like`self.assertTrue(target.IsValid(), "some useless text")`.Beside being really verbose the error messages generated by this pattern arealways just indicating that the target failed to be created but now why.This patch introduces a helper function `createTestTarget` to our Test classthat creates the target with the much more verbose `CreateTarget` overload thatgives us back an SBError (with a fancy error). If the target couldn't be createdthe function prints out the SBError that LLDB returned and asserts for us. Italso defaults to the "a.out" build artifact path that nearly all tests are usingto avoid to hardcode "a.out" in every test.I converted a bunch of tests to the new function but I'll do the rest of thetest suite as follow ups.Reviewed By: JDevlieghereDifferential Revision: https://reviews.llvm.org/D102771
[lldb] [test] Rename '.categories' to 'categories'Make category-specifying files visible. There is really no good reasonto keep them hidden, and having them visible increases the chancesthat som
[lldb] [test] Rename '.categories' to 'categories'Make category-specifying files visible. There is really no good reasonto keep them hidden, and having them visible increases the chancesthat someone will actually spot them.Differential Revision: https://reviews.llvm.org/D91065
[lldb] Make order of completions for expressions deterministic and sorted by Clang's priority values.Summary:It turns out that the order in which we provide completions for expressions isnondete
[lldb] Make order of completions for expressions deterministic and sorted by Clang's priority values.Summary:It turns out that the order in which we provide completions for expressions isnondeterministic. This leads to confusing user experience and also breaks thereproducer tests (as two LLDB tests can go out of sync due to thenon-determinism in the completion lists)The reason for the non-determinism is that the CompletionConsumer informs usabout decls in the order in which it finds declarations in the lookup store ofthe DeclContexts it visits (mainly this snippet in SemaLookup.cpp):``` lang=c++ // Enumerate all of the results in this context. for (DeclContextLookupResult R : Load ? Ctx->lookups() : Ctx->noload_lookups(/*PreserveInternalState=*/false)) { [...]```This storage of the lookup is sorted by pointer values (see the hash of`DeclarationName`) and can therefore be non-deterministic. The LLDB codecompletion consumer that receives these calls originally expected that the orderof declarations is defined by Clang, but it seems the API expects the client toprovide an order to the completions.This patch fixes the issue as follows:* We sort the completions we get from Clang alphabetically and also by thepriority value we get from Clang (with priority value sorting having precedenceover the alphabetical sorting)* We make all the functions/variables that touch a completion before the sortingconst-qualified. The idea is that this should prevent that we never haveobservable side-effect from touching these declarations in a non-deterministicorder (e.g., we don't try to complete the type by accident).This way we behave like the other parts of Clang which also sort the results bysome deterministic value (usually the name or something computed from a name,e.g., edit distance to a given string).We most likely also need to fix the Clang code to make the loop I listed abovedeterministic to prevent these issues in the future (tracked in rdar://63442513). This wouldn't replace the functionality provided in this patch though as wewould still need the priority and overall alphabetical sorting.Note: I had to increase the lldb-vscode completion limit to 100 as the testslook for strings that aren't in the first 50 results anymore due to variablenames starting with letters like 'v' (which are now always shown much furtherdown in the list due to the alphabetical sorting).Fixes rdar://63200995Reviewers: JDevlieghere, clayborgReviewed By: JDevlieghereSubscribers: mgrang, abidhDifferential Revision: https://reviews.llvm.org/D80292
[lldb][test] Remove symlink for API tests.Summary: Moves lldbsuite tests to lldb/test/API.This is a largely mechanical change, moved with the following steps:```rm lldb/test/API/testcasesmkdi
[lldb][test] Remove symlink for API tests.Summary: Moves lldbsuite tests to lldb/test/API.This is a largely mechanical change, moved with the following steps:```rm lldb/test/API/testcasesmkdir -p lldb/test/API/{test_runner/test,tools/lldb-{server,vscode}}mv lldb/packages/Python/lldbsuite/test/test_runner/test lldb/test/API/test_runnerfor d in $(find lldb/packages/Python/lldbsuite/test/* -maxdepth 0 -type d | egrep -v "make|plugins|test_runner|tools"); do mv $d lldb/test/API; donefor d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-vscode -maxdepth 1 -mindepth 1 | grep -v ".py"); do mv $d lldb/test/API/tools/lldb-vscode; donefor d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-server -maxdepth 1 -mindepth 1 | egrep -v "gdbremote_testcase.py|lldbgdbserverutils.py|socket_packet_pump.py"); do mv $d lldb/test/API/tools/lldb-server; done```lldb/packages/Python/lldbsuite/__init__.py and lldb/test/API/lit.cfg.py were also updated with the new directory structure.Reviewers: labath, JDevlieghereTags: #lldbDifferential Revision: https://reviews.llvm.org/D71151