diff --git a/tests/stdin/Makefile b/tests/stdin/Makefile new file mode 100644 index 0000000000..464eba09b7 --- /dev/null +++ b/tests/stdin/Makefile @@ -0,0 +1,7 @@ +include ../Makefile.tests_common + +USEMODULE += stdin + +TEST_ON_CI_WHITELIST += all + +include $(RIOTBASE)/Makefile.include diff --git a/tests/stdin/main.c b/tests/stdin/main.c new file mode 100644 index 0000000000..7d071685ba --- /dev/null +++ b/tests/stdin/main.c @@ -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 + * + */ + +#include + +int main(void) +{ + int value = getchar(); + printf("You entered '%c'\n", (char)value); + return 0; +} diff --git a/tests/stdin/tests/01-run.py b/tests/stdin/tests/01-run.py new file mode 100755 index 0000000000..f1d287543b --- /dev/null +++ b/tests/stdin/tests/01-run.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2019 Alexandre Abadie +# +# 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))