tests: gpiomon: new test case
authorBartosz Golaszewski <bartekgola@gmail.com>
Thu, 22 Jun 2017 18:56:36 +0000 (20:56 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Thu, 22 Jun 2017 18:56:36 +0000 (20:56 +0200)
Verify that we actually ignore events we're not watching.

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

index 19b9a16620d1097ef408e84f9e8fbdb7423a38de..f73461988a436d2109917640340ed7994db210b5 100644 (file)
@@ -127,6 +127,24 @@ TEST_DEFINE(gpiomon_both_events_sigterm,
            "tools: gpiomon - receive both types of events and kill with SIGTERM",
            0, { 8, 8 });
 
+static void gpiomon_ignore_falling_edge(void)
+{
+       test_tool_run("gpiomon", "--rising-edge",
+                     test_chip_name(0), "4", (char *)NULL);
+       test_set_event(0, 4, TEST_EVENT_FALLING, 100);
+       usleep(300000);
+       test_tool_signal(SIGTERM);
+       test_tool_wait();
+
+       TEST_ASSERT(test_tool_exited());
+       TEST_ASSERT_RET_OK(test_tool_exit_status());
+       TEST_ASSERT_NULL(test_tool_stdout());
+       TEST_ASSERT_NULL(test_tool_stderr());
+}
+TEST_DEFINE(gpiomon_ignore_falling_edge,
+           "tools: gpiomon - wait for rising edge events, ignore falling edge",
+           0, { 8, 8 });
+
 static void gpiomon_no_arguments(void)
 {
        test_tool_run("gpiomon", (char *)NULL);