This patch adds two unit tests for cgroup_get_cgroups().
No changes were made to cgroup_get_cgroup().

In the near future I would like to significantly refactor
this function.  cgget does not use standard libcgroup
data structures like struct cgroup, and a refactor of
cgroup_get_cgroup() would allow portions of it to be
used by cgget rather than having cgget reimplement the
same functionality.

Branch is here:
    https://github.com/drakenclimber/libcgroup/tree/tests/cgroup_get_cgroup2
Continuous integration tests are passing:
    https://travis-ci.com/drakenclimber/libcgroup/builds/150551533
Code coverage increased from 17.86% to 18.23%:
    https://coveralls.io/builds/28957204

Changes from v1 to v2:
* Switched to using c++ vectors to compare the expected
  data with the data received from cgroup_get_cgroup().
  Special thanks to Michal Koutný for this suggestion as
  it really made the test easier to read
* Added an enum for the controllers to further clarify
  readability.  Again, thanks Michal.
* Added another controller (netns) so that the array is
  no longer symmetrical in the x and y axes
* Rather than rely on the compiler to NULL out unpopulated
  fields in a few arrays, I added an explicit NULL value

Tom Hromatka (1):
  tests: Add unit tests for cgroup_get_cgroup()

 tests/gunit/006-cgroup_get_cgroup.cpp | 268 ++++++++++++++++++++++++++
 tests/gunit/Makefile.am               |   3 +-
 2 files changed, 270 insertions(+), 1 deletion(-)
 create mode 100644 tests/gunit/006-cgroup_get_cgroup.cpp

-- 
2.21.0



_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to