Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5015930iog; Wed, 22 Jun 2022 10:10:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u9tPoLzCMdITRAKbVsLMbIw9djj7o2pIZdgjqeyfsWFmxiMdrtgwmhnxDQj3a2mTEZveoh X-Received: by 2002:a05:6402:518b:b0:435:c1ed:3121 with SMTP id q11-20020a056402518b00b00435c1ed3121mr594872edd.405.1655917832323; Wed, 22 Jun 2022 10:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655917832; cv=none; d=google.com; s=arc-20160816; b=TwEejaajBYnn22aqhRKSgc0y5tLsheKSddWEjzBbg922W3Dk01MxK3R1e0TOYFk+1f wS6PrRO858unbUTzkRd3DsUlEhmUpD+CbBDtKElHut/A9OtJqO84EkbzPbSYCJF7xwGt ojwkzCJ6j0itwn/w78AL2QAhBpaA6IhlN/Ra7TTSSwfm3XLtHzN1T8Ic+CTIVQLhbAzv NwY2uFLzyXIMVKDgoz7PXAinKwBoFB2Cd/y1mrr4fFJOYJhKKEPKm9uAU2Fkiyd39MwD Vb54MUwDfdIAv8z7o2MLhR5Qmxl2iXYyaaZ4b6Y5poS/MffusnOIEW+xHVcctxg4HsGm Aghw== 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=OqqiTD3gLybHOW4I6TLL5midAVTZ5DMLmHGaa4oXrwI=; b=0PMTTqr5fYbPKxDX5Ag8QBD6jBqscBVogL/O7jDvjhaJLqk07QzApAAMYaB9T6u+rH GHTxd63dQ8XUdz1YLFiWFaCszz7+IbDcP6OZKvz9KAQlB+9E8P/x+HAlAZAfbMDJ+OVw Rl4aRMj1ENul/I9suqfGwDgTqF8yu6bxczkRjN6mbB7ox55SHGl37CwLoBDAT3XNGFpE oRalKpLbcY1BZEejOhezGcn+E7xEccBbooJvF2zB6n2MPOQhTs0E/ZO88n8VLY4RMrTL r53tL0Yr+wnfC1PtBR08f3sgwpOBmn10VqnNKKaMKzJhNLm93cQ4JtYV68w59h1e7Xzn Zhfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=LViXX25+; 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 e8-20020a170906648800b00722e4cb31aesi5943873ejm.254.2022.06.22.10.10.02; Wed, 22 Jun 2022 10:10:32 -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=LViXX25+; 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 S1376397AbiFVRHv (ORCPT + 99 others); Wed, 22 Jun 2022 13:07:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377089AbiFVRHj (ORCPT ); Wed, 22 Jun 2022 13:07:39 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F7A740E6B for ; Wed, 22 Jun 2022 10:06:56 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id z7so24775863edm.13 for ; Wed, 22 Jun 2022 10:06:55 -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=OqqiTD3gLybHOW4I6TLL5midAVTZ5DMLmHGaa4oXrwI=; b=LViXX25+dhqxoIkD3PVPh5xlkUUjEcGqJEAQ2qrZky+J2zu84mwCgGHlmhvMlgCsTZ /7+K0OsGs4c0r6Nxx1W3q3XWLkYo5PiFTkwvQoGEnBfp/rYyu9VMlF54QnNBcW6gxmeg udE1bX3CTw4mk+szaqUlm7iwY6sxk/Fp1YqJoi3c8VLcRlDc/GekR6NuuTqB5VoMO1dv RlTU9nDiD5VtqIMUKnNVdUrBu38/HydLxExUxcu7/Y4L75O1AA+/QDUzPv1hNPdlzD7Y R0gs5JfrNdgn6vrpQuSabxnMwLLVOxHRrZmJRtT1JLDE8OvV1VaUVKyjabfpdU8pgg0B PBpw== 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=OqqiTD3gLybHOW4I6TLL5midAVTZ5DMLmHGaa4oXrwI=; b=wlM3EDVm19zQ4g50t+6CbZZdRGWnbgNFVp3uGTN1txvx7h2mZmrx4VIuiIxA6npDO2 1yZiZ8ujJg/V7v6iHkI5iiY+J0HPp5svUpOLmRXxRPmSKCTmRHHX8Fq6KWUmtvQOHK+E t7C8CT/5S42DvuvSunMl6mZmPRkxYRwKDQHhIL4V9pELlwqksKm6hqONRLLRAq/hKkq6 gHAcPfIAp0r6kLmTwmONfoRhCO9KRM2AGrPpnwHDELKt/ZJM28M6ShUP4qFj5AHa9haj xvb+Ozu0Muk5iV7M82RhSvStT6UOl5gDJFUXjV3nUEykDKwZh7pxBFA55WaGuuuVLgoQ 9wNA== X-Gm-Message-State: AJIora/bTeE3yV6l5e8dlQe+LGKWKHrFahtjPmFGmws9cq47VPRiy5// Xgv8eGYTxxmHHSwiOOPh6N8qaZH2FfIrnhMayBU5Bg== X-Received: by 2002:a05:6402:438a:b0:435:bc23:d615 with SMTP id o10-20020a056402438a00b00435bc23d615mr2590960edc.283.1655917614113; Wed, 22 Jun 2022 10:06:54 -0700 (PDT) MIME-Version: 1.0 References: <20220621200926.257002-1-maira.canal@usp.br> <20220621200926.257002-5-maira.canal@usp.br> In-Reply-To: <20220621200926.257002-5-maira.canal@usp.br> From: Daniel Latypov Date: Wed, 22 Jun 2022 10:06:42 -0700 Message-ID: Subject: Re: [PATCH v2 4/9] drm: selftest: convert drm_format selftest to KUnit To: =?UTF-8?B?TWHDrXJhIENhbmFs?= Cc: Isabella Basso , magalilemes00@gmail.com, tales.aparecida@gmail.com, mwen@igalia.com, andrealmeid@riseup.net, siqueirajordao@riseup.net, Trevor Woerner , leandro.ribeiro@collabora.com, n@nfraprado.net, Daniel Vetter , Shuah Khan , David Airlie , Maxime Ripard , Thomas Zimmermann , michal.winiarski@intel.com, Javier Martinez Canillas , =?UTF-8?B?Sm9zw6kgRXhww7NzaXRv?= , David Gow , brendanhiggins@google.com, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, 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 Tue, Jun 21, 2022 at 1:10 PM Ma=C3=ADra Canal wrote= : > > Considering the current adoption of the KUnit framework, convert the > DRM format selftest to the KUnit API. > > Tested-by: David Gow > Signed-off-by: Ma=C3=ADra Canal Acked-by: Daniel Latypov Overall looks good from the KUnit side, just a few general suggestions belo= w. FYI, the warning email from kernel-test-robot is basically saying that the compiler is not optimizing away the temporary variables internally created in KUNIT_EXPECT_*. So having too many KUNIT_EXPECT_.* in a single function is the trigger. The main workaround you'd have is to split up the test into more test funct= ions. (I don't know if that's actually worth doing) > +static void igt_check_drm_format_block_width(struct kunit *test) > +{ > + const struct drm_format_info *info =3D NULL; > + > + /* Test invalid arguments */ > + KUNIT_EXPECT_FALSE(test, drm_format_info_block_width(info, 0)); > + KUNIT_EXPECT_FALSE(test, drm_format_info_block_width(info, -1)); > + KUNIT_EXPECT_FALSE(test, drm_format_info_block_width(info, 1)); Hmm, I think one of these two would be clearer here: KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 0), 0); KUNIT_EXPECT_EQ(test, 0, drm_format_info_block_width(info, 0)); I think this helps test readability (giving hints about the types) and gives better error messages, more on that below. The problem with using the boolean expectations is that given int foo =3D 2; KUNIT_EXPECT_FALSE(test, foo); KUnit will only print out Expected foo to be false, but is true Using EXPECT_EQ(foo, 0), we'd get Expected foo =3D=3D 0, but foo =3D=3D 2 Knowing exactly what the offending return value was can help debug test failures a bit faster. > + > + /* Test 1 plane format */ > + info =3D drm_format_info(DRM_FORMAT_XRGB4444); > + KUNIT_EXPECT_TRUE(test, info); FYI, you can now instead write KUNIT_EXPECT_NOT_NULL(test, info); this new macro was merged into 5.19-rc1.