Skip to content

Commit fd85294

Browse files
committed
zephyr: test: userspace: add a test for pipeline_new()
Add a simple test to allocate a pipeline using a user-space memory heap and verify creation is successful. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 4946982 commit fd85294

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

zephyr/test/userspace/test_ll_task.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <sof/schedule/schedule.h>
1414
#include <sof/schedule/ll_schedule.h>
1515
#include <sof/schedule/ll_schedule_domain.h>
16+
#include <sof/audio/pipeline.h>
1617
#include <rtos/task.h>
1718
#include <rtos/userspace_helper.h>
1819
#include <ipc4/fw_reg.h>
@@ -94,6 +95,40 @@ ZTEST(userspace_ll, ll_task_test)
9495
ll_task_test();
9596
}
9697

98+
static void pipeline_check(void)
99+
{
100+
struct pipeline *p;
101+
struct k_heap *heap;
102+
uint32_t pipeline_id = 1;
103+
uint32_t priority = 5;
104+
uint32_t comp_id = 10;
105+
int ret;
106+
107+
heap = zephyr_ll_user_heap();
108+
zassert_not_null(heap, "user heap not found");
109+
110+
/* Create pipeline on user heap */
111+
p = pipeline_new(heap, pipeline_id, priority, comp_id, NULL);
112+
zassert_not_null(p, "pipeline creation failed");
113+
114+
/* Verify heap assignment */
115+
zassert_equal(p->heap, heap, "pipeline heap not equal to user heap");
116+
117+
/* Verify pipeline properties */
118+
zassert_equal(p->pipeline_id, pipeline_id, "pipeline id mismatch");
119+
zassert_equal(p->priority, priority, "priority mismatch");
120+
zassert_equal(p->comp_id, comp_id, "comp id mismatch");
121+
122+
/* Free pipeline */
123+
ret = pipeline_free(p);
124+
zassert_ok(ret, "pipeline free failed");
125+
}
126+
127+
ZTEST(userspace_ll, pipeline_check)
128+
{
129+
pipeline_check();
130+
}
131+
97132
ZTEST_SUITE(userspace_ll, NULL, NULL, NULL, NULL, NULL);
98133

99134
/**

0 commit comments

Comments
 (0)