From patchwork Mon Nov 14 09:59:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9426945 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8A7ED60471 for ; Mon, 14 Nov 2016 09:59:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81653286D4 for ; Mon, 14 Nov 2016 09:59:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76633286E5; Mon, 14 Nov 2016 09:59:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4EACE286D4 for ; Mon, 14 Nov 2016 09:59:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A1E026E391; Mon, 14 Nov 2016 09:59:42 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 36A146E389; Mon, 14 Nov 2016 09:59:41 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id 3so8612804pgd.0; Mon, 14 Nov 2016 01:59:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NaUnpkYDBusP80doNLmFWpPo6sj6jdSZgJw7rUiHSLo=; b=fmePEYACTeT7zQo12cnTdtYQSi2GKLoDJLmaR9Ap48/vaRQQAoGoxKcrY/RnURW4G1 ZOJGc1uri2+Lvc0Fx40CNVIJV59W4V0UNxvDhrQqU3Z3PZdC/ZnV8PPwO9zTLSQ+VwSH o1qf8CZ+BlzLwlJcMAioBNCNodtTO9DcpcAqd/2YIkPK99XViCjnlWcHSi/9/HOT+l1d w13oLq1SnuJi6nhElFbEe1DANJqcM6dGncnG7F1xkRga3ptY/hxt2B5HV4eYDrHlNOQ1 WEBgnAqLqYKqv5Bpq5LTYyHsIxY9KKVZuHhueZGjGo8BUJrupul5zzE6NqhGbBYBqEAP NOTQ== X-Gm-Message-State: ABUngvcyibB5DNsm/4qm23tNGBCiB4vPWGYUJO09u3rEFlNB9EOBODUaBdi86tqo6GW+4A== X-Received: by 10.98.223.203 with SMTP id d72mr34778220pfl.2.1479117580749; Mon, 14 Nov 2016 01:59:40 -0800 (PST) Received: from jade.nodan1.kt.home.ne.jp (202-72-64-164.koalanet.ne.jp. [202.72.64.164]) by smtp.gmail.com with ESMTPSA id p125sm14320235pfg.33.2016.11.14.01.59.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Nov 2016 01:59:40 -0800 (PST) From: Gustavo Padovan To: intel-gfx@lists.freedesktop.org Date: Mon, 14 Nov 2016 18:59:14 +0900 Message-Id: <1479117566-17709-3-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1479117566-17709-1-git-send-email-gustavo@padovan.org> References: <1479117566-17709-1-git-send-email-gustavo@padovan.org> Cc: Gustavo Padovan , dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 01/12] tests/kms_atomic_transition: use select + read instead of blocking read X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan If the event never arrives we can timeout with select and end the test. Signed-off-by: Gustavo Padovan --- 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))