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