lkml.org 
[lkml]   [2021]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] lib/test: convert lib/test_list_sort.c to use KUnit
On Wed, Apr 21, 2021 at 11:32 AM Daniel Latypov <dlatypov@google.com> 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 <<EOF
> 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 <dlatypov@google.com>

Acked-by: Brendan Higgins <brendanhiggins@google.com>

\
 
 \ /
  Last update: 2021-04-22 22:07    [W:0.064 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site