[PATCH i-g-t v1 2/4] lib/igt_core: Added message to runner about ignoring kernel warns
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Tue Jul 30 04:10:57 UTC 2024
On Thu, Jul 25, 2024 at 02:50:04PM +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 encouter such message, it will save it and then temporarily
s/encouter/encounter/
> ignore kernel warnings or errors which matches given regex.
>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
> lib/igt_core.c | 14 ++++++++++++++
> lib/igt_core.h | 2 ++
> 2 files changed, 16 insertions(+)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 3ff3e0392..647486ba9 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -3432,3 +3432,17 @@ 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: ";
> +
> + igt_kmsg(KMSG_INFO "%s%s\n", mark_ignore_dmesg, ignore_dmesg_regex);
If developer will make a mistake and pass invalid regexp we will know
about it late, at runner time.
As this is hard contract between runner and the test which is feeding it
with regexp you should validate it here. It even should assert as
most tests are executed manually during development phase so you'll
ensure developer has provided valid regexp.
The biggest cons of this attitude is if you'll make a mistake you'll
have to alter regexp. Kernel changes in dmesg output also will require
test change what is a noise. But as I said in previous mail it is
conditionally acceptable for me atm. We have single exception now
(xe_wedged) so lets go this way.
--
Zbigniew
> +}
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 084d94da7..22bdc0b73 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -1522,4 +1522,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