minor change in test driver
This commit is contained in:
17
t/err.sh
17
t/err.sh
@ -27,14 +27,19 @@ run_partfile() {
|
||||
return 1
|
||||
}
|
||||
|
||||
l_expected_errline=$(echo $l_expected_errinfo | cut -d: -f1)
|
||||
l_xlen=$(echo $l_expected_errline | wc -c)
|
||||
l_expected_errline=$(echo "$l_expected_errinfo" | cut -d: -f1)
|
||||
l_xlen=$(echo "$l_expected_errline" | wc -c)
|
||||
l_xlen=$(expr $l_xlen + 10)
|
||||
l_expected_errmsg=$(echo $l_expected_errinfo | cut -c${l_xlen}-)
|
||||
l_expected_errmsg=$(echo "$l_expected_errinfo" | cut -c${l_xlen}-)
|
||||
l_output=`$l_cmd 2>&1`
|
||||
## the regular expression is not escaped properly. the error information must not
|
||||
## include specifial regex characters to avoid problems.
|
||||
echo "$l_output" | grep -E "ERROR:.+${l_partfile}\[${l_expected_errline},[[:digit:]]+\] ${l_expected_errmsg}" >/dev/null 2>&1 || {
|
||||
|
||||
## the checks using grep may not be 100% accurate depending on message patterns.
|
||||
## but it's unlikely such a case really happens
|
||||
echo "$l_output" | grep -q -E "^ERROR:.+${l_partfile}\[${l_expected_errline},[[:digit:]]+\] .+" 2>&1 || {
|
||||
echo "ERROR: error not raised at line $l_expected_errline - $l_script($l_partno) - $l_output"
|
||||
return 1
|
||||
}
|
||||
echo "$l_output" | grep -q -F " ${l_expected_errmsg}" 2>&1 || {
|
||||
echo "ERROR: error not raised at line $l_expected_errline - $l_script($l_partno) - $l_output"
|
||||
return 1
|
||||
}
|
||||
|
Reference in New Issue
Block a user