[igt-dev] [PATCH v3 5/8] tests/fbdev: Add tests for write operations on framebuffer
Thomas Zimmermann
tzimmermann at suse.de
Tue Nov 10 07:50:59 UTC 2020
The write tests check the written buffer against the content of the mapped
framebuffer.
v3:
* put igt_describe() before igt_subtest() (Petri)
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
tests/fbdev.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tests/fbdev.c b/tests/fbdev.c
index a6376c3b..02abdede 100644
--- a/tests/fbdev.c
+++ b/tests/fbdev.c
@@ -135,6 +135,26 @@ static void framebuffer_tests(int fd)
igt_require_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_require_f(ret == (ssize_t)fix_info.smem_len, "pwrite failed, ret=%zd\n", ret);
+ cmp = memcmp(map, buf, fix_info.smem_len);
+ igt_require_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_require_f(ret == (ssize_t)fix_info.smem_len, "pwrite failed, ret=%zd\n", ret);
+ cmp = memcmp(map, buf, fix_info.smem_len);
+ igt_require_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
--
2.29.2
More information about the igt-dev
mailing list