public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>,
	Thomas Wood <thomas.wood@intel.com>
Subject: [PATCH igt] tests/kms_fbc_crc: fix debugfs read
Date: Tue,  5 May 2015 17:01:41 -0300	[thread overview]
Message-ID: <1430856101-1825-1-git-send-email-przanoni@gmail.com> (raw)

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

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 <thomas.wood@intel.com>
Date:   Wed Mar 25 16:42:57 2015 +0000
    igt.cocci: check the return values of various functions

Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 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;
 }
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

                 reply	other threads:[~2015-05-05 20:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430856101-1825-1-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=thomas.wood@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox