From: Yu Watanabe Date: Sat, 1 Jun 2024 13:25:06 +0000 (+0900) Subject: test: reduce number of 'systemctl daemon-reload' a bit X-Git-Tag: v256-rc4~49^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f03c19f7bf10d989274b6e3fec1ef088a9514cf;p=thirdparty%2Fsystemd.git test: reduce number of 'systemctl daemon-reload' a bit --- diff --git a/test/units/TEST-04-JOURNAL.LogFilterPatterns.sh b/test/units/TEST-04-JOURNAL.LogFilterPatterns.sh index 04062bd76f7..37fdd5f82bd 100755 --- a/test/units/TEST-04-JOURNAL.LogFilterPatterns.sh +++ b/test/units/TEST-04-JOURNAL.LogFilterPatterns.sh @@ -4,7 +4,9 @@ set -eux set -o pipefail # shellcheck source=test/units/util.sh - . "$(dirname "$0")"/util.sh +. "$(dirname "$0")"/util.sh + +NEEDS_RELOAD= add_logs_filtering_override() { local unit="${1:?}" @@ -13,13 +15,18 @@ add_logs_filtering_override() { mkdir -p "/run/systemd/system/$unit.d/" echo -ne "[Service]\nLogFilterPatterns=$log_filter" >"/run/systemd/system/$unit.d/$override_name.conf" - systemctl daemon-reload + NEEDS_RELOAD=1 } run_service_and_fetch_logs() { local unit="${1:?}" local start + if [[ -n "$NEEDS_RELOAD" ]]; then + systemctl daemon-reload + NEEDS_RELOAD= + fi + journalctl --sync start="$(date '+%Y-%m-%d %T.%6N')" systemctl start "$unit"