Repository navigation
test: cfg-gate unix-only helpers in issue2304 stem (Refs #3512) - #3520
Merged
Merged
Conversation
…(Refs #3512) Root cause: every #[test] in tests/issue2304_numbered_devnull_spawn_regressions.rs is #[cfg(unix)], but the shared helpers were ungated: the two use lines (std::path::PathBuf / std::process::{Command, Stdio}), const RUBASH, struct Fixture, fn fixture, and impl Fixture (fn run). On non-unix targets these items are dead code, which fails RUSTFLAGS="-D warnings" builds of the test target on Windows — the same class as #3503 (fixed by PR #3508). Fix: add #[cfg(unix)] to exactly those items (6 insertions, 0 deletions). No test logic changes; on unix the file is behaviour-equivalent. Verification (lane evidence, UNVERIFIED-BY-CAPTAIN): X299 Windows fail-first and head legs plus the Linux stem run were in flight at push time; results are recorded in the PR body and in REPORT.md in the lane workdir. 本 PR 删除了什么:无删除。仅新增 6 行 #[cfg(unix)] 属性。
Member
Author
队长复核 PASS结论:合入。 Refs-only,合入后队长手关 #3512。 Diff(已核对原文): 1 文件 +6/−0, 腿(
CI(run 43542224096,失败日志原文已核): 3 红 job(GNU 1349/1/4、Rust tests 0/1、macOS 1242/1/4)唯一失败名均为 交集: merge-base 删除节: 正文已有(无删除),与 diff 一致。 |
caomengxuan666
marked this pull request as ready for review
November 14, 2026 02:37
This was referenced Nov 14, 2026
Closed
Closed
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.
Refs #3512
根因
tests/issue2304_numbered_devnull_spawn_regressions.rs中全部 5 个#[test]均为#[cfg(unix)],但共享辅助项未加门控:两条 use 行(std::path::PathBuf/std::process::{Command, Stdio})、const RUBASH、struct Fixture、fn fixture、impl Fixture(含fn run)。在非 unix 目标上这些项构成 dead code,使 Windows 的RUSTFLAGS="-D warnings"测试目标构建报 4 项 dead-code。与 #3503 同类(已由 PR #3508 修复)。修法
对上述 6 项精确添加
#[cfg(unix)]:6 行插入、0 删除。测试逻辑零改动;unix 上行为等价。验证状态
UNVERIFIED-BY-CAPTAIN:车道在 X299-2607(cargo/rustc 1.99.1,cl 19.44.35230)实测——
0f37a6e7):RUSTFLAGS="-D warnings" cargo test --locked --test issue2304_numbered_devnull_spawn_regressions --no-run,rc=101,恰好 4 项 dead-code(RUBASH从未使用、Fixture从未构造、fixture从未使用、run从未使用),与 issue 所述逐字一致。cargo test,rc=0,0 error / 0 warning,running 0 tests/test result: ok. 0 passed(Windows 下 5 测均cfg(unix),0 测即预期);RUSTFLAGS="-D warnings" cargo check --locked --lib --binsrc=0,0 error / 0 warning;rustfmt --edition 2021 --check该文件 rc=0。补丁 SHA256 在 X299 侧逐字核对一致。#[cfg(unix)],unix 侧零逻辑改动;Windows 腿已覆盖全部-D warnings验收口径。issue2875_input_procsub_child_runs_as_rubash_shell(已知 lib-only-run NOBIN 陷阱,与本单无关,日志中无 issue2304 字样);其余腿全绿,含 Windows tests compile check。本 PR 删除了什么
无删除。仅新增 6 行
#[cfg(unix)]属性。