From patchwork Thu Aug 31 21:33:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vinay Belgaumkar X-Patchwork-Id: 9932965 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 32D6060362 for ; Thu, 31 Aug 2017 21:30:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 265D725EA6 for ; Thu, 31 Aug 2017 21:30:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FC8327F85; Thu, 31 Aug 2017 21:30:42 +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 8754525EA6 for ; Thu, 31 Aug 2017 21:30:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A8596E78C; Thu, 31 Aug 2017 21:30:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id C6A176E78C for ; Thu, 31 Aug 2017 21:30:36 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Aug 2017 14:30:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,455,1498546800"; d="scan'208";a="146871913" Received: from vinaysim-desktop.fm.intel.com ([10.1.27.130]) by fmsmga006.fm.intel.com with ESMTP; 31 Aug 2017 14:30:36 -0700 From: Vinay Belgaumkar To: intel-gfx@lists.freedesktop.org Date: Thu, 31 Aug 2017 14:33:23 -0700 Message-Id: <1504215203-197533-1-git-send-email-vinay.belgaumkar@intel.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v2] 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. Trying to establish a method to document subtests, it should describe the feature being tested rather than how. The HOW part can, if needed, be described in the test code. Documenting subtests will give us a good way to trace feature test coverage, and also help a faster ramp for understanding the test code. v2: Removed duplication, addressed comments, cc'd test author Cc: MichaƂ Winiarski Cc: Eric Anholt Signed-off-by: Vinay Belgaumkar --- tests/gem_flink_basic.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/tests/gem_flink_basic.c b/tests/gem_flink_basic.c index 26ae7d6..9c8c4c3 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,8 +46,6 @@ test_flink(int fd) struct drm_gem_open open_struct; int ret; - igt_info("Testing flink and open.\n"); - memset(&create, 0, sizeof(create)); create.size = 16 * 1024; ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); @@ -69,8 +69,6 @@ test_double_flink(int fd) struct drm_gem_flink flink2; int ret; - igt_info("Testing repeated flink.\n"); - memset(&create, 0, sizeof(create)); create.size = 16 * 1024; ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); @@ -92,8 +90,6 @@ test_bad_flink(int fd) struct drm_gem_flink flink; int ret; - igt_info("Testing error return on bad flink ioctl.\n"); - flink.handle = 0x10101010; ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); igt_assert(ret == -1 && errno == ENOENT); @@ -105,8 +101,6 @@ test_bad_open(int fd) struct drm_gem_open open_struct; int ret; - igt_info("Testing error return on bad open ioctl.\n"); - open_struct.name = 0x10101010; ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct); @@ -121,8 +115,6 @@ test_flink_lifetime(int fd) struct drm_gem_open open_struct; int ret, fd2; - igt_info("Testing flink lifetime.\n"); - fd2 = drm_open_driver(DRIVER_INTEL); memset(&create, 0, sizeof(create)); @@ -134,11 +126,13 @@ test_flink_lifetime(int fd) ret = ioctl(fd2, DRM_IOCTL_GEM_FLINK, &flink); igt_assert_eq(ret, 0); + /* Open another reference to the gem object */ open_struct.name = flink.name; ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct); igt_assert_eq(ret, 0); igt_assert(open_struct.handle != 0); + /* Before closing the previous one */ close(fd2); fd2 = drm_open_driver(DRIVER_INTEL); @@ -155,14 +149,36 @@ igt_main igt_fixture fd = drm_open_driver(DRIVER_INTEL); + /** + * basic: + * Test creation and use of flink. + */ igt_subtest("basic") test_flink(fd); + + /** + * double-flink: + * This test validates the ability to create multiple flinks + * for the same gem object. They should obtain the same name. + */ igt_subtest("double-flink") test_double_flink(fd); + + /** + * bad-flink: + * Negative test for invalid flink usage. + */ igt_subtest("bad-flink") test_bad_flink(fd); + igt_subtest("bad-open") test_bad_open(fd); + + /** + * flink-lifetime: + * Flink lifetime is limited to that of the gem object it + * points to. + */ igt_subtest("flink-lifetime") test_flink_lifetime(fd); }