Skip to contentSkip to conversation

Test cases for fbdev

PATCH Superseded Thomas Zimmermann 3 participants 13 messages Nov 19, 2020 – Nov 20, 2020

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover Test cases for fbdev

This patchset adds read and write tests for fbdev. It compares the content of the framebuffer and reference buffer. A number of the special cases near the EOF are also tested.

Depending on the implementation (sys, cfb), fbdev read/write changes its semantics. Together with a kernel patches [1] these test cases intend to provide a reference.

v5:
* test mmap() with igt_assert() (Daniel, Chris)
v4:
* declare variables as volatile where necessary (Petri)
* replace igt_require() with igt_assert() in several places (Petri)
* clarify several error messages (Petri)
* update CI
v3:
* put igt_describe() before the block it describes (Petri)
v2:
* move tests into subtest groups
* do setup in igt_fixtures (Daniel, Chris, Petri)
* add additional tests for unaligned access and NULL-pointer buffers (Daniel)

[1] https://patchwork.freedesktop.org/series/80038/

Thomas Zimmermann (8):
tests/fbdev: Move existing tests into separate subgroups tests/fbdev: Map framebuffer in igt_fixture tests/fbdev: Add tests for read operations on framebuffer tests/fbdev: Add tests for unaligned reads on framebuffer memory tests/fbdev: Add tests for write operations on framebuffer tests/fbdev: Add tests for unaligned writes on framebuffer memory tests/fbdev: Add tests for accessing framebuffer near EOF tests/fbdev: Add tests for read/writing with NULL-pointer buffers

 tests/fbdev.c                         | 223 ++++++++++++++++++++++++--
 tests/intel-ci/fast-feedback.testlist |   8 +-
 2 files changed, 214 insertions(+), 17 deletions(-)

--
2.29.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#1 lore raw

PATCH v5 1/8 tests/fbdev: Move existing tests into separate subgroups

Move the existing tests into subgroups for testing modesetting and accessing the framebuffer.

v5:
* test mmap() with igt_assert() (Daniel, Chris)
v4:
* declare fd as volatile (Petri)
* add info test to CI
v3:

	* put igt_describe() before igt_subtest() and igt_subtest_group()
	  (Petri)
---
 tests/fbdev.c                         | 53 ++++++++++++++++++++-------
 tests/intel-ci/fast-feedback.testlist |  1 +
 2 files changed, 41 insertions(+), 13 deletions(-)
tests/fbdev.c +40 -13
index e5efeb93..a803f445 100644
@@ -37,28 +37,17 @@
 
 #include "igt.h"
 
-igt_main
+static void mode_tests(int fd)
 {
 	struct fb_var_screeninfo var_info;
 	struct fb_fix_screeninfo fix_info;
-	int fd = -1;
 
-	/*
-	 * Should this test focus on the fbdev independent of any drm driver,
-	 * or should it look for fbdev of a particular device?
-	 */
 	igt_fixture {
-		fd = open("/dev/fb0", O_RDWR);
-		if (fd < 0) {
-			drm_load_module(DRIVER_ANY);
-			fd = open("/dev/fb0", O_RDWR);
-		}
-		igt_require_f(fd != -1, "/dev/fb0\n");
-
 		igt_require(ioctl(fd, FBIOGET_VSCREENINFO, &var_info) == 0);
 		igt_require(ioctl(fd, FBIOGET_FSCREENINFO, &fix_info) == 0);
 	}
 
+	igt_describe("Check if screeninfo is valid");
 	igt_subtest("info") {
 		unsigned long size;
 
@@ -69,7 +58,17 @@ igt_main
 			     fix_info.line_length,
 			     fix_info.smem_len);
 	}
+}
+
+static void framebuffer_tests(int fd)
+{
+	struct fb_fix_screeninfo fix_info;
+
+	igt_fixture {
+		igt_require(ioctl(fd, FBIOGET_FSCREENINFO, &fix_info) == 0);
+	}
 
+	igt_describe("Check mmap operations on framebuffer memory");
 	igt_subtest("mmap") {
 		void *map;
 
@@ -82,6 +81,34 @@ igt_main
 		memset(map, 0, fix_info.smem_len);
 		munmap(map, fix_info.smem_len);
 	}
+}
+
+igt_main
+{
+	volatile int fd = -1;
+
+	/*
+	 * Should this test focus on the fbdev independent of any drm driver,
+	 * or should it look for fbdev of a particular device?
+	 */
+	igt_fixture {
+		fd = open("/dev/fb0", O_RDWR);
+		if (fd < 0) {
+			drm_load_module(DRIVER_ANY);
+			fd = open("/dev/fb0", O_RDWR);
+		}
+		igt_require_f(fd != -1, "/dev/fb0\n");
+	}
+
+	igt_describe("Check modesetting");
+	igt_subtest_group {
+		mode_tests(fd);
+	}
+
+	igt_describe("Check framebuffer access");
+	igt_subtest_group {
+		framebuffer_tests(fd);
+	}
 
 	igt_fixture {
 		close(fd);
tests/intel-ci/fast-feedback.testlist +1 -0
index 83722f83..a40410a8 100644
@@ -2,6 +2,7 @@
 
 igt@core_auth@basic-auth
 igt@debugfs_test@read_all_entries
+igt@fbdev@info
 igt@fbdev@mmap
 igt@gem_basic@bad-close
 igt@gem_basic@create-close
Signature · 6 lines
2.29.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#2 lore raw

PATCH v5 2/8 tests/fbdev: Map framebuffer in igt_fixture

In reply to Thomas Zimmermann

The mapping of the framebuffer memory will be useful for read/write tests. Move it into an igt_fixture block.

v4:
* declare map as volatile (Petri)
* test struct fb_fix_screeninfo.smem_len with igt_assert()
* remove mmap test from CI

---
 tests/fbdev.c                         | 12 +++++-------
 tests/intel-ci/fast-feedback.testlist |  1 -
 2 files changed, 5 insertions(+), 8 deletions(-)
tests/fbdev.c +5 -7
index a803f445..eebd2a83 100644
@@ -63,22 +63,20 @@ static void mode_tests(int fd)
 static void framebuffer_tests(int fd)
 {
 	struct fb_fix_screeninfo fix_info;
+	void * volatile map;
 
 	igt_fixture {
 		igt_require(ioctl(fd, FBIOGET_FSCREENINFO, &fix_info) == 0);
-	}
-
-	igt_describe("Check mmap operations on framebuffer memory");
-	igt_subtest("mmap") {
-		void *map;
-
-		igt_require(fix_info.smem_len);
+		igt_assert(fix_info.smem_len);
 
 		map = mmap(NULL, fix_info.smem_len,
 			   PROT_WRITE, MAP_SHARED, fd, 0);
 		igt_assert(map != MAP_FAILED);
 
 		memset(map, 0, fix_info.smem_len);
+	}
+
+	igt_fixture {
 		munmap(map, fix_info.smem_len);
 	}
 }
tests/intel-ci/fast-feedback.testlist +0 -1
index a40410a8..cf66b4da 100644
@@ -3,7 +3,6 @@
 igt@core_auth@basic-auth
 igt@debugfs_test@read_all_entries
 igt@fbdev@info
-igt@fbdev@mmap
 igt@gem_basic@bad-close
 igt@gem_basic@create-close
 igt@gem_basic@create-fd-close
Signature · 6 lines
2.29.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw

PATCH v5 3/8 tests/fbdev: Add tests for read operations on framebuffer

In reply to Thomas Zimmermann

The read tests check the read buffer against the content of the mapped framebuffer.

v4:
* test malloc() success with igt_require()
* replace igt_require() by igt_assert() in "read" (Petri)
* add read test to CI
v3:
* put igt_describe() before igt_subtest() (Petri)

---
 tests/fbdev.c                         | 25 +++++++++++++++++++++++++
 tests/intel-ci/fast-feedback.testlist |  1 +
 2 files changed, 26 insertions(+)
tests/fbdev.c +25 -0
index eebd2a83..d8c78a5e 100644
@@ -25,6 +25,7 @@
 
 #include "igt.h"
 
+#include <errno.h>
 #include <fcntl.h>
 #include <string.h>
 #include <sys/ioctl.h>
@@ -64,6 +65,7 @@ static void framebuffer_tests(int fd)
 {
 	struct fb_fix_screeninfo fix_info;
 	void * volatile map;
+	void * volatile buf;
 
 	igt_fixture {
 		igt_require(ioctl(fd, FBIOGET_FSCREENINFO, &fix_info) == 0);
@@ -73,10 +75,33 @@ static void framebuffer_tests(int fd)
 			   PROT_WRITE, MAP_SHARED, fd, 0);
 		igt_assert(map != MAP_FAILED);
 
+		buf = malloc(fix_info.smem_len);
+		igt_require(buf);
+	}
+
+	igt_describe("Check read operations on framebuffer memory");
+	igt_subtest("read") {
+		ssize_t ret;
+		int cmp;
+
+		/* fill framebuffer with 0 and compare */
 		memset(map, 0, fix_info.smem_len);
+		ret = pread(fd, buf, fix_info.smem_len, 0);
+		igt_assert_f(ret == (ssize_t)fix_info.smem_len, "pread failed, ret=%zd\n", ret);
+		cmp = memcmp(map, buf, fix_info.smem_len);
+		igt_assert_f(!cmp, "read buffer differs from mapped framebuffer for 0\n");
+
+		/* fill framebuffer with 0x55 and compare */
+		memset(map, 0x55, fix_info.smem_len);
+		ret = pread(fd, buf, fix_info.smem_len, 0);
+		igt_assert_f(ret == (ssize_t)fix_info.smem_len, "pread failed, ret=%zd\n", ret);
+		cmp = memcmp(map, buf, fix_info.smem_len);
+		igt_assert_f(!cmp, "read buffer differs from mapped framebuffer for 0x55\n");
 	}
 
 	igt_fixture {
+		free(buf);
+		memset(map, 0, fix_info.smem_len); // don't leave garbage on the screen
 		munmap(map, fix_info.smem_len);
 	}
 }
tests/intel-ci/fast-feedback.testlist +1 -0
index cf66b4da..fc8a605f 100644
@@ -3,6 +3,7 @@
 igt@core_auth@basic-auth
 igt@debugfs_test@read_all_entries
 igt@fbdev@info
+igt@fbdev@read
 igt@gem_basic@bad-close
 igt@gem_basic@create-close
 igt@gem_basic@create-fd-close
Signature · 6 lines
2.29.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#4 lore raw

PATCH v5 4/8 tests/fbdev: Add tests for unaligned reads on framebuffer memory

In reply to Thomas Zimmermann

The tests for unaligned reads start and stop reading within pages.

v4:
* declare pagesize as volatile
* test sysconf() success with igt_require() (Petri)
* clarify error message about frambuffer size (Petri)
* replace igt_require() by igt_assert() in "unaligned-read" (Petri)
* add unaligned-read test to CI
v3:
* put igt_describe() before igt_subtest() (Petri)

---
 tests/fbdev.c                         | 40 +++++++++++++++++++++++++--
 tests/intel-ci/fast-feedback.testlist |  1 +
 2 files changed, 39 insertions(+), 2 deletions(-)
tests/fbdev.c +38 -2
index d8c78a5e..be9e95c1 100644
@@ -64,10 +64,13 @@ static void mode_tests(int fd)
 static void framebuffer_tests(int fd)
 {
 	struct fb_fix_screeninfo fix_info;
-	void * volatile map;
-	void * volatile buf;
+	unsigned char * volatile map;
+	unsigned char * volatile buf;
+	volatile size_t pagesize;
 
 	igt_fixture {
+		long ret;
+
 		igt_require(ioctl(fd, FBIOGET_FSCREENINFO, &fix_info) == 0);
 		igt_assert(fix_info.smem_len);
 
@@ -77,6 +80,10 @@ static void framebuffer_tests(int fd)
 
 		buf = malloc(fix_info.smem_len);
 		igt_require(buf);
+
+		ret = sysconf(_SC_PAGESIZE);
+		igt_require(ret != -1);
+		pagesize = ret;
 	}
 
 	igt_describe("Check read operations on framebuffer memory");
@@ -99,6 +106,35 @@ static void framebuffer_tests(int fd)
 		igt_assert_f(!cmp, "read buffer differs from mapped framebuffer for 0x55\n");
 	}
 
+	igt_describe("Check read operations on unaligned locations in framebuffer memory");
+	igt_subtest("unaligned-read") {
+		off_t off;
+		size_t len;
+		ssize_t ret;
+		const unsigned char *pos;
+
+		off = pagesize + (pagesize >> 2); // 1.25 * pagesize
+		len = (pagesize << 2) + (pagesize >> 1); // 4.5 * pagesize
+		igt_require_f((off + len) < fix_info.smem_len, "framebuffer too small to test\n");
+
+		/* read at unaligned location and compare */
+		memset(map, 0, fix_info.smem_len);
+		memset(&map[off], 0x55, len);
+		memset(buf, 0xff, fix_info.smem_len);
+		ret = pread(fd, &buf[off], len, off);
+		igt_assert_f(ret == (ssize_t)len, "pread failed, ret=%zd\n", ret);
+		pos = memchr(buf, 0x55, fix_info.smem_len);
+		igt_assert_f(pos, "0x55 not found within read buffer\n");
+		igt_assert_f(pos == &buf[off], "0x55 found at pos %zu, expected %lld\n",
+			     pos - buf, (long long)off);
+		pos = memchr(&buf[off], 0xff, fix_info.smem_len - off);
+		igt_assert_f(pos, "0xff not found within read buffer\n");
+		igt_assert_f(pos == &buf[off + len], "0xff found at pos %zu, expected %lld\n",
+			     pos - buf, (long long)(off + len));
+		pos = memchr(&buf[off + len], 0x55, fix_info.smem_len - off + len);
+		igt_assert_f(pos, "found 0x55 at pos %zu, none expected\n", pos - buf);
+	}
+
 	igt_fixture {
 		free(buf);
 		memset(map, 0, fix_info.smem_len); // don't leave garbage on the screen
tests/intel-ci/fast-feedback.testlist +1 -0
index fc8a605f..2f9148ab 100644
@@ -4,6 +4,7 @@ igt@core_auth@basic-auth
 igt@debugfs_test@read_all_entries
 igt@fbdev@info
 igt@fbdev@read
+igt@fbdev@unaligned-read
 igt@gem_basic@bad-close
 igt@gem_basic@create-close
 igt@gem_basic@create-fd-close
Signature · 6 lines
2.29.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#5 lore raw

Re: [igt-dev] [PATCH v5 4/8] tests/fbdev: Add tests for unaligned reads on framebuffer memory

Quoted 89 lines · Thomas Zimmermann

The tests for unaligned reads start and stop reading within pages.

v4:
* declare pagesize as volatile
* test sysconf() success with igt_require() (Petri)
* clarify error message about frambuffer size (Petri)
* replace igt_require() by igt_assert() in "unaligned-read" (Petri)
* add unaligned-read test to CI
v3:
* put igt_describe() before igt_subtest() (Petri)

---
 tests/fbdev.c                         | 40 +++++++++++++++++++++++++--
 tests/intel-ci/fast-feedback.testlist |  1 +
 2 files changed, 39 insertions(+), 2 deletions(-)
tests/fbdev.c +38 -2
index d8c78a5e..be9e95c1 100644
@@ -64,10 +64,13 @@ static void mode_tests(int fd)
 static void framebuffer_tests(int fd)
 {
 	struct fb_fix_screeninfo fix_info;
-	void * volatile map;
-	void * volatile buf;
+	unsigned char * volatile map;
+	unsigned char * volatile buf;
+	volatile size_t pagesize;
 
 	igt_fixture {
+		long ret;
+
 		igt_require(ioctl(fd, FBIOGET_FSCREENINFO, &fix_info) == 0);
 		igt_assert(fix_info.smem_len);
 
@@ -77,6 +80,10 @@ static void framebuffer_tests(int fd)
 
 		buf = malloc(fix_info.smem_len);
 		igt_require(buf);
+
+		ret = sysconf(_SC_PAGESIZE);
+		igt_require(ret != -1);
+		pagesize = ret;
 	}
 
 	igt_describe("Check read operations on framebuffer memory");
@@ -99,6 +106,35 @@ static void framebuffer_tests(int fd)
 		igt_assert_f(!cmp, "read buffer differs from mapped framebuffer for 0x55\n");
 	}
 
+	igt_describe("Check read operations on unaligned locations in framebuffer memory");
+	igt_subtest("unaligned-read") {
+		off_t off;
+		size_t len;
+		ssize_t ret;
+		const unsigned char *pos;
+
+		off = pagesize + (pagesize >> 2); // 1.25 * pagesize
+		len = (pagesize << 2) + (pagesize >> 1); // 4.5 * pagesize
+		igt_require_f((off + len) < fix_info.smem_len, "framebuffer too small to test\n");
+
+		/* read at unaligned location and compare */
+		memset(map, 0, fix_info.smem_len);
+		memset(&map[off], 0x55, len);
+		memset(buf, 0xff, fix_info.smem_len);
+		ret = pread(fd, &buf[off], len, off);
+		igt_assert_f(ret == (ssize_t)len, "pread failed, ret=%zd\n", ret);
+		pos = memchr(buf, 0x55, fix_info.smem_len);
+		igt_assert_f(pos, "0x55 not found within read buffer\n");
+		igt_assert_f(pos == &buf[off], "0x55 found at pos %zu, expected %lld\n",
+			     pos - buf, (long long)off);
+		pos = memchr(&buf[off], 0xff, fix_info.smem_len - off);
+		igt_assert_f(pos, "0xff not found within read buffer\n");
+		igt_assert_f(pos == &buf[off + len], "0xff found at pos %zu, expected %lld\n",
+			     pos - buf, (long long)(off + len));
+		pos = memchr(&buf[off + len], 0x55, fix_info.smem_len - off + len);
+		igt_assert_f(pos, "found 0x55 at pos %zu, none expected\n", pos - buf);
+	}
+
 	igt_fixture {
 		free(buf);
 		memset(map, 0, fix_info.smem_len); // don't leave garbage on the screen
tests/intel-ci/fast-feedback.testlist +0 -0
index fc8a605f..2f9148ab 100644

tests/intel-ci/fast-feedback.testlist igt@core_auth@basic-auth · line 7

Quoted 4 lines
tests/intel-ci/fast-feedback.testlist +1 -0
@@ -4,6 +4,7 @@ igt@core_auth@basic-auth
 igt@debugfs_test@read_all_entries
 igt@fbdev@info
 igt@fbdev@read
+igt@fbdev@unaligned-read

Leave this and unaligned-write out of fast-feedback.testlist. Otherwise the CI changes look good.

Signature · 5 lines
Petri Latvala
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#6 lore raw

PATCH v5 5/8 tests/fbdev: Add tests for write operations on framebuffer

In reply to Thomas Zimmermann

The write tests check the written buffer against the content of the mapped framebuffer.

v4:
* replace igt_require() by iqt_assert() in "write" (Petri)
* add write test to CI
v3:
* put igt_describe() before igt_subtest() (Petri)

---
 tests/fbdev.c                         | 20 ++++++++++++++++++++
 tests/intel-ci/fast-feedback.testlist |  1 +
 2 files changed, 21 insertions(+)
tests/fbdev.c +20 -0
index be9e95c1..23ff146c 100644
@@ -135,6 +135,26 @@ static void framebuffer_tests(int fd)
 		igt_assert_f(pos, "found 0x55 at pos %zu, none expected\n", pos - buf);
 	}
 
+	igt_describe("Check write operations on framebuffer memory");
+	igt_subtest("write") {
+		ssize_t ret;
+		int cmp;
+
+		/* write 0 to framebuffer and compare */
+		memset(buf, 0, fix_info.smem_len);
+		ret = pwrite(fd, buf, fix_info.smem_len, 0);
+		igt_assert_f(ret == (ssize_t)fix_info.smem_len, "pwrite failed, ret=%zd\n", ret);
+		cmp = memcmp(map, buf, fix_info.smem_len);
+		igt_assert_f(!cmp, "write buffer differs from mapped framebuffer for 0\n");
+
+		/* write 0x55 to framebuffer and compare */
+		memset(buf, 0x55, fix_info.smem_len);
+		ret = pwrite(fd, buf, fix_info.smem_len, 0);
+		igt_assert_f(ret == (ssize_t)fix_info.smem_len, "pwrite failed, ret=%zd\n", ret);
+		cmp = memcmp(map, buf, fix_info.smem_len);
+		igt_assert_f(!cmp, "write buffer differs from mapped framebuffer for 0\n");
+	}
+
 	igt_fixture {
 		free(buf);
 		memset(map, 0, fix_info.smem_len); // don't leave garbage on the screen
tests/intel-ci/fast-feedback.testlist +1 -0
index 2f9148ab..66630e1d 100644
@@ -5,6 +5,7 @@ igt@debugfs_test@read_all_entries
 igt@fbdev@info
 igt@fbdev@read
 igt@fbdev@unaligned-read
+igt@fbdev@write
 igt@gem_basic@bad-close
 igt@gem_basic@create-close
 igt@gem_basic@create-fd-close
Signature · 6 lines
2.29.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#7 lore raw

PATCH v5 6/8 tests/fbdev: Add tests for unaligned writes on framebuffer memory

In reply to Thomas Zimmermann

The tests for unaligned writes start and stop writing within pages.

v4:
* replace igt_require() by igt_assert() in "unaligned-write" (Petri)
* clarify error message about framebuffer size (Petri)
* add unaligned-write test to CI
v3:
* put igt_describe() before igt_subtest() (Petri)

---
 tests/fbdev.c                         | 29 +++++++++++++++++++++++++++
 tests/intel-ci/fast-feedback.testlist |  1 +
 2 files changed, 30 insertions(+)
tests/fbdev.c +29 -0
index 23ff146c..c4cb357f 100644
@@ -155,6 +155,35 @@ static void framebuffer_tests(int fd)
 		igt_assert_f(!cmp, "write buffer differs from mapped framebuffer for 0\n");
 	}
 
+	igt_describe("Check write operations on unaligned locations in framebuffer memory");
+	igt_subtest("unaligned-write") {
+		off_t off;
+		size_t len;
+		ssize_t ret;
+		const unsigned char *pos;
+
+		off = pagesize + (pagesize >> 2); // 1.25 * pagesize
+		len = (pagesize << 2) + (pagesize >> 1); // 4.5 * pagesize
+		igt_require_f((off + len) < fix_info.smem_len, "framebuffer too small to test\n");
+
+		/* read at unaligned location and compare */
+		memset(map, 0xff, fix_info.smem_len);
+		memset(buf, 0, fix_info.smem_len);
+		memset(&buf[off], 0x55, len);
+		ret = pwrite(fd, &buf[off], len, off);
+		igt_assert_f(ret == (ssize_t)len, "pwrite failed, ret=%zd\n", ret);
+		pos = memchr(map, 0x55, fix_info.smem_len);
+		igt_assert_f(pos, "0x55 not found within framebuffer\n");
+		igt_assert_f(pos == &map[off], "0x55 found at pos %zu, expected %lld\n",
+			     pos - map, (long long)off);
+		pos = memchr(&map[off], 0xff, fix_info.smem_len - off);
+		igt_assert_f(pos, "0xff not found within framebuffer\n");
+		igt_assert_f(pos == &map[off + len], "0xff found at pos %zu, expected %lld\n",
+			     pos - map, (long long)(off + len));
+		pos = memchr(&map[off + len], 0x55, fix_info.smem_len - off + len);
+		igt_assert_f(pos, "found 0x55 at pos %zu, none expected\n", pos - map);
+	}
+
 	igt_fixture {
 		free(buf);
 		memset(map, 0, fix_info.smem_len); // don't leave garbage on the screen
tests/intel-ci/fast-feedback.testlist +1 -0
index 66630e1d..5bad1341 100644
@@ -5,6 +5,7 @@ igt@debugfs_test@read_all_entries
 igt@fbdev@info
 igt@fbdev@read
 igt@fbdev@unaligned-read
+igt@fbdev@unaligned-write
 igt@fbdev@write
 igt@gem_basic@bad-close
 igt@gem_basic@create-close
Signature · 6 lines
2.29.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#8 lore raw

PATCH v5 7/8 tests/fbdev: Add tests for accessing framebuffer near EOF

In reply to Thomas Zimmermann

Fbdev has some specific behavior when reading/writing near the EOF, which the eof test checks. If at least one bytes has been written, the number of bytes has to be returned, otherwise an error code (if any) has to be returned, or otherwise 0 has to returned. Not all drivers get this right.

v4:
* replace igt_require() by igt_assert() in "eof" (Petri)
* add eof test to CI
v3:
* put igt_describe() before igt_subtest() (Petri)

---
 tests/fbdev.c                         | 47 ++++++++++++++++++++++++++-
 tests/intel-ci/fast-feedback.testlist |  1 +
 2 files changed, 47 insertions(+), 1 deletion(-)
tests/fbdev.c +46 -1
index c4cb357f..62aa99b4 100644
@@ -78,7 +78,8 @@ static void framebuffer_tests(int fd)
 			   PROT_WRITE, MAP_SHARED, fd, 0);
 		igt_assert(map != MAP_FAILED);
 
-		buf = malloc(fix_info.smem_len);
+		/* allocate two additional bytes for eof test */
+		buf = malloc(fix_info.smem_len + 2);
 		igt_require(buf);
 
 		ret = sysconf(_SC_PAGESIZE);
@@ -184,6 +185,50 @@ static void framebuffer_tests(int fd)
 		igt_assert_f(pos, "found 0x55 at pos %zu, none expected\n", pos - map);
 	}
 
+	igt_describe("Check framebuffer access near EOF");
+	igt_subtest("eof") {
+		unsigned long lastindex = fix_info.smem_len - 1;
+		unsigned char *maplast = &((unsigned char *)map)[lastindex];
+		unsigned char *buflast = &((unsigned char *)buf)[lastindex];
+		ssize_t ret;
+
+		*buflast = 0x55;
+
+		/* write across EOF; set remaining bytes */
+		ret = pwrite(fd, buflast, 2, lastindex);
+		igt_assert_f(ret == 1, "write crossed EOF, ret=%zd\n", ret);
+		igt_assert_f(*maplast == *buflast, "write buffer differs from mapped framebuffer at final byte, "
+						   "maplast=%u buflast=%u\n", *maplast, *buflast);
+
+		/* write at EOF; get ENOSPC */
+		ret = pwrite(fd, &buflast[1], 1, lastindex + 1);
+		igt_assert_f((ret == -1) && (errno == ENOSPC), "write at EOF, ret=%zd\n", ret);
+
+		*maplast = 0;
+
+		/* write final byte */
+		ret = pwrite(fd, buflast, 1, lastindex);
+		igt_assert_f(ret == 1, "write before EOF, ret=%zd\n", ret);
+		igt_assert_f(*maplast == *buflast, "write buffer differs from mapped framebuffer at final byte, "
+						   "maplast=%u buflast=%u\n", *maplast, *buflast);
+
+		/* write after EOF; get EFBIG */
+		ret = pwrite(fd, &buflast[2], 1, lastindex + 2);
+		igt_assert_f((ret == -1) && (errno == EFBIG), "write after EOF, ret=%zd\n", ret);
+
+		*maplast = 0;
+
+		/* read across the EOF; get remaining bytes */
+		ret = pread(fd, buflast, 2, lastindex);
+		igt_assert_f(ret == 1, "read before EOF, ret=%zd\n", ret);
+		igt_assert_f(*maplast == *buflast, "read buffer differs from mapped framebuffer at final byte, "
+						   "maplast=%u buflast=%u\n", *maplast, *buflast);
+
+		/* read after EOF; get 0 */
+		ret = pread(fd, &buflast[1], 1, lastindex + 1);
+		igt_assert_f(ret == 0, "read at EOF, ret=%zd\n", ret);
+	}
+
 	igt_fixture {
 		free(buf);
 		memset(map, 0, fix_info.smem_len); // don't leave garbage on the screen
tests/intel-ci/fast-feedback.testlist +1 -0
index 5bad1341..0423de80 100644
@@ -2,6 +2,7 @@
 
 igt@core_auth@basic-auth
 igt@debugfs_test@read_all_entries
+igt@fbdev@eof
 igt@fbdev@info
 igt@fbdev@read
 igt@fbdev@unaligned-read
Signature · 6 lines
2.29.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#9 lore raw

PATCH v5 8/8 tests/fbdev: Add tests for read/writing with NULL-pointer buffers

In reply to Thomas Zimmermann

Trying to read and write with a NULL-pointer buffer should fail and report EFAULT.

v4:
* replace igt_require() by igt_assert() in "nullptr" (Petri)
* add nullptr test to CI
v3:
* put igt_describe() before igt_subtest() (Petri)

---
 tests/fbdev.c                         | 11 +++++++++++
 tests/intel-ci/fast-feedback.testlist |  1 +
 2 files changed, 12 insertions(+)
tests/fbdev.c +11 -0
index 62aa99b4..c6139124 100644
@@ -229,6 +229,17 @@ static void framebuffer_tests(int fd)
 		igt_assert_f(ret == 0, "read at EOF, ret=%zd\n", ret);
 	}
 
+	igt_describe("Check framebuffer access with NULL");
+	igt_subtest("nullptr") {
+		ssize_t ret;
+
+		ret = pread(fd, NULL, fix_info.smem_len, 0);
+		igt_require_f((ret == -1) && (errno == EFAULT), "reading into NULL did not return EFAULT, ret=%zd\n", ret);
+
+		ret = pwrite(fd, NULL, fix_info.smem_len, 0);
+		igt_require_f((ret == -1) && (errno == EFAULT), "writing from NULL did not return EFAULT, ret=%zd\n", ret);
+	}
+
 	igt_fixture {
 		free(buf);
 		memset(map, 0, fix_info.smem_len); // don't leave garbage on the screen
tests/intel-ci/fast-feedback.testlist +1 -0
index 0423de80..71bbd173 100644
@@ -4,6 +4,7 @@ igt@core_auth@basic-auth
 igt@debugfs_test@read_all_entries
 igt@fbdev@eof
 igt@fbdev@info
+igt@fbdev@nullptr
 igt@fbdev@read
 igt@fbdev@unaligned-read
 igt@fbdev@unaligned-write
Signature · 6 lines
2.29.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#10 lore raw

Re: [igt-dev] [PATCH v5 8/8] tests/fbdev: Add tests for read/writing with NULL-pointer buffers

Quoted 5 lines · Thomas Zimmermann

Trying to read and write with a NULL-pointer buffer should fail and report EFAULT.

v4:
* replace igt_require() by igt_assert() in "nullptr" (Petri)

But they're still igt_requires in there?

Signature · 1 line
Petri Latvala
Quoted 47 lines

* add nullptr test to CI
v3:
* put igt_describe() before igt_subtest() (Petri)

---
 tests/fbdev.c                         | 11 +++++++++++
 tests/intel-ci/fast-feedback.testlist |  1 +
 2 files changed, 12 insertions(+)
tests/fbdev.c +11 -0
index 62aa99b4..c6139124 100644
@@ -229,6 +229,17 @@ static void framebuffer_tests(int fd)
 		igt_assert_f(ret == 0, "read at EOF, ret=%zd\n", ret);
 	}
 
+	igt_describe("Check framebuffer access with NULL");
+	igt_subtest("nullptr") {
+		ssize_t ret;
+
+		ret = pread(fd, NULL, fix_info.smem_len, 0);
+		igt_require_f((ret == -1) && (errno == EFAULT), "reading into NULL did not return EFAULT, ret=%zd\n", ret);
+
+		ret = pwrite(fd, NULL, fix_info.smem_len, 0);
+		igt_require_f((ret == -1) && (errno == EFAULT), "writing from NULL did not return EFAULT, ret=%zd\n", ret);
+	}
+
 	igt_fixture {
 		free(buf);
 		memset(map, 0, fix_info.smem_len); // don't leave garbage on the screen
tests/intel-ci/fast-feedback.testlist +1 -0
index 0423de80..71bbd173 100644
@@ -4,6 +4,7 @@ igt@core_auth@basic-auth
 igt@debugfs_test@read_all_entries
 igt@fbdev@eof
 igt@fbdev@info
+igt@fbdev@nullptr
 igt@fbdev@read
 igt@fbdev@unaligned-read
 igt@fbdev@unaligned-write
Signature · 1 line
2.29.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#11 lore raw

Re: [igt-dev] [PATCH v5 8/8] tests/fbdev: Add tests for read/writing with NULL-pointer buffers

Hi

Am 19.11.20 um 15:11 schrieb Petri Latvala:

Quoted 8 lines · Thomas Zimmermann
Quoted 5 lines

Trying to read and write with a NULL-pointer buffer should fail and report EFAULT.

v4:
* replace igt_require() by igt_assert() in "nullptr" (Petri)

But they're still igt_requires in there?

Sorry, my mistake. Thanks for double-checking.

Best regards
Thomas

Quoted 2 lines
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#12 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for Test cases for fbdev

In reply to Thomas Zimmermann
== Series Details ==

== Series Details ==

Series: Test cases for fbdev
URL : https://patchwork.freedesktop.org/series/84065/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9362 -> IGTPW_5198
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_5198 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_5198, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_5198:

### IGT changes ###

#### Possible regressions ####

* {igt@fbdev@read} (NEW):
- {fi-dg1-1}: NOTRUN -> [SKIP][1] +5 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-dg1-1/igt@[email protected]

* igt@gem_exec_suspend@basic-s0:
- fi-glk-dsi: NOTRUN -> [INCOMPLETE][2]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-glk-dsi/igt@[email protected]

New tests
---------

New tests have been introduced between CI_DRM_9362 and IGTPW_5198:

### New IGT tests (6) ###

* igt@fbdev@eof:
- Statuses : 35 pass(s) 4 skip(s)
- Exec time: [0.0, 0.00] s

* igt@fbdev@nullptr:
- Statuses : 35 pass(s) 4 skip(s)
- Exec time: [0.0, 0.01] s

* igt@fbdev@read:
- Statuses : 35 pass(s) 4 skip(s)
- Exec time: [0.0, 3.06] s

* igt@fbdev@unaligned-read:
- Statuses : 35 pass(s) 4 skip(s)
- Exec time: [0.0, 0.07] s

* igt@fbdev@unaligned-write:
- Statuses : 35 pass(s) 4 skip(s)
- Exec time: [0.0, 1.04] s

* igt@fbdev@write:
- Statuses : 35 pass(s) 4 skip(s)
- Exec time: [0.0, 2.05] s

Known issues
------------

Here are the changes found in IGTPW_5198 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@core_hotunplug@unbind-rebind:
- fi-skl-lmem: [PASS][3] -> [DMESG-WARN][4] ([i915#2605]) +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-skl-lmem/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-skl-lmem/igt@[email protected]
- fi-kbl-7500u: [PASS][5] -> [DMESG-WARN][6] ([i915#2540])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-kbl-7500u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-kbl-7500u/igt@[email protected]

* igt@i915_selftest@live@active:
- fi-tgl-y: [PASS][7] -> [DMESG-FAIL][8] ([i915#666])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-tgl-y/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-tgl-y/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@gt_lrc:
- fi-bsw-n3050: [PASS][9] -> [DMESG-FAIL][10] ([i915#2675])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-bsw-n3050/igt@i915_selftest@live@gt_lrc.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-bsw-n3050/igt@i915_selftest@live@gt_lrc.html

* igt@kms_busy@basic@flip:
- fi-kbl-soraka: [PASS][11] -> [DMESG-WARN][12] ([i915#1982])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-kbl-soraka/igt@kms_busy@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-kbl-soraka/igt@kms_busy@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- fi-icl-u2: [PASS][13] -> [DMESG-WARN][14] ([i915#1982]) +1 similar issue
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-icl-u2/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-icl-u2/igt@[email protected]

* igt@kms_flip@basic-plain-flip@d-edp1:
- fi-tgl-y: [PASS][15] -> [DMESG-WARN][16] ([i915#1982])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-tgl-y/igt@kms_flip@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-tgl-y/igt@kms_flip@[email protected]

* igt@prime_vgem@basic-gtt:
- fi-tgl-y: [PASS][17] -> [DMESG-WARN][18] ([i915#402]) +1 similar issue
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-tgl-y/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-tgl-y/igt@[email protected]

#### Possible fixes ####

* igt@core_hotunplug@unbind-rebind:
- fi-icl-u2: [DMESG-WARN][19] ([i915#1982]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-icl-u2/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-icl-u2/igt@[email protected]

* igt@gem_mmap_gtt@basic:
- fi-tgl-y: [DMESG-WARN][21] ([i915#402]) -> [PASS][22] +2 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-tgl-y/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-tgl-y/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- fi-byt-j1900: [DMESG-WARN][23] ([i915#1982]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-byt-j1900/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-byt-j1900/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-bsw-kefka: [DMESG-WARN][25] ([i915#1982]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9362/fi-bsw-kefka/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/fi-bsw-kefka/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2540]: https://gitlab.freedesktop.org/drm/intel/issues/2540
[i915#2605]: https://gitlab.freedesktop.org/drm/intel/issues/2605
[i915#2675]: https://gitlab.freedesktop.org/drm/intel/issues/2675
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#666]: https://gitlab.freedesktop.org/drm/intel/issues/666

Participating hosts (42 -> 39)
------------------------------

Additional (2): fi-glk-dsi fi-cfl-guc
Missing (5): fi-ilk-m540 fi-tgl-dsi fi-hsw-4200u fi-bsw-cyan fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_5859 -> IGTPW_5198

CI-20190529: 20190529
CI_DRM_9362: 374246282b84ca52149ecb9a83a4ad7a515d01d9 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_5198: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/index.html
IGT_5859: 5bc1047cc8f38a9e0c5a914b6511a639b15a740e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Testlist changes ==

+igt@fbdev@eof
+igt@fbdev@nullptr
+igt@fbdev@read
+igt@fbdev@unaligned-read
+igt@fbdev@unaligned-write
+igt@fbdev@write
-igt@fbdev@mmap

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5198/index.html

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev