From patchwork Thu Sep 14 18:09:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vinay Belgaumkar X-Patchwork-Id: 9953667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DFF466024A for ; Thu, 14 Sep 2017 18:07:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4839291BE for ; Thu, 14 Sep 2017 18:07:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D99CD291C5; Thu, 14 Sep 2017 18:07:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B96BE291C6 for ; Thu, 14 Sep 2017 18:07:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1BF576E29A; Thu, 14 Sep 2017 18:07:42 +0000 (UTC) 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 ESMTPS id BF33189906 for ; Thu, 14 Sep 2017 18:07:40 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Sep 2017 11:07:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,394,1500966000"; d="scan'208";a="151404272" Received: from vinaysim-desktop.fm.intel.com ([10.1.27.130]) by fmsmga005.fm.intel.com with ESMTP; 14 Sep 2017 11:07:39 -0700 From: Vinay Belgaumkar To: intel-gfx@lists.freedesktop.org Date: Thu, 14 Sep 2017 11:09:58 -0700 Message-Id: <1505412598-35854-1-git-send-email-vinay.belgaumkar@intel.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH i-g-t v3] tests/gem_flink_basic: Add documentation for subtests X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Added the missing IGT_TEST_DESCRIPTION and some subtest descriptions. v2: Removed duplication, addressed comments, cc'd test author v3: Only comment abstract code, change some igt_info to igt_debug. Changed description to reflect this is a patch, not an RFC. Cc: MichaƂ Winiarski Cc: Eric Anholt Cc: Arkadiusz Hiler Cc: Daniel Vetter Signed-off-by: Vinay Belgaumkar --- tests/gem_flink_basic.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/gem_flink_basic.c b/tests/gem_flink_basic.c index 26ae7d6..48b0b8b 100644 --- a/tests/gem_flink_basic.c +++ b/tests/gem_flink_basic.c @@ -36,6 +36,8 @@ #include #include "drm.h" +IGT_TEST_DESCRIPTION("Tests for flink - a way to export a gem object by name"); + static void test_flink(int fd) { @@ -44,7 +46,7 @@ test_flink(int fd) struct drm_gem_open open_struct; int ret; - igt_info("Testing flink and open.\n"); + igt_debug("Testing flink and open.\n"); memset(&create, 0, sizeof(create)); create.size = 16 * 1024; @@ -69,7 +71,7 @@ test_double_flink(int fd) struct drm_gem_flink flink2; int ret; - igt_info("Testing repeated flink.\n"); + igt_debug("Testing repeated flink.\n"); memset(&create, 0, sizeof(create)); create.size = 16 * 1024; @@ -83,6 +85,8 @@ test_double_flink(int fd) flink2.handle = create.handle; ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink2); igt_assert_eq(ret, 0); + + /* flinks for same gem object share the same name */ igt_assert(flink2.name == flink.name); } @@ -92,7 +96,7 @@ test_bad_flink(int fd) struct drm_gem_flink flink; int ret; - igt_info("Testing error return on bad flink ioctl.\n"); + igt_debug("Testing error return on bad flink ioctl.\n"); flink.handle = 0x10101010; ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); @@ -105,7 +109,7 @@ test_bad_open(int fd) struct drm_gem_open open_struct; int ret; - igt_info("Testing error return on bad open ioctl.\n"); + igt_debug("Testing error return on bad open ioctl.\n"); open_struct.name = 0x10101010; ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct); @@ -121,7 +125,7 @@ test_flink_lifetime(int fd) struct drm_gem_open open_struct; int ret, fd2; - igt_info("Testing flink lifetime.\n"); + igt_debug("Testing flink lifetime.\n"); fd2 = drm_open_driver(DRIVER_INTEL); @@ -134,6 +138,7 @@ test_flink_lifetime(int fd) ret = ioctl(fd2, DRM_IOCTL_GEM_FLINK, &flink); igt_assert_eq(ret, 0); + /* Open a second reference to the gem object with different fd */ open_struct.name = flink.name; ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct); igt_assert_eq(ret, 0); @@ -142,6 +147,7 @@ test_flink_lifetime(int fd) close(fd2); fd2 = drm_open_driver(DRIVER_INTEL); + /* Flink name remains valid due to the second reference */ open_struct.name = flink.name; ret = ioctl(fd2, DRM_IOCTL_GEM_OPEN, &open_struct); igt_assert_eq(ret, 0); @@ -163,6 +169,8 @@ igt_main test_bad_flink(fd); igt_subtest("bad-open") test_bad_open(fd); + + /* Flink lifetime is limited to that of the gem object it points to */ igt_subtest("flink-lifetime") test_flink_lifetime(fd); }