meson icon indicating copy to clipboard operation
meson copied to clipboard

`meson test --gdb` launches the wrapper with gdb instead of the wrappee test command

Open 3v1n0 opened this issue 4 years ago • 3 comments

Describe the bug

Using test wrappers will make --gdb option not to work, unless the wrapper is a binary itself, but is generally not expected to be tested, while we care about the wrappee.

To Reproduce

project('foo')

add_test_setup('default',
  is_default: true,
  exe_wrapper: find_program('env'),
)
test('true', find_program('true'))

Expected behavior

meson test _build --gdb will launch: /usr/bin/env gdb --quiet --nh --args /bin/true

While it's currently launching: gdb --quiet --nh --args /usr/bin/env /bin/true.

It may probably be even added addressed by using another command-line option (like --gdb-test-only) if we don't want to break the previous behavior, but personally I find that using wrappers is breaking hardly the ability to use debuggers with tests.

3v1n0 avatar Aug 27 '21 13:08 3v1n0

I have a custom test-runner script and this would beneficial because currently I have to set follow-fork-mode child to debug my stuff. https://github.com/hse-project/hse/blob/master/tests/test-runner

tristan957 avatar Aug 31 '21 18:08 tristan957

Yeah set follow-fork-mode child may work, but not if you're using a script with sh-bang comment as the test executable, as gdb won't recognize it as a binary file, the only way would be to explicitly set the test binary as bash, python3 and friends and the script itself as argument.

3v1n0 avatar Sep 06 '21 12:09 3v1n0

That is the exact problem I have faced recently.

tristan957 avatar Sep 07 '21 20:09 tristan957