Skip to content

Commit f57643d

Browse files
committed
github/gen-matrix.py: use all-pairs coverage instead of full cartesian
Switch the regular_test matrix from itertools.product to allpairspy's AllPairs over compiler x standard x mode. With 4 compilers, 2 standards and 2 modes the regular grid drops from 24 items to 8 while still exercising every pair of parameter values at least once. 'dev' is no longer crossed against every compiler / standard; it gets a single one-off entry pinned to clang++-22 / C++23, alongside the existing DPDK, cxx-modules, and fuzz one-offs. The script gets a PEP 723 inline-metadata block and a uv shebang ('#!/usr/bin/env -S uv run --script') so it can declare its single dependency (allpairspy) without polluting a global Python environment. Runs under Python 3.10 and newer. tests-matrix.gold is regenerated: 12 jobs total (8 regular + 4 one-offs).
1 parent 6e0f3fd commit f57643d

3 files changed

Lines changed: 31 additions & 44 deletions

File tree

.github/workflows/gen-matrix.py

100644100755
Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/env -S uv run --script
2+
# /// script
3+
# requires-python = ">=3.10"
4+
# dependencies = [
5+
# "allpairspy",
6+
# ]
7+
# ///
28
"""
39
Generate the regular_test include: matrix for tests.yaml.
410
5-
Computes the Cartesian product of compilers × standards × modes for
6-
regular builds, then appends special-purpose jobs (dpdk, cxx-modules,
7-
fuzz) so that tests.yaml has a single job definition for all of them.
8-
Everything outside the marked region is left untouched.
11+
Uses all-pairs (pairwise) coverage over compiler x standard x mode for
12+
the regular builds, plus an explicit list of special-purpose jobs
13+
(dpdk, cxx-modules, fuzz). All-pairs guarantees that every pair of
14+
parameter values is exercised by at least one job, with far fewer
15+
combinations than the full cartesian product (12 vs 24 for our 4x2x3
16+
matrix). Everything outside the marked region of tests.yaml is left
17+
untouched.
918
1019
Usage:
11-
python3 .github/workflows/gen-matrix.py
20+
.github/workflows/gen-matrix.py
1221
git diff .github/workflows/tests.yaml
1322
"""
1423

15-
import itertools
24+
from __future__ import annotations
25+
1626
import pathlib
1727
from typing import Any
1828

29+
from allpairspy import AllPairs
30+
1931
HERE = pathlib.Path(__file__).parent
2032
TESTS_YAML = HERE / "tests.yaml"
2133

@@ -29,7 +41,7 @@
2941
+ [f"g++-{v}" for v in GCC_VERSIONS]
3042
)
3143
STANDARDS: list[int] = [20, 23]
32-
MODES: list[str] = ["dev", "debug", "release"]
44+
MODES: list[str] = ["debug", "release"]
3345

