Linux Test Project
 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 v2 09/18] testcases/lib: Implement tst_cgctl binary
Date: Tue, 26 Jul 2022 14:48:56 +0200	[thread overview]
Message-ID: <Yt/iuJCC9kLv7LV0@pevik> (raw)
In-Reply-To: <d9b6784f8e3fa3e4d9486bc54a2e230a313edd84.1658433280.git.luke.nowakowskikrijger@canonical.com>

> Implement a binary utility that creates an interface to make calls to
> the cgroup C API.

> This will effectively allow shell scripts to make calls to the cgroup C
> api.

> Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
> ---
> v2: Add license identifier and copyright.
> Reformat with tabs instead of spaces.
> Add help format message and help function.
> Add error gotos to streamline error messaging.

>  testcases/lib/Makefile    |  2 +-
>  testcases/lib/tst_cgctl.c | 87 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 88 insertions(+), 1 deletion(-)
>  create mode 100644 testcases/lib/tst_cgctl.c

> diff --git a/testcases/lib/Makefile b/testcases/lib/Makefile
> index f2de0c832..f4f8c8524 100644
> --- a/testcases/lib/Makefile
> +++ b/testcases/lib/Makefile
> @@ -12,6 +12,6 @@ MAKE_TARGETS		:= tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp\
>  			   tst_device tst_net_iface_prefix tst_net_ip_prefix tst_net_vars\
>  			   tst_getconf tst_supported_fs tst_check_drivers tst_get_unused_port\
>  			   tst_get_median tst_hexdump tst_get_free_pids tst_timeout_kill\
> -			   tst_check_kconfigs
> +			   tst_check_kconfigs tst_cgctl

>  include $(top_srcdir)/include/mk/generic_leaf_target.mk
> diff --git a/testcases/lib/tst_cgctl.c b/testcases/lib/tst_cgctl.c
> new file mode 100644
> index 000000000..4f4fe8542
> --- /dev/null
> +++ b/testcases/lib/tst_cgctl.c
> @@ -0,0 +1,87 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2022 Canonical Ltd.
> + */
> +
> +#include <stdio.h>
> +#include <string.h>
> +#include <stdlib.h>
> +#include <stdint.h>
> +#include <unistd.h>
> +#include "tst_cgroup.h"
> +
> +#define USAGE "Usage: tst_cgctl require [controller] [test_pid]\n\
> +	\t cleanup [config (output of tst_cg_print_config)]\n\
> +	\t print\n\
> +	\t help\n"
nit: instead of define I'd create function usage().
I'd print always to stderr, just exit code would be different.
(we print tst_res/tst_brk output to stderr, thus it's better to use it).

Also checkpatch does not like it:
$ cd testcases/lib/ && make check-tst_cgctl
CHECK testcases/lib/tst_cgctl.c
tst_cgctl.c:13: WARNING: Avoid line continuations in quoted strings

The rest LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

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

  reply	other threads:[~2022-07-26 12:49 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 20:52 [LTP] [PATCH v5 00/18] Expand Cgroup lib and modify controller tests Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v3 01/18] API/cgroup: Modify tst_cg_print_config for parsing and consumption Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH 02/18] API/cgroup: Add option for specific pid to tst_cg_opts Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v2 03/18] API/cgroup: Add cgroup_find_root helper function Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH 04/18] API/cgroup: Add CTRL_NAME_MAX define Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v2 05/18] tst_test_macros: Add TST_TO_STR and TST_STR macro Luke Nowakowski-Krijger
2022-07-26 14:44   ` Petr Vorel
2022-07-21 20:52 ` [LTP] [PATCH v5 06/18] API/cgroup: Implement tst_cg_load_config Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v3 07/18] API/cgroup: Add more controllers to tst_cgroup Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v2 08/18] API/cgroup: refuse to mount blkio when io controller is mounted Luke Nowakowski-Krijger
2022-07-26 14:40   ` Petr Vorel
2022-07-21 20:52 ` [LTP] [PATCH v2 09/18] testcases/lib: Implement tst_cgctl binary Luke Nowakowski-Krijger
2022-07-26 12:48   ` Petr Vorel [this message]
2022-07-21 20:52 ` [LTP] [PATCH v5 10/18] controllers: Expand cgroup_lib shell library Luke Nowakowski-Krijger
2022-07-26 13:12   ` Petr Vorel
2022-07-26 19:24     ` Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v3 11/18] controllers: Update cgroup_fj_* to use newer cgroup lib and test lib Luke Nowakowski-Krijger
2022-07-25 11:41   ` Richard Palethorpe
2022-07-26  6:36     ` Li Wang
2022-07-21 20:52 ` [LTP] [PATCH v3 12/18] controllers: Update memcg_control_test to newer test lib and cgroup lib Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v3 13/18] controllers: Update memcg/regression/* to new test " Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v2 14/18] controllers: Update memcg_stress_test to use newer " Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v2 15/18] controllers: update memcg/functional " Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v3 16/18] controllers: Update pids.sh " Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v2 17/18] controllers: update cpuset_regression_test.sh " Luke Nowakowski-Krijger
2022-07-21 20:52 ` [LTP] [PATCH v3 18/18] controllers: update cgroup_regression_test " Luke Nowakowski-Krijger
2022-07-26  3:33   ` Li Wang
2022-07-25  8:14 ` [LTP] [PATCH v5 00/18] Expand Cgroup lib and modify controller tests Petr Vorel
2022-07-25 20:25   ` Luke Nowakowski-Krijger
2022-07-26 13:00     ` Petr Vorel
2022-07-26  6:10 ` Li Wang
2022-07-26  8:52   ` Richard Palethorpe
2022-07-26 16:04     ` Petr Vorel

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=Yt/iuJCC9kLv7LV0@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox