tests: provide test for vfs+fmt corner-case
On `native` when using `vfs` the `fmt` print functions do not work. This is because the `fmt` module uses the `write()` system call which is bend by the `native_vfs` module to use `vfs_write()`. However, `native` does not use a `stdio` module to print. Instead, it just writes to the hosts standard I/O directly. As such, STDIN, STDOUT, and STDERR are never initialized for `vfs` so `vfs` does not recognize `STDIN_FILENO`, `STDOUT_FILENO` and `STDERR_FILENO` as valid file descriptors. This test case showcases this bug.
This commit is contained in:
parent
33b1f9ecf7
commit
13d5f6e6b4
7
tests/vfs_plus_stdio/Makefile
Normal file
7
tests/vfs_plus_stdio/Makefile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
DEVELHELP=0
|
||||||
|
include ../Makefile.tests_common
|
||||||
|
|
||||||
|
USEMODULE += vfs
|
||||||
|
USEMODULE += fmt
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.include
|
||||||
27
tests/vfs_plus_stdio/main.c
Normal file
27
tests/vfs_plus_stdio/main.c
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup tests
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @brief Tests VFS together with stdio on a board
|
||||||
|
*
|
||||||
|
* @author Martine S. Lenders <m.lenders@fu-berlin.de>
|
||||||
|
*
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "fmt.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
print_str("SUCCESS\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
tests/vfs_plus_stdio/tests/01-run.py
Executable file
18
tests/vfs_plus_stdio/tests/01-run.py
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# Copyright (C) 2019 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.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from testrunner import run
|
||||||
|
|
||||||
|
|
||||||
|
def testfunc(child):
|
||||||
|
child.expect_exact('SUCCESS')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(run(testfunc, timeout=1))
|
||||||
Loading…
x
Reference in New Issue
Block a user