llvm-project/lldb/test/API/api
Raphael Isemann 54c2687292 [lldb] Introduce createTestTarget for creating a valid target in API tests
At the moment nearly every test calls something similar to
`self.dbg.CreateTarget(self.getBuildArtifact("a.out"))` and them sometimes
checks 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 are
always just indicating that the target failed to be created but now why.

This patch introduces a helper function `createTestTarget` to our Test class
that creates the target with the much more verbose `CreateTarget` overload that
gives us back an SBError (with a fancy error). If the target couldn't be created
the function prints out the SBError that LLDB returned and asserts for us. It
also defaults to the "a.out" build artifact path that nearly all tests are using
to 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 the
test suite as follow ups.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D102771
2021-05-24 16:18:44 +02:00
..
check_public_api_headers
command-return-object
listeners [lldb] Introduce createTestTarget for creating a valid target in API tests 2021-05-24 16:18:44 +02:00
log [lldb] Fix TestAPILog.py for reproducer replay 2020-08-21 10:35:35 -07:00
multiple-debuggers [lldb] [test] Un-XFAIL TestMultipleDebuggers.py 2020-11-18 12:09:04 +01:00
multiple-targets [LLDB] Skip TestMultipleTargets.py on Arm/AArch64 Linux 2021-02-16 01:28:16 +05:00
multithreaded [lldb] [POSIX-DYLD] Add libraries from initial rendezvous brkpt hit 2020-12-17 09:31:10 +01:00