1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

shtests: report signal when a test crashes

When a test aborted due to a signal, the >256 exit code signifying
the signal was incorrectly reported as the number of errors.

src/cmd/ksh93/tests/shtests:
- For $? > 256, obtain and report the signal name using 'kill -l'.

(cherry picked from commit a7d8ae628e228fc3cadcf977fbffc87b90c7bc53)
This commit is contained in:
Martijn Dekker 2020-06-04 19:44:59 +02:00
parent 21f281a5fa
commit 794d1c8601

View file

@ -339,19 +339,21 @@ do [[ $i == *.sh ]] || i+='.sh'
lang=LANG=$lang
fi
echo test $o begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"}
E=error
eval $lang \$valgrind \$SHELL \$trace \$i
e=$?
if [[ $valgrind ]]
then valxml $valxml
(( e += $? ))
fi
if (( e > 256 ))
then E="(killed by SIG$(kill -l "$e"))"
elif (( e == 1 ))
then E="1 error"
else E="$e errors"
fi
if (( e == 0 ))
then echo test $o passed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} "[ $t $T 0 ${E}s ]"
else if (( e != 1 ))
then E=${E}s
fi
echo test $o failed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ $t $T $e $E ]"
then echo test $o passed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} "[ $t $T $E ]"
else echo test $o failed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ $t $T $E ]"
fi
done
fi
@ -359,20 +361,20 @@ do [[ $i == *.sh ]] || i+='.sh'
then c=$tmp/shcomp-$u.ksh
o="$u(shcomp)"
echo test $o begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"}
E=error
if $SHCOMP $i > $c
then if $valgrind $SHELL $trace $c
then echo test $o passed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} "[ $t $T 0 ${E}s ]"
then echo test $o passed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} "[ $t $T 0 errors ]"
else e=$?
if (( e != 1 ))
then E=${E}s
if (( e > 256 ))
then E="(killed by SIG$(kill -l "$e"))"
elif (( e == 1 ))
then E="1 error"
else E="$e errors"
fi
echo test $o failed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ $t $T $e $E ]"
echo test $o failed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ $t $T $E ]"
fi
else e=$?
t=1
T=test
echo test $o failed to compile ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ $t $T 1 $E ]"
echo test $o failed to compile ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ 1 test 1 error ]"
fi
if [[ $i == $timesensitive ]]
then VMALLOC_OPTIONS=$vmalloc_options