2019-02-12 10:22:03 -05:00
|
|
|
# cgroup2 specific common functions
|
|
|
|
|
|
|
|
|
|
export CGROUP2_PATH="${CGROUP2_PATH:-/sys/fs/cgroup}"
|
|
|
|
|
|
|
|
|
|
_require_cgroup2()
|
|
|
|
|
{
|
2019-07-15 10:25:21 +02:00
|
|
|
if [ `findmnt -d backward -n -o FSTYPE -f ${CGROUP2_PATH}` != "cgroup2" ]; then
|
|
|
|
|
_notrun "cgroup2 not mounted on ${CGROUP2_PATH}"
|
|
|
|
|
fi
|
|
|
|
|
|
2019-02-12 10:22:03 -05:00
|
|
|
if [ ! -f "${CGROUP2_PATH}/cgroup.subtree_control" ]; then
|
|
|
|
|
_notrun "Test requires cgroup2 enabled"
|
|
|
|
|
fi
|
2019-07-15 10:25:21 +02:00
|
|
|
|
2019-02-12 10:22:03 -05:00
|
|
|
if [[ ! $(cat ${CGROUP2_PATH}/cgroup.controllers) =~ $1 ]]; then
|
|
|
|
|
_notrun "Cgroup2 doesn't support $1 controller $1"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/bin/true
|