From: Mike Mason 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 Message-ID: <1408383829-1935-1-git-send-email-michael.w.mason@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id AA07C8908E for ; Mon, 18 Aug 2014 10:42:27 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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 --- 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