Skip to content

Commit 2bd20c7

Browse files
committed
the matrix's compiler axis follows the declaration, not the cache
Same commit: the PR's `scan (windows-x86_64)` was green and the same job on main was red. That run's restored cache carried an extra `gcc@16.1.0`, so the scan produced 24 cells where the expected table declares 16 for that host, and all eight extras were reported as cells the table does not mention. What a runner happens to have installed is not what this repository declares, and the criterion has to be the second. The compiler axis now comes from expected.tsv's own column, computed by the workflow from the same column the install step reads — so "install these" and "scan these" cannot disagree. Installed versions outside the declaration are named on stderr; a measurement that did not run and one that passed are indistinguishable from an exit code.
1 parent 5575cb7 commit 2bd20c7

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/ci-target-matrix.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,19 @@ jobs:
309309
export MCPP="$MCPP_UNDER_TEST"
310310
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
311311
"$MCPP" self config --mirror GLOBAL 2>/dev/null || true
312+
# ⚠️⚠️ 编译器轴跟着**声明**走,不跟着「这台机器上装了什么」走。
313+
#
314+
# 实测 2026-08-26,同一个提交:PR 上这个 job 绿,合入 main 后红 —— 那
315+
# 次 windows-2022 恢复出来的缓存里多了一个 `gcc@16.1.0`,扫描产出 24
316+
# 格而期望表声明 16 格,八格全部报成「表里没有这一格」。缓存里有什么
317+
# 不是这个仓库声明了什么,而判据必须是后者。
318+
#
319+
# 与上一步取自同一列,所以「装它」和「扫它」不可能各说各话。
320+
MATRIX_COMPILERS="$(awk -F'\t' -v h='${{ matrix.host }}' \
321+
'NF>=11 && $2==h {print $4}' tests/matrix/expected.tsv \
322+
| sort -u | tr '\n' ' ')"
323+
export MATRIX_COMPILERS
324+
echo "declared compiler axis: ${MATRIX_COMPILERS:-<none — scanning what is installed>}"
312325
# ⚠️ 两种体系各自成表。scan 把 mode 写进第一列,而比对必须按 mode 分开
313326
# 做 —— 拿一种体系的测量去比整张表,另一种的每一行都会被报成「没跑到」。
314327
bash tests/matrix/scan.sh payload > measured-payload.tsv

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,19 @@
113113
compiler-rt builtins 在 aarch64 上编不过。这个示例**不被任何 CI 构建**,所以它
114114
钉住的版本过期了也没有任何东西会说话。
115115

116+
### CI
117+
118+
- **⚠️⚠️ 目标矩阵的编译器轴跟着「装了什么」走,于是缓存能决定判据。**
119+
120+
实测:同一个提交,PR 的 `scan (windows-x86_64)` 绿,合入 main 后同一个 job 红 ——
121+
那次 runner 恢复出来的缓存里多了一个 `gcc@16.1.0`,扫描产出 24 格而期望表为这台
122+
宿主声明的是 16 格,八格全部报成「表里没有这一格」。
123+
124+
**期望表是一份声明**,编译器轴现在跟着它走(`MATRIX_COMPILERS`,由 workflow
125+
从 expected.tsv 的同一列算出,与「装哪些」那一步同源,所以两者不可能各说各话)。
126+
装着却不在声明里的版本写到 stderr —— 一次没跑的测量和一次通过的测量,在退出码上
127+
没有区别。
128+
116129
### 兼容性
117130

118131
**没有任何一次原本成功的构建换了行为。** 图声明编译器的情形里,原来的结局是

tests/matrix/scan.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,32 @@ targets() { printf '%s' "$LIST" | jq_r '.data.targets[].target' | sort -u; }
111111
#
112112
# ⚠️ 但收窄必须说出来。被丢掉的版本写到 stderr —— 一次没跑的测量和一次通过的
113113
# 测量,在退出码上没有区别。
114+
#
115+
# ⚠️⚠️ 而「装了哪些」不是「这台宿主声明了哪些」,把前者当成后者会让缓存决定判据。
116+
#
117+
# 实测 2026-08-26,同一个提交:PR 的 `scan (windows-x86_64)` 绿,合入 main 后同一
118+
# 个 job 红 —— 因为那次 runner 恢复出来的缓存里多了一个 `gcc@16.1.0`,扫描于是产出
119+
# 24 格,而期望表为这台宿主声明的是 16 格,八格全部报成「表里没有这一格」。
120+
#
121+
# 这台宿主装了什么随缓存变(297 的具名跳过就是围着这个事实写的),而**期望表是一
122+
# 份声明**。让编译器轴跟着声明走,这一整类假红就消失了:`MATRIX_COMPILERS` 由
123+
# workflow 从 expected.tsv 自己那一列算出来传进来。
124+
#
125+
# ⭐ 不传时退回「装了什么扫什么」,因为本机跑没有期望表可依。
114126
compilers() {
127+
if [ -n "${MATRIX_COMPILERS:-}" ]; then
128+
# ⚠️ 收窄仍然要说出来。装着却不在声明里的那些,写到 stderr —— 一次没跑的
129+
# 测量和一次通过的测量,在退出码上没有区别。
130+
printf '%s' "$LIST" | jq_r '.data.toolchains[] | .family + "@" + .version' \
131+
| while IFS= read -r have; do
132+
case " $MATRIX_COMPILERS " in
133+
*" $have "*) ;;
134+
*) echo "scan: 略过 $have —— 本宿主的期望表没有声明它" >&2 ;;
135+
esac
136+
done
137+
printf '%s\n' $MATRIX_COMPILERS
138+
return
139+
fi
115140
printf '%s' "$LIST" | jq_r '.data.toolchains[] | .family + "@" + .version' \
116141
| awk -F@ '{ if (seen[$1]++) print "scan: 略过 " $0 " —— 每族只取最新" > "/dev/stderr"
117142
else print $0 }'

0 commit comments

Comments
 (0)