max / alloy
1 file changed,
+48 insertions,
-1 deletion
| @@ -67,7 +67,18 @@ | |||
| 67 | 67 | # set up. That is how the privileged run on fw12 reported zero screenshot binds | |
| 68 | 68 | # on 2026-09-03 while the unprivileged one found all four. | |
| 69 | 69 | target_user() { echo "${SUDO_USER:-$(id -un)}"; } | |
| 70 | - | target_home() { getent passwd "$(target_user)" 2>/dev/null | cut -d: -f6; } | |
| 70 | + | # passwd first, $HOME only when passwd cannot answer. The order matters and is | |
| 71 | + | # the reason $HOME is not simply used: under sudo it is /root, which is how a | |
| 72 | + | # privileged run once reported a correctly configured machine as having no sway | |
| 73 | + | # config. But an unnamed uid has no passwd entry at all -- a container run with | |
| 74 | + | # `--user 1000:1000` against an image whose accounts the installer has not | |
| 75 | + | # created yet -- and there the choice is $HOME or nothing. | |
| 76 | + | target_home() { | |
| 77 | + | local home | |
| 78 | + | home="$(getent passwd "$(target_user)" 2>/dev/null | cut -d: -f6)" | |
| 79 | + | [ -n "$home" ] || home="${HOME:-}" | |
| 80 | + | echo "$home" | |
| 81 | + | } | |
| 71 | 82 | # A graphical session is not reachable over a plain ssh connection, which is | |
| 72 | 83 | # how this script is usually run. Rows that need one skip rather than fail. | |
| 73 | 84 | has_session() { [ -n "${WAYLAND_DISPLAY:-}" ] && have swaymsg; } | |
| @@ -341,6 +352,42 @@ | |||
| 341 | 352 | row SKIP nvidia "no NVIDIA card on this machine" | |
| 342 | 353 | fi | |
| 343 | 354 | ||
| 355 | + | # ---------------------------------------------------------------- toolchain --- | |
| 356 | + | # The silent class, like linger above: nothing fails, and the machine builds | |
| 357 | + | # every release on a compiler the tree did not ask for. | |
| 358 | + | # | |
| 359 | + | # `rust-toolchain.toml` is honoured by rustup's proxy and by nothing else, so a | |
| 360 | + | # build host whose $HOME has no rustup runs Fedora's rust and says so nowhere. | |
| 361 | + | # Measured 2026-09-04 in a container from the fw13 image: rustc 1.98.0 against a | |
| 362 | + | # tree pinning 1.97.1, `cargo test` green, not one word of warning. The cost is | |
| 363 | + | # not a broken build but a quiet one -- rustfmt output moves between compiler | |
| 364 | + | # versions, which is the whole reason the pins exist, and the sweep's fmt cell | |
| 365 | + | # then measures which machine formatted last. | |
| 366 | + | # | |
| 367 | + | # Only a build host is asked. A laptop with no tree is not failing anything by | |
| 368 | + | # not having a toolchain, so the absence of either the tree or rustc is a SKIP. | |
| 369 | + | pin_file="$(target_home)/Code/alloy/rust-toolchain.toml" | |
| 370 | + | if [ ! -r "$pin_file" ]; then | |
| 371 | + | row SKIP toolchain "no ~/Code/alloy/rust-toolchain.toml; not a build host" | |
| 372 | + | elif ! have rustc; then | |
| 373 | + | row SKIP toolchain "no rustc for $(target_user); not a build host" | |
| 374 | + | else | |
| 375 | + | # The pin as written, and the active compiler's own version. Both are parsed | |
| 376 | + | # narrowly on purpose: a shape this does not recognise degrades to SKIP, since | |
| 377 | + | # a battery that invents a FAIL is one people learn to ignore. | |
| 378 | + | pinned="$(sed -n 's/^[[:space:]]*channel[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' "$pin_file" | head -1)" | |
| 379 | + | active="$(rustc --version 2>/dev/null | awk '{print $2}')" | |
| 380 | + | if [ -z "$pinned" ] || [ -z "$active" ]; then | |
| 381 | + | row SKIP toolchain "could not read the pin or the active version from this output shape" | |
| 382 | + | elif [ "$pinned" = "$active" ]; then | |
| 383 | + | row PASS toolchain "rustc $active matches the pinned channel" | |
| 384 | + | elif have rustup; then | |
| 385 | + | row FAIL toolchain "rustc $active, tree pins $pinned, and rustup is installed -- run: rustup toolchain install $pinned" | |
| 386 | + | else | |
| 387 | + | row FAIL toolchain "rustc $active, tree pins $pinned, and there is no rustup to honour it -- the pin is being ignored silently" | |
| 388 | + | fi | |
| 389 | + | fi | |
| 390 | + | ||
| 344 | 391 | # ------------------------------------------------------------------ verdict --- | |
| 345 | 392 | printf '\n%s passed, %s failed, %s skipped\n' "$PASSED" "$FAILED" "$SKIPPED" | |
| 346 | 393 | [ "$SKIPPED" -gt 0 ] && printf 'skipped rows are unanswered questions, not passes\n' |