aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Schrock <steve.schrock@getcruise.com>2024-04-19 16:44:56 +0000
committerDenis Kenzior <denkenz@gmail.com>2024-04-22 11:22:57 -0500
commitaf2718346a2825e2264d9ca7fd63f13b3f1ff479 (patch)
treeffba8d13a5e5b59b9ab130eb7706cd6f9855d576
parente13fb8f498cc9665cf1c077eb61872f2119c71c3 (diff)
downloadofono-af2718346a2825e2264d9ca7fd63f13b3f1ff479.tar.gz
qmi unit: Validate creation of services of the same type
Confirm that there are no problems when clients create services for the same qmi type.
-rw-r--r--unit/test-qmimodem-qmi.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/unit/test-qmimodem-qmi.c b/unit/test-qmimodem-qmi.c
index 0e15f898f..8df8b56a7 100644
--- a/unit/test-qmimodem-qmi.c
+++ b/unit/test-qmimodem-qmi.c
@@ -221,8 +221,9 @@ static void perform_all_pending_work(void)
static void test_create_services(const void *data)
{
struct test_info *info = test_setup();
+ struct qmi_service *services[3];
uint32_t service_type;
- int i;
+ size_t i;
perform_discovery(info);
@@ -256,6 +257,22 @@ static void test_create_services(const void *data)
perform_all_pending_work();
assert(l_queue_isempty(info->services));
+ /* Confirm that multiple services may be created for the same type */
+ service_type = unique_service_type(0);
+
+ for (i = 0; i < L_ARRAY_SIZE(services); i++) {
+ assert(qmi_service_create(info->device, service_type,
+ create_service_cb, info, NULL));
+ perform_all_pending_work();
+
+ assert(l_queue_length(info->services) == 1);
+ services[i] = l_queue_pop_head(info->services);
+ assert(services[i]);
+ }
+
+ for (i = 0; i < L_ARRAY_SIZE(services); i++)
+ qmi_service_unref(services[i]);
+
test_cleanup(info);
}