Skip to content

ci(tier2): run the RUN_SERIAL part beside the suite on its own CPUs (#2773) - #2779

Merged
zackees merged 3 commits into
masterfrom
fix/2773-serial-cpus
Oct 28, 2026
Merged

zackees merged 3 commits into
masterfrom
fix/2773-serial-cpus

Conversation

@zackees

@zackees zackees commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

What

Tier 2's RUN_SERIAL deinterlace tests idle every other core while they run: five tests, one after another, 147 s of the 242 s of one mode on a 24-core host (#2773). CI avoids it with two runners per mode (#2071, #2072); a local host has no second runner, so this takes the isolation from CPU time instead of an idle machine.

New opt-in OBS_TIER2_SERIAL_CPUS=<cpu list>:

  • the suite part runs ctest -E <serial regex> pinned to the CPUs the variable leaves;
  • the serial part runs beside it, each RUN_SERIAL test as its own process on its own CPU pair with LP_NUM_THREADS=1 and its own xvfb-run -a;
  • either part failing fails the mode; both logs are kept (tree.ctest-<mode>.log, tree.serial-<mode>.log);
  • unset, nothing changes — CI keeps the serial runners of perf(ci): cut the Tier 2 critical path of merge-queue runs (11 min, measured 2026-10-24) #2072.

The serial part deliberately does not go through ctest: RUN_SERIAL keeps those tests one-at-a-time even under -j, and a second concurrent ctest would race the first one's Testing/Temporary/CTestCostData.txt. The trade-off is that the five pinned tests no longer get cost entries; ctest's longest-first ordering has nothing to order when one test per CPU pair is already the schedule.

RED

56a85edd8 — ci/test_tier2_serial_cpus.py, seven of ten cases fail on it:

$ uv run python -m unittest ci/test_tier2_serial_cpus.py
FAILED (failures=7)
  error: Failed to spawn: .../rust/tools/linux-validate/serial-runner.py
  AssertionError: 'OBS_TIER2_SERIAL_CPUS' not found in '#!/bin/bash ...'

GREEN

73c795cd1:

  • rust/tools/linux-validate/serial-runner.py — run (registry → one process per CPU pair, ENVIRONMENT/WORKING_DIRECTORY/RUN_SERIAL properties honoured, per-test log, non-zero on failure), suite-cpus (affinity minus the serial set, refuses an empty remainder) and pin (execs the suite part's ctest on a CPU set, so the harness needs no taskset);
  • validate.sh — the concurrent branch, the usage guard against OBS_CTEST_PART/OBS_CTEST_SHARD, and test_env_pairs so the serial children get the same NAME=VALUE list the suite part exports;
  • run.py — passthrough into the container;
  • README.md — the knob and what changes;
  • ci/test_tier2_env.py — reads the pairs array, which is now the source of the environment block it pins.
$ uv run python -m unittest ci/test_tier2_serial_cpus.py     # 10 tests, OK
$ uv run python -m unittest ci/test_tier2_serial_part.py ci/test_tier2_serial_cpus.py \
      ci/test_tier2_ci_runtime.py ci/test_tier2_run.py ci/test_tier2_env.py \
      ci/test_tier2_fanout.py ci/test_registration.py ci/test_uv_run.py
Ran 66 tests ... OK
$ (cd ci && uv run python -m unittest test_tier2_proof_inputs test_ci_scope)
Ran 53 tests ... OK
$ uvx [email protected] check ci/test_tier2_serial_cpus.py rust/tools/linux-validate/serial-runner.py \
      rust/tools/linux-validate/run.py                                # All checks passed

Measured on this host (16 cores; serial 0-9, suite 10-15)

Inside the Tier 2 image against this checkout's build tree:

  • standalone, one process per CPU pair: 5/5 passed in 31.6 s wall; one after another they are 147 s per mode in Tier 2 (local): run the RUN_SERIAL deinterlace tests on their own cores beside the suite #2773. Each rate's log shows its filtered cases (tests: Running 13 test(s) ... PASSED), not the skip path.
  • concurrent with the suite part: serial 33.4 s, 5/5 passed, while tree.ctest-OFF.log was still running the suite tests (10/585, each 17-19 s). The suite part on this box is slower than the reporter's 24-core host, so I stopped the full run at 15 min rather than quote a total I did not finish.

No docs/features.md line: build/test tooling only.

Refs #2773

RED. The Tier 2 harness has no OBS_TIER2_SERIAL_CPUS and no serial runner
yet, so seven of the ten cases fail:

  $ uv run python -m unittest ci/test_tier2_serial_cpus.py
  FAILED (failures=7)
  failed to spawn .../serial-runner.py: No such file or directory
  AssertionError: 'OBS_TIER2_SERIAL_CPUS' not found in validate.sh

The cases that must go green: the suite CPU set is the affinity minus the
serial set (and an empty remainder is refused), the serial tests run at the
same time on their own CPU pairs, only RUN_SERIAL tests are run by the new
part, a failure fails the run and keeps the log, more tests than pairs is
a usage error, validate.sh keeps its single ctest invocation for the
default path, and run.py passes the variable into the container.
…2773)

GREEN for 56a85ed. OBS_TIER2_SERIAL_CPUS=<cpu list> gives the five
RUN_SERIAL deinterlace tests their own cores, so a local host gets the
isolation CI has with a second runner (#2071/#2072) without idling the
machine:

- rust/tools/linux-validate/serial-runner.py: `run` starts each RUN_SERIAL
  test from the CTest registry as its own process on its own CPU pair
  (sched_setaffinity, LP_NUM_THREADS=1 from the test's ENVIRONMENT,
  WORKING_DIRECTORY honoured, its own xvfb-run -a and log);
  `suite-cpus` prints the affinity minus the serial set; `pin` execs the
  suite part's ctest on that set, so the harness needs no taskset.
- validate.sh: the concurrent branch, the usage guard against
  OBS_CTEST_PART/OBS_CTEST_SHARD, and test_env_pairs so the serial
  children get the same NAME=VALUE list the suite part exports.
- run.py: passthrough, so the harness passes it into the container.
- README: the knob and what changes.
- ci/test_tier2_env.py: read the pairs array, which is now the source of
  the environment block it pins.

The serial part deliberately has no ctest of its own: RUN_SERIAL keeps
those tests one-at-a-time even under -j, and a second concurrent ctest
would race the suite part's Testing/Temporary/CTestCostData.txt.

Measured on this 16-core host (CPUs 0-9 serial, 10-15 suite), inside the
Tier 2 image against this checkout's build tree:

  standalone, one process per pair: 5/5 passed in 31.6 s wall
  (one after another they are 147 s per mode in #2773)

  concurrent with the suite part: serial 33.4 s, 5/5 passed, while
  tree.ctest-OFF.log was still running the suite tests

No features.md line: build/test tooling only.
ci/test_tier2_xvfb_lifetime.py execs the suite-part invocation with a stubbed
xvfb-run to prove the shared display survives between tests (#1355). #2773
puts that invocation in the else branch of the serial-CPU opt-in, so the pin
now reads the else branch and counts the three xvfb-run/ctest pairs: the
default path, the repeat run, and the concurrent suite part. The serial part
gets its own per-test display (--xvfb=-a), which the test also pins.
@zackees
zackees marked this pull request as ready for review October 28, 2026 11:38
@zackees
zackees added this pull request to the merge queue Oct 28, 2026
@zackees

zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator

PR #2779 is ready and queued (gh pr merge --auto).

  • CI on ed35e18e1: Format ✅, Fast Gate ✅, Rust Tier 2 Linux build ✅, tests OFF ✅, tests ON ✅, both serial shards ✅, CI Gate ✅.
  • Local ./lint ok (34.7 s). No local-gate stamp, so CI ran the Linux lanes itself; no app lane is involved (this is rust/tools/linux-validate + ci/ only).
  • No docs/features.md line: build/test tooling only.
  • Rebase notes: the RED commit 56a85edd8 is unchanged; 73c795cd1 is the GREEN and ed35e18e1 updates two existing pins that read the code this PR moves (ci/test_tier2_env.py, ci/test_tier2_xvfb_lifetime.py).

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant