2023-11-26 15:08:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
for i in $@; do :; done
|
|
|
|
script="$i"
|
|
|
|
|
2023-11-27 09:25:27 +00:00
|
|
|
expected_errinfo=$(grep -n -o -E "##ERROR: .+" "$script" 2>/dev/null)
|
2023-11-26 15:08:59 +00:00
|
|
|
[ -z "$expected_errinfo" ] && {
|
|
|
|
echo "INVALID TESTER - $script contains no ERROR information"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
expected_errline=$(echo $expected_errinfo | cut -d: -f1)
|
|
|
|
xlen=$(echo $expected_errline | wc -c)
|
2023-11-27 09:25:27 +00:00
|
|
|
xlen=$(expr $xlen + 10)
|
2023-11-26 15:08:59 +00:00
|
|
|
expected_errmsg=$(echo $expected_errinfo | cut -c${xlen}-)
|
|
|
|
|
|
|
|
output=$($@ 2>&1)
|
2023-11-27 09:25:27 +00:00
|
|
|
## the regular expression is not escaped properly. the error information must not
|
|
|
|
## include specifial regex characters to avoid problems.
|
|
|
|
echo "$output" | grep -E "ERROR:.+${script}\[${expected_errline},[[:digit:]]+\] ${expected_errmsg}" || {
|
2023-11-26 15:08:59 +00:00
|
|
|
echo "$script - $output"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
exit 0
|