Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5597688ioo; Wed, 1 Jun 2022 08:37:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzF0Etb550U6u06s3pSuO22LbgeRylw5jCvV0XfUcV8YtdLvKCJwWDVtWNRXixuwdjqY/41 X-Received: by 2002:a17:90b:368b:b0:1e6:67a0:1c17 with SMTP id mj11-20020a17090b368b00b001e667a01c17mr2574158pjb.203.1654097854576; Wed, 01 Jun 2022 08:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654097854; cv=none; d=google.com; s=arc-20160816; b=WYwHS2L3d7J2mCy9yZRLl2FTInAJ4MEahdQ62fcSah2DjzE7gKciEJ0eRDm2FO4/GF P6cqnUn3vahsHKEkzeed1u/um4YFEEmtrY/XE1U/EiGKGhHOQoAXh1IY4JgR02wAb+GR upoOF/0hI4MIsE9Ma7rXQBFA0dIgKL9BL7Pk571TPT1h1eB07ptNF1CzODmPNtd5hQI9 5wVVAlXveqgzvPCfGlC2O9KssrZLXAcV3KBApXXgiXbVeO+v1n2P+7fG4iO7+pD/3tZJ m1VR1WQN6TAHxWiBLdK7dSaP6ALnwaNs+MHqWcBmUHWnXu1B8FO94eH7dP23R2Ny3wsp OTCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=93b76ZHbZcuHCfscxd3Lk2d9Wx/yBWaIajc4fFNKsBY=; b=OAI6dyVBUb2WqvWu8W/qk3alZIoztqQX2F6bjouz496CSRwvC6boBrJQyuXI4ZDnTh +G3FgpoeM4kh9lwurjk7Vac9KPq+cRiUatZICnxdRPNUfBpSzsQ3AC4UXLTh7GhkwHTQ dxU60nw6Lnkp8r5v0nkhYy9wwX4nX8sYBmBrbFaSiCeE+xhD/Bwsl9BqLWuK8GtBcrdh CiiMspv7cL1gZUQR3XipK1llaXTnCKAPO2++QLLDmb0FeW/7UC1TRABVIM9QPsB3s67M Jljd0XQsc8ouh59dvbvl22R2N4aGjdLsx0IE0+2MyKtbl7JYzmCgx8OnTy/zzA3svz6h 9eOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KCNnBbaZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x21-20020a1709027c1500b00163655bed22si2566740pll.501.2022.06.01.08.37.20; Wed, 01 Jun 2022 08:37:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KCNnBbaZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238469AbiE3W6N (ORCPT + 99 others); Mon, 30 May 2022 18:58:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234309AbiE3W6K (ORCPT ); Mon, 30 May 2022 18:58:10 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25224515A6 for ; Mon, 30 May 2022 15:58:09 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id q1so6839663ejz.9 for ; Mon, 30 May 2022 15:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=93b76ZHbZcuHCfscxd3Lk2d9Wx/yBWaIajc4fFNKsBY=; b=KCNnBbaZtRLRoY3MVGmEaI+oOj68q4mGW3ulnyBw04EH4w9DzxWhvCRj6surNXd8CS fuvEHexXKjIqHTvvN3ZoulQQHSq0xCM25YCFhkqcpATO3cfAwJ9XdmOp8vsbSk60rIoX ACOTcJFXi+Q02vZwlN1nc1GvU+Pltqyfxs1CgDWE2hPQIviYaGqdCf9SlYUaIFhfV99R RhOBpWVW63h2VJb5hnKPSFw5j5S10V2knTtJ+PMQykdhK07awXOOzPvcINh6JfX4ckUS X4TMdYwN9Vsz2tgWnocs8Lp1qj5oEloCgZNB1xE/VKtK1vrkCexEQHTRRQ6OELY89TS0 NZiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=93b76ZHbZcuHCfscxd3Lk2d9Wx/yBWaIajc4fFNKsBY=; b=UVFtvi3JJQv9pHKxGt6zrSUWq0v3d0c/ZSUg/7/CVa/DJZb+7vynx9xF6uBTZzXysn 3yXVJ7MCU29vEk79VeTG11Hn1z0G9I/0/Kz8P2DUTQlYnWWDYyNxbfxWwBZZL0+w4qpO Xx33e/st1vKHJ9qEyZLjTddyCIUVV2rIvHTiO42PdGXQ9ytZ+E1XAFzkffMM2zIuDlMJ PxdeFkM5NQRkKdZ9o3TCL+/zovFmxJB7hyLt1ikBCw/cv2qsUq+kxn8z557Tib+zzwuo aUP+uB0LMvE1C/1eyaCILs3FfBzikJ1/50jDESc3y+/26NON/838d21Yd5iX4fvU7uCr lD4w== X-Gm-Message-State: AOAM533wNqq5Z2tAshqzyv6xMUYUaP9bNWLLd1XUQwwuytdN5P9MTxLO 3sSslO12vbCqzJ94j0hvvS+bsJ7pGhH86jWRk8SlXw== X-Received: by 2002:a17:907:2cc7:b0:6fa:7356:f411 with SMTP id hg7-20020a1709072cc700b006fa7356f411mr49703826ejc.369.1653951487392; Mon, 30 May 2022 15:58:07 -0700 (PDT) MIME-Version: 1.0 References: <20220530102017.471865-1-jose.exposito89@gmail.com> <20220530102017.471865-2-jose.exposito89@gmail.com> <20220530131158.kqq2mohxoh52xpeg@penduick> <20220530162903.GA6546@elementary> In-Reply-To: <20220530162903.GA6546@elementary> From: Daniel Latypov Date: Mon, 30 May 2022 15:57:56 -0700 Message-ID: Subject: Re: [RFC PATCH 1/1] drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332() To: =?UTF-8?B?Sm9zw6kgRXhww7NzaXRv?= Cc: Maxime Ripard , kunit-dev@googlegroups.com, javierm@redhat.com, tzimmermann@suse.de, maarten.lankhorst@linux.intel.com, airlied@linux.ie, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 30, 2022 at 9:29 AM Jos=C3=A9 Exp=C3=B3sito wrote: > I just cc'ed kunit-dev@googlegroups.com. For anyone joining the > conversation, here is the link to the patch and the cover letter with > some questions: > > https://lore.kernel.org/dri-devel/20220530102017.471865-1-jose.exposito89= @gmail.com/T/ Thanks for the link. A few initial notes: a) normally, `select`ing other kconfigs is discouraged. It's not explicitly called out in https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html#test-kcon= fig-entries but this was the conclusion after some debate on the mailing lists earlier. b) I see `dst` is allocated with kzalloc but not freed. Should we use `kunit_kzalloc()` instead so it does get automatically freed? > > > > > > --- > > > drivers/gpu/drm/Kconfig | 12 ++ > > > drivers/gpu/drm/Makefile | 3 + > > > drivers/gpu/drm/drm_format_helper_test.c | 166 +++++++++++++++++++++= ++ > > > 3 files changed, 181 insertions(+) > > > create mode 100644 drivers/gpu/drm/drm_format_helper_test.c > > > > > > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > > > index e88c497fa010..d92be6faef15 100644 > > > --- a/drivers/gpu/drm/Kconfig > > > +++ b/drivers/gpu/drm/Kconfig > > > @@ -76,6 +76,18 @@ config DRM_KMS_HELPER > > > help > > > CRTC helpers for KMS drivers. > > > > > > +config DRM_FORMAR_HELPER_TEST > > > + bool "drm_format_helper tests" if !KUNIT_ALL_TESTS > > > + depends on DRM && KUNIT=3Dy > > > + select DRM_KMS_HELPER From above, a) Specifically here, it'd be encouraged to instead do depends on DRM && KUNIT=3Dy && DRM_KMS_HELPER Ideally, using a .kunitconfig file would make it so having to select DRM_KMS_HELPER manually isn't that annoying. > > AFAIK, kunit test cases are supposed to have a .kunitconfig too to > > enable the kunit tests easily. > > > > Maxime > > A .kuniconfig example is present in the cover letter. My understanding > from the docs: > > https://docs.kernel.org/dev-tools/kunit/run_wrapper.html#create-a-kunitco= nfig-file The bit of the documentation you're looking for is https://www.kernel.org/doc/html/latest/dev-tools/kunit/running_tips.html#de= fining-a-set-of-tests You can create a drivers/gpu/drm/.kunitconfig file and run with $ ./tools/testing/kunit/kunit.py run --kunitconfig=3Ddrivers/gpu/drm --arch= =3Dx86_86 The contents of that file would be just like CONFIG_KUNIT=3Dy CONFIG_DRM=3Dy CONFIG_DRM_KMS_HELPER=3Dy # if no `select` CONFIG_DRM_FORMAR_HELPER_TEST=3Dy Re "kunit test cases are supposed to have a .kunitconfig too" As I noted in the docs: This is a relatively new feature (5.12+) so we don=E2=80=99t have any conventions yet about on what files should be checked in versus just kept around locally. It=E2=80=99s up to you and your maintainer to decide i= f a config is useful enough to submit (and therefore have to maintain). So it's up to whatever people think works best/is worth it. I think in this case, it makes sense to add the file. > Is that, like the .config file, the .kunitconfig file is not meant to > be included in git, but I'm sure someone else will clarify this point. That bit of the docs needs to be rewritten. You're recommended to check in a drivers/gpu/drm/.kunitconfig file into git= . Context: `kunit.py` used to use the "/.kunitconfig" file. Anytime you wanted to run more tests, you'd append to that file. So we agreed that no one should check in that file specifically. Now kunit.py * uses "/.kunitconfig", by default: ".kunit/.kunitconfig" * has the --kunitconfig flag so you can use different files so it's no longer as relevant. Hope that helps, Daniel