Skip to content

QOL changes for test runner #79

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

Merged

Conversation

khangng-ampere
Copy link
Contributor

This PR is a collection of small QOL changes to the test runner:

  1. Make TAP output a tad more useful, with captured logs from mctpd subprocess.
  2. Allow running without TAP by passing --interactive to meson.
  3. Allow filtering tests (or passing arbitrary flags) to pytest via --test-args.

As a result, instead of

meson test -C obj
cd obj
dbus-run-session env DBUS_STARTER_BUS_TYPE=user pytest
cd ..

It can be now

meson test -C obj --interactive

and for filtering tests:

meson test -C obj --interactive --test-args="-k recov"

pytest-tap 3.5 prints all the captured stdout and stderr into comments
of the TAP output:

    # --- Captured Err ---
    # test-mctpd: log CodeConstruct#1
    # test-mctpd: log CodeConstruct#2
    # test-mctpd: ...

This just improves the situation over having no logs at all, or having
to rerun with pytest directly to see the log.

Signed-off-by: Khang D Nguyen <[email protected]>
pytest-tap output is great for just summaries, but the log is very much
unreadable if tests fail. Currently there is an unresolved issue related
to terminalreporter, see [1].

[1] python-tap/pytest-tap#98

This commit adds a way to disable TAP. Newer versions of meson support
an --interactive flag, like so:

    meson test -C obj --interactive

This makes the test run directly in the terminal, not redirected to
a file. When this happens, i.e stdout is a terminal, we run the test
without TAP.

Signed-off-by: Khang D Nguyen <[email protected]>
Currently, to my knowledge, there is no way to filter tests when running
the testsuite through meson. Manually invoking pytest is the only way.

This PR allows such CLI invocation to be possible to filter tests
containing "recovery":

    meson test -C obj --test-args="-k recovery"

Signed-off-by: Khang D Nguyen <[email protected]>
@jk-ozlabs jk-ozlabs merged commit 380608e into CodeConstruct:main Jun 3, 2025
1 check passed
@khangng-ampere khangng-ampere deleted the khangng/push-mwunqxqkysto branch June 3, 2025 07:18
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.

2 participants