public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Dhinakaran Pandiyan <dhinakaran.pandiyan@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: rodrigo.vivi@intel.com
Subject: [PATCH i-g-t] tests/psr: Don't strcmp CRCs that are not NULL terminated.
Date: Mon, 18 Sep 2017 18:55:09 -0700	[thread overview]
Message-ID: <20170919015509.10736-1-dhinakaran.pandiyan@gmail.com> (raw)

Switched to strncmp.

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@gmail.com>
---
 tests/kms_psr_sink_crc.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index bd3fa5e9..795b6546 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -34,6 +34,7 @@
 bool running_with_psr_disabled;
 
 #define CRC_BLACK "000000000000"
+#define CRC_LEN 12
 
 enum operations {
 	PAGE_FLIP,
@@ -243,7 +244,7 @@ static void get_sink_crc(data_t *data, char *crc) {
 	usleep(300000);
 
 	/* Black screen is always invalid */
-	igt_assert(strcmp(crc, CRC_BLACK) != 0);
+	igt_assert(strncmp(crc, CRC_BLACK, CRC_LEN) != 0);
 }
 
 static bool is_green(char *crc)
@@ -289,8 +290,8 @@ static void run_test(data_t *data)
 	uint32_t handle = data->fb_white.gem_handle;
 	igt_plane_t *test_plane;
 	void *ptr;
-	char ref_crc[12];
-	char crc[12];
+	char ref_crc[CRC_LEN];
+	char crc[CRC_LEN];
 	const char *expected = "";
 
 	/* Confirm that screen became Green */
@@ -347,9 +348,9 @@ static void run_test(data_t *data)
 		memset(ptr, 0xff, data->mod_size);
 		get_sink_crc(data, crc);
 		if (data->test_plane == DRM_PLANE_TYPE_PRIMARY)
-			assert_or_manual(strcmp(ref_crc, crc) == 0, "screen WHITE");
+			assert_or_manual(strncmp(ref_crc, crc, CRC_LEN) == 0, "screen WHITE");
 		else
-			assert_or_manual(strcmp(ref_crc, crc) == 0,
+			assert_or_manual(strncmp(ref_crc, crc, CRC_LEN) == 0,
 			       "GREEN background with WHITE box");
 
 		igt_info("Waiting 10s...\n");
@@ -392,7 +393,7 @@ static void run_test(data_t *data)
 		break;
 	}
 	get_sink_crc(data, crc);
-	assert_or_manual(strcmp(ref_crc, crc) != 0, expected);
+	assert_or_manual(strncmp(ref_crc, crc, CRC_LEN) != 0, expected);
 }
 
 static void test_cleanup(data_t *data) {
-- 
2.11.0

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

             reply	other threads:[~2017-09-19  1:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19  1:55 Dhinakaran Pandiyan [this message]
2017-09-19 10:19 ` ✗ Fi.CI.BAT: warning for tests/psr: Don't strcmp CRCs that are not NULL terminated Patchwork
2017-09-19 22:47 ` [PATCH i-g-t v2] " Dhinakaran Pandiyan
2017-09-22  1:01   ` Sripada, Radhakrishna
2017-09-20  0:36 ` ✓ Fi.CI.BAT: success for tests/psr: Don't strcmp CRCs that are not NULL terminated. (rev2) Patchwork
2017-09-20  4:12 ` ✗ Fi.CI.IGT: failure " Patchwork

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=20170919015509.10736-1-dhinakaran.pandiyan@gmail.com \
    --to=dhinakaran.pandiyan@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@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