From 164051347421710b8fa7fe79afec2ef1ffd97d30 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Wed, 8 Feb 2017 09:00:23 +0100 Subject: kms_flip: Handle EINTR in poll call for -interruptible tests. This fixes the following failure in kms_flip: (kms_flip:12099) CRITICAL: Test assertion failure function calibrate_ts, file kms_flip.c:1190: (kms_flip:12099) CRITICAL: Failed assertion: poll(&(struct pollfd){drm_fd, POLLIN}, 1, -1) == 1 (kms_flip:12099) CRITICAL: Last errno: 4, Interrupted system call Stack trace: #0 [__igt_fail_assert+0xf1] #1 [run_test_on_crtc_set.constprop.13+0x18f3] #2 [run_pair+0x31f] #3 [main+0x463] #4 [__libc_start_main+0xf0] #5 [_start+0x29] #6 [+0x29] Subtest 2x-plain-flip-ts-check-interruptible failed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99651 Signed-off-by: Maarten Lankhorst --- tests/kms_flip.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'tests/kms_flip.c') diff --git a/tests/kms_flip.c b/tests/kms_flip.c index fc946d36..41406dfe 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -1018,9 +1018,10 @@ fb_is_bound(struct test_output *o, int fb) int n; for (n = 0; n < o->count; n++) { - struct drm_mode_crtc mode; + struct drm_mode_crtc mode = { + .crtc_id = o->_crtc[n] + }; - mode.crtc_id = o->_crtc[n]; if (drmIoctl(drm_fd, DRM_IOCTL_MODE_GETCRTC, &mode)) return 0; @@ -1186,8 +1187,22 @@ static void calibrate_ts(struct test_output *o, int crtc_idx) for (n = 0; n < CALIBRATE_TS_STEPS; n++) { struct drm_event_vblank ev; uint64_t now; + int poll_ret; - igt_assert(poll(&(struct pollfd){drm_fd, POLLIN}, 1, -1) == 1); + while (1) { + /* + * In case of the interruptible tests, this poll may + * be interrupted with -EINTR, handle this by restarting + * until we poll timeout or success. + */ + poll_ret = poll(&(struct pollfd){drm_fd, POLLIN}, 1, -1); + + if (poll_ret == 1) + break; + + igt_assert_neq(poll_ret, 0); + igt_assert_eq(errno, EINTR); + } igt_assert(read(drm_fd, &ev, sizeof(ev)) == sizeof(ev)); igt_assert_eq(ev.sequence, last_seq + 1); -- cgit v1.2.3