All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Mason <michael.w.mason@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 i-g-t 1/1] tests: Fix seg fault when gem_mmap is run without specifying a subtest
Date: Mon, 18 Aug 2014 10:43:49 -0700	[thread overview]
Message-ID: <1408383829-1935-1-git-send-email-michael.w.mason@intel.com> (raw)

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>
---
 tests/gem_mmap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/gem_mmap.c b/tests/gem_mmap.c
index 334bd76..33ffe45 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
-- 
1.9.1

             reply	other threads:[~2014-08-18 17:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 17:43 Mike Mason [this message]
2014-08-19 10:40 ` [PATCH v2 i-g-t 1/1] tests: Fix seg fault when gem_mmap is run without specifying a subtest Thomas Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1408383829-1935-1-git-send-email-michael.w.mason@intel.com \
    --to=michael.w.mason@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.