Skip to contentSkip to conversation

Fix chamelium port allocation during igt_fixture

PATCH Superseded Mohammed Bilal 4 participants 7 messages Dec 9, 2025 – Dec 10, 2025 Library code

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 cover Fix chamelium port allocation during igt_fixture

The current fixture implementation executes even for unrelated subtests, causing false failures when expected inputs were not present. Refactor the DP/HDMI/VGA hotplug tests to use a common connector lookup pattern so that each test skips cleanly.

v3:
- Introduce a unified connector test macro (Sebastien)
- Remove unused variable (Sebastien)
- Drop per-connector fixture usage (Sebastien)
- Refactor DP/HDMI/VGA hotplug tests (Sebastien)

Mohammed Bilal (2):
lib/igt_chamelium: add get_port() helper and CONNECTOR_TEST macro tests/chamelium/kms_chamelium_hpd: use helper function for connector
lookup in DP/HDMI/VGA tests

 lib/igt_chamelium.c                 |  10 ++
 lib/igt_chamelium.h                 |  18 +++
 tests/chamelium/kms_chamelium_hpd.c | 240 +++++++++++-----------------
 3 files changed, 125 insertions(+), 143 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH v3 1/2 lib/igt_chamelium: add get_port() helper and CONNECTOR_TEST macro

Add a get_port() helper to return the first matching connector type, and introduce a CONNECTOR_TEST() macro to simplify connector lookup and skip subtests cleanly when the requested connector is unavailable.

---
 lib/igt_chamelium.c | 10 ++++++++++
 lib/igt_chamelium.h | 18 ++++++++++++++++++
 2 files changed, 28 insertions(+)
lib/igt_chamelium.c +10 -0
index cb240a7df..782b34ebe 100644
@@ -3260,6 +3260,16 @@ bool chamelium_wait_all_configured_ports_connected(struct chamelium *chamelium,
 	return wait_for_connected_state(drm_fd, connectors, connectors_count);
 }
 
