Skip to content

Commit 5d738b2

Browse files
[lldb][Docs] Expand remote testing instructions (#122694)
There's a lot of fiddly bits to get right here, so I've added a more complete example and explained why you might choose one method over another. I thought about adding this to the qemu testing page, as that's what we (Linaro) use this for mostly, but it applies to any remote system whether hardware or simulator.
1 parent f99e6df commit 5d738b2

File tree

1 file changed

+53
-17
lines changed

1 file changed

+53
-17
lines changed

lldb/docs/resources/test.rst

+53-17
Original file line numberDiff line numberDiff line change
@@ -586,24 +586,60 @@ To run a specific test, pass a filter, for example:
586586
Running the Test Suite Remotely
587587
```````````````````````````````
588588

589-
Running the test-suite remotely is similar to the process of running a local
590-
test suite, but there are two things to have in mind:
591-
592-
1. You must have the lldb-server running on the remote system, ready to accept
593-
multiple connections. For more information on how to setup remote debugging
594-
see the Remote debugging page.
595-
2. You must tell the test-suite how to connect to the remote system. This is
596-
achieved using the ``LLDB_TEST_PLATFORM_URL``, ``LLDB_TEST_PLATFORM_WORKING_DIR``
597-
flags to cmake, and ``--platform-name`` parameter to ``dotest.py``.
598-
These parameters correspond to the platform select and platform connect
599-
LLDB commands. You will usually also need to specify the compiler and
600-
architecture for the remote system.
601-
3. Remote Shell tests execution is currently supported only for Linux target
602-
platform. It's triggered when ``LLDB_TEST_SYSROOT`` is provided for building
603-
test sources. It can be disabled by setting ``LLDB_TEST_SHELL_DISABLE_REMOTE=On``.
604-
Shell tests are not guaranteed to pass against remote target if the compiler
605-
being used is other than Clang.
589+
1. Run lldb-server on the remote system, so that it can accept multiple connections.
590+
This is called "platform" mode:
606591

592+
::
593+
594+
lldb-server platform --server --listen 0.0.0.0:<port A> --gdbserver-port <port B>
595+
596+
Assuming that ``port A`` and ``port B`` on the remote system can be reached
597+
from your host system. If your remote system is a simulator on your host machine,
598+
you may need to forward these ports to the host when you start the simulator.
599+
600+
For more information on how to setup remote debugging see :doc:`/use/remote`.
601+
602+
2. Tell the test-suite how to connect to the remote system. This is done using the
603+
``LLDB_TEST_PLATFORM_URL`` and ``LLDB_TEST_PLATFORM_WORKING_DIR`` flags of CMake,
604+
or the ``--platform-name``, ``--platform-url`` and ``--platform-working-dir``
605+
parameters of ``dotest.py``. These parameters are passed on to the ``platform select``
606+
and ``platform connect`` LLDB commands when the tests are run.
607+
608+
You will usually need to specify the compiler and architecture for the
609+
remote system. This is done with CMake options ``LLDB_TEST_COMPILER`` and
610+
``LLDB_TEST_ARCH``, or the ``dotest.py`` options ``--compiler`` and ``--arch``.
611+
612+
.. note::
613+
Even in cases where the two systems are the same architecture and run the
614+
same operating system, there may be version differences between the two
615+
which require you to use a different compiler version for remote testing.
616+
617+
For example, to run tests using ``dotest.py`` on a remote AArch64 Linux system
618+
you might run:
619+
620+
::
621+
622+
./bin/lldb-dotest --platform-name remote-linux --arch aarch64 --compiler aarch64-none-linux-gnu-gcc --platform-url connect://<remote-ip>:<port A> --platform-working-dir /tmp/test_lldb -p <test-name>.py
623+
624+
This is the equivalent of:
625+
626+
* ``LLDB_TEST_ARCH`` = ``aarch64``
627+
* ``LLDB_TEST_COMPILER`` = ``aarch64-none-linux-gnu-gcc``
628+
* ``LLDB_TEST_PLATFORM_URL`` = ``connect://<remote-ip>:<port A>``
629+
* ``LLDB_TEST_PLATFORM_WORKING_DIR`` = ``/tmp/test_lldb``
630+
631+
Setting these values using CMake allows you to run ``ninja check-lldb`` to run
632+
tests on the remote system.
633+
634+
If you have a host build that you sometimes check on a remote system, but otherwise
635+
test on the host, adding arguments to ``dotest.py`` manually is easier.
636+
637+
.. note::
638+
Remote Shell test execution is currently supported only for Linux targets.
639+
It is enabled when ``LLDB_TEST_SYSROOT`` is set. Remote Shell testing can
640+
be disabled by setting ``LLDB_TEST_SHELL_DISABLE_REMOTE=On``. Shell tests
641+
are not guaranteed to pass against remote target if the test compiler is not
642+
Clang.
607643

608644
Running tests in QEMU System Emulation Environment
609645
``````````````````````````````````````````````````

0 commit comments

Comments
 (0)