ci: move error handling functions at the end

So that everything is defined by the time we use it in here.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32054>
This commit is contained in:
Eric Engestrom
2024-11-08 10:45:39 +01:00
committed by Marge Bot
parent aee04bf4fb
commit 5cd054ebe5

View File

@@ -34,24 +34,6 @@ function get_current_minsec {
printf "%02d:%02d" $((CURR_TIME/60)) $((CURR_TIME%60))
}
function error {
x_off 2>/dev/null
RED="\e[0;31m"
ENDCOLOR="\e[0m"
# we force the following to be not in a section
if [ -n "${CURRENT_SECTION:-}" ]; then
_section_end $CURRENT_SECTION
fi
CURR_MINSEC=$(get_current_minsec)
echo -e "\n${RED}[${CURR_MINSEC}] ERROR: $*${ENDCOLOR}\n"
x_restore
}
function trap_err {
error ${CURRENT_SECTION:-'unknown-section'}: ret code: $*
}
function _build_section_start {
local section_params=$1
shift
@@ -116,8 +98,6 @@ export -f _x_store_state
export -f _x_off
export -f _x_restore
export -f get_current_minsec
export -f error
export -f trap_err
export -f _build_section_start
export -f _section_start
export -f _build_section_end
@@ -136,5 +116,26 @@ if [ -z "${RESULTS_DIR:-}" ]; then
mkdir -p "${RESULTS_DIR}"
fi
function error {
x_off 2>/dev/null
RED="\e[0;31m"
ENDCOLOR="\e[0m"
# we force the following to be not in a section
if [ -n "${CURRENT_SECTION:-}" ]; then
_section_end $CURRENT_SECTION
fi
CURR_MINSEC=$(get_current_minsec)
echo -e "\n${RED}[${CURR_MINSEC}] ERROR: $*${ENDCOLOR}\n"
x_restore
}
function trap_err {
error ${CURRENT_SECTION:-'unknown-section'}: ret code: $*
}
export -f error
export -f trap_err
set -E
trap 'trap_err $?' ERR