On 2/25/20 2:41 PM, Tom Hromatka wrote:
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

And perhaps more importantly - it added the ability to detect
when a controller is in the test dataset but doesn't get
populated into the struct cgroup returned by cgroup_get_cgroup().

Really good find, Michal.

Tom

* 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




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

Reply via email to