set -eux
set -o pipefail
-systemd-analyze log-level debug
-
cat >/run/systemd/system/floodme@.service <<EOF
[Service]
ExecStart=true
set -eux
set -o pipefail
-systemd-analyze log-level debug
-
test_quotas() {
local directory="$1"
test_quotas "/var/lib/private" "StateDirectory=quotadir" "StateDirectoryQuota=1%"
-systemd-analyze log-level info
-
touch /testok
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
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]
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
--property="Type=notify" \
--property="ExitType=cgroup" \
/tmp/test19-exit-cgroup-parentless.sh 'systemctl kill --signal 9 six'
-
-
-systemd-analyze log-level info
# Test ExecReload= (PR #13098)
-systemd-analyze log-level debug
-
export SYSTEMD_PAGER=
SERVICE_PATH="$(mktemp /etc/systemd/system/execreloadXXX.service)"
SERVICE_NAME="${SERVICE_PATH##*/}"
systemctl reload "$SERVICE_NAME"
systemctl status "$SERVICE_NAME"
systemctl stop "$SERVICE_NAME"
-
-systemd-analyze log-level info
# 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
(! 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
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
assert_eq "$(systemctl show -P ExecMainStatus "$TEST_UNIT")" "0"
systemctl stop "$TEST_UNIT"
-
-systemctl log-level info
# 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
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
# 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 \
cmp /tmp/stderr <<EOF
b
EOF
-
-systemd-analyze log-level info
# 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,
fi
done
[[ "$sigrtmin1" == 1 ]]
-
-systemd-analyze log-level info
# Test ExecXYZEx= service unit dbus hookups
-systemd-analyze log-level debug
-
declare -A property
property[1_one]=ExecCondition
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
# 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")
systemctl disable "$UNIT_NAME"
rm "$TMP_FILE" /run/systemd/system/{"$UNIT_NAME","$ONSUCCESS_UNIT_NAME"} "$FIFO_FILE"
-
-systemctl log-level info
trap at_exit EXIT
-systemctl log-level debug
-
# Existing files
mkdir /tmp/test-open-file
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
# 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 )
test "$(systemctl is-active success-failure-test-failure)" = "inactive"
systemctl stop success-failure-test success-failure-test-success
-
-systemd-analyze log-level info
# Test Type=exec
-systemd-analyze log-level debug
-
# Create a binary for which execve() will fail
touch /tmp/brokenbinary
chmod +x /tmp/brokenbinary
sleep 0 true \
sleep 2 sleep 1 true \
0)
-
-systemd-analyze log-level info
set -eux
set -o pipefail
-systemd-analyze log-level debug
-
systemctl disable --now systemd-timesyncd.service
timedatectl set-timezone Europe/Berlin
rm /run/systemd/system.conf /run/systemd/system/systemd-timedated.service.d/override.conf
systemctl daemon-reload
-systemd-analyze log-level info
-
touch /testok
# 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 \
RESULT="$(systemctl show -P Result oomtest.service)"
test "$RESULT" = "oom-kill"
-
- systemd-analyze log-level info
fi
touch /testok
set -eux
set -o pipefail
-systemd-analyze log-level debug
-
test_directory() {
local directory="$1"
local path="$2"
test_check_idmapped_mounts_root
fi
-systemd-analyze log-level info
-
touch /testok
trap at_exit EXIT
-systemd-analyze log-level debug
-systemd-analyze log-target journal
-
# Log files
straceLog='strace.log'
journalLog='journal.log'
rm -rf "$confDir"
systemctl daemon-reload
-systemd-analyze log-level info
-
touch /testok
exit 77
fi
-systemd-analyze log-level debug
-
unit=TEST-38-FREEZER-sleep.service
start_test_service() {
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
grep PORTABLE_PREFIXES=app1 /usr/lib/extension-release.d/extension-release.app2
fi
-systemd-analyze log-level info
-
touch /testok
# 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"
grep "^hello world$" /tmp/hello-world
(! grep "^hello world$" /tmp/no-hello-world)
-systemd-analyze log-level info
-
touch /testok
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
homectl inspect matchtest | grep "Area: quux3"
homectl remove matchtest
-systemd-analyze log-level info
-
touch /testok
set -ex
set -o pipefail
-systemd-analyze log-level debug
-
systemctl enable test-honor-first-shutdown.service
systemctl start test-honor-first-shutdown.service
# 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?}"
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
# 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"
run_testcases
-systemd-analyze log-level info
-
touch /testok
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.
done
}
-systemd-analyze log-level debug
-
-
cat >/run/systemd/system/testservice-fail-59.service <<EOF
[Unit]
Description=TEST-59-RELOADING-RESTART Normal exit
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
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
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
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]
set -o pipefail
setup() {
- systemd-analyze log-level debug
-
for i in {0..3};
do
ip netns del "ns${i}" || true
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
# 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
exec {lock}<&-
timeout 30 bash -c 'until diff /tmp/copyme /tmp/copied >/dev/null; do sleep .2; done'
-systemctl log-level info
-
touch /testok
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
-systemctl log-level debug
export SYSTEMD_LOG_LEVEL=debug
# Sanity checks
OUTPUT=$(systemd-analyze unit-shell "$UNIT_NAME" cat /tmp/testfile)
assert_in "Hello from test unit" "$OUTPUT"
-systemd-analyze log-level info
-
touch /testok
RESULTS_FILE=/tmp/TEST-66-DEVICE-ISOLATION.serviceresults
-systemd-analyze log-level debug
-
systemctl start TEST-66-DEVICE-ISOLATION-device-isolation.service
sleep 5
grep -q "thisshouldnotbehere" "$RESULTS_FILE" && exit 42
-systemd-analyze log-level info
-
touch /testok
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))
done
}
-systemd-analyze log-level debug
-
cat >/run/systemd/system/testservice-failure-68.service <<EOF
[Unit]
OnFailure=testservice-failure-exit-handler-68.service
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
# 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() {
# 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
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
systemctl stop $UNIT
-systemd-analyze log-level info
-
touch /testok
exit 0
fi
-systemd-analyze log-level debug
-
CGROUP=/sys/fs/cgroup/"$(systemctl show TEST-79-MEMPRESS.service -P ControlGroup)"
test -d "$CGROUP"
rm "$SCRIPT"
-systemd-analyze log-level info
-
touch /testok
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
assert_eq "$count" "$expected_count"
}
-systemd-analyze log-level debug
-
export SYSTEMD_LOG_LEVEL=debug
if [ -f /run/TEST-82-SOFTREBOOT.touch3 ]; then
exec sleep infinity
fi
-systemd-analyze log-level info
-
touch /testok
systemctl --no-block exit 123
set -eux
set -o pipefail
-systemctl log-level info
-
(! systemd-detect-virt -cq)
DUMMY_DMESG_0="$(mktemp)"