Skip to content

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

Open
eduardomourar wants to merge 1 commit into
uutils:mainfrom
eduardomourar:refactor/wasi-ignore-reasons
Open

eduardomourar wants to merge 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:

GNU test failed: tests/id/setgid. tests/id/setgid is passing on 'main'. Maybe you have to rebase?

@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

Merging this PR will not alter performance

1 warning, 1 note

⚠️ 124 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

✅ 341 untouched benchmarks
⏩ 130 skipped benchmarks1


Comparing eduardomourar:refactor/wasi-ignore-reasons (8a50254) with main (aea67c0)2

Open in CodSpeed

Footnotes

  1. 130 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 (90b48bf) during the generation of this report, so aea67c0 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe we can remove this whole file and add those as comments in tests/uutests_procs/src/lib.rs

@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 from aebb327 to ca94dbf Compare October 28, 2026 15:47
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 ca94dbf to 8a50254 Compare October 30, 2026 20:39

This branch has not been deployed

No deployments
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