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 AA16DC6FA82 for ; Fri, 23 Sep 2022 11:02:20 +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=AG2XXhQv35ouHB6sRFqD6YPcye3PSy8ImJA+dAud3I4=; b=ksgMFYzN6Rs4+3 KaYuAWe8ENyjIJFB3m1zIXlYRtcCsztfyPxLqvfkoLBHgzO58HXvSYNNjv+morkWHc7FJYSYH2pRr td7gnF6okhNvGnxqnWswF22QOEe+TUfBwOiDbBIqW9SbAesLYOEIr7gx7K9JFRCWmN0FdEB5PgbAP 5hsz30ObXBHiPpeJ6Wm6eBBr3eBaOiGDQ00hX3sTRJzCnIogvXJ+NoBA6fsItlE8Lf2UYH9n66X+R sEVATuZPlQxIHHAIDWrE2U7VSWoZ/mS8N8QhJLsvFgqsyMPjiPaYuiLloL0cO4T2w+sUdyBgTMeZR 0l8+vGKFkEpR5zh6DyLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1obgQt-003oXr-JV; Fri, 23 Sep 2022 11:01:23 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1obgQq-003oWD-PR for linux-arm-kernel@lists.infradead.org; Fri, 23 Sep 2022 11:01:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663930879; 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=JOiBQeetDdcvSGIfY2fjhmLzANCrF4v13aGxj9JhJvY=; b=PGBpLfFqI634DeddRewYt0Pc1ZMDIqjKUV9Jk7+4T/a5s8PvxeNV6lYHmqUmgQCq5Myk6k oOL19leHHkzyKsBITxzRUZak1azVTqJ6fRC3197+e0aI+bVTB5pEVsIobxjcm7cUwfAPL3 fbhwmOvwNJI7fmQkbpKwXdGNsTpWxqU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-399-Ox3u5vNSP7Wf6Dgo0-UltQ-1; Fri, 23 Sep 2022 07:01:18 -0400 X-MC-Unique: Ox3u5vNSP7Wf6Dgo0-UltQ-1 Received: by mail-wm1-f71.google.com with SMTP id k38-20020a05600c1ca600b003b49a809168so2549399wms.5 for ; Fri, 23 Sep 2022 04:01:18 -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=JOiBQeetDdcvSGIfY2fjhmLzANCrF4v13aGxj9JhJvY=; b=KIxJkmZk7pOa5ugUeAiGeaF4sRG6m10ITZMT4pE7kyK/MIn/wF3y9d/0S9RgWR1emj SYB/URcrF5Lsp0bonn0zecAMDkKIqqXg5z86ZRlv64/Bxdpo8zBZVjq+dBG9K5EvuDSy 3HfG1C99yYN+1fPpp7NJJCVSYIdzmiOP2hQRVF899qRArLkppYxO3ExRMGkDKCxcpKzx /M7I4VhckVyBbKw5KINvWCJZGApmFyBsYkLWiu8mSYPof9zSkUL9xH6U8p6UzFTfqfdw K/y46VcWitV9itzuI5KTXyS5ircQqL6wOlm+Rd30xLZ9/Bw71nURS9f8vKmyk0HCvE+B 2bOQ== X-Gm-Message-State: ACrzQf3k/QkYdqIlSicPy/RqmLczVtdyMzsGTegFzvNpI1V6paDTf3v9 Jq9OzOTWZT8AR+pI34HdaPfA4zF45hXLSUEKUMLU4cPXMUgJ+Y2L2pY5YD/Tck9j37crMoX7KME Gkg2Sx5sGys8Ng7Wb0Q/wgFUK06vRxWQcbnI= X-Received: by 2002:a05:600c:364a:b0:3b4:b9b3:8bef with SMTP id y10-20020a05600c364a00b003b4b9b38befmr12643113wmq.26.1663930877269; Fri, 23 Sep 2022 04:01:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gLa2EBcgyRTL5irtnfD1Rbw8bNumsaMk9N6QECjIoyKaHGe3CCmvJDwZ+J5z85y4gmVnDHA== X-Received: by 2002:a05:600c:364a:b0:3b4:b9b3:8bef with SMTP id y10-20020a05600c364a00b003b4b9b38befmr12643075wmq.26.1663930876886; Fri, 23 Sep 2022 04:01:16 -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 c1-20020a5d5281000000b002287d99b455sm7050946wrv.15.2022.09.23.04.01.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Sep 2022 04:01:16 -0700 (PDT) Message-ID: <4bef4296-b32f-e6c9-c8d0-591e2945e0d4@redhat.com> Date: Fri, 23 Sep 2022 13:01:14 +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> <93969920-b5ed-ff15-48d4-02e2f9c23505@suse.de> From: Javier Martinez Canillas In-Reply-To: <93969920-b5ed-ff15-48d4-02e2f9c23505@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_040120_923270_F279E815 X-CRM114-Status: GOOD ( 22.66 ) 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 12:30, Thomas Zimmermann wrote: [...] >>>> + >>>> +#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 > > That document says "...one option is to conditionally #include the test > file...". This doesn't sound like a strong requirement. > That's true. >> >> 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... >> > > There's the problem of interference between the source files when > building the code. It's also not the same source code after including > the test file. At a minimum, including the tests' source file further > includes more files. also includes quite a few of Linux > header files. > > IMHO the current convention (if any) is far from optimal and we should > consider breaking it. > Yes, I agree with that. But probably we should be explicit about the wrapper export symbols to access static functions pattern in the KUnit docs so other subsystems could do the same and it becomes a convention ? > Best regards > Thomas > -- 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