Skip to content

Commit ee44416

Browse files
ubiedadanieldegrasse
authored andcommitted
tests: rtio: workq: Add test-case for same-prio items
Processed on separate worker threads. This test is expected to fail as the P4WQ limits the number of active items assigned to worker threads to the number of CPU cores the system has. Signed-off-by: Luis Ubieda <luisf@croxel.com>
1 parent 3e9eea2 commit ee44416

File tree

1 file changed

+33
-0
lines changed
  • tests/subsys/rtio/workq/src

1 file changed

+33
-0
lines changed

tests/subsys/rtio/workq/src/main.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,39 @@ ZTEST(rtio_work, test_work_supports_batching_submissions)
128128
rtio_cqe_release(&r_test, cqe);
129129
}
130130

131+
ZTEST(rtio_work, test_work_supports_working_same_prio_items_on_separate_threads)
132+
{
133+
struct rtio_sqe *sqe_a;
134+
struct rtio_sqe *sqe_b;
135+
struct rtio_cqe *cqe;
136+
137+
sqe_a = rtio_sqe_acquire(&r_test);
138+
rtio_sqe_prep_nop(sqe_a, &dummy_iodev, &work_handler_sem_1);
139+
sqe_a->prio = RTIO_PRIO_NORM;
140+
141+
sqe_b = rtio_sqe_acquire(&r_test_2);
142+
rtio_sqe_prep_nop(sqe_b, &dummy_iodev_2, &work_handler_sem_2);
143+
sqe_b->prio = RTIO_PRIO_NORM;
144+
145+
zassert_ok(rtio_submit(&r_test, 0));
146+
zassert_ok(rtio_submit(&r_test_2, 0));
147+
148+
zassert_equal(2, work_handler_called);
149+
zassert_equal(2, rtio_work_req_used_count_get());
150+
151+
k_sem_give(&work_handler_sem_1);
152+
k_sem_give(&work_handler_sem_2);
153+
154+
zassert_equal(2, work_handler_called);
155+
zassert_equal(0, rtio_work_req_used_count_get());
156+
157+
/** Clean-up */
158+
cqe = rtio_cqe_consume_block(&r_test);
159+
rtio_cqe_release(&r_test, cqe);
160+
cqe = rtio_cqe_consume_block(&r_test_2);
161+
rtio_cqe_release(&r_test_2, cqe);
162+
}
163+
131164
ZTEST(rtio_work, test_work_supports_preempting_on_higher_prio_submissions)
132165
{
133166
struct rtio_sqe *sqe_a;

0 commit comments

Comments
 (0)