diff --git a/tools/README.md b/tools/README.md index 9e0ca695..e54f579b 100644 --- a/tools/README.md +++ b/tools/README.md @@ -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. diff --git a/tools/fast-check b/tools/fast-check index 935ff39f..26ffd86b 100755 --- a/tools/fast-check +++ b/tools/fast-check @@ -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)" "." \