[LTP] [PATCH v2 1/4] lib/tst_kconfig: Modify the return type of tst_kconfig_check function
Cyril Hrubis
chrubis@suse.cz
Thu Jan 6 11:57:03 CET 2022
Hi!
> diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
> index d433b8cf6..dc7decff9 100644
> --- a/lib/tst_kconfig.c
> +++ b/lib/tst_kconfig.c
> @@ -478,22 +478,26 @@ static void dump_vars(const struct tst_expr *expr)
> }
> }
>
> -void tst_kconfig_check(const char *const kconfigs[])
> +int tst_kconfig_check(const char *const kconfigs[])
> {
> size_t expr_cnt = array_len(kconfigs);
> struct tst_expr *exprs[expr_cnt];
> unsigned int i, var_cnt;
> - int abort_test = 0;
> + int ret = 0;
>
> for (i = 0; i < expr_cnt; i++) {
> exprs[i] = tst_bool_expr_parse(kconfigs[i]);
>
> - if (!exprs[i])
> - tst_brk(TBROK, "Invalid kconfig expression!");
> + if (!exprs[i]) {
> + tst_res(TWARN, "Invalid kconfig expression!");
> + return 1;
> + }
> }
>
> - if (validate_vars(exprs, expr_cnt))
> - tst_brk(TBROK, "Invalid kconfig variables!");
> + if (validate_vars(exprs, expr_cnt)) {
> + tst_res(TWARN, "Invalid kconfig variables!");
> + return 1;
> + }
I think that it would be actually better to keep the TBROK in these two
checks because neither of these two will trigger unless there is a typo
in the expressions and it makes sense to abort everything and stop in
these cases.
Other than that it looks good.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list