ci: Make section emission really quiet
If you're emitting a section header under set -x, you will see: + section_start foo "foo" + x_off [the section header] This is kind of annoying. Instead of trying to squash it everywhere by dancing around local set +x management, play some extremely stupid tricks with shells to make sure we never emit it. Signed-off-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31602>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2086 # we want word splitting
|
||||
# shellcheck disable=SC1091 # paths only become valid at runtime
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
section_start cuttlefish_setup "cuttlefish: setup"
|
||||
set -xe
|
||||
|
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2086 # we want word splitting
|
||||
# shellcheck disable=SC1091 # paths only become valid at runtime
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
section_start test_setup "deqp: preparing test setup"
|
||||
|
||||
|
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2086 # we want word splitting
|
||||
# shellcheck disable=SC1091 # paths only become valid at runtime
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
set -ex
|
||||
|
||||
|
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2086 # we want word splitting
|
||||
# shellcheck disable=SC1091 # paths only become valid at runtime
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
section_start prepare_rootfs "Preparing root filesystem"
|
||||
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC1003 # works for us now...
|
||||
# shellcheck disable=SC2086 # we want word splitting
|
||||
# shellcheck disable=SC1091 # paths only become valid at runtime
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
section_switch meson-cross-file "meson: cross file generate"
|
||||
|
||||
|
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2086 # we want word splitting
|
||||
# shellcheck disable=SC1091 # paths only become valid at runtime
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
set -ex
|
||||
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2035 # FIXME glob
|
||||
# shellcheck disable=SC2086 # we want word splitting
|
||||
# shellcheck disable=SC1091 # paths only become valid at runtime
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
section_start traces_prepare "traces: preparing test setup"
|
||||
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2038 # TODO: rewrite the find
|
||||
# shellcheck disable=SC2086 # we want word splitting
|
||||
# shellcheck disable=SC1091 # paths only become valid at runtime
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
section_switch prepare-artifacts "artifacts: prepare"
|
||||
|
||||
|
@@ -1,6 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC1091 # paths only become valid at runtime
|
||||
|
||||
set -e
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
ARTIFACTSDIR=$(pwd)/shader-db
|
||||
mkdir -p "$ARTIFACTSDIR"
|
||||
export DRM_SHIM_DEBUG=true
|
||||
|
@@ -3,7 +3,9 @@
|
||||
# shellcheck disable=SC2086 # we want word splitting
|
||||
# shellcheck disable=SC2155 # mktemp usually not failing
|
||||
|
||||
function x_off {
|
||||
shopt -s expand_aliases
|
||||
|
||||
function _x_off {
|
||||
if [[ "$-" == *"x"* ]]; then
|
||||
state_x=1
|
||||
set +x
|
||||
@@ -12,6 +14,8 @@ function x_off {
|
||||
fi
|
||||
}
|
||||
|
||||
alias x_off='{ _x_off; } >/dev/null 2>/dev/null'
|
||||
|
||||
# TODO: implement x_on !
|
||||
|
||||
export JOB_START_S=$(date -u +"%s" -d "${CI_JOB_STARTED_AT:?}")
|
||||
@@ -27,7 +31,7 @@ function error {
|
||||
RED="\e[0;31m"
|
||||
ENDCOLOR="\e[0m"
|
||||
# we force the following to be not in a section
|
||||
section_end $CURRENT_SECTION
|
||||
_section_end $CURRENT_SECTION
|
||||
|
||||
CURR_MINSEC=$(get_current_minsec)
|
||||
echo -e "\n${RED}[${CURR_MINSEC}] ERROR: $*${ENDCOLOR}\n"
|
||||
@@ -38,7 +42,7 @@ function trap_err {
|
||||
error ${CURRENT_SECTION:-'unknown-section'}: ret code: $*
|
||||
}
|
||||
|
||||
function build_section_start {
|
||||
function _build_section_start {
|
||||
local section_params=$1
|
||||
shift
|
||||
local section_name=$1
|
||||
@@ -50,60 +54,62 @@ function build_section_start {
|
||||
CURR_MINSEC=$(get_current_minsec)
|
||||
echo -e "\n\e[0Ksection_start:$(date +%s):$section_name$section_params\r\e[0K${CYAN}[${CURR_MINSEC}] $*${ENDCOLOR}\n"
|
||||
}
|
||||
alias build_section_start="x_off; _build_section_start"
|
||||
|
||||
function section_start {
|
||||
x_off 2>/dev/null
|
||||
build_section_start "[collapsed=true]" $*
|
||||
function _section_start {
|
||||
_build_section_start "[collapsed=true]" $*
|
||||
[ "$state_x" -eq 0 ] || set -x
|
||||
}
|
||||
alias section_start="x_off; _section_start"
|
||||
|
||||
function uncollapsed_section_start {
|
||||
x_off 2>/dev/null
|
||||
build_section_start "" $*
|
||||
function _uncollapsed_section_start {
|
||||
_build_section_start "" $*
|
||||
[ "$state_x" -eq 0 ] || set -x
|
||||
}
|
||||
alias uncollapsed_section_start="x_off; _uncollapsed_section_start"
|
||||
|
||||
function build_section_end {
|
||||
function _build_section_end {
|
||||
echo -e "\e[0Ksection_end:$(date +%s):$1\r\e[0K"
|
||||
CURRENT_SECTION=""
|
||||
}
|
||||
alias build_section_end="x_off; _build_section_end"
|
||||
|
||||
function section_end {
|
||||
x_off >/dev/null
|
||||
build_section_end $*
|
||||
function _section_end {
|
||||
_build_section_end $*
|
||||
[ "$state_x" -eq 0 ] || set -x
|
||||
}
|
||||
alias section_end="x_off; _section_end"
|
||||
|
||||
function section_switch {
|
||||
x_off 2>/dev/null
|
||||
function _section_switch {
|
||||
if [ -n "$CURRENT_SECTION" ]
|
||||
then
|
||||
build_section_end $CURRENT_SECTION
|
||||
_build_section_end $CURRENT_SECTION
|
||||
fi
|
||||
build_section_start "[collapsed=true]" $*
|
||||
_build_section_start "[collapsed=true]" $*
|
||||
[ "$state_x" -eq 0 ] || set -x
|
||||
}
|
||||
alias section_switch="x_off; _section_switch"
|
||||
|
||||
function uncollapsed_section_switch {
|
||||
x_off 2>/dev/null
|
||||
function _uncollapsed_section_switch {
|
||||
if [ -n "$CURRENT_SECTION" ]
|
||||
then
|
||||
build_section_end $CURRENT_SECTION
|
||||
_build_section_end $CURRENT_SECTION
|
||||
fi
|
||||
build_section_start "" $*
|
||||
_build_section_start "" $*
|
||||
[ "$state_x" -eq 0 ] || set -x
|
||||
}
|
||||
alias uncollapsed_section_switch="x_off; _uncollapsed_section_switch"
|
||||
|
||||
export -f x_off
|
||||
export -f _x_off
|
||||
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
|
||||
export -f section_end
|
||||
export -f section_switch
|
||||
export -f uncollapsed_section_switch
|
||||
export -f _build_section_start
|
||||
export -f _section_start
|
||||
export -f _build_section_end
|
||||
export -f _section_end
|
||||
export -f _section_switch
|
||||
export -f _uncollapsed_section_switch
|
||||
|
||||
# Freedesktop requirement (needed for Wayland)
|
||||
[ -n "${XDG_RUNTIME_DIR:-}" ] || export XDG_RUNTIME_DIR="$(mktemp -p "$PWD" -d xdg-runtime-XXXXXX)"
|
||||
|
@@ -1,4 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC1091 # paths only become valid at runtime
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
set -e
|
||||
|
||||
|
Reference in New Issue
Block a user