mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-02 15:40:58 +00:00
Fix double reporting when the last command of a function fails
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
f6d29c6a9e
commit
4848d7bb45
|
@ -475,6 +475,11 @@ pre_setup_keep_going () {
|
|||
failure_count=0 # Number of failed components
|
||||
last_failure_status=0 # Last failure status in this component
|
||||
|
||||
# See err_trap
|
||||
previous_failure_status=0
|
||||
previous_failed_command=
|
||||
previous_failure_funcall_depth=0
|
||||
|
||||
start_red=
|
||||
end_color=
|
||||
if [ -t 1 ]; then
|
||||
|
@ -512,6 +517,21 @@ pre_setup_keep_going () {
|
|||
last_failure_status=$?
|
||||
failed_command=$BASH_COMMAND
|
||||
|
||||
if [[ $last_failure_status -eq $previous_failure_status &&
|
||||
"$failed_command" == "$previous_failed_command" &&
|
||||
${#FUNCNAME[@]} == $((previous_failure_funcall_depth - 1)) ]]
|
||||
then
|
||||
# The same command failed twice in a row, but this time one level
|
||||
# less deep in the function call stack. This happens when the last
|
||||
# command of a function returns a nonzero status, and the function
|
||||
# returns that same status. Ignore the second failure.
|
||||
previous_failure_funcall_depth=${#FUNCNAME[@]}
|
||||
return
|
||||
fi
|
||||
previous_failure_status=$last_failure_status
|
||||
previous_failed_command=$failed_command
|
||||
previous_failure_funcall_depth=${#FUNCNAME[@]}
|
||||
|
||||
text="$current_section: $failed_command -> $last_failure_status"
|
||||
echo "${start_red}^^^^$text^^^^${end_color}" >&2
|
||||
echo "$text" >>"$failure_summary_file"
|
||||
|
|
Loading…
Reference in a new issue