2 # SPDX-License-Identifier: LGPL-2.1-or-later
6 # shellcheck source=test/units/test-control.sh
7 .
"$(dirname "$0")"/test-control.sh
8 # shellcheck source=test/units/util.sh
9 .
"$(dirname "$0")"/util.sh
11 if [[ "$(get_cgroup_hierarchy)" != unified
]]; then
12 echo "Skipping $0 as we're not running with the unified cgroup hierarchy"
16 testcase_iodevice_dbus
() {
17 # Test that per-device properties are applied in configured order even for different devices (because
18 # they may resolve to same underlying device in the end
19 # Note: if device does not exist cgroup attribute write fails but systemd should still track the
20 # configured properties
21 systemd-run
--unit=test0.service \
22 --property="IOAccounting=yes" \
25 systemctl set-property test0.service \
26 IOReadBandwidthMax
="/dev/sda1 1M" \
27 IOReadBandwidthMax
="/dev/sda2 2M" \
28 IOReadBandwidthMax
="/dev/sda3 4M"
32 trap 'rm -f "$output"' RETURN
33 systemctl show
-P IOReadBandwidthMax test0.service
>"$output"
34 diff -u "$output" - <<EOF
40 systemctl stop test0.service
43 testcase_iodevice_unitfile
() {
44 cat >/run
/systemd
/system
/test1.service
<<EOF
46 ExecStart=/usr/bin/sleep inf
47 IOReadBandwidthMax=/dev/sda1 1M
48 IOReadBandwidthMax=/dev/sda2 2M
49 IOReadBandwidthMax=/dev/sda3 4M
51 systemctl daemon-reload
55 trap 'rm -f "$output"' RETURN
56 systemctl show
-P IOReadBandwidthMax test1.service
>"$output"
57 diff -u "$output" - <<EOF
62 rm -f /run
/systemd
/system
/test1.service