tests: Fix seg fault when gem_mmap is run without specifying a subtest
PATCH v2 1/1 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.
--- tests/gem_mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/gem_mmap.c +3 -3
@@ -62,10 +62,8 @@ igt_mainigt_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
Signature · 1 line
1.9.1
Quoted 5 lines · Mike Mason
gem_mmapseg 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. Thusgem_mmap__cpu()returns nil for addr andmemset()seg faults. This patch makes new-object and short-mmap create and close their own gem objects.
Both patches (this one and "scripts: Allow multiple -t and -x regular expressions for run-tests.sh") merged, thanks.
Quoted 41 lines
Signed-off-by Mike Mason <[email protected]>--- tests/gem_mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)tests/gem_mmap.c +3
-4@@ -62,10 +62,8 @@ igt_mainigt_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 --1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx