mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
vircgroupmock: rewrite cgroup fopen mocking
Move all the cgroup data into separate files out of vircgroupmock.c and rework the fopen function to load data from files. This will make it easier to add more test cases. Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
7
tests/vircgroupdata/all-in-one.cgroups
Normal file
7
tests/vircgroupdata/all-in-one.cgroups
Normal file
@@ -0,0 +1,7 @@
|
||||
#subsys_name hierarchy num_cgroups enabled
|
||||
cpuset 6 1 1
|
||||
cpu 6 1 1
|
||||
cpuacct 6 1 1
|
||||
memory 6 1 1
|
||||
devices 6 1 1
|
||||
blkio 6 1 1
|
||||
@@ -4,4 +4,4 @@ proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
|
||||
udev /dev devtmpfs rw,relatime,size=16458560k,nr_inodes=4114640,mode=755 0 0
|
||||
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
|
||||
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
|
||||
cgroup /sys/fs/cgroup cgroup rw,relatime,blkio,devices,memory,cpuacct,cpu,cpuset 0 0
|
||||
cgroup /not/really/sys/fs/cgroup cgroup rw,relatime,blkio,devices,memory,cpuacct,cpu,cpuset 0 0
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
cpu /sys/fs/cgroup
|
||||
cpuacct /sys/fs/cgroup
|
||||
cpuset /sys/fs/cgroup
|
||||
memory /sys/fs/cgroup
|
||||
devices /sys/fs/cgroup
|
||||
cpu /not/really/sys/fs/cgroup
|
||||
cpuacct /not/really/sys/fs/cgroup
|
||||
cpuset /not/really/sys/fs/cgroup
|
||||
memory /not/really/sys/fs/cgroup
|
||||
devices /not/really/sys/fs/cgroup
|
||||
freezer <null>
|
||||
blkio /sys/fs/cgroup
|
||||
blkio /not/really/sys/fs/cgroup
|
||||
net_cls <null>
|
||||
perf_event <null>
|
||||
name=systemd <null>
|
||||
|
||||
1
tests/vircgroupdata/all-in-one.self.cgroup
Normal file
1
tests/vircgroupdata/all-in-one.self.cgroup
Normal file
@@ -0,0 +1 @@
|
||||
6:blkio,devices,memory,cpuacct,cpu,cpuset:/
|
||||
10
tests/vircgroupdata/logind.cgroups
Normal file
10
tests/vircgroupdata/logind.cgroups
Normal file
@@ -0,0 +1,10 @@
|
||||
#subsys_name hierarchy num_cgroups enabled
|
||||
cpuset 0 1 1
|
||||
cpu 0 1 1
|
||||
cpuacct 0 1 1
|
||||
memory 0 1 0
|
||||
devices 0 1 1
|
||||
freezer 0 1 1
|
||||
net_cls 0 1 1
|
||||
blkio 0 1 1
|
||||
perf_event 0 1 1
|
||||
2
tests/vircgroupdata/logind.mounts
Normal file
2
tests/vircgroupdata/logind.mounts
Normal file
@@ -0,0 +1,2 @@
|
||||
none /not/really/sys/fs/cgroup tmpfs rw,rootcontext=system_u:object_r:sysfs_t:s0,seclabel,relatime,size=4k,mode=755 0 0
|
||||
systemd /not/really/sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,name=systemd 0 0
|
||||
1
tests/vircgroupdata/logind.self.cgroup
Normal file
1
tests/vircgroupdata/logind.self.cgroup
Normal file
@@ -0,0 +1 @@
|
||||
0:name=systemd:/
|
||||
8
tests/vircgroupdata/systemd.cgroups
Normal file
8
tests/vircgroupdata/systemd.cgroups
Normal file
@@ -0,0 +1,8 @@
|
||||
#subsys_name hierarchy num_cgroups enabled
|
||||
cpuset 2 4 1
|
||||
cpu 3 48 1
|
||||
cpuacct 3 48 1
|
||||
memory 4 4 1
|
||||
devices 5 4 1
|
||||
freezer 6 4 1
|
||||
blkio 8 4 1
|
||||
11
tests/vircgroupdata/systemd.mounts
Normal file
11
tests/vircgroupdata/systemd.mounts
Normal file
@@ -0,0 +1,11 @@
|
||||
rootfs / rootfs rw 0 0
|
||||
tmpfs /run tmpfs rw,seclabel,nosuid,nodev,mode=755 0 0
|
||||
tmpfs /not/really/sys/fs/cgroup tmpfs rw,seclabel,nosuid,nodev,noexec,mode=755 0 0
|
||||
cgroup /not/really/sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
|
||||
cgroup /not/really/sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
|
||||
cgroup /not/really/sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0
|
||||
cgroup /not/really/sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
|
||||
cgroup /not/really/sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
|
||||
cgroup /not/really/sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
|
||||
/dev/sda1 /boot ext4 rw,seclabel,relatime,data=ordered 0 0
|
||||
tmpfs /tmp tmpfs rw,seclabel,relatime,size=1024000k 0 0
|
||||
6
tests/vircgroupdata/systemd.self.cgroup
Normal file
6
tests/vircgroupdata/systemd.self.cgroup
Normal file
@@ -0,0 +1,6 @@
|
||||
115:memory:/
|
||||
8:blkio:/
|
||||
6:freezer:/
|
||||
3:cpuacct,cpu:/system
|
||||
2:cpuset:/
|
||||
1:name=systemd:/user/berrange/123
|
||||
Reference in New Issue
Block a user