render / rpms / libvirt

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