[PATCH i-g-t v2 3/3] tests/core_getversion: test all drm devices
Mauro Carvalho Chehab
mauro.chehab at linux.intel.com
Wed Mar 13 14:00:50 UTC 2024
On Wed, 21 Feb 2024 11:29:29 +0100
Kamil Konieczny <kamil.konieczny at linux.intel.com> wrote:
> Create multigpu subtest and check all drm devices.
>
> v2: add define for number of max tested cards (Helen)
>
> Cc: Helen Koike <helen.koike at collabora.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
> tests/core_getversion.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/tests/core_getversion.c b/tests/core_getversion.c
> index 8b95e2ce4..1311e8dc5 100644
> --- a/tests/core_getversion.c
> +++ b/tests/core_getversion.c
> @@ -40,11 +40,17 @@
> *
> * SUBTEST: basic
> * Description: Tests GET_VERSION ioctl of the first device.
> + *
> + * SUBTEST: multigpu
> + * Description: Tests GET_VERSION ioctl for all drm devices.
> */
>
> IGT_TEST_DESCRIPTION("Tests the DRM_IOCTL_GET_VERSION ioctl and libdrm's "
> "drmGetVersion() interface to it.");
>
> +/* constant same as in drmtest.c */
> +#define MAX_DRM_CARDS 16
> +
I would prefer to have MAX_DRM_CARDS defined into a header file
probably at lib/drmtest.h, where __drm_open_driver_another() is
declared.
Either way,
Reviewed-by: Mauro Carvalho Chehab <mchehab at kernel.org>
> static void check(int fd, char *dst, int len)
> {
> drmVersionPtr v;
> @@ -78,6 +84,21 @@ igt_main
> igt_info("0: %s\n", info);
> }
>
> + igt_describe("Check GET_VERSION ioctl for all drm devices.");
> + igt_subtest("multigpu") {
> + int fd2;
> +
> + for (int i = 0; i < MAX_DRM_CARDS; ++i) {
> + fd2 = __drm_open_driver_another(i, DRIVER_ANY);
> + if (fd2 == -1)
> + break;
> +
> + check(fd2, info, sizeof(info));
> + igt_info("%d: %s\n", i, info);
> + drm_close_driver(fd2);
> + }
> + }
> +
> igt_fixture
> drm_close_driver(fd);
> }
More information about the igt-dev
mailing list