[LTP] [PATCH v2] controllers: skip test when cgroup v2 is loaded
Li Wang
liwang@redhat.com
Mon Feb 17 09:48:08 CET 2025
Hi Guojie,
On Mon, Feb 17, 2025 at 3:25 PM Jin Guojie <guojie.jin@gmail.com> wrote:
> Hi Li Wang,
>
> This patch fixes the judgment of controllers in the cgroup v2 system
> and improves the error message.
> This is the second version I've made.
> Would you please review it?
>
Sure, we do now have a new cgroup_lib.sh to replace the outdated shell
CGroup API, can we include that new to update test_controllers.sh?
>
> Regards,
> Jin
>
> On Thu, Dec 19, 2024 at 2:36 PM Jin Guojie <guojie.jin@gmail.com> 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
> > +
> > if [ -f /proc/cgroups ]
> > then
> > CPU_CONTROLLER=`grep -w cpu /proc/cgroups | cut -f1`;
> > --
> > 2.34.1
>
>
--
Regards,
Li Wang
More information about the ltp
mailing list