Skip to content

Commit 03e841c

Browse files
[lldb] Correct documentation of LLDB_TEST_USER_ARGS (#89042)
https://discourse.llvm.org/t/running-lldb-in-a-container/76801/4 found that the obvious way to use this variable doesn't work, despite what our docs and examples say. Perhaps in the past it did but now you need to use ";" as a separator to make sure the final command line works properly. For example "-A foo" becomes "-A foo" when python goes to run the runner script. The script sees this as one command line element, not two. What you actually want is "-A;foo" which we convert to "-A" "foo" which the script sees as one option and one value for that option. The "Script:" printout from dotest is misleading here because it does `" ".join(cmd)` so it looks like it's ok but in fact it's not. I'm not changing that format though because printing the command as a Python list is not useful outside of this specific situation.
1 parent c82f45f commit 03e841c

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

lldb/docs/resources/test.rst

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,23 +441,40 @@ Running the Full Test Suite
441441
The easiest way to run the LLDB test suite is to use the ``check-lldb`` build
442442
target.
443443

444+
::
445+
446+
$ ninja check-lldb
447+
448+
Changing Test Suite Options
449+
```````````````````````````
450+
444451
By default, the ``check-lldb`` target builds the test programs with the same
445452
compiler that was used to build LLDB. To build the tests with a different
446453
compiler, you can set the ``LLDB_TEST_COMPILER`` CMake variable.
447454

455+
You can also add to the test runner options by setting the
456+
``LLDB_TEST_USER_ARGS`` CMake variable. This variable uses ``;`` to separate
457+
items which must be separate parts of the runner's command line.
458+
448459
It is possible to customize the architecture of the test binaries and compiler
449-
used by appending ``-A`` and ``-C`` options respectively to the CMake variable
450-
``LLDB_TEST_USER_ARGS``. For example, to test LLDB against 32-bit binaries
451-
built with a custom version of clang, do:
460+
used by appending ``-A`` and ``-C`` options respectively. For example, to test
461+
LLDB against 32-bit binaries built with a custom version of clang, do:
452462

453463
::
454464

455-
$ cmake -DLLDB_TEST_USER_ARGS="-A i386 -C /path/to/custom/clang" -G Ninja
465+
$ cmake -DLLDB_TEST_USER_ARGS="-A;i386;-C;/path/to/custom/clang" -G Ninja
456466
$ ninja check-lldb
457467

458468
Note that multiple ``-A`` and ``-C`` flags can be specified to
459469
``LLDB_TEST_USER_ARGS``.
460470

471+
If you want to change the LLDB settings that tests run with then you can set
472+
the ``--setting`` option of the test runner via this same variable. For example
473+
``--setting;target.disable-aslr=true``.
474+
475+
For a full list of test runner options, see
476+
``<build-dir>/bin/lldb-dotest --help``.
477+
461478
Running a Single Test Suite
462479
```````````````````````````
463480

lldb/test/API/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ set(LLDB_TEST_ARCH
3535
# Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to pass to the script
3636
set(LLDB_TEST_USER_ARGS
3737
""
38-
CACHE STRING "Specify additional arguments to pass to test runner. For example: '-C gcc -C clang -A i386 -A x86_64'")
38+
CACHE STRING "Specify additional arguments to pass to test runner. Seperate \
39+
items with \";\". For example: '-C;gcc;-C;clang;-A;i386;-A;x86_64'")
3940

4041
set(LLDB_TEST_COMMON_ARGS_VAR
4142
-u CXXFLAGS

0 commit comments

Comments
 (0)