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:
Marian Buschsieweke 2020-11-18 20:43:36 +01:00
parent a11514a198
commit 955b1f5be8
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
2 changed files with 4 additions and 4 deletions

View File

@ -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");

View File

@ -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')