Skip to content

test: cfg-gate unix-only helpers in issue2304 stem (Refs #3512) - #3520

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/3512-dead-code-issue2304-pin
Nov 14, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/3512-dead-code-issue2304-pin

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

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)实测——

  • fail-first(基底 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 所述逐字一致。
  • 修后:同一 stem 全量 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 --bins rc=0,0 error / 0 warning;rustfmt --edition 2021 --check 该文件 rc=0。补丁 SHA256 在 X299 侧逐字核对一致。
  • Linux 5 测腿欠账:Simular box 盘 100% 满、老服务器 sshd 四次 banner 超时(与 2026-11-13 窗口同形态,需用户从阿里云控制台重启恢复),Linux 侧 5 测未能跑到,待复核轮补跑。本单仅为测试辅助项加 #[cfg(unix)],unix 侧零逻辑改动;Windows 腿已覆盖全部 -D warnings 验收口径。
  • CI 注:3 腿红均为同一单测 issue2875_input_procsub_child_runs_as_rubash_shell(已知 lib-only-run NOBIN 陷阱,与本单无关,日志中无 issue2304 字样);其余腿全绿,含 Windows tests compile check。

本 PR 删除了什么

无删除。仅新增 6 行 #[cfg(unix)] 属性。

…(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)] 属性。
@caomengxuan666

Copy link
Copy Markdown
Member Author

队长复核 PASS

结论:合入。 Refs-only,合入后队长手关 #3512。

Diff(已核对原文): 1 文件 +6/−0,tests/issue2304_numbered_devnull_spawn_regressions.rs 上恰好 6 处 #[cfg(unix)] 插入(2 条 use 行 + RUBASH + Fixture + fixture + impl Fixture),逐项与 #3512 的 4 死项对应;测试逻辑零改动,无产品代码触动。

腿(~/workspace/review-3520/legs/,日志已从盘核验,零 VOID):

  • L1 钉双边(bin-first):头 5/5 = 基底 5/5,逐名同一。
  • L2 lib 双边(bin-first):头 1246/0/4 = 基底 1246/0/4,失败名集 ∅。
  • L3 windows-gnu -D warnings 单目标:基底 rc=101,恰 4 项 dead-code(RUBASH :31、Fixture :33、fixture :38、run :49,与 [test] dead_code in tests/issue2304_numbered_devnull_spawn_regressions.rs under -D warnings #3512 逐字一致);头 rc=0 干净。fail-first 复现 + 修法确认。
  • L4 Linux -D warnings:双边 rc=0、零诊断,-D warnings 各出现 37 次(非空闲)。
  • L5 卫生:rustfmt、git diff --check 均 rc=0。

CI(run 43542224096,失败日志原文已核): 3 红 job(GNU 1349/1/4、Rust tests 0/1、macOS 1242/1/4)唯一失败名均为 issue2875(#3292 基线类,consumer_tests.rs:2911);决定性面 Windows tests compile check PASS,API tripwire PASS。钉 stem 在 CI 日志中 0 提及(#3430 型缺口),本轮 L1 已补齐。

交集: merge-base 0f37a6e7..live tip 02e34fd7 共 10 文件,0 个触及 issue2304——零交集例外成立,无需 update-branch(合入时再重算一次)。

删除节: 正文已有(无删除),与 diff 一致。

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.

1 participant