Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH v2] core_getversion: Test for desired device
@ 2023-09-25 16:22 Rob Clark
  2023-09-25 20:15 ` [igt-dev] ✓ CI.xeBAT: success for core_getversion: Test for desired device (rev2) Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Rob Clark @ 2023-09-25 16:22 UTC (permalink / raw)
  To: igt-dev; +Cc: Rob Clark, Helen Koike, Emma Anholt

From: Rob Clark <robdclark@chromium.org>

We discovered in drm/ci that if the drm device fails to probe, all the
tests come back as "Skip" and the job is considered successful. Fix
the getversion test to fail if there is no drm device or if the drm
device does not match the expected device as specified by the optional
IGT_REQUIRED_DRIVER environment variable.

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 tests/core_getversion.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/core_getversion.c b/tests/core_getversion.c
index 32cb976e4923..a13cc9c5c288 100644
--- a/tests/core_getversion.c
+++ b/tests/core_getversion.c
@@ -48,14 +48,21 @@ igt_simple_main
 {
 	int fd;
 	drmVersionPtr v;
+	const char *name = getenv("IGT_REQUIRED_DRIVER");
 
-	fd = drm_open_driver(DRIVER_ANY);
+	fd = __drm_open_driver(DRIVER_ANY);
+	igt_assert_fd(fd);
 	v = drmGetVersion(fd);
 	igt_assert_neq(strlen(v->name), 0);
 	igt_assert_neq(strlen(v->date), 0);
 	igt_assert_neq(strlen(v->desc), 0);
 	if (is_i915_device(fd))
 		igt_assert_lte(1, v->version_major);
+	if (name) {
+		igt_assert_f(!strcmp(name, v->name),
+			     "Expected driver \"%s\" but got \"%s\"\n",
+			     name, v->name);
+	}
 
 	drmFree(v);
 	drm_close_driver(fd);
-- 
2.41.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-27 16:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-25 16:22 [igt-dev] [PATCH v2] core_getversion: Test for desired device Rob Clark
2023-09-25 20:15 ` [igt-dev] ✓ CI.xeBAT: success for core_getversion: Test for desired device (rev2) Patchwork
2023-09-25 20:16 ` [igt-dev] ✓ Fi.CI.BAT: " Patchwork
2023-09-26  0:48 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-09-26  7:36 ` [igt-dev] [PATCH v2] core_getversion: Test for desired device Juha-Pekka Heikkila
2023-09-26 12:33 ` Helen Koike
2023-09-26 16:42 ` Daniel Stone
2023-09-27 16:53   ` Kamil Konieczny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox