From: Kamalesh Babulal Date: Tue, 20 Dec 2022 16:09:19 +0000 (+0530) Subject: gunit/test-015: Populate subtree_control for leaf cgroup X-Git-Tag: v3.1.0~257 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=328ec5e8e4f00790cb91f81ff53f2cdd42d0106f;p=thirdparty%2Flibcgroup.git gunit/test-015: Populate subtree_control for leaf cgroup We no more rely on the cgroup's parent subtree_control file to verify if a controller is enabled for a cgroup. So, populate the leaf/child cgroups with subtree_control file similar to the parent cgroup. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/tests/gunit/015-cgroupv2_controller_enabled.cpp b/tests/gunit/015-cgroupv2_controller_enabled.cpp index f5ad47c2..25d2e7c1 100644 --- a/tests/gunit/015-cgroupv2_controller_enabled.cpp +++ b/tests/gunit/015-cgroupv2_controller_enabled.cpp @@ -54,6 +54,7 @@ class CgroupV2ControllerEnabled : public ::testing::Test { void InitChildDir(const char dirname[]) { char tmp_path[FILENAME_MAX] = {0}; + FILE *f; int ret; /* create the directory */ @@ -61,6 +62,14 @@ class CgroupV2ControllerEnabled : public ::testing::Test { PARENT_DIR, dirname); ret = mkdir(tmp_path, MODE); ASSERT_EQ(ret, 0); + + snprintf(tmp_path, FILENAME_MAX - 1, + "%s/%s/cgroup.subtree_control", PARENT_DIR, dirname); + + f = fopen(tmp_path, "w"); + ASSERT_NE(f, nullptr); + fprintf(f, "cpu io memory pids\n"); + fclose(f); } void InitMountTable(void)