Integrate 0.9.8 NDS read-only lab, repair upstream hook and simplify setup guidance

This commit is contained in:
2026-11-30 21:13:35 +00:00
parent b9fe2e61d2
commit c3aa4688d8
57 changed files with 2894 additions and 36 deletions

View File

@@ -4,8 +4,15 @@ set -euo pipefail
cd "$(dirname "$0")/.."
[[ $EUID == 0 ]] || { echo 'Use sudo make check-ncp-ip-integration on an isolated test host'; exit 1; }
[[ ! -S /run/mars-pcap/transport.sock ]] || { echo 'Existing MARS broker; test aborted'; exit 1; }
config=$(mktemp); chmod 600 "$config"; printf '{"enabled":true,"address":"127.0.0.1","slp":true}' > "$config"
work=$(mktemp -d); config=$work/ip.json; touch "$config"; chmod 600 "$config"; printf '{"enabled":true,"address":"127.0.0.1","slp":true}' > "$config"
unset MARS_NDS_LAB MARS_NDS_LAB_CONFIG MARS_NDS_LAB_DB MARS_NDS_DISCOVERY_TREE MARS_TEST_NDS_DISCOVERY MARS_TEST_INVALID_NDS
if [[ ${1:-} == --nds || ${1:-} == --invalid-nds ]]; then
printf '{"tree":"MARS_TREE","organization":"HOME","units":["USERS"]}' > "$work/tree.json"
export MARS_NDS_LAB=1 MARS_NDS_LAB_DB="$work/directory.sqlite3" MARS_NDS_DISCOVERY_TREE=MARS_TREE MARS_TEST_NDS_DISCOVERY=1
MARS_NDS_LAB_CONFIG=$(python3 nds/tools/snapshot.py "$work/tree.json" "$MARS_NDS_LAB_DB"); export MARS_NDS_LAB_CONFIG
if [[ ${1:-} == --invalid-nds ]]; then unset MARS_TEST_NDS_DISCOVERY; export MARS_TEST_INVALID_NDS=1; rm -f "$MARS_NDS_LAB_DB"; fi
fi
./build/mars-pcapd --offline-test --test-ip-config "$config" & pid=$!
trap 'kill "$pid" 2>/dev/null || true; wait "$pid" 2>/dev/null || true; rm -f "$config"' EXIT
trap 'kill "$pid" 2>/dev/null || true; wait "$pid" 2>/dev/null || true; rm -rf -- "$work"' EXIT
for i in $(seq 1 50); do [[ -S /run/mars-pcap/transport.sock ]] && break; sleep .1; done
./build/test-ncp-ip