From 143c2845676fa5838ac4abf6b6fb9de80e12915e Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 11 Aug 2026 14:18:32 +0200 Subject: [PATCH] test: drop forgotten `set +e` This was introduced all the way back in 2019 where this particular test case was the last one in the file, so it worked as intended. Unfortunately, since then we added new tests after this one, which means this particular `set +e` masked fails in any of them (except for assert_*() calls, which call exit on fail). --- test/units/TEST-03-JOBS.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/units/TEST-03-JOBS.sh b/test/units/TEST-03-JOBS.sh index cecd35fa26..fec48da0f8 100755 --- a/test/units/TEST-03-JOBS.sh +++ b/test/units/TEST-03-JOBS.sh @@ -98,14 +98,11 @@ ELAPSED=$((END_SEC-START_SEC)) # Test time-limited scopes START_SEC=$(date -u '+%s') -set +e -systemd-run --scope --property=RuntimeMaxSec=3s sleep 30 -RESULT=$? +(! systemd-run --scope --property=RuntimeMaxSec=3s sleep 30) END_SEC=$(date -u '+%s') ELAPSED=$((END_SEC-START_SEC)) [[ "$ELAPSED" -ge 3 ]] [[ "$ELAPSED" -le 10 ]] -[[ "$RESULT" -ne 0 ]] # Test transactions with cycles # Provides coverage for issues like https://github.com/systemd/systemd/issues/26872 @@ -121,7 +118,9 @@ EOF done systemctl daemon-reload for i in {0..19}; do - systemctl start "transaction-cycle$i.service" + # This intentionally fails with: + # Failed to start transaction-cycle0.service: Transaction order is cyclic. See system logs for details. + systemctl start "transaction-cycle$i.service" || : done IDS_FILE="/tmp/TEST-03-JOBS-CYCLE-IDS-$RANDOM" @@ -168,6 +167,8 @@ assert_rc 3 systemctl --quiet is-active succeeds-on-restart.target systemctl start fails-on-restart.target || : assert_rc 3 systemctl --quiet is-active fails-on-restart.target +systemctl stop fails-on-restart.service + COUNTER_FILE=/tmp/test-03-restart-counter export FAILURE_FLAG_FILE=/tmp/test-03-restart-failure-flag