3446
# Markers that bracket the managed region inside tests.yaml.
3547
BEGIN_TAG = "# This include block is AUTOGENERATED"
@@ -39,6 +51,11 @@
3951
# Items only set enable-ccache when overriding the default (test.yaml treats
4052
# absent/empty as enabled).
4153
SPECIAL_ITEMS: list[dict[str, Any]] = [
54+
{
55+
"compiler": "clang++-22",
56+
"standard": 23,
57+
"mode": "dev",
58+
},
4259
{
4360
"compiler": "clang++-22",
4461
"standard": 23,
@@ -86,8 +103,8 @@ def _format_item(item: dict[str, Any], indent: str) -> str:
86103

87104
def generate() -> list[dict[str, Any]]:
88105
regular: list[dict[str, Any]] = [
89-
{"compiler": c, "standard": s, "mode": m}
90-
for c, s, m in itertools.product(COMPILERS, STANDARDS, MODES)
106+
{"compiler": compiler, "standard": standard, "mode": mode}
107+
for compiler, standard, mode in AllPairs([COMPILERS, STANDARDS, MODES])
91108
]
92109
return regular + SPECIAL_ITEMS
93110

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
Fuzz Tests
22
Test (clang++-19, C++20, debug)
3-
Test (clang++-19, C++20, dev)
4-
Test (clang++-19, C++20, release)
5-
Test (clang++-19, C++23, debug)
6-
Test (clang++-19, C++23, dev)
73
Test (clang++-19, C++23, release)
8-
Test (clang++-22, C++20, debug)
9-
Test (clang++-22, C++20, dev)
104
Test (clang++-22, C++20, release)
115
Test (clang++-22, C++23, debug)
126
Test (clang++-22, C++23, dev)
13-
Test (clang++-22, C++23, release)
147
Test (g++-14, C++20, debug)
15-
Test (g++-14, C++20, dev)
16-
Test (g++-14, C++20, release)
17-
Test (g++-14, C++23, debug)
18-
Test (g++-14, C++23, dev)
198
Test (g++-14, C++23, release)
20-
Test (g++-16, C++20, debug)
21-
Test (g++-16, C++20, dev)
229
Test (g++-16, C++20, release)
2310
Test (g++-16, C++23, debug)
24-
Test (g++-16, C++23, dev)
25-
Test (g++-16, C++23, release)
2611
Test with C++20 modules enabled
2712
Test with DPDK enabled

.github/workflows/tests.yaml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,15 @@ jobs:
2222
# This include block is AUTOGENERATED, do not edit by hand
2323
# instead edit + re-run .github/workflows/gen-matrix.py
2424
include:
25-
- {compiler: clang++-19, standard: 20, mode: dev}
2625
- {compiler: clang++-19, standard: 20, mode: debug}
27-
- {compiler: clang++-19, standard: 20, mode: release}
28-
- {compiler: clang++-19, standard: 23, mode: dev}
29-
- {compiler: clang++-19, standard: 23, mode: debug}
30-
- {compiler: clang++-19, standard: 23, mode: release}
31-
- {compiler: clang++-22, standard: 20, mode: dev}
32-
- {compiler: clang++-22, standard: 20, mode: debug}
33-
- {compiler: clang++-22, standard: 20, mode: release}
34-
- {compiler: clang++-22, standard: 23, mode: dev}
3526
- {compiler: clang++-22, standard: 23, mode: debug}
36-
- {compiler: clang++-22, standard: 23, mode: release}
37-
- {compiler: g++-14, standard: 20, mode: dev}
38-
- {compiler: g++-14, standard: 20, mode: debug}
39-
- {compiler: g++-14, standard: 20, mode: release}
40-
- {compiler: g++-14, standard: 23, mode: dev}
41-
- {compiler: g++-14, standard: 23, mode: debug}
4227
- {compiler: g++-14, standard: 23, mode: release}
43-
- {compiler: g++-16, standard: 20, mode: dev}
44-
- {compiler: g++-16, standard: 20, mode: debug}
4528
- {compiler: g++-16, standard: 20, mode: release}
46-
- {compiler: g++-16, standard: 23, mode: dev}
4729
- {compiler: g++-16, standard: 23, mode: debug}
48-
- {compiler: g++-16, standard: 23, mode: release}
30+
- {compiler: g++-14, standard: 20, mode: debug}
31+
- {compiler: clang++-22, standard: 20, mode: release}
32+
- {compiler: clang++-19, standard: 23, mode: release}
33+
- {compiler: clang++-22, standard: 23, mode: dev}
4934
- {compiler: clang++-22, standard: 23, mode: release, enables: --enable-dpdk, options: "--cook dpdk --dpdk-machine corei7-avx", label: "Test with DPDK enabled"}
5035
- {compiler: clang++-22, standard: 23, mode: debug, enables: --enable-cxx-modules, enable-ccache: false, label: "Test with C++20 modules enabled"}
5136
- {compiler: clang++-22, standard: 23, mode: fuzz, test-args: "-- -R 'Seastar.fuzz.'", label: "Fuzz Tests"}

0 commit comments

Comments
 (0)