From: Gustavo Padovan <gustavo.pado...@collabora.co.uk>

If the event never arrives we can timeout with select and end the test.

Signed-off-by: Gustavo Padovan <gustavo.padovan at collabora.co.uk>
---
 tests/kms_atomic_transition.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 1977993..e693c88 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -296,6 +296,14 @@ static void commit_display(igt_display_t *display, 
unsigned event_mask, bool non
                struct drm_event *e = (void *)buf;
                struct drm_event_vblank *vblank = (void *)buf;
                uint32_t crtc_id, pipe = I915_MAX_PIPES;
+               struct timeval timeout = { .tv_sec = 3, .tv_usec = 0 };
+               fd_set fds;
+
+               FD_ZERO(&fds);
+               FD_SET(0, &fds);
+               FD_SET(display->drm_fd, &fds);
+               ret = select(display->drm_fd + 1, &fds, NULL, NULL, &timeout);
+               igt_assert(ret > 0);

                ret = read(display->drm_fd, buf, sizeof(buf));
                if (ret < 0 && (errno == EINTR || errno == EAGAIN))
-- 
2.5.5

Reply via email to