Factor signal checks out of test scripts
Several test scripts now have some code to check for a program returning a signal, and reporting a suitable failure. This patch moves this duplicated code into a helper function in tests.sh. At the same time we remove a bashism found in the current copies (using the non portablr $[ ] construct for arithmetic). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>main
parent
a90b5b1491
commit
c879a8a28b
|
@ -17,10 +17,7 @@ trap "rm -f $LOG" 0
|
||||||
verbose_run_log "$LOG" $VALGRIND "$DTC" -o /dev/null "$@"
|
verbose_run_log "$LOG" $VALGRIND "$DTC" -o /dev/null "$@"
|
||||||
ret="$?"
|
ret="$?"
|
||||||
|
|
||||||
if [ "$ret" -gt 127 ]; then
|
FAIL_IF_SIGNAL $ret
|
||||||
signame=$(kill -l $[ret - 128])
|
|
||||||
FAIL "Killed by SIG$signame"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for c in $CHECKS; do
|
for c in $CHECKS; do
|
||||||
if ! grep -E "^(ERROR)|(Warning) \($c\):" $LOG > /dev/null; then
|
if ! grep -E "^(ERROR)|(Warning) \($c\):" $LOG > /dev/null; then
|
||||||
|
|
|
@ -18,10 +18,7 @@ if [ "$ret" -ne 0 -a "$expect" = "ERR" ]; then
|
||||||
PASS
|
PASS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ret" -gt 127 ]; then
|
FAIL_IF_SIGNAL $ret
|
||||||
signame=$(kill -l $[ret - 128])
|
|
||||||
FAIL "Killed by SIG$signame"
|
|
||||||
fi
|
|
||||||
|
|
||||||
diff $EXPECT $LOG
|
diff $EXPECT $LOG
|
||||||
ret="$?"
|
ret="$?"
|
||||||
|
|
|
@ -29,19 +29,14 @@ ret="$?"
|
||||||
if [ "$ret" -ne 0 -a "$expect" = "ERR" ]; then
|
if [ "$ret" -ne 0 -a "$expect" = "ERR" ]; then
|
||||||
PASS
|
PASS
|
||||||
fi
|
fi
|
||||||
if [ "$ret" -gt 127 ]; then
|
|
||||||
signame=$(kill -l $[ret - 128])
|
FAIL_IF_SIGNAL $ret
|
||||||
FAIL "Killed by SIG$signame"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Now fdtget to read the value
|
# Now fdtget to read the value
|
||||||
verbose_run_log "$LOG" $VALGRIND "$DTGET" "$dtb" "$node" "$property" $flags
|
verbose_run_log "$LOG" $VALGRIND "$DTGET" "$dtb" "$node" "$property" $flags
|
||||||
ret="$?"
|
ret="$?"
|
||||||
|
|
||||||
if [ "$ret" -gt 127 ]; then
|
FAIL_IF_SIGNAL $ret
|
||||||
signame=$(kill -l $[ret - 128])
|
|
||||||
FAIL "Killed by SIG$signame"
|
|
||||||
fi
|
|
||||||
|
|
||||||
diff $EXPECT $LOG
|
diff $EXPECT $LOG
|
||||||
ret="$?"
|
ret="$?"
|
||||||
|
|
|
@ -10,6 +10,14 @@ FAIL () {
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FAIL_IF_SIGNAL () {
|
||||||
|
ret="$1"
|
||||||
|
if [ "$ret" -gt 127 ]; then
|
||||||
|
signame=$(kill -l $((ret - 128)))
|
||||||
|
FAIL "Killed by SIG$signame"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
DTC=../dtc
|
DTC=../dtc
|
||||||
DTGET=../fdtget
|
DTGET=../fdtget
|
||||||
DTPUT=../fdtput
|
DTPUT=../fdtput
|
||||||
|
|
Loading…
Reference in New Issue