[LTP] [PATCH v5 1/3] lib: Add support option for .needs_cmds

Cyril Hrubis chrubis@suse.cz
Fri Dec 12 11:30:56 CET 2025


Hi!
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index da5314c50..67553f65d 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1365,6 +1365,19 @@ static const char *default_fs_type(void)
>  	return tst_dev_fs_type();
>  }
>  
> +bool tst_cmd_present(const char *cmd)
> +{
> +	struct tst_cmd *pcmd = tst_test->needs_cmds;
> +
> +	while (pcmd->cmd) {
> +		if (!strcmp(pcmd->cmd, cmd))
> +			return pcmd->present;
> +
> +		pcmd++;
> +	}
> +	return false;

Once again, we should tst_brk(TBROK, "Unexpected command '%s'", cmd) here since we asked for
something that we haven't checked for!

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list