[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABVgOSnevOm1djuJrAR3K1kcVkXrZxugHL-b2bBPhHNSXE1GyA@mail.gmail.com>
Date: Fri, 17 Jun 2022 16:02:04 +0800
From: David Gow <davidgow@...gle.com>
To: Daniel Latypov <dlatypov@...gle.com>
Cc: mark.rutland@....com, boqun.feng@...il.com,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
KUnit Development <kunit-dev@...glegroups.com>,
Peter Zijlstra <peterz@...radead.org>,
Brendan Higgins <brendanhiggins@...gle.com>,
Michael Ellerman <mpe@...erman.id.au>
Subject: Re: [PATCH] lib/atomic64_test.c: convert to use KUnit
On Fri, Jun 17, 2022 at 2:04 AM Daniel Latypov <dlatypov@...gle.com> wrote:
>
> The test currently is a bunch of checks (implemented using BUG_ON())
> that can be built into the kernel or as a module.
>
> Convert it to a KUnit test, which can also run in both modes.
> From a user's perspective, this change adds a CONFIG_KUNIT=y dep and
> changes the output format of the test [1] and makes it less destructive
> on failure. The test itself is the same.
>
> This hopefully makes the test easier to run and more consistent with
> similar tests in lib/.
> Since it has no dependencies, it can be run without explicitly setting
> up a .kunitconfig via
> $ ./tools/testing/kunit/kunit.py run atomic
> ...
> [13:53:44] Starting KUnit Kernel (1/1)...
> [13:53:44] ============================================================
> [13:53:47] =================== atomic (2 subtests) ====================
> [13:53:47] [PASSED] test_atomic
> [13:53:47] [PASSED] test_atomic64
> [13:53:47] ===================== [PASSED] atomic ======================
> [13:53:47] ============================================================
> [13:53:47] Testing complete. Passed: 2, Failed: 0, Crashed: 0, Skipped: 0, Errors: 0
> [13:53:47] Elapsed time: 13.902s total, 1.629s configuring, 9.331s building, 2.852s running
>
> It can be run on ARCH=x86_64 (and others) via:
> $ ./tools/testing/kunit/kunit.py run --arch=x86_64 atomic
>
> The message about which platform the test ran on won't show up in
> kunit.py, but still gets printed out in dmesg, e.g.
> > TAP version 14
> > 1..1
> > # Subtest: atomic
> > 1..2
> > ok 1 - test_atomic
> > ok 2 - test_atomic64
> > # atomic: ran on x86-64 platform with CX8 and with SSE
> > # atomic: pass:2 fail:0 skip:0 total:2
> > # Totals: pass:2 fail:0 skip:0 total:2
> > ok 1 - atomic
>
> [1] https://www.kernel.org/doc/html/latest/dev-tools/ktap.html
>
> Signed-off-by: Daniel Latypov <dlatypov@...gle.com>
> Reviewed-by: David Gow <davidgow@...gle.com>
> Reviewed-by: Brendan Higgins <brendanhiggins@...gle.com>
> Tested-by: Michael Ellerman <mpe@...erman.id.au> (powerpc)
> ---
> Meta: this is a resend of https://lore.kernel.org/linux-kselftest/20220502192327.81153-1-dlatypov@google.com/
> Michael kindly pointed me to the right MAINTAINERS entry (this test file
> isn't covered by it, and it slipped my mind to check the non-test code).
>
> I've waited until 5.19-rc1 so that the relevant KUnit patches this
> depended on have been merged.
> Rebasing and tweaking the commit message a bit are the only changes.
> ---
Tested this again just to be sure, and it still builds, runs, and
passes for me on:
- UML (x86_64)
- x86_64 + qemu
- i386 + qemu
- arm64 + qemu + clang/LLVM
Cheers,
-- David
Powered by blists - more mailing lists