public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2] lib/igt_eld: introduce eld_is_supported
@ 2019-09-12 12:07 Simon Ser
  2019-09-12 12:24 ` Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Simon Ser @ 2019-09-12 12:07 UTC (permalink / raw)
  To: igt-dev

We've seen cases in which /proc/asound doesn't exist (e.g. with the new SOF
framework). We've also seen cases in which no soundcard is exposed by ALSA (see
bugzilla link). Last, some audio drivers din't support ELDs (non-Intel
drivers). In all of these cases, skipping the tests depending on ELD support
makes more sense and makes it clearer what happens.

v2: also check that the driver supports ELDs entries in procfs

Signed-off-by: Simon Ser <simon.ser@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102370
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_eld.c           | 17 +++++++++++++++++
 lib/igt_eld.h           |  1 +
 tests/kms_chamelium.c   |  2 ++
 tests/kms_hdmi_inject.c |  2 ++
 4 files changed, 22 insertions(+)

diff --git a/lib/igt_eld.c b/lib/igt_eld.c
index 16c4ac06c6f6..ab4307f1d289 100644
--- a/lib/igt_eld.c
+++ b/lib/igt_eld.c
@@ -26,6 +26,8 @@
 #include "config.h"

 #include <dirent.h>
+#include <errno.h>
+#include <glob.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
@@ -262,3 +264,18 @@ bool eld_has_igt(void)
 	struct eld_entry eld;
 	return eld_get_igt(&eld);
 }
+
+/** eld_is_supported: check whether the ALSA procfs is enabled, audio cards
+ * are found and ELDs are supported */
+bool eld_is_supported(void)
+{
+	glob_t glob_buf;
+	bool has_elds;
+
+	igt_assert_f(glob("/proc/asound/card*/" ELD_PREFIX "*",
+			  0, NULL, &glob_buf) == 0,
+		     "glob failed\n");
+	has_elds = glob_buf.gl_pathc > 0;
+	globfree(&glob_buf);
+	return has_elds;
+}
diff --git a/lib/igt_eld.h b/lib/igt_eld.h
index 7c4489f054f1..4b917a62cfaf 100644
--- a/lib/igt_eld.h
+++ b/lib/igt_eld.h
@@ -49,6 +49,7 @@ struct eld_entry {
 	struct eld_sad sads[ELD_SADS_CAP];
 };

+bool eld_is_supported(void);
 bool eld_get_igt(struct eld_entry *eld);
 bool eld_has_igt(void);

diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index b122722a9ff4..523300980550 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -1968,6 +1968,8 @@ test_display_audio_edid(data_t *data, struct chamelium_port *port,
 	struct eld_entry eld;
 	struct eld_sad *sad;

+	igt_require(eld_is_supported());
+
 	reset_state(data, port);

 	output = prepare_output(data, port, edid);
diff --git a/tests/kms_hdmi_inject.c b/tests/kms_hdmi_inject.c
index d9ab4095b8c5..1769df088bbc 100644
--- a/tests/kms_hdmi_inject.c
+++ b/tests/kms_hdmi_inject.c
@@ -142,6 +142,8 @@ hdmi_inject_audio(int drm_fd, drmModeConnector *connector)
 	struct igt_fb fb;
 	struct kmstest_connector_config config;

+	igt_require(eld_is_supported());
+
 	edid = igt_kms_get_hdmi_audio_edid();
 	kmstest_force_edid(drm_fd, connector, edid);

--
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2019-09-12 22:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-12 12:07 [igt-dev] [PATCH i-g-t v2] lib/igt_eld: introduce eld_is_supported Simon Ser
2019-09-12 12:24 ` Chris Wilson
2019-09-12 12:30   ` Ser, Simon
2019-09-12 12:52 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_eld: introduce eld_is_supported (rev2) Patchwork
2019-09-12 22:55 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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