Skip to content

Commit 52b8e3d

Browse files
kietavainenkartben
authored andcommitted
tests: kernel: metairq: Ensure meta-IRQ can preempt a cooperative thread
The intention of the test is to have a meta-IRQ preempt a cooperative thread, then ensure the same cooperative thread is resumed back to instead of a higher priority thread. Thus, the test needs to assert that the lower priority cooperative thread is not yet complete when it makes the higher priority thread ready to run. This change reveals bugs like #80574, where the meta-IRQ is unable to preempt a cooperative thread. Signed-off-by: Kalle Kietäväinen <[email protected]>
1 parent d929b8a commit 52b8e3d

File tree

1 file changed

+6
-0
lines changed
  • tests/kernel/sched/metairq/src

1 file changed

+6
-0
lines changed

tests/kernel/sched/metairq/src/main.c

+6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ void metairq_thread(void *p1, void *p2, void *p3)
7777

7878
k_msleep(WAIT_MS);
7979

80+
zassert_not_equal(coop_cnt2, LOOP_CNT, "thread2 wasn't preempted");
81+
8082
printk("give sem1\n");
8183
k_sem_give(&coop_sem1);
8284

@@ -113,6 +115,8 @@ void coop_thread1(void *p1, void *p2, void *p3)
113115
cnt2 = coop_cnt2;
114116
zassert_equal(cnt2, LOOP_CNT, "Unexpected cnt2 at end: %d", cnt2);
115117

118+
printk("thread1 end\n");
119+
116120
k_sem_give(&coop_sem1);
117121
}
118122

@@ -155,6 +159,8 @@ void coop_thread2(void *p1, void *p2, void *p3)
155159
cnt2 = coop_cnt2;
156160
zassert_equal(cnt2, LOOP_CNT, "Unexpected cnt2 at end: %d", cnt2);
157161

162+
printk("thread2 end\n");
163+
158164
k_sem_give(&coop_sem2);
159165
}
160166

0 commit comments

Comments
 (0)