test(scripts): resolve binaries from build bin layout
This commit is contained in:
+37
-11
@@ -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-15-fault-suite"
|
||||
SUMMARY_HELPER="${SCRIPT_DIR}/fault_summary_helper.py"
|
||||
@@ -70,6 +71,28 @@ allocate_run_dir || exit 1
|
||||
|
||||
echo -e "order\tscenario_id\tname\tstatus\treason\tduration_ms\tcommand_rc\tlog_path" > "${MANIFEST_TSV}"
|
||||
|
||||
binary_exists() {
|
||||
local path="$1"
|
||||
[[ -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
|
||||
}
|
||||
|
||||
append_manifest_row() {
|
||||
local order="$1"
|
||||
local scenario_id="$2"
|
||||
@@ -125,14 +148,14 @@ run_expected_failure() {
|
||||
|
||||
main() {
|
||||
local required=(
|
||||
"${BUILD_DIR}/cvmmap_streamer"
|
||||
"${BUILD_DIR}/rtmp_output_tester"
|
||||
"cvmmap_streamer"
|
||||
"rtmp_output_tester"
|
||||
)
|
||||
|
||||
local missing=()
|
||||
for bin in "${required[@]}"; do
|
||||
if [[ ! -x "${bin}" ]]; then
|
||||
missing+=("${bin}")
|
||||
if ! resolve_binary "${bin}" >/dev/null; then
|
||||
missing+=("${BUILD_BIN_DIR}/${bin} or ${BUILD_DIR}/${bin}")
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -149,16 +172,19 @@ main() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
CVMMAP_STREAMER_BIN="$(resolve_binary cvmmap_streamer)"
|
||||
RTMP_OUTPUT_TESTER="$(resolve_binary rtmp_output_tester)"
|
||||
|
||||
run_expected_failure 1 "removed_encoder_backend" "removed encoder backend rejected" \
|
||||
"invalid encoder backend: 'gstreamer_legacy' was removed; use ffmpeg" \
|
||||
"${BUILD_DIR}/cvmmap_streamer" \
|
||||
"${CVMMAP_STREAMER_BIN}" \
|
||||
--run-mode pipeline \
|
||||
--input-uri cvmmap://default \
|
||||
--encoder-backend gstreamer_legacy
|
||||
|
||||
run_expected_failure 2 "removed_rtmp_transport" "removed RTMP transport rejected" \
|
||||
"invalid rtmp transport: 'legacy_custom' was removed; use libavformat or ffmpeg_process" \
|
||||
"${BUILD_DIR}/cvmmap_streamer" \
|
||||
"${CVMMAP_STREAMER_BIN}" \
|
||||
--run-mode pipeline \
|
||||
--input-uri cvmmap://default \
|
||||
--rtmp \
|
||||
@@ -167,7 +193,7 @@ main() {
|
||||
|
||||
run_expected_failure 3 "removed_rtmp_mode_cli" "removed RTMP mode flag rejected" \
|
||||
"unknown argument: --rtmp-mode (removed; RTMP always uses enhanced mode)" \
|
||||
"${BUILD_DIR}/cvmmap_streamer" \
|
||||
"${CVMMAP_STREAMER_BIN}" \
|
||||
--rtmp-mode enhanced
|
||||
|
||||
local mode_row_dir="${RUN_DIR}/4-removed_rtmp_mode_toml"
|
||||
@@ -181,19 +207,19 @@ mode = "enhanced"
|
||||
EOF
|
||||
run_expected_failure 4 "removed_rtmp_mode_toml" "removed RTMP mode TOML rejected" \
|
||||
"invalid RTMP config: outputs.rtmp.mode was removed; RTMP always uses enhanced mode" \
|
||||
"${BUILD_DIR}/cvmmap_streamer" \
|
||||
"${CVMMAP_STREAMER_BIN}" \
|
||||
--config "${mode_config}"
|
||||
|
||||
run_expected_failure 5 "missing_rtmp_url" "missing RTMP URL rejected" \
|
||||
"invalid RTMP config: enabled RTMP output requires at least one URL" \
|
||||
"${BUILD_DIR}/cvmmap_streamer" \
|
||||
"${CVMMAP_STREAMER_BIN}" \
|
||||
--run-mode pipeline \
|
||||
--input-uri cvmmap://default \
|
||||
--rtmp
|
||||
|
||||
run_expected_failure 6 "invalid_rtp_endpoint" "invalid RTP endpoint rejected" \
|
||||
"invalid RTP config: endpoint must be in '<host>:<port>' format" \
|
||||
"${BUILD_DIR}/cvmmap_streamer" \
|
||||
"${CVMMAP_STREAMER_BIN}" \
|
||||
--run-mode pipeline \
|
||||
--input-uri cvmmap://default \
|
||||
--rtp \
|
||||
@@ -201,7 +227,7 @@ EOF
|
||||
|
||||
run_expected_failure 7 "ffmpeg_process_bad_binary" "ffmpeg_process child failure surfaces" \
|
||||
"child exited before publish completed" \
|
||||
"${BUILD_DIR}/rtmp_output_tester" \
|
||||
"${RTMP_OUTPUT_TESTER}" \
|
||||
--rtmp-url rtmp://127.0.0.1/live/test \
|
||||
--transport ffmpeg_process \
|
||||
--ffmpeg-path /nonexistent/ffmpeg \
|
||||
|
||||
Reference in New Issue
Block a user