diff mbox series

[13/13] unit: Add unit test for QRTR dedicated services

Message ID 20240624193315.1164943-13-denkenz@gmail.com (mailing list archive)
State Superseded
Headers show
Series [01/13] qmi: Introduce SERVICE_VERSION macro | expand

Commit Message

Denis Kenzior June 24, 2024, 7:32 p.m. UTC
---
 unit/test-qmimodem-qmi.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
diff mbox series

Patch

diff --git a/unit/test-qmimodem-qmi.c b/unit/test-qmimodem-qmi.c
index 2ff981391849..f647a025474e 100644
--- a/unit/test-qmimodem-qmi.c
+++ b/unit/test-qmimodem-qmi.c
@@ -566,6 +566,32 @@  static void test_service_notification_independence(const void *data)
 	test_cleanup(info);
 }
 
+static void test_dedicated(const void *data)
+{
+	struct test_info *info = test_setup();
+	struct l_io *io;
+	uint32_t service_type;
+	struct qmi_service *service;
+
+	perform_lookup(info);
+
+	service_type = unique_service_type(0); /* Use the first service */
+	service = qmi_qrtr_node_get_dedicated_service(info->node, service_type);
+	assert(service);
+
+	io = l_io_new(info->service_fds[0]);
+	assert(io);
+	l_io_set_read_handler(io, received_data, info, NULL);
+
+	send_request_via_qmi(info, service);
+	send_response_to_client(info, io);
+
+	l_io_destroy(io);
+	qmi_service_free(service);
+
+	test_cleanup(info);
+}
+
 static void exit_if_qrtr_not_supported(void)
 {
 	int fd;
@@ -598,6 +624,7 @@  int main(int argc, char **argv)
 	l_test_add("QRTR notifications", test_notifications, NULL);
 	l_test_add("QRTR service notifications are independent",
 				test_service_notification_independence, NULL);
+	l_test_add("QRTR dedicated service", test_dedicated, NULL);
 	result = l_test_run();
 
 	__ofono_log_cleanup();