From b905696f33000507b3f5e209fb8239d1f1c7c6e4 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Tue, 13 Jun 2017 21:44:27 +0200 Subject: [PATCH] tests: gpioinfo: test incorrect input Check if gpioinfo behaves correctly if the chip for which we want the info dumped doesn't exist. Signed-off-by: Bartosz Golaszewski --- tests/tests-gpioinfo.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/tests-gpioinfo.c b/tests/tests-gpioinfo.c index 01dd710..93b6640 100644 --- a/tests/tests-gpioinfo.c +++ b/tests/tests-gpioinfo.c @@ -108,3 +108,19 @@ static void gpioinfo_print_all_but_one_chip(void) TEST_DEFINE(gpioinfo_print_all_but_one_chip, "tools: gpioinfo - print all but one chip", 0, { 4, 4, 8, 4 }); + +static void gpioinfo_inexistent_chip(void) +{ + test_tool_run("gpioinfo", "inexistent", (char *)NULL); + test_tool_wait(); + + TEST_ASSERT(test_tool_exited()); + TEST_ASSERT_EQ(test_tool_exit_status(), 1); + TEST_ASSERT_NULL(test_tool_stdout()); + TEST_ASSERT_NOT_NULL(test_tool_stderr()); + TEST_ASSERT_STR_CONTAINS(test_tool_stderr(), + "looking up chip inexistent"); +} +TEST_DEFINE(gpioinfo_inexistent_chip, + "tools: gpioinfo - inexistent chip", + 0, { 8, 4 }); -- 2.30.2