From patchwork Wed May 7 13:55:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 4128671 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6A2929F334 for ; Wed, 7 May 2014 13:55:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3900201ED for ; Wed, 7 May 2014 13:55:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D0BD2201BB for ; Wed, 7 May 2014 13:55:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 16FE06ED02; Wed, 7 May 2014 06:55:31 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id E5D5C6ED12 for ; Wed, 7 May 2014 06:55:28 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 07 May 2014 06:55:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="4.97,1003,1389772800"; d="scan'208"; a="535206828" Received: from rosetta.fi.intel.com (HELO rosetta) ([10.237.72.66]) by fmsmga002.fm.intel.com with ESMTP; 07 May 2014 06:55:27 -0700 Received: by rosetta (Postfix, from userid 1000) id CAB99800B6; Wed, 7 May 2014 16:55:29 +0300 (EEST) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Wed, 7 May 2014 16:55:28 +0300 Message-Id: <1399470928-15389-1-git-send-email-mika.kuoppala@intel.com> X-Mailer: git-send-email 1.7.9.5 Subject: [Intel-gfx] [PATCH] tests/gem_flink_race, prime_self_import: fix object counts 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.8 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 We need to add one drm_open_any() before getting the object counts as first call to drm_open_any() allocates file descriptors for exit handlers and thus is not symmetrical Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77867 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77875 Signed-off-by: Mika Kuoppala --- tests/gem_flink_race.c | 8 ++++++++ tests/prime_self_import.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/gem_flink_race.c b/tests/gem_flink_race.c index 3353b83..f129cb3 100644 --- a/tests/gem_flink_race.c +++ b/tests/gem_flink_race.c @@ -163,6 +163,11 @@ static void test_flink_close(void) int r, i, num_threads; int obj_count; void *status; + int fake; + + /* Allocate exit handler fds in here so that we dont screw + * up the counts */ + fake = drm_open_any(); obj_count = get_object_count(); @@ -193,6 +198,9 @@ static void test_flink_close(void) obj_count = get_object_count() - obj_count; printf("leaked %i objects\n", obj_count); + + close(fake); + igt_assert(obj_count == 0); } diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c index efdd24f..41c203f 100644 --- a/tests/prime_self_import.c +++ b/tests/prime_self_import.c @@ -258,6 +258,11 @@ static void test_reimport_close_race(void) int obj_count; void *status; uint32_t handle; + int fake; + + /* Allocate exit handler fds in here so that we dont screw + * up the counts */ + fake = drm_open_any(); obj_count = get_object_count(); @@ -294,6 +299,9 @@ static void test_reimport_close_race(void) obj_count = get_object_count() - obj_count; printf("leaked %i objects\n", obj_count); + + close(fake); + igt_assert(obj_count == 0); }