[PATCH i-g-t v1 3/4] HAX/DO_NOT_MERGE: tests/core_getversion: add dmesg flooding subtests

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Jul 15 15:37:02 UTC 2024


Add subtests for testing igt_runner disk limiting option,
they will try to flood dmesg with useless messages.

Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/core_getversion.c | 63 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/tests/core_getversion.c b/tests/core_getversion.c
index 158133da7..20ff6b475 100644
--- a/tests/core_getversion.c
+++ b/tests/core_getversion.c
@@ -43,11 +43,53 @@
  *
  * SUBTEST: all-cards
  * Description: Tests GET_VERSION ioctl for all drm devices.
+ *
+ * SUBTEST: flood-1k
+ * SUBTEST: flood-11k
+ * SUBTEST: flood-1m
+ * SUBTEST: flood-3m
+ * SUBTEST: flood-11m
+ * SUBTEST: flood-51m
+ * SUBTEST: flood-101m
+ * Description: Flood dmesg with messages.
  */
 
 IGT_TEST_DESCRIPTION("Tests the DRM_IOCTL_GET_VERSION ioctl and libdrm's "
 		     "drmGetVersion() interface to it.");
 
+static char *fill_it(char *buf, int size)
+{
+	int i;
+
+	--size;
+	for (i=0; i < size; i++, buf++)
+		*buf = 'a' + rand() % 24;
+
+	*buf = 0;
+
+	return buf;
+}
+
+/* Flood dmesg with one KiloByte messages.
+ * kb_num: number of messaged to kprint
+ */
+static void flood_dmesg(int kb_num)
+{
+	char stra[1024+3];
+	int i, j;
+
+	igt_info("Printing to dmesg count %dKB.\n", kb_num);
+	igt_kmsg(KMSG_INFO "Print to dmesg with %dKB.\n", kb_num);
+	for (i = 0; i < kb_num; i++)
+		for (j = 0; j < 8; j++) { /* 8*128 = 1024 */
+			fill_it(stra, 128);
+			igt_kmsg(KMSG_INFO "core: (%d.%d): %s\n", i, j, stra);
+		}
+
+	igt_kmsg(KMSG_INFO "End printing.\n");
+	igt_info("Last buf:%s:\n", stra);
+}
+
 static void check(int fd, char *dst, int len)
 {
 	drmVersionPtr v;
@@ -101,6 +143,27 @@ igt_main
 	igt_subtest("all-cards")
 		check_all_drm();
 
+	igt_subtest("flood-1k")
+		flood_dmesg(1);
+
+	igt_subtest("flood-11k")
+		flood_dmesg(11);
+
+	igt_subtest("flood-1m")
+		flood_dmesg(1*1024);
+
+	igt_subtest("flood-3m")
+		flood_dmesg(3*1024);
+
+	igt_subtest("flood-11m")
+		flood_dmesg(11*1024);
+
+	igt_subtest("flood-51m")
+		flood_dmesg(51*1024);
+
+	igt_subtest("flood-101m")
+		flood_dmesg(101*1024);
+
 	igt_fixture
 		drm_close_driver(fd);
 }
-- 
2.43.0



More information about the Intel-gfx-trybot mailing list