Skip to content

test(fake-executable): name the failing step and the fake - #656

Merged
rominf merged 1 commit into
mainfrom
test/fake-executable-tidy
Oct 13, 2026
Merged

rominf merged 1 commit into
mainfrom
test/fake-executable-tidy

Conversation

@rominf

@rominf rominf commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

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 .expect still shows whether the write or the chmod failed. The two rocm-smi stubs in xtask/src/workflow_contract.rs now say which preflight (bash/sh or pwsh) they belong to. This change also drops the dead stdout(Stdio::null()) and documents why the module is a plain pub module rather than gated behind a feature: its callers are test code in other crates, which can't see cfg(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:

  • fmt
  • tests for rocm-core (623), xtask (247) and e2e-cucumber lib (142), plus feature_naming
  • both clippy invocations, on Linux and for x86_64-pc-windows-gnu

No scenario: this is test-support code, and nothing a CLI user sees changes.

`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 juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 a test(...)-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 returns false on 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.

@rominf

rominf commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks. On the two notes:

  • stdout(Stdio::null()): the description calls the removal out ("drops the dead stdout(Stdio::null())"). The squash merge uses the PR title and description, so the merged commit will record it too. The spawned command already redirects its own output, so removing the call changes nothing at run time.
  • running_as_root() on macOS: that platform is out of scope. AGENTS.md lists Windows and Linux as the only supported hosts and asks not to change logic for other platforms, and there is no macOS lane. I am leaving it as it is.

@rominf
rominf added this pull request to the merge queue Oct 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 13, 2026
@rominf
rominf added this pull request to the merge queue Oct 13, 2026
@rominf

rominf commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

The merge queue ejected this on engine-shell-01 (merge-group run 38473081629). #656 does not touch the engine shell. The step checks for a prompt line before bash has drawn one, a race #663 fixes. Re-queued unchanged.

Merged via the queue into main with commit 9f2b3f3 Oct 13, 2026
48 of 49 checks passed
@rominf
rominf deleted the test/fake-executable-tidy branch October 13, 2026 22:23
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