render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Pablo Greco 40546a
From ab8447f6e6a5ab8e3d278be61bc9ccc93c435d3b Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <ab8447f6e6a5ab8e3d278be61bc9ccc93c435d3b@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Mon, 1 Jul 2019 17:07:58 +0200
Pablo Greco 40546a
Subject: [PATCH] vircgrouptest: add detect mounts test for cgroup v2
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 8f43c7a698b7a360d508eccc82ffc08e930cc3f8)
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: <10b25253a0f4705093b96cfe56a0c64bb2114785.1561993100.git.phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 tests/vircgroupdata/unified.cgroups     | 13 +++++++++++++
Pablo Greco 40546a
 tests/vircgroupdata/unified.mounts      | 20 ++++++++++++++++++++
Pablo Greco 40546a
 tests/vircgroupdata/unified.parsed      | 11 +++++++++++
Pablo Greco 40546a
 tests/vircgroupdata/unified.self.cgroup |  1 +
Pablo Greco 40546a
 tests/vircgrouptest.c                   |  3 +++
Pablo Greco 40546a
 5 files changed, 48 insertions(+)
Pablo Greco 40546a
 create mode 100644 tests/vircgroupdata/unified.cgroups
Pablo Greco 40546a
 create mode 100644 tests/vircgroupdata/unified.mounts
Pablo Greco 40546a
 create mode 100644 tests/vircgroupdata/unified.parsed
Pablo Greco 40546a
 create mode 100644 tests/vircgroupdata/unified.self.cgroup
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/tests/vircgroupdata/unified.cgroups b/tests/vircgroupdata/unified.cgroups
Pablo Greco 40546a
new file mode 100644
Pablo Greco 40546a
index 0000000000..e0d8a3561c
Pablo Greco 40546a
--- /dev/null
Pablo Greco 40546a
+++ b/tests/vircgroupdata/unified.cgroups
Pablo Greco 40546a
@@ -0,0 +1,13 @@
Pablo Greco 40546a
+#subsys_name	hierarchy	num_cgroups	enabled
Pablo Greco 40546a
+cpuset      0       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     0       1       1
Pablo Greco 40546a
+freezer     0       1       1
Pablo Greco 40546a
+net_cls     0       1       1
Pablo Greco 40546a
+perf_event  0       1       1
Pablo Greco 40546a
+net_prio    0       1       1
Pablo Greco 40546a
+hugetlb     0       1       1
Pablo Greco 40546a
+pids        0       1       1
Pablo Greco 40546a
diff --git a/tests/vircgroupdata/unified.mounts b/tests/vircgroupdata/unified.mounts
Pablo Greco 40546a
new file mode 100644
Pablo Greco 40546a
index 0000000000..b4ab94a2c3
Pablo Greco 40546a
--- /dev/null
Pablo Greco 40546a
+++ b/tests/vircgroupdata/unified.mounts
Pablo Greco 40546a
@@ -0,0 +1,20 @@
Pablo Greco 40546a
+sysfs /sys sysfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+devtmpfs /dev devtmpfs rw,seclabel,nosuid,size=1009844k,nr_inodes=252461,mode=755 0 0
Pablo Greco 40546a
+securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev 0 0
Pablo Greco 40546a
+devpts /dev/pts devpts rw,seclabel,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
Pablo Greco 40546a
+tmpfs /run tmpfs rw,seclabel,nosuid,nodev,mode=755 0 0
Pablo Greco 40546a
+cgroup2 /not/really/sys/fs/cgroup cgroup2 rw,seclabel,nosuid,nodev,noexec,relatime,nsdelegate 0 0
Pablo Greco 40546a
+pstore /sys/fs/pstore pstore rw,seclabel,nosuid,nodev,noexec,relatime 0 0
Pablo Greco 40546a
+bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
Pablo Greco 40546a
+configfs /sys/kernel/config configfs rw,relatime 0 0
Pablo Greco 40546a
+/dev/vda2 / ext4 rw,seclabel,relatime 0 0
Pablo Greco 40546a
+selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
Pablo Greco 40546a
+debugfs /sys/kernel/debug debugfs rw,seclabel,relatime 0 0
Pablo Greco 40546a
+hugetlbfs /dev/hugepages hugetlbfs rw,seclabel,relatime,pagesize=2M 0 0
Pablo Greco 40546a
+systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=40,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=14586 0 0
Pablo Greco 40546a
+mqueue /dev/mqueue mqueue rw,seclabel,relatime 0 0
Pablo Greco 40546a
+tmpfs /tmp tmpfs rw,seclabel,nosuid,nodev 0 0
Pablo Greco 40546a
+sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
Pablo Greco 40546a
+tmpfs /run/user/0 tmpfs rw,seclabel,nosuid,nodev,relatime,size=204000k,mode=700 0 0
Pablo Greco 40546a
diff --git a/tests/vircgroupdata/unified.parsed b/tests/vircgroupdata/unified.parsed
Pablo Greco 40546a
new file mode 100644
Pablo Greco 40546a
index 0000000000..3de0fc643d
Pablo Greco 40546a
--- /dev/null
Pablo Greco 40546a
+++ b/tests/vircgroupdata/unified.parsed
Pablo Greco 40546a
@@ -0,0 +1,11 @@
Pablo Greco 40546a
+cpu          <null>
Pablo Greco 40546a
+cpuacct      <null>
Pablo Greco 40546a
+cpuset       <null>
Pablo Greco 40546a
+memory       <null>
Pablo Greco 40546a
+devices      <null>
Pablo Greco 40546a
+freezer      <null>
Pablo Greco 40546a
+blkio        <null>
Pablo Greco 40546a
+net_cls      <null>
Pablo Greco 40546a
+perf_event   <null>
Pablo Greco 40546a
+name=systemd <null>
Pablo Greco 40546a
+unified      /not/really/sys/fs/cgroup
Pablo Greco 40546a
diff --git a/tests/vircgroupdata/unified.self.cgroup b/tests/vircgroupdata/unified.self.cgroup
Pablo Greco 40546a
new file mode 100644
Pablo Greco 40546a
index 0000000000..1e027b2a3c
Pablo Greco 40546a
--- /dev/null
Pablo Greco 40546a
+++ b/tests/vircgroupdata/unified.self.cgroup
Pablo Greco 40546a
@@ -0,0 +1 @@
Pablo Greco 40546a
+0::/
Pablo Greco 40546a
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
Pablo Greco 40546a
index b66682e6c8..1ce1371ddc 100644
Pablo Greco 40546a
--- a/tests/vircgrouptest.c
Pablo Greco 40546a
+++ b/tests/vircgrouptest.c
Pablo Greco 40546a
@@ -900,6 +900,9 @@ mymain(void)
Pablo Greco 40546a
     DETECT_MOUNTS("all-in-one");
Pablo Greco 40546a
     DETECT_MOUNTS_FAIL("no-cgroups");
Pablo Greco 40546a
     DETECT_MOUNTS("kubevirt");
Pablo Greco 40546a
+    fakerootdir = initFakeFS("unified", NULL);
Pablo Greco 40546a
+    DETECT_MOUNTS("unified");
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