]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
tests: Add unit tests for cg_build_path()
authorTom Hromatka <tom.hromatka@oracle.com>
Thu, 30 May 2019 15:22:28 +0000 (09:22 -0600)
committerDhaval Giani <dhaval.giani@oracle.com>
Thu, 30 May 2019 16:37:06 +0000 (09:37 -0700)
commit2b4b5e4de11448dc51f26e7674c206ec9f0926c7
treef36f71bc522a9e58a5f6786d0b9391e1eae2391c
parent31a28ab1cf7f460706a518bdb3c51e480699e1b6
tests: Add unit tests for cg_build_path()

This commit adds unit tests for the internal function
cg_build_path().  While code coverage is not (yet) enabled,
I believe these tests provide full code coverage for the
aforementioned function and its sister function
cg_build_path_locked().

The following tests are in this commit:

BuildPathV1_ControllerMismatch() - Calls cg_build_path() with a
    controller that isn't in cg_mount_table[].  Expects a return
    value of NULL

BuildPathV1_ControllerMatch() - Calls cg_build_path() with a valid
    controller in cg_mount_table[]

BuildPathV1_ControllerMatchWithName() - Calls cg_build_path() with
    a valid controller and a cgroup name

BuildPathV1_ControllerMatchWithNs() - Calls cg_build_path() with a
    valid controller that has a namespace

BuildPathV1_ControllerMatchWithNameAndNs() - Calls cg_build_path()
    with a valid controller, a cgroup name, and the controller has
    a namespace

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
tests/gunit/001-path.cpp [new file with mode: 0644]
tests/gunit/Makefile.am