From patchwork Wed May 4 15:15:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Bragg X-Patchwork-Id: 9015741 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 37BB0BF29F for ; Wed, 4 May 2016 15:15:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 668742039D for ; Wed, 4 May 2016 15:15:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0ABE4203AE for ; Wed, 4 May 2016 15:15:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CD696E388; Wed, 4 May 2016 15:15:31 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 091A26E388 for ; Wed, 4 May 2016 15:15:30 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id n129so10868819wmn.1 for ; Wed, 04 May 2016 08:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=p9JTBi58LHIcZ2S1jZKkoiZbNPDCXQC/1MNjuglJZWA=; b=uCLp54GFS4sHiakz606C4+DS+DWoPY/dff+OOqIj/gP/iOgyiIsUy7kvOZPfFhifhe qzFCyERuctfhQljg4hMSE/pEEpPn0XRPR4ImnT08KBp7DCsStiSRWgQgV34vflGqQuHz 5y/hYUzR7rBOvCzuo7HMsP8+BNuBINFdzVkArAxSaGz/7GsAhcOG0kM1V2cQiOD5INWJ CpIIemMYNOwP2JmVvldimd8NG8Wi68fBj0AOCBqBrx1cOwtSdD1WrXgDPdGYx0FZ3ve+ pwKIu12AuzR7untDnBO8EL6im2BPswP0i1P58tftjS/1mwugNOICN7qJTNpUIwKOVfNj OkXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=p9JTBi58LHIcZ2S1jZKkoiZbNPDCXQC/1MNjuglJZWA=; b=bkZopbqoyIJhxcjBRjt1gaG2GyXAkQ7GrfSxZJuI/pKgsxkf7J47cTEkAxBATuSzDb iz9Xz4YiNG8cSzjvokn5WdST0Ezu8QqdRSWUmSHPZ5UfRgCBllN6WVg7d5Hvj3JCCs/P 9lmgr4In6jYNVcFrv3eobq6T8TYuEIxN9T1pgAWd+wPyifUanP3Bd98L+yc2WOa9caof 7NyCa/YGepyz0KaKin03EI9OxwQ6LjSc9TjfHuO/gGOnVB//KhhJIRV6jokvCsbpWIZE ISXRyIVCnM4SYPQk032QSqSeuJVblsH96TU+Zrd0lvw+CKseNu5GqKsPXA//tYaHIhPl JJEA== X-Gm-Message-State: AOPr4FXQGO6oePsL21BdTsywgoXUuo1fzMIkIpiWeoOaWkuQc3W9TAdGmw7sBhYjvgbbgA== X-Received: by 10.194.116.225 with SMTP id jz1mr9112240wjb.148.1462374928596; Wed, 04 May 2016 08:15:28 -0700 (PDT) Received: from sixbynine.org (host-78-151-16-215.as13285.net. [78.151.16.215]) by smtp.gmail.com with ESMTPSA id jq1sm4745941wjc.28.2016.05.04.08.15.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 May 2016 08:15:28 -0700 (PDT) From: Robert Bragg To: intel-gfx@lists.freedesktop.org Date: Wed, 4 May 2016 16:15:24 +0100 Message-Id: <1462374925-29536-1-git-send-email-robert@sixbynine.org> X-Mailer: git-send-email 2.7.1 Cc: Sourab Gupta Subject: [Intel-gfx] [PATCH igt 1/2] drmtest: don't discard return value in do_ioctl() 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-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation for testing DRM_IOCTL_I915_PERF_OPEN which returns a file descriptor this allows us to get the return value of ioctl called by the do_ioctl() utility. Signed-off-by: Robert Bragg --- lib/drmtest.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/drmtest.h b/lib/drmtest.h index c391464..6aee1e8 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -104,11 +104,16 @@ bool is_i915_device(int fd); * * This macro wraps drmIoctl() and uses igt_assert to check that it has been * successfully executed. + * + * It's implemented using a gcc statement expression to still be able to + * assign the ioctl's return value after the assertion too. */ -#define do_ioctl(fd, ioc, ioc_data) do { \ - igt_assert_eq(igt_ioctl((fd), (ioc), (ioc_data)), 0); \ +#define do_ioctl(fd, ioc, ioc_data) ({ \ + int _ret = drmIoctl((fd), (ioc), (ioc_data)); \ + igt_assert(_ret >= 0); \ errno = 0; \ -} while (0) + _ret; \ +}) /** * do_ioctl_err: