Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/regression.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
# shellcheck shell=bash disable=SC2317

set -Eeuo pipefail
trap 'echo "Error at line $LINENO"' ERR

# shellcheck disable=SC2016
basic_err_string='echo "Error at line $LINENO"'
# shellcheck disable=SC2064
trap "$basic_err_string" ERR

nix --version
df -h .
Expand Down Expand Up @@ -188,6 +192,12 @@ _cleanup_testnet_on_interrupt() {
# cleanup on Ctrl+C or error
# shellcheck disable=SC2329
_interrupted() {
# Ignore further interrupts and errors during cleanup
trap '' SIGINT
# shellcheck disable=SC2064
trap "$basic_err_string" ERR
set +e

# Do testnet cleanup only on interrupted testrun. When not interrupted,
# cleanup is done as part of a testrun.
_cleanup_testnet_on_interrupt || :
Expand Down Expand Up @@ -238,7 +248,7 @@ MON_PID=$!

# ensure cleanup on ANY exit (success, error, Ctrl-C, set -e, etc.)
# shellcheck disable=SC2064
trap "echo 'Stopping monitor'; kill $MON_PID 2>/dev/null || true" EXIT
trap "echo 'Stopping monitor'; kill ${MON_PID:-} 2>/dev/null || true" EXIT

# Run tests and generate report

Expand Down Expand Up @@ -283,7 +293,13 @@ if [ "${KEEP_CLUSTERS_RUNNING:-""}" = 1 ]; then
read -r
fi

# redefine the ERR trap to avoid interfering with cleanup
# shellcheck disable=SC2064
trap "$basic_err_string" ERR
# ignore Ctrl+C during cleanup
trap '' SIGINT
_cleanup
trap - SIGINT

# prepare artifacts for upload in GitHub Actions
if [ -n "${GITHUB_ACTIONS:-""}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .github/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ EOF

run_pytest() {
if [ -n "${SESSION_TIMEOUT:-}" ]; then
local -a timeout_arr=( "--signal=INT" "--kill-after=0" "$SESSION_TIMEOUT" )
local -a timeout_arr=( "--foreground" "--signal=INT" "--kill-after=0" "$SESSION_TIMEOUT" )
echo "Running: PYTEST_ADDOPTS='${PYTEST_ADDOPTS:-}' timeout ${timeout_arr[*]} pytest $*"
timeout "${timeout_arr[@]}" pytest "$@"
else
Expand Down