Skip to content
Snippets Groups Projects
Commit 38aecf2b authored by Yegor Yefremov's avatar Yegor Yefremov
Browse files

tests/periph_uart: adapt main.c for automated testing


This is an effort to automate UART testing using the same framework as
was already introduced for i2c. The framework relies on shell commands
to return invocation status and data in a special way:

1. Invocation status: Success or Error
2. Data inside the []

Hence this patch adds invocation status to the UART init command and
invocation status and data to the printer.

Signed-off-by: default avatarYegor Yefremov <yegorslists@googlemail.com>
parent 3b1e4f54
No related branches found
No related tags found
No related merge requests found
...@@ -91,11 +91,11 @@ static void *printer(void *arg) ...@@ -91,11 +91,11 @@ static void *printer(void *arg)
uart_t dev = (uart_t)msg.content.value; uart_t dev = (uart_t)msg.content.value;
char c; char c;
printf("UART_DEV(%i) RX: ", dev); printf("Success: UART_DEV(%i) RX: [", dev);
do { do {
c = (int)ringbuffer_get_one(&(ctx[dev].rx_buf)); c = (int)ringbuffer_get_one(&(ctx[dev].rx_buf));
if (c == '\n') { if (c == '\n') {
puts("\\n"); puts("]\\n");
} }
else if (c >= ' ' && c <= '~') { else if (c >= ' ' && c <= '~') {
printf("%c", c); printf("%c", c);
...@@ -145,7 +145,7 @@ static int cmd_init(int argc, char **argv) ...@@ -145,7 +145,7 @@ static int cmd_init(int argc, char **argv)
puts("Error: Unable to initialize UART device\n"); puts("Error: Unable to initialize UART device\n");
return 1; return 1;
} }
printf("Successfully initialized UART_DEV(%i)\n", dev); printf("Success: Successfully initialized UART_DEV(%i)\n", dev);
/* also test if poweron() and poweroff() work (or at least don't break /* also test if poweron() and poweroff() work (or at least don't break
* anything) */ * anything) */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment