[igt-dev] [PATCH v6 5/8] tests/fbdev: Add tests for write operations on framebuffer
Thomas Zimmermann
tzimmermann at suse.de
Fri Nov 20 10:52:14 UTC 2020
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)
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
tests/fbdev.c | 20 ++++++++++++++++++++
tests/intel-ci/fast-feedback.testlist | 1 +
2 files changed, 21 insertions(+)
diff --git a/tests/fbdev.c b/tests/fbdev.c
index be9e95c1..23ff146c 100644
--- a/tests/fbdev.c
+++ b/tests/fbdev.c
@@ -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
diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist
index fc8a605f..58e2ac1c 100644
--- a/tests/intel-ci/fast-feedback.testlist
+++ b/tests/intel-ci/fast-feedback.testlist
@@ -4,6 +4,7 @@ igt at core_auth@basic-auth
igt at debugfs_test@read_all_entries
igt at fbdev@info
igt at fbdev@read
+igt at fbdev@write
igt at gem_basic@bad-close
igt at gem_basic@create-close
igt at gem_basic@create-fd-close
--
2.29.2
More information about the igt-dev
mailing list