Pablo Greco 40546a
From 804df2c86f609fee35603273329f773e6eead7a8 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <804df2c86f609fee35603273329f773e6eead7a8@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Mon, 1 Jul 2019 17:07:59 +0200
Pablo Greco 40546a
Subject: [PATCH] vircgrouptest: add detect mounts test for hybrid cgroups
Pablo Greco 40546a
MIME-Version: 1.0
Pablo Greco 40546a
Content-Type: text/plain; charset=UTF-8
Pablo Greco 40546a
Content-Transfer-Encoding: 8bit
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
(cherry picked from commit 1981c79c4b068b918c3f34093ed2e634811b4147)
Pablo Greco 40546a
Pablo Greco 40546a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Message-Id: <8692433b683cef60139ee0b11052fd7f0de9ea41.1561993100.git.phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 tests/vircgroupdata/hybrid.cgroups     | 12 ++++++++++++
Pablo Greco 40546a
 tests/vircgroupdata/hybrid.mounts      | 23 +++++++++++++++++++++++
Pablo Greco 40546a
 tests/vircgroupdata/hybrid.parsed      | 11 +++++++++++
Pablo Greco 40546a
 tests/vircgroupdata/hybrid.self.cgroup |  9 +++++++++
Pablo Greco 40546a
 tests/vircgrouptest.c                  |  3 +++
Pablo Greco 40546a
 5 files changed, 58 insertions(+)
Pablo Greco 40546a
 create mode 100644 tests/vircgroupdata/hybrid.cgroups
Pablo Greco 40546a
 create mode 100644 tests/vircgroupdata/hybrid.mounts
Pablo Greco 40546a
 create mode 100644 tests/vircgroupdata/hybrid.parsed
Pablo Greco 40546a
 create mode 100644 tests/vircgroupdata/hybrid.self.cgroup
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/tests/vircgroupdata/hybrid.cgroups b/tests/vircgroupdata/hybrid.cgroups
Pablo Greco 40546a
new file mode 100644
Pablo Greco 40546a
index 0000000000..7f3bc7b8cb
Pablo Greco 40546a
--- /dev/null
Pablo Greco 40546a
+++ b/tests/vircgroupdata/hybrid.cgroups
Pablo Greco 40546a
@@ -0,0 +1,12 @@
Pablo Greco 40546a
+#subsys_name	hierarchy	num_cgroups	enabled
Pablo Greco 40546a
+cpuset      2       1       1
Pablo Greco 40546a
+cpu         0       1       1
Pablo Greco 40546a
+cpuacct     0       1       1
Pablo Greco 40546a
+blkio       0       1       1
Pablo Greco 40546a
+memory      0       1       1
Pablo Greco 40546a
+devices     3       1       1
Pablo Greco 40546a
+freezer     5       1       1
Pablo Greco 40546a
+net_cls     4       1       1
Pablo Greco 40546a
+perf_event  6       1       1
Pablo Greco 40546a
+hugetlb     7       1       1
Pablo Greco 40546a
+pids        8       1       1
Pablo Greco 40546a
diff --git a/tests/vircgroupdata/hybrid.mounts b/tests/vircgroupdata/hybrid.mounts
Pablo Greco 40546a
new file mode 100644
Pablo Greco 40546a
index 0000000000..d6f5f82115
Pablo Greco 40546a
--- /dev/null
Pablo Greco 40546a
+++ b/tests/vircgroupdata/hybrid.mounts
Pablo Greco 40546a
@@ -0,0 +1,23 @@
Pablo Greco 40546a
+proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+devtmpfs /dev devtmpfs rw,nosuid,size=10240k,nr_inodes=502705,mode=755 0 0
Pablo Greco 40546a
+devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
Pablo Greco 40546a
+tmpfs /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0
Pablo Greco 40546a
+tmpfs /run tmpfs rw,nosuid,nodev,noexec,mode=755 0 0
Pablo Greco 40546a
+mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
Pablo Greco 40546a
+pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+cgroup_root /not/really/sys/fs/cgroup tmpfs rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755 0 0
Pablo Greco 40546a
+openrc /not/really/sys/fs/cgroup/openrc cgroup rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc 0 0
Pablo Greco 40546a
+none /not/really/sys/fs/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0
Pablo Greco 40546a
+cpuset /not/really/sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
Pablo Greco 40546a
+devices /not/really/sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
Pablo Greco 40546a
+net_cls /not/really/sys/fs/cgroup/net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_cls 0 0
Pablo Greco 40546a
+freezer /not/really/sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
Pablo Greco 40546a
+perf_event /not/really/sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
Pablo Greco 40546a
+hugetlb /not/really/sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
Pablo Greco 40546a
+pids /not/really/sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
Pablo Greco 40546a
diff --git a/tests/vircgroupdata/hybrid.parsed b/tests/vircgroupdata/hybrid.parsed
Pablo Greco 40546a
new file mode 100644
Pablo Greco 40546a
index 0000000000..7600de5f45
Pablo Greco 40546a
--- /dev/null
Pablo Greco 40546a
+++ b/tests/vircgroupdata/hybrid.parsed
Pablo Greco 40546a
@@ -0,0 +1,11 @@
Pablo Greco 40546a
+cpu          <null>
Pablo Greco 40546a
+cpuacct      <null>
Pablo Greco 40546a
+cpuset       /not/really/sys/fs/cgroup/cpuset
Pablo Greco 40546a
+memory       <null>
Pablo Greco 40546a
+devices      /not/really/sys/fs/cgroup/devices
Pablo Greco 40546a
+freezer      /not/really/sys/fs/cgroup/freezer
Pablo Greco 40546a
+blkio        <null>
Pablo Greco 40546a
+net_cls      /not/really/sys/fs/cgroup/net_cls
Pablo Greco 40546a
+perf_event   /not/really/sys/fs/cgroup/perf_event
Pablo Greco 40546a
+name=systemd <null>
Pablo Greco 40546a
+unified      /not/really/sys/fs/cgroup/unified
Pablo Greco 40546a
diff --git a/tests/vircgroupdata/hybrid.self.cgroup b/tests/vircgroupdata/hybrid.self.cgroup
Pablo Greco 40546a
new file mode 100644
Pablo Greco 40546a
index 0000000000..2a08905c91
Pablo Greco 40546a
--- /dev/null
Pablo Greco 40546a
+++ b/tests/vircgroupdata/hybrid.self.cgroup
Pablo Greco 40546a
@@ -0,0 +1,9 @@
Pablo Greco 40546a
+8:pids:/
Pablo Greco 40546a
+7:hugetlb:/
Pablo Greco 40546a
+6:perf_event:/
Pablo Greco 40546a
+5:freezer:/
Pablo Greco 40546a
+4:net_cls:/
Pablo Greco 40546a
+3:devices:/
Pablo Greco 40546a
+2:cpuset:/
Pablo Greco 40546a
+1:name=openrc:/
Pablo Greco 40546a
+0::/
Pablo Greco 40546a
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
Pablo Greco 40546a
index 1ce1371ddc..aeb2840823 100644
Pablo Greco 40546a
--- a/tests/vircgrouptest.c
Pablo Greco 40546a
+++ b/tests/vircgrouptest.c
Pablo Greco 40546a
@@ -903,6 +903,9 @@ mymain(void)
Pablo Greco 40546a
     fakerootdir = initFakeFS("unified", NULL);
Pablo Greco 40546a
     DETECT_MOUNTS("unified");
Pablo Greco 40546a
     cleanupFakeFS(fakerootdir);
Pablo Greco 40546a
+    fakerootdir = initFakeFS("hybrid", NULL);
Pablo Greco 40546a
+    DETECT_MOUNTS("hybrid");
Pablo Greco 40546a
+    cleanupFakeFS(fakerootdir);
Pablo Greco 40546a
 
Pablo Greco 40546a
     fakerootdir = initFakeFS(NULL, "systemd");
Pablo Greco 40546a
     if (virTestRun("New cgroup for self", testCgroupNewForSelf, NULL) < 0)
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a