aboutsummaryrefslogtreecommitdiffstats
path: root/common/cgroup2
blob: 8833c9c83f949a47abb4239254236821b1b9d586 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# cgroup2 specific common functions

export CGROUP2_PATH="${CGROUP2_PATH:-/sys/fs/cgroup}"

_require_cgroup2()
{
	if [ `findmnt -d backward -n -o FSTYPE -f ${CGROUP2_PATH}` != "cgroup2" ]; then
		_notrun "cgroup2 not mounted on ${CGROUP2_PATH}"
	fi

	if [ ! -f "${CGROUP2_PATH}/cgroup.subtree_control" ]; then
		_notrun "Test requires cgroup2 enabled"
	fi

	if [[ ! $(cat ${CGROUP2_PATH}/cgroup.controllers) =~ $1 ]]; then
		_notrun "Cgroup2 doesn't support $1 controller $1"
	fi
}

/bin/true