diff options
| author | Paul Sokolovsky | 2017-12-15 12:10:39 +0200 |
|---|---|---|
| committer | Paul Sokolovsky | 2017-12-15 12:10:39 +0200 |
| commit | 6b19520a743ddafcdd1881582d4c90a9ea068610 (patch) | |
| tree | 454cb55fe93f52c5ed9af1e5701dd02cde9c848f /ports/zephyr/main.c | |
| parent | 103eeffcd925891867916c6f7d23dcbb098c59fe (diff) | |
zephyr: Add support for binary with builtin testsuite.
If TEST is defined, file it refers to will be used as the testsuite
source (should be generated with tools/tinytest-codegen.py).
"make-bin-testsuite" script is introduce to build such a binary.
Diffstat (limited to 'ports/zephyr/main.c')
| -rw-r--r-- | ports/zephyr/main.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ports/zephyr/main.c b/ports/zephyr/main.c index d6ddc65cc..8c64fdcee 100644 --- a/ports/zephyr/main.c +++ b/ports/zephyr/main.c @@ -41,6 +41,13 @@ #include "lib/utils/pyexec.h" #include "lib/mp-readline/readline.h" +#ifdef TEST +#include "lib/upytesthelper/upytesthelper.h" +#include "lib/tinytest/tinytest.c" +#include "lib/upytesthelper/upytesthelper.c" +#include TEST +#endif + static char *stack_top; static char heap[MICROPY_HEAP_SIZE]; @@ -95,6 +102,14 @@ int real_main(void) { init_zephyr(); + #ifdef TEST + static const char *argv[] = {"test"}; + upytest_set_heap(heap, heap + sizeof(heap)); + int r = tinytest_main(1, argv, groups); + printf("status: %d\n", r); + return 0; + #endif + soft_reset: #if MICROPY_ENABLE_GC gc_init(heap, heap + sizeof(heap)); |
