From 37673cb131a8c14642731d6f89cb96d58c9882a4 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Tue, 28 Apr 2026 22:18:18 -0300 Subject: [PATCH] test(sync): bound manual av sync probe --- scripts/manual/run_upstream_av_sync.sh | 10 +++++++++- testing/tests/client_manual_sync_script_contract.rs | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/manual/run_upstream_av_sync.sh b/scripts/manual/run_upstream_av_sync.sh index f90bbf9..2ae969d 100755 --- a/scripts/manual/run_upstream_av_sync.sh +++ b/scripts/manual/run_upstream_av_sync.sh @@ -15,6 +15,7 @@ LESAVKA_SERVER_CONNECT_HOST=${LESAVKA_SERVER_CONNECT_HOST:-38.28.125.112} LESAVKA_SERVER_ADDR=${LESAVKA_SERVER_ADDR:-auto} PROBE_DURATION_SECONDS=${PROBE_DURATION_SECONDS:-10} PROBE_WARMUP_SECONDS=${PROBE_WARMUP_SECONDS:-4} +PROBE_TIMEOUT_SECONDS=${PROBE_TIMEOUT_SECONDS:-$((PROBE_DURATION_SECONDS + PROBE_WARMUP_SECONDS + 20))} # Do not open the UVC host capture far ahead of the probe. The gadget side only # has frames once the sync probe is feeding the server, and some hosts time out # VIDIOC_STREAMON if the camera is starved during pre-roll. @@ -761,13 +762,17 @@ sleep "${LEAD_IN_SECONDS}" echo "==> running local Lesavka sync probe against ${RESOLVED_LESAVKA_SERVER_ADDR}" probe_status=0 +probe_timed_out=0 ( cd "${REPO_ROOT}" - "${PROBE_BIN}" \ + timeout --signal=INT "${PROBE_TIMEOUT_SECONDS}" "${PROBE_BIN}" \ --server "${RESOLVED_LESAVKA_SERVER_ADDR}" \ --duration-seconds "${PROBE_DURATION_SECONDS}" \ --warmup-seconds "${PROBE_WARMUP_SECONDS}" ) || probe_status=$? +if [[ "${probe_status}" -eq 124 ]]; then + probe_timed_out=1 +fi capture_status=0 wait "${capture_pid}" || capture_status=$? @@ -829,6 +834,9 @@ REMOTE_NORMALIZE_SCRIPT fi if [[ "${probe_status}" -ne 0 ]]; then + if [[ "${probe_timed_out}" -eq 1 ]]; then + echo "sync probe timed out after ${PROBE_TIMEOUT_SECONDS}s; this usually means one upstream stream did not close cleanly after capture starvation." >&2 + fi echo "sync probe failed with status ${probe_status}" >&2 [[ -f "${LOCAL_CAPTURE}" ]] && echo "partial capture preserved at ${LOCAL_CAPTURE}" >&2 exit "${probe_status}" diff --git a/testing/tests/client_manual_sync_script_contract.rs b/testing/tests/client_manual_sync_script_contract.rs index c83b833..63bc2cf 100644 --- a/testing/tests/client_manual_sync_script_contract.rs +++ b/testing/tests/client_manual_sync_script_contract.rs @@ -20,6 +20,9 @@ fn upstream_sync_script_tunnels_auto_server_addr_through_ssh() { "tunneled to ${LESAVKA_SERVER_HOST}:127.0.0.1:${SERVER_TUNNEL_REMOTE_PORT}", "CAPTURE_READY_MARKER=\"__LESAVKA_CAPTURE_READY__\"", "LEAD_IN_SECONDS=${LEAD_IN_SECONDS:-0}", + "PROBE_TIMEOUT_SECONDS=${PROBE_TIMEOUT_SECONDS:-$((PROBE_DURATION_SECONDS + PROBE_WARMUP_SECONDS + 20))}", + "timeout --signal=INT \"${PROBE_TIMEOUT_SECONDS}\" \"${PROBE_BIN}\"", + "sync probe timed out after ${PROBE_TIMEOUT_SECONDS}s", "VIDIOC_STREAMON.*Connection timed out", "the UVC host opened before MJPEG frames reached the gadget", "Tethys capture failed before the sync probe could start",