From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2] lib/igt_eld: introduce eld_is_supported
Date: Thu, 12 Sep 2019 15:07:18 +0300 [thread overview]
Message-ID: <20190912120718.2969-1-simon.ser@intel.com> (raw)
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
next reply other threads:[~2019-09-12 12:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 12:07 Simon Ser [this message]
2019-09-12 12:24 ` [igt-dev] [PATCH i-g-t v2] lib/igt_eld: introduce eld_is_supported 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190912120718.2969-1-simon.ser@intel.com \
--to=simon.ser@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox