[igt-dev] [PATCH i-g-t 1/2] lib/igt_kmod: fill skip message for KUnit skips

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Jun 15 10:47:43 UTC 2023


Hi Mauro,

On 2023-06-15 at 11:47:21 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
> 
> IGT build is currently complaining with the lack of a message for
> igt_skip:
> 
>   [188/1383] Compiling C object lib/libigt-igt_kmod_c.a.p/igt_kmod.c.o
>   ../lib/igt_kmod.c: In function ‘__igt_kunit’:
>   ../lib/igt_kmod.c:847:26: warning: zero-length gnu_printf format string [-Wformat-zero-length]
>     847 |                 igt_skip("");
>         |                          ^~
> 
> Add one.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>

Lgtm,

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  lib/igt_kmod.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
> index 66c3028b3551..6205871791c3 100644
> --- a/lib/igt_kmod.c
> +++ b/lib/igt_kmod.c
> @@ -763,7 +763,7 @@ static void __igt_kunit(const char *module_name, const char *opts)
>  	int ret;
>  	struct ktap_test_results *results;
>  	struct ktap_test_results_element *temp;
> -	bool skip = false;
> +	int skip = 0;
>  	bool fail = false;
>  
>  	/* get normalized module name */
> @@ -800,10 +800,15 @@ static void __igt_kunit(const char *module_name, const char *opts)
>  	}
>  
>  	/* The KUnit module is required for running any KUnit tests */
> -	if (igt_kmod_load("kunit", NULL) != 0 ||
> -	    kmod_module_new_from_name(kmod_ctx(), "kunit", &kunit_kmod) != 0) {
> +	ret = igt_kmod_load("kunit", NULL);
> +	if (ret) {
> +		skip = ret;
> +		goto unload;
> +	}
> +	ret = kmod_module_new_from_name(kmod_ctx(), "kunit", &kunit_kmod);
> +	if (ret) {
>  		igt_warn("Unable to load KUnit\n");
> -		skip = true;
> +		skip = ret;
>  		goto unload;
>  	}
>  
> @@ -811,10 +816,11 @@ static void __igt_kunit(const char *module_name, const char *opts)
>  
>  	results = ktap_parser_start(f, is_builtin);
>  
> -	if (igt_kmod_load(module_name, opts) != 0) {
> +	ret = igt_kmod_load(module_name, opts);
> +	if (ret) {
> +		skip = ret;
>  		igt_warn("Unable to load %s module\n", module_name);
>  		ret = ktap_parser_stop();
> -		skip = true;
>  		goto unload;
>  	}
>  
> @@ -844,7 +850,7 @@ unload:
>  	igt_ktest_fini(&tst);
>  
>  	if (skip)
> -		igt_skip("");
> +		igt_skip("Skipping test, as probing KUnit module returned %d", skip);
>  
>  	if (fail)
>  		igt_fail(IGT_EXIT_ABORT);
> -- 
> 2.40.1
> 


More information about the igt-dev mailing list