OverviewFilesCommitsIssuesDocsReleasesPeers

hyperswarm-peer / integration / run_layer14.sh

35 lines · bash ref:
#!/usr/bin/env bash
# Layer 14: Peer Lifetime Under Room Switch
# Drops the peer an overlay is attached to and attaches a new one, three times.
# Needs no bootstrap, no network and no second process — a crash IS the failure,
# so the exit status matters as much as the output.
set -uo pipefail
cd "$(dirname "$0")"

echo "=== Layer 14: Peer Lifetime Under Room Switch ==="

rm -f /tmp/layer14_status.txt
OUTPUT=$(timeout -k 10 90 godot4 --headless --path project --script ../layer14_room_switch.gd 2>&1)
RC=$?
echo "$OUTPUT"

# glibc aborts the process on heap corruption, so the script never reaches its
# own summary. Report that as the failure it is rather than "no results found".
if [ $RC -ne 0 ] && ! echo "$OUTPUT" | grep -qE "=== Layer 14: (PASS|FAILED) ==="; then
    echo "Layer 14: FAILED (godot exited $RC — crash before the summary)"
    exit 1
fi

if echo "$OUTPUT" | grep -q "FAIL "; then
    echo "Layer 14: FAILED"
    exit 1
fi

if echo "$OUTPUT" | grep -q "=== Layer 14: PASS ==="; then
    echo "Layer 14: OK"
    exit 0
fi

echo "Layer 14: UNKNOWN (no results found)"
exit 1