From 328ec5e8e4f00790cb91f81ff53f2cdd42d0106f Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Tue, 20 Dec 2022 21:39:19 +0530 Subject: [PATCH] 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 --- tests/gunit/015-cgroupv2_controller_enabled.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) 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) -- 2.47.2