• D
    Add a test suite for cgroups functionality · d1452470
    Daniel P. Berrange 提交于
    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: NDaniel P. Berrange <berrange@redhat.com>
    d1452470
vircgrouptest.c 8.3 KB