hex/scripts/check
Kit Langton 7c180101bf Add scripts/check with nextest timeouts; make hanging tests deterministic
scripts/check runs fmt, clippy and nextest (falls back to cargo test).
.config/nextest.toml kills a test after 30 s (60 s for GPU scenes) and
reports it by name; CI uses the ci profile.

Fixes tests that hung or depended on the host: HID modifier queries and
Carbon layout lookups off the main thread, the leaked i18n language,
the stale 2.3.0 driver version, CoreAudio in the startup-failure test,
unbounded accept/recv waits, a 20 ms sleep race in local_api, and
keyboard_layout under --list.
2026-10-23 20:03:00 -07:00

34 lines
1.1 KiB
Shell
Executable file

#!/usr/bin/env bash
# The local check loop.
#
# scripts/check fmt, clippy, then every test
# scripts/check meeting::query fmt, then only the tests matching the filters
#
# Tests run through cargo-nextest (.config/nextest.toml): each test is its own
# process, and one that hangs is killed and reported by name. Exit codes:
# 10 fmt, 11 clippy, 12 tests. NEXTEST_PROFILE=ci selects CI's profile.
set -uo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
stage() {
printf '\n==> %s\n' "$1"
}
stage "fmt"
cargo fmt --all --check || exit 10
if [[ $# -eq 0 ]]; then
stage "clippy"
cargo clippy --locked --all-targets --all-features -- -D warnings || exit 11
fi
if command -v cargo-nextest >/dev/null 2>&1; then
stage "test (nextest${1:+: $*})"
cargo nextest run --locked --no-tests=warn "$@" || exit 12
else
stage "test (cargo test${1:+: $*})"
echo "cargo-nextest is not installed, so a hung test stalls the run without" >&2
echo "a name. Install it with: brew install cargo-nextest" >&2
cargo test --locked -- "$@" || exit 12
fi