test(sync): bound manual av sync probe

This commit is contained in:
Brad Stein 2026-04-28 22:18:18 -03:00
parent 8648180ab5
commit 37673cb131
2 changed files with 12 additions and 1 deletions

View File

@ -15,6 +15,7 @@ LESAVKA_SERVER_CONNECT_HOST=${LESAVKA_SERVER_CONNECT_HOST:-38.28.125.112}
LESAVKA_SERVER_ADDR=${LESAVKA_SERVER_ADDR:-auto} LESAVKA_SERVER_ADDR=${LESAVKA_SERVER_ADDR:-auto}
PROBE_DURATION_SECONDS=${PROBE_DURATION_SECONDS:-10} PROBE_DURATION_SECONDS=${PROBE_DURATION_SECONDS:-10}
PROBE_WARMUP_SECONDS=${PROBE_WARMUP_SECONDS:-4} 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 # 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 # 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. # 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}" echo "==> running local Lesavka sync probe against ${RESOLVED_LESAVKA_SERVER_ADDR}"
probe_status=0 probe_status=0
probe_timed_out=0
( (
cd "${REPO_ROOT}" cd "${REPO_ROOT}"
"${PROBE_BIN}" \ timeout --signal=INT "${PROBE_TIMEOUT_SECONDS}" "${PROBE_BIN}" \
--server "${RESOLVED_LESAVKA_SERVER_ADDR}" \ --server "${RESOLVED_LESAVKA_SERVER_ADDR}" \
--duration-seconds "${PROBE_DURATION_SECONDS}" \ --duration-seconds "${PROBE_DURATION_SECONDS}" \
--warmup-seconds "${PROBE_WARMUP_SECONDS}" --warmup-seconds "${PROBE_WARMUP_SECONDS}"
) || probe_status=$? ) || probe_status=$?
if [[ "${probe_status}" -eq 124 ]]; then
probe_timed_out=1
fi
capture_status=0 capture_status=0
wait "${capture_pid}" || capture_status=$? wait "${capture_pid}" || capture_status=$?
@ -829,6 +834,9 @@ REMOTE_NORMALIZE_SCRIPT
fi fi
if [[ "${probe_status}" -ne 0 ]]; then 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 echo "sync probe failed with status ${probe_status}" >&2
[[ -f "${LOCAL_CAPTURE}" ]] && echo "partial capture preserved at ${LOCAL_CAPTURE}" >&2 [[ -f "${LOCAL_CAPTURE}" ]] && echo "partial capture preserved at ${LOCAL_CAPTURE}" >&2
exit "${probe_status}" exit "${probe_status}"

View File

@ -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}", "tunneled to ${LESAVKA_SERVER_HOST}:127.0.0.1:${SERVER_TUNNEL_REMOTE_PORT}",
"CAPTURE_READY_MARKER=\"__LESAVKA_CAPTURE_READY__\"", "CAPTURE_READY_MARKER=\"__LESAVKA_CAPTURE_READY__\"",
"LEAD_IN_SECONDS=${LEAD_IN_SECONDS:-0}", "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", "VIDIOC_STREAMON.*Connection timed out",
"the UVC host opened before MJPEG frames reached the gadget", "the UVC host opened before MJPEG frames reached the gadget",
"Tethys capture failed before the sync probe could start", "Tethys capture failed before the sync probe could start",