From: Richard Palethorpe <rpalethorpe@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 5/6] API/cgroups: tst_require fail gracefully with unknown controller
Date: Thu, 27 May 2021 16:14:44 +0100 [thread overview]
Message-ID: <87mtsgjjiz.fsf@suse.de> (raw)
In-Reply-To: <CAEemH2cqGGJuF56LpVO9egB7eLLCLdcXKaVA_2dkFRFmN8=jKw@mail.gmail.com>
Hello Li,
Li Wang <liwang@redhat.com> writes:
> Hi Richard,
>
> On Fri, May 21, 2021 at 6:26 PM Richard Palethorpe via ltp
> <ltp@lists.linux.it> wrote:
>>
>> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
>> ---
>> lib/tst_cgroup.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
>> index 74746f13e..6d94ea41c 100644
>> --- a/lib/tst_cgroup.c
>> +++ b/lib/tst_cgroup.c
>> @@ -599,6 +599,12 @@ void tst_cgroup_require(const char *const ctrl_name,
>> struct cgroup_ctrl *const ctrl = cgroup_find_ctrl(ctrl_name);
>> struct cgroup_root *root;
>>
>> + 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.
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.
>
>
>> + }
>> +
>> if (!options)
>> options = &default_opts;
>>
>> --
>> 2.31.1
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>>
--
Thank you,
Richard.
next prev parent reply other threads:[~2021-05-27 15:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 10:25 [LTP] [PATCH v2 0/6] cfs_bandwidth01 and CGroup API Richard Palethorpe
2021-05-21 10:25 ` [LTP] [PATCH v2 1/6] API/cgroups: Allow fetching of CGroup name Richard Palethorpe
2021-05-21 10:25 ` [LTP] [PATCH v2 2/6] API/cgroups: Remove obsolete function in API Richard Palethorpe
2021-05-21 10:25 ` [LTP] [PATCH v2 3/6] API/cgroups: Add cpu controller Richard Palethorpe
2021-05-21 10:25 ` [LTP] [PATCH v2 4/6] API/cgroups: Auto add controllers to subtree_control in new subgroup Richard Palethorpe
2021-05-21 10:25 ` [LTP] [PATCH v2 5/6] API/cgroups: tst_require fail gracefully with unknown controller Richard Palethorpe
2021-05-27 13:18 ` Li Wang
2021-05-27 15:14 ` Richard Palethorpe [this message]
2021-05-28 8:22 ` Li Wang
2021-05-21 10:25 ` [LTP] [PATCH v2 6/6] sched/cgroup: Add cfs_bandwidth01 Richard Palethorpe
2021-05-27 13:26 ` Li Wang
2021-05-28 9:37 ` Richard Palethorpe
2021-05-31 5:33 ` Li Wang
2021-05-31 6:02 ` Li Wang
2021-06-01 10:42 ` Richard Palethorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mtsgjjiz.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox