fix(tools): fast-check builds its native and KDE checks for the host, from any shell

The default dev shell exports CARGO_BUILD_TARGET=x86_64-pc-windows-msvc for the Windows cross
build. The native and the KDE checks run `cargo test` through `nix shell nixpkgs#gcc`, which is
not a dev shell and keeps the environment it was started from, so run from inside `nix develop`
they built their test programs for Windows and failed with "cannot execute binary file" (exit
126), the failure the recorder step of the macOS job had in CI.

Both lines now drop the variable. The macOS check names its target and the Windows check wants
the variable, so they stay as they were. With the variable exported, the native line fails with
126 before and passes (139, 8, 14, 20 and 16 tests) after.
This commit is contained in:
LGUG2Z committed 2026-11-06 11:39:39 -08:00
1 parent f0731112a5
commit a90147e3ff
2 files changed
+7 -2

No files matched your search

+5
View File
@@ -40,6 +40,11 @@ this tool.
| `flake.nix`, `flake.lock`, `nix/**` | evaluation only: `nix flake show` and `nix eval ...drvPath` of one check and one package per platform (no `nix flake check`) |
| `*.md`, `docs/`, `tools/`, images, `.github` | nothing |
The native and KDE checks drop `CARGO_BUILD_TARGET` from their environment: the default `nix develop` shell exports it
(`x86_64-pc-windows-msvc`, for the Windows cross build), and a `cargo test` that inherited it would build test programs for
Windows and fail with `cannot execute binary file`, so `fast-check` gives the same result from any shell. The macOS check
names its target and the Windows check wants the variable.
Persistent target directories live under `$FAST_CHECK_SCRATCH` (default `${XDG_CACHE_HOME:-~/.cache}/komorebi-fast-check`):
`target-fast-win` (2.8 GB), `kde-target` (shared, 30 GB, grows with test binaries: `tools/trim-target`),
`target-fast-mac` (2.2 GB), `target-fast-native` (0.5 GB). Delete them to reclaim disk; the next run is cold.
+2 -2
View File
@@ -88,7 +88,7 @@ add() { NAMES+=("$1"); DIRS+=("$2"); CMDS+=("$3"); }
if [ "$want_native" = 1 ]; then
add "native: shared crates tests" "." \
"CARGO_TARGET_DIR=$S/target-fast-native nix shell nixpkgs#gcc -c cargo test --locked -p komorebi-layouts -p komorebi-scrolling"
"CARGO_TARGET_DIR=$S/target-fast-native env -u CARGO_BUILD_TARGET nix shell nixpkgs#gcc -c cargo test --locked -p komorebi-layouts -p komorebi-scrolling"
fi
if [ "$want_win" = 1 ]; then
# a bare cargo command builds default-members (the Windows crates) of the one workspace
@@ -97,7 +97,7 @@ if [ "$want_win" = 1 ]; then
fi
if [ "$want_kde" = 1 ]; then
add "kde: cargo check + lib tests (komorebi-linux)" "." \
"export CARGO_TARGET_DIR=$S/kde-target COMMIT_HASH=\${COMMIT_HASH:-dev}; nix shell nixpkgs#gcc -c bash -c 'cargo check --locked -p komorebi-linux && cargo check --locked -p komorebi && cargo test --locked -p komorebi-linux --lib && cargo test --locked -p komorebi-linux --test schemas -- --test-threads=1'"
"export CARGO_TARGET_DIR=$S/kde-target COMMIT_HASH=\${COMMIT_HASH:-dev}; unset CARGO_BUILD_TARGET; nix shell nixpkgs#gcc -c bash -c 'cargo check --locked -p komorebi-linux && cargo check --locked -p komorebi && cargo test --locked -p komorebi-linux --lib && cargo test --locked -p komorebi-linux --test schemas -- --test-threads=1'"
fi
if [ "$want_mac" = 1 ]; then
add "macos: type-check only (fake CC, cannot link)" "." \