From: Bartosz Golaszewski Date: Tue, 13 Jun 2017 19:44:27 +0000 (+0200) Subject: tests: gpioinfo: test incorrect input X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b905696f33000507b3f5e209fb8239d1f1c7c6e4;p=qemu-gpiodev%2Flibgpiod.git 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 --- 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 });