[PATCH i-g-t v3 5/5] tests/chamelium/v3: Implement a basic Chamelium v3 accessibility test

Louis Chauvet louis.chauvet at bootlin.com
Tue Oct 22 16:31:54 UTC 2024


Utilizing the RPC calls introduced earlier, this commit adds a simple test
to verify if the Chamelium v3 device is accessible.

Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
 tests/chamelium/v3/kms_chamelium_v3_basic.c | 30 +++++++++++++++++++++++++++++
 tests/meson.build                           |  1 +
 2 files changed, 31 insertions(+)

diff --git a/tests/chamelium/v3/kms_chamelium_v3_basic.c b/tests/chamelium/v3/kms_chamelium_v3_basic.c
new file mode 100644
index 000000000000..4d48e68e2936
--- /dev/null
+++ b/tests/chamelium/v3/kms_chamelium_v3_basic.c
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: MIT
+
+#include <igt.h>
+#include "chamelium/v3/igt_chamelium.h"
+
+igt_main
+{
+	struct igt_chamelium_v3 *chamelium;
+
+	igt_describe("Test if the chamelium can list all the ports.");
+	igt_subtest("chamelium-list-ports") {
+		chamelium_v3_port_id *ports;
+		int port_count;
+
+		chamelium = chamelium_v3_init_from_config();
+
+		port_count = chamelium_v3_get_supported_ports(chamelium, &ports);
+
+		for (int i = 0; i < port_count; i++) {
+			char *name = chamelium_v3_get_port_name(chamelium, ports[i]);
+
+			igt_info("Port %d: name: %s\n", ports[i], name);
+			free(name);
+		}
+
+		free(ports);
+
+		chamelium_v3_uninit(chamelium);
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index 861101c2534e..9ddf906723e8 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -341,6 +341,7 @@ chamelium_v2_progs = [
 ]
 
 chamelium_v3_progs = [
+	'kms_chamelium_v3_basic',
 ]
 
 test_deps = [ igt_deps ]

-- 
2.46.2



More information about the igt-dev mailing list