mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
integration: fix cgroup parsing
On some systems, the cgroup hierarchies are grouped together (cpu,cpuacct). In order to avoid fake failures, update the cgroup parsing to just check whether or not the mountinfo options *contain* the cgroup type. Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
@@ -6,6 +6,7 @@ RUN echo 'deb http://httpredir.debian.org/debian jessie-backports main' > /etc/a
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
curl \
|
||||
gawk \
|
||||
iptables \
|
||||
libaio-dev \
|
||||
libcap-dev \
|
||||
|
||||
@@ -9,8 +9,8 @@ CGROUP_MEMORY=""
|
||||
TEST_CGROUP_NAME="runc-cgroups-integration-test"
|
||||
|
||||
function init_cgroup_path() {
|
||||
base_path=$(grep "rw," /proc/self/mountinfo | grep -i -m 1 'MEMORY$' | cut -d ' ' -f 5)
|
||||
CGROUP_MEMORY="${base_path}/${TEST_CGROUP_NAME}"
|
||||
base_path=$(grep "cgroup" /proc/self/mountinfo | gawk 'toupper($NF) ~ /\<MEMORY\>/ { print $5; exit }')
|
||||
CGROUP_MEMORY="${base_path}/${TEST_CGROUP_NAME}"
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
|
||||
@@ -11,7 +11,7 @@ CGROUP_BLKIO=""
|
||||
|
||||
function init_cgroup_path() {
|
||||
for g in MEMORY CPUSET CPU BLKIO; do
|
||||
base_path=$(grep "rw," /proc/self/mountinfo | grep -i -m 1 "$g\$" | cut -d ' ' -f 5)
|
||||
base_path=$(grep "cgroup" /proc/self/mountinfo | gawk 'toupper($NF) ~ /\<'${g}'\>/ { print $5; exit }')
|
||||
eval CGROUP_${g}="${base_path}/runc-update-integration-test"
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user