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,
Mohammed Bilal <mohammed.bilal@intel.com>
Subject: [PATCH i-g-t v7 1/3] tests/chamelium/kms_chamelium: Add connector_test() macro
Date: Tue, 3 Feb 2026 09:15:44 +0530 [thread overview]
Message-ID: <20260203034546.1516152-2-mohammed.bilal@intel.com> (raw)
In-Reply-To: <20260203034546.1516152-1-mohammed.bilal@intel.com>
Introduce a unified connector_test() helper macro that iterates over all
matching connected ports and executes tests accordingly, ensuring clean
skipping when no matching connector is present and avoiding unintended
fixture execution.
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-02-03 3:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-03 3:45 [PATCH i-g-t v7 0/3] Fix chamelium port allocation during igt_fixture Mohammed Bilal
2026-02-03 3:45 ` Mohammed Bilal [this message]
2026-02-09 12:04 ` [i-g-t,v7,1/3] tests/chamelium/kms_chamelium: Add connector_test() macro Joshi, Kunal1
2026-02-09 13:04 ` [PATCH i-g-t v7 1/3] " Sebastian Brzezinka
2026-02-03 3:45 ` [PATCH i-g-t v7 2/3] tests/chamelium/kms_chamelium: use helper function for connector lookup in DP/HDMI/VGA tests Mohammed Bilal
2026-02-09 12:05 ` [i-g-t, v7, " Joshi, Kunal1
2026-02-09 13:05 ` [PATCH i-g-t v7 " Sebastian Brzezinka
2026-02-03 3:45 ` [PATCH i-g-t v7 3/3] tests/chamelium: Rename connector_test to connector_subtest Mohammed Bilal
2026-02-09 12:05 ` [i-g-t,v7,3/3] " Joshi, Kunal1
2026-02-09 12:28 ` [PATCH i-g-t v7 3/3] " Sebastian Brzezinka
2026-02-09 13:06 ` Sebastian Brzezinka
2026-02-05 9:08 ` ✓ Xe.CI.BAT: success for Fix chamelium port allocation during igt_fixture (rev3) Patchwork
2026-02-05 9:58 ` ✓ i915.CI.BAT: " Patchwork
2026-02-06 0:14 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-06 4:00 ` ✗ Xe.CI.FULL: " Patchwork
2026-02-09 12:14 ` Bilal, Mohammed
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=20260203034546.1516152-2-mohammed.bilal@intel.com \
--to=mohammed.bilal@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jeevan.b@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