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:
Aleksa Sarai 2016-05-10 21:54:22 +10:00
parent 39aa5d0b1a
commit c823933fe1
3 changed files with 4 additions and 3 deletions

View File

@ -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 \

View File

@ -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() {

View File

@ -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
}