From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3CA16C00140 for ; Mon, 15 Aug 2022 08:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=65Fe4YUGlCATA1QkIBbGQMpU7z4D0tzNGbyN/Mz76ZY=; b=iZlnzY3rf4Jkhty3h/CiN00eKm iqBwVgmRz7HFeF87Gm1w5lKPDOjoPyCxLI1iHf13tW4cArOrSnula42xHbKByROal0qaV6xeyQnjG Fr7zNoxXnQ8Lr/fH5DZY4zS2REMQ8VqwGyOs8o3yThK3iCtocFV0Gn5u4r6ApH1+vp2zNqT83qVGd uT97VdofC84YZj7bqFSEks6qp+wM7wPqgRao9DjPIGvEA+DrkfsGAfh69GGcbE49ROp2Clpcja/3D mqRsSHU6DeNjf1V1eaIbWPxCuyvjvBw192vtkBtCF0oPqdMA7uUCRvgNSbs+Bm+V/agTxkXpNfnMJ gxp4ecbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNVgu-00DJzq-EE; Mon, 15 Aug 2022 08:43:20 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNVfs-00DJQE-Nh; Mon, 15 Aug 2022 08:42:22 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id C12EA58060D; Mon, 15 Aug 2022 04:42:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 15 Aug 2022 04:42:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1660552935; x=1660560135; bh=jCLrmollLV DyqBu3wvulbaV3RNTNZ05rEx9CXO/Wmng=; b=tKIVdEkVutMMGoXB1seo7kuBWK mf+hhbPhGWrfbcicTvnvCvjVJk7gsTTkcvO8a106wcix/T3U60GBkelVJcHblTbP OlBFZkWU2EEQ9q8mVomOeKdsnf5qzG7ufJMwoSRLUHs6/IDDMKf8hdhcS10QrW2r OtRX4PKWtpr1AG8rtvul5sZfhOU7MBDY4JGWHQ29DuKN9BNurNR5L/35gONxPXTL FV/NZ4JS9yrNQfGLZgzYL7lkQKod0tgoxzHc+aMxyDGXnKFw76HgjvDo9MffGLWh o75gtZUrIH8e3F9VZY7sX7uHh+eEPceRz6M4BRPiMYE6VQzKRUEj9TyZI6oQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1660552935; x=1660560135; bh=jCLrmollLVDyqBu3wvulbaV3RNTN Z05rEx9CXO/Wmng=; b=r1ZBLTTA0UF3TVxHv0Ro7SCOCq58S55oqD7QUtGH+vhH FGGjdkz2apuLRHGUbfTBfOaZ1SRkrWh/MCb8cG02BHzJRI8qOp/HdK8sDw8+/WUf RcDs+fVw41JmZ5hLjx62gFh0wfGAXuhlMoVEid7XevlykQNrwZ8VJ0wNEx/URmed KZxkR3uPVUyzs1wEX3cSd5v+yCGMdrdiWtsYpKJSrfxcYiYXK4yGuuLHzFI2xKAR kwWQqiwiednwZYFxhGuuEf5npdMC9lL/POObijvw4blQPMV8p53Gq7T5S6Qvksjf arefGU1nLY9zXHruU/4mfeHhpQlO8j4HDCwI8tIbsg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehvddgtdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpedtleekjeeiudefvdfhieffteelhfeivdeliefgieeugffhvdelieffjeei geetjeenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggt hh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Aug 2022 04:42:14 -0400 (EDT) Date: Mon, 15 Aug 2022 10:42:13 +0200 From: Maxime Ripard To: Thomas Zimmermann Cc: Jernej Skrabec , Martin Blumenstingl , Chen-Yu Tsai , Philipp Zabel , Jerome Brunet , Samuel Holland , Daniel Vetter , Emma Anholt , David Airlie , Maarten Lankhorst , Noralf =?utf-8?Q?Tr=C3=B8nnes?= , Kevin Hilman , Neil Armstrong , Dom Cobley , Dave Stevenson , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Mateusz Kwiatkowski , Geert Uytterhoeven , linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, Phil Elwell , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 08/35] drm/client: Add some tests for drm_connector_pick_cmdline_mode() Message-ID: <20220815084213.olcvp6qhmhhykz6t@houat> References: <20220728-rpi-analog-tv-properties-v1-0-3d53ae722097@cerno.tech> <20220728-rpi-analog-tv-properties-v1-8-3d53ae722097@cerno.tech> <14d698dc-172c-773f-7ea1-7101b9f5b77f@suse.de> MIME-Version: 1.0 In-Reply-To: <14d698dc-172c-773f-7ea1-7101b9f5b77f@suse.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220815_014217_280267_885DB2A0 X-CRM114-Status: GOOD ( 22.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============4540812794882617041==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============4540812794882617041== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="rlnnmrn6tqqsyh2j" Content-Disposition: inline --rlnnmrn6tqqsyh2j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Thomas, On Tue, Aug 02, 2022 at 12:14:29PM +0200, Thomas Zimmermann wrote: > Am 29.07.22 um 18:34 schrieb Maxime Ripard: > > drm_connector_pick_cmdline_mode() is in charge of finding a proper > > drm_display_mode from the definition we got in the video=3D command line > > argument. > >=20 > > Let's add some unit tests to make sure we're not getting any regressions > > there. > >=20 > > Signed-off-by: Maxime Ripard > >=20 > > diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm= _client_modeset.c > > index bbc535cc50dd..ee6b8f193c24 100644 > > --- a/drivers/gpu/drm/drm_client_modeset.c > > +++ b/drivers/gpu/drm/drm_client_modeset.c > > @@ -1237,3 +1237,7 @@ int drm_client_modeset_dpms(struct drm_client_dev= *client, int mode) > > return ret; > > } > > EXPORT_SYMBOL(drm_client_modeset_dpms); > > + > > +#ifdef CONFIG_DRM_KUNIT_TEST > > +#include "tests/drm_mode_test.c" > > +#endif >=20 > Including source files is somewhat ugly, prolongs compile times and could > even interfere with the actual source code. Can we do this in some other > way? Yeah, this irks me a bit as well, but it's the preferred way of doing it according to the kunit doc: https://www.kernel.org/doc/html/latest/dev-tools/kunit/usage.html#testing-s= tatic-functions > I suggest to add the tests here and export them for use in the test case. > Something like >=20 > #ifdef CONFIG_DRM_KUNIT_TEST > static drm_mode_res_1920_1080_60() > { > ... > } >=20 > struct kunit_case drm_mode_tests[] =3D { > drm_mode_res_1920_1080_60 > }; > EXPORT_SYMBOL(drm_mode_tests); > #endif >=20 > This would add the tests next to the tested code, but leave the test driv= er > in drm_mode_test.c. The test suite is fairly small for now, but if we end up with dozens of tests like what is there for the command line parser (which could happen for that kind of functions), I'm very afraid that the original source file will become unreadable, while this has the advantage to keep the original file readability. Maxime --rlnnmrn6tqqsyh2j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYvoG5QAKCRDj7w1vZxhR xc0mAQDuFbvOznqy7wPFfo7D22siO3vakpbi8JYCjof/aUhSWQEAh1/POG4ZPo9G 5liKYUHEyb8jsiIsA5GvnKqbiUcWNQw= =hjzk -----END PGP SIGNATURE----- --rlnnmrn6tqqsyh2j-- --===============4540812794882617041== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============4540812794882617041==--