#!/bin/sh # Simple test suite for videohubctrl functionality cd $(dirname $0)/.. export PATH=".:$PATH" make ulimit -c unlimited export PATH=".:$PATH" check() { if diff -u $1.ok $1.out then echo "OK : $2" else echo "ERROR : $2" exit 1 fi } videohubctrl --test-input test/input-00.txt $@ &> test/test-01.out check test/test-01 "Test parsing of test/input-00.txt" videohubctrl --test-input test/input-00.txt --backup $@ &> test/test-02.out check test/test-02 "Test --backup option output" ( sed -e 's|\\||g' < test/test-02.ok | tr -d '\n' echo ' --test-input test/input-03.txt' ) | sh &> test/test-03.out check test/test-03 "Test --backup restore" videohubctrl --test-input test/input-00.txt \ --set-name "Test name" \ --in-name "Windows 4 HD" "Windows 4 HighDef" \ --in-output "Windows 1" "Output 15" \ --in-monitor "Windows 3" "Monitor 1" \ --in-name 5 "In 5" \ --in-name "Input 6" "Camera 6" \ --out-name "Enc1 1" "Encoder 1" \ --out-name 16 Dev-Lo \ --out-lock 6 \ --out-lock "Output 15" \ --out-unlock 12 \ --out-unlock "Enc2 1" \ --out-input "Output 5" "Windows 1" \ --out-input 5 2 \ --out-input 5 "Windows 3" \ --mon-name 1 "PC 1 Mon" \ --mon-name "Monitor 4" "Decklink" \ --mon-unlock 2 \ --mon-lock 4 \ --mon-name 3 "Loopback" \ --mon-input 3 16 \ --ser-name 1 "Ren Ctrl 1" \ --ser-name "Deck 3" "Ren Deck 3" \ --ser-unlock 1 \ --ser-lock 2 \ --ser-input 2 1 \ --ser-dir 6 in \ --ser-dir 7 out \ --ser-dir 8 out --ser-dir 8 auto \ --ser-input 4 5 \ --ser-input 6 7 \ --ser-clear 4 \ --ser-clear "Serial 6" \ --pu-clear 1 --pu-clear 3 --pu-clear 4 \ --pu-unlock 1 --pu-lock 1 --pu-connect 1 "Windows 4 HD" \ --pu-connect 4 "DPlay1" --pu-lock 4 \ --fr-name 1 "Pic 1" --fr-name 2 "Pic 2" \ --fr-output 1 13 --fr-output 2 14 --fr-output 3 15 \ --fr-clear 3 \ --fr-lock 1 --fr-lock 2 --fr-lock 8 --fr-unlock 8 \ $@ &> test/test-04.out check test/test-04 "Test multiple configuration commands" grep -v ^videohub: < test/test-03.out > test/test-05.out sed -e 's,| L |,| O |,g' < test/test-01.ok > test/test-05.ok check test/test-05 "Test if --backup restored correct config." videohubctrl --test-input test/input-00.txt --in-name 0 "Test Input 0" $@ &> test/test-06.out videohubctrl --test-input test/input-00.txt --in-name 18 "Test Input 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --in-name "Input 18" "Test Input 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-name 18 "Test Output 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-name "Output 18" "Test Output 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --in-output "Input 22" "Output 15" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --in-output "Input 14" "Output 22" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --in-monitor "Input 22" "Monitor 3" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --in-monitor "Input 14" "Monitor 33" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-lock 18 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-lock "Output 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-unlock 18 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-unlock "Output 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-input 0 0 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-input 0 18 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-input 18 0 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-input 18 18 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-input 1 18 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-input 18 1 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-input "Input 10" "Output 10" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-input "Err Output" "Input 10" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --out-input "Output 10" "Err Input" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --mon-name 18 "Test Output 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --mon-name "Output 18" "Test Output 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --mon-lock 18 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --mon-lock "Output 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --mon-unlock 18 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --mon-unlock "Output 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-name 18 "Test Serial 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-name "Serial 18" "Test Serial 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-clear 24 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-clear "Serial X" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-connect 24 7 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-lock 18 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-lock "Serial 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-unlock 18 $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-unlock "Serial 18" $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-dir 1 err-dir $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --ser-dir "Serial 5" err-dir $@ >> test/test-06.out 2>&1 videohubctrl --test-input test/input-00.txt --set-name $@ >> test/test-06.out 2>&1 check test/test-06 "Test errors on commands with invalid parameters." videohubctrl --test-input test/input-00.txt --list-device $@ &> test/test-07.out check test/test-07 "Test --list-device option output" videohubctrl --test-input test/input-00.txt --list-inputs $@ &> test/test-08.out check test/test-08 "Test --list-inputs option output" videohubctrl --test-input test/input-00.txt --list-outputs $@ &> test/test-09.out check test/test-09 "Test --list-outputs option output" videohubctrl --test-input test/input-10.txt $@ &> test/test-10.out check test/test-10 "Test invalid protocol" videohubctrl --test-input test/input-11.txt $@ &> test/test-11.out check test/test-11 "Test invalid number of ports" videohubctrl --test-input test/input-12.txt $@ &> test/test-12.out check test/test-12 "Test device-not_present check" videohubctrl --test-input test/input-14.txt $@ &> test/test-14.out check test/test-14 "Test buggy input" videohubctrl --test-input test/input-00.txt --list-monitor $@ &> test/test-15.out check test/test-15 "Test --list-monitor option output" videohubctrl --test-input test/input-00.txt --list-serial $@ &> test/test-16.out check test/test-16 "Test --list-serial option output" videohubctrl --test-input test/input-17.txt --info $@ &> test/test-17.out check test/test-17 "Test wider range of input commands" videohubctrl --test-input test/input-00.txt --list-proc-units $@ &> test/test-18.out check test/test-18 "Test --list-proc-units option output" videohubctrl --test-input test/input-00.txt --list-frames $@ &> test/test-19.out check test/test-19 "Test --list-frames option output" videohubctrl --test-input test/input-r.txt $@ &> test/test-r.out check test/test-r "Test input with windows line endings" videohubctrl --test-input test/input-r2.txt $@ &> test/test-r2.out check test/test-r2 "Test input with leading whitespace and windows line endings" videohubctrl --test-input test/input-288.txt $@ &> test/test-288.out check test/test-288 "Test videohub 288 config parsing" videohubctrl --list-alarms --test-input test/input-288-alarms.txt $@ &> test/test-288-alarms.out check test/test-288-alarms "Test alarm overflow"