]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: skip DELEGATE test if the kernel can't do cgroupv2 (#7445)
authorLennart Poettering <lennart@poettering.net>
Fri, 24 Nov 2017 14:29:06 +0000 (15:29 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 24 Nov 2017 14:29:06 +0000 (15:29 +0100)
Fixes: #7440
test/TEST-19-DELEGATE/testsuite.sh

index 3fbf34717735dc5d2c50889a8f4fe853862a945e..c738bea10e5884a24901aa3089855f807db8baa9 100755 (executable)
@@ -4,16 +4,20 @@
 set -ex
 set -o pipefail
 
-systemd-run --wait --unit=test0.service -p "DynamicUser=1" -p "Delegate=" \
-            test -w /sys/fs/cgroup/system.slice/test0.service/ -a \
-                 -w /sys/fs/cgroup/system.slice/test0.service/cgroup.procs -a \
-                 -w /sys/fs/cgroup/system.slice/test0.service/cgroup.subtree_control
+if grep -q cgroup2 /proc/filesystems ; then
+        systemd-run --wait --unit=test0.service -p "DynamicUser=1" -p "Delegate=" \
+                    test -w /sys/fs/cgroup/system.slice/test0.service/ -a \
+                    -w /sys/fs/cgroup/system.slice/test0.service/cgroup.procs -a \
+                    -w /sys/fs/cgroup/system.slice/test0.service/cgroup.subtree_control
 
-systemd-run --wait --unit=test1.service -p "DynamicUser=1" -p "Delegate=memory pids" \
-            grep memory /sys/fs/cgroup/system.slice/test1.service/cgroup.controllers
+        systemd-run --wait --unit=test1.service -p "DynamicUser=1" -p "Delegate=memory pids" \
+                    grep memory /sys/fs/cgroup/system.slice/test1.service/cgroup.controllers
 
-systemd-run --wait --unit=test2.service -p "DynamicUser=1" -p "Delegate=memory pids" \
-            grep pids /sys/fs/cgroup/system.slice/test2.service/cgroup.controllers
+        systemd-run --wait --unit=test2.service -p "DynamicUser=1" -p "Delegate=memory pids" \
+                    grep pids /sys/fs/cgroup/system.slice/test2.service/cgroup.controllers
+else
+        echo "Skipping TEST-19-DELEGATE, as the kernel doesn't actually support cgroupsv2" >&2
+fi
 
 echo OK > /testok