Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp49234rdb; Fri, 5 Jan 2024 02:15:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKToE7EQssoiJhajyBorRvutJWyYtXTl2LAbA2a6xegPFX/cJLpk8YP0OT+ixgqHtRcOSf X-Received: by 2002:a05:6358:920e:b0:175:61aa:e0be with SMTP id d14-20020a056358920e00b0017561aae0bemr2099299rwb.1.1704449721451; Fri, 05 Jan 2024 02:15:21 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ko15-20020a056a00460f00b006da7d962a0esi1048606pfb.123.2024.01.05.02.15.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 02:15:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17723-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bEcfQJkt; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-17723-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17723-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C820B2842AA for ; Fri, 5 Jan 2024 10:15:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 764E828DB7; Fri, 5 Jan 2024 10:13:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bEcfQJkt" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4149525553 for ; Fri, 5 Jan 2024 10:13:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704449636; x=1735985636; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=yngqZG8Spc06NTUdaXFEbO5cTO9IfPcH40tZek15x7A=; b=bEcfQJktuS7mLupe6kbxNc3r0LI79YmUWpLBk6qEdIiOq7tT/G/IQKH8 1cvyQZxBohNgZnMcBexZvQ+gnmTIg0txbkocH9TimI92aFFU22i39K8dC IRfLtX8/DG2n2ow6yzXr/y3Lt7JGj0QcO/S7yJZVd9UZfLZpsACulafo7 WPFMxU7Cqbz5MiAVUM2W+kFvEd5ztB0kGswzLKF5j29KdwgcJneFI3guo asrKT5Ul7qi235PlqmF6dzciQWS78mK4YJuG5lXqORpLW9NInAiVRgmQY HaPFKe7NmEtpwNo/sjl4AKFG0qFuJtmfzDUvupB/zFbbZR9kfXzYXrDSz Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="483651631" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="483651631" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2024 02:13:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="730435473" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="730435473" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga003.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Jan 2024 02:13:55 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 5 Jan 2024 02:13:55 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Fri, 5 Jan 2024 02:13:55 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 5 Jan 2024 02:13:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cpR5RtF1eUQtOFq1o/wlSlGClbX/rgRqjQbEqis713MFwJ/DJOvt5+IAbcXQFQTnTC6JJ93JzTiO/aVUR5cC16uYa8uL9ASxkZ5OWdTKpeuXrF/GllcvLsatEew7MluPNj4iunKKHwJ+asBV4+HAUQpZA6Mlh18PDxvESf74sAAXqO67YNiqJZkPmJ04+1IZnEk+IdyNf3rMbqg2FhxD2IH8ZptbcmIrxRl1zbyypUDzaBc6j6dNJAI5t6+BmShHirf2CJLGqmVRYGq21WLCxdxeMI3CToO2xyazeNsRPI2+rOpmom2XORx05hzzrA2W2pU1jDJVCI72Kl1FqcpNMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=36WGdOADJ6H/0w6QoNAwTeI1Doo4V2GznzvvWmIxLvs=; b=cF+hDv7YhvTwQg4BoDsMriUzkqYt+RHt37/ljx2A5c9DdOcy+95FyXuEfYOos20OlaR27SX10gL96DXE5IVbeHqTP5h4gUEH/dU8u5ZHoyEigPkm+dejfV1pJuf/ePohmRf+FPmHlv3xYdph0rzf3ZD+v1ii7BYk4ePOdM6J/NRpka6yBtXnvGDu7NC5/0dppsj1mZG4/xt6086XXu2WY8nqD62DuyWpCaJ/8WJbGlbt0wLK1LV7IysTMuUP4Mu30464KGTD8MDrAi7AkpoEu1z8gosbXaqPF60AtobnGRfhSpP46hoOWJsfRohuoCb8K7XawDezxucJSakH/vvzJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) by PH0PR11MB4823.namprd11.prod.outlook.com (2603:10b6:510:43::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.17; Fri, 5 Jan 2024 10:13:47 +0000 Received: from DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::f105:47dd:6794:6821]) by DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::f105:47dd:6794:6821%4]) with mapi id 15.20.7159.015; Fri, 5 Jan 2024 10:13:46 +0000 From: =?UTF-8?q?Micha=C5=82=20Winiarski?= To: , , CC: Rodrigo Vivi , Michal Wajdeczko , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Javier Martinez Canillas , =?UTF-8?q?Ma=C3=ADra=20Canal?= , =?UTF-8?q?Micha=C5=82=20Winiarski?= Subject: [PATCH v4 4/6] drm/tests: managed: Add comments and expect fail messages Date: Fri, 5 Jan 2024 11:13:22 +0100 Message-ID: <20240105101324.26811-5-michal.winiarski@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240105101324.26811-1-michal.winiarski@intel.com> References: <20240105101324.26811-1-michal.winiarski@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: VI1PR0502CA0007.eurprd05.prod.outlook.com (2603:10a6:803:1::20) To BL1PR11MB5365.namprd11.prod.outlook.com (2603:10b6:208:308::18) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5373:EE_|PH0PR11MB4823:EE_ X-MS-Office365-Filtering-Correlation-Id: d960fb1a-3988-44e4-87d6-08dc0dd700bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4DqXvZf7zn2juiK45TfYS6bAOq4clc8FnN8tOHK50lyFlqOi5TIjHvHsiwdJQBGppwvuxr6CudcLKDgWJM4kYwOx9mlvNeYegF5VNRyzrVV4X/yF13o2bveBYEonEBoeNzDPqPITX5dvItnhf7+Wx2p1lHYYUrdWY3ilc5MUyDUu2ufK5vP3KjS2Cmy/9Z0JMIFQMIsxooqm24tlusIQZ+EWYrGcn8QvEZ+74JnJwHmmbr2K5Q8PllZfq5HeoYrWtdL/4X9a76Hl076/I8kg01qTzrXG5E6jaTGnks2jtN2cCts3wTA4pwG8NZXZbI74yG/nD2lkQA3RjATkJEugZBk20w54Uw5J9RxJS9h0mU0ymt+WKNXmc6dJDouL+dkKPVCkuHBwC5Avo0c0tiFyCPGvlc5bZhjBVrilWZ0BpFnTLB5I271qEj4iWJL+1I+hGaKYt+zwL37kP9bi4SXRmddMkRWmLDMP+fJoMHLfvOVmNX4F1XApEvjxJYiL72xf96h5whXHR+zT2oUlB4plS1vmKhR7Q8JY4waXl30jZz/ngC7hafZEEwKXdAzqGpUO X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5373.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(39860400002)(396003)(376002)(346002)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(2616005)(26005)(1076003)(6666004)(6506007)(6512007)(86362001)(83380400001)(4326008)(8676002)(8936002)(316002)(54906003)(7416002)(36756003)(2906002)(5660300002)(6486002)(478600001)(66946007)(66476007)(66556008)(38100700002)(82960400001)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UHgzZ1hLUmNKVWZ5SERxcHlFcDQ0dDB3VFdhemRuTUZMemQ5bXAvSTVGTVZ0?= =?utf-8?B?U0xuUTByMVdMbTNIbnhzNGl5VDVUMU5PQ1QvWTQxa1RrcEVBTS9QQ3N2Vlo1?= =?utf-8?B?aHdsRHBhRURjaUxGU2o5aFNUT201ZTZpRXlXYmJLQ2tqZEx2YlZHUUtRUGIy?= =?utf-8?B?KzJlVEJJRnJmME5sQUZwWU5VK2cvdDFGYjhUNTk5SWx3bVVseWUxdlRmMmoz?= =?utf-8?B?dktCZ2pwaHZudFNkZDJsWE5lUHRFbE5jaDg4TmpQRzIzVmlCUEdqTGNEcVIz?= =?utf-8?B?UkpiWWpET010TzlQOGFQcmI0dkFFSTg3TlVNTHYrRFpNNXljTEhVK1M5SE1r?= =?utf-8?B?L1JpOEJwaHhnU1UyZ0d0dXpsRDJIcVFwOFRIamtwRUhFcE1BTDdTTndFTFpu?= =?utf-8?B?c2dG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1a-3988-44e4-87d6-08dc0dd700bc X-MS-Exchange-CrossTenant-AuthSource: BL1PR11MB5365.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2024 10:13:46.6390 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wnBS3Xq0KhmIAbrqLEYcMVDLROpXSuYfz8ax9F94iaGEqq0Ue+yRBIWv1MzvSMnUDgT8eAklSpjX6TvHWoz6ObugDd9nGd08Pk+0N00mPXw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4823 X-OriginatorOrg: intel.com Add comments explaining the intention behind the test and certain implementation details related to device lifetime. Signed-off-by: MichaƂ Winiarski --- drivers/gpu/drm/tests/drm_managed_test.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tests/drm_managed_test.c b/drivers/gpu/drm/tests/drm_managed_test.c index e4790ae838ba7..986a38c9144a5 100644 --- a/drivers/gpu/drm/tests/drm_managed_test.c +++ b/drivers/gpu/drm/tests/drm_managed_test.c @@ -19,6 +19,10 @@ static void drm_action(struct drm_device *drm, void *ptr) priv->action_done = true; } +/* + * The test verifies that the release action is called automatically when the + * device is released. + */ static void drm_test_managed_run_action(struct kunit *test) { struct managed_test_priv *priv; @@ -32,6 +36,11 @@ static void drm_test_managed_run_action(struct kunit *test) dev = drm_kunit_helper_alloc_device(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev); + /* + * DRM device can't be embedded in priv, since priv->action_done needs + * to remain allocated beyond both parent device and drm_device + * lifetime. + */ drm = __drm_kunit_helper_alloc_drm_device(test, dev, sizeof(*drm), 0, DRIVER_MODESET); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, drm); @@ -44,7 +53,7 @@ static void drm_test_managed_run_action(struct kunit *test) drm_dev_unregister(drm); drm_kunit_helper_free_device(test, dev); - KUNIT_EXPECT_TRUE(test, priv->action_done); + KUNIT_EXPECT_TRUE_MSG(test, priv->action_done, "Release action was not called"); } static struct kunit_case drm_managed_tests[] = { -- 2.43.0