tests/stdin: add non regression test for stdin

This commit is contained in:
Alexandre Abadie 2019-05-28 20:37:32 +02:00
parent 7fa201ef24
commit d73a6c837b
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
3 changed files with 50 additions and 0 deletions

7
tests/stdin/Makefile Normal file
View File

@ -0,0 +1,7 @@
include ../Makefile.tests_common
USEMODULE += stdin
TEST_ON_CI_WHITELIST += all
include $(RIOTBASE)/Makefile.include

24
tests/stdin/main.c Normal file
View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2019 Inria
*
* 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 Shows that stdin module is required when one wants to use getchar
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
*/
#include <stdio.h>
int main(void)
{
int value = getchar();
printf("You entered '%c'\n", (char)value);
return 0;
}

19
tests/stdin/tests/01-run.py Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env python3
# Copyright (C) 2019 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
def testfunc(child):
child.sendline('O')
child.expect_exact('You entered \'O\'')
if __name__ == "__main__":
sys.exit(run(testfunc))