Skip to content

test: gate unix-only test helpers + drop dead test code (Refs #3779) - #3781

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix/3779-test-dead-code-census
Nov 16, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix/3779-test-dead-code-census

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

test: gate unix-only test helpers + drop dead test code (Refs #3779)

整树 -D warnings 普查(#3779)的 16 处 + Linux 腿对照发现的第 17 处。
全部是 tests/ 死代码/未用 import,src/ 不动,钉语义不动。

清单与平台口径

cfg-gate(辅助只被 #[cfg(unix)] 钉调用,Windows 腿上死掉;Linux 腿保持原样):

  • issue2298:RUBASH、Fixture、fixture、Fixture::run/read + 2 个 import
  • issue2294:test_dir、rubash_stdin、run_in、wait_file_contents + 4 个 import
  • issue1331:run_script + Write import(Command 留给非门控钉)
  • issue1657:Scratch、Scratch::new/run、Drop、passwd_home + 5 个 import
  • issue2737:run + Command import
  • regression.rs:issue_1584/issue_1582 两 mod 整体 #[cfg(unix)](两 mod 钉全为 unix 门控;初版只 gate 了两 fn run,X299 腿报 use super::*; 级联未用,改按文件内 #[cfg(windows)] mod … 先例 gate mod)
  • issue2390:RUBASH、Outcome、run_script、normalize_fd_numbers、assert_case + 3 个 import
  • issue1276:Stdio import(只在 unix 门控的 facet (2) 钉里用;facet (1) 只用 Command)
  • issue1021:BufRead/BufReader、mpsc、Duration import(只在 unix 钉里用;另一钉只用 Command/Stdio)
  • issue2278:rubash_in_stdin_file + 其 Stdio import(5 处调用全在 #[cfg(unix)] 钉里;初版误删,Linux 腿 E0425 ×5 抓获,已字节一致恢复 + gate,提交 70cc3f2)

真删(双腿皆死):

  • issue2473:use std::io::Write as _ 全文件无 Write 方法调用

改名(值仍捕获、不断言,树内 _stdout/_stderr 惯例):

  • issue592:stdout → _stdout(find -name 'data.txt' 绑定,只断言 rc)
  • issue3540:stdout → _stdout([bug] ${a[$(...)]:?err}: an arithmetic error in the subscript still emits the :? report #3541 首绑定,只断言 stderr;status 已有 let _ =)
  • issue2036_s2:字段 stderr → _stderr(无 .stderr 读处)
  • d11:字段 stderr → _stderr(钉读 .code/.stdout + {outcome:?})
  • issue2642:第 17 处,Linux 腿特有(#![cfg(unix)] 文件,Windows 普查看不见;前任 Linux base census 报 field code is never read):字段 code → _code(钉只读 .stdout/.stderr)

单文件删 import:

  • issue566:Path(#![cfg(windows)],PathBuf 仍用)

本 PR 删除了什么

  • tests/issue2473_procsub_operand_marker_regressions.rs:use std::io::Write as _; 一行。无 Write 方法调用。
  • 其余 16 项为 cfg-gate 或 _ 改名,无删除。(issue2278 的函数初版误删后已在 70cc3f2 字节一致恢复,不计删除。)

验证(rebase 后双腿重跑,待队长复核,腿日志见 REPORT §8)

  • 已 rebase 到 154a95a(test: drop unused std::io::Write import in issue523 test (Refs #3776) #3778 合入点),新头 2bee55b,3 提交干净重放;基底比较 22 提交与本 PR 17 文件零交集。
  • Linux RUSTFLAGS="-D warnings" cargo check --locked --tests --keep-going:CENSUS_RC=101,唯一诊断为上游新带入的 tests/issue3255_histexpand_prefix_invocation_name.rs:117(use super::*; 未用;该文件与基底字节一致,本 PR 未碰;master 自身 census 同样红)。
  • X299(Windows)同命令:CHECK_RC=0,零诊断(35.58s;issue523 已随基底清掉)。
  • CI run 43870362461(新头):除 goldens 与 census 外全绿;goldens 2 红与 master 154a95a 自身腿逐字相同(基线);census 与 master 失败集基本一致(360 行对 360 行,归一化后仅差一格 timing 敏感用例,皆非本单文件)。
  • 残差待队长裁:Linux 腿的 issue3255 一红属上游(须另立单或等上游修),本 PR 本身无新红。

Refs #3779

UNVERIFIED-BY-CAPTAIN

The fn-level gates left 'use super::*;' with no live user on Windows
(-D warnings flags it). Both mods are unix-only throughout, so gate
the mods (file precedent: #[cfg(windows)] mod issue_2225 etc.) and
drop the now-redundant fn gates. Refs #3779
…bad delete)

The 2eb34fd delete was wrong: rubash_in_stdin_file has 5 call sites,
all inside #[cfg(unix)] tests. The Windows census flagged it only
because the callers do not exist on Windows; the Linux --keep-going
leg fails with E0425 x5. Restore byte-identical and gate it (plus its
Stdio import) with #[cfg(unix) instead. Refs #3779
@caomengxuan666
caomengxuan666 force-pushed the fix/3779-test-dead-code-census branch from 70cc3f2 to 2bee55b Compare November 16, 2026 12:51
@caomengxuan666

Copy link
Copy Markdown
Member Author

rebase 进展(续作车道):#3778 已合入(merge 154a95a),本 PR 已 rebase 到 154a95a(新头 2bee55b,3 提交干净重放,基底比较:364478d→154a95a 间 22 提交与本 PR 17 文件零交集,issue523 的修法已随基底带入)。正文 issue2278 一节已为 v3 内容(初版误删、Linux 腿 E0425×5 抓获、70cc3f2 字节一致恢复 + gate)。下一步:双腿重跑到 0 诊断(Linux 本地 + X299),结果进 REPORT。

@caomengxuan666

Copy link
Copy Markdown
Member Author

队长复核 PASS(2026-11-16 21:0x CST,新头 2bee55b,基底 154a95a):

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