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 15:43:10 +0800 [thread overview]
Message-ID: <5E81A30E.2080002@cn.fujitsu.com> (raw)
In-Reply-To: <20200330071217.GB4571@dell5510>
On 2020/3/30 15:12, Petr Vorel wrote:
> Hi Xiao,
>
>>> # 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.
>
> not sure if you mean removing .needs_cmds entirely or just for
> copy_file_range02.c. or some other test. I rewritten the original patchset
> because Cyril suggested .needs_cmds implementation:
>
> "Actually I would like to avoid exposing the function to the tests and
> force people to use the .needs_cmds instead in order to have a proper
> metadata." [1]
>
>
Hi Petr,
Thanks a lot for your explanation.
I want to remove .needs_cmds entirely before but it may be helpful to
get metadata about command.
Thanks,
Xiao Yang
> IMHO parsing struct members is easier to get metadata than searching for
> various functions to be used, so I understand Cyril's intention. Cyril explains
> this on his blog posts (I've noticed [2], but it's also in [3]: "this
> arrangement also helps to export the test metadata into a machine parsable
> format").
>
> Kind regards,
> Petr
>
>> 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
>
>
> Kind regards,
> Petr
>
> [1] https://lists.linux.it/pipermail/ltp/2020-March/016233.html
> [2] https://people.kernel.org/metan/towards-parallel-kernel-test-runs
> [3] https://people.kernel.org/metan/the-ltp-test-driver-model
>
>
> .
>
next prev parent reply other threads:[~2020-03-30 7:43 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
2020-03-30 7:12 ` Petr Vorel
2020-03-30 7:43 ` Xiao Yang [this message]
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=5E81A30E.2080002@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox