[LTP] [PATCH v2] controllers: skip test when cgroup v2 is loaded

Ricardo B. Marlière rbm@suse.com
Mon May 12 15:50:28 CEST 2025


On Thu Dec 19, 2024 at 3:36 AM -03, Jin Guojie wrote:
> V2:
> * Correction of comments
>
> V1:
> * Initial check for cgroup v2
>
> When running "controllers" case on some newer Linux distributions, there
> will be 10 ERROR messages during the setup phase, and several TFAIL
> results at the end.
>
> Current "controllers" cases only implement tests for cgroup v1 file interface.
> It's better to skip the test after checking that v2 hierarchy has
> already been loaded.
>
> [1] https://lists.linux.it/pipermail/ltp/2024-December/041082.html
>
> Signed-off-by: Jin Guojie <guojie.jin@gmail.com>
> ---
>  testcases/kernel/controllers/test_controllers.sh | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/testcases/kernel/controllers/test_controllers.sh
> b/testcases/kernel/controllers/test_controllers.sh
> index 7aa974ff2..0b67387ec 100755
> --- a/testcases/kernel/controllers/test_controllers.sh
> +++ b/testcases/kernel/controllers/test_controllers.sh
> @@ -37,6 +37,15 @@
>  #
>            #
>  ##################################################################################
>
> +# Currently only cgroup v1 interface can be tested.
> +# When the v2 hierarchy is already loaded in the system, skip the test.
> +mount | grep  " type cgroup2 " &>/dev/null
> +if [ $? == 0 ]
> +then
> +       tst_brkm TCONF "" "test_controllers.sh: V1 controller
> required, but mounted on V2"
> +       exit 32
> +fi
> +

Tested-by: Ricardo B. Marlière <rbm@suse.com>

FYI This test was excluded from Tumbleweed but now is being tested
again:

https://openqa.opensuse.org/tests/5053017#step/controllers/8

With this patch, the test is correctly skipped:

https://openqa.opensuse.org/tests/5054200#step/controllers/8

IMHO it should be merged.

Thanks,
-	Ricardo.


>  if [ -f /proc/cgroups ]
>  then
>         CPU_CONTROLLER=`grep -w cpu /proc/cgroups | cut -f1`;
> --
> 2.34.1



More information about the ltp mailing list