From 0923d36c600cfae163610414260658a60d648b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Sun, 14 Apr 2024 21:29:31 +0200 Subject: [PATCH] Systest timeout --- ci/tests/run-system-tests.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ci/tests/run-system-tests.sh b/ci/tests/run-system-tests.sh index f4921217b2..496fad7f3e 100755 --- a/ci/tests/run-system-tests.sh +++ b/ci/tests/run-system-tests.sh @@ -8,6 +8,9 @@ source "$(dirname "$BASH_SOURCE")/common.sh" NANO_REPO_DIR=${1:-../} NANO_SYSTEST_DIR=${NANO_REPO_DIR}/systest +# Allow TEST_TIMEOUT to be set from an environment variable +TEST_TIMEOUT=${TEST_TIMEOUT:-300s} + echo "Running systests from: ${NANO_SYSTEST_DIR}" # This assumes that the executables are in the current working directory @@ -22,7 +25,8 @@ for script in ${NANO_SYSTEST_DIR}/*.sh; do echo "::group::Running: $name" # Redirecting output to a file to prevent it from being mixed with the output of the action - ./$script > "${name}.log" 2>&1 + # Using timeout command to enforce time limits + timeout $TEST_TIMEOUT ./$script > "${name}.log" 2>&1 status=$? cat "${name}.log" @@ -30,8 +34,11 @@ for script in ${NANO_SYSTEST_DIR}/*.sh; do if [ $status -eq 0 ]; then echo "Passed: $name" + elif [ $status -eq 124 ]; then + echo "::error::Systest timed out: $name" + overall_status=1 else - echo "::error Systest failed: $name ($?)" + echo "::error::Systest failed: $name ($status)" overall_status=1 fi done