[PATCH i-g-t v14 resend 1/3] lib/igt_facts: Library and unit testing for fact tracking

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Dec 20 08:50:28 UTC 2024


Hi Peter,
On 2024-12-16 at 16:14:18 +0100, Peter Senna Tschudin wrote:

I am going to merge your series as those checkpatch.pl are rather
a codestyle nitpicks, also as I checked current gcc compiler makes
'bool' type behaviour correct, so it is not a blocker.

Kasia I am expecting that we will followup this with code style
fixes, please help and find someone to do it.

Regards,
Kamil

> Introduces the igt_facts library, designed to collect and track system
> and GPU-related facts during test execution. It provides insights into
> the system state before and after running tests and highlights changes.
> 
> Facts collected:
> 
>  - GPUs on PCI bus: 'hardware PCI bus' 'GPU name'
>  - Associations between PCI GPU and DRM card: 'PCI bus': 'card number'
>  - Kernel taints: 'true' or 'false'
>  - GPU kernel modules loaded: 'driver name'
> 
> To use igt_facts, include "igt_facts.h", then:
> 
>  1. Add a call to igt_facts_lists_init()
>  2. Add calls to igt_facts(last_test) before each test and after
>     running the last test.
> 
> The argument should be NULL or a string with the name of the test:
> 
>  - The first call to igt_facts() will print the facts present
>    "before any test"
>  - Subsequent calls will print only changes to facts if any.
> 
> Here is an example output of using igt_facts when integrated
> with igt_runner. Lines containing '[FACT ' were printed by calls
> to igt_facts():
> 
>  [229.606139] [FACT before any test] new: hardware.pci.gpu_at_addr.0000:03:00.0: 8086:e20b Intel Battlemage (Gen20)
>  [229.606305] [FACT before any test] new: kernel.is_tainted.taint_warn: true
>  [229.608841] [001/267] (600s left) xe_module_load (load)
>  [229.641224] Starting subtest: load
>  [230.613328] Subtest load: SUCCESS (0.973s)
>  [230.678868] [FACT xe_module_load (load)] new: hardware.pci.drm_card_at_addr.0000:03:00.0: card0
>  [230.680801] [FACT xe_module_load (load)] new: kernel.kmod_is_loaded.xe: true
> 
> Unit testing for igt_facts is located at lib/tests/igt_facts.c. Run it
> locally with `meson test -C build`.
> 
> CC: Helen Koike <helen.koike at collabora.com>
> CC: Jani Nikula <jani.nikula at linux.intel.com>
> CC: Jani Saarinen <jani.saarinen at intel.com>
> CC: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
> CC: Juha-Pekka Heikkila <juha-pekka.heikkila at intel.com>
> CC: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> CC: Lucas De Marchi <lucas.demarchi at intel.com>
> CC: Maíra Canal <mcanal at igalia.com>
> CC: Melissa Wen <mwen at igalia.com>
> CC: Petri Latvala <adrinael at adrinael.net>
> CC: Rob Clark <robdclark at chromium.org>
> CC: Ryszard Knop <ryszard.knop at intel.com>
> CC: Swati Sharma <swati2.sharma at intel.com>
> CC: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> CC: dominik.karol.piatkowski at intel.com
> CC: himal.prasad.ghimiray at intel.com
> CC: katarzyna.piecielska at intel.com
> CC: luciano.coelho at intel.com
> CC: nirmoy.das at intel.com
> CC: stuart.summers at intel.com
> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Reviewed-by: Ryszard Knop <ryszard.knop at intel.com>
> Reviewed-by: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>
> Signed-off-by: Peter Senna Tschudin <peter.senna at linux.intel.com>
> ---
>  lib/igt_facts.c       | 779 ++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_facts.h       |  47 +++
>  lib/meson.build       |   1 +
>  lib/tests/igt_facts.c |  18 +
>  lib/tests/meson.build |   1 +
>  5 files changed, 846 insertions(+)
>  create mode 100644 lib/igt_facts.c
>  create mode 100644 lib/igt_facts.h
>  create mode 100644 lib/tests/igt_facts.c
> 
> diff --git a/lib/igt_facts.c b/lib/igt_facts.c
> new file mode 100644
> index 000000000..2e04a7c86
> --- /dev/null
> +++ b/lib/igt_facts.c
> @@ -0,0 +1,779 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2024 Intel Corporation
> + */
...cut...



More information about the igt-dev mailing list