mirror of
https://github.com/systemd/systemd
synced 2024-07-23 03:04:57 +00:00
test: reduce number of 'systemctl daemon-reload' a bit
This commit is contained in:
parent
7faf8987ed
commit
5f03c19f7b
|
@ -4,7 +4,9 @@ set -eux
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
# shellcheck source=test/units/util.sh
|
# shellcheck source=test/units/util.sh
|
||||||
. "$(dirname "$0")"/util.sh
|
. "$(dirname "$0")"/util.sh
|
||||||
|
|
||||||
|
NEEDS_RELOAD=
|
||||||
|
|
||||||
add_logs_filtering_override() {
|
add_logs_filtering_override() {
|
||||||
local unit="${1:?}"
|
local unit="${1:?}"
|
||||||
|
@ -13,13 +15,18 @@ add_logs_filtering_override() {
|
||||||
|
|
||||||
mkdir -p "/run/systemd/system/$unit.d/"
|
mkdir -p "/run/systemd/system/$unit.d/"
|
||||||
echo -ne "[Service]\nLogFilterPatterns=$log_filter" >"/run/systemd/system/$unit.d/$override_name.conf"
|
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() {
|
run_service_and_fetch_logs() {
|
||||||
local unit="${1:?}"
|
local unit="${1:?}"
|
||||||
local start
|
local start
|
||||||
|
|
||||||
|
if [[ -n "$NEEDS_RELOAD" ]]; then
|
||||||
|
systemctl daemon-reload
|
||||||
|
NEEDS_RELOAD=
|
||||||
|
fi
|
||||||
|
|
||||||
journalctl --sync
|
journalctl --sync
|
||||||
start="$(date '+%Y-%m-%d %T.%6N')"
|
start="$(date '+%Y-%m-%d %T.%6N')"
|
||||||
systemctl start "$unit"
|
systemctl start "$unit"
|
||||||
|
|
Loading…
Reference in a new issue