#!/bin/sh # Author: Santiago Ruano Rincón # 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