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