Skip to content

ci(test): fix the slowest-suites table on uutils sort; print CPU and SHA support - #2988

Merged
DeusData merged 1 commit into
mainfrom
fix/ci-slowest-suites-and-cpu-line
Nov 14, 2026
Merged

DeusData merged 1 commit into
mainfrom
fix/ci-slowest-suites-and-cpu-line

Conversation

@DeusData

Copy link
Copy Markdown
Owner

Summary

Two small fixes to the test scripts' log output. Nothing here changes what runs or what gates.

  1. "8 slowest suites" table fixed on newer runner images.
    scripts/run-tests-parallel.sh sorted the per-suite results with
    sort -t= -k6 -rn. uutils sort (Rust coreutils, which newer hosted
    images ship as sort) parses the attached form -t= as -t with an
    inline =value, so the separator comes out empty. The step then
    printed sort: separator must be exactly one character long: '', and
    the table was empty on hosted x86 legs. The fix passes the separator as
    its own argument (sort -t '=' -k6,6 -rn), which GNU, BSD and uutils
    sort all parse the same way. The key is still field 6 of
    name rc=N pass=N fail=N skip=N secs=N split on =, i.e. secs.

  2. CPU model and SHA-256 instruction support in the test environment
    line.
    scripts/test.sh now prints, on its existing
    === test.sh: os=... === line, e.g.
    cpu="AMD EPYC 7763 64-Core Processor" sha_ni=yes (x86) or
    cpu="Apple M5 Pro" sha2=yes (ARM). src/foundation/sha256.c uses x86
    SHA-NI / ARMv8 SHA2 when present and its portable transform otherwise.
    A sanitized test runner fingerprints its own large image on that path,
    so the CPU a hosted job drew decides how long those fingerprints take.
    Until now that was invisible in the log.

    • Linux and MSYS2: model name and flags / Features from
      /proc/cpuinfo (whole-word match), with lscpu's "Model name" as the
      model fallback (Linux arm64 has no model name line).
    • macOS: sysctl machdep.cpu.brand_string, plus
      hw.optional.arm.FEAT_SHA256 (Apple silicon) or the leaf-7 SHA
      feature (Intel). These are the same signals sha256.c probes.
    • MSYS2 on Windows ARM64 runs an x86-64 runtime, so its /proc/cpuinfo
      flags describe the emulated CPU. There the field reads sha2=unknown
      instead of guessing.
    • Best effort and never fatal: anything unreadable prints unknown.
      Every lookup is guarded for set -euo pipefail, and there are no
      early-exit pipes that could take SIGPIPE.

CI scope (full)

  • Workflow files: none changed.
  • Scripts changed:
    • scripts/run-tests-parallel.sh: one line, the informational slowest-suites table.
    • scripts/env.sh: new cpu_summary helper; print_env takes an optional --cpu.
    • scripts/test.sh: calls print_env "test.sh" --cpu.
  • Steps whose log output changes: every step that runs
    scripts/test.sh. In _test.yml that is the test-unix, test-diag,
    test-lsan-macos, test-tsan and test-windows jobs; in pr.yml the
    contracts job (scripts/test.sh --contracts-only). The same applies to
    the local venues that call scripts/test.sh. The slowest-suites table
    comes from the parallel harness that scripts/test.sh runs.
  • Unchanged output: scripts/build.sh, scripts/lint.sh and
    scripts/repro.sh keep their exact environment line (they do not pass
    --cpu).
  • No gating change. run-tests-parallel.sh runs without set -e. Its
    exit status still comes only from the failed-test count and the
    non-zero-rc count, as before. The sort failure never failed a job; it
    only lost the table. cpu_summary always returns 0.

Verification

  • Sort: a fixture in the real results-line format (11 suites), checked
    against the expected top 8 by secs:
    • uutils coreutils 0.2.2 (ubuntu:25.10): the origin/main form fails with
      exactly the hosted error, sort: separator must be exactly one character long: '' (exit 2). The new form ranks correctly.
    • GNU coreutils 9.4 (ubuntu 24.04 test image) and macOS BSD sort 2.3:
      both forms rank correctly, so there is no change in behaviour there.
  • CPU line:
    • macOS arm64: cpu="Apple M5 Pro" sha2=yes.
    • Linux arm64 (test image, GNU userland, and ubuntu:25.10, uutils
      userland): cpu="unknown" sha2=yes. The VM's CPU part has no lscpu
      name; hosted arm64 runners report e.g. Neoverse.
    • The x86 branch, run as the real function text with only the cpuinfo
      path pointed at fixtures:
      • an EPYC 7763 flags line gives sha_ni=yes;
      • a Xeon 8272CL flags line gives sha_ni=no, including a
        sha_ni_absent_decoy token, which proves whole-word matching;
      • MSYSTEM=CLANGARM64 gives sha2=unknown;
      • an unreadable file gives cpu="unknown" sha_ni=unknown, exit 0
        under set -euo pipefail.
    • build.sh and repro.sh lines are byte-identical to before.
  • tests/test_lane_wiring_contract.sh: OK (27 lanes served).
  • tests/test_venue_parity_contract.sh: OK (25 workflows marker-checked, 11 venue workflows whitelist-walked).
  • scripts/test.sh --contracts-only: all 45 contract steps passed.
  • shellcheck 0.11.0 on the three scripts: same 11 findings as origin/main,
    all on untouched lines; none in scripts/env.sh.

…SHA support

The "8 slowest suites" summary in scripts/run-tests-parallel.sh sorted with
`sort -t= -k6 -rn`. uutils sort (Rust coreutils, shipped as sort on newer
runner images) reads the attached form -t= as -t with an inline "=value",
an empty separator, and exits with "separator must be exactly one character
long: ''", leaving the table empty. Pass the separator as its own argument,
which GNU, BSD and uutils sort all parse alike. Informational only: the
script has no set -e and its exit status is unchanged.

scripts/test.sh's environment line now also names the CPU and whether it
has SHA-256 instructions (x86 sha_ni / ARMv8 sha2), the signal
src/foundation/sha256.c uses to choose its hardware or portable backend.
A sanitized runner fingerprints its own large image on that path, so which
CPU a hosted job drew decides how long those fingerprints take. The helper
lives in scripts/env.sh (cpu_summary, opted into via print_env --cpu, so
build.sh, lint.sh and repro.sh print exactly what they did); it reads
/proc/cpuinfo or lscpu on Linux/MSYS2 and sysctl on macOS, reports
"unknown" for anything unreadable, and never fails the caller.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData
DeusData merged commit f854641 into main Nov 14, 2026
43 checks passed
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