#!/bin/sh # Simple test suite for videohubctrl functionality cd $(dirname $0)/.. 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 \ --vi-name "Windows 4 HD" "Windows 4 HighDef" \ --vi-name 5 "In 5" \ --vi-name "Input 6" "Camera 6" \ --vo-name "Enc1 1" "Encoder 1" \ --vo-name 16 Dev-Lo \ --vo-lock 6 \ --vo-lock "Output 15" \ --vo-unlock 12 \ --vo-unlock "Enc2 1" \ --vo-input "Output 5" "Windows 1" \ --vo-input 5 2 \ --vo-input 5 "Windows 3" \ --mo-name 1 "PC 1 Mon" \ --mo-name "Monitor 4" "Decklink" \ --mo-unlock 2 \ --mo-lock 4 \ --mo-name 3 "Loopback" \ --mo-input 3 16 \ --se-name 1 "Ren Ctrl 1" \ --se-name "Deck 3" "Ren Deck 3" \ --se-unlock 1 \ --se-lock 2 \ --se-input 2 1 \ --se-dir 6 in \ --se-dir 7 out \ --se-dir 8 out --se-dir 8 auto \ --se-input 4 5 \ --se-input 6 7 \ --se-clear 4 \ --se-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 --vi-name 0 "Test Input 0" $@ &> test/test-06.out ./videohubctrl --test-input test/input-00.txt --vi-name 18 "Test Input 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vi-name "Input 18" "Test Input 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-name 18 "Test Output 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-name "Output 18" "Test Output 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-lock 18 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-lock "Output 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-unlock 18 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-unlock "Output 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-input 0 0 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-input 0 18 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-input 18 0 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-input 18 18 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-input 1 18 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-input 18 1 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-input "Input 10" "Output 10" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-input "Err Output" "Input 10" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --vo-input "Output 10" "Err Input" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --mo-name 18 "Test Output 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --mo-name "Output 18" "Test Output 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --mo-lock 18 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --mo-lock "Output 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --mo-unlock 18 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --mo-unlock "Output 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-name 18 "Test Serial 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-name "Serial 18" "Test Serial 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-clear 24 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-clear "Serial X" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-connect 24 7 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-lock 18 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-lock "Serial 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-unlock 18 $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-unlock "Serial 18" $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-dir 1 err-dir $@ >> test/test-06.out 2>&1 ./videohubctrl --test-input test/input-00.txt --se-dir "Serial 5" err-dir $@ >> test/test-06.out 2>&1 check test/test-06 "Test errors on commands with invalid ports." 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-vinputs $@ &> test/test-08.out check test/test-08 "Test --list-vinputs option output" videohubctrl --test-input test/input-00.txt --list-voutputs $@ &> test/test-09.out check test/test-09 "Test --list-voutputs 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-moutputs $@ &> test/test-15.out check test/test-15 "Test --list-moutputs 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"