* [LTP] [PATCH] controllers/cgroup: Skip regression test on cgroup v2 systems
@ 2026-03-15 12:59 Samir
2026-03-16 3:52 ` Li Wang via ltp
0 siblings, 1 reply; 4+ messages in thread
From: Samir @ 2026-03-15 12:59 UTC (permalink / raw)
To: ltp; +Cc: Samir
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.
Signed-off-by: Samir <samir@linux.ibm.com>
---
.../kernel/controllers/cgroup/cgroup_regression_test.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
index 276231fe8..f6deb0d43 100755
--- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
+++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
@@ -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"
--
2.51.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] controllers/cgroup: Skip regression test on cgroup v2 systems
2026-03-15 12:59 [LTP] [PATCH] controllers/cgroup: Skip regression test on cgroup v2 systems Samir
@ 2026-03-16 3:52 ` Li Wang via ltp
2026-03-16 11:58 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Li Wang via ltp @ 2026-03-16 3:52 UTC (permalink / raw)
To: Samir; +Cc: ltp
On Sun, Mar 15, 2026 at 01:59:33PM +0100, Samir wrote:
> 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.
>
> Signed-off-by: Samir <samir@linux.ibm.com>
> ---
> .../kernel/controllers/cgroup/cgroup_regression_test.sh | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> index 276231fe8..f6deb0d43 100755
> --- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> +++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> @@ -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
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] controllers/cgroup: Skip regression test on cgroup v2 systems
2026-03-16 3:52 ` Li Wang via ltp
@ 2026-03-16 11:58 ` Petr Vorel
2026-03-17 7:09 ` Samir M
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2026-03-16 11:58 UTC (permalink / raw)
To: Li Wang; +Cc: Samir, ltp
Hi Li, Samir,
...
> > + # 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
+1
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] controllers/cgroup: Skip regression test on cgroup v2 systems
2026-03-16 11:58 ` Petr Vorel
@ 2026-03-17 7:09 ` Samir M
0 siblings, 0 replies; 4+ messages in thread
From: Samir M @ 2026-03-17 7:09 UTC (permalink / raw)
To: Petr Vorel, Li Wang; +Cc: ltp
On 16/03/26 5:28 pm, Petr Vorel wrote:
> Hi Li, Samir,
>
> ...
>>> + # 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
> +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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-17 7:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-15 12:59 [LTP] [PATCH] controllers/cgroup: Skip regression test on cgroup v2 systems Samir
2026-03-16 3:52 ` Li Wang via ltp
2026-03-16 11:58 ` Petr Vorel
2026-03-17 7:09 ` Samir M
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox