Make $? compatible with set -e in system tests

Ensure handling of return code from previous command doesn't cause the
script to halt if that code is non-zero when running with `set -e`.
This commit is contained in:
Tom Krizek
2023-06-09 10:57:34 +02:00
parent 1436025e20
commit 837c190d9e
19 changed files with 89 additions and 99 deletions

View File

@@ -42,8 +42,8 @@ for bad in bad-*.conf
do
ret=0
echo_i "checking that named-checkconf detects error in $bad"
$CHECKCONF $bad > /dev/null 2>&1
if [ $? != 1 ]; then echo_i "failed"; ret=1; fi
{ $CHECKCONF $bad > /dev/null 2>&1; rc=$?; } || true
if [ $rc != 1 ]; then echo_i "failed"; ret=1; fi
status=$((status + ret))
done
@@ -51,8 +51,8 @@ for good in good-*.conf
do
ret=0
echo_i "checking that named-checkconf detects no error in $good"
$CHECKCONF $good > /dev/null 2>&1
if [ $? != 0 ]; then echo_i "failed"; ret=1; fi
{ $CHECKCONF $good > /dev/null 2>&1; rc=$?; } || true
if [ $rc != 0 ]; then echo_i "failed"; ret=1; fi
status=$((status + ret))
done