From: Mohammed Bilal <mohammed.bilal@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: jeevan.b@intel.com, kunal1.joshi@intel.com,
sameer.lattannavar@intel.com, karthik.b.s@intel.com,
Mohammed Bilal <mohammed.bilal@intel.com>
Subject: [PATCH i-g-t v6 1/2] tests/chamelium/kms_chamelium: Add connector_test() macro
Date: Thu, 29 Jan 2026 13:15:19 +0530 [thread overview]
Message-ID: <20260129074520.397133-2-mohammed.bilal@intel.com> (raw)
In-Reply-To: <20260129074520.397133-1-mohammed.bilal@intel.com>
Update connector handling to iterate over all matching connected ports and
execute tests accordingly, while fixing unintended fixture execution and
skipping cleanly when no matching connector is present.
Signed-off-by: Mohammed Bilal <mohammed.bilal@intel.com>
---
tests/chamelium/kms_chamelium_helper.h | 33 ++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/tests/chamelium/kms_chamelium_helper.h b/tests/chamelium/kms_chamelium_helper.h
index 6dbde8b76..ac776998f 100644
--- a/tests/chamelium/kms_chamelium_helper.h
+++ b/tests/chamelium/kms_chamelium_helper.h
@@ -40,6 +40,39 @@
for_each_port(p, port) if (chamelium_port_get_type(port) == \
DRM_MODE_CONNECTOR_##type__)
+/**
+ * connector_test() - Run a subtest for all ports of a given connector type
+ *
+ * Defines a subtest that iterates over all available Chamelium ports and
+ * executes the provided test function for each port matching the requested
+ * connector type. If no matching port is found, the subtest is skipped
+ * cleanly.
+ *
+ * This helper avoids repeated connector-iteration logic and provides a
+ * consistent pattern for running connector-specific tests.
+ */
+
+#define connector_test(name__, connector_type__, data__, test_fn__, ...) \
+ do { \
+ igt_subtest(name__) { \
+ int p__; \
+ struct chamelium_port *port__; \
+ bool found__ = false; \
+ for_each_port(p__, port__) { \
+ if (chamelium_port_get_type(port__) != \
+ DRM_MODE_CONNECTOR_##connector_type__) \
+ continue; \
+ igt_info("%s: testing port %s\n", name__, \
+ chamelium_port_get_name(port__)); \
+ found__ = true; \
+ test_fn__(data__, port__, ##__VA_ARGS__); \
+ } \
+ if (!found__) \
+ igt_skip(#connector_type__ \
+ " connector not available"); \
+ } \
+ } while (0) \
+
/*
* The chamelium data structure is used to store all the information known about
* chamelium to run the tests.
--
2.48.1
next prev parent reply other threads:[~2026-01-29 7:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 7:45 [PATCH i-g-t v6 0/2] Fix chamelium port allocation during igt_fixture Mohammed Bilal
2026-01-29 7:45 ` Mohammed Bilal [this message]
2026-01-29 7:45 ` [PATCH i-g-t v6 2/2] tests/chamelium/kms_chamelium_hpd: use helper function for connector lookup in DP/HDMI/VGA tests Mohammed Bilal
2026-01-30 4:05 ` [i-g-t,v6,2/2] " Joshi, Kunal1
2026-01-29 8:46 ` ✓ Xe.CI.BAT: success for Fix chamelium port allocation during igt_fixture Patchwork
2026-01-29 9:27 ` ✓ i915.CI.BAT: " Patchwork
2026-01-29 10:56 ` ✗ i915.CI.Full: failure " 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=20260129074520.397133-2-mohammed.bilal@intel.com \
--to=mohammed.bilal@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jeevan.b@intel.com \
--cc=karthik.b.s@intel.com \
--cc=kunal1.joshi@intel.com \
--cc=sameer.lattannavar@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