mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
abb666bf73
Before the test used the `help` command to verify that access to the shell is present. While this does have the benefit of not requiring a custom command, it does have some robustness issues: - When new default commands get added, this test will fail - When the help message of a command gets reworded, the test will fail - When the order of commands in the test will change, the test will fail - Note that with the XFA based `SHELL_COMMAND()` macro, we do not guarantee any particular order. Specifically, the order can change with implementation details.
52 lines
1.0 KiB
C
52 lines
1.0 KiB
C
/*
|
|
* Copyright (C) 2021 Freie Universität Berlin
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
* directory for more details.
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* @brief Test for the lock behaviour of the shell
|
|
*
|
|
* @author Hendrik van Essen <hendrik.ve@fu-berlin.de>
|
|
*
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "shell.h"
|
|
|
|
#include "test_utils/interactive_sync.h"
|
|
|
|
/* this command is used by the test automation to check whether commands are
|
|
* executed or not (due to the shell being locked). */
|
|
static int _cmd_ping(int argc, char **argv)
|
|
{
|
|
if (argc != 1) {
|
|
printf("Usage: %s\n", argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
puts("PONG!");
|
|
return 0;
|
|
}
|
|
|
|
SHELL_COMMAND(ping, "Echo \"PONG!\"", _cmd_ping);
|
|
|
|
int main(void)
|
|
{
|
|
test_utils_interactive_sync();
|
|
|
|
puts("test_shell_lock");
|
|
|
|
/* define buffer to be used by the shell */
|
|
char line_buf[SHELL_DEFAULT_BUFSIZE];
|
|
|
|
/* start shell */
|
|
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
|
|
|
|
return 0;
|
|
}
|