Repository navigation
test(examine): property-test the driver-side text readers - #558
Conversation
`examine` judges the driver side of a host from a few small text readers. Each now has a property with an oracle stated independently of the code: the WSL Ubuntu floor is monotone in the release; device-node access follows POSIX owner/group/other precedence; `blacklist amdgpu` is recognized per the modprobe.d grammar (not when commented out, not for another module whose name starts with `amdgpu`); `iommu=` is read from its own cmdline token and never from `amd_iommu=` or `intel_iommu=`; and every spelling of a gfx target a host reports normalizes to an install family the CLI recognizes, idempotently. Inputs come from small real-shaped alphabets, and a deterministic test draws from the same strategies and requires every region of each oracle to be reached. None of these found a defect; they are regression guards. The one gap in this area, `blacklistamdgpu` read as a directive, is #506 and is pinned by an ignored test its fix should un-ignore. `PROPTEST_CASES` raises the case count. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
jussielo-amd
left a comment
There was a problem hiding this comment.
Nice, careful piece of work. Traced each property (mode_access owner/group/other precedence, the blacklist grammar, iommu= tokenization, the WSL floor, and the gfx-family normalize/round-trip) against the actual implementation by hand, and the oracles all check out independently of the code — no vacuous generators, no off-by-one in the permission-class indices, and the inputs_reach_every_region hit-rate math holds up with real margin. Ran the suite plus clippy and fmt locally and everything's clean, matching the PR description. The #506 pin and the #521 scoping note both check out against the live issue/PR too.
One small nice-to-have: GFX_TARGETS doesn't include a gfx125x example, so that branch of normalize_therock_family isn't exercised by this property test (the existing example test still covers it, so no real gap). Not blocking.
Approving.
|
Following up the non-blocking note on the review: #628 adds |
…es (ROCm#628) The family property draws its targets from GFX_TARGETS, which had no gfx125x entry, so the gfx125* arm of normalize_therock_family was only covered by its single example test. Add gfx1250, the gfx125x target the detection code already produces from a 12.5.0 GC version, so the property now also checks that a host reporting it lands on a known TheRock family in any spelling, and that the family is stable under a second normalization. With the gfx125* arm deleted, the property now fails with minimal input "gfx1250"; without this entry the same mutation passes it. Follows up the review on ROCm#558. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
tests/e2e-cucumber/expectations.tomlfor the fixed ticket ID and removed/narrowed any now-stale xfail rows. — N/A, test-only.docs/architecture.md. — N/A.Summary
rocm examinejudges the driver side of a host with a few small text readers. Each one now has a property whose oracle is stated independently of the code:distro_clears_wsl_floormode_accessstat -c %Astring (with or without the ACL+)line_blacklists_amdgpublacklist amdgpuis recognized, but not when commented out and not foramdgpu_foo,amdgpufoo,amdgpu2,radeonoramdkfdparse_iommu_paramiommu=is read from its own token, never fromamd_iommu=orintel_iommu=normalize_therock_family:xnack-suffix, trailing whitespace) normalizes to a family inknown_therock_families(), and normalizing again changes nothingNone of them found a defect, so they are regression guards. They extend the existing example tests (
iommu_param_parsed_from_cmdline,blacklist_amdgpu_detection,mode_access_owner_group_other_precedence,known_therock_families_all_round_trip) from a few hand-picked inputs to the whole input alphabet.The
iommu=generator deliberately never produces twoiommu=tokens. Which one takes effect is the kernel's decision, not a tokenization property, and pinning the current first-match behaviour would make a correct change look like a regression.Reach
inputs_reach_every_regiondraws 2048 inputs from each strategy with a deterministic RNG and requires each region to appear in at least 5% of draws:mode_access: owner class 1034, group class 478 (other is the rest)iommu=present 1053, only look-alike parameters 749Mutation testing
Each mutant turned its property red and was then restored:
mode_accesschecks the group before the ownerparse_iommu_parammatchesiommu=anywhere in a tokenamd_iommu=…read asiommu=)line_blacklists_amdgpuaccepts any module starting withamdgpublacklist amdgpu_foo)(24, 4) clears the floor but the newer (30, 4) does not)Ignored reproducer, tied to #506
blacklistamdgpu(no whitespace after the directive) is read as a blacklist. That is #506. The blacklist property's separator alphabet therefore excludes the empty separator. A separate test,a_blacklist_directive_needs_whitespace_before_the_module, is#[ignore]d with(#506)in the reason; it still fails on this base. The fix for #506 should un-ignore it and can then let the property draw an empty separator.Relationship to #521
This comes from a property-testing pass over GPU classification. Everything in that pass about APU classification — the lspci/marketing-name/rocminfo/Windows-row properties, the corpus sweeps, the Raphael + RX 7900 XTX
diagnosetest and thevram_capacity_is_meaningfultest — is already in #521 and was dropped from here. What remains is the driver-side readers, which #521 does not touch.The new module is
examine_driver_proptests.rs(#521 addsexamine_proptests.rs), declared at the end ofexamine.rs, so the two PRs do not overlap.examine.rsmerges cleanly with #521. The family property also holds after #521, which addsgfx90cas its own family in bothnormalize_therock_familyandknown_therock_families().Determinism, runtime, platforms
proptest-regressions/as usual.PROPTEST_CASESraises the case count (default 256).AGENTS.md §3
This is a test-only change: it changes no CLI output, exit code, file layout or runtime selection, so no Gherkin scenario is needed.
Verification
cargo test --locked -p rocm-core: exit 0 (478 passed, 1 ignored)cargo clippy --locked --workspace --all-targets -- -D warnings: exit 0cargo clippy --locked -p e2e-cucumber --test e2e -- -D warnings: exit 0cargo fmt --all --check,cargo xtask manifest --check,cargo xtask tpn --check,cargo xtask check-crate-edges: exit 0