[LTP] [PATCH v2 1/4] lib/tst_kconfig: Modify the return type of tst_kconfig_check function

xuyang2018.jy@fujitsu.com xuyang2018.jy@fujitsu.com
Fri Jan 7 02:25:48 CET 2022


Hi Cyril
> 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.
Sounds reasonable, will do it.

Best Regards
Yang Xu
>
> Other than that it looks good.
>


More information about the ltp mailing list