All of lore.kernel.org
 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 v2 01/16] API/cgroup: Modify tst_cgroup_print_config for easier parsing and consumption
Date: Mon, 24 Jan 2022 11:16:24 +0000	[thread overview]
Message-ID: <87k0epz7wh.fsf@suse.de> (raw)
In-Reply-To: <3e412686c9cd82cd58697b8200b6d961d7fe4af9.1642601554.git.luke.nowakowskikrijger@canonical.com>

Hello Luke,

Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com> writes:

> Prepare tst_cgroup_print_config to be more easily parsed and consumed by
> shell scripts and other programs.
>
> Also add any detected root information as well as the relevant state
> associated with the roots that would be needed by the test to properly
> cleanup.
>
> Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
> ---
> v2: Remove "mounted_drain_dir" as mounting ltp dir and drain dir happen
> at the same time
>
>  lib/tst_cgroup.c | 35 +++++++++++++++++++++++++++++++----
>  1 file changed, 31 insertions(+), 4 deletions(-)
>
> diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
> index 2ef599d9e..704e64030 100644
> --- a/lib/tst_cgroup.c
> +++ b/lib/tst_cgroup.c
> @@ -301,12 +301,26 @@ opendir:
>  				  O_PATH | O_DIRECTORY);
>  }
>  
> +#define CONFIG_LTPDIR_KEY "Created_Ltp_Dir"
> +#define CONFIG_MOUNTROOT_KEY "Mounted_Root"
> +#define CONFIG_TESTID_KEY "Test_Id"
> +#define CONFIG_CTRL_REQUIRED "Required"
> +#define CONFIG_CTRL_HEADER "Detected Controllers:"
> +#define CONFIG_ROOT_HEADER "Detected Roots:"

Do we really need to configure these? Also why not just use the same
variable names as the C? It makes grepping them easier.

> +
> +/* Prints out the minimal internal state of the test to be consumed
> + * by tst_cgroup_load_config().
> + *
> + * The config keeps track of the minimal state needed for tst_cgroup_cleanup
> + * to cleanup after a test and does not keep track of the creation of
> + * test cgroups that might be created through tst_cgroup_group_mk().
> + */
>  void tst_cgroup_print_config(void)
>  {
>  	struct cgroup_root *root;
>  	const struct cgroup_ctrl *ctrl;
>  
> -	tst_res(TINFO, "Detected Controllers:");
> +	printf("%s\n", CONFIG_CTRL_HEADER);
>  
>  	for_each_ctrl(ctrl) {
>  		root = ctrl->ctrl_root;
> @@ -314,11 +328,24 @@ void tst_cgroup_print_config(void)
>  		if (!root)
>  			continue;
>  
> -		tst_res(TINFO, "\t%.10s %s @ %s:%s",
> +		printf("%s %s @ %s %s\n",
>  			ctrl->ctrl_name,
> -			root->no_cpuset_prefix ? "[noprefix]" : "",
>  			root->ver == TST_CGROUP_V1 ? "V1" : "V2",
> -			root->mnt_path);
> +			root->mnt_path,
> +			ctrl->we_require_it ? CONFIG_CTRL_REQUIRED : "");
> +	}
> +
> +	printf("%s\n", CONFIG_ROOT_HEADER);
> +
> +	for_each_root(root) {
> +		printf("%s %s=%s %s=%s %s=%s\n",

Perhaps we could just use tab separated values? The first row could be
the column names.

> +			root->mnt_path,
> +			CONFIG_MOUNTROOT_KEY,
> +			root->we_mounted_it ? "yes" : "no",
> +			CONFIG_LTPDIR_KEY,
> +			root->ltp_dir.we_created_it ? "yes" : "no",
> +			CONFIG_TESTID_KEY,
> +			root->test_dir.dir_name ? root->test_dir.dir_name : "NULL");
>  	}
>  }


-- 
Thank you,
Richard.

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

  reply	other threads:[~2022-01-24 11:32 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 14:44 [LTP] [PATCH 00/16] Expand Cgroup lib and modify controller tests Luke Nowakowski-Krijger
2022-01-19 14:44 ` [LTP] [PATCH v2 01/16] API/cgroup: Modify tst_cgroup_print_config for easier parsing and consumption Luke Nowakowski-Krijger
2022-01-24 11:16   ` Richard Palethorpe [this message]
2022-01-19 14:44 ` [LTP] [PATCH 02/16] API/cgroup: Add option for specific pid to tst_cgroup_opts Luke Nowakowski-Krijger
2022-01-19 14:44 ` [LTP] [PATCH v2 03/16] API/cgroup: Add cgroup_find_root helper function Luke Nowakowski-Krijger
2022-01-19 14:44 ` [LTP] [PATCH v2 04/16] API/cgroup: Implement tst_cgroup_load_config() Luke Nowakowski-Krijger
2022-01-24 12:05   ` Richard Palethorpe
2022-03-02 18:08     ` Luke Nowakowski-Krijger
2022-01-19 14:44 ` [LTP] [PATCH 05/16] API/cgroup: Add more controllers to tst_cgroup Luke Nowakowski-Krijger
2022-01-24  7:10   ` Li Wang
2022-01-24  7:21     ` Li Wang
2022-01-24 11:36   ` Richard Palethorpe
2022-01-19 14:44 ` [LTP] [PATCH 06/16] API/cgroup: Change to TWARN when v2 controllers change Luke Nowakowski-Krijger
2022-01-24 10:44   ` Richard Palethorpe
2022-01-19 14:44 ` [LTP] [PATCH 07/16] testcases/lib: Implement tst_cgctl binary Luke Nowakowski-Krijger
2022-01-24  7:54   ` Li Wang
2022-01-19 14:44 ` [LTP] [PATCH v2 08/16] controllers: Expand cgroup_lib shell library Luke Nowakowski-Krijger
2022-01-19 14:44 ` [LTP] [PATCH 09/16] controllers: Update cgroup_fj_* to use newer cgroup lib and test lib Luke Nowakowski-Krijger
2022-01-24  8:51   ` Li Wang
2022-03-02 23:41     ` Luke Nowakowski-Krijger
2022-01-19 14:44 ` [LTP] [PATCH 10/16] controllers: Update memcg_control_test to newer test lib and cgroup lib Luke Nowakowski-Krijger
2022-01-24  9:43   ` Li Wang
2022-01-24 12:24     ` Richard Palethorpe
2022-03-02 21:37     ` Luke Nowakowski-Krijger
2022-03-04  7:11       ` Li Wang
2022-01-19 14:44 ` [LTP] [PATCH 11/16] controllers: Update memcg/regression/* to new test " Luke Nowakowski-Krijger
2022-01-19 14:44 ` [LTP] [PATCH 12/16] controllers: Update memcg_stress_test to use newer " Luke Nowakowski-Krijger
2022-01-19 14:44 ` [LTP] [PATCH 13/16] controllers: update memcg/functional " Luke Nowakowski-Krijger
2022-01-19 14:44 ` [LTP] [PATCH 14/16] controllers: Update pids.sh " Luke Nowakowski-Krijger
2022-01-24 12:26   ` Richard Palethorpe
2022-01-19 14:44 ` [LTP] [PATCH 15/16] controllers: update cpuset_regression_test.sh " Luke Nowakowski-Krijger
2022-01-19 14:44 ` [LTP] [PATCH 16/16] controllers: update cgroup_regression_test " Luke Nowakowski-Krijger
2022-01-24  9:40 ` [LTP] [PATCH 00/16] Expand Cgroup lib and modify controller tests 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=87k0epz7wh.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 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.