Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1437,8 +1437,10 @@ set(_onebit_route_tests
laya_gguf_route mem_admit_route hrx_cwsr_route hrx_runtime_route hybrid_route
hybrid_kvshare_route)
# Tests that only exist for some configurations (a model was passed, a device is built in).
list(APPEND _onebit_route_tests hybrid_e2e laya_route_e2e laya_models_e2e pm_laya_route serve_e2e_cpu serve_e2e_hrx
hrx_cpu_weight_parity)
# serve_e2e_<dev> left this list with engine #1485: it runs `serve --port 0` now, so it picks nothing and there is no
# window for the lock to close. hrx_cpu_weight_parity stays - it starts `llama-server` itself, whose port is not ours to
# choose (that is also why it is not in the `1bit serve` migration).
list(APPEND _onebit_route_tests hybrid_e2e laya_route_e2e laya_models_e2e pm_laya_route hrx_cpu_weight_parity)
foreach(_onebit_route_test IN LISTS _onebit_route_tests)
if(TEST ${_onebit_route_test})
set_tests_properties(${_onebit_route_test} PROPERTIES RESOURCE_LOCK route_ports)
Expand Down
11 changes: 9 additions & 2 deletions tests/anchor_rerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
set -uo pipefail

bin=${1:?usage: anchor_rerun.sh <1bit> <outdir> <device> <alias>:<gguf> ...}
# shellcheck source=tests/serve_port.sh
. "$(dirname "$0")/serve_port.sh" # serve_port_wait: read back the port serve bound (engine #1485)
outdir=${2:?}
device=${3:?}
shift 3
Expand All @@ -31,11 +33,16 @@ for spec in "$@"; do
echo "SKIP $alias: gguf missing: $gguf"
continue
fi
port=$(python3 -c 'import socket; s=socket.socket(); s.bind(("127.0.0.1", 0)); print(s.getsockname()[1])')
log=$(mktemp /tmp/serve-rerun-${alias}.XXXX.log)
t0=$(date +%s)
"$bin" serve -m "$gguf" --device "$device" --port "$port" --alias "$alias" >"$log" 2>&1 &
# --port 0: the kernel picks and serve reports the port it bound (engine #1485), so nothing is picked and released
# here. The budget matches this script's own 30-minute health window: these are real models.
"$bin" serve -m "$gguf" --device "$device" --port 0 --alias "$alias" >"$log" 2>&1 &
pid=$!
port=$(serve_port_wait "$log" "$pid" 18000) || {
echo "FAIL $alias: serve never reported a port; log=$log"; tail -25 "$log"
kill "$pid" 2>/dev/null; wait "$pid" 2>/dev/null; continue
}
code=000
for _ in $(seq 1 3600); do
code=$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:$port/health" 2>/dev/null)
Expand Down
8 changes: 6 additions & 2 deletions tests/serve_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
set -uo pipefail

bin=${1:?usage: serve_e2e.sh path/to/1bit <model> <device> [args]}
# shellcheck source=tests/serve_port.sh
. "$(dirname "$0")/serve_port.sh" # serve_port_wait: read back the port serve bound (engine #1485)
model=${2:?}
device=${3:?}
shift 3
Expand All @@ -35,10 +37,12 @@ if [ "$device" = hrx ]; then
for t in $want; do case " $have" in *" $t "*) found=1 ;; esac; done
[ $found = 1 ] || { echo "skip: no $want GPU for HRX on this machine (GPUs: ${have:-none})"; exit 77; }
fi
port=$(python3 -c 'import socket; s=socket.socket(); s.bind(("127.0.0.1", 0)); print(s.getsockname()[1])')
log=$(mktemp)
"$bin" serve -m "$model" --device "$device" --port "$port" --alias e2e-model "$@" >"$log" 2>&1 &
# --port 0: the kernel picks and serve reports the port it bound, so nothing here picks a port and releases it before
# serve binds (engine #1444/#1485). The budget is generous because this test loads a real model before it is ready.
"$bin" serve -m "$model" --device "$device" --port 0 --alias e2e-model "$@" >"$log" 2>&1 &
pid=$!
port=$(serve_port_wait "$log" "$pid" 12000) || { echo "FAIL serve never reported a port"; cat "$log"; exit 1; }
cleanup() { kill "$pid" 2>/dev/null; wait "$pid" 2>/dev/null; rm -f "$log"; }
trap cleanup EXIT
fail=0
Expand Down
Loading