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 55498C6FA82 for ; Fri, 23 Sep 2022 09:28:17 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jrKLQDJ2rkGSkgAYxaK4+MUN9773Sb33R/cOc+HMW5k=; b=IwPTjgfTvVKN1d o+l7FUnZJR/G8osbfBg1taKTujjNml31s/sqe4wDTd/k0ikqZr1ZwNY8VDOLxDG9MNlpc+Bn6J5oi 6yE0F9+dX9+K+ifMkcGKy5GzJkH0/Vf1extQdssWcNSFjfXaWjb9Uv6GO5H24QHJjHZkXKl1cS3+Z bNId9GWaD2m6iEWGcEPsj5YQAJEvdOtqBFY4sSF7NuQz0KTmQ9CWbrnHdcOCjYDcjtTNkqtcZRn8D vNauQIF/Er1SBFzCKPuATPLmfOpwiC9JkkXPPsKYS0KKQgJjontH7SCUQlIiDk14l9rawhRUXvkvo mzFQjiGhMsJ+NryeH83A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1obexT-003Jcm-U8; Fri, 23 Sep 2022 09:26:56 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1obexJ-003JY3-7F for linux-arm-kernel@lists.infradead.org; Fri, 23 Sep 2022 09:26:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663925200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lBmBrugF1Uc8odU/lwXKGYWTxCtAMKSLu086DYvJSJ0=; b=FB4gijC0WWZJ1wuJ7D1e5bz9MYNV4RlIggLuxlMYnm3A444VuCMM8eDipzZ3GmGW9XMG2j yAZwSbYDgDrNZ8RsMpqIQjc8vPxqIKDA7Jhg/MZf8+q3+3mnsI6eZBl0WLp0l7m5Tlstcj tvfyuatS7mq9kPTvJYgd8iFwtdQIer4= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-144-2nbfGtMWMj6-an95LO8gEg-1; Fri, 23 Sep 2022 05:26:37 -0400 X-MC-Unique: 2nbfGtMWMj6-an95LO8gEg-1 Received: by mail-wm1-f69.google.com with SMTP id fc12-20020a05600c524c00b003b5054c70d3so1810279wmb.5 for ; Fri, 23 Sep 2022 02:26:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=lBmBrugF1Uc8odU/lwXKGYWTxCtAMKSLu086DYvJSJ0=; b=6PWou7XhSDmm5Yv4iBZEeK7jqL/TJ+Zw3cg5mcRmGaKnJQ8A2Y3LhyRVf6k1v8REHs B0Vj60nw1XQT/LlTm20COcLztPuzpR0EuGnXvhxMErf88umCWP/cSBCR1dIj+lpJtr7K 3AUAZQQH2g1OJzZEgQOrcnCe+vex5IdGR31bMHc60GImkJBN+SzLAMBqlDKhjyFMtUmi C7a3Rhg95U7GPLXrnkcsPagoZ0RBhAkh7lUjh6oW4ARA4o2WNs9V8Le3GbMCsYrHIOa1 KEElNiqut1nI3SBZbc42qMe5QQlOV1Jn8+DH8prbx8RhyUCRlCOr6RDc3hdHbNRi7Cts ipbg== X-Gm-Message-State: ACrzQf31PaH2kOFdL4i+Y3zO49KDmg+WI2ojfxc2KknhCQnqQghUjyxo AlPGes1xt0WHs+uFzJ3WRMylor2L7KQkS8xVfRhOmtjxgtmjA5gLGC0SA9YhUHu8ZpanwPYDOiB +rocoNAhqo74uBTqm/Ey8rfBE7rrjElThzDI= X-Received: by 2002:a5d:6485:0:b0:226:ecf9:359c with SMTP id o5-20020a5d6485000000b00226ecf9359cmr4764163wri.17.1663925196541; Fri, 23 Sep 2022 02:26:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61+EyXP0DrQbd5lBD5JiT0UCPQrcmRDCgUpYVonrMG8qw0pJ6zzDkEJadTs5GlFRxQTExixQ== X-Received: by 2002:a5d:6485:0:b0:226:ecf9:359c with SMTP id o5-20020a5d6485000000b00226ecf9359cmr4764139wri.17.1663925196203; Fri, 23 Sep 2022 02:26:36 -0700 (PDT) Received: from [192.168.1.130] (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id bj1-20020a0560001e0100b0022b0214cfa6sm8514250wrb.45.2022.09.23.02.26.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Sep 2022 02:26:35 -0700 (PDT) Message-ID: Date: Fri, 23 Sep 2022 11:26:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH v2 13/33] drm/client: Add some tests for drm_connector_pick_cmdline_mode() To: Thomas Zimmermann , Maxime Ripard , Jernej Skrabec , Rodrigo Vivi , Ben Skeggs , David Airlie , Maxime Ripard , Joonas Lahtinen , Emma Anholt , Karol Herbst , Samuel Holland , Jani Nikula , Daniel Vetter , Lyude Paul , Maarten Lankhorst , Tvrtko Ursulin , Chen-Yu Tsai Cc: Dom Cobley , Dave Stevenson , Phil Elwell , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Mateusz Kwiatkowski , Hans de Goede , =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= , Geert Uytterhoeven , linux-sunxi@lists.linux.dev, linux-arm-kernel@lists.infradead.org References: <20220728-rpi-analog-tv-properties-v2-0-f733a0ed9f90@cerno.tech> <20220728-rpi-analog-tv-properties-v2-13-f733a0ed9f90@cerno.tech> <49ea7c7c-7d4c-8348-ea75-e0f376111e4c@suse.de> From: Javier Martinez Canillas In-Reply-To: <49ea7c7c-7d4c-8348-ea75-e0f376111e4c@suse.de> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220923_022645_382558_219BE65A X-CRM114-Status: GOOD ( 22.38 ) 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 9/23/22 11:15, Thomas Zimmermann wrote: > Hi > > Am 22.09.22 um 16:25 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= command line >> argument. >> >> Let's add some unit tests to make sure we're not getting any regressions >> there. >> >> Signed-off-by: Maxime Ripard >> >> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c >> index bbc535cc50dd..d553e793e673 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_client_modeset_test.c" >> +#endif > > I strongly dislike this style of including source files in each other. > It's a recipe for all kind of build errors. Can you do something else? > This seems to be the convention used to test static functions and what's documented in the Kunit docs: https://kunit.dev/third_party/kernel/docs/tips.html#testing-static-functions I agree with you that's not ideal but I think that consistency with how it is done by other subsystems is also important. > As the tested function is an internal interface, maybe export a wrapper > if tests are enabled, like this: > > #ifdef CONFIG_DRM_KUNIT_TEST > struct drm_display_mode * > drm_connector_pick_cmdline_mode_kunit(drm_conenctor) > { > return drm_connector_pick_cmdline_mode(connector) > } > EXPORT_SYMBOL(drm_connector_pick_cmdline_mode_kunit) > #endif > > The wrapper's declaration can be located in the kunit test file. > But that's also not nice since we are artificially exposing these only to allow the static functions to be called from unit tests. And would be a different approach than the one used by all other subsystems... -- Best regards, Javier Martinez Canillas Core Platforms Red Hat _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel