itest: New macro, support for tmt and debian autopkgtest, and more#246
Open
cgwalters wants to merge 1 commit intobootc-dev:mainfrom
Open
itest: New macro, support for tmt and debian autopkgtest, and more#246cgwalters wants to merge 1 commit intobootc-dev:mainfrom
cgwalters wants to merge 1 commit intobootc-dev:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new itest-macros crate to provide attribute macros for test registration, enhances the itest harness with output capture via fork-exec, and adds support for emitting test metadata in tmt (FMF) and autopkgtest (DEP-8) formats. My feedback highlights a potential naming collision in the generated static items and notes that the current output capture implementation may lose temporal ordering between stdout and stderr, though it remains acceptable for general use.
… capping Major feature expansion of the itest integration test framework to make it reusable across bootc-dev projects (bcvk, composefs-rs, bootc). Fork-exec output capture: when not under nextest or tmt, the harness re-executes itself per test to capture stdout/stderr, preventing interleaved output from parallel tests. Test metadata: --emit-tmt and --emit-autopkgtest flags generate FMF and DEP-8 metadata from registered tests, enabling tmt and autopkgtest to discover and run individual tests. Per-test TestMeta (timeout, needs_root, isolation, tags, flaky, etc.) maps to format-specific fields. Verified end-to-end with tmt. Proc macro: #[itest::test_attr] attribute macro replaces the declarative macros. Preserves doc comments, auto-converts error types (anyhow/eyre compatible), detects async fn and wraps with a tokio runtime, and accepts all metadata as attribute arguments. VM resource capping: when no explicit --itype is set, itest detects host memory (from /proc/meminfo and cgroup v2/v1 limits) and caps the VM to 70% of available memory. Prevents OOM on constrained CI runners like GHA (7 GiB / 2 vCPU). Override via ITEST_VM_MEMORY_MIB, ITEST_VM_VCPUS, or ITEST_VM_MEMORY_FRACTION. Spiked on composefs-rs: 43 tests migrated, net -120 lines deleted, all tests pass. Assisted-by: OpenCode (Claude Opus 4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A lot of stuff for itest, which is our Rust-based test framework for integration testing.
Fork-exec output capture: when not running under nextest or tmt, the harness re-executes itself per test to capture stdout/stderr, matching cargo test default behavior. ITEST_NOCAPTURE=1 disables for debugging.
Test metadata generation: --emit-tmt and --emit-autopkgtest flags generate FMF and DEP-8 metadata from registered tests, enabling tmt and autopkgtest to discover and run individual tests. Verified end-to-end with tmt.
TestMeta: per-test metadata struct (timeout, needs_root, isolation, tags, summary, needs_internet, flaky) that maps to tmt and autopkgtest fields. Stored in distributed slices alongside test functions.
Proc macro (#[itest::test_attr]): attribute macro that replaces the declarative macros for cleaner ergonomics. Preserves doc comments, handles error type conversion (anyhow/eyre/io::Error), supports async fn via automatic tokio runtime creation, and accepts all metadata as attribute arguments.
VM instance type: privileged_test! and booted_test! accept itype for VM sizing, threaded through require_root() to bcvk --itype.
The Justfile now prefers nextest with cargo test fallback, and fixes a pre-existing bug where set -e skipped cleanup on test failure.
Assisted-by: OpenCode (Claude Opus 4)