Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meson test --interactive #13112

Merged
merged 2 commits into from
Apr 24, 2024
Merged

Conversation

DaanDeMeyer
Copy link
Contributor

This is very similar to --gdb, except it doesn't spawn GDB, but connects stdin/stdout/stderr directly to the test itself. This allows interacting with integration tests that spawn a shell in a container or virtual machine when the test fails.

In systemd we're migrating our integration tests to run using the meson test runner. We want to allow interactive debugging of failed tests directly in the virtual machine or container that is spawned to run the test. To make this possible, we need meson test to connect stdin/stdout/stderr of the test directly to the user's terminal, just like is done with the --gdb option.

Copy link
Member

@eli-schwartz eli-schwartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No release notes snippet. Unit tests documentation should mention the version it was added in (otherwise users might try the command line argument with older meson, and get confused when it doesn't exist).

@DaanDeMeyer DaanDeMeyer force-pushed the interactive branch 2 times, most recently from 1893caf to e06fbe2 Compare April 19, 2024 14:38
@DaanDeMeyer
Copy link
Contributor Author

Let me know if I added the release notes snippet in the right file

@eli-schwartz
Copy link
Member

docs/markdown/snippets/*.md

See https://mesonbuild.com/Contributing.html#documentation

@DaanDeMeyer DaanDeMeyer force-pushed the interactive branch 3 times, most recently from 20209f8 to e61afa6 Compare April 23, 2024 06:30
@DaanDeMeyer
Copy link
Contributor Author

@jpakkane @eli-schwartz Any chance this could get another look? This is the final piece we need to allow debugging systemd's integration tests.

This is very similar to --gdb, except it doesn't spawn GDB, but
connects stdin/stdout/stderr directly to the test itself. This allows
interacting with integration tests that spawn a shell in a container
or virtual machine when the test fails.

In systemd we're migrating our integration tests to run using the
meson test runner. We want to allow interactive debugging of failed
tests directly in the virtual machine or container that is spawned
to run the test. To make this possible, we need meson test to connect
stdin/stdout/stderr of the test directly to the user's terminal, just
like is done with the --gdb option.
This allows tests to check whether stdin is a tty to figure out if they're
running in interactive mode or not.

It also makes sure that tests that are not running in interactive mode
don't inadvertendly try to read from stdin.
@jpakkane
Copy link
Member

LGTM

@jpakkane jpakkane merged commit 5754140 into mesonbuild:master Apr 24, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants