forked from RIOT-OS/RIOT
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Taken and simplified from shell test.
- Loading branch information
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
include ../Makefile.tests_common | ||
|
||
USEMODULE += shell | ||
USEMODULE += shell_democommands | ||
|
||
FEATURES_REQUIRED += rust_target | ||
|
||
# Currently unknown, something related to the LED_PORT definition that doesn't | ||
# pass C2Rust's transpilation | ||
BOARD_BLACKLIST := ek-lm4f120xl | ||
|
||
include $(RIOTBASE)/Makefile.include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
BOARD_INSUFFICIENT_MEMORY := \ | ||
nucleo-f031k6 \ | ||
nucleo-f042k6 \ | ||
nucleo-l011k4 \ | ||
nucleo-l031k6 \ | ||
samd10-xmini \ | ||
stk3200 \ | ||
stm32f030f4-demo \ | ||
stm32g0316-disco \ | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../shell/main.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (C) 2017 Alexandre Abadie <[email protected]> | ||
# 2022 Christian Amsüss <[email protected]> | ||
# | ||
# 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. | ||
|
||
import sys | ||
from testrunner import run | ||
|
||
|
||
EXPECTED_HELP = ( | ||
'Command Description', | ||
'---------------------------------------', | ||
'bufsize Get the shell\'s buffer size', | ||
'start_test starts a test', | ||
'end_test ends a test', | ||
'echo prints the input command', | ||
'empty print nothing on command', | ||
'hello_world Print a greeting', | ||
'xfa_test1 xfa test command 1', | ||
'xfa_test2 xfa test command 2', | ||
) | ||
|
||
PROMPT = '> ' | ||
|
||
CMDS = ( | ||
('start_test', '[TEST_START]'), | ||
|
||
# test default commands | ||
('help', EXPECTED_HELP), | ||
|
||
('end_test', '[TEST_END]'), | ||
) | ||
|
||
CMDS_REGEX = {'ps.rs'} | ||
|
||
|
||
def check_cmd(child, cmd, expected): | ||
regex = cmd in CMDS_REGEX | ||
child.expect(PROMPT) | ||
child.sendline(cmd) | ||
for line in expected: | ||
if regex: | ||
child.expect(line) | ||
else: | ||
child.expect_exact(line) | ||
|
||
|
||
def testfunc(child): | ||
# loop other defined commands and expected output | ||
for cmd, expected in CMDS: | ||
check_cmd(child, cmd, expected) | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(run(testfunc)) |