Repository navigation
Description
Proposal: a general target_os test gate instead of the one-off //! skip-windows:
Problem
The test harness (src/main.w, parse_test_directives_for_target) currently
has exactly one OS-specific gate:
//! skip-windows: <reason>— skips a test iffwith_sysinfo_os() == "Windows".
There is no skip-mac / skip-macos and no skip-linux. The only other
gates are //! requires-arch: <arch> (host-arch match), unconditional
//! skip: / //! skip, and //! known-issue:. So OS gating is asymmetric and
Windows-shaped by accident: the moment a test needs to be gated off macOS or
linux, there is no directive for it and the pattern is to bolt on another
skip-<os> prefix. That is ceremony the harness could generalize once.
This came up bringing the green battery (build :test) to the Windows
presubmit: several tests need gating for genuine platform gaps (e.g.
behav_async_stack_overflow, #369 — no guard-page overflow trap in the Windows
fiber backend). skip-windows covers Windows, but the same class of
platform-gap gating on the other two OSes has no spelling.
What the reference languages do
- Rust:
#[cfg(target_os = "windows")]/cfg!(target_os = ...)— one
predicate keyed by OS value, plustarget_family = "unix"|"windows". Tests
use#[cfg(...)]/#[cfg_attr(...)]uniformly. - Zig:
builtin.os.tag == .windows— one enum, compared against any tag. - Go:
//go:build windows///go:build unixbuild constraints — a boolean
expression over OS/arch tags (windows && amd64,!windows, …).
All three express OS gating as one keyed predicate over an OS value, never a
per-OS bespoke keyword. requires-arch already follows that shape here; OS
gating is the odd one out.
Proposed direction (Eric's call on exact spelling)
Replace/augment skip-windows with a symmetric, value-keyed directive mirroring
requires-arch, e.g. one of:
//! skip-os: <windows|macos|linux> — <reason>(skip on the named OS; repeatable), and/or//! requires-os: <os>(run only on the named OS),
matched against the same with_sysinfo_os() the harness already reads. Keep
skip-windows as a deprecated alias during migration, or mechanically migrate
the existing occurrences. This adds no new language surface — it is purely a
test-harness directive, same tier as requires-arch.
Deliberately not proposing user-facing #[cfg(target_os)] language
machinery here — that is a much larger design question. This is scoped to the
test directive grammar only.
Mission fit
"Don't make the user write anything the compiler already knows / that doesn't
matter." A per-OS keyword family (skip-windows, then inevitably skip-macos,
skip-linux) is three spellings for one concept the harness already computes
(with_sysinfo_os()). One value-keyed directive is the least-ceremony form and
matches the existing requires-arch precedent.
Prediction
Medium-high confidence Eric accepts the direction (value-keyed skip-os /
requires-os mirroring requires-arch) and picks the exact prefix wording
himself, per the spec-wording-is-solemn rule. The concrete words are his to
bless; this issue only proposes the shape.
Interim
The Windows green-battery work (PR #794) uses the existing //! skip-windows:
as-is — the lazy path that works today — and does not introduce new directive
grammar. This issue tracks the generalization separately.
Activity
ehartford commentedon Aug 31, 2026
Implemented as blessed (design call, 2026-08-31): one value-keyed family —
skip-on: <os|arch|os-arch> <reason>/only-on: <os|arch|os-arch>— replacing skip-windows, skip-windows-aarch64, and requires-arch. Values validate against a closed set, so mistyped gates fail loudly at the directives stage instead of silently running everywhere (the old parser treated unknown //! lines as comments). 23 files swept; full :test green on the rebuilt harness. Landed in the commit referencing this issue.test harness: value-keyed platform gates — skip-on: / only-on: replac…
fix 1166 (#2766)