This RFC proposes to extend LLDB test suite functionality by adding the ability to run Shell tests against the remote target platform.
Motivation
CLI is one of the main ways users interact with LLDB, along with LLDB Python API/SB API. Since some clients are interested in using it for remote debugging, e.g. for new platforms, it is important to ensure that their experience with the remote debugging will be as smooth as with the local one.
Currently, the remote debugging functionality and cases with complicated build scenarios are tested using API tests. However, it would be nice to be able to run Shell tests with remote execution as well, since after connecting to the remote, the state of LLDB and the behavior of the LLDB command interpreter changes (for example see [lldb] Disable find-module.test in case of a remote target by slydiman ¡ Pull Request #94165 ¡ llvm/llvm-project ¡ GitHub). Many Shell tests launch processes, so we want them to do so remotely in the case of a cross environment.
Also, it may reveal potential future bugs, extend the Shell testing capabilities, and draw LLDB contributorsâ attention to the importance of considering remote debugging cases in their commits.
Implementation
To support cross environment with the LLDB Shell tests it seems to be sufficient to
-
Add
-O "platform select remote-linux" -O "platform connect <url>"
to the %lldb lit substitution in case of remote test run configuration. -
Add proper
--sysroot <...>
flag to %clang substitution in case of cross-compilation. -
Disable some tests and make some minor changes that consider that the host and target triples may be different.
Since it is done in a unified way, this does not add to the tests complexity and seems to cause only a little maintenance overhead down the road. Test source files that require complex build scenarios are rather used in API tests anyway. I also think it is better to limit the supported toolchains to clang+lld for remote Shell tests run to avoid the explosive growth of possible build configurations.
Is there a better way of doing this?
The implementation for the proposed change can be found here [lldb][test] Support remote run of Shell tests by dzhidzhoev ¡ Pull Request #95986 ¡ llvm/llvm-project ¡ GitHub. Comments, reviews, other approaches, and ideas are welcomed!