From 89e78976ab9344cfa6b403961c320aea1b8cdbd1 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 2 May 2022 20:46:41 +0200 Subject: [PATCH] tests: panic: make 'get_test_name' work without VFS, add echo When vfs component is not added to the build, bare minimum syscalls are provided by newlib component. These syscalls currently don't perform CR/LF translation. This commit makes the 'get_test_name' function work with minimal syscalls and also adds echo, so that the user sees what they type. --- tools/test_apps/system/panic/main/test_panic_main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/test_apps/system/panic/main/test_panic_main.c b/tools/test_apps/system/panic/main/test_panic_main.c index f533a892f7..85e3d5bfbd 100644 --- a/tools/test_apps/system/panic/main/test_panic_main.c +++ b/tools/test_apps/system/panic/main/test_panic_main.c @@ -194,12 +194,17 @@ static const char* get_test_name(void) c = getchar(); if (c == EOF) { vTaskDelay(pdMS_TO_TICKS(10)); - } else if (c == '\r') { - continue; - } else if (c == '\n') { + } else if ((c == '\r' || c == '\n') && p != test_name_str) { + /* terminate the line */ + puts("\n\r"); + fflush(stdout); *p = '\0'; break; } else { + /* echo the received character */ + putchar(c); + fflush(stdout); + /* and save it */ *p = c; ++p; }