summaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
AgeCommit message (Collapse)Author
2020-08-14[lldb] Use SBProcess::Continue instead of 'run' command in TestTargetAPI.pyRaphael Isemann
This test is flaky on Green Dragon as it often fails when the process state is "Invalid" in the assert: self.assertEqual(process.GetState(), lldb.eStateExited) It seems this is related to just doing "run" which apparently invalidates the Target's process in case it's still running and needs to be restarted. Just doing 'continue' on the process (and ignoring the error in case it already finished) prevents that and makes this consistently pass for me. Just pushing this out to get Green Dragon back online.
2020-08-13[lldb] Set the launch flags to GetLaunchInfo().GetLaunchFlags()Jonas Devlieghere
Instead of clearing the launch flags, always pass the target's current launch flags.
2020-08-07[lldb] Assert the process has exited before we gets its output.Jonas Devlieghere
2020-08-06[LLDB] Mark test_launch_simple as a no-debug-info testJonas Devlieghere
No need to run this test with the multiple variants.
2020-08-06[LLDB] Skip test_launch_simple from TestTargetAPI.py when remoteJonas Devlieghere
2020-08-06[lldb] Use target.GetLaunchInfo() instead of creating an empty one.Jonas Devlieghere
Update tests that were creating an empty LaunchInfo instead of using the one coming from the target. This ensures target properties are honored.
2020-08-06[LLDB] Skip test_launch_simple from TestTargetAPI.py on Arm/AArch64 LinuxMuhammad Omair Javaid
Recently added TestTargetAPI.py test "test_launch_simple" is failing on Arm/AArch64 Linux targets. Putting them to skip until fixed. Differential Revision: https://reviews.llvm.org/D85235
2020-08-05"|" used when "||" was meant in SBTarget::FindFunctionsJim Ingham
2020-08-05[lldb] Skip test_launch_simple on WindowsJonas Devlieghere
Because stdio manipulation unsupported on Windows.
2020-08-05[lldb] Make SBTarget::LaunchSimple start form the target's LaunchInfoJonas Devlieghere
Currently SBTarget::LaunchSimple creates a new LaunchInfo which means it ignores any target properties that have been set. Instead, it should start from the target's LaunchInfo and populated the specified fields. Differential revision: https://reviews.llvm.org/D85235
2020-08-04[lldb/Test] Skip tests that try to get the remote environmentJonas Devlieghere
We don't support getting the remote environment. The gdb remote protocol has no packet for that.
2020-07-23Recommit "[lldb/API] Overwrite variables with ↵Pavel Labath
SBLaunchInfo::SetEnvironment(append=true)" The patch was reverted 27d52cd86a2c because of failures in TestWeakSymbols.py. These have now been addressed in D83552. The original commit message was: This function was documented to overwrite entries with D76111, which was adding a couple of similar functions. However, this function (unlike the functions added in that patch) was/is not actually overwriting variables -- any pre-existing variables would get ignored. This behavior does not seem to be intentional. In fact, before the refactor in D41359, this function could introduce duplicate entries, which could have very surprising effects both inside lldb and on other applications (some applications would take the first value, some the second one; in lldb, attempting to unset a variable could make the second variable become active, etc.). Overwriting seems to be the most reasonable behavior here, so change the code to match documentation. Differential Revision: https://reviews.llvm.org/D83306
2020-07-14[lldb/Test] Always set the cleanupSubprocesses tear down hookJonas Devlieghere
Always clean up subprocesses on tear down instead of relying on the caller to do so. This is not only less error prone but also means the tests can be more concise. Differential revision: https://reviews.llvm.org/D83787
2020-07-08Revert "[lldb/API] Overwrite variables with ↵Davide Italiano
SBLaunchInfo::SetEnvironment(append=true)" This reverts commit 695b33a56919af8873eecb47cb83fa17a271e99f beacuse it broke the macOS bot.
2020-07-08[lldb/API] Overwrite variables with SBLaunchInfo::SetEnvironment(append=true)Pavel Labath
Summary: This function was documented to overwrite entries with D76111, which was adding a couple of similar functions. However, this function (unlike the functions added in that patch) was/is not actually overwriting variables -- any pre-existing variables would get ignored. This behavior does not seem to be intentional. In fact, before the refactor in D41359, this function could introduce duplicate entries, which could have very surprising effects both inside lldb and on other applications (some applications would take the first value, some the second one; in lldb, attempting to unset a variable could make the second variable become active, etc.). Overwriting seems to be the most reasonable behavior here, so change the code to match documentation. Reviewers: clayborg, wallace, jingham Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D83306
2020-06-30[lldb/Test] Introduce "assertSuccess"Pavel Labath
Summary: A lot of our tests do 'self.assertTrue(error.Success()'. The problem with that is that when this fails, it produces a completely useless error message (False is not True) and the most important piece of information -- the actual error message -- is completely hidden. Sometimes we mitigate that by including the error message in the "msg" argument, but this has two additional problems: - as the msg argument is evaluated unconditionally, one needs to be careful to not trigger an exception when the operation was actually successful. - it requires more typing, which means we often don't do it assertSuccess solves these problems by taking the entire SBError object as an argument. If the operation was unsuccessful, it can format a reasonable error message itself. The function still accepts a "msg" argument, which can include any additional context, but this context now does not need to include the error message. To demonstrate usage, I replace a number of existing assertTrue assertions with the new function. As this process is not easily automatable, I have just manually updated a representative sample. In some cases, I did not update the code to use assertSuccess, but I went for even higher-level assertion apis (runCmd, expect_expr), as these are even shorter, and can produce even better failure messages. Reviewers: teemperor, JDevlieghere Subscribers: arphaman, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D82759
2020-05-27[lldb/Reproducers] Skip or fix the remaining tests.Jonas Devlieghere
After this patch all remaining tests should pass on macOS when replayed from a reproducer. To capture the reproducers: ./bin/llvm-lit ../llvm-project/lldb/test/ --param lldb-run-with-repro=capture To replay the reproducers: ./bin/llvm-lit ../llvm-project/lldb/test/ --param lldb-run-with-repro=replay
2020-05-27[lldb/Reproducers] Differentiate active and passive replay unexpected packet.Jonas Devlieghere
2020-05-26[lldb/Reproducers] Skip remaining failing test in python_api subdirJonas Devlieghere
Skip the remaining two failing test in the python_api subdirectory. See inline comments for the reason why.
2020-05-25[lldb/Test] Add a trace method to replace print statements.Jonas Devlieghere
Many tests use (commented out) print statement for debugging the test itself. This patch adds a new trace method to lldbtest to reuse the existing tracing infrastructure and replace these print statements. Differential revision: https://reviews.llvm.org/D80448
2020-05-21[lldb/Test] Fix replay with TestSetWatchpoint.pyJonas Devlieghere
The reproducers only track the creation of objects and not their destruction. Therefore it keeps all objects alive indefinitely.
2020-05-21[lldb/Test] Cleanup TestSymbolContext.pyJonas Devlieghere
Remove commented out code, fix the indentation and always use the full path to the executable. The latter is necessary for the test to pass from reproducer replay.
2020-05-21Move decorator to the correct function.Adrian Prantl
2020-05-21Disable malloc stepping test under ASAN. The output is different and I'm not ↵Adrian Prantl
sure how stable it is.
2020-05-20[lldb/Reproducers] Fix/skip passive replay failures in python_api subdirJonas Devlieghere
Fixes or skips tests in the python_api subdirectory that were failing with passive replay.
2020-05-20[lldb/Reproducers] Skip another test that uses lldb::FileSP under the hoodJonas Devlieghere
2020-05-13[LLDB] Mark some xfails for arm-linuxMuhammad Omair Javaid
This patch marks following tests as xfail for arm-linux target. lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py lldb/test/API/python_api/thread/TestThreadAPI.py lldb/test/Shell/Recognizer/assert.test Bugs have been filed for all of them for the corresponding failing component.
2020-05-07[lldb/Test] Skip more tests that are not expected to work with passive replayJonas Devlieghere
This skips some tests that pass with active replay (which doesn't check the output) but fail with passive replay. Valid reasons for this include: - Checking the output of the process (which doesn't run during replay), - Checking files that cannot be captured in the VFS (non-existing or unreadable files or files that are removed during test), Unfortunately there's no good way to mark a test as supported for active replay but unsupported for passive replay because the number and order of API calls needs to be identical during capture and replay. I don't think this is a huge loss however.
2020-05-07[lldb/Test] Fix typo in find-and-replace.Jonas Devlieghere
2020-05-07[lldb/Test] Add @skipIfReproducer to tests using lldb::FileSP.Jonas Devlieghere
lldb::FileSP is a typedef for std::shared_ptr<lldb_private::File> and the reproducers cannot instrument a lldb_private constructor.
2020-04-21[lldb/Test] Add skipIfReproducer for tests that diverge during replayJonas Devlieghere
Add the skipIfReproducer decorator to the remaining tests that fail to replay because the GDB remote packets diverge during replay. This is *not* expected and should be fixed, but figuring out exactly what caused the divergence has proven pretty difficult to track down. I've marked these tests as skipped for now so we can get clean results and detect new regressions. I have no evidence to believe that these failures have the same root cause, so I've not assigned them a PR.
2020-04-07[lldb] NFC: Fix trivial typo in comments, documents, and messagesKazuaki Ishizaki
Differential Revision: https://reviews.llvm.org/D77460
2020-04-01[lldb] Inherit host environment when running shell commandsPavel Labath
Summary: On most hosts we were running shell commands with an empty environment. The only exception was windows, which was inheriting the host enviroment mostly by accident. Running the commands in an empty environment does not sound like a sensible default, so this patch changes Host::RunShellCommand to inherit the host environment. This impacts both commands run via SBPlatform::Run (in case of host platforms), as well as the "platform shell" CLI command. Reviewers: jingham, friss Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D77123
2020-03-23Create basic SBEnvironment classWalter Erquinigo
2020-03-23Revert "Create basic SBEnvironment class"Walter Erquinigo
This reverts commit fd868f517d2c5ca8c0f160dbec0857b14ecf74c1.
2020-03-23Create basic SBEnvironment classWalter Erquinigo
2020-03-20Revert "Create basic SBEnvironment class"Walter Erquinigo
This reverts commit 34c0759f846447454714c8faa0e1753a8713637b.
2020-03-20Create basic SBEnvironment classWalter Erquinigo
Summary: Inspired by https://reviews.llvm.org/D74636, I'm introducing a basic version of Environment in the API. More functionalities can be added as needed. Reviewers: labath, clayborg Subscribers: mgorny, lldb-commits, diazhector98 Tags: #lldb Differential Revision: https://reviews.llvm.org/D76111
2020-03-20Temporarily Revert "Create basic SBEnvironment class"Adrian Prantl
while investigating bot breakage. This reverts commit 2dec82652e4b6424e46e7bd674cb6404e01e218e.
2020-03-20Create basic SBEnvironment classWalter Erquinigo
Summary: Inspired by https://reviews.llvm.org/D74636, I'm introducing a basic version of Environment in the API. More functionalities can be added as needed. Reviewers: labath, clayborg Subscribers: mgorny, lldb-commits, diazhector98 Tags: #lldb Differential Revision: https://reviews.llvm.org/D76111
2020-03-05[lldb][test] TestFileHandle: flush the output after writeTatyana Krasnukha
2020-03-05[lldb][testsuite] Create a SBDebugger instance for each testTatyana Krasnukha
Some tests set settings and don't clean them up, this leads to side effects in other tests. The patch removes a global debugger instance with a per-test debugger to avoid such effects. From what I see, lldb.DBG was needed to determine the platform before a test is run, lldb.selected_platform is used for this purpose now. Though, this required adding a new function to the SBPlatform interface. Differential Revision: https://reviews.llvm.org/D74903
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-13[lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in ↵Raphael Isemann
the test suite Summary: The error message from the construct `assertTrue(a == b, "msg") ` are nearly always completely useless for actually debugging the issue. This patch is just replacing this construct (and similar ones like `assertTrue(a != b, ...)` with the proper call to assertEqual or assertNotEquals. This patch was mostly written by a shell script with some manual verification afterwards: ``` lang=python import sys def sanitize_line(line): if line.strip().startswith("self.assertTrue(") and " == " in line: line = line.replace("self.assertTrue(", "self.assertEquals(") line = line.replace(" == ", ", ", 1) if line.strip().startswith("self.assertTrue(") and " != " in line: line = line.replace("self.assertTrue(", "self.assertNotEqual(") line = line.replace(" != ", ", ", 1) return line for a in sys.argv[1:]: with open(a, "r") as f: lines = f.readlines() with open(a, "w") as f: for line in lines: f.write(sanitize_line(line)) ``` Reviewers: labath, JDevlieghere Reviewed By: labath Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D74475
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