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:
parent
39aa5d0b1a
commit
c823933fe1
|
@ -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 \
|
RUN apt-get update && apt-get install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
curl \
|
curl \
|
||||||
|
gawk \
|
||||||
iptables \
|
iptables \
|
||||||
libaio-dev \
|
libaio-dev \
|
||||||
libcap-dev \
|
libcap-dev \
|
||||||
|
|
|
@ -9,8 +9,8 @@ CGROUP_MEMORY=""
|
||||||
TEST_CGROUP_NAME="runc-cgroups-integration-test"
|
TEST_CGROUP_NAME="runc-cgroups-integration-test"
|
||||||
|
|
||||||
function init_cgroup_path() {
|
function init_cgroup_path() {
|
||||||
base_path=$(grep "rw," /proc/self/mountinfo | grep -i -m 1 'MEMORY$' | cut -d ' ' -f 5)
|
base_path=$(grep "cgroup" /proc/self/mountinfo | gawk 'toupper($NF) ~ /\<MEMORY\>/ { print $5; exit }')
|
||||||
CGROUP_MEMORY="${base_path}/${TEST_CGROUP_NAME}"
|
CGROUP_MEMORY="${base_path}/${TEST_CGROUP_NAME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function teardown() {
|
function teardown() {
|
||||||
|
|
|
@ -11,7 +11,7 @@ CGROUP_BLKIO=""
|
||||||
|
|
||||||
function init_cgroup_path() {
|
function init_cgroup_path() {
|
||||||
for g in MEMORY CPUSET CPU BLKIO; do
|
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"
|
eval CGROUP_${g}="${base_path}/runc-update-integration-test"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue