summaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities/archives
AgeCommit message (Collapse)Author
2024-10-08[lldb][test] Remove xfails from static lib tests on WindowsDavid Spickett
Originally failing due to https://github.com/llvm/llvm-project/issues/24901, but since https://github.com/llvm/llvm-project/pull/110837 the test is passing. Already removed one xfail but didn't realise we had more for the same bug.
2024-10-08[lldb][test] Fix unexpected pass of TestBSDArchives on WindowsDavid Spickett
Originally failing due to https://github.com/llvm/llvm-project/issues/24901, but since https://github.com/llvm/llvm-project/pull/110837 the test is passing. https://lab.llvm.org/buildbot/#/builders/141/builds/3012 My guess is that the `llvm-` tool has better support for static libraries on Windows.
2024-10-07[lldb][test] Mark test() in TestBSDArchives.py as passing remotely (#111199)Vladislav Dzhidzhoev
It was xfail'ed in de2ddc8f3146b. However, it passes on a buildbot https://lab.llvm.org/staging/#/builders/195/builds/3988.
2024-09-25[lldb][test] Use tools from llvm instead of compiler tools (#109961)Vladislav Dzhidzhoev
In #102185, toolchain detection for API tests has been rewritten in Python. Tools paths for tests there are determined from compiler path. Here tools are taken from `--llvm-tools-dir` dotest.py argument, which by default refers to the LLVM build directory, unless they are explicitly redefined in environment variables. It helps to minimize external dependencies and to maximize the reproducibility of the build.
2024-02-21[lldb][test] Modernize asserts (#82503)Jordan Rupprecht
This uses [teyit](https://pypi.org/project/teyit/) to modernize asserts, as recommended by the [unittest release notes](https://docs.python.org/3.12/whatsnew/3.12.html#id3). For example, `assertTrue(a == b)` is replaced with `assertEqual(a, b)`. This produces better error messages, e.g. `error: unexpectedly found 1 and 2 to be different` instead of `error: False`.
2023-09-18Skip tests with earlier versions of clangAdrian Prantl
2023-09-11[lldb][Tests] Reformat API tests with blackDavid Spickett
These are all recent additions I think, including a few of mine for AArch64. Going forward the CI checks should help us fix these earlier.
2023-09-06[LLDB] Skip TestBSDArchives.py on windowsMuhammad Omair Javaid
This fixes LLDB windows buildbot after updates to TestBSDArchives.py. https://lab.llvm.org/buildbot/#/builders/219/builds/5408 I have marked new failing test as an expected failure on Windows.
2023-09-05Switch over to using the LLVM archive parser for BSD archives.Greg Clayton
Our LLDB parser didn't correctly handle archives of all flavors on different systems, it currently only correctly handled BSD archives, normal and thin, on macOS, but I noticed that it was getting incorrect information when decoding a variety of archives on linux. There were subtle changes to how names were encoded that we didn't handle correctly and we also didn't set the result of GetObjectSize() correctly as there was some bad math. This didn't matter when exracting .o files from .a files for LLDB because the size was always way too big, but it was big enough to at least read enough bytes for each object within the archive. This patch does the following: - switch over to use LLVM's archive parser and avoids previous code duplication - remove values from ObjectContainerBSDArchive::Object that we don't use like: - uid - gid - mode - fix ths ObjectContainerBSDArchive::Object::file_size value to be correct - adds tests to test that we get the correct module specifications Differential Revision: https://reviews.llvm.org/D159408
2023-08-04[lldb] Fix Python test formatting (NFC)Jonas Devlieghere
All Python files in the LLVM repository were reformatted with Black [1]. Files inside the LLDB subproject were reformatted in 2238dcc39358. This patch updates a handful of tests that were added or modified since then and weren't formatted with Black. [1] https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style/68257
2023-08-01[lldb] Fix test TestBSDArchives.py properlyWanyi Ye
The previous patch D156367 introduced a test debugging thin archive with one of the linked object file missing. It actually failed on green dragon build bots. I put up a speculative fix (https://github.com/llvm/llvm-project/commit/4520cc066b2ffe5ac261e3aca887cba3f113b1ff) that only fixed the symptom of it. The actual root cause was that the timestamps were set to 0 when creating the thin archive Makefile command ``` llvm-ar -rcsDT libfoo-thin.a a.o b.o ``` Where the flag "[D] - use zero for timestamps and uids/gids (default)" according to the llvm-ar help Use "[U] - use actual timestamps and uids/gids" fixed the timestamp Now the test is actually getting error from missing object file linked to the thin archive instead of the mismatched timestamp. This means removing one of the object file a.o should only result in failure breaking at `a()`; breaking at `b()` should work just fine. Test Plan: All 4 test cases passed ``` ▶ ./bin/llvm-lit -vv ../llvm-project/lldb/test/API/functionalities/archives/TestBSDArchives.py llvm-lit: /Users/wanyi/local/llvm-project/lldb/test/API/lit.cfg.py:173: warning: Could not set a default per-test timeout. Requires the Python psutil module but it could not be found. Try installing it via pip or via your operating system's package manager. -- Testing: 1 tests, 1 workers -- PASS: lldb-api :: functionalities/archives/TestBSDArchives.py (1 of 1) Testing Time: 8.07s Passed: 1 1 warning(s) in tests ``` Differential Revision: https://reviews.llvm.org/D156564
2023-07-27[lldb] Fix TestBSDArchives failureWanyi Ye
This is a speculative fix for the lldb API test suite Build bot failures see: https://green.lab.llvm.org/green/view/LLDB/job/as-lldb-cmake/3262/
2023-07-27[BSDArchive] NULL check the child object file ptr before accessing its memberWanyi Ye
Recently we've observed lldb crashes caused by missing object file linked to a thin archive (.a) files. The crash is due to a missing NULL check in the code when looking for child object file referred by the thin archive. Malformed archive file should not crash LLDB. Instead, it should report the error and continue. New error message will look like the following ``` error: libfoo.a(__objects__/foo/barAppDelegate.mm.o) failed to load objfile for path/to/libfoo.a. Debugging will be degraded for this module. ``` Test Plan: llvm-lit test ``` ./bin/llvm-lit -sv ../llvm-project/lldb/test/API/functionalities/archives/TestBSDArchives.py ``` Test without code change will error out with LLDB crash ``` -- Command Output (stderr): -- PASS: LLDB (~/llvm-upstream/Debug/bin/clang-arm64) :: test (TestBSDArchives.BSDArchivesTestCase) PASS: LLDB (~/llvm-upstream/Debug/bin/clang-arm64) :: test_frame_var_errors_when_archive_missing (TestBSDArchives.BSDArchivesTestCase) FAIL: LLDB (~/llvm-upstream/Debug/bin/clang-arm64) :: test_frame_var_errors_when_mtime_mistmatch_for_object_in_archive (TestBSDArchives.BSDArchivesTestCase) PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. HandleCommand(command = "b a") 1. HandleCommand(command = "breakpoint set --name 'a'") Fatal Python error: Segmentation fault Current thread 0x00000001f7b99e00 (most recent call first): File "~/llvm-upstream/Debug/bin/LLDB.framework/Resources/Python/lldb/__init__.py", line 3270 in HandleCommand File "~/llvm-upstream/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2070 in runCmd File "~/llvm-upstream/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2421 in expect File "~/llvm-upstream/llvm-project/lldb/test/API/functionalities/archives/TestBSDArchives.py", line 156 in test_frame_var_errors_when_thin_archive_malformed ... ``` Differential Revision: https://reviews.llvm.org/D156367
2023-05-25[NFC][Py Reformat] Reformat python files in lldbJonas Devlieghere
This is an ongoing series of commits that are reformatting our Python code. Reformatting is done with `black` (23.1.0). If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run `git checkout --ours <yourfile>` and then reformat it with black. RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Differential revision: https://reviews.llvm.org/D151460
2022-09-12Add the ability to show when variables fails to be available when debug info ↵Greg Clayton
is valid. Summary: Many times when debugging variables might not be available even though a user can successfully set breakpoints and stops somewhere. Letting the user know will help users fix these kinds of issues and have a better debugging experience. Examples of this include: - enabling -gline-tables-only and being able to set file and line breakpoints and yet see no variables - unable to open object file for DWARF in .o file debugging for darwin targets due to modification time mismatch or not being able to locate the N_OSO file. This patch adds an new API to SBValueList: lldb::SBError lldb::SBValueList::GetError(); object so that if you request a stack frame's variables using SBValueList SBFrame::GetVariables(...), you can get an error the describes why the variables were not available. This patch adds the ability to get an error back when requesting variables from a lldb_private::StackFrame when calling GetVariableList. It also now shows an error in response to "frame variable" if we have debug info and are unable to get varialbes due to an error as mentioned above: (lldb) frame variable error: "a.o" object from the "/tmp/libfoo.a" archive: either the .o file doesn't exist in the archive or the modification time (0x63111541) of the .o file doesn't match Reviewers: labath JDevlieghere aadsm yinghuitan jdoerfert sscalpone Subscribers: Differential Revision: https://reviews.llvm.org/D133164
2022-09-12Revert "Add the ability to show when variables fails to be available when ↵Stella Stamenova
debug info is valid." This reverts commit 9af089f5179d52c6561ec27532880edcfb6253af. This broke the windows lldb bot: https://lab.llvm.org/buildbot/#/builders/83/builds/23528
2022-09-09Add the ability to show when variables fails to be available when debug info ↵Greg Clayton
is valid. Many times when debugging variables might not be available even though a user can successfully set breakpoints and stops somewhere. Letting the user know will help users fix these kinds of issues and have a better debugging experience. Examples of this include: - enabling -gline-tables-only and being able to set file and line breakpoints and yet see no variables - unable to open object file for DWARF in .o file debugging for darwin targets due to modification time mismatch or not being able to locate the N_OSO file. This patch adds an new API to SBValueList: lldb::SBError lldb::SBValueList::GetError(); object so that if you request a stack frame's variables using SBValueList SBFrame::GetVariables(...), you can get an error the describes why the variables were not available. This patch adds the ability to get an error back when requesting variables from a lldb_private::StackFrame when calling GetVariableList. It also now shows an error in response to "frame variable" if we have debug info and are unable to get varialbes due to an error as mentioned above: (lldb) frame variable error: "a.o" object from the "/tmp/libfoo.a" archive: either the .o file doesn't exist in the archive or the modification time (0x63111541) of the .o file doesn't match Differential Revision: https://reviews.llvm.org/D133164
2022-07-05[lldb] Add support to load object files from thin archivesKaining Zhong
This fixes https://github.com/llvm/llvm-project/issues/50114 where lldb/mac can't load object files from thin archives. This patch allows lldb to identify thin archives, and load object files contained in them. Differential Revision: https://reviews.llvm.org/D126464
2022-06-17[lldb][tests] Automatically call compute_mydir (NFC)Dave Lee
Eliminate boilerplate of having each test manually assign to `mydir` by calling `compute_mydir` in lldbtest.py. Differential Revision: https://reviews.llvm.org/D128077
2022-04-08[lldb] XFAIL tests that aren't passing remotelyJonas Devlieghere
XFAIL a series of tests that are failing remotely.
2021-01-21[lldb] Make TestBSDArchives a no-debug-info-testRaphael Isemann
The DSYM variant of this test is failing since D94890. But as we explicitly try to disable the DSYM generation in the makefile and build the archive on our own, I don't see why we even need to run the DSYM version of the test. This patch disables the generated derived versions of this test for the different debug information containers (which includes the failing DSYM one).
2021-01-20Makefile.rules: Avoid redundant .d generation (make restart) and inline ↵Fangrui Song
archive rule to the only test Take an example when `CXX_SOURCES` is main.cpp. main.d is an included file. make will rebuild main.d, re-executes itself [1] to read in the new main.d file, then rebuild main.o, finally link main.o into a.out. main.cpp is parsed twice in this process. This patch merges .d generation into .o generation [2], writes explicit rules for .c/.m and deletes suffix rules for %.m and %.o. Since a target can be satisfied by either of .c/.cpp/.m/.mm, we use multiple pattern rules. The rule with the prerequisite (with VPATH considered) satisfied is used [3]. Since suffix rules are disabled, the implicit rule for archive member targets is no long available [4]. Rewrite, simplify the archive rule and inline it into the only test `test/API/functionalities/archives/Makefile`. [1]: https://www.gnu.org/software/make/manual/html_node/Remaking-Makefiles.html [2]: http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ [3]: https://www.gnu.org/software/make/manual/html_node/Pattern-Match.html [4]: https://www.gnu.org/software/make/manual/html_node/Archive-Update.html ObjC/ObjCXX tests only run on macOS. I don't have testing environment. Hope someone can do it for me. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94890
2020-11-12[lldb] Add expect_var_path to test variable path resultsRaphael Isemann
This adds `expect_var_path` to test variable paths so we no longer have to use `frame var` and find substrs in the command output. The behaviour is identical with `expect_expr` (and it also uses the same checking backend), but it instead calls `GetValueForVariablePath` to evaluate the string as a variable path. Also rewrites a few of the tests that previously used `frame variable` to use `expect_var_path`. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D90450
2020-02-20[lldb] Remove license headers from all test source filesRaphael Isemann
Summary: Around a third of our test sources have LLVM license headers. This patch removes those headers from all test sources and also fixes any tests that depended on the length of the license header. The reasons for this are: * A few tests verify line numbers and will start failing if the number of lines in the LLVM license header changes. Once I landed my patch for valid SourceLocations in debug info we will probably have even more tests that verify line numbers. * No other LLVM project is putting license headers in its test files to my knowledge. * They make the test sources much more verbose than they have to be. Several tests have longer license headers than the actual test source. For the record, the following tests had their line numbers changed to pass with the removal of the license header: lldb-api :: functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py lldb-shell :: Reproducer/TestGDBRemoteRepro.test lldb-shell :: Reproducer/TestMultipleTargets.test lldb-shell :: Reproducer/TestReuseDirectory.test lldb-shell :: ExecControl/StopHook/stop-hook-threads.test lldb-shell :: ExecControl/StopHook/stop-hook.test lldb-api :: lang/objc/exceptions/TestObjCExceptions.py Reviewers: #lldb, espindola, JDevlieghere Reviewed By: #lldb, JDevlieghere Subscribers: emaste, aprantl, arphaman, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D74839
2020-02-11[lldb][test] Remove symlink for API tests.Jordan Rupprecht
Summary: Moves lldbsuite tests to lldb/test/API. This is a largely mechanical change, moved with the following steps: ``` rm lldb/test/API/testcases mkdir -p lldb/test/API/{test_runner/test,tools/lldb-{server,vscode}} mv lldb/packages/Python/lldbsuite/test/test_runner/test lldb/test/API/test_runner for 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; done for 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; done for 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, JDevlieghere Tags: #lldb Differential Revision: https://reviews.llvm.org/D71151