Repository navigation
test(fake-executable): name the failing step and the fake - #656
Conversation
`write_fake_executable` passed the spawn, pipe and chmod errors up bare, so when the old separate write/chmod `.expect()` messages at the call sites were folded into one, a failure lost which step went wrong. Each step now names the path and itself, keeping the original error kind, and the two rocm-smi stubs in the workflow-contract tests say which preflight they belong to. Also drop the `stdout(Stdio::null())` the in-script redirect already supersedes, and say in the module docs why the helper is public rather than `cfg(test)` or feature-gated. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
juhovainio
left a comment
There was a problem hiding this comment.
Reviewed this (test-only, ~40 lines across 2 files) with two independent passes. No blocking issues.
Verified: all four step_error(...) call sites correctly map to their failure modes (spawn/wait/send/chmod) with the right ErrorKind preserved; the two xtask .expect(...) edits line up with run_preflight/run_preflight_pwsh; the new chmod-failure test is a real, reliable repro (Unix-only via cfg(all(test, unix)), relies on real EPERM, correctly guarded by the existing running_as_root() convention); the stdout(Stdio::null()) removal has zero behavioral effect since the spawned command's own shell redirect already controls where output goes.
Two minor non-blocking notes, neither worth holding this up for:
- The
stdout(Stdio::null())removal is a touch of a behavior-adjacent change riding along in atest(...)-typed commit without being called out in the new doc comment. Harmless since it's confirmed dead code, but a skimming reviewer could miss it. running_as_root()unconditionally returnsfalseon non-Linux unix (e.g. macOS), so this new test would misbehave if ever run as root on a hypothetical macOS runner. Pre-existing, not introduced here, and there's no macOS CI lane today, so purely latent.
Approving - nothing here blocks merge.
|
Thanks. On the two notes:
|
Follows up #649.
write_fake_executable's errors now name the path and the step that failed (spawn, send, wait or chmod) and keep the original error kind, so each call site's single.expectstill shows whether the write or the chmod failed. The two rocm-smi stubs inxtask/src/workflow_contract.rsnow say which preflight (bash/sh or pwsh) they belong to. This change also drops the deadstdout(Stdio::null())and documents why the module is a plainpubmodule rather than gated behind a feature: its callers are test code in other crates, which can't seecfg(test), and a feature would have to be enabled in every consumer's dev-dependency.A new test,
a_failed_chmod_names_the_path_and_the_step, makes a real chmod fail. Removing the chmod error context fails it.Verified locally:
rocm-core(623),xtask(247) ande2e-cucumberlib (142), plusfeature_namingx86_64-pc-windows-gnuNo scenario: this is test-support code, and nothing a CLI user sees changes.