From 5975fabd9f835e6210cc83990fa17439ce72d2f8 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Mon, 22 Feb 2021 12:37:04 +0100 Subject: [PATCH] tests/shell: add tests for XFA shell commands --- tests/shell/main.c | 24 ++++++++++++++++++++++++ tests/shell/tests/01-run.py | 8 +++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/shell/main.c b/tests/shell/main.c index 376b6e7008..58924fd6a3 100644 --- a/tests/shell/main.c +++ b/tests/shell/main.c @@ -103,6 +103,30 @@ static const shell_command_t shell_commands[] = { { NULL, NULL, NULL } }; +static int _xfa_test1(int argc, char **argv) +{ + (void) argc; + (void) argv; + printf("[XFA TEST 1 OK]\n"); + + return 0; +} + +static int _xfa_test2(int argc, char **argv) +{ + (void) argc; + (void) argv; + printf("[XFA TEST 2 OK]\n"); + + return 0; +} + +/* Add above commands to the shell commands XFA using helper macro. + * Intentionally reversed order to test linker script based alphanumeric + * ordering. */ +SHELL_COMMAND(xfa_test2, "xfa test command 2",_xfa_test2); +SHELL_COMMAND(xfa_test1, "xfa test command 1",_xfa_test1); + int main(void) { printf("test_shell.\n"); diff --git a/tests/shell/tests/01-run.py b/tests/shell/tests/01-run.py index 967eda74ea..a4b423ad8d 100755 --- a/tests/shell/tests/01-run.py +++ b/tests/shell/tests/01-run.py @@ -19,7 +19,9 @@ EXPECTED_HELP = ( 'echo prints the input command', 'reboot Reboot the node', 'ps Prints information about running threads.', - 'app_metadata Returns application metadata' + 'app_metadata Returns application metadata', + 'xfa_test1 xfa test command 1', + 'xfa_test2 xfa test command 2' ) EXPECTED_PS = ( @@ -96,6 +98,10 @@ CMDS = ( ('ps', EXPECTED_PS), ('help', EXPECTED_HELP), + # test commands added to shell_commands_xfa + ('xfa_test1', '[XFA TEST 1 OK]'), + ('xfa_test2', '[XFA TEST 2 OK]'), + # test reboot ('reboot', 'test_shell.'),