tests: gpiomon: use test_trigger_event() to fix timing errors
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 3 Jun 2019 16:18:53 +0000 (18:18 +0200)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Wed, 5 Jun 2019 10:06:47 +0000 (12:06 +0200)
Since we don't need to trigger events from a separate thread when
testing tools and we've experienced timing issues with these two
test cases, let's use the new helper for triggering of single events.

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

index b17e411457ac45021b9fe9db5befb7e6f3c64065..7440d65bfe1d8c2ecab7da7e9eee844d5c004741 100644 (file)
@@ -131,12 +131,13 @@ static void gpiomon_watch_multiple_lines(void)
 {
        test_tool_run("gpiomon", "--format=%o", test_chip_name(0),
                      "1", "2", "3", "4", "5", (char *)NULL);
-       test_set_event(0, 2, 100);
-       usleep(150000);
-       test_set_event(0, 3, 100);
-       usleep(150000);
-       test_set_event(0, 4, 100);
-       usleep(150000);
+       usleep(100000);
+       test_trigger_event(0, 2);
+       usleep(100000);
+       test_trigger_event(0, 3);
+       usleep(100000);
+       test_trigger_event(0, 4);
+       usleep(100000);
        test_tool_signal(SIGTERM);
        test_tool_wait();
 
@@ -155,12 +156,13 @@ static void gpiomon_watch_multiple_lines_not_in_order(void)
 {
        test_tool_run("gpiomon", "--format=%o", test_chip_name(0),
                      "5", "2", "7", "1", "6", (char *)NULL);
-       test_set_event(0, 2, 100);
-       usleep(150000);
-       test_set_event(0, 1, 100);
-       usleep(150000);
-       test_set_event(0, 6, 100);
-       usleep(150000);
+       usleep(100000);
+       test_trigger_event(0, 2);
+       usleep(100000);
+       test_trigger_event(0, 1);
+       usleep(100000);
+       test_trigger_event(0, 6);
+       usleep(100000);
        test_tool_signal(SIGTERM);
        test_tool_wait();