diff --git a/tests/event_threads/Makefile b/tests/event_threads/Makefile new file mode 100644 index 0000000000..291264de49 --- /dev/null +++ b/tests/event_threads/Makefile @@ -0,0 +1,8 @@ +include ../Makefile.tests_common + +USEMODULE += event_thread_highest event_thread_medium event_thread_lowest + +# arm7 has an issue with it's ISR_STACKSIZE define +FEATURES_BLACKLIST += arch_arm7 + +include $(RIOTBASE)/Makefile.include diff --git a/tests/event_threads/Makefile.ci b/tests/event_threads/Makefile.ci new file mode 100644 index 0000000000..8a0aef2b9e --- /dev/null +++ b/tests/event_threads/Makefile.ci @@ -0,0 +1,8 @@ +BOARD_INSUFFICIENT_MEMORY := \ + arduino-duemilanove \ + arduino-nano \ + arduino-uno \ + atmega328p \ + nucleo-f031k6 \ + stm32f030f4-demo \ + # diff --git a/tests/event_threads/main.c b/tests/event_threads/main.c new file mode 100644 index 0000000000..88920d1c55 --- /dev/null +++ b/tests/event_threads/main.c @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2020 Kaspar Schleiser + * 2020 Freie Universität Berlin + * 2020 Inria + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup tests + * @{ + * + * @file + * @brief Event threads test application + * + * @author Kaspar Schleiser + * + * @} + */ + +#include + +#include "thread.h" +#include "event/thread.h" + +static void _handler_high(event_t *event) { + (void)event; + puts("high"); +} + +static event_t event_high = { .handler=_handler_high }; + +static void _handler_medium(event_t *event) { + (void)event; + puts("medium"); +} + +static event_t event_medium = { .handler=_handler_medium }; + +static void _handler_low(event_t *event) { + (void)event; + puts("low"); +} + +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"); + + return 0; +} diff --git a/tests/event_threads/tests/01-run.py b/tests/event_threads/tests/01-run.py new file mode 100755 index 0000000000..3a731093d0 --- /dev/null +++ b/tests/event_threads/tests/01-run.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import sys +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('low\r\n') + + +if __name__ == "__main__": + sys.exit(run(testfunc))