mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 18:58:00 +00:00
- 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
36 lines
864 B
Bash
Executable File
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 ==="
|