Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp183181pxy; Wed, 21 Apr 2021 22:53:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJya4U4MXENqGbnpim7evXCdSZJmzNFg5ouExAW/oC3I8kvgNuN33K+KdZ1DJIRfALThNZzH X-Received: by 2002:a17:90a:db49:: with SMTP id u9mr16140691pjx.209.1619070808660; Wed, 21 Apr 2021 22:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619070808; cv=none; d=google.com; s=arc-20160816; b=dVPmjPDZCh3xgGgzvlpxDXVqSTY9mg+nFufWHcIrrbJQzUQfDJS9C6FxtZ9qCAjBwd A2M/k4G+rTkhzr8ZU8YV5E7YTml7lgnGn//t96IXR6r90w9Ta59knpuuNON2rAjcTceP Csf1s0sbiXj48es1LM0VNYQPE6UqOM9G3JQP+TcSxKn6UIbur1YD/uDA2wZlWW13QpfL 2UocjUkyeaxBq26CHhLv8McqGkhCpN4EOJnhebCDKWXidsqsBD4oy0Dsz8Icozp0kzAQ wz1ot6YsgxvSd6g0+EizZeDKVy84j02+2yWkFdzANVcUwh/XsKyYbncT7vVw8nTBAADT Tlxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wlBZuZJpKddS9FWipfcldRHxE90gSWKH6VLNPWIbZE8=; b=HyPf8H78rNaI+DFigSp8fvcO93d2Ywhy2zxXlCOGtC29sP+gSq+C0jZXVslwyp/JCw 1S0kqq4s+7zd0obG86RMeRWmNz99336/XZAyx3QUNMo1ym5HH+Vw976Sm2rKStyRKS6C 8BuU/EcjKXIqls4HxCc13uA3Cdx7SO+0Omebw2kSnVvYM/gT8oPtppbO58WtdtOffJIR DYiE3iaIFfxVqNZ+0moeW0IOwyfxxwY95iYgSajAz2ye7jXPMnkK4fDboywuXKqufxze V3Z3zSsELlP4uJF9zLcl/aOMG8m0eLceW+OXAcyWrZDKKoq5kOZCjEpqd6NyHzj8Zzzz stRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ks6R6vv0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w70si2068965pff.345.2021.04.21.22.53.16; Wed, 21 Apr 2021 22:53:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ks6R6vv0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229548AbhDVFxG (ORCPT + 99 others); Thu, 22 Apr 2021 01:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbhDVFxF (ORCPT ); Thu, 22 Apr 2021 01:53:05 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58AD3C06174A for ; Wed, 21 Apr 2021 22:52:31 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id z8so50413139ljm.12 for ; Wed, 21 Apr 2021 22:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wlBZuZJpKddS9FWipfcldRHxE90gSWKH6VLNPWIbZE8=; b=Ks6R6vv0FBcBlp9a2wW2yDdhiiLJLLQK0Lo/kp3hPLkwEavVgTzWZtXdxf4cIbb8vN ZJ2hDv3AW+mHoi+8AFDZhxdLlcX1gcucrrEtBFKkciuSm3T4abyc7MF3PukHsg+Li4oi vdFpTu/acdgdfPYCHACnEjoZvhNCvhuQY4bAtqEW2uSKfUerWK4uP1c2LiX2bXTKEX7v W/rMC5px51jeRPTnhSuPNuEsp/C08yTeRDQ3l7dP4WLLxLOovjEYTa4C1LRbj4Pumwzy K94V7z7O/1/zmCJAVGEsTMsZKV1cACjI35udBd9W3LOFNP8T0snGEIEk/CN6pzCWQzrY bc+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wlBZuZJpKddS9FWipfcldRHxE90gSWKH6VLNPWIbZE8=; b=fL6QskFYLIzWfDZQ1OlAUrCHWW3EIWiQ8Zk+yYEI2cwEtKU3LR+tqLIM9HO0cLkFOt o8gVOaV24dfOr+ZPNnZEhUM5PBcn/k1hs0IdXflbzUVN/vhA+47NU29XfF+VTRIuvrk/ j4sg/jvWOcNuP3yBlwFa4iWI4tE3qUIzJhFna8OXdeYNNla79qpQfqnPrDUUbpa5a1UB rgvA3710vq5OIfegxS18gh1zcKLm0C/yGDxZgAfQxfWTtIhl+fHIZ9e7Eyjgc4H15gpa 8x8I5zAhaPRsguFV2trftbiUNG+Ky/S+LgNUihwGNXIb10g7SiXYSdZLWxqlryqBOAE1 uS9w== X-Gm-Message-State: AOAM531Lwm9QeW7ToT+J5zZzEiEi8K8dGG7p/Ydw/DuTE2XEhfbJE/lh +/wl0aAPZFZbvgky8PwcR/Y1yAD5sCrY6ZOg+5MuT+n7XionGA== X-Received: by 2002:a2e:a7c8:: with SMTP id x8mr1291001ljp.89.1619070749681; Wed, 21 Apr 2021 22:52:29 -0700 (PDT) MIME-Version: 1.0 References: <20210421183222.2557747-1-dlatypov@google.com> In-Reply-To: <20210421183222.2557747-1-dlatypov@google.com> From: David Gow Date: Thu, 22 Apr 2021 13:52:17 +0800 Message-ID: Subject: Re: [PATCH 2/2] lib/test: convert lib/test_list_sort.c to use KUnit To: Daniel Latypov Cc: Andy Shevchenko , Brendan Higgins , Linux Kernel Mailing List , KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 22, 2021 at 2:32 AM Daniel Latypov wrote: > > Functionally, this just means that the test output will be slightly > changed and it'll now depend on CONFIG_KUNIT=y/m. > > It'll still run at boot time and can still be built as a loadable > module. > > There was a pre-existing patch to convert this test that I found later, > here [1]. Compared to [1], this patch doesn't rename files and uses > KUnit features more heavily (i.e. does more than converting pr_err() > calls to KUNIT_FAIL()). > > What this conversion gives us: > * a shorter test thanks to KUnit's macros > * a way to run this a bit more easily via kunit.py (and > CONFIG_KUNIT_ALL_TESTS=y) [2] > * a structured way of reporting pass/fail > * uses kunit-managed allocations to avoid the risk of memory leaks > * more descriptive error messages: > * i.e. it prints out which fields are invalid, what the expected > values are, etc. > > What this conversion does not do: > * change the name of the file (and thus the name of the module) > * change the name of the config option > > Leaving these as-is for now to minimize the impact to people wanting to > run this test. IMO, that concern trumps following KUnit's style guide > for both names, at least for now. > > [1] https://lore.kernel.org/linux-kselftest/20201015014616.309000-1-vitor@massaru.org/ > [2] Can be run via > $ ./tools/testing/kunit/kunit.py run --kunitconfig /dev/stdin < CONFIG_KUNIT=y > CONFIG_TEST_LIST_SORT=y > EOF > > [16:55:56] Configuring KUnit Kernel ... > [16:55:56] Building KUnit Kernel ... > [16:56:29] Starting KUnit Kernel ... > [16:56:32] ============================================================ > [16:56:32] ======== [PASSED] list_sort ======== > [16:56:32] [PASSED] list_sort_test > [16:56:32] ============================================================ > [16:56:32] Testing complete. 1 tests run. 0 failed. 0 crashed. > [16:56:32] Elapsed time: 35.668s total, 0.001s configuring, 32.725s building, 0.000s running > > Note: the build time is as after a `make mrproper`. > > Signed-off-by: Daniel Latypov > --- This looks good to me: I'm not an expert in the test, though, so I may have missed something. I did run it, though, and it seemed to work fine. It's a shame the functions can no-longer be marked __init, but I think the advantages of KUnit outweigh it, particularly since this is unlikely to be being used in production. (BTW: This doesn't appear to be posted as a reply to Patch 1/2, which made it a bit trickier to find.) This is Tested-by: David Gow -- David