From 085f465c001bd2b58109b8154943a64f34c54e0c Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Mon, 31 Aug 2015 11:23:18 +0800 Subject: [PATCH] Fix cgroup mount tests I got: ``` exec_test.go:823: Mode expected to contain 'ro,nosuid,nodev,noexec': tmpfs on /sys/fs/cgroup type tmpfs (ro,seclabel,nosuid,nodev,noexec,relatime,mode=755 ```wq Signed-off-by: Qiang Huang --- libcontainer/integration/exec_test.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/libcontainer/integration/exec_test.go b/libcontainer/integration/exec_test.go index e61c32b2..f979fa6e 100644 --- a/libcontainer/integration/exec_test.go +++ b/libcontainer/integration/exec_test.go @@ -819,7 +819,10 @@ func TestMountCgroupRO(t *testing.T) { lines := strings.Split(mountInfo, "\n") for _, l := range lines { if strings.HasPrefix(l, "tmpfs on /sys/fs/cgroup") { - if !strings.Contains(l, "ro,nosuid,nodev,noexec") { + if !strings.Contains(l, "ro") || + !strings.Contains(l, "nosuid") || + !strings.Contains(l, "nodev") || + !strings.Contains(l, "noexec") { t.Fatalf("Mode expected to contain 'ro,nosuid,nodev,noexec': %s", l) } if !strings.Contains(l, "mode=755") { @@ -830,7 +833,10 @@ func TestMountCgroupRO(t *testing.T) { if !strings.HasPrefix(l, "cgroup") { continue } - if !strings.Contains(l, "ro,nosuid,nodev,noexec") { + if !strings.Contains(l, "ro") || + !strings.Contains(l, "nosuid") || + !strings.Contains(l, "nodev") || + !strings.Contains(l, "noexec") { t.Fatalf("Mode expected to contain 'ro,nosuid,nodev,noexec': %s", l) } } @@ -862,7 +868,10 @@ func TestMountCgroupRW(t *testing.T) { lines := strings.Split(mountInfo, "\n") for _, l := range lines { if strings.HasPrefix(l, "tmpfs on /sys/fs/cgroup") { - if !strings.Contains(l, "rw,nosuid,nodev,noexec") { + if !strings.Contains(l, "rw") || + !strings.Contains(l, "nosuid") || + !strings.Contains(l, "nodev") || + !strings.Contains(l, "noexec") { t.Fatalf("Mode expected to contain 'rw,nosuid,nodev,noexec': %s", l) } if !strings.Contains(l, "mode=755") { @@ -873,7 +882,10 @@ func TestMountCgroupRW(t *testing.T) { if !strings.HasPrefix(l, "cgroup") { continue } - if !strings.Contains(l, "rw,nosuid,nodev,noexec") { + if !strings.Contains(l, "rw") || + !strings.Contains(l, "nosuid") || + !strings.Contains(l, "nodev") || + !strings.Contains(l, "noexec") { t.Fatalf("Mode expected to contain 'rw,nosuid,nodev,noexec': %s", l) } }