From patchwork Mon Aug 18 17:43:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mason, Michael W" X-Patchwork-Id: 4738461 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4158DC0338 for ; Mon, 18 Aug 2014 17:42:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 60787200F3 for ; Mon, 18 Aug 2014 17:42:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9628A200E5 for ; Mon, 18 Aug 2014 17:42:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2CF0B8908E; Mon, 18 Aug 2014 10:42:29 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org 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) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 18 Aug 2014 10:36:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,887,1400050800"; d="scan'208";a="560134431" Received: from otc-chrmqaubu-05.jf.intel.com ([10.7.202.145]) by orsmga001.jf.intel.com with ESMTP; 18 Aug 2014 10:42:15 -0700 From: Mike Mason To: intel-gfx@lists.freedesktop.org Date: Mon, 18 Aug 2014 10:43:49 -0700 Message-Id: <1408383829-1935-1-git-send-email-michael.w.mason@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [Intel-gfx] [PATCH v2 i-g-t 1/1] tests: Fix seg fault when gem_mmap is run without specifying a subtest X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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