Skip to contentSkip to conversation

tests/psr: Don't strcmp CRCs that are not NULL terminated.

PATCH New Dhinakaran Pandiyan 4 participants 6 messages Sep 19, 2017 – Sep 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/psr: Don't strcmp CRCs that are not NULL terminated.

Switched to strncmp.

---
 tests/kms_psr_sink_crc.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
tests/kms_psr_sink_crc.c +7 -6
index bd3fa5e9..795b6546 100644
@@ -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) {
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: warning for tests/psr: Don't strcmp CRCs that are not NULL terminated.

== Series Details ==

== Series Details ==

Series: tests/psr: Don't strcmp CRCs that are not NULL terminated.
URL : https://patchwork.freedesktop.org/series/30564/
State : warning

== Summary ==

IGT patchset tested on top of latest successful build 6dceb6f2b28c591a1b004d11173bbea91ef4471c igt/kms_psr_sink_crc: Add psr_drrs subtest

with latest DRM-Tip kernel build CI_DRM_3106
a7b0939454cd drm-tip: 2017y-09m-19d-09h-18m-06s UTC integration manifest

Test gem_exec_reloc:

        Subgroup basic-write-cpu:
                dmesg-warn -> PASS       (fi-kbl-7500u)
Test gem_exec_suspend:
        Subgroup basic-s3:
                incomplete -> PASS       (fi-kbl-7500u) fdo#102850
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                pass       -> FAIL       (fi-snb-2600) fdo#100215
Test drv_module_reload:
        Subgroup basic-reload:
                pass       -> DMESG-WARN (fi-skl-6770hq)

fdo#102850 https://bugs.freedesktop.org/show_bug.cgi?id=102850
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:447s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:475s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:428s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:529s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:277s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:508s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:502s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:498s
fi-cfl-s         total:289  pass:223  dwarn:34  dfail:0   fail:0   skip:32  time:552s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:419s
fi-glk-2a        total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:604s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:432s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:409s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:438s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:491s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:469s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:476s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:584s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:580s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:543s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:462s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:754s
fi-skl-6770hq    total:289  pass:268  dwarn:1   dfail:0   fail:0   skip:20  time:496s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:476s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:576s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:1   skip:39  time:419s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_227/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

PATCH v2 1/1 tests/psr: Don't strcmp CRCs that are not NULL terminated.

In reply to Dhinakaran Pandiyan

Switched to strncmp.
v2: increased buffer size to account for NULL character.

---
 tests/kms_psr_sink_crc.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
tests/kms_psr_sink_crc.c +7 -6
index 1c25f2c8..ff257698 100644
@@ -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 + 1) != 0);
 }
 
 static bool is_green(char *crc)
@@ -298,8 +299,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 + 1] = {0};
+	char crc[CRC_LEN + 1] = {0};
 	const char *expected = "";
 
 	/* Confirm that screen became Green */
@@ -356,9 +357,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 + 1) == 0, "screen WHITE");
 		else
-			assert_or_manual(strcmp(ref_crc, crc) == 0,
+			assert_or_manual(strncmp(ref_crc, crc, CRC_LEN + 1) == 0,
 			       "GREEN background with WHITE box");
 
 		igt_info("Waiting 10s...\n");
@@ -401,7 +402,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 + 1) != 0, expected);
 }
 
 static void test_cleanup(data_t *data) {
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#3 lore raw
Quoted 12 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Dhinakaran Pandiyan
Sent: Tuesday, September 19, 2017 3:48 PM
To: [email protected]
Cc: Pandiyan, Dhinakaran <[email protected]>; Vivi, Rodrigo <[email protected]>
Subject: [Intel-gfx] [PATCH i-g-t v2] tests/psr: Don't strcmp CRCs that are not NULL terminated.

Quoted 5 lines

Switched to strncmp.
v2: increased buffer size to account for NULL character.

Quoted 64 lines
---
 tests/kms_psr_sink_crc.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
tests/kms_psr_sink_crc.c +6 -5
index 1c25f2c8..ff257698 100644
@@ -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 + 1) != 0);
 }
 
 static bool is_green(char *crc)
@@ -298,8 +299,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 + 1] = {0};
+	char crc[CRC_LEN + 1] = {0};
 	const char *expected = "";
 
 	/* Confirm that screen became Green */
@@ -356,9 +357,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 + 1)
 == 0, "screen WHITE");
 		else
-			assert_or_manual(strcmp(ref_crc, crc) == 0,
+			assert_or_manual(strncmp(ref_crc, crc, CRC_LEN + 1)
 == 0,
tests/kms_psr_sink_crc.c +1 -1
 			       "GREEN background with WHITE box");
 
 		igt_info("Waiting 10s...\n");
@@ -401,7 +402,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 + 1) != 0,
 expected);
 }
 

static void test_cleanup(data_t *data) {
--
2.11.0

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.BAT: success for tests/psr: Don't strcmp CRCs that are not NULL terminated. (rev2)

In reply to Dhinakaran Pandiyan
== Series Details ==

== Series Details ==

Series: tests/psr: Don't strcmp CRCs that are not NULL terminated. (rev2)
URL : https://patchwork.freedesktop.org/series/30564/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
da197b5f3cb516aaaea72d0d60b0f5c1c81081dd igt/gem_eio: Add another variant of in-flight to avoid request coalescing

with latest DRM-Tip kernel build CI_DRM_3111
85e28edde5bf drm-tip: 2017y-09m-19d-23h-07m-57s UTC integration manifest

Test chamelium:

        Subgroup hdmi-hpd-fast:
                fail       -> SKIP       (fi-kbl-7500u)
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-legacy:
                fail       -> PASS       (fi-snb-2600) fdo#100215
Test drv_module_reload:
        Subgroup basic-reload:
                dmesg-warn -> PASS       (fi-glk-1) fdo#102777

fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:438s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:473s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:422s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:519s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:277s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:514s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:504s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:497s
fi-cfl-s         total:289  pass:223  dwarn:34  dfail:0   fail:0   skip:32  time:550s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:414s
fi-glk-1         total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:565s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:435s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:408s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:433s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:486s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:469s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:472s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:575s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:591s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:545s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:752s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:493s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:480s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:571s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:423s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_231/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✗ Fi.CI.IGT: failure for tests/psr: Don't strcmp CRCs that are not NULL terminated. (rev2)

In reply to Dhinakaran Pandiyan
== Series Details ==

== Series Details ==

Series: tests/psr: Don't strcmp CRCs that are not NULL terminated. (rev2)
URL : https://patchwork.freedesktop.org/series/30564/
State : failure

== Summary ==

Test gem_eio:

        Subgroup in-flight-external:
                dmesg-warn -> PASS       (shard-hsw)
        Subgroup in-flight-contexts:
                dmesg-warn -> PASS       (shard-hsw)
Test kms_setmode:
        Subgroup basic:
                fail       -> PASS       (shard-hsw) fdo#99912
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-primscrn-shrfb-pgflip-blt:
                pass       -> FAIL       (shard-hsw)
Test kms_busy:
        Subgroup extended-modeset-hang-newfb-with-reset-render-C:
                pass       -> DMESG-WARN (shard-hsw) fdo#102249

fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249

shard-hsw total:2271 pass:1217 dwarn:2 dfail:0 fail:14 skip:1038 time:9615s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_231/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx