From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t v5] tests/kms_chamelium: skip if GetAudioFormat is not supported
Date: Thu, 16 May 2019 10:27:57 +0300 [thread overview]
Message-ID: <20190516072757.9577-1-simon.ser@intel.com> (raw)
In-Reply-To: <20190515072922.30768-2-simon.ser@intel.com>
Skip audio tests in case GetAudioFormat is not supported by the Chamelium
device (because it is outdated).
A new __chamelium_rpc function has been introduced. The difference with
chamelium_rpc is that it doesn't asserts that the XML-RPC succeeds.
A new chamelium_supports_get_audio_format function has been introduced. It
tries to call GetAudioFormats with abritrary parameters, and checks whether the
call fails because the method doesn't exist. It is not possible to generalize
it into chamelium_supports_method because some methods might have side-effects
(and the only way to check whether a method exists is to try to call it).
Signed-off-by: Simon Ser <simon.ser@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Arek <arkadiusz.hiler@intel.com>
---
Changes from v4 to v5: don't expose chamelium_supports_get_audio_format
directly, instead call it in chamelium_has_audio_support (Arek)
lib/igt_chamelium.c | 73 +++++++++++++++++++++++++++++++++++++------
tests/kms_chamelium.c | 4 +--
2 files changed, 66 insertions(+), 11 deletions(-)
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 94825002cab3..649d807a18fa 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -265,14 +265,13 @@ static void *chamelium_fsm_mon(void *data)
return NULL;
}
-static xmlrpc_value *chamelium_rpc(struct chamelium *chamelium,
- struct chamelium_port *fsm_port,
- const char *method_name,
- const char *format_str,
- ...)
+static xmlrpc_value *__chamelium_rpc_va(struct chamelium *chamelium,
+ struct chamelium_port *fsm_port,
+ const char *method_name,
+ const char *format_str,
+ va_list va_args)
{
- xmlrpc_value *res;
- va_list va_args;
+ xmlrpc_value *res = NULL;
struct fsm_monitor_args monitor_args;
pthread_t fsm_thread_id;
@@ -296,17 +295,49 @@ static xmlrpc_value *chamelium_rpc(struct chamelium *chamelium,
&monitor_args);
}
- va_start(va_args, format_str);
xmlrpc_client_call2f_va(&chamelium->env, chamelium->client,
chamelium->url, method_name, format_str, &res,
va_args);
- va_end(va_args);
if (fsm_port) {
pthread_cancel(fsm_thread_id);
igt_cleanup_hotplug(monitor_args.mon);
}
+ return res;
+}
+
+static xmlrpc_value *__chamelium_rpc(struct chamelium *chamelium,
+ struct chamelium_port *fsm_port,
+ const char *method_name,
+ const char *format_str,
+ ...)
+{
+ xmlrpc_value *res;
+ va_list va_args;
+
+ va_start(va_args, format_str);
+ res = __chamelium_rpc_va(chamelium, fsm_port, method_name,
+ format_str, va_args);
+ va_end(va_args);
+
+ return res;
+}
+
+static xmlrpc_value *chamelium_rpc(struct chamelium *chamelium,
+ struct chamelium_port *fsm_port,
+ const char *method_name,
+ const char *format_str,
+ ...)
+{
+ xmlrpc_value *res;
+ va_list va_args;
+
+ va_start(va_args, format_str);
+ res = __chamelium_rpc_va(chamelium, fsm_port, method_name,
+ format_str, va_args);
+ va_end(va_args);
+
igt_assert_f(!chamelium->env.fault_occurred,
"Chamelium RPC call failed: %s\n",
chamelium->env.fault_string);
@@ -930,12 +961,36 @@ int chamelium_get_captured_frame_count(struct chamelium *chamelium)
return ret;
}
+/**
+ * chamelium_supports_get_audio_format: check the Chamelium device supports
+ * retrieving the capture audio format.
+ */
+static bool chamelium_supports_get_audio_format(struct chamelium *chamelium)
+{
+ xmlrpc_value *res;
+
+ res = __chamelium_rpc(chamelium, NULL, "GetAudioFormat", "(i)", 3);
+ if (res)
+ xmlrpc_DECREF(res);
+
+ /* XML-RPC has a special code for unsupported methods
+ * (XMLRPC_NO_SUCH_METHOD_ERROR) however the Chamelium implementation
+ * doesn't return it. */
+ return (!chamelium->env.fault_occurred ||
+ strstr(chamelium->env.fault_string, "not supported") == NULL);
+}
+
bool chamelium_has_audio_support(struct chamelium *chamelium,
struct chamelium_port *port)
{
xmlrpc_value *res;
xmlrpc_bool has_support;
+ if (!chamelium_supports_get_audio_format(chamelium)) {
+ igt_debug("The Chamelium device doesn't support GetAudioFormat\n");
+ return false;
+ }
+
res = chamelium_rpc(chamelium, port, "HasAudioSupport", "(i)", port->id);
xmlrpc_read_bool(&chamelium->env, res, &has_support);
xmlrpc_DECREF(res);
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 7c3006982abd..88e2163d39a4 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -1033,8 +1033,8 @@ test_display_audio(data_t *data, struct chamelium_port *port,
igt_require(alsa_has_exclusive_access());
- /* Old Chamelium devices need an update for DisplayPort audio
- * support. */
+ /* Old Chamelium devices need an update for DisplayPort audio and
+ * chamelium_get_audio_format support. */
igt_require(chamelium_has_audio_support(data->chamelium, port));
alsa = alsa_init();
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-05-16 7:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 7:29 [igt-dev] [PATCH i-g-t v4 0/9] tests/kms_chamelium: add HDMI audio test Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 1/9] tests/kms_chamelium: skip if GetAudioFormat is not supported Simon Ser
2019-05-16 7:27 ` Simon Ser [this message]
2019-05-16 8:30 ` [igt-dev] [PATCH i-g-t v5] " Arkadiusz Hiler
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 2/9] lib/igt_edid: add support for Short Audio Descriptors Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 3/9] lib/igt_edid: add support for Vendor Specific Data blocks Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 4/9] lib/igt_chamelium: add CHAMELIUM_DEFAULT_EDID Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 5/9] tests/kms_chamelium: generate an EDID with audio support Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 6/9] tests/kms_chamelium: disable >48KHz audio tests Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 7/9] tests/kms_chamelium: enable audio test on HDMI ports Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 8/9] tests/kms_chamelium: don't abort audio test on first fail Simon Ser
2019-05-15 7:29 ` [igt-dev] [PATCH i-g-t v4 9/9] HAX: add {dp, hdmi}-audio test to fast-feedback Simon Ser
2019-05-15 8:25 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_chamelium: add HDMI audio test (rev2) Patchwork
2019-05-15 8:36 ` Ser, Simon
2019-05-15 13:30 ` Arkadiusz Hiler
2019-05-16 9:44 ` Petri Latvala
2019-05-15 16:37 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2019-05-16 7:58 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_chamelium: add HDMI audio test (rev3) Patchwork
2019-05-16 9:52 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-05-16 10:19 ` Arkadiusz Hiler
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=20190516072757.9577-1-simon.ser@intel.com \
--to=simon.ser@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=petri.latvala@intel.com \
/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