Linux Test Project
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 08/16] controllers: Expand cgroup_lib shell library
Date: Mon, 07 Mar 2022 11:39:26 +0000	[thread overview]
Message-ID: <87ilsqm1kg.fsf@suse.de> (raw)
In-Reply-To: <87wnh6m2fp.fsf@suse.de>

Hello,

>> +
>> +# Mounts and configures the given controller
>> +# USAGE: cgroup_require CONTROLLER
>> +cgroup_require()
>> +{
>> +	local ctrl="$1"
>> +	local exists
>> +
>> +	[ $# -eq 0 ] && tst_brk TBROK "cgroup_require: controller not defined"
>> +
>> +	[ ! -f /proc/cgroups ] && tst_brk TCONF "Kernel does not support
>> control groups"
>
> The tst_cgroup lib can handle this. Also is it guaranteed that
> /proc/cgroups exists if cgroups are enabled?
>
>> +
>> +	exists=$(grep -w $ctrl /proc/cgroups | awk '{ print $4 }')
>> +	[ "$exists" != "1" ] && tst_brk TCONF "cgroup_require:
>> Controller not available or not enabled"
>
> For some reason this fails on my VM where no cgroups are mounted
> already. Also it's redundant because tst_cgroup should handle it.
>
>> +
>> +	_cgroup_state=$(tst_cgctl require "$ctrl" $$)
>> +
>> +	[ "$_cgroup_state" = "" ] && tst_brk TBROK "cgroup_require: No
>state was set after call. Controller '$ctrl' maybe does not exist?"

Perhaps we can just check the return status of tst_cgctl and exit the
script if it is >0?

>> +
>> +	return 0
>>  }


-- 
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-03-07 11:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 23:18 [LTP] [PATCH v2 00/16] Expand Cgroup lib and modify controller tests Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH v3 01/16] API/cgroup: Modify tst_cg_print_config for parsing and consumption Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH 02/16] API/cgroup: Add option for specific pid to tst_cg_opts Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH v2 03/16] API/cgroup: Add cgroup_find_root helper function Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH v3 04/16] API/cgroup: Implement tst_cg_load_config Luke Nowakowski-Krijger
2022-03-07  9:05   ` Richard Palethorpe
2022-03-16 22:38     ` Luke Nowakowski-Krijger
2022-03-17  7:07       ` Richard Palethorpe
2022-04-27 17:38         ` Luke Nowakowski-Krijger
2022-04-28  9:17           ` Li Wang
2022-03-04 23:18 ` [LTP] [PATCH v2 05/16] API/cgroup: Add more controllers to tst_cgroup Luke Nowakowski-Krijger
2022-03-07 11:24   ` Richard Palethorpe
2022-03-16  9:35     ` Li Wang
2022-03-04 23:18 ` [LTP] [PATCH 06/16] API/cgroup: refuse to mount blkio when io controller is mounted Luke Nowakowski-Krijger
2022-03-16 10:01   ` Li Wang
2022-03-04 23:18 ` [LTP] [PATCH v2 07/16] testcases/lib: Implement tst_cgctl binary Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH v3 08/16] controllers: Expand cgroup_lib shell library Luke Nowakowski-Krijger
2022-03-07 11:00   ` Richard Palethorpe
2022-03-07 11:39     ` Richard Palethorpe [this message]
2022-03-16  9:46       ` Li Wang
2022-03-16 21:46         ` Luke Nowakowski-Krijger
2022-03-17  5:38           ` Li Wang
2022-03-04 23:18 ` [LTP] [PATCH v2 09/16] controllers: Update cgroup_fj_* to use newer cgroup lib and test lib Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH v2 10/16] controllers: Update memcg_control_test to newer test lib and cgroup lib Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH v2 11/16] controllers: Update memcg/regression/* to new test " Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH v2 12/16] controllers: Update memcg_stress_test to use newer " Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH v2 13/16] controllers: update memcg/functional " Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH v2 14/16] controllers: Update pids.sh " Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH v2 15/16] controllers: update cpuset_regression_test.sh " Luke Nowakowski-Krijger
2022-03-04 23:18 ` [LTP] [PATCH 16/16] controllers: update cgroup_regression_test " Luke Nowakowski-Krijger
2022-03-16  9:09   ` Li Wang

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=87ilsqm1kg.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=ltp@lists.linux.it \
    --cc=luke.nowakowskikrijger@canonical.com \
    /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