test(scripts): resolve binaries from build bin layout
This commit is contained in:
@@ -5,6 +5,7 @@ set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
STREAMER_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||
BUILD_DIR="${STREAMER_ROOT}/build"
|
||||
BUILD_BIN_DIR="${BUILD_DIR}/bin"
|
||||
EVIDENCE_ROOT="${STREAMER_ROOT}/.sisyphus/evidence"
|
||||
TASK_EVIDENCE_DIR="${EVIDENCE_ROOT}/task-14-acceptance"
|
||||
SUMMARY_HELPER="${SCRIPT_DIR}/acceptance_summary_helper.py"
|
||||
@@ -66,6 +67,23 @@ binary_exists() {
|
||||
[[ -x "${path}" ]]
|
||||
}
|
||||
|
||||
binary_candidates() {
|
||||
local name="$1"
|
||||
printf '%s\n' "${BUILD_BIN_DIR}/${name}" "${BUILD_DIR}/${name}"
|
||||
}
|
||||
|
||||
resolve_binary() {
|
||||
local name="$1"
|
||||
local candidate=""
|
||||
while IFS= read -r candidate; do
|
||||
if binary_exists "${candidate}"; then
|
||||
printf '%s\n' "${candidate}"
|
||||
return 0
|
||||
fi
|
||||
done < <(binary_candidates "${name}")
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_pid() {
|
||||
local pid="$1"
|
||||
local timeout_s="$2"
|
||||
@@ -124,7 +142,7 @@ run_rtp_row() {
|
||||
local row_start_ms
|
||||
row_start_ms="$(date +%s%3N)"
|
||||
|
||||
"${BUILD_DIR}/rtp_receiver_tester" \
|
||||
"${RTP_RECEIVER_TESTER}" \
|
||||
--port "${port}" \
|
||||
--expect-pt "${payload_type}" \
|
||||
--packet-threshold 1 \
|
||||
@@ -135,7 +153,7 @@ run_rtp_row() {
|
||||
sleep 1
|
||||
|
||||
set +e
|
||||
"${BUILD_DIR}/rtp_output_tester" \
|
||||
"${RTP_OUTPUT_TESTER}" \
|
||||
--host 127.0.0.1 \
|
||||
--port "${port}" \
|
||||
--payload-type "${payload_type}" \
|
||||
@@ -208,7 +226,7 @@ run_rtmp_row() {
|
||||
local row_start_ms
|
||||
row_start_ms="$(date +%s%3N)"
|
||||
|
||||
"${BUILD_DIR}/rtmp_stub_tester" \
|
||||
"${RTMP_STUB_TESTER}" \
|
||||
--mode "${mode}" \
|
||||
--listen-host 127.0.0.1 \
|
||||
--listen-port "${port}" \
|
||||
@@ -220,7 +238,7 @@ run_rtmp_row() {
|
||||
sleep 1
|
||||
|
||||
set +e
|
||||
"${BUILD_DIR}/rtmp_output_tester" \
|
||||
"${RTMP_OUTPUT_TESTER}" \
|
||||
--rtmp-url "rtmp://127.0.0.1:${port}/live/${row_id}" \
|
||||
--transport "${transport}" \
|
||||
--codec "${codec}" \
|
||||
@@ -273,16 +291,16 @@ run_rtmp_row() {
|
||||
|
||||
main() {
|
||||
local required=(
|
||||
"${BUILD_DIR}/rtp_output_tester"
|
||||
"${BUILD_DIR}/rtp_receiver_tester"
|
||||
"${BUILD_DIR}/rtmp_output_tester"
|
||||
"${BUILD_DIR}/rtmp_stub_tester"
|
||||
"rtp_output_tester"
|
||||
"rtp_receiver_tester"
|
||||
"rtmp_output_tester"
|
||||
"rtmp_stub_tester"
|
||||
)
|
||||
|
||||
local missing=()
|
||||
for bin in "${required[@]}"; do
|
||||
if ! binary_exists "${bin}"; then
|
||||
missing+=("${bin}")
|
||||
if ! resolve_binary "${bin}" >/dev/null; then
|
||||
missing+=("${BUILD_BIN_DIR}/${bin} or ${BUILD_DIR}/${bin}")
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -298,6 +316,11 @@ main() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
RTP_OUTPUT_TESTER="$(resolve_binary rtp_output_tester)"
|
||||
RTP_RECEIVER_TESTER="$(resolve_binary rtp_receiver_tester)"
|
||||
RTMP_OUTPUT_TESTER="$(resolve_binary rtmp_output_tester)"
|
||||
RTMP_STUB_TESTER="$(resolve_binary rtmp_stub_tester)"
|
||||
|
||||
run_rtp_row 1 "rtp_h264" "h264"
|
||||
run_rtp_row 2 "rtp_h265" "h265"
|
||||
run_rtmp_row 3 "rtmp_h264_libavformat" "h264" "libavformat"
|
||||
|
||||
Reference in New Issue
Block a user