================ @@ -403,6 +403,70 @@ The 'child_send1.txt' file gets generated during the test run, so it makes sense TestSTTYBeforeAndAfter.py file to do the cleanup instead of artificially adding it as part of the default cleanup action which serves to cleanup those intermediate and a.out files. +## How To Test Specific Things + +Below is a breakdown of the layers in an lldb session, with hints for the type of +tests you can use to test these steps in isolation. + +If isolation is not possible, the fallback is always a Shell or API test that +works at a higher level. For these, try to be sure that the behaviour you are +checking for is not going to be generated by code other than the code in question, +now, or in the future. + +### Interactive user interface elements + +Like the text user interface, or tab completion in the command line interface. + +Use a `PExpectTest` or call the SBAPI equivalent of what the user's input is +doing. In completion's case, `SBCommandInterpreter::HandleCompletion`. + + +### Internal components of `lldb` and the debug server + +Use a unit test. It is justified to refactor code in order for it to be unit +tested. + +### `lldb`'s handling of specific packets and sequences of packets + +Use an API test that creates a mock debug server. Look for +`MockGDBServer` and `MockGDBServerResponder` in the existing test suite. + +If you need to fake part of the debug server but forward the rest to a real +debug server, start by looking at the reverse execution tests which use +`ReverseTestBase`. + +### The debug server's handling of specific packets or sequences of packets + +Use an API test that sends fake traffic to a real `lldb-server`. The existing +tests in `lldb/test/API/tools/lldb-server` are your starting point. + +### What the debug server does to the inferior process + +Generally you can check this using `lldb`'s own commands in a Shell or API +test. + +However if you do not trust enough of the implementation yet to do that, +you can have the inferior process check things for you. + +For example to test register access the API test might: +* Launch the inferior, which writes a known pattern to the register using ---------------- bulbazord wrote:
Suggestion: Use an ordered list. https://github.com/llvm/llvm-project/pull/205581 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
