controllers/cgroup: Skip regression test on cgroup v2 systems
PATCH v2 1/1 controllers/cgroup: Skip regression test on cgroup v2 systems
The cgroup_regression_test.sh test2 attempts to mount a cgroup filesystem and expects a cgroup v1 hierarchy. On systems using cgroup v2 (unified hierarchy), the test fails with:
TFAIL: Failed to mount cgroup filesystem
because the legacy cgroup v1 mount layout is not available. Use the cgroup_lib.sh helpers to detect the cgroup version:
cgroup_require "memory" cgroup_version=$(cgroup_get_version "memory")
If the memory controller is on a cgroup v2 hierarchy, mark the test as TCONF since it is only applicable to cgroup v1.
This avoids false failures when running the controllers suite on systems where cgroup v2 is enabled.
Changelog:
V2 -> V2
1. Use cgroup_lib.sh helpers to detect the cgroup version instead of relying on the /sys/fs/cgroup/cgroup.controllers file check. Older Patch link: https://lore.kernel.org/ltp/20260316115800.GA311158@pevik/T/#mc4b1bb1d0f73d0267a74f3de9764fa8fb398eecc
--- .../controllers/cgroup/cgroup_regression_test.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +11 -0
@@ -117,6 +117,17 @@ test2() { local val1 local val2 + local cgroup_version + + # This test is specific to cgroup v1 + # Use cgroup_lib.sh standard way for version check + cgroup_require "memory" + cgroup_version=$(cgroup_get_version "memory") + if [ "$cgroup_version" = "2" ]; then + tst_res TCONF "This test requires cgroup v1, but system is using cgroup v2" + cgroup_cleanup + return + fi mount -t cgroup -o none,name=foo cgroup cgroup/ if [ $? -ne 0 ]; then
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 33 lines · Samir
The
cgroup_regression_test.shtest2 attempts to mount a cgroup filesystem and expects a cgroup v1 hierarchy. On systems using cgroup v2 (unified hierarchy), the test fails with:TFAIL: Failed to mount cgroup filesystem
because the legacy cgroup v1 mount layout is not available. Use the
cgroup_lib.shhelpers to detect the cgroup version:cgroup_require "memory" cgroup_version=$(cgroup_get_version "memory")If the memory controller is on a cgroup v2 hierarchy, mark the test as TCONF since it is only applicable to cgroup v1.
This avoids false failures when running the controllers suite on systems where cgroup v2 is enabled.
Changelog:
V2 -> V2
1. Usecgroup_lib.shhelpers to detect the cgroup version instead of relying on the/sys/fs/cgroup/cgroup.controllersfile check. Older Patch link: https://lore.kernel.org/ltp/20260316115800.GA311158@pevik/T/#mc4b1bb1d0f73d0267a74f3de9764fa8fb398eeccSigned-off-by Samir <[email protected]>--- .../controllers/cgroup/cgroup_regression_test.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +0
-0
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh test2() · line 123
Quoted 7 lines
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +4
-0@@ -117,6 +117,17 @@ test2() { local val1 local val2 + local cgroup_version + + # This test is specific to cgroup v1 + # Use cgroup_lib.sh standard way for version check
The tst_res printing is clear enough, so we do not need code comments here. I modified a bit and merged this patch, thanks!
Signature · 6 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp