C API: .needs_cmds and SAFE_RUN_CMD()
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest0 of 6 patches 0 repliesNew
Patches in v1 No applies recorded yet
None of the 6 patches the cover letter announces are in this archive.
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [LTP] [PATCH 0/6] C API: .needs_cmds and SAFE_RUN_CMD()
Quoted 14 lines · Petr Vorel
Hi Xiao,
Quoted 11 lines · Petr Vorel
Quoted 2 lines
+ There is a double check (first in
.needs_cmds, then inSAFE_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
Quoted 7 lines
Quoted 2 lines
by passing
TST_RUN_CMD_CHECK_CMDso 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;
Signature · 22 lines
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;
--
const char *const cmd_userdel[] = {tst_needs_cmds[1], "-r",
username, NULL};
if (tst_run_cmd(cmd_userdel, NULL, NULL, 1))
--
.needs_cmds = (const char *const []) {
"useradd",
"userdel",
----------------------------------------------
btw: is it possible for .needs_cmds to save the required commands with
options?
Thanks,
Xiao YangQuoted 8 lines
I put it there because some command might be run just under some condition (not always), thus not suitable for .needs_cmds, but still nice to have reliable check. But maybe I'm wrong.
Kind regards,
Petr