Re: [PATCH] ww_mutex: convert self-test to KUnit
From: Boqun Feng
Date: Tue Feb 11 2025 - 17:41:53 EST
Hi Tamir,
On Mon, Feb 10, 2025 at 10:59:12AM -0500, Tamir Duberstein wrote:
> Convert this unit test to a KUnit test.
>
I would like to know the pros and cons between kunit tests and
kselftests, maybe someone Cced can answer that? It'll be good to put
these in the commit log as well.
Regards,
Boqun
> Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
> ---
> I tested this using:
> $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 ww_mutex
>
> On success:
> ; [12:48:16] ================== ww_mutex (5 subtests) ===================
> ; [12:48:16] ======================= test_mutex ========================
> ; [12:48:16] [PASSED] flags=0
> ; [12:48:16] [PASSED] flags=1
> ; [12:48:16] [PASSED] flags=2
> ; [12:48:16] [PASSED] flags=3
> ; [12:48:16] [PASSED] flags=4
> ; [12:48:17] [PASSED] flags=5
> ; [12:48:17] [PASSED] flags=6
> ; [12:48:17] [PASSED] flags=7
> ; [12:48:17] =================== [PASSED] test_mutex ====================
> ; [12:48:17] ========================= test_aa =========================
> ; [12:48:17] [PASSED] lock
> ; [12:48:17] [PASSED] trylock
> ; [12:48:17] ===================== [PASSED] test_aa =====================
> ; [12:48:17] ======================== test_abba ========================
> ; [12:48:17] [PASSED] trylock=0,resolve=0
> ; [12:48:17] [PASSED] trylock=1,resolve=1
> ; [12:48:17] [PASSED] trylock=0,resolve=0
> ; [12:48:17] [PASSED] trylock=1,resolve=1
> ; [12:48:17] ==================== [PASSED] test_abba ====================
> ; [12:48:17] ======================= test_cycle ========================
> ; [12:48:17] [PASSED] nthreads=2
> ; [12:48:17] =================== [PASSED] test_cycle ====================
> ; [12:48:21] ========================= stress ==========================
> ; [12:48:21] [PASSED] nlocks=16,nthreads_per_cpu=2,flags=1
> ; [12:48:23] [PASSED] nlocks=16,nthreads_per_cpu=2,flags=2
> ; [12:48:23] [PASSED] nlocks=2046,nthreads_per_cpu=3,flags=7
> ; [12:48:23] ===================== [PASSED] stress ======================
> ; [12:48:23] ==================== [PASSED] ww_mutex =====================
> ; [12:48:23] ============================================================
> ; [12:48:23] Testing complete. Ran 18 tests: passed: 18
>
> On failure:
> ---
[...]