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.
This commit is contained in:
Ivan Grokhotkov 2022-05-02 20:46:41 +02:00
parent 77b754b47f
commit 89e78976ab
No known key found for this signature in database
GPG Key ID: 1E050E141B280628

View File

@ -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;
}