Files
codebase-memory-mcp/scripts/test.sh
T
Martin Vogel fd1640ec29 Add build scripts, fix GCC warnings, unify CI workflows
- Add scripts/clean.sh, test.sh, build.sh, lint.sh as single source
  of truth for local and CI builds (always clean, always parallel)
- Fix -Wmissing-braces: replace {{0}} with memset for struct arrays
- Fix -Wrestrict: use intermediate buffer for same-struct snprintf
- Update dry-run.yml and release.yml to use the new scripts
2026-03-18 12:31:53 +01:00

36 lines
864 B
Bash
Executable File

#!/bin/bash
# test.sh — Clean build + run all C tests with ASan + UBSan.
#
# Usage: scripts/test.sh [CC=gcc-14] [CXX=g++-14]
#
# This script is the SINGLE source of truth for running tests.
# Used identically in local development and CI workflows.
#
# Steps:
# 1. Clean all build artifacts (forced fresh compile)
# 2. Build test-runner with sanitizers
# 3. Run all test suites
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
# Detect parallelism
NPROC=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
# Forward CC/CXX from env or args (e.g. scripts/test.sh CC=gcc-14)
for arg in "$@"; do
export "${arg?}"
done
echo "=== test.sh: compiler=${CC:-default} cores=$NPROC ==="
# Step 1: Clean
scripts/clean.sh
# Step 2 + 3: Build and run tests
make -j"$NPROC" -f Makefile.cbm test
echo "=== All tests passed ==="