[LTP] [PATCH v4 2/5] lib: Introduce KCONFIG_SKIP_CHECK environment variable

Petr Vorel pvorel@suse.cz
Thu Jan 13 12:09:21 CET 2022


Hi Xu,

> This environment variable is designed to add kernel config check functionality
> switch. So we can skip kconfig check completely and it is useful especially
> for the embedded platforms that they don't have kernel config.

very nit: I'd write it a bit simpler. Maybe:
Add environment variable to disable kernel config check functionality.
It is useful for embedded platforms which don't have kernel config installed.

> +++ b/doc/user-guide.txt
> @@ -10,6 +10,7 @@ For running LTP network tests see `testcases/network/README.md`.
>  |==============================================================================
>  | 'KCONFIG_PATH'        | The path to the kernel config file, (if not set, it tries
>                            the usual paths '/boot/config-RELEASE' or '/proc/config.gz').
> +| 'KCONFIG_SKIP_CHECK'  | Skip kernel config check, the default is empty (don't skip).
s/empty/not set/ ?
maybe: Skip kernel config check if variable set (not set by default).

...

> +static int kconfig_skip_check(void)
> +{
> +	char *skipped = getenv("KCONFIG_SKIP_CHECK");
> +
> +	if (skipped)
> +		return 1;
> +
> +	return 0;
> +}
> +
>  static const char *kconfig_path(char *path_buf, size_t path_buf_len)
>  {
>  	const char *path = getenv("KCONFIG_PATH");
> @@ -485,6 +495,11 @@ int tst_kconfig_check(const char *const kconfigs[])
>  	unsigned int i, var_cnt;
>  	int ret = 0;

> +	if (kconfig_skip_check()) {
> +		tst_res(TINFO, "Skipping kernel config check as requested");
I suppose you expect tests / library use kconfig_skip_check() in the future for
some detection. If not I'd move tst_res(TINFO, ...) into kconfig_skip_check().

Otherwise LGTM.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


More information about the ltp mailing list