1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#!/bin/sh
# Author: Santiago Ruano Rincón <santiago@debian.org>
# 2021-03-18
# License: GPLv3
# Test some of the tools included in cgroup-tools on cgroupv2 support
set -e
CGROUP2MOUNTED=$(grep cgroup2 /proc/mounts)
if [ "$CGROUP2MOUNTED" != 0 ]; then
if [ ! "$AUTOPKGTEST_REBOOT_MARK" = "cgroupv2-prepare" ]; then
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/ s/GRUB_CMDLINE_LINUX_DEFAULT="\(.*\)"/GRUB_CMDLINE_LINUX_DEFAULT="\1 systemd.unified_cgroup_hierarchy=true swapaccount=1"/' /etc/default/grub
update-grub 2>&1
/tmp/autopkgtest-reboot cgroupv2-prepare
fi
fi
cat /proc/mounts | grep cgroup
echo "test cgcreate"
cgcreate -g cpuset:test
echo "test lscgroup"
lscgroup | grep test
echo "test cgset"
cgset -r cpuset.cpus=0 test
echo "test cgget"
cgget -g cpuset:test
echo "test cgcreate"
cgexec -g cpuset:test ls -l
|