All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 0/6] C API: .needs_cmds and SAFE_RUN_CMD()
Date: Mon, 30 Mar 2020 13:20:27 +0800	[thread overview]
Message-ID: <5E81819B.5070303@cn.fujitsu.com> (raw)
In-Reply-To: <CAEemH2chnkojt0oc9OVodwKOj27_7aTj1nHnkk_DVoOxUP-H7A@mail.gmail.com>

On 2020/3/30 12:39, Li Wang wrote:
> Hi Xiao,
>
> On Sun, Mar 29, 2020 at 1:36 PM Xiao Yang <yangx.jy@cn.fujitsu.com
> <mailto:yangx.jy@cn.fujitsu.com>> wrote:
>
>     On 2020/3/28 11:42, Petr Vorel wrote:
>      > Hi Xiao,
>      >
>      >> On 3/28/20 5:39 AM, Petr Vorel wrote:
>      >>> + There is a double check (first in
>      >>> .needs_cmds, then in SAFE_RUN_CMD()), maybe that's not needed.
>      >
>      >> Hi Petr,
>      >
>      >> Why do you need the duplicate .needs_cmds flag?(it introduces
>     the double
>      >> check as you said)
>      >
>      >> Usually, all tests run commands by tst_run_cmd()/SAFE_RUN_CMD()
>     and they can
>      >> report TCONF
>      >
>      >> by passing TST_RUN_CMD_CHECK_CMD so it is fair to be a part of
>      >> tst_run_cmd()/SAFE_RUN_CMD().
>      >
>      > Thanks for your review.
>      > I guess Cyril will prefer .needs_cmds, as it can be parsed -
>     metadata project:
>      > https://people.kernel.org/metan/towards-parallel-kernel-test-runs
>      > https://github.com/metan-ucw/ltp/tree/master/docparse
>     Hi Petr?
>
>     Thank you for sharing these info.
>     Does Cyril want to get metadata from struct tst_test directly?
>
>     How about the rough design?
>     1) .needs_cmds only saves the required commands.(doesn't do any check)
>     2) pass the corresponding member of .needs_cmds to
>     tst_run_cmd()/SAFE_RUN_CMD()(do check in these functions).
>     For example:
>     ----------------------------------------------
>     # grep tst_needs_cmds include/tst_cmd.h
>     extern const char *const *tst_needs_cmds;
>
>     # grep -B1 tst_needs_cmds lib/tst_test.c
>
>     const char *const *tst_needs_cmds;
>     --
>     if (tst_test->needs_cmds)
>     tst_needs_cmds = tst_test->needs_cmds;
>
>     # grep -A2 'needs_cmds' testcases/kernel/syscalls/add_key/add_key05.c
>     const char *const cmd_useradd[] = {tst_needs_cmds[0], username, NULL};
>     int rc;
>
>
> I don't see any advantage of involving this struct in a test case, and
> it also makes things more complicated.
Hi Li,

In fact, I perfer to remove .need_cmd and use tst_run_cmd with/without 
TST_RUN_CMD_CHECK_CMD directly.
But I am not sure if it is necessary to keep .need_cmd for metadata 
project.  I think we can generate json about resouce by reading struct 
tst_test or other ways.

Thanks,
Xiao Yang

>
> IMO, the '.needs_cmds' should do check and guarantee all the cmds exist.
> That's a hard requirement for the test. If a situation that the commands
> are only part of the requirement(soft), we could avoid using
> '.needs_cmds' in the test and just calling tst_run_cmd() without passing
> TST_RUN_CMD_CHECK_CMD flag. This satisfies most situations we have, it
> is safe enough and choosable for people.
>
> Or maybe I'm wrong here too:).
>
> --
> Regards,
> Li Wang




  reply	other threads:[~2020-03-30  5:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 21:39 [LTP] [PATCH 0/6] C API: .needs_cmds and SAFE_RUN_CMD() Petr Vorel
2020-03-27 21:39 ` [LTP] [PATCH 1/6] lib: Implement .needs_cmds Petr Vorel
2020-03-30  6:13   ` Li Wang
2020-03-30  7:03     ` Petr Vorel
2020-03-30 11:31       ` Cyril Hrubis
2020-03-27 21:39 ` [LTP] [PATCH 2/6] Use .needs_cmds Petr Vorel
2020-03-30 11:31   ` Cyril Hrubis
2020-03-30 11:48     ` Petr Vorel
2020-03-30 11:57       ` Li Wang
2020-03-30 12:17         ` Petr Vorel
2020-03-30 12:37         ` Petr Vorel
2020-03-27 21:39 ` [LTP] [PATCH 3/6] lib/tst_run_cmd_*(): Turn int pass_exit_val into enum Petr Vorel
2020-03-30 11:38   ` Cyril Hrubis
2020-03-30 11:40     ` Petr Vorel
2020-03-27 21:39 ` [LTP] [PATCH 4/6] lib/tst_run_cmd_*(): Search for program in $PATH Petr Vorel
2020-03-30 11:40   ` Cyril Hrubis
2020-03-30 11:52     ` Petr Vorel
2020-03-30 11:53       ` Cyril Hrubis
2020-03-27 21:39 ` [LTP] [PATCH 5/6] lib: Implement SAFE_RUN_CMD() macro (new API only) Petr Vorel
2020-03-30  6:35   ` Li Wang
2020-03-30  8:44     ` Petr Vorel
2020-03-27 21:39 ` [LTP] [PATCH 6/6] Use SAFE_RUN_CMD() Petr Vorel
2020-03-28  2:41 ` [LTP] [PATCH 0/6] C API: .needs_cmds and SAFE_RUN_CMD() Xiao Yang
2020-03-28  3:42   ` Petr Vorel
2020-03-29  5:29     ` Xiao Yang
2020-03-30  4:39       ` Li Wang
2020-03-30  5:20         ` Xiao Yang [this message]
2020-03-30  7:12           ` Petr Vorel
2020-03-30  7:43             ` Xiao Yang
2020-03-30  4:24     ` 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=5E81819B.5070303@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --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 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.