[PATCH i-g-t v2 2/4] lib/igt_core: Added message to runner about ignoring kernel warns

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Aug 7 14:22:49 UTC 2024


On Tue, Aug 06, 2024 at 04:43:30PM +0200, Kamil Konieczny wrote:
> Allow a test to emit regex into dmesg to be read by runner when
> it will be generating results based on kernel dmesg. When it
> will encounter such message, runner will save it and then
> temporarily ignore kernel warnings or errors which matches given
> regex.
> 
> v2: check creation of regex in subtest run and bail out quickly
> on error, fix description (Zbigniew)
> 
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
>  lib/igt_core.c | 19 +++++++++++++++++++
>  lib/igt_core.h |  2 ++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 3ff3e0392..6523e33df 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -3432,3 +3432,22 @@ int igt_pci_system_init(void)
>  
>  	return pthread_once(&once_control, __pci_system_init);
>  }
> +
> +/**
> + * igt_emit_ignore_dmesg_regex:
> + * @ignore_dmesg: string regex
> + *
> + * Emits a string for igt_runner to ignore next dmesg warns or errors which
> + * matches it.
> + */
> +void igt_emit_ignore_dmesg_regex(const char *ignore_dmesg_regex)
> +{
> +	static const char mark_ignore_dmesg[] = "add ignored dmesg regex: ";
> +	GRegex *re;
> +
> +	re = g_regex_new(ignore_dmesg_regex, G_REGEX_OPTIMIZE, 0, NULL);

May you catch an error and display what's wrong with this regex?

--
Zbigniew

> +	igt_assert_f(re, "Error in regexp '%s'\n", ignore_dmesg_regex);
> +
> +	g_regex_unref(re);
> +	igt_kmsg(KMSG_INFO "%s%s\n", mark_ignore_dmesg, ignore_dmesg_regex);
> +}
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 82f474c5f..c12488298 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -1540,4 +1540,6 @@ static inline void igt_pci_system_cleanup(void)
>  {
>  }
>  
> +void igt_emit_ignore_dmesg_regex(const char *ignore_dmesg_regex);
> +
>  #endif /* IGT_CORE_H */
> -- 
> 2.43.0
> 


More information about the igt-dev mailing list