+struct chamelium_port *
+get_port(struct chamelium_port **ports, int port_count, int connector_type)
+{
+	for (int i = 0; i < port_count; i++) {
+		if (chamelium_port_get_type(ports[i]) == connector_type)
+			return ports[i];
+	}
+	return NULL;
+}
+
 igt_constructor {
 	/* Frame dumps can be large, so we need to be able to handle very large
 	 * responses
lib/igt_chamelium.h +18 -0
index b5d13ddc8..07ef2b61f 100644
@@ -274,4 +274,22 @@ bool chamelium_plug_all(struct chamelium *chamelium);
 bool chamelium_wait_all_configured_ports_connected(struct chamelium *chamelium,
 						   int drm_fd);
 
+/* Helper to get first matching connector type */
+struct chamelium_port *
+get_port(struct chamelium_port **ports, int port_count, int connector_type);
+
+/* Generic connector test macro usable by all chamelium tests */
+#define CONNECTOR_TEST(name, connector_type, test_fn, ...)                    \
+	do {                                                                   \
+		igt_subtest(name) {                                            \
+			struct chamelium_port *port =                          \
+			       get_port(data.ports, data.port_count,         \
+					DRM_MODE_CONNECTOR_##connector_type); \
+			if (!port)                                              \
+				igt_skip(#connector_type                           \
+					 " connector not available\n");         \
+				test_fn(&data, port, ##__VA_ARGS__);                   \
+					 }                                              \
+	} while (0)
+
 #endif /* IGT_CHAMELIUM_H */
Signature · 1 line
2.48.1
#2 lore raw

RE: [PATCH i-g-t v3 1/2] lib/igt_chamelium: add get_port() helper and CONNECTOR_TEST macro

Quoted 30 lines

-----Original Message-----
From: Bilal, Mohammed <[email protected]>
Sent: Tuesday, December 9, 2025 8:54 PM
To: [email protected]
Cc: B, Jeevan <[email protected]>; Joshi, Kunal1 <[email protected]>; Lattannavar, Sameer <[email protected]>; B S, Karthik <[email protected]>; Bilal, Mohammed <[email protected]>
Subject: [PATCH i-g-t v3 1/2] lib/igt_chamelium: add get_port() helper and CONNECTOR_TEST macro

Add a get_port() helper to return the first matching connector type, and introduce a CONNECTOR_TEST() macro to simplify connector lookup and skip subtests cleanly when the requested connector is unavailable.

---
 lib/igt_chamelium.c | 10 ++++++++++
 lib/igt_chamelium.h | 18 ++++++++++++++++++
 2 files changed, 28 insertions(+)
lib/igt_chamelium.c index renamed from lib/igt_chamelium.c +0 -0

cb240a7df..782b34ebe 100644

lib/igt_chamelium.c +0 -0
@@ -3260,6 +3260,16 @@ bool

chamelium_wait_all_configured_ports_connected(struct chamelium *chamelium,
return wait_for_connected_state(drm_fd, connectors,
connectors_count); }

lib/igt_chamelium.c

Quoted 2 lines
lib/igt_chamelium.c +2 -0
+struct chamelium_port *
+get_port(struct chamelium_port **ports, int port_count, int

Function name is too generic, it should be like igt_chamelium_get_port/chamelium_get_port Also make sure to fix indentation for function.
Consider making it static if only used within the file.

Quoted 38 lines
lib/igt_chamelium.c +8 -0
+connector_type) {
+	for (int i = 0; i < port_count; i++) {
+		if (chamelium_port_get_type(ports[i]) == connector_type)
+			return ports[i];
+	}
+	return NULL;
+}
+
 igt_constructor {
 	/* Frame dumps can be large, so we need to be able to handle very

large

lib/igt_chamelium.c +0 -0
 	 * responses
lib/igt_chamelium.h index renamed from lib/igt_chamelium.h +0 -0

b5d13ddc8..07ef2b61f 100644

lib/igt_chamelium.h +11 -0
@@ -274,4 +274,22 @@ bool chamelium_plug_all(struct chamelium
 *chamelium);  bool chamelium_wait_all_configured_ports_connected(struct
 chamelium *chamelium,
 						   int drm_fd);
 
+/* Helper to get first matching connector type */ struct chamelium_port
+* get_port(struct chamelium_port **ports, int port_count, int
+connector_type);
+
+/* Generic connector test macro usable by all chamelium tests */
+#define CONNECTOR_TEST(name, connector_type, test_fn, ...)                    \
+	do {                                                                   \
+		igt_subtest(name) {                                            \
+			struct chamelium_port *port =                          \
+			       get_port(data.ports, data.port_count,         \
+
	DRM_MODE_CONNECTOR_##connector_type); \
lib/igt_chamelium.h +4 -0
+			if (!port)                                              \
+				igt_skip(#connector_type                           \
+					 " connector not available\n");         \
+				test_fn(&data, port, ##__VA_ARGS__);

\

lib/igt_chamelium.h bool chamelium_plug_all(struct chamelium *chamelium); · line 294

Quoted 3 lines
lib/igt_chamelium.h +3 -0
+					 }                                              \
+	} while (0)
+

Fix formatting its not clean
Also consider adding documentation for both the function and macro.

Quoted 3 lines

#endif /* IGT_CHAMELIUM_H */
--
2.48.1

#3 lore raw

PATCH v3 2/2 tests/chamelium/kms_chamelium_hpd: use helper function for connector lookup in DP/HDMI/VGA tests

In reply to Mohammed Bilal

Replace the old connector_subtest() + per-connector igt_fixture blocks with a unified CONNECTOR_TEST() helper based on get_port(). The previous fixtures were always executed even when running other subtests, causing false failures when HDMI/VGA/DP connectors were not present.

Using CONNECTOR_TEST() makes each subtest perform its own connector lookup and skip cleanly if unavailable, while removing repeated boilerplate across DP/HDMI/VGA hotplug tests.

---
 tests/chamelium/kms_chamelium_hpd.c | 240 +++++++++++-----------------
 1 file changed, 97 insertions(+), 143 deletions(-)
tests/chamelium/kms_chamelium_hpd.c +97 -143
index 161f494e9..198ec6039 100644
@@ -463,157 +463,114 @@ IGT_TEST_DESCRIPTION("Testing HPD with a Chamelium board");
 igt_main
 {
 	chamelium_data_t data;
-	struct chamelium_port *port;
-	int p;
 
 	igt_fixture {
 		chamelium_init_test(&data);
 	}
 
 	igt_describe("DisplayPort tests");
-	igt_subtest_group {
-		igt_fixture {
-			chamelium_require_connector_present(
-				data.ports, DRM_MODE_CONNECTOR_DisplayPort,
-				data.port_count, 1);
-		}
 
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("dp-hpd", DisplayPort)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_DP_HDMI,
-				     TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("dp-hpd-fast", DisplayPort) test_hotplug(
-			&data, port, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("dp-hpd-enable-disable-mode", DisplayPort)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("dp-hpd-with-enabled-mode", DisplayPort)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON);
-
-		igt_describe(test_hotplug_for_each_pipe_desc);
-		connector_subtest("dp-hpd-for-each-pipe", DisplayPort)
-			test_hotplug_for_each_pipe(&data, port);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("dp-hpd-after-suspend", DisplayPort)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_MEM,
-						SUSPEND_TEST_NONE);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("dp-hpd-after-hibernate", DisplayPort)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_DISK,
-						SUSPEND_TEST_DEVICES);
-
-		igt_describe(test_hpd_storm_detect_desc);
-		connector_subtest("dp-hpd-storm", DisplayPort)
-			test_hpd_storm_detect(&data, port,
-					      HPD_STORM_PULSE_INTERVAL_DP);
-
-		igt_describe(test_hpd_storm_disable_desc);
-		connector_subtest("dp-hpd-storm-disable", DisplayPort)
-			test_hpd_storm_disable(&data, port,
-					       HPD_STORM_PULSE_INTERVAL_DP);
-	}
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("dp-hpd", DisplayPort, test_hotplug,
+		       HPD_TOGGLE_COUNT_DP_HDMI, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("dp-hpd-fast", DisplayPort, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("dp-hpd-enable-disable-mode", DisplayPort, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("dp-hpd-with-enabled-mode", DisplayPort, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON);
+
+	igt_describe(test_hotplug_for_each_pipe_desc);
+	CONNECTOR_TEST("dp-hpd-for-each-pipe", DisplayPort, test_hotplug_for_each_pipe);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("dp-hpd-after-suspend", DisplayPort, test_suspend_resume_hpd,
+		       SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("dp-hpd-after-hibernate", DisplayPort, test_suspend_resume_hpd,
+		       SUSPEND_STATE_DISK, SUSPEND_TEST_DEVICES);
+
+	igt_describe(test_hpd_storm_detect_desc);
+	CONNECTOR_TEST("dp-hpd-storm", DisplayPort, test_hpd_storm_detect,
+		       HPD_STORM_PULSE_INTERVAL_DP);
+
+	igt_describe(test_hpd_storm_disable_desc);
+	CONNECTOR_TEST("dp-hpd-storm-disable", DisplayPort, test_hpd_storm_disable,
+		       HPD_STORM_PULSE_INTERVAL_DP);
 
 	igt_describe("HDMI tests");
-	igt_subtest_group {
-		igt_fixture {
-			chamelium_require_connector_present(
-				data.ports, DRM_MODE_CONNECTOR_HDMIA,
-				data.port_count, 1);
-		}
 
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("hdmi-hpd", HDMIA)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_DP_HDMI,
-				     TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("hdmi-hpd-fast", HDMIA) test_hotplug(
-			&data, port, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("hdmi-hpd-enable-disable-mode", HDMIA)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("hdmi-hpd-with-enabled-mode", HDMIA)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON);
-
-		igt_describe(test_hotplug_for_each_pipe_desc);
-		connector_subtest("hdmi-hpd-for-each-pipe", HDMIA)
-			test_hotplug_for_each_pipe(&data, port);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("hdmi-hpd-after-suspend", HDMIA)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_MEM,
-						SUSPEND_TEST_NONE);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("hdmi-hpd-after-hibernate", HDMIA)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_DISK,
-						SUSPEND_TEST_DEVICES);
-
-		igt_describe(test_hpd_storm_detect_desc);
-		connector_subtest("hdmi-hpd-storm", HDMIA)
-			test_hpd_storm_detect(&data, port,
-					      HPD_STORM_PULSE_INTERVAL_HDMI);
-
-		igt_describe(test_hpd_storm_disable_desc);
-		connector_subtest("hdmi-hpd-storm-disable", HDMIA)
-			test_hpd_storm_disable(&data, port,
-					       HPD_STORM_PULSE_INTERVAL_HDMI);
-	}
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("hdmi-hpd", HDMIA, test_hotplug,
+		       HPD_TOGGLE_COUNT_DP_HDMI, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("hdmi-hpd-fast", HDMIA, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("hdmi-hpd-enable-disable-mode", HDMIA, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("hdmi-hpd-with-enabled-mode", HDMIA, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON);
+
+	igt_describe(test_hotplug_for_each_pipe_desc);
+	CONNECTOR_TEST("hdmi-hpd-for-each-pipe", HDMIA, test_hotplug_for_each_pipe);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("hdmi-hpd-after-suspend", HDMIA, test_suspend_resume_hpd,
+		       SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("hdmi-hpd-after-hibernate", HDMIA, test_suspend_resume_hpd,
+		       SUSPEND_STATE_DISK, SUSPEND_TEST_DEVICES);
+
+	igt_describe(test_hpd_storm_detect_desc);
+	CONNECTOR_TEST("hdmi-hpd-storm", HDMIA, test_hpd_storm_detect,
+		       HPD_STORM_PULSE_INTERVAL_HDMI);
+
+	igt_describe(test_hpd_storm_disable_desc);
+	CONNECTOR_TEST("hdmi-hpd-storm-disable", HDMIA, test_hpd_storm_disable,
+		       HPD_STORM_PULSE_INTERVAL_HDMI);
 
 	igt_describe("VGA tests");
-	igt_subtest_group {
-		igt_fixture {
-			chamelium_require_connector_present(
-				data.ports, DRM_MODE_CONNECTOR_VGA,
-				data.port_count, 1);
-		}
 
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("vga-hpd", VGA) test_hotplug(
-			&data, port, HPD_TOGGLE_COUNT_VGA, TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("vga-hpd-fast", VGA) test_hotplug(
-			&data, port, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("vga-hpd-enable-disable-mode", VGA)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("vga-hpd-with-enabled-mode", VGA)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("vga-hpd-after-suspend", VGA)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_MEM,
-						SUSPEND_TEST_NONE);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("vga-hpd-after-hibernate", VGA)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_DISK,
-						SUSPEND_TEST_DEVICES);
-
-		igt_describe(test_hpd_without_ddc_desc);
-		connector_subtest("vga-hpd-without-ddc", VGA)
-			test_hpd_without_ddc(&data, port);
-	}
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("vga-hpd", VGA, test_hotplug, HPD_TOGGLE_COUNT_VGA, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("vga-hpd-fast", VGA, test_hotplug, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("vga-hpd-enable-disable-mode", VGA,
+		       test_hotplug, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("vga-hpd-with-enabled-mode", VGA,
+		       test_hotplug, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("vga-hpd-after-suspend", VGA,
+		       test_suspend_resume_hpd, SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("vga-hpd-after-hibernate", VGA,
+		       test_suspend_resume_hpd, SUSPEND_STATE_DISK, SUSPEND_TEST_DEVICES);
+
+	igt_describe(test_hpd_without_ddc_desc);
+	CONNECTOR_TEST("vga-hpd-without-ddc", VGA, test_hpd_without_ddc);
+
+	igt_describe(test_hotplug_for_each_pipe_desc);
+	CONNECTOR_TEST("vga-hpd-for-each-pipe", VGA, test_hotplug_for_each_pipe);
 
 	igt_describe("Tests that operate on all connectors");
 	igt_subtest_group {
@@ -623,7 +580,8 @@ igt_main
 
 		igt_describe(test_suspend_resume_hpd_common_desc);
 		igt_subtest("common-hpd-after-suspend")
-			test_suspend_resume_hpd_common(&data, SUSPEND_STATE_MEM,
+			test_suspend_resume_hpd_common(&data,
+						       SUSPEND_STATE_MEM,
 						       SUSPEND_TEST_NONE);
 
 		igt_describe(test_suspend_resume_hpd_common_desc);
@@ -633,10 +591,6 @@ igt_main
 						       SUSPEND_TEST_DEVICES);
 	}
 
-	igt_describe(test_hotplug_for_each_pipe_desc);
-	connector_subtest("vga-hpd-for-each-pipe", VGA)
-		test_hotplug_for_each_pipe(&data, port);
-
 	igt_fixture {
 		igt_display_fini(&data.display);
 		drm_close_driver(data.drm_fd);
Signature · 1 line
2.48.1
#4 lore raw

Re: [PATCH i-g-t v3 2/2] tests/chamelium/kms_chamelium_hpd: use helper function for connector lookup in DP/HDMI/VGA tests

Hi Mohammad

It looks much better now, but I still have a few minor points that could be improved.

Quoted 6 lines · Mohammed Bilal

Replace the old connector_subtest() + per-connector igt_fixture blocks with a unified CONNECTOR_TEST() helper based on get_port(). The previous fixtures were always executed even when running other subtests, causing false failures when HDMI/VGA/DP connectors were not present.

Using CONNECTOR_TEST() makes each subtest perform its own connector

A lot of definitions in IGT are in lowercase, you may consider changing this one to lowercase as well

Quoted 15 lines

lookup and skip cleanly if unavailable, while removing repeated boilerplate across DP/HDMI/VGA hotplug tests.

---
 tests/chamelium/kms_chamelium_hpd.c | 240 +++++++++++-----------------
 1 file changed, 97 insertions(+), 143 deletions(-)
tests/chamelium/kms_chamelium_hpd.c +0 -0
index 161f494e9..198ec6039 100644
@@ -463,157 +463,114 @@ IGT_TEST_DESCRIPTION("Testing HPD with a Chamelium board");
 igt_main
 {

tests/chamelium/kms_chamelium_hpd.c IGT_TEST_DESCRIPTION("Testing HPD with a Chamelium board"); · line 474

Quoted 10 lines
tests/chamelium/kms_chamelium_hpd.c +0 -3
 	chamelium_data_t data;
-	struct chamelium_port *port;
-	int p;
 
 	igt_fixture {
 		chamelium_init_test(&data);
 	}
 
 	igt_describe("DisplayPort tests");
-	igt_subtest_group {

Does the igt_subtest_group need to be removed?

Quoted 241 lines
tests/chamelium/kms_chamelium_hpd.c +95 -135
-		igt_fixture {
-			chamelium_require_connector_present(
-				data.ports, DRM_MODE_CONNECTOR_DisplayPort,
-				data.port_count, 1);
-		}
 
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("dp-hpd", DisplayPort)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_DP_HDMI,
-				     TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("dp-hpd-fast", DisplayPort) test_hotplug(
-			&data, port, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("dp-hpd-enable-disable-mode", DisplayPort)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("dp-hpd-with-enabled-mode", DisplayPort)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON);
-
-		igt_describe(test_hotplug_for_each_pipe_desc);
-		connector_subtest("dp-hpd-for-each-pipe", DisplayPort)
-			test_hotplug_for_each_pipe(&data, port);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("dp-hpd-after-suspend", DisplayPort)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_MEM,
-						SUSPEND_TEST_NONE);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("dp-hpd-after-hibernate", DisplayPort)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_DISK,
-						SUSPEND_TEST_DEVICES);
-
-		igt_describe(test_hpd_storm_detect_desc);
-		connector_subtest("dp-hpd-storm", DisplayPort)
-			test_hpd_storm_detect(&data, port,
-					      HPD_STORM_PULSE_INTERVAL_DP);
-
-		igt_describe(test_hpd_storm_disable_desc);
-		connector_subtest("dp-hpd-storm-disable", DisplayPort)
-			test_hpd_storm_disable(&data, port,
-					       HPD_STORM_PULSE_INTERVAL_DP);
-	}
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("dp-hpd", DisplayPort, test_hotplug,
+		       HPD_TOGGLE_COUNT_DP_HDMI, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("dp-hpd-fast", DisplayPort, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("dp-hpd-enable-disable-mode", DisplayPort, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("dp-hpd-with-enabled-mode", DisplayPort, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON);
+
+	igt_describe(test_hotplug_for_each_pipe_desc);
+	CONNECTOR_TEST("dp-hpd-for-each-pipe", DisplayPort, test_hotplug_for_each_pipe);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("dp-hpd-after-suspend", DisplayPort, test_suspend_resume_hpd,
+		       SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("dp-hpd-after-hibernate", DisplayPort, test_suspend_resume_hpd,
+		       SUSPEND_STATE_DISK, SUSPEND_TEST_DEVICES);
+
+	igt_describe(test_hpd_storm_detect_desc);
+	CONNECTOR_TEST("dp-hpd-storm", DisplayPort, test_hpd_storm_detect,
+		       HPD_STORM_PULSE_INTERVAL_DP);
+
+	igt_describe(test_hpd_storm_disable_desc);
+	CONNECTOR_TEST("dp-hpd-storm-disable", DisplayPort, test_hpd_storm_disable,
+		       HPD_STORM_PULSE_INTERVAL_DP);
 
 	igt_describe("HDMI tests");
-	igt_subtest_group {
-		igt_fixture {
-			chamelium_require_connector_present(
-				data.ports, DRM_MODE_CONNECTOR_HDMIA,
-				data.port_count, 1);
-		}
 
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("hdmi-hpd", HDMIA)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_DP_HDMI,
-				     TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("hdmi-hpd-fast", HDMIA) test_hotplug(
-			&data, port, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("hdmi-hpd-enable-disable-mode", HDMIA)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("hdmi-hpd-with-enabled-mode", HDMIA)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON);
-
-		igt_describe(test_hotplug_for_each_pipe_desc);
-		connector_subtest("hdmi-hpd-for-each-pipe", HDMIA)
-			test_hotplug_for_each_pipe(&data, port);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("hdmi-hpd-after-suspend", HDMIA)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_MEM,
-						SUSPEND_TEST_NONE);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("hdmi-hpd-after-hibernate", HDMIA)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_DISK,
-						SUSPEND_TEST_DEVICES);
-
-		igt_describe(test_hpd_storm_detect_desc);
-		connector_subtest("hdmi-hpd-storm", HDMIA)
-			test_hpd_storm_detect(&data, port,
-					      HPD_STORM_PULSE_INTERVAL_HDMI);
-
-		igt_describe(test_hpd_storm_disable_desc);
-		connector_subtest("hdmi-hpd-storm-disable", HDMIA)
-			test_hpd_storm_disable(&data, port,
-					       HPD_STORM_PULSE_INTERVAL_HDMI);
-	}
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("hdmi-hpd", HDMIA, test_hotplug,
+		       HPD_TOGGLE_COUNT_DP_HDMI, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("hdmi-hpd-fast", HDMIA, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("hdmi-hpd-enable-disable-mode", HDMIA, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("hdmi-hpd-with-enabled-mode", HDMIA, test_hotplug,
+		       HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON);
+
+	igt_describe(test_hotplug_for_each_pipe_desc);
+	CONNECTOR_TEST("hdmi-hpd-for-each-pipe", HDMIA, test_hotplug_for_each_pipe);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("hdmi-hpd-after-suspend", HDMIA, test_suspend_resume_hpd,
+		       SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("hdmi-hpd-after-hibernate", HDMIA, test_suspend_resume_hpd,
+		       SUSPEND_STATE_DISK, SUSPEND_TEST_DEVICES);
+
+	igt_describe(test_hpd_storm_detect_desc);
+	CONNECTOR_TEST("hdmi-hpd-storm", HDMIA, test_hpd_storm_detect,
+		       HPD_STORM_PULSE_INTERVAL_HDMI);
+
+	igt_describe(test_hpd_storm_disable_desc);
+	CONNECTOR_TEST("hdmi-hpd-storm-disable", HDMIA, test_hpd_storm_disable,
+		       HPD_STORM_PULSE_INTERVAL_HDMI);
 
 	igt_describe("VGA tests");
-	igt_subtest_group {
-		igt_fixture {
-			chamelium_require_connector_present(
-				data.ports, DRM_MODE_CONNECTOR_VGA,
-				data.port_count, 1);
-		}
 
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("vga-hpd", VGA) test_hotplug(
-			&data, port, HPD_TOGGLE_COUNT_VGA, TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("vga-hpd-fast", VGA) test_hotplug(
-			&data, port, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("vga-hpd-enable-disable-mode", VGA)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON_OFF);
-
-		igt_describe(test_basic_hotplug_desc);
-		connector_subtest("vga-hpd-with-enabled-mode", VGA)
-			test_hotplug(&data, port, HPD_TOGGLE_COUNT_FAST,
-				     TEST_MODESET_ON);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("vga-hpd-after-suspend", VGA)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_MEM,
-						SUSPEND_TEST_NONE);
-
-		igt_describe(test_suspend_resume_hpd_desc);
-		connector_subtest("vga-hpd-after-hibernate", VGA)
-			test_suspend_resume_hpd(&data, port, SUSPEND_STATE_DISK,
-						SUSPEND_TEST_DEVICES);
-
-		igt_describe(test_hpd_without_ddc_desc);
-		connector_subtest("vga-hpd-without-ddc", VGA)
-			test_hpd_without_ddc(&data, port);
-	}
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("vga-hpd", VGA, test_hotplug, HPD_TOGGLE_COUNT_VGA, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("vga-hpd-fast", VGA, test_hotplug, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("vga-hpd-enable-disable-mode", VGA,
+		       test_hotplug, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON_OFF);
+
+	igt_describe(test_basic_hotplug_desc);
+	CONNECTOR_TEST("vga-hpd-with-enabled-mode", VGA,
+		       test_hotplug, HPD_TOGGLE_COUNT_FAST, TEST_MODESET_ON);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("vga-hpd-after-suspend", VGA,
+		       test_suspend_resume_hpd, SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
+
+	igt_describe(test_suspend_resume_hpd_desc);
+	CONNECTOR_TEST("vga-hpd-after-hibernate", VGA,
+		       test_suspend_resume_hpd, SUSPEND_STATE_DISK, SUSPEND_TEST_DEVICES);
+
+	igt_describe(test_hpd_without_ddc_desc);
+	CONNECTOR_TEST("vga-hpd-without-ddc", VGA, test_hpd_without_ddc);
+
+	igt_describe(test_hotplug_for_each_pipe_desc);
+	CONNECTOR_TEST("vga-hpd-for-each-pipe", VGA, test_hotplug_for_each_pipe);
 
 	igt_describe("Tests that operate on all connectors");
 	igt_subtest_group {

tests/chamelium/kms_chamelium_hpd.c igt_main · line 584

Quoted 6 lines
tests/chamelium/kms_chamelium_hpd.c +2 -1
@@ -623,7 +580,8 @@ igt_main
 
 		igt_describe(test_suspend_resume_hpd_common_desc);
 		igt_subtest("common-hpd-after-suspend")
-			test_suspend_resume_hpd_common(&data, SUSPEND_STATE_MEM,
+			test_suspend_resume_hpd_common(&data,
+						       SUSPEND_STATE_MEM,

Please, do not add newlines like this. Maintain the current formatting.

BR,
Seba

#5 lore raw

✗ Fi.CI.BUILD: failure for Fix chamelium port allocation during igt_fixture

In reply to Mohammed Bilal
== Series Details ==

== Series Details ==

Series: Fix chamelium port allocation during igt_fixture
URL : https://patchwork.freedesktop.org/series/158705/
State : failure

== Summary ==

Applying: lib/igt_chamelium: add get_port() helper and CONNECTOR_TEST macro
Applying: tests/chamelium/kms_chamelium_hpd: use helper function for connector lookup in DP/HDMI/VGA tests Using index info to reconstruct a base tree...
M tests/chamelium/kms_chamelium_hpd.c
Falling back to patching base and 3-way merge...
Auto-merging tests/chamelium/kms_chamelium_hpd.c
CONFLICT (content): Merge conflict in tests/chamelium/kms_chamelium_hpd.c
Patch failed at 0002 tests/chamelium/kms_chamelium_hpd: use helper function for connector lookup in DP/HDMI/VGA tests When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

#6 lore raw
In reply to Mohammed Bilal
Quoted 9 lines

-----Original Message-----
From: Bilal, Mohammed <[email protected]>
Sent: Tuesday, December 9, 2025 8:54 PM
To: [email protected]
Cc: B, Jeevan <[email protected]>; Joshi, Kunal1 <[email protected]>; Lattannavar, Sameer <[email protected]>; B S, Karthik <[email protected]>; Bilal, Mohammed <[email protected]>
Subject: [PATCH i-g-t v3 0/2] Fix chamelium port allocation during igt_fixture

Quoted 5 lines

The current fixture implementation executes even for unrelated subtests, causing false failures when expected inputs were not present. Refactor the DP/HDMI/VGA hotplug tests to use a common connector lookup pattern so that each test skips cleanly.

What is change in v2:
Also document these specifically for each patch.

Quoted 18 lines

v3:
- Introduce a unified connector test macro (Sebastien)
- Remove unused variable (Sebastien)
- Drop per-connector fixture usage (Sebastien)
- Refactor DP/HDMI/VGA hotplug tests (Sebastien)

Mohammed Bilal (2):
lib/igt_chamelium: add get_port() helper and CONNECTOR_TEST macro tests/chamelium/kms_chamelium_hpd: use helper function for connector
lookup in DP/HDMI/VGA tests

 lib/igt_chamelium.c                 |  10 ++
 lib/igt_chamelium.h                 |  18 +++
 tests/chamelium/kms_chamelium_hpd.c | 240 +++++++++++-----------------
 3 files changed, 125 insertions(+), 143 deletions(-)

--
2.48.1