]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Add a test suite for cgroups functionality
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 28 Mar 2013 14:36:52 +0000 (14:36 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 15 Apr 2013 16:35:31 +0000 (17:35 +0100)
commitd14524701ac0d3cf3108595b52f7f41292a22333
tree5df8054321f8227752ecd058b96ffef3f4ecb21a
parent04c18d25f12bad6852d40454563adf8ba0e994f4
Add a test suite for cgroups functionality

Some aspects of the cgroups setup / detection code are quite subtle
and easy to break. It would greatly benefit from unit testing, but
this is difficult because the test suite won't have privileges to
play around with cgroups. The solution is to use monkey patching
via LD_PRELOAD to override the fopen, open, mkdir, access functions
to redirect access of cgroups files to some magic stubs in the
test suite.

Using this we provide custom content for the /proc/cgroup and
/proc/self/mounts files which report a fixed cgroup setup. We
then override open/mkdir/access so that access to the cgroups
filesystem gets redirected into files in a temporary directory
tree in the test suite build dir.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
.gitignore
cfg.mk
tests/Makefile.am
tests/vircgroupmock.c [new file with mode: 0644]
tests/vircgrouptest.c [new file with mode: 0644]