integration tests: do not adjust log level in the test script

We passes log level through kernel command line. It is not necessary to
set to debug level at the beginning, and set to info at the end.
This is important when a test has several subtests. If a subtest sets
log level to info at the end, then subsequent tests may not generate any
useful logs.
This commit is contained in:
Yu Watanabe
2025-09-25 00:46:35 +09:00
parent ba8801a076
commit 5c60d3011f
40 changed files with 0 additions and 160 deletions

View File

@@ -3,8 +3,6 @@
set -eux
set -o pipefail
systemd-analyze log-level debug
cat >/run/systemd/system/floodme@.service <<EOF
[Service]
ExecStart=true

View File

@@ -4,8 +4,6 @@
set -eux
set -o pipefail
systemd-analyze log-level debug
test_quotas() {
local directory="$1"
@@ -90,6 +88,4 @@ EOF
test_quotas "/var/lib/private" "StateDirectory=quotadir" "StateDirectoryQuota=1%"
systemd-analyze log-level info
touch /testok

View File

@@ -20,8 +20,6 @@ at_exit() {
trap at_exit EXIT
systemctl service-log-level systemd-importd debug
# Mount tmpfs over /var/lib/confexts to not pollute the image
mkdir -p /var/lib/confexts
mount -t tmpfs tmpfs /var/lib/confexts -o mode=755

View File

@@ -20,8 +20,6 @@ at_exit() {
trap at_exit EXIT
systemctl service-log-level systemd-machined debug
systemctl service-log-level systemd-importd debug
# per request in https://github.com/systemd/systemd/pull/35117
systemctl edit --runtime --stdin 'systemd-nspawn@.service' --drop-in=debug.conf <<EOF
[Service]

View File

@@ -11,8 +11,6 @@ if [[ "$(get_cgroup_hierarchy)" != unified ]]; then
exit 0
fi
systemd-analyze log-level debug
# Multiple level process tree, parent process stays up
cat >/tmp/test19-exit-cgroup.sh <<EOF
#!/usr/bin/env bash
@@ -98,6 +96,3 @@ systemd-run --wait \
--property="Type=notify" \
--property="ExitType=cgroup" \
/tmp/test19-exit-cgroup-parentless.sh 'systemctl kill --signal 9 six'
systemd-analyze log-level info

View File

@@ -5,8 +5,6 @@ set -o pipefail
# Test ExecReload= (PR #13098)
systemd-analyze log-level debug
export SYSTEMD_PAGER=
SERVICE_PATH="$(mktemp /etc/systemd/system/execreloadXXX.service)"
SERVICE_NAME="${SERVICE_PATH##*/}"
@@ -57,5 +55,3 @@ systemctl status "$SERVICE_NAME"
systemctl reload "$SERVICE_NAME"
systemctl status "$SERVICE_NAME"
systemctl stop "$SERVICE_NAME"
systemd-analyze log-level info

View File

@@ -4,8 +4,6 @@ set -eux
# Test that ExecStopPost= is always run
systemd-analyze log-level debug
systemd-run --unit=simple1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple \
-p ExecStopPost='touch /run/simple1' true
test -f /run/simple1
@@ -101,5 +99,3 @@ test -f /run/idle1
(! systemd-run --unit=idle2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle \
-p ExecStopPost='touch /run/idle2' false)
test -f /run/idle2
systemd-analyze log-level info

View File

@@ -18,8 +18,6 @@ mkdir /tmp/test-extra-fd
echo "Hello" > /tmp/test-extra-fd/1.txt
echo "Extra" > /tmp/test-extra-fd/2.txt
systemd-analyze log-level debug
# Open files and assign FD to variables
exec {TEST_FD1}</tmp/test-extra-fd/1.txt
exec {TEST_FD2}</tmp/test-extra-fd/2.txt
@@ -61,5 +59,3 @@ assert_eq "$(systemctl show -P Result "$TEST_UNIT")" "success"
assert_eq "$(systemctl show -P ExecMainStatus "$TEST_UNIT")" "0"
systemctl stop "$TEST_UNIT"
systemctl log-level info

View File

@@ -6,9 +6,6 @@ set -o pipefail
# Test JoinsNamespaceOf= with PrivateTmp=yes
systemd-analyze log-level debug
systemd-analyze log-target journal
# simple case
systemctl start TEST-23-UNIT-FILE-joins-namespace-of-1.service
systemctl start TEST-23-UNIT-FILE-joins-namespace-of-2.service
@@ -27,5 +24,3 @@ systemctl start TEST-23-UNIT-FILE-joins-namespace-of-8.service
systemctl start TEST-23-UNIT-FILE-joins-namespace-of-9.service
systemctl stop TEST-23-UNIT-FILE-joins-namespace-of-6.service
systemctl stop TEST-23-UNIT-FILE-joins-namespace-of-8.service
systemd-analyze log-level info

View File

@@ -5,8 +5,6 @@ set -o pipefail
# Test StandardOutput=file:
systemd-analyze log-level debug
systemd-run --wait --unit=TEST-23-UNIT-FILE-standard-output-one \
-p StandardOutput=file:/tmp/stdout \
-p StandardError=file:/tmp/stderr \
@@ -56,5 +54,3 @@ EOF
cmp /tmp/stderr <<EOF
b
EOF
systemd-analyze log-level info

View File

@@ -6,9 +6,6 @@ set -o pipefail
# Test OnSuccess= + Uphold= + PropagatesStopTo= + BindsTo=
systemd-analyze log-level debug
systemd-analyze log-target journal
# Idea is this:
# 1. we start TEST-23-UNIT-FILE-success.service
# 2. which through OnSuccess= starts TEST-23-UNIT-FILE-fail.service,
@@ -102,5 +99,3 @@ for _ in {1..120}; do
fi
done
[[ "$sigrtmin1" == 1 ]]
systemd-analyze log-level info

View File

@@ -5,8 +5,6 @@ set -o pipefail
# Test ExecXYZEx= service unit dbus hookups
systemd-analyze log-level debug
declare -A property
property[1_one]=ExecCondition
@@ -31,5 +29,3 @@ for c in "${!property[@]}"; do
systemctl show -p "${property[$c]}" "$c" | grep -F "path=echo ; argv[]=echo \${$c} ; ignore_errors=no"
systemctl show -p "${property[$c]}Ex" "$c" | grep -F "path=echo ; argv[]=echo \${$c} ; flags=no-env-expand"
done
systemd-analyze log-level info

View File

@@ -11,8 +11,6 @@ set -o pipefail
# wait this many secs for each test service to succeed in what is being tested
MAX_SECS=60
systemctl log-level debug
# test one: Restart=on-failure should restart the service
(! systemd-run --unit=oneshot-restart-one -p Type=oneshot -p Restart=on-failure bash -c "exit 1")
@@ -97,5 +95,3 @@ EOF
systemctl disable "$UNIT_NAME"
rm "$TMP_FILE" /run/systemd/system/{"$UNIT_NAME","$ONSUCCESS_UNIT_NAME"} "$FIFO_FILE"
systemctl log-level info

View File

@@ -14,8 +14,6 @@ at_exit() {
trap at_exit EXIT
systemctl log-level debug
# Existing files
mkdir /tmp/test-open-file
@@ -51,5 +49,3 @@ systemctl stop TEST-23-UNIT-FILE-openfile-server.socket
assert_rc 202 systemd-run -p OpenFile=/run/missing/foo:missing-file:read-only --wait true
assert_rc 0 systemd-run -p OpenFile=/run/missing/foo:missing-file:read-only,graceful --wait true
systemctl log-level info

View File

@@ -5,8 +5,6 @@ set -o pipefail
# Test OnSuccess=/OnFailure= in combination
systemd-analyze log-level debug
# Start-up should fail, but the automatic restart should fix it
(! systemctl start success-failure-test )
@@ -45,5 +43,3 @@ done
test "$(systemctl is-active success-failure-test-failure)" = "inactive"
systemctl stop success-failure-test success-failure-test-success
systemd-analyze log-level info

View File

@@ -5,8 +5,6 @@ set -o pipefail
# Test Type=exec
systemd-analyze log-level debug
# Create a binary for which execve() will fail
touch /tmp/brokenbinary
chmod +x /tmp/brokenbinary
@@ -59,5 +57,3 @@ busctl call \
sleep 0 true \
sleep 2 sleep 1 true \
0)
systemd-analyze log-level info

View File

@@ -3,8 +3,6 @@
set -eux
set -o pipefail
systemd-analyze log-level debug
systemctl disable --now systemd-timesyncd.service
timedatectl set-timezone Europe/Berlin
@@ -61,6 +59,4 @@ while test ! -f /tmp/timezone-changed-alternate-path-2 ; do sleep .5 ; done
rm /run/systemd/system.conf /run/systemd/system/systemd-timedated.service.d/override.conf
systemctl daemon-reload
systemd-analyze log-level info
touch /testok

View File

@@ -10,8 +10,6 @@ set -o pipefail
# kernels where the concept was still new.
if test -f /sys/fs/cgroup/system.slice/TEST-32-OOMPOLICY.service/memory.oom.group; then
systemd-analyze log-level debug
# Run a service that is guaranteed to be the first candidate for OOM killing
systemd-run --unit=oomtest.service \
-p Type=exec -p OOMScoreAdjust=1000 -p OOMPolicy=stop -p MemoryAccounting=yes \
@@ -29,8 +27,6 @@ if test -f /sys/fs/cgroup/system.slice/TEST-32-OOMPOLICY.service/memory.oom.grou
RESULT="$(systemctl show -P Result oomtest.service)"
test "$RESULT" = "oom-kill"
systemd-analyze log-level info
fi
touch /testok

View File

@@ -3,8 +3,6 @@
set -eux
set -o pipefail
systemd-analyze log-level debug
test_directory() {
local directory="$1"
local path="$2"
@@ -239,6 +237,4 @@ if systemd-analyze compare-versions "$(uname -r)" ge 5.12; then
test_check_idmapped_mounts_root
fi
systemd-analyze log-level info
touch /testok

View File

@@ -21,9 +21,6 @@ at_exit() {
trap at_exit EXIT
systemd-analyze log-level debug
systemd-analyze log-target journal
# Log files
straceLog='strace.log'
journalLog='journal.log'
@@ -352,6 +349,4 @@ fi
rm -rf "$confDir"
systemctl daemon-reload
systemd-analyze log-level info
touch /testok

View File

@@ -12,8 +12,6 @@ if [[ -n "${COVERAGE_BUILD_DIR:-}" ]]; then
exit 77
fi
systemd-analyze log-level debug
unit=TEST-38-FREEZER-sleep.service
start_test_service() {

View File

@@ -13,13 +13,9 @@ fi
install_extension_images
systemd-analyze log-level debug
runas testuser systemd-run --wait --user --unit=test-private-users \
-p PrivateUsers=yes -P echo hello
runas testuser systemctl --user log-level debug
runas testuser systemd-run --wait --user --unit=test-private-tmp-innerfile \
-p PrivateTmp=yes \
-P touch /tmp/innerfile.txt
@@ -140,6 +136,4 @@ if unshare --mount --user --map-root-user mount -t overlay overlay /tmp/c -o low
grep PORTABLE_PREFIXES=app1 /usr/lib/extension-release.d/extension-release.app2
fi
systemd-analyze log-level info
touch /testok

View File

@@ -2,8 +2,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eux
systemd-analyze log-level debug
journalctl --list-namespaces -o json | jq .
systemd-run --wait -p LogNamespace=foobar echo "hello world"
@@ -25,6 +23,4 @@ journalctl --list-namespaces -o json | jq .
grep "^hello world$" /tmp/hello-world
(! grep "^hello world$" /tmp/no-hello-world)
systemd-analyze log-level info
touch /testok

View File

@@ -40,9 +40,6 @@ FSTYPE="$(stat --file-system --format "%T" /)"
systemctl start systemd-homed.service systemd-userdbd.socket
systemd-analyze log-level debug
systemctl service-log-level systemd-homed debug
# Create a tmpfs to use as backing store for the home dir. That way we can enforce a size limit nicely.
mkdir -p /home
mount -t tmpfs tmpfs /home -o size=290M
@@ -848,6 +845,4 @@ homectl inspect matchtest
homectl inspect matchtest | grep "Area: quux3"
homectl remove matchtest
systemd-analyze log-level info
touch /testok

View File

@@ -3,8 +3,6 @@
set -ex
set -o pipefail
systemd-analyze log-level debug
systemctl enable test-honor-first-shutdown.service
systemctl start test-honor-first-shutdown.service

View File

@@ -6,8 +6,6 @@ set -eux
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
systemd-analyze log-level debug
run_with_cred_compare() (
local cred="${1:?}"
local exp="${2?}"
@@ -529,6 +527,4 @@ run0 -u testuser --pipe mkdir -p /home/testuser/.config/credstore.encrypted
run0 -u testuser --pipe systemd-creds encrypt --user --name=brummbaer - /home/testuser/.config/credstore.encrypted/brummbaer < /tmp/brummbaer.data
run0 -u testuser --pipe systemd-run --user --pipe -p ImportCredential=brummbaer systemd-creds cat brummbaer | cmp /tmp/brummbaer.data
systemd-analyze log-level info
touch /testok

View File

@@ -8,8 +8,6 @@ set -o pipefail
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
systemd-analyze log-level debug
# Ensure that the init.scope.d drop-in is applied on boot
test "$(cat /sys/fs/cgroup/init.scope/memory.high)" != "max"
@@ -346,6 +344,4 @@ EOF
run_testcases
systemd-analyze log-level info
touch /testok

View File

@@ -3,11 +3,6 @@
set -eux
set -o pipefail
fail() {
systemd-analyze log-level info
exit 1
}
# Wait for a service to enter a state within a timeout period, if it doesn't
# enter the desired state within the timeout period then this function will
# exit the test case with a non zero exit code.
@@ -27,9 +22,6 @@ wait_on_state_or_fail() {
done
}
systemd-analyze log-level debug
cat >/run/systemd/system/testservice-fail-59.service <<EOF
[Unit]
Description=TEST-59-RELOADING-RESTART Normal exit
@@ -83,8 +75,6 @@ systemctl start testservice-abort-restart-59.service
systemctl --signal=SIGABRT kill testservice-abort-restart-59.service
wait_on_state_or_fail "testservice-abort-restart-59.service" "failed" "30"
systemd-analyze log-level info
# Test that rate-limiting daemon-reload works
mkdir -p /run/systemd/system.conf.d/
cat >/run/systemd/system.conf.d/50-test-59-reload.conf <<EOF
@@ -152,8 +142,6 @@ EOF
chmod +x /run/notify-reload-test.sh
systemd-analyze log-level debug
systemd-run --unit notify-reload-test -p Type=notify-reload -p KillMode=process /run/notify-reload-test.sh
systemctl reload notify-reload-test
systemctl stop notify-reload-test
@@ -163,8 +151,6 @@ test "$(systemctl show -p ExecMainStatus --value notify-reload-test)" = 109
systemctl reset-failed notify-reload-test
rm /run/notify-reload-test.sh
systemd-analyze log-level info
# Ensure that, with system log level info, we get debug level messages when a unit fails to start and is
# restarted with RestartMode=debug
cat >/run/systemd/system/testservice-fail-restart-debug-59.service <<EOF

View File

@@ -168,9 +168,6 @@ testcase_mount_ratelimit() {
timeout 2m bash -c 'while systemctl list-units -t mount tmp-meow* | grep -q tmp-meow; do systemctl daemon-reload; sleep 10; done'
}
systemd-analyze log-level debug
systemd-analyze log-target journal
mkdir -p /run/systemd/journald.conf.d
cat >/run/systemd/journald.conf.d/99-ratelimit.conf <<EOF
[Journal]

View File

@@ -4,8 +4,6 @@ set -ex
set -o pipefail
setup() {
systemd-analyze log-level debug
for i in {0..3};
do
ip netns del "ns${i}" || true
@@ -30,8 +28,6 @@ teardown() {
ip netns del "ns${i}"
ip link del "veth${i}"
done
systemd-analyze log-level info
}
if systemd-analyze compare-versions "$(uname -r)" lt 5.7; then

View File

@@ -6,8 +6,6 @@ set -o pipefail
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
systemctl log-level debug
# Test that a path unit continuously triggering a service that fails condition checks eventually fails with
# the trigger-limit-hit error.
rm -f /tmp/nonexistent
@@ -120,6 +118,4 @@ echo test2 > /tmp/copyme
exec {lock}<&-
timeout 30 bash -c 'until diff /tmp/copyme /tmp/copied >/dev/null; do sleep .2; done'
systemctl log-level info
touch /testok

View File

@@ -6,7 +6,6 @@ set -eux
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
systemctl log-level debug
export SYSTEMD_LOG_LEVEL=debug
# Sanity checks
@@ -1147,6 +1146,4 @@ MAIN_PID=$(systemctl show -p MainPID --value "$UNIT_NAME")
OUTPUT=$(systemd-analyze unit-shell "$UNIT_NAME" cat /tmp/testfile)
assert_in "Hello from test unit" "$OUTPUT"
systemd-analyze log-level info
touch /testok

View File

@@ -5,8 +5,6 @@ set -o pipefail
RESULTS_FILE=/tmp/TEST-66-DEVICE-ISOLATION.serviceresults
systemd-analyze log-level debug
systemctl start TEST-66-DEVICE-ISOLATION-device-isolation.service
sleep 5
@@ -19,6 +17,4 @@ systemctl stop TEST-66-DEVICE-ISOLATION-device-isolation.service
grep -q "thisshouldnotbehere" "$RESULTS_FILE" && exit 42
systemd-analyze log-level info
touch /testok

View File

@@ -14,7 +14,6 @@ wait_on_state_or_fail() {
state=$(systemctl show "$service" --property=ActiveState --value)
while [ "$state" != "$expected_state" ]; do
if [ "$timeout" = "0" ]; then
systemd-analyze log-level info
exit 1
fi
timeout=$((timeout - 1))
@@ -23,8 +22,6 @@ wait_on_state_or_fail() {
done
}
systemd-analyze log-level debug
cat >/run/systemd/system/testservice-failure-68.service <<EOF
[Unit]
OnFailure=testservice-failure-exit-handler-68.service
@@ -226,6 +223,4 @@ wait_on_state_or_fail "testservice-failure-exit-handler-68-template@testservice-
systemctl start testservice-success-and-failure-68.service
wait_on_state_or_fail "testservice-success-exit-handler-68.service" "inactive" "10"
systemd-analyze log-level info
touch /testok

View File

@@ -70,7 +70,6 @@ restart_resolved() {
# and can occasionally hit the default rate limit
systemctl reset-failed systemd-resolved.service
systemctl start systemd-resolved.service
systemctl service-log-level systemd-resolved.service debug
}
setup() {
@@ -1440,7 +1439,6 @@ EOF
# PRE-SETUP
systemctl unmask systemd-resolved.service
systemctl enable --now systemd-resolved.service
systemctl service-log-level systemd-resolved.service debug
# Need to be run before SETUP, otherwise things will break
manual_testcase_01_resolvectl

View File

@@ -9,8 +9,6 @@ if ! env --block-signal=SIGUSR1 true 2> /dev/null ; then
exit 0
fi
systemd-analyze log-level debug
UNIT="test-sigqueue-$RANDOM.service"
systemd-run -u "$UNIT" -p Type=notify -p DynamicUser=1 -- env --block-signal=SIGRTMIN+7 systemd-notify --exec --ready \; sleep infinity
@@ -30,6 +28,4 @@ test "$(grep SigQ: /proc/"$P"/status | cut -d: -f2 | cut -d/ -f1)" -eq 6
systemctl stop $UNIT
systemd-analyze log-level info
touch /testok

View File

@@ -13,8 +13,6 @@ if ! cat /proc/pressure/memory >/dev/null ; then
exit 0
fi
systemd-analyze log-level debug
CGROUP=/sys/fs/cgroup/"$(systemctl show TEST-79-MEMPRESS.service -P ControlGroup)"
test -d "$CGROUP"
@@ -63,6 +61,4 @@ systemd-run \
rm "$SCRIPT"
systemd-analyze log-level info
touch /testok

View File

@@ -98,8 +98,6 @@ systemd-analyze fdstore "$MYUNIT" --json=short | grep -P -q '\[{"fdname":"quux",
systemctl stop "$MYUNIT"
rm "$MYSCRIPT"
systemd-analyze log-level debug
# Test fdstore pinning (this will pull in fdstore-pin.service fdstore-nopin.service)
systemctl start fdstore-pin.target

View File

@@ -71,8 +71,6 @@ check_device_property() {
assert_eq "$count" "$expected_count"
}
systemd-analyze log-level debug
export SYSTEMD_LOG_LEVEL=debug
if [ -f /run/TEST-82-SOFTREBOOT.touch3 ]; then
@@ -325,7 +323,5 @@ EOF
exec sleep infinity
fi
systemd-analyze log-level info
touch /testok
systemctl --no-block exit 123

View File

@@ -3,8 +3,6 @@
set -eux
set -o pipefail
systemctl log-level info
(! systemd-detect-virt -cq)
DUMMY_DMESG_0="$(mktemp)"