All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4 11/19] controllers: Expand cgroup_lib shell library
Date: Thu, 5 May 2022 10:16:34 +0200	[thread overview]
Message-ID: <YnOH4h8rTbg1NzCO@pevik> (raw)
In-Reply-To: <3d85635f6b87c73a2389627bc94c847c52165dc7.1651176646.git.luke.nowakowskikrijger@canonical.com>

Hi Luke,

> diff --git a/testcases/kernel/controllers/cgroup_lib.sh b/testcases/kernel/controllers/cgroup_lib.sh
...
> +_cgroup_state=
> +
> +_cgroup_check_return()
> +{
> +	local ret="$1"
> +	local msg="$2"
> +
> +	tst_flag2mask TBROK
> +	[ "$ret" = "$?" ] && tst_brk TBROK "$msg"
> +
> +	tst_flag2mask TCONF
> +	[ "$ret" = "$?" ] && tst_brk TCONF "$msg"
> +}
As I wrote in previous patch likely we can avoid tst_flag2mask in new API.

In few cases where needed we hardwired numbers (IMHO POSIX shell does not
support constants, which would be better than variables which can be changed).

In this case you could probably use ROD() or EXPECT_PASS_BRK().
We use ROD() for external commands, thus support only TBROK on 0,
but it should be probably safe to add TCONF on 32. If others consider it
dangerous, we can add another function in tst_test.sh, e.g. ROD_LTP() which
would expect LTP exit codes.

...
> +# Cleans up any setup done by calling cgroup_require.
> +# USAGE: cgroup_cleanup
> +# Can be safely called even when no setup has been done
> +cgroup_cleanup()
> +{
> +	[ "$_cgroup_state" = "" ] && return 0
> +
> +	tst_cgctl cleanup "$_cgroup_state"
> +
> +	_cgroup_check_return "$?" "cgroup_cleanup: tst_cgctl cleanup exited"
> +
> +	_cgroup_state=""
nit: can be just
_cgroup_state=


Kind regards,
Petr

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

  reply	other threads:[~2022-05-05  8:16 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 20:39 [LTP] [PATCH v4 00/19] Expand Cgroup lib and modify controller tests Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v3 01/19] API/cgroup: Modify tst_cg_print_config for parsing and consumption Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH 02/19] API/cgroup: Add option for specific pid to tst_cg_opts Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v2 03/19] API/cgroup: Add cgroup_find_root helper function Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH 04/19] API/cgroup: Add CTRL_NAME_MAX define Luke Nowakowski-Krijger
2022-05-03 14:26   ` Petr Vorel
2022-04-28 20:39 ` [LTP] [PATCH 05/19] tst_test_macros: Add TST_TOSTR macro Luke Nowakowski-Krijger
2022-05-03 14:38   ` Petr Vorel
2022-05-05 13:34   ` Cyril Hrubis
2022-04-28 20:39 ` [LTP] [PATCH v4 06/19] API/cgroup: Implement tst_cg_load_config Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v3 07/19] API/cgroup: Add more controllers to tst_cgroup Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH 08/19] API/cgroup: refuse to mount blkio when io controller is mounted Luke Nowakowski-Krijger
2022-05-03 15:10   ` Petr Vorel
2022-04-28 20:39 ` [LTP] [PATCH v2 09/19] testcases/lib: Implement tst_cgctl binary Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH 10/19] testcases/lib: Add tst_flag2mask function Luke Nowakowski-Krijger
2022-05-05  8:01   ` Petr Vorel
2022-04-28 20:39 ` [LTP] [PATCH v4 11/19] controllers: Expand cgroup_lib shell library Luke Nowakowski-Krijger
2022-05-05  8:16   ` Petr Vorel [this message]
2022-05-05 13:53     ` Cyril Hrubis
2022-05-10 11:19       ` Petr Vorel
2022-05-13 20:15         ` Luke Nowakowski-Krijger
2022-07-21 21:01           ` Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v2 12/19] controllers: Update cgroup_fj_* to use newer cgroup lib and test lib Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v2 13/19] controllers: Update memcg_control_test to newer test lib and cgroup lib Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v2 14/19] controllers: Update memcg/regression/* to new test " Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v2 15/19] controllers: Update memcg_stress_test to use newer " Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v2 16/19] controllers: update memcg/functional " Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v2 17/19] controllers: Update pids.sh " Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v2 18/19] controllers: update cpuset_regression_test.sh " Luke Nowakowski-Krijger
2022-04-28 20:39 ` [LTP] [PATCH v2 19/19] controllers: update cgroup_regression_test " Luke Nowakowski-Krijger
2022-05-02  9:19 ` [LTP] [PATCH v4 00/19] Expand Cgroup lib and modify controller tests Richard Palethorpe
2022-05-05  7:49 ` Petr Vorel
2022-07-06  6:17   ` Li Wang
2022-07-06  6:25     ` 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=YnOH4h8rTbg1NzCO@pevik \
    --to=pvorel@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.