test: add new target "coverage"
add a new target "make coverage" to generate the lcov coverage report for the tests suite.
Most of the changes were done with Claude Code.
It is the first step to get more coverage in our tests.
Summary by Sourcery
Add configurable code coverage support to the build and introduce richer, structured logging and skip reasons in the Python test suite.
Build:
- Introduce --enable-coverage configure option with gcov/lcov/gcovr integration and corresponding Makefile coverage targets and flags.
Tests:
- Enhance Python tests to return structured skip reasons and improve diagnostics via a shared logger and additional /tmp mount.
- Adjust many tests to hide container stderr by default to reduce noise while preserving detailed error logging.
- Add a tmpfs /tmp mount to the base test configuration and tweak some test setups/cleanup for robustness.
Reviewer's Guide
Adds optional code coverage support (configure flag, compiler/linker flags, and make coverage targets) and refactors the Python test suite to use a shared logger, structured skip reasons, quieter run_and_get_output calls, and more robust TAP-style diagnostics and cleanup behavior.
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Introduce configurable code coverage support and make targets driven by gcov/lcov/gcovr. |
|
configure.acMakefile.ammaint.mk |
| Standardize Python test logging, error reporting, and TAP output handling across the test suite. |
|
tests/tests_utils.pytests/test_devices.pytests/test_mounts.pytests/test_exec.pytests/test_delete.pytests/test_resources.pytests/test_uid_gid.pytests/test_capabilities.pytests/test_oci_features.pytests/test_hostname.pytests/test_mounts.pytests/test_oci_features.pytests/test_cwd.pytests/test_limits.pytests/test_seccomp.pytests/test_bpf_devices.pytests/test_domainname.pytests/test_pid.pytests/test_rlimits.pytests/test_time.pytests/test_tty.pytests/test_hooks.pytests/test_start.pytests/test_mempolicy.py |
| Make tests more automation-friendly by returning structured skip reasons and reducing noisy stderr from helpers. |
|
tests/tests_utils.pytests/test_mempolicy.pytests/test_start.pytests/test_devices.pytests/test_mounts.pytests/test_exec.pytests/test_delete.pytests/test_resources.pytests/test_uid_gid.pytests/test_capabilities.pytests/test_limits.pytests/test_seccomp.pytests/test_bpf_devices.pytests/test_time.pytests/test_tty.pytests/test_bpf_devices.pytests/test_update.pytests/test_pid_file.pytests/test_init.c (via tests_init_CFLAGS in Makefile.am) |
| Tighten and extend container test behavior (tmpfs /tmp, mounts, idmapped mounts, cgroups, etc.) to be more deterministic and debuggable. |
|
tests/tests_utils.pytests/test_mounts.pytests/test_devices.pytests/test_update.pyMakefile.am |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
Ephemeral COPR build failed. @containers/packit-build please check.
TMT tests failed. @containers/packit-build please check.
fuzzing CI fixed here: https://github.com/containers/crun/pull/1922
@jnovy PTAL
@jnovy thanks! Fixed now
The rest is looking good - it currently covers 29% but it's a good starting point. LGTM