[LTP] [PATCH v5 1/3] lib: Add support option for .needs_cmds
Petr Vorel
pvorel@suse.cz
Tue Nov 11 12:06:18 CET 2025
Hi Wei,
...
> /*
> * vfork() + execvp() specified program.
> *
> diff --git a/include/tst_test.h b/include/tst_test.h
> index 9c21c1728..9305cf39d 100644
> --- a/include/tst_test.h
> +++ b/include/tst_test.h
> @@ -524,7 +524,7 @@ struct tst_fs {
> *
> * @tags: A {} terminated array of test tags. See struct tst_tag for details.
> *
> - * @needs_cmds: A NULL terminated array of commands required for the test to run.
> + * @needs_cmds: A NULL terminated array of struct tst_cmd required for the test to run.
Please use :ref:`...` formatting to make struct clickable.
* @needs_cmds: A NULL terminated array of :ref:`struct tst_cmd` required for
* the test to run.
> *
> * @needs_cgroup_ver: If set the test will run only if the specified cgroup
> * version is present on the system.
> @@ -617,7 +617,7 @@ struct tst_fs {
> const struct tst_tag *tags;
> - const char *const *needs_cmds;
> + struct tst_cmd *needs_cmds;
> const enum tst_cg_ver needs_cgroup_ver;
> @@ -721,6 +721,18 @@ int tst_creat_unlinked(const char *path, int flags, mode_t mode);
> */
> const char *tst_get_tmpdir_root(void);
> +/**
> + * tst_cmd_present() - Check if a command is present
> + * @cmd: The name of the command to check for.
> + *
> + * This function iterates through the &tst_test->needs_cmds array. It compares
> + * the given command name with each entry in the array and returns the 'present'
And here please again make it clickable tst_cmd->present. It really helps people
to click and see what you mean by 'present'.
* the given command name with each entry in the array and returns the
* &tst_cmd->present flag for the matching command.
If this is the only part to change, it can be done before merge.
> + * flag for the matching command.
> + *
> + * Return: `true` if the command is present, `false` otherwise.
> + */
> +bool tst_cmd_present(const char *cmd);
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
More information about the ltp
mailing list