diff options
| author | Murilo Ijanc <[email protected]> | 2026-07-26 12:56:51 -0300 |
|---|---|---|
| committer | Murilo Ijanc <[email protected]> | 2026-07-26 12:56:59 -0300 |
| commit | b7b08a7d29d84de187dd8a55e0c94de66b07a572 (patch) | |
| tree | 7e55661d3eca3cf3b16aada6e87eabee68802fb9 /tests/run.sh | |
| download | asm-b7b08a7d29d84de187dd8a55e0c94de66b07a572.tar.gz | |
Initial importv0.1.0
Diffstat (limited to 'tests/run.sh')
| -rwxr-xr-x | tests/run.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/run.sh b/tests/run.sh new file mode 100755 index 0000000..52e50d2 --- /dev/null +++ b/tests/run.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Bring the local API stand-in up, run the driver against it, tear it down. +# Exits non-zero when anything fails. $1 is the driver, the rest is a prefix +# to run it under (valgrind, gdb, ...). + +set -eu + +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +driver=$1 +shift + +fifo=$(mktemp -u) +mkfifo "$fifo" + +python3 "$here/server.py" 0 >"$fifo" & +server=$! + +cleanup() { + kill "$server" 2>/dev/null || true + wait "$server" 2>/dev/null || true + rm -f "$fifo" +} +trap cleanup EXIT INT TERM + +port=$(head -n 1 "$fifo") +if [ -z "$port" ]; then + echo "server did not start" >&2 + exit 1 +fi + +echo "server on 127.0.0.1:$port" +"$@" "$driver" "http://127.0.0.1:$port" |