controllers/cgroup: Skip regression test on cgroup v2 systems
PATCH 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.
Add a check for the presence of /sys/fs/cgroup/cgroup.controllers, which indicates a cgroup v2 system. If detected, mark the test as TCONF since the test is only applicable to cgroup v1.
This prevents false failures when running the controllers suite on systems where cgroup v2 is enabled by default.
--- .../kernel/controllers/cgroup/cgroup_regression_test.sh | 7 +++++++ 1 file changed, 7 insertions(+)
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +7 -0
@@ -118,6 +118,13 @@ test2() local val1 local val2 + # This test is specific to cgroup v1 + # Check if system is using cgroup v2 + if [ -f /sys/fs/cgroup/cgroup.controllers ]; then + tst_res TCONF "This test requires cgroup v1, but system is using cgroup v2" + return + fi + mount -t cgroup -o none,name=foo cgroup cgroup/ if [ $? -ne 0 ]; then tst_res TFAIL "Failed to mount cgroup filesystem"
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 25 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.
Add a check for the presence of
/sys/fs/cgroup/cgroup.controllers, which indicates a cgroup v2 system. If detected, mark the test as TCONF since the test is only applicable to cgroup v1.This prevents false failures when running the controllers suite on systems where cgroup v2 is enabled by default.
Signed-off-by Samir <[email protected]>--- .../kernel/controllers/cgroup/cgroup_regression_test.sh | 7 +++++++ 1 file changed, 7 insertions(+)testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +0
-0
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh test2() · line 123
Quoted 6 lines
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +3
-0@@ -118,6 +118,13 @@ test2() local val1 local val2 + # This test is specific to cgroup v1 + # Check if system is using cgroup v2 + if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
This is typically right as the '/sys/fs/cgroup' is Cgroup default mount path, but if a tested system does not mount there, this won't work.
Maybe we can go with the 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 "memory controller mounted on cgroup v2 hierarchy, skipping test." return
fi
Signature · 6 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Li, Samir,
...
Quoted 7 lines
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh test2() · line 123
Quoted 3 lines
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +3
-0+ # This test is specific to cgroup v1 + # Check if system is using cgroup v2 + if [ -f /sys/fs/cgroup/cgroup.controllers ]; thenThis is typically right as the '
/sys/fs/cgroup' is Cgroup default mount path, but if a tested system does not mount there, this won't work.
Quoted 8 lines
Maybe we can go with the
cgroup_lib.shstandard way for version check?
cgroup_require"memory"
cgroup_version=$(cgroup_get_version "memory")
if [ "$cgroup_version" = "2" ]; then
tst_resTCONF "memory controller mounted on cgroup v2 hierarchy, skipping test." return
fi
+1
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 15 lines · Petr Vorel
Hi Li, Samir,
...
Quoted 4 lines
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh test2() · line 123
Quoted 3 lines
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +3
-0+ # This test is specific to cgroup v1 + # Check if system is using cgroup v2 + if [ -f /sys/fs/cgroup/cgroup.controllers ]; thenThis is typically right as the '
/sys/fs/cgroup' is Cgroup default mount path,Quoted 8 lines
but if a tested system does not mount there, this won't work.
Maybe we can go with thecgroup_lib.shstandard way for version check?
cgroup_require"memory"
cgroup_version=$(cgroup_get_version "memory")
if [ "$cgroup_version" = "2" ]; then
tst_resTCONF "memory controller mounted on cgroup v2 hierarchy, skipping test." return
fi
Quoted 5 lines
+1
Kind regards,
Petr
Hi Li, Petr,
I agree with the suggested changes. Thank you for review comments will sent a new patch version with the suggested changes.
Regards,
Samir
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp