[LTP] [PATCH v2 5/6] API/cgroups: tst_require fail gracefully with unknown controller

Li Wang liwang@redhat.com
Fri May 28 10:22:42 CEST 2021


> >> +       if (!ctrl) {
> >> +               tst_brk(TBROK, "'%s' controller is unknown to LTP", ctrl_name);
> >> +               tst_brk(TBROK, "Calling %s in cleanup?", __func__);
> >> +               return;
> >
> > It'd never go here to perform a return because the first tst_brk
> > will break the test directly. And, I don't know why we need the
> > second tst_brk to show calling in cleanup, is that possible?
>
> It can return if it is called during cleanup. tst_cgroup_require should
> not be called from cleanup. However someone can do it by accident.

Well, I see. But TBH, here worries too much about the unexpected situation:).

> We probably need two versions of tst_brk. One which can return if called
> from cleanup and one which does not. I suspect most tst_brk callers
> assume it will not return. It is really only some safe library functions
> which can handle that.

Yes, sounds reasonable to me.

[Cc Cyril if he has more advice on this]

--
Regards,
Li Wang



More information about the ltp mailing list