From patchwork Tue May 5 20:01:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 6342601 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 5EE1DBEEE1 for ; Tue, 5 May 2015 20:02:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5974E2021F for ; Tue, 5 May 2015 20:02:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7B28320117 for ; Tue, 5 May 2015 20:02:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9F1656E59F; Tue, 5 May 2015 13:02:35 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qg0-f46.google.com (mail-qg0-f46.google.com [209.85.192.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FB3E6E59F for ; Tue, 5 May 2015 13:02:34 -0700 (PDT) Received: by qgej70 with SMTP id j70so87401435qge.2 for ; Tue, 05 May 2015 13:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=3455ZCh4Eyrbrjg4/wqpVpVNAs+CDhkIjnI4jGF2McY=; b=k2tsGWYT0FlbE+ZSj9Q7OCy6cGE8AW5s9IA88YcN8+RhtrO/M4u1+DDOPGYM75wmrm JLO7SuWWqbv8uPZQG7hW3EkOEbqn6Y9vFfRfqZmfPKBXtgam3w7dOPK0rdc2eXM/+3k9 nik4H2K7kCyv7vFeJ1qQJeod8SZMpgYpO9uKfeXVetN67fUnL6r+e3Sz4Kuio/FtxsVo FFjmOPxSLZrL5nNFnloD1TdufhoZwfn+oEWbxuGxUipI2ExCwRqj1yknjrFezrojZWbo hP2qyCoO5JzgU0JKDGh5VzxhHwUlPsoJW/SRHCJGIG65jNoWp/tvCy/8o6HkXuAZJp57 1qdQ== X-Received: by 10.55.22.139 with SMTP id 11mr60365586qkw.94.1430856153845; Tue, 05 May 2015 13:02:33 -0700 (PDT) Received: from localhost.localdomain ([187.121.142.45]) by mx.google.com with ESMTPSA id 18sm12885465qgh.40.2015.05.05.13.02.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 May 2015 13:02:33 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Tue, 5 May 2015 17:01:41 -0300 Message-Id: <1430856101-1825-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.1.4 Cc: Paulo Zanoni , Thomas Wood Subject: [Intel-gfx] [PATCH igt] tests/kms_fbc_crc: fix debugfs 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-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 From: Paulo Zanoni Commit 47f6b1305cc3752f318a555b932e194e1500c1d8 completely broke this test due to the fread() assertion. When we're reading the debugfs file we really don't care about how many bytes we read because the number is not constant and we just use strstr() later. Change the assertion to make it check for at least 1 byte read, just to make sure no one changes that again. Regression introduced by: commit 47f6b1305cc3752f318a555b932e194e1500c1d8 Author: Thomas Wood Date: Wed Mar 25 16:42:57 2015 +0000 igt.cocci: check the return values of various functions Cc: Thomas Wood Signed-off-by: Paulo Zanoni --- tests/kms_fbc_crc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) We might also want to change/fix lib/igt.cocci, but I'll leave that to Thomas. There are other cases where we just read debugfs and we don't really care about how many bytes we actually read. diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c index 1320bad..3fd870d 100644 --- a/tests/kms_fbc_crc.c +++ b/tests/kms_fbc_crc.c @@ -198,7 +198,7 @@ static bool fbc_enabled(data_t *data) status = igt_debugfs_fopen("i915_fbc_status", "r"); igt_assert(status); - igt_assert_eq(fread(str, sizeof(str) - 1, 1, status), 1); + igt_assert(fread(str, 1, sizeof(str) - 1, status) > 0); fclose(status); return strstr(str, "FBC enabled") != NULL; }