summaryrefslogtreecommitdiff
path: root/tests/kms_flip.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-02-08 09:00:23 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-02-08 09:01:56 +0100
commit164051347421710b8fa7fe79afec2ef1ffd97d30 (patch)
tree5876a826129ce5be8d45d93abfeb08169418cd3b /tests/kms_flip.c
parentbcd7ed6142a497c979862bc3c67fed52ef966c3d (diff)
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 [<unknown>+0x29] Subtest 2x-plain-flip-ts-check-interruptible failed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99651 Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'tests/kms_flip.c')
-rw-r--r--tests/kms_flip.c21
1 files changed, 18 insertions, 3 deletions
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);