Skip to content

Audit tests whose expected output encodes a host fact #2373

Closed

Description

@ehartford

Problem

build/pcre2.w rewrote upstream's testoutputheap-8 so that it matched the
Mac malloc's address reuse (free unremembered block -> free 20480). The
expected output then encoded one machine's allocator, and Linux was red
(#2365, fixed in PR #2361 at cb9205a). Upstream's RunTest marks that test
environment-specific and runs it only on request.

Checks like this pass on the host that wrote them and fail on the next one,
and the failure looks like a regression in whatever PR runs there.

Proposal

Audit the tree for expected outputs and normalizers that encode a host fact
rather than a property of the program:

  • normalizers in build/*.w that rewrite reference output (frame sizes,
    struct sizes, allocation sizes, labels): which are true on every supported
    64-bit host, and which are one host's facts?
  • expect-stdout fixtures that print addresses, allocation order, hash
    iteration order, timings, or $TMPDIR, $HOME or /tmp paths
  • tests that only run on darwin, or whose Linux branch has never run

For each one, compare what the program means rather than where the allocator
put it (as #2365 does), or document why the host fact is the contract.

Activity

  1. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced: the audit has not been done. No commit references this issue, and no check in build.w or build/ scans expected outputs for host facts. The case that prompted it (testoutputheap-8) is fixed (#2361, see #2365).

    post-release: a one-time audit of test expectations.

  2. added this to the post-v0.16.0 milestone on Oct 28, 2026
  3. ehartford commented on Nov 17, 2026

    @ehartford
    ContributorAuthor

    The audit (2026-11-17, main 820cb94)

    Normalizers of reference output in build/*.w. One rewrites values: pcre2_normalize_heap_output (build/pcre2.w), which states upstream's heap-test file as 10.47 prints it "on a 64-bit host" (frame sizes 136/632/152/16136, malloc 152, the heapframes size). Those are struct sizes of the 64-bit build, and the pcre2 lanes pass with them on darwin-aarch64, linux-x86_64, linux-aarch64 and windows-x86_64 (release run 43905671015). The allocator-order rewrite this issue was filed for is gone (#2361). The others (comp_normalize_line_endings, *_normalize_path_separators, br_normalize_embedded_source, pkg_normalize_path, sdk_normalize) normalize line endings and path separators, which is what makes an expectation hold on every host.

    Expectations that name a host fact. No //! expect-* line in test/ names a temp or home path (/tmp, /Users/, /home/, /var/folders), an address, a dylib, or an OS or architecture name. (The one hex match, behav_1922_integer_format_full_width, is the number being formatted.)

    Tests that run on one platform. only-on: darwin is ten files, each about a Darwin fact by construction: Mach-O undefined symbols, the embedded sysroot's stubs (two), platform availability, the SIMD C ABI, the mach clock migration, malloc_size as the witness that libc memory was freed once, and #1014's in-process calling chains (two). The tenth was mine from yesterday, da_703_ledger_grows: it expected Darwin's chain where the line every backend prints proves the same thing; fixed (commit a4ddacd, lands with the next battery). only-on: windows is 14, linux 2, aarch64 4, x86_64 1.

    "Whose Linux branch has never run." Since #3376 the nightly release runs :test on linux-x86_64, linux-aarch64 and windows-x86_64 every night and files a red platform as an issue, so an expectation that holds on one host only now fails within a day on the others, under its own name. On 2026-11-16 the only test failure outside macOS was one contract view (#3375).

    What the audit cannot find by reading: an expectation that depends on hash iteration order or timing. Those show as flakes or as a red platform; none is open except #2914 and #876 (windows-aarch64 timing and loopback, non-gating).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions