summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lldbtest.py
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] Add expect_expr function for testing expression evaluation in dotests.Raphael Isemann2020-01-151-0/+39
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a new function to lldbtest: `expect_expr`. This function is supposed to replace the current approach of calling `expect`/`runCmd` with `expr`, `p` etc. `expect_expr` allows evaluating expressions and matching their value/summary/type/error message without having to do any string matching that might allow unintended passes (e.g., `self.expect("expr 3+4", substrs=["7"])` can unexpectedly pass for results like `(Class7) $0 = 7`, `(int) $7 = 22`, `(int) $0 = 77` and so on). This only uses the function in a few places to test and demonstrate it. I'll migrate the tests in follow up commits. Reviewers: JDevlieghere, shafik, labath Reviewed By: labath Subscribers: christof, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70314
* [lldb][tests][NFC] Unify variable naming conventionTatyana Krasnukha2020-01-101-2/+2
|
* Testuite: Support Asan test with remote testingFred Riss2019-11-061-0/+9
| | | | | | To do so, we need to register the sanitizer libraries with the target so that they get uploaded before running. This patch adds a helper to the test class to this effect.
* [LLDB] Remove incorrect dotest.py invocationJonas Devlieghere2019-10-281-16/+0
| | | | | | | | | | | | | | The invocation shown by dotest.py to re-run a single test is misleading: it ranges from missing arguments (best case scenario) to being totally wrong (worst case scenario). In the past I've tried to get it right, but given the dotest architecture this is harder than it looks. Furthermore, we have pretty good documentation on the website [1] for most use cases. This patch removes the rerun invocation. [1] https://lldb.llvm.org/resources/test.html
* [test] Use a different module cache for Shell and API tests.Jonas Devlieghere2019-10-101-1/+1
| | | | | | | | | | | | | | Before the test reorganization, everything was part of a single test suite with a single module cache. Now that things are properly separated this is no longer the case. Only the shell tests inherited the logic to properly configure and wipe the module caches. This patch adds that logic back for the API tests. While doing so, I noticed that we were configuring a Clang module cache in CMake, but weren't actually using it from dotest.py. I included a fix for that in this patch as well. Differential revision: https://reviews.llvm.org/D68755 llvm-svn: 374386
* [lldbtest] Add an "expected_cmd_failure" option to the filecheck helperVedant Kumar2019-09-101-1/+5
| | | | llvm-svn: 371544
* [dotest] Centralize initialization commands even morePavel Labath2019-09-051-20/+19
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: In r367234 we introduced a central place to hold the set up commands for the various ways we have of launching lldb. However, a number of commands still remained outside of that. This patch moves the remaining set up commands into this function, which allows us to remove manual clang module path setting code in TestBatchMode. One unfortunate victim of this approach is TestSTTYBeforeAndAfter which, due to how it launches lldb (pexpect->expect->lldb), fails get the quoting right. It would be possible to fix the quoting there, it would be a bit icky, and none of the commands in this list are really relevant for what this test is doing, so I just remove the commands outright. Reviewers: JDevlieghere, jankratochvil Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D67173 llvm-svn: 371019
* [test] Fix various module cache bugs and inconsistenciesJonas Devlieghere2019-08-291-7/+7
| | | | | | | | | | | | | | | | | Currently, lit tests don't set neither the module cache for building inferiors nor the module cache used by lldb when running tests. Furthermore, we have several places where we rely on the path to the module cache being always the same, rather than passing the correct value around. This makes it hard to specify a different module cache path when debugging a a test. This patch reworks how we determine and pass around the module cache paths and fixes the omission on the lit side. It also adds a sanity check to the lit and dotest suites. Differential revision: https://reviews.llvm.org/D66966 llvm-svn: 370394
* [lldb] Fix and test completion for ambiguous long optionsRaphael Isemann2019-08-281-0/+10
| | | | | | | | | | The refactoring patch for the option completion broke the completion for ambiguous long options. As this feature was also untested (as testing ambiguous options with the current test methods is impossible), I just noticed now. This patch restores the old behavior and adds a test for this feature. llvm-svn: 370185
* [dotest] Remove long running test "decorator" and re-enable tests.Jonas Devlieghere2019-08-271-12/+0
| | | | | | | | | | | | Today I discovered the skipLongRunningTest decorator and to my surprise all the tests were passing without the decorator. They don't seem to be that expensive either, they take a few seconds but we have tests that take much longer than that. As such I propose to remove the decorator and enable them by default. Differential revision: https://reviews.llvm.org/D66774 llvm-svn: 369995
* Skip tail call frame tests when dwarf_version < 4Vedant Kumar2019-08-231-0/+1
| | | | | | rdar://problem/54656572 llvm-svn: 369821
* [lldb] Fix typo on the BreakpointLocation header and the lldbtest.py (NFC)Med Ismail Bennani2019-08-191-3/+5
| | | | | | | | | | | | | | | Summary: This commit fixes some typo I found while exploring LLDB's codebase. Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com> Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D66452 llvm-svn: 369313
* [dotest] Add --dwarf-version to override the tested DWARF version.Jonas Devlieghere2019-08-191-0/+2
| | | | | | | | | | | | | On the matrix bot on GreenDragon [1] we want to run the test suite against different DWARF versions. The idea here is not to replace targeted tests for certain DWARF features, but rather to provide an easy way to support this configuration. [1] http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/ Differential revision: https://reviews.llvm.org/D66370 llvm-svn: 369272
* [API] Have SBCommandReturnObject::GetOutput/Error return "" instead of nullptrPavel Labath2019-08-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | Summary: It seems this was an unintended side-effect of D26698. AFAICT, these functions did return an empty string before that patch, and the patch contained code which attempted to ensure that, but those efforts were negated by ConstString::AsCString, which by default returns a nullptr even for empty strings. This patch: - fixes the GetOutput/Error methods to really return empty strings - adds and explicit test for that - removes a workaround in lldbtest.py, which was masking this problem from our other tests Reviewers: jingham, clayborg Subscribers: zturner, lldb-commits Differential Revision: https://reviews.llvm.org/D65739 llvm-svn: 368806
* [lldb][NFC] Remove unused imports in python testsRaphael Isemann2019-08-021-3/+0
| | | | llvm-svn: 367663
* [lldb] Increase testsuite packet-timeout 5secs -> 1minJan Kratochvil2019-07-291-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | rL357954 did increase `packet-timeout` 1sec -> 5secs. Which is IMO about the maximum timeout reasonable for regular use. But for testsuite I think the timeout should be higher as the testsuite runs in parallel and it can be run even on slow hosts and with other load (moreover if it runs on some slow arch). I have chosen 60 secs, that should be enough hopefully. Larger value could make debugging with hanging `lldb-server` annoying. This patch was based on this testsuite timeout: http://lab.llvm.org:8014/builders/lldb-x86_64-fedora/builds/546/steps/test/logs/stdio FAIL: test_connect (TestGDBRemoteClient.TestGDBRemoteClient) Test connecting to a remote gdb server ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteClient.py", line 13, in test_connect process = self.connect(target) File "/home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py", line 480, in connect self.assertTrue(error.Success(), error.description) AssertionError: False is not True : failed to get reply to handshake packet Differential Revision: https://reviews.llvm.org/D65271 llvm-svn: 367234
* [dotest] Remove dead codeJonas Devlieghere2019-07-261-2/+0
| | | | | | Remove some dead code that I ran into when preparing D65311. llvm-svn: 367079
* [dotest] Set environment variables after potentialy clearing others.Jonas Devlieghere2019-07-251-3/+4
| | | | | | | | | Dotest contains code to clear DYLD_LIBRARY_PATH for the inferior to not propagate sanitized builds. However, it's possible that we want to inject a different library path with `--inferior-env`. To make that work correctly, we need to do that *after* clearing DYLD_LIBRARY_PATH. llvm-svn: 367054
* [lldb][NFC] Cleanup mentions and code related to lldb-miRaphael Isemann2019-07-191-5/+0
| | | | | | | | | | | | | | | | Summary: lldb-mi has been removed, but there are still a bunch of references in the code base. This patch removes all of them. Reviewers: JDevlieghere, jfb Reviewed By: JDevlieghere Subscribers: dexonsmith, ki.stfu, mgorny, abidh, jfb, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64992 llvm-svn: 366590
* [dotest] Disable color while testing.Jonas Devlieghere2019-07-171-0/+3
| | | | | | | | | Disable colors so we don't risk having unexpected ANSI codes in the test output. Currently, the behavior of a test can change depending on whether it's run under a color-supporting terminal, or under a dummy terminal, for example when using lit or multiprocessing. llvm-svn: 366356
* [dotest] Add the ability to set environment variables for the inferior.Jonas Devlieghere2019-06-261-0/+3
| | | | | | | | | | | This patch adds a dotest flag for setting environment variables for the inferior. This is different from the current --env flag, which sets variables in the debugger's environment. This allows us to set things like LD_LIBRARY_PATH for testing. Differential revision: https://reviews.llvm.org/D63790 llvm-svn: 364443
* [dotest] Remove unused functionJonas Devlieghere2019-06-251-9/+1
| | | | | | The function `EnvArray` has no used. llvm-svn: 364351
* [lldb] [test] Extend D55859 symbols.enable-external-lookup=false for more ↵Jan Kratochvil2019-06-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | testcases D55859 <https://reviews.llvm.org/D55859> has no effect for some of the testcases so this patch extends it even for (all?) other testcases known to me. LLDB was failing when LLDB prints errors reading system debug infos (`*-debuginfo.rpm`, DWZ-optimized) which should never happen as LLDB testcases should not be affected by system debug infos. `lldb/packages/Python/lldbsuite/test/api/multithreaded/driver.cpp.template` is using only SB API which does not expose `ModuleList` so I had to call `HandleCommand()` there. `lldb-test.cpp` could also use `HandleCommand` and then there would be no need for `ModuleListProperties::SetEnableExternalLookup()` but I think it is cleaner with API and not on based on text commands. Differential Revision: https://reviews.llvm.org/D63339 llvm-svn: 363567
* Implement a better way of not passing the sanitizer environment on to tests.Adrian Prantl2019-03-151-3/+2
| | | | | | rdar://problem/48889580 llvm-svn: 356275
* Make sure that a sanitizer LLDB's environment doesn't get passed onAdrian Prantl2019-03-141-0/+5
| | | | | | to test binaries. llvm-svn: 356113
* Relax testcase.Adrian Prantl2019-03-071-1/+1
| | | | | | | Recent versions of llvm monorepo builds build libc++abi.dylib as libc++abi.1.dylib. This accespts both variants. llvm-svn: 355571
* Remove redundant second os.path.join call [NFC]Raphael Isemann2019-03-061-2/+1
| | | | llvm-svn: 355548
* Revert "[lldbtest] Check against the correct name for libcxxabi (macOS)."Davide Italiano2019-03-051-1/+1
| | | | | | | This passes locally but breaks on the bots. Maybe an SDK difference. Reverting while I investigate. llvm-svn: 355415
* [lldbtest] Check against the correct name for libcxxabi (macOS).Davide Italiano2019-03-051-1/+1
| | | | llvm-svn: 355356
* [lldb] [lldbtest] Fix getBuildFlags() not to use libstdc++ on NetBSDMichal Gorny2019-03-021-1/+2
| | | | | | | | | | Remove the code forcing -stdlib=libstdc++ on NetBSD in getBuildFlags() method. NetBSD uses libc++ everywhere else, and using libstdc++ here causes lang/cpp/dynamic-value to fail to build. Differential Revision: https://reviews.llvm.org/D58871 llvm-svn: 355273
* [lldbtest] Remove some accidentally commented out code.Davide Italiano2019-02-201-2/+0
| | | | llvm-svn: 354415
* [lldbtest] Fix some code to be compatible between py2 and py3.Davide Italiano2019-02-181-18/+4
| | | | llvm-svn: 354297
* [dotest] Fix compiler version number comparisonFrederic Riss2019-02-141-4/+5
| | | | | | | | | | | | | | | dotest's version comparision function is just a lexicographical compare of the version strings. This is obviously wrong. This patch implements the comparison using distutils.version.LooseVersion as suggested by Zachary. Reviewers: zturner, labath, serge-sans-paille Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D58219 llvm-svn: 354047
* Only check the dwarf version when using the dwarf categoryAdrian Prantl2019-01-241-2/+2
| | | | llvm-svn: 352094
* Unbreak windows botsAdrian Prantl2019-01-241-9/+10
| | | | llvm-svn: 352086
* Add decorator support for the DWARF version produced by the compilerAdrian Prantl2019-01-241-0/+13
| | | | | | | and mark up some tests failing in http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/ llvm-svn: 352072
* Revert "[dotest] Add logging to investigate CI issue."Jonas Devlieghere2019-01-231-6/+1
| | | | | | | We figured out the issue so the logging is no longer necessary. It turns out we were using a session format that was not unique for inline tests. llvm-svn: 351902
* [dotest] Add logging to investigate CI issue.Jonas Devlieghere2019-01-181-1/+6
| | | | | | | | | | | | We're seeing an odd issue on GreenDragon's lldb-cmake-matrix. Dotest is unable to move a log file (OSError: [Errno 2] No such file or directory). The os.rename call is guarded with a check that the source file and destination directory exist. This wraps the call in a try-except that prints the source and destination path to see which component seemingly doesn't exist. llvm-svn: 351611
* lldbtest.py: try to fix a runtime exceptionAdrian Prantl2019-01-101-4/+7
| | | | | | found on http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/32/consoleFull#15046896708254eaf0-7326-4999-85b0-388101f2d404 llvm-svn: 350876
* Update a comment according to r255360 "Remove -r and -R options from dotest.py"Tatyana Krasnukha2018-12-141-2/+1
| | | | llvm-svn: 349208
* Use a shared module cache directory for LLDB.Adrian Prantl2018-11-161-2/+3
| | | | | | | | | | | | | This saves about 3 redundant gigabytes from the Objective-C test build directories. Tests that must do unsavory things with the LLDB clang module cache, already specify a per-test module cache in their .py test instructions. <rdar://problem/36002081> Differential Revision: https://reviews.llvm.org/D54602 llvm-svn: 347057
* Remove Go debugger pluginJonas Devlieghere2018-11-051-18/+0
| | | | | | | | | | | | | | | | | | | In January Davide sent an e-mail to the mailing list to suggest removing unmaintained language plugins such as Go and Java. The plan was to have some cool down period to allow users to speak up, however after that the plugins were never actually removed. This patch removes the Go debugger plugin. The plugin can be added again in the future if it is mature enough both in terms of testing and maintenance commitment. Discussion on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2018-January/013171.html Differential revision: https://reviews.llvm.org/D54057 llvm-svn: 346157
* [dotest] Make a missing FileCheck binary a warning, not an errorVedant Kumar2018-10-121-0/+2
| | | | | | | | | | This allows bots which haven't updated to pass in --filecheck to dotest.py to run more tests. FileCheck-dependent tests will continue to fail. Differential Revision: https://reviews.llvm.org/D53175 llvm-svn: 344401
* [lldbsuite] Fix the filecheck functionality to work with Python 3Stella Stamenova2018-10-121-1/+1
| | | | | | | | | | | | | | Summary: This is another string/byte conversion issue between Python 2 and 3. In Python 2, the subprocess communication expects a byte string, but in Python 3, it expects bytes. Since both versions are capable of using strings when universal_newlines is set to True AND filecheck operates on strings, force the use of strings. Reviewers: zturner, asmith, vsk Reviewed By: zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D53166 llvm-svn: 344386
* [lldbtest] Fix self.filecheck check file lookupVedant Kumar2018-09-201-10/+11
| | | | | | | | | | | | | | The 'test_filename' property in TestBase changes over time, so attempting to find a check file relative to the directory containing 'test_filename' is flaky. Use the absolute path of the check file as that's always correct (and simpler). This relies on the test driver changing into the test directory, which it seems we can safely assume. As a drive-by, make self.filecheck respect the trace (-t) option. llvm-svn: 342699
* Allow use of self.filecheck in LLDB tests (c.f self.expect)Vedant Kumar2018-09-181-0/+48
| | | | | | | | | | | | | Add a "filecheck" method to the LLDB test base. This allows test authors to pattern match command output using FileCheck, making it possible to write stricter tests than what `self.expect` allows. For context (motivation, examples of stricter checking, etc), see the lldb-dev thread: "Using FileCheck in lldb inline tests". Differential Revision: https://reviews.llvm.org/D50751 llvm-svn: 342508
* Add support for descriptions with command completions.Raphael Isemann2018-09-131-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a framework for adding descriptions to the command completions we provide. It also adds descriptions for completed top-level commands so that we can test this code. Completions are in general supposed to be displayed alongside the completion itself. The descriptions can be used to provide additional information about the completion to the user. Examples for descriptions are function signatures when completing function calls in the expression command or the binary name when providing completion for a symbol. There is still some boilerplate code from the old completion API left in LLDB (mostly because the respective APIs are reused for non-completion related purposes, so the CompletionRequest doesn't make sense to be used), so that's why I still had to change some function signatures. Also, as the old API only passes around a list of matches, and the descriptions are for these functions just another list, I had to add some code that essentially just ensures that both lists are always the same side (e.g. all the manual calls to `descriptions->AddString(X)` below a `matches->AddString(Y)` call). The initial command descriptions that come with this patch are just reusing the existing short help that is already added in LLDB. An example completion with descriptions looks like this: ``` (lldb) pl Available completions: platform -- Commands to manage and create platforms. plugin -- Commands for managing LLDB plugins. ``` Reviewers: #lldb, jingham Reviewed By: #lldb, jingham Subscribers: jingham, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D51175 llvm-svn: 342181
* Added initial code completion support for the `expr` commandRaphael Isemann2018-08-301-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds initial code completion support for the `expr` command. We now have a completion handler in the expression CommandObject that essentially just attempts to parse the given user expression with Clang with an attached code completion consumer. We filter and prepare the code completions provided by Clang and send them back to the completion API. The current completion is limited to variables that are in the current scope. This includes local variables and all types used by local variables. We however don't do any completion of symbols that are not used in the local scope (or in some other way already in the ASTContext). This is partly because there is not yet any code that manually searches for additiona information in the debug information. Another cause is that for some reason the existing code for loading these additional symbols when requested by Clang doesn't seem to work. This will be fixed in a future patch. Reviewers: jingham, teemperor Reviewed By: teemperor Subscribers: labath, aprantl, JDevlieghere, friss, lldb-commits Differential Revision: https://reviews.llvm.org/D48465 llvm-svn: 341086
* lldbtest.py: Unconditionally set the clang module cache path.Adrian Prantl2018-08-211-12/+9
| | | | | | This should fix the errors observable on the new lldb-cmake bot. llvm-svn: 340293
* Add a new tool named "lldb-vscode" that implements the Visual Studio Code ↵Greg Clayton2018-08-161-0/+5
| | | | | | | | | | | | Debug Adaptor Protocol This patch adds a new lldb-vscode tool that speaks the Microsoft Visual Studio Code debug adaptor protocol. It has full unit tests that test all packets. This tool can be easily packaged up into a native extension and used with Visual Studio Code, and it can also be used by Nuclide Differential Revision: https://reviews.llvm.org/D50365 llvm-svn: 339911
OpenPOWER on IntegriCloud