1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests/turo_txt: Add turo_txt tests

This commit is contained in:
MrKevinWeiss 2021-11-22 09:30:01 +01:00
parent 7ab6729b04
commit 4337f97662
No known key found for this signature in database
GPG Key ID: 3514539D7808D123
5 changed files with 71 additions and 0 deletions

7
tests/turo_txt/Makefile Normal file
View File

@ -0,0 +1,7 @@
include ../Makefile.tests_common
USEMODULE += test_utils_result_output
USEMODULE += test_utils_result_output_txt
USEMODULE += shell
include $(RIOTBASE)/Makefile.include

4
tests/turo_txt/README.md Normal file
View File

@ -0,0 +1,4 @@
# TURO (Test Utils Result Output) Test - TXT
This is only to test the txt variant of turo.
Please check [the turo test](../turo) for more info.

View File

@ -0,0 +1,4 @@
CONFIG_MODULE_FMT=y
CONFIG_MODULE_SHELL=y
CONFIG_MODULE_TEST_UTILS_RESULT_OUTPUT=y
CONFIG_MODULE_TEST_UTILS_RESULT_OUTPUT_TXT=y

1
tests/turo_txt/main.c Symbolic link
View File

@ -0,0 +1 @@
../turo/main.c

55
tests/turo_txt/tests/01-run.py Executable file
View File

@ -0,0 +1,55 @@
#!/usr/bin/env python3
# Copyright (C) 2017 Alexandre Abadie <alexandre.abadie@inria.fr>
#
# 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
PASSING_CMDS = [
'turo_simple_s32 0',
'turo_simple_s32 -1',
'turo_simple_s32 0x7FFFFFFF',
'turo_simple_s32 -2147483648',
'turo_simple_array_u8 1',
'turo_simple_array_u8 2 255',
'turo_simple_array_s32 0 -1 0x7FFFFFFF -2147483648',
'turo_simple_dict_string foo bar',
'turo_simple_dict_s32 baz -2147483648',
'turo_simple_exit_status 0',
'test_multi_element_dict a b c d',
'test_netif'
]
FAILING_CMDS = [
'turo_simple_s32 a',
'turo_simple_s32 0x100000000',
'turo_simple_s32 -2147483649',
'turo_simple_array_u8 -1',
'turo_simple_array_u8 2 256',
'turo_simple_array_s32 a b',
'turo_simple_array_s32 -2147483649',
'turo_simple_dict_s32 baz s',
'turo_simple_dict_s32 baz -2147483649',
'turo_simple_exit_status 1'
]
def testfunc(child):
# Simple checking if the exit code works across everything
for cmd in PASSING_CMDS:
child.sendline(cmd)
child.expect('Success')
for cmd in FAILING_CMDS:
child.sendline(cmd)
child.expect('Error')
if __name__ == "__main__":
sys.exit(run(testfunc))