Skip to content

refactor: use proc macro for wasi ignore reasons - #14964

Merged
sylvestre merged 1 commit into
uutils:mainfrom
eduardomourar:refactor/wasi-ignore-reasons
Nov 4, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
eduardomourar:refactor/wasi-ignore-reasons

Conversation

@eduardomourar

@eduardomourar eduardomourar commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Centralizes the ~460 #[cfg_attr(wasi_runner, ignore = "...")] annotations behind #[uutests::wasi_ignore(ReasonKey)], a proc-macro attribute in the new tests/uutests_procs crate.

Context: PR 14884 and PR 13687 flagged wasi_runner as a cfg duplicated across the suite as free-text strings. The tests always compile for the host, because WASI cannot spawn the
child process they launch. So target_os cannot replace the cfg. wasi_runner is the only signal that a run drives a wasm32-wasip1/wasm32-wasip2 binary through wasmtime. This change keeps the cfg and removes the string duplication. Every reason is now defined once, alphabetically, in tests/uutests_procs/src/lib.rs: 40 keys, down from 57 after merging duplicates. Several keys previously had no explanation.

#[uutests::wasi_ignore(Reason)] also applies to a mod { ... } block. It recurses into nested modules and attaches the reason to every test inside. tee's linux_only module and truncate's fifo module use this.

Not touched: structural gates that are not ignore-reasons (feat_diagnostics module gating, #[cfg(wasi_runner)] branches that select alternate passing assertions).

Ignore gates converted to compile-time gates

The PR also changes some annotations between the two WASI skip mechanisms. #[cfg_attr(wasi_runner, ignore = "...")] still compiles the test under the WASI runner and skips it at runtime. #[cfg(not(wasi_runner))] drops the test from the build under the WASI runner. The second form fits a test that is genuinely platform-specific under WASI, where no WASI API could make it pass. This change converts some annotations from the first form to the second, and the reverse in a few places. It affects cp, mv, truncate and shuf. The gate change rides along with the reason-string centralization rather than a separate PR.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)

@eduardomourar
eduardomourar force-pushed the refactor/wasi-ignore-reasons branch from 2a36443 to 088a962 Compare September 29, 2026 17:21
@codspeed

codspeed Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning, 1 note

⚠️ 123 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

✅ 401 untouched benchmarks
⏩ 70 skipped benchmarks1


Comparing eduardomourar:refactor/wasi-ignore-reasons (1467832) with main (6c880ea)2

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (5fd1c79) during the generation of this report, so 6c880ea was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Comment thread Cargo.toml Resolved
Comment thread tests/by-util/test_ln.rs Resolved
Comment thread tests/uutests_procs/src/lib.rs Resolved
Comment thread tests/uutests_procs/src/lib.rs Resolved
Comment thread tests/uutests_procs/src/lib.rs Resolved
Comment thread tests/uutests_procs/src/lib.rs Resolved
@eduardomourar
eduardomourar force-pushed the refactor/wasi-ignore-reasons branch 5 times, most recently from 7fc1254 to 764dc3f Compare October 8, 2026 20:58
Comment thread docs/src/wasi-test-gaps.md Resolved
@eduardomourar
eduardomourar force-pushed the refactor/wasi-ignore-reasons branch 2 times, most recently from bd1bf06 to 9dba18a Compare October 13, 2026 20:39
@eduardomourar
eduardomourar force-pushed the refactor/wasi-ignore-reasons branch 4 times, most recently from a72b7ce to aebb327 Compare October 24, 2026 19:52
Comment thread AGENTS.md Resolved
Comment thread tests/by-util/test_cp.rs Resolved
Comment thread tests/uutests_procs/Cargo.toml Resolved
Comment thread tests/uutests_procs/src/lib.rs Resolved
@eduardomourar
eduardomourar force-pushed the refactor/wasi-ignore-reasons branch 3 times, most recently from 8a50254 to 8cee82b Compare October 31, 2026 09:36
@sylvestre
sylvestre force-pushed the refactor/wasi-ignore-reasons branch from 8cee82b to 0720764 Compare November 3, 2026 07:18
@eduardomourar
eduardomourar force-pushed the refactor/wasi-ignore-reasons branch 3 times, most recently from c6f238e to 87fba1b Compare November 3, 2026 16:58
The PR also converts some `#[cfg_attr(wasi_runner, ignore = ...)]` annotations to `#[cfg(not(wasi_runner))]`, and the reverse in a few places, where the test is genuinely platform-specific under WASI. This gate change affects cp, mv, truncate and shuf, and rides along with the reason-string centralization.
@eduardomourar
eduardomourar force-pushed the refactor/wasi-ignore-reasons branch from 87fba1b to 1467832 Compare November 3, 2026 22:02
@sylvestre
sylvestre enabled auto-merge (rebase) November 3, 2026 22:12
@sylvestre
sylvestre merged commit 88707ee into uutils:main Nov 4, 2026
194 of 195 checks passed
@eduardomourar
eduardomourar deleted the refactor/wasi-ignore-reasons branch November 11, 2026 23:50
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