On Wed, Apr 21, 2021 at 11:32 AM Daniel Latypov <dlatypov@xxxxxxxxxx> 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@xxxxxxxxxxx/ > [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@xxxxxxxxxx> Acked-by: Brendan Higgins <brendanhiggins@xxxxxxxxxx>