#!/bin/sh # tests/test_junction.sh -- the junction plugin against a stand-in server. # # The C test needs a live HTTP endpoint; this starts tests/fake_junction.py on a # free-ish port, waits for it, and hands the port to the test. Nothing leaves # the machine. set -e cd "$(dirname "$0")/.." . "$(dirname "$0")/sh/port.sh" port=${JUNCTION_TEST_PORT:-$(free_port)} python3 tests/fake_junction.py "$port" & pid=$! trap 'kill $pid 2>/dev/null || true' EXIT INT TERM # The helper proves that *our* fake owns the listening socket, not just that # something answers: a port another program holds used to make this test talk # to a stranger that knows nothing about junction. if ! wait_listen "$port" "$pid"; then echo "test_junction: the fake junction did not start on $port" exit 1 fi ./tests/test_junction "$port"