Tests now work for FreeBSD
Some checks failed
CI / Test (Linux) (push) Has been cancelled
CI / Test (Windows MSVC) (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled

This commit is contained in:
Eric Ratliff
2026-03-15 17:09:29 -05:00
parent f083ac9524
commit 79f6bb57d4
2 changed files with 27 additions and 3 deletions

View File

@@ -24,6 +24,17 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
TEST_DIR="$SCRIPT_DIR/test"
BUILD_DIR="$TEST_DIR/build"
# Portable CPU count -- BSD make requires a number after -j, GNU make does not
cpu_count() {
if command -v nproc &>/dev/null; then
nproc
elif command -v sysctl &>/dev/null; then
sysctl -n hw.ncpu
else
echo 4
fi
}
# Color output
if [[ -t 1 ]]; then
RED=$'\033[0;31m'; GRN=$'\033[0;32m'; CYN=$'\033[0;36m'
@@ -67,6 +78,8 @@ if ! command -v cmake &>/dev/null; then
echo " Install:" >&2
if [[ "$(uname)" == "Darwin" ]]; then
echo " brew install cmake" >&2
elif [[ "$(uname)" == "FreeBSD" ]]; then
echo " sudo pkg install cmake" >&2
else
echo " sudo apt install cmake (Debian/Ubuntu)" >&2
echo " sudo dnf install cmake (Fedora)" >&2
@@ -102,7 +115,7 @@ if [[ ! -f "$BUILD_DIR/CMakeCache.txt" ]]; then
fi
info "Building tests..."
cmake --build "$BUILD_DIR" --parallel 2>&1 | \
cmake --build "$BUILD_DIR" --parallel "$(cpu_count)" 2>&1 | \
while IFS= read -r line; do echo " $line"; done
echo ""