tests/event_threads: spice up test a bit
By posting a higher priority event from the event handlers prior to printing, we can verify that an event handler is indeed preempted by a higher priority event.
This commit is contained in:
parent
a11514a198
commit
955b1f5be8
@ -34,6 +34,7 @@ static event_t event_high = { .handler=_handler_high };
|
||||
|
||||
static void _handler_medium(event_t *event) {
|
||||
(void)event;
|
||||
event_post(EVENT_PRIO_HIGHEST, &event_high);
|
||||
puts("medium");
|
||||
}
|
||||
|
||||
@ -41,6 +42,7 @@ static event_t event_medium = { .handler=_handler_medium };
|
||||
|
||||
static void _handler_low(event_t *event) {
|
||||
(void)event;
|
||||
event_post(EVENT_PRIO_MEDIUM, &event_medium);
|
||||
puts("low");
|
||||
}
|
||||
|
||||
@ -49,8 +51,6 @@ static event_t event_low = { .handler=_handler_low };
|
||||
int main(void)
|
||||
{
|
||||
event_post(EVENT_PRIO_LOWEST, &event_low);
|
||||
event_post(EVENT_PRIO_MEDIUM, &event_medium);
|
||||
event_post(EVENT_PRIO_HIGHEST, &event_high);
|
||||
|
||||
puts("main done");
|
||||
|
||||
|
||||
@ -5,9 +5,9 @@ from testrunner import run
|
||||
|
||||
|
||||
def testfunc(child):
|
||||
child.expect_exact('medium\r\n')
|
||||
child.expect_exact('high\r\n')
|
||||
child.expect_exact('main done\r\n')
|
||||
child.expect_exact('high\r\n')
|
||||
child.expect_exact('medium\r\n')
|
||||
child.expect_exact('low\r\n')
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user