summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorQuentin Glidic <sardemff7+git@sardemff7.net>2013-01-06 15:46:00 +0100
committerKristian Høgsberg <krh@bitplanet.net>2013-01-11 15:12:45 -0500
commit0d2c233e15137abf9c9ec55b8b9b120318af1375 (patch)
tree9c7ec5abf0c2cf45fc292cfd65b577b68f8aed79 /tests
parent812bd4dd0fb20161aaf07029fbd6146d530b9932 (diff)
test/event-loop: Check readable state on a pipe
When redirecting stdout to a non-readable file makes the test fail as a false negative
Diffstat (limited to 'tests')
-rw-r--r--tests/event-loop-test.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/event-loop-test.c b/tests/event-loop-test.c
index e630cde..2f3dcd4 100644
--- a/tests/event-loop-test.c
+++ b/tests/event-loop-test.c
@@ -43,14 +43,19 @@ TEST(event_loop_post_dispatch_check)
struct wl_event_loop *loop = wl_event_loop_create();
struct wl_event_source *source;
int dispatch_ran = 0;
+ int p[2];
- source = wl_event_loop_add_fd(loop, 1, WL_EVENT_READABLE,
+ assert(pipe(p) == 0);
+
+ source = wl_event_loop_add_fd(loop, p[0], WL_EVENT_READABLE,
fd_dispatch, &dispatch_ran);
wl_event_source_check(source);
wl_event_loop_dispatch(loop, 0);
assert(dispatch_ran);
+ assert(close(p[0]) == 0);
+ assert(close(p[1]) == 0);
wl_event_source_remove(source);
wl_event_loop_destroy(loop);
}