From patchwork Thu May 5 15:06:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Bragg X-Patchwork-Id: 9025121 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 38046BF29F for ; Thu, 5 May 2016 15:06:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4DBA62038F for ; Thu, 5 May 2016 15:06:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D197E2038D for ; Thu, 5 May 2016 15:06:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 372F989B01; Thu, 5 May 2016 15:06:07 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 83F9B89B01 for ; Thu, 5 May 2016 15:06:05 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id r12so3931439wme.0 for ; Thu, 05 May 2016 08:06:05 -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:in-reply-to:references; bh=N4BPZKJcNr3biShKV/bUK9n8KdZhJ9nZ2dLYf5HtJ8E=; b=1GykowiMTZRwKHu1axzH6zWMra5U/UIOanf5k+S6tovgZwy4w5fEsVUcGkBWd1Y4ZJ khkdkUABOsVKTtpEDGH0PsmVRCiI4SMxJGL0+UvtvgvxKURJn/0VEP1ITJHxYvKe/G3L 1E3zPnsGNsKv1rP8Yz+BbMd0LzB44DOCtp8zo4OgZHcVqnTmcSPoxygcRhY2bTS8t9oI q43cl4M4sSJ+D50h2gh5sruMCoiPCGoFwiUGI9xn0h+nR0epIcaQRPlOi872iURduSM/ 3298sYsUJkumAEjTfK0xOVUrNwdRoCj+Uq1Aki1QufUeGqlfLEllcFZapFaP8Fu6ZSXl RF/w== 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 :in-reply-to:references; bh=N4BPZKJcNr3biShKV/bUK9n8KdZhJ9nZ2dLYf5HtJ8E=; b=ZduVkPw1gWAPYAXhzhmvJafyi6m3wxOMqasnn2J93g6un1HuTlArGyGKApLmGEVoAS YHmlGlTjIp388Chedwip8EoaAnLo3mW8+H4ZyxHz/sEOXMfGKdeegzlHZgbiKh2LjNL4 tnWitBB/JJCsMWVyCd4W29DAluJ1Cqj3Eu3zCPWo4AIcZyRb/78j7UcihRtZwB9oe682 KkrQYjnkFTI24UzsFOL3a341c/Ou3ls4niLJloirt4ogb0T88Dc4mQk0TzrjseZ8IZD/ 9Fw6mlem2nU2Xve4BPfgy+rqiAR2CnnBA0lT8QmrrXJrdNXAsXzN8Zz63pR0WSJg81mQ FLsQ== X-Gm-Message-State: AOPr4FWsIbnXnH3LVjvA9RDh++UtSLVebd/PuoN/4ufEk3pfBTyVukSdaHD86eIpbNLE0Q== X-Received: by 10.28.19.20 with SMTP id 20mr4146632wmt.5.1462460764140; Thu, 05 May 2016 08:06:04 -0700 (PDT) Received: from sixbynine.org ([83.217.123.106]) by smtp.gmail.com with ESMTPSA id jr8sm10190906wjb.15.2016.05.05.08.06.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 May 2016 08:06:03 -0700 (PDT) From: Robert Bragg To: intel-gfx@lists.freedesktop.org Date: Thu, 5 May 2016 16:06:02 +0100 Message-Id: <1462460762-19028-1-git-send-email-robert@sixbynine.org> X-Mailer: git-send-email 2.7.1 In-Reply-To: <20160504152714.GF19266@nuc-i3427.alporthouse.com> References: <20160504152714.GF19266@nuc-i3427.alporthouse.com> Subject: [Intel-gfx] [PATCH] 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 Fixed a rebase mistake where I dropped the use of the igt_ioctl wrapper in do_ioctl(). I'm not entirely sure a.t.m whether the assertion change from ret == 0 to ret >= 0 will break anything, though comparing run-tests.sh -s -t basic before/after didn't seem to highlight a problem for me. --- >8 --- 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..b917ecb 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 = igt_ioctl((fd), (ioc), (ioc_data)); \ + igt_assert(_ret >= 0); \ errno = 0; \ -} while (0) + _ret; \ +}) /** * do_ioctl_err: