summaryrefslogtreecommitdiff
path: root/tests/gem_mmap.c
diff options
context:
space:
mode:
authorMike Mason <michael.w.mason@intel.com>2014-08-18 10:43:49 -0700
committerThomas Wood <thomas.wood@intel.com>2014-08-19 11:32:06 +0100
commit4d2f511cee49db9b8f1ebf93b9835d871dfb9a9e (patch)
tree95a4af1122c274dd9492a2cacbd2e3747db1b199 /tests/gem_mmap.c
parente9da093b13c572b50c84ea2ec19244c8e2b78f08 (diff)
tests: Fix seg fault when gem_mmap is run without specifying a subtest
gem_mmap seg faults when all tests are run together. This occurs because the new-object subtest closes the gem object, but short-mmap assumes it still exists. Thus gem_mmap__cpu() returns nil for addr and memset() seg faults. This patch makes new-object and short-mmap create and close their own gem objects. Signed-off-by: Mike Mason <michael.w.mason@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'tests/gem_mmap.c')
-rw-r--r--tests/gem_mmap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/gem_mmap.c b/tests/gem_mmap.c
index 334bd760..33ffe452 100644
--- a/tests/gem_mmap.c
+++ b/tests/gem_mmap.c
@@ -62,10 +62,8 @@ igt_main
igt_assert(ret == -1 && errno == ENOENT);
}
- igt_fixture
- handle = gem_create(fd, OBJECT_SIZE);
-
igt_subtest("new-object") {
+ handle = gem_create(fd, OBJECT_SIZE);
arg.handle = handle;
arg.offset = 0;
arg.size = OBJECT_SIZE;
@@ -94,9 +92,11 @@ igt_main
igt_subtest("short-mmap") {
igt_assert(OBJECT_SIZE > 4096);
+ handle = gem_create(fd, OBJECT_SIZE);
addr = gem_mmap__cpu(fd, handle, 4096, PROT_WRITE);
memset(addr, 0, 4096);
munmap(addr, 4096);
+ gem_close(fd, handle);
}
igt_fixture