tests: gpiomon: new test case
authorBartosz Golaszewski <bartekgola@gmail.com>
Fri, 23 Jun 2017 14:42:07 +0000 (16:42 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Fri, 23 Jun 2017 14:42:07 +0000 (16:42 +0200)
Verify that gpiomon bails out if the same line offset is given more
than once.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
tests/tests-gpiomon.c

index b1337260bac7005a8e2f8fd7865e650c7d8c9e58..36acb96659215697933994e709d23b682dfe991d 100644 (file)
@@ -199,6 +199,22 @@ TEST_DEFINE(gpiomon_watch_multiple_lines_not_in_order,
            "tools: gpiomon - watch multiple lines (offsets not in order)",
            0, { 8, 8 });
 
+static void gpiomon_request_the_same_line_twice(void)
+{
+       test_tool_run("gpiomon", test_chip_name(0), "2", "2", (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(),
+                                "error configuring GPIO line events");
+}
+TEST_DEFINE(gpiomon_request_the_same_line_twice,
+           "tools: gpiomon - request the same line twice",
+           0, { 8, 8 });
+
 static void gpiomon_no_arguments(void)
 {
        test_tool_run("gpiomon", (char *)NULL);