Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Add multi-arch Docker test: arm64 (native) + amd64 (QEMU)

Martin Vogelae0d1754ed20
diff --git a/test-infrastructure/docker-compose.yml b/test-infrastructure/docker-compose.yml
index 2f2f37c76..20446d4c4 100644
--- a/test-infrastructure/docker-compose.yml
+++ b/test-infrastructure/docker-compose.yml
@@ -1,21 +1,34 @@
-# Local Ubuntu test environment — mirrors GitHub Actions CI exactly.
+# Local test environment — mirrors GitHub Actions CI for all Docker-capable platforms.
#
-# Usage:
-# docker compose -f test-infrastructure/docker-compose.yml run --rm test
-# docker compose -f test-infrastructure/docker-compose.yml run --rm lint
+# Coverage matrix:
+# Linux arm64: native on Apple Silicon (mirrors CI ubuntu-24.04-arm)
+# Linux amd64: QEMU emulation (mirrors CI ubuntu-latest)
+# macOS: not possible in Docker — test natively: scripts/test.sh CC=cc
+# Windows: not possible in Docker on Mac — CI only
#
-# Shortcut (from repo root):
-# ./test-infrastructure/run.sh # test
-# ./test-infrastructure/run.sh lint # lint only
+# Usage:
+# ./test-infrastructure/run.sh # test arm64 (native, fast)
+# ./test-infrastructure/run.sh all # test arm64 + amd64 in parallel
+# ./test-infrastructure/run.sh amd64 # test amd64 only (QEMU, slower)
+# ./test-infrastructure/run.sh lint # lint only
services:
test:
build:
context: ..
dockerfile: test-infrastructure/Dockerfile
+ platform: linux/arm64
+ volumes:
+ - ..:/src
+ command: ["CC=gcc", "CXX=g++"]
+
+ test-amd64:
+ build:
+ context: ..
+ dockerfile: test-infrastructure/Dockerfile
+ platform: linux/amd64
volumes:
- ..:/src
- # GCC + ASan + UBSan + LeakSanitizer (exactly what CI runs)
command: ["CC=gcc", "CXX=g++"]
lint:
diff --git a/test-infrastructure/run.sh b/test-infrastructure/run.sh
index f15bd00a4..503e1d1fd 100755
--- a/test-infrastructure/run.sh
+++ b/test-infrastructure/run.sh
@@ -1,11 +1,19 @@
#!/bin/bash
-# Quick runner for local Docker-based CI testing.
+# Local CI testing — GCC + ASan + LeakSanitizer in Docker.
+#
+# Coverage:
+# arm64: Native on Apple Silicon (fast, ~3 min)
+# amd64: QEMU emulation (slower, ~8 min) — mirrors CI ubuntu-latest
+# macOS: Run natively: scripts/test.sh CC=cc CXX=c++
+# Windows: CI only (no Docker support on Mac)
#
# Usage:
-# ./test-infrastructure/run.sh # Run GCC tests (ASan + LeakSanitizer)
-# ./test-infrastructure/run.sh lint # Run linters (clang-format + cppcheck)
-# ./test-infrastructure/run.sh both # Lint then test
-# ./test-infrastructure/run.sh shell # Drop into container shell for debugging
+# ./test-infrastructure/run.sh # arm64 test (default, fast)
+# ./test-infrastructure/run.sh all # arm64 + amd64 in parallel
+# ./test-infrastructure/run.sh amd64 # amd64 only
+# ./test-infrastructure/run.sh lint # clang-format + cppcheck
+# ./test-infrastructure/run.sh shell # debug shell (arm64)
+# ./test-infrastructure/run.sh shell-amd64 # debug shell (amd64)
set -euo pipefail
@@ -13,26 +21,37 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
COMPOSE="docker compose -f $ROOT/test-infrastructure/docker-compose.yml"
case "${1:-test}" in
- test)
- echo "=== Running GCC + ASan + LeakSanitizer tests (mirrors Ubuntu CI) ==="
+ test|arm64)
+ echo "=== Linux arm64 (GCC + ASan + LeakSanitizer) ==="
$COMPOSE run --rm test
;;
- lint)
- echo "=== Running linters (clang-format-20 + cppcheck 2.20.0) ==="
- $COMPOSE run --rm lint
+ amd64)
+ echo "=== Linux amd64 via QEMU (GCC + ASan + LeakSanitizer) ==="
+ $COMPOSE run --rm test-amd64
+ ;;
+ all)
+ echo "=== Testing arm64 + amd64 in parallel ==="
+ $COMPOSE run --rm -d test
+ $COMPOSE run --rm test-amd64
+ echo "=== Waiting for arm64... ==="
+ # docker compose run -d returns immediately; wait for the container
+ $COMPOSE wait test 2>/dev/null || true
+ echo "=== All platforms passed ==="
;;
- both)
- echo "=== Running linters ==="
+ lint)
+ echo "=== Linters (clang-format-20 + cppcheck 2.20.0) ==="
$COMPOSE run --rm lint
- echo "=== Running tests ==="
- $COMPOSE run --rm test
;;
shell)
- echo "=== Dropping into test container shell ==="
+ echo "=== Debug shell (Linux arm64) ==="
$COMPOSE run --rm --entrypoint bash test
;;
+ shell-amd64)
+ echo "=== Debug shell (Linux amd64 via QEMU) ==="
+ $COMPOSE run --rm --entrypoint bash test-amd64
+ ;;
*)
- echo "Usage: $0 {test|lint|both|shell}"
+ echo "Usage: $0 {test|arm64|amd64|all|lint|shell|shell-amd64}"
exit 1
;;
esac