Re: [PATCH v2 2/2] kunit: enable hardware acceleration when available

2024-11-05 Thread Tamir Duberstein
On Tue, Nov 5, 2024 at 8:36 AM Kristina Martsenko wrote: > > On 02/11/2024 12:09, Tamir Duberstein wrote: > > Use KVM or HVF if supported by the QEMU binary and available on the > > system. > > > > This produces a nice improvement on my Apple M3 Pro running macOS 14.

Re: [PATCH 2/2] kunit: enable hardware acceleration when available

2024-11-01 Thread Tamir Duberstein
On Fri, Nov 1, 2024, 09:52 Alyssa Ross wrote: > > On Fri, Oct 25, 2024 at 05:03:54PM -0400, Tamir Duberstein wrote: > > @@ -124,6 +125,29 @@ class > > LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations): > >

Re: [PATCH 2/2] kunit: enable hardware acceleration when available

2024-11-02 Thread Tamir Duberstein
On Fri, Nov 1, 2024 at 11:23 AM Thomas Weißschuh wrote: > > On 2024-11-01 10:49:36-0400, Tamir Duberstein wrote: > > On Fri, Nov 1, 2024, 09:52 Alyssa Ross wrote: > > > > > > On Fri, Oct 25, 2024 at 05:03:54PM -0400, Tamir Duberstein wrote: >

[PATCH v2 1/2] kunit: add fallback for os.sched_getaffinity

2024-11-02 Thread Tamir Duberstein
Python 3.13 added os.process_cpu_count as a cross-platform alternative for the Linux-only os.sched_getaffinity. Use it when it's available and provide a fallback when it's not. This allows kunit to run on macOS. Signed-off-by: Tamir Duberstein --- tools/testing/kunit/kun

[PATCH v2 2/2] kunit: enable hardware acceleration when available

2024-11-02 Thread Tamir Duberstein
[HH:MM:SS] Elapsed time: 1.773s Signed-off-by: Tamir Duberstein --- tools/testing/kunit/kunit_kernel.py | 3 +++ tools/testing/kunit/qemu_configs/arm64.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit

[PATCH v2 0/2] kunit: enable hardware virtualization

2024-11-02 Thread Tamir Duberstein
This series implements feature detection of hardware virtualization on Linux and macOS; the latter being my primary use case. This yields approximately a 6x improvement using HVF on M3 Pro. Signed-off-by: Tamir Duberstein --- Changes in v2: - Use QEMU accelerator fallback (Alyssa Ross, Thomas

[PATCH 2/2] kunit: enable hardware acceleration when available

2024-10-25 Thread Tamir Duberstein
[HH:MM:SS] Elapsed time: 1.773s Signed-off-by: Tamir Duberstein --- tools/testing/kunit/kunit_kernel.py | 26 +- tools/testing/kunit/qemu_configs/arm64.py | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/tools/testing/kunit/kunit_kernel.py b

[PATCH 0/2] kunit: enable hardware virtualization

2024-10-25 Thread Tamir Duberstein
This series implements feature detection of hardware virtualization on Linux and macOS; the latter being my primary use case. This yields approximately a 6x improvement using HVF on M3 Pro. Signed-off-by: Tamir Duberstein --- Tamir Duberstein (2): kunit: add fallback for

[PATCH 1/2] kunit: add fallback for os.sched_getaffinity

2024-10-25 Thread Tamir Duberstein
Python 3.13 added os.process_cpu_count as a cross-platform alternative for the Linux-only os.sched_getaffinity. Use it when it's available and provide a fallback when it's not. This allows kunit to run on macOS. Signed-off-by: Tamir Duberstein --- tools/testing/kunit/kun

Re: [PATCH v2 2/2] kunit: enable hardware acceleration when available

2024-12-03 Thread Tamir Duberstein
On Tue, Nov 5, 2024 at 2:51 PM Tamir Duberstein wrote: > > This behavior is at least somewhat intentional[0]. I have filed a bug > with qemu[1]. If someone can conceive of a way to achieve this, I'd be > delighted to send a v3. > > [cut] > > Link: https://gitlab.c

Re: [PATCH v2 1/2] kunit: add fallback for os.sched_getaffinity

2024-12-07 Thread Tamir Duberstein
On Tue, Nov 5, 2024 at 3:36 AM David Gow wrote: > > On Sat, 2 Nov 2024 at 20:10, Tamir Duberstein wrote: > > > > Python 3.13 added os.process_cpu_count as a cross-platform alternative > > for the Linux-only os.sched_getaffinity. Use it when it's available and > &g

[PATCH v2] scanf: convert self-test to KUnit

2025-02-03 Thread Tamir Duberstein
Convert the scanf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case. Signed-off-by: Tamir Duberstein Acked-by: Geert Uytterhoeven # m68k --- This is one

Re: [PATCH v2] scanf: convert self-test to KUnit

2025-02-04 Thread Tamir Duberstein
On Tue, Feb 4, 2025 at 3:39 AM Petr Mladek wrote: > > On Mon 2025-02-03 06:48:05, Tamir Duberstein wrote: [...] > > diff --git a/lib/Makefile b/lib/Makefile > > index d5cfc7afbbb8..a53cf6dd1505 100644 > > --- a/lib/Makefile > > +++ b/lib/Make

[PATCH v3 1/2] scanf: convert self-test to KUnit

2025-02-04 Thread Tamir Duberstein
Convert the scanf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case. Acked-by: Geert Uytterhoeven # m68k Acked-by: Petr Mladek Signed-off-by: Tamir

[PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Tamir Duberstein
Convert the scanf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't rename the file in accordance with usual kunit conventions nor does it refactor the tests into proper parameterized tests - it's all one big test case. Signed-off

Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Tamir Duberstein
On Fri, Jan 31, 2025 at 12:50 PM Andy Shevchenko wrote: > > On Fri, Jan 31, 2025 at 12:22:39PM -0500, Tamir Duberstein wrote: > > On Fri, Jan 31, 2025 at 12:11 PM Andy Shevchenko > > wrote: > > > On Fri, Jan 31, 2025 at 10:47:49AM -0500, Tamir Duberstein wrote: [...]

[PATCH v3 0/2] EDITME: cover title for scanf-kunit-convert

2025-02-04 Thread Tamir Duberstein
ng: $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 scanf Signed-off-by: Tamir Duberstein --- Changes in v3: - Reduce diff noise in lib/Makefile. (Petr Mladek) - Split `scanf_test` into a few test cases. New output: : === scanf (10 subtests)

[PATCH v3 1/2] scanf: convert self-test to KUnit

2025-02-04 Thread Tamir Duberstein
Convert the scanf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case. Acked-by: Geert Uytterhoeven # m68k Acked-by: Petr Mladek Signed-off-by: Tamir

[PATCH v3 2/2] scanf: break kunit into test cases

2025-02-04 Thread Tamir Duberstein
Use `suite_{init,exit}` and move some tests into `scanf_test_cases`. This gives us nicer output in the event of a failure. Signed-off-by: Tamir Duberstein --- lib/scanf_kunit.c | 82 +++ 1 file changed, 47 insertions(+), 35 deletions(-) diff

Re: [PATCH v3 0/2] EDITME: cover title for scanf-kunit-convert

2025-02-04 Thread Tamir Duberstein
Oops, broken cover letter. Resending.

Re: [PATCH v3 1/2] scanf: convert self-test to KUnit

2025-02-04 Thread Tamir Duberstein
Please disregard.

[PATCH v3 0/2] scanf: convert self-test to KUnit

2025-02-04 Thread Tamir Duberstein
ng: $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 scanf Signed-off-by: Tamir Duberstein --- Changes in v3: - Reduce diff noise in lib/Makefile. (Petr Mladek) - Split `scanf_test` into a few test cases. New output: : === scanf (10 subtests)

[PATCH 1/2] printf: convert self-test to KUnit

2025-02-04 Thread Tamir Duberstein
Convert the printf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case. Signed-off-by: Tamir Duberstein --- Documentation/core-api/printk-formats

[PATCH 0/2] printf: convert self-test to KUnit

2025-02-04 Thread Tamir Duberstein
[0]. Link: https://lore.kernel.org/all/20250204-scanf-kunit-convert-v3-0-386d7c3ee...@gmail.com/T/#u [0] Signed-off-by: Tamir Duberstein --- Tamir Duberstein (2): printf: convert self-test to KUnit printf: break kunit into test cases Documentation/core-api/printk-formats.rst | 2 +- M

[PATCH 2/2] printf: break kunit into test cases

2025-02-04 Thread Tamir Duberstein
Use `suite_{init,exit}` and move all tests into `printf_test_cases`. This gives us nicer output in the event of a failure. Combine `plain_format` and `plain_hash` into `hash_pointer` since they're testing the same scenario. Signed-off-by: Tamir Duberstein --- lib/printf_kunit.c

Re: [PATCH v2] scanf: convert self-test to KUnit

2025-02-04 Thread Tamir Duberstein
On Tue, Feb 4, 2025 at 7:17 AM Petr Mladek wrote: > > On Tue 2025-02-04 05:27:23, Tamir Duberstein wrote: > > Oops, meant to address this in the last reply. > > > > On Tue, Feb 4, 2025 at 3:39 AM Petr Mladek wrote: > > > > > > Should this go via the pr

Re: [PATCH v2] scanf: convert self-test to KUnit

2025-02-04 Thread Tamir Duberstein
Oops, meant to address this in the last reply. On Tue, Feb 4, 2025 at 3:39 AM Petr Mladek wrote: > > Should this go via the printk tree, please? > Or is David going to take it via the kunit tree? Going via printk would be my preference.

[PATCH 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
Extract a private header and convert the prime_numbers self-test to a KUnit test. I considered parameterizing the test using `KUNIT_CASE_PARAM` but didn't see how it was possible since the test logic is entangled with the test parameter generation logic. Signed-off-by: Tamir Duberstein ---

[PATCH 1/2] lib/math: Hook up tests/Makefile

2025-02-07 Thread Tamir Duberstein
th: Add int_pow test suite") Signed-off-by: Tamir Duberstein --- lib/math/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/math/Makefile b/lib/math/Makefile index 853f023ae537..d390da9a59fe 100644 --- a/lib/math/Makefile +++ b/lib/math/Makefile @@ -5,8 +5

[PATCH v2 0/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
:50:19] Testing complete. Ran 1 tests: failed: 1 Signed-off-by: Tamir Duberstein --- Changes in v2: - Keep all the details hidden in prime_numbers.c; expose `with_primes` for debug logging in the test. (David Gow) - Link to v1: https://lore.kernel.org/r/20250207-prime_numbers-kunit-convert-v1-0

[PATCH v2 1/2] lib/math: Hook up tests/Makefile

2025-02-08 Thread Tamir Duberstein
th: Add int_pow test suite") Reviewed-by: David Gow Signed-off-by: Tamir Duberstein --- lib/math/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/math/Makefile b/lib/math/Makefile index 853f023ae537..d390da9a59fe 100644 --- a/lib/math/Makefile +++ b/lib/m

[PATCH v2 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
Extract a private header and convert the prime_numbers self-test to a KUnit test. I considered parameterizing the test using `KUNIT_CASE_PARAM` but didn't see how it was possible since the test logic is entangled with the test parameter generation logic. Signed-off-by: Tamir Duberstein ---

Re: [PATCH v2 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
On Sat, Feb 8, 2025 at 8:58 AM Tamir Duberstein wrote: > > [...] > > diff --git a/lib/math/prime_numbers.c b/lib/math/prime_numbers.c > index 9a17ee9af93a..540d9b7b178f 100644 > --- a/lib/math/prime_numbers.c > +++ b/lib/math/prime_numbers.c > @@ -64,7 +58,13 @@ static c

Re: [PATCH 0/3] bitmap: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
On Sat, Feb 8, 2025 at 12:53 PM Yury Norov wrote: > > [...] > > Take over means that you'd at least add the Co-developed-by tag. I didn't use their code - the thing being "taken over" is the work of having these debates with the maintainers. > [...] > > KUNIT is disabled in defconfig, at least o

[PATCH v2] blackhole_dev: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
Convert this very simple smoke test to a KUnit test. Add a missing `htons` call that was spotted[0] by kernel test robot after initial conversion to KUnit. Link: https://lore.kernel.org/oe-kbuild-all/202502090223.qcymbjwt-...@intel.com/ [0] Signed-off-by: Tamir Duberstein --- I tested this

[PATCH] blackhole_dev: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
Convert this very simple smoke test to a KUnit test. Signed-off-by: Tamir Duberstein --- I tested this using: $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 --kconfig_add CONFIG_NET=y blackholedev --- lib/Kconfig.debug | 20

[PATCH 0/2] lib/prime_numbers: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
; # prime_numbers_test: prime_numbers_test(65536) passed, last prime was 65521 ; # prime_numbers_test: primes.{last=61, .sz=64, .primes[]=...x28208a20a08a28ac} = 2-3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61 ; ; ok 1 prime_numbers_test ; ok 1 math-prime_numbers Signed-off-by: Tamir Duberstein

[PATCH 1/3] bitmap: remove _check_eq_u32_array

2025-02-07 Thread Tamir Duberstein
This has been unused since commit 3aa56885e516 ("bitmap: replace bitmap_{from,to}_u32array") in 2018. Remove it to avoid the need to port it to KUnit in this series. Signed-off-by: Tamir Duberstein --- lib/test_bitmap.c | 28 1 file changed, 28 deletion

[PATCH 0/3] bitmap: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
/all/20250207-printf-kunit-convert-v2-0-057b23860...@gmail.com/T/#u [0] Link: https://lore.kernel.org/all/20250207-scanf-kunit-convert-v4-0-a23e2afae...@gmail.com/T/#u [1] Link: https://lore.kernel.org/all/20240726110658.2281070-1-usama.an...@collabora.com/T/#u [2] Link: https://lore.kernel.org

[PATCH 2/3] bitmap: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
Convert the bitmap() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case. Signed-off-by: Tamir Duberstein --- MAINTAINERS | 2 +-

[PATCH 3/3] bitmap: break kunit into test cases

2025-02-07 Thread Tamir Duberstein
Move some tests into `bitmap_test_cases` and parameterize `test_bitmap_print_buf`. This gives us nicer output in the event of a failure. Signed-off-by: Tamir Duberstein --- lib/bitmap_kunit.c | 182 ++--- 1 file changed, 89 insertions(+), 93

[PATCH v3 0/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
:50:19] Testing complete. Ran 1 tests: failed: 1 Signed-off-by: Tamir Duberstein --- Changes in v3: - Remove `selftest_max` again; snuck into v2. - Restore `#include `. - Sending v3 early because kernel test robot is sad. - Link to v2: https://lore.kernel.org/r/20250208-prime_numbers-kunit-convert

[PATCH v3 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
Extract a private header and convert the prime_numbers self-test to a KUnit test. I considered parameterizing the test using `KUNIT_CASE_PARAM` but didn't see how it was possible since the test logic is entangled with the test parameter generation logic. Signed-off-by: Tamir Duberstein ---

[PATCH v3 1/2] lib/math: Hook up tests/Makefile

2025-02-08 Thread Tamir Duberstein
th: Add int_pow test suite") Reviewed-by: David Gow Signed-off-by: Tamir Duberstein --- lib/math/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/math/Makefile b/lib/math/Makefile index 853f023ae537..d390da9a59fe 100644 --- a/lib/math/Makefile +++ b/lib/m

Re: [PATCH v2 1/2] printf: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
On Mon, Feb 10, 2025 at 8:01 AM Rasmus Villemoes wrote: > > On Fri, Feb 07 2025, Tamir Duberstein wrote: > > [...] > > If/when you do re-roll a v3, can you split the defconfig changes off to > a separate patch? It's a little annoying to scroll through all those >

Re: [PATCH v2 1/2] printf: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
On Mon, Feb 10, 2025 at 9:52 AM Geert Uytterhoeven wrote: > > Hi Tamir, > > On Mon, 10 Feb 2025 at 15:37, Tamir Duberstein wrote: > > On Mon, Feb 10, 2025 at 8:01 AM Rasmus Villemoes > > wrote: > > > > > > On Fri, Feb 07 2025, Tamir Duberstein wrote:

Re: [PATCH v5 1/2] scanf: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
On Mon, Feb 10, 2025 at 10:00 AM Tamir Duberstein wrote: > > Convert the scanf() self-test to a KUnit test. > > In the interest of keeping the patch reasonably-sized this doesn't > refactor the tests into proper parameterized tests - it's all one big > test cas

[PATCH] ww_mutex: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
Convert this unit test to a KUnit test. Signed-off-by: Tamir Duberstein --- 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

Re: [PATCH v2] blackhole_dev: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
On Sat, Feb 8, 2025 at 2:26 PM Tamir Duberstein wrote: > > Convert this very simple smoke test to a KUnit test. > > Add a missing `htons` call that was spotted[0] by kernel test robot > after initial conversion to KUnit. > > Link: > https://lore.kernel.org/oe-kbuild-a

Re: [PATCH v5 2/2] scanf: break kunit into test cases

2025-02-10 Thread Tamir Duberstein
On Mon, Feb 10, 2025 at 11:27 AM Geert Uytterhoeven wrote: > > > [...] > > > > -static char *test_buffer; > > -static char *fmt_buffer; > > +static char test_buffer[BUF_SIZE]; > > +static char fmt_buffer[BUF_SIZE]; > > Why? This wastes 2 KiB of memory when the test is not running. It's a fair poi

[PATCH v5 1/2] scanf: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
Convert the scanf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case. Acked-by: Petr Mladek Reviewed-by: David Gow Signed-off-by: Tamir Duberstein --- M

[PATCH v5 0/2] scanf: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
ng: $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 scanf Signed-off-by: Tamir Duberstein --- Changes in v5: - Remove extraneous trailing newlines from failure messages. - Replace `pr_debug` with `kunit_printk`. - Use static char arrays instead of kmalloc. - Drop KU

[PATCH v5 2/2] scanf: break kunit into test cases

2025-02-10 Thread Tamir Duberstein
Use `suite_init` and move some tests into `scanf_test_cases`. This gives us nicer output in the event of a failure. Reviewed-by: David Gow Signed-off-by: Tamir Duberstein --- lib/scanf_kunit.c | 98 +-- 1 file changed, 44 insertions(+), 54

[PATCH v6 0/2] scanf: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
ng: $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 scanf Signed-off-by: Tamir Duberstein --- Changes in v6: - s/at boot/at runtime/ for consistency with the printf series. - Go back to kmalloc. (Geert Uytterhoeven) - Link to v5: https://lore.kernel.org/r/20250210-scan

[PATCH v6 1/2] scanf: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
Convert the scanf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case. Acked-by: Petr Mladek Reviewed-by: David Gow Signed-off-by: Tamir Duberstein --- M

[PATCH v6 2/2] scanf: break kunit into test cases

2025-02-10 Thread Tamir Duberstein
Use `suite_init` and move some tests into `scanf_test_cases`. This gives us nicer output in the event of a failure. Reviewed-by: David Gow Signed-off-by: Tamir Duberstein --- lib/scanf_kunit.c | 88 ++- 1 file changed, 48 insertions(+), 40

[PATCH v4 1/2] scanf: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
ned-off-by: Tamir Duberstein --- MAINTAINERS | 2 +- arch/m68k/configs/amiga_defconfig| 1 - arch/m68k/configs/apollo_defconfig | 1 - arch/m68k/configs/atari_defconfig| 1 - arch/m68k/configs/bvme6000_defconfig | 1 - arch/m68k/configs/hp300_defconfi

[PATCH v4 2/2] scanf: break kunit into test cases

2025-02-07 Thread Tamir Duberstein
Use `suite_{init,exit}` and move some tests into `scanf_test_cases`. This gives us nicer output in the event of a failure. Reviewed-by: David Gow Signed-off-by: Tamir Duberstein --- lib/scanf_kunit.c | 82 +++ 1 file changed, 47 insertions

[PATCH v4 0/2] scanf: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
ng: $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 scanf Signed-off-by: Tamir Duberstein --- Changes in v4: - Bake `test` into various macros, greatly reducing diff noise. - Revert control flow changes. - Link to v3: https://lore.kernel.org/r/20250204-scanf-kunit-co

Re: [PATCH 0/2] printf: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
On Fri, Feb 7, 2025 at 5:01 AM Rasmus Villemoes wrote: > > On Thu, Feb 06 2025, Tamir Duberstein wrote: > > > On Thu, Feb 6, 2025 at 4:27 AM Rasmus Villemoes > > wrote: > >> > >> On Tue, 4 Feb 2025 at 20:36, Tamir Duberstein wrote: > >> >

[PATCH v2 1/2] printf: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
Convert the printf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case. Acked-by: Geert Uytterhoeven # m68k Signed-off-by: Tamir Duberstein --- Documentatio

[PATCH v2 2/2] printf: break kunit into test cases

2025-02-07 Thread Tamir Duberstein
Use `suite_{init,exit}` and move all tests into `printf_test_cases`. This gives us nicer output in the event of a failure. Combine `plain_format` and `plain_hash` into `hash_pointer` since they're testing the same scenario. Signed-off-by: Tamir Duberstein --- lib/printf_kunit.c

[PATCH v2 0/2] printf: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
[0]. Link: https://lore.kernel.org/all/20250204-scanf-kunit-convert-v3-0-386d7c3ee...@gmail.com/T/#u [0] Signed-off-by: Tamir Duberstein --- Changes in v2: - Incorporate code review from prior work[0] by Arpitha Raghunandan. - Link to v1: https://lore.kernel.org/r/20250204-printf-kunit-convert-v1-0

Re: [PATCH v3 0/2] scanf: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
On Fri, Feb 7, 2025 at 2:33 AM David Gow wrote: > > Thanks very much for doing this. I'm happy with these changes from a KUnit > POV. > > Two things I think we need to be careful about: > - This and the printf test are both changing the m68k configs. This is > fine, but could lead to a (harmless)

Re: [PATCH 0/2] printf: convert self-test to KUnit

2025-02-06 Thread Tamir Duberstein
On Thu, Feb 6, 2025 at 4:27 AM Rasmus Villemoes wrote: > > On Tue, 4 Feb 2025 at 20:36, Tamir Duberstein wrote: > > > > This is one of just 3 remaining "Test Module" kselftests (the others > > being bitmap and scanf), the rest having been converted to

Re: [PATCH v4 1/2] scanf: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
On Fri, Feb 7, 2025 at 6:49 AM Tamir Duberstein wrote: > > Convert the scanf() self-test to a KUnit test. > > In the interest of keeping the patch reasonably-sized this doesn't > refactor the tests into proper parameterized tests - it's all one big > test case. Apo

Re: [PATCH v2 1/2] printf: convert self-test to KUnit

2025-02-07 Thread Tamir Duberstein
On Fri, Feb 7, 2025 at 6:30 AM Tamir Duberstein wrote: > > Convert the printf() self-test to a KUnit test. > > In the interest of keeping the patch reasonably-sized this doesn't > refactor the tests into proper parameterized tests - it's all one big > test case. Apo

Re: [PATCH v5 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
On Mon, Feb 10, 2025 at 9:37 PM Kees Cook wrote: > > On Sat, Feb 08, 2025 at 09:44:39PM -0500, Tamir Duberstein wrote: > > Extract a private header and convert the prime_numbers self-test to a > > KUnit test. I considered parameterizing the test using > > `KUNIT_CASE_PARA

Re: [PATCH v5 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
Ah, I see https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/move-kunit-tests&id=3e50ba8fc834cadead733e4feeb969fce2f3b6e1 now. On Mon, Feb 10, 2025 at 9:47 PM Tamir Duberstein wrote: > > On Mon, Feb 10, 2025 at 9:37 PM Kees Cook wrote: > > &g

Re: distro support for CONFIG_KUNIT: [PATCH 0/3] bitmap: convert self-test to KUnit

2025-02-10 Thread Tamir Duberstein
On Mon, Feb 10, 2025 at 3:20 PM Yury Norov wrote: > > On Mon, Feb 10, 2025 at 11:35:48AM -0800, John Hubbard wrote: > > On 2/9/25 11:54 PM, Geert Uytterhoeven wrote: > > > On Sat, 8 Feb 2025 at 18:53, Yury Norov wrote: > > > > On Fri, Feb 07, 2025 at 03:14:0

Re: [PATCH 0/2] printf: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 3:40 AM Rasmus Villemoes wrote: > > On Tue, Feb 11 2025, David Gow wrote: > > > On Mon, 10 Feb 2025 at 19:57, Rasmus Villemoes > > wrote: > >> > >> On Fri, Feb 07 2025, Tamir Duberstein wrote: > >> > >> > O

Re: [PATCH v6 1/2] scanf: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 6:37 AM Petr Mladek wrote: > > On Mon 2025-02-10 13:13:48, Tamir Duberstein wrote: > > Convert the scanf() self-test to a KUnit test. > > > > In the interest of keeping the patch reasonably-sized this doesn't > > refactor the tests int

Re: [PATCH v7 0/3] scanf: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 10:54 AM Andy Shevchenko wrote: > > On Tue, Feb 11, 2025 at 10:47:03AM -0500, Tamir Duberstein wrote: > > On Tue, Feb 11, 2025 at 10:40 AM Andy Shevchenko > > wrote: > > > On Tue, Feb 11, 2025 at 10:13:36AM -0500, Tamir Duberstein wrote: >

Re: [PATCH v7 1/3] scanf: remove redundant debug logs

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 10:58 AM Andy Shevchenko wrote: > > On Tue, Feb 11, 2025 at 10:50:33AM -0500, Tamir Duberstein wrote: > > On Tue, Feb 11, 2025 at 10:42 AM Andy Shevchenko > > wrote: > > > On Tue, Feb 11, 2025 at 10:13:37AM -0500, Tamir Duberstein wrote: >

Re: [PATCH v6 1/2] scanf: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 11:06 AM Petr Mladek wrote: > > On Tue 2025-02-11 06:45:07, Tamir Duberstein wrote: > > On Tue, Feb 11, 2025 at 6:37 AM Petr Mladek wrote: > > > > > > On Mon 2025-02-10 13:13:48, Tamir Duberstein wrote: > > > > Con

Re: [PATCH v5 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 11:38 AM Kees Cook wrote: > > On Tue, Feb 11, 2025 at 06:51:09AM -0500, Tamir Duberstein wrote: > > Kees, it looks like the private header didn't make it to your tree. > > This bit is missing: > > Whoops! Thanks. I've added it (and fixe

Re: [PATCH v5 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
10, 2025 at 9:52 PM Tamir Duberstein wrote: > > Ah, I see > https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/move-kunit-tests&id=3e50ba8fc834cadead733e4feeb969fce2f3b6e1 > now. > > On Mon, Feb 10, 2025 at 9:47 PM Tamir Duberstein wrote: &g

Re: [PATCH v6 1/2] scanf: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 7:15 AM Andy Shevchenko wrote: > > On Tue, Feb 11, 2025 at 06:45:07AM -0500, Tamir Duberstein wrote: > > On Tue, Feb 11, 2025 at 6:37 AM Petr Mladek wrote: > > > On Mon 2025-02-10 13:13:48, Tamir Duberstein wrote: > > > > > +

Re: [PATCH v7 0/3] scanf: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 12:17 PM Andy Shevchenko wrote: > > On Tue, Feb 11, 2025 at 10:57:11AM -0500, Tamir Duberstein wrote: > > On Tue, Feb 11, 2025 at 10:54 AM Andy Shevchenko > > wrote: > > > On Tue, Feb 11, 2025 at 10:47:03AM -0500, Tamir Duberstein wrote: > &g

Re: [PATCH v7 1/3] scanf: remove redundant debug logs

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 12:16 PM Andy Shevchenko wrote: > > On Tue, Feb 11, 2025 at 11:02:59AM -0500, Tamir Duberstein wrote: > > On Tue, Feb 11, 2025 at 10:58 AM Andy Shevchenko > > wrote: > > > On Tue, Feb 11, 2025 at 10:50:33AM -0500, Tamir Duberstein wrote: > &g

Re: [PATCH v7 0/3] scanf: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 10:40 AM Andy Shevchenko wrote: > > On Tue, Feb 11, 2025 at 10:13:36AM -0500, Tamir Duberstein wrote: > > This is one of just 3 remaining "Test Module" kselftests (the others > > being bitmap and printf), the rest having been converted to K

Re: [PATCH v7 1/3] scanf: remove redundant debug logs

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 10:42 AM Andy Shevchenko wrote: > > On Tue, Feb 11, 2025 at 10:13:37AM -0500, Tamir Duberstein wrote: > > The test already prints the same information on failure; remove > > redundant pr_debug() logs. > > ... > > > #define _check_numbers_t

Re: [PATCH v6 2/2] scanf: break kunit into test cases

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 6:54 AM Petr Mladek wrote: > > On Mon 2025-02-10 13:13:49, Tamir Duberstein wrote: > > Use `suite_init` and move some tests into `scanf_test_cases`. This > > gives us nicer output in the event of a failure. > > Hmm, simulate the following fail

[PATCH v7 0/3] scanf: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
ng: $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 scanf Signed-off-by: Tamir Duberstein --- Changes in v7: - Remove redundant debug logs. (Petr Mladek) - Drop Petr's Acked-by. - Use original test assertions as KUNIT_*_EQ_MSG produces hard-to-parse messages.

[PATCH v7 1/3] scanf: remove redundant debug logs

2025-02-11 Thread Tamir Duberstein
The test already prints the same information on failure; remove redundant pr_debug() logs. Signed-off-by: Tamir Duberstein --- lib/test_scanf.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/test_scanf.c b/lib/test_scanf.c index 44f8508c9d88..07444a852fd4 100644 --- a/lib

[PATCH v7 3/3] scanf: break kunit into test cases

2025-02-11 Thread Tamir Duberstein
Use `suite_init` and move some tests into `scanf_test_cases`. This gives us nicer output in the event of a failure. Reviewed-by: David Gow Signed-off-by: Tamir Duberstein --- lib/scanf_kunit.c | 94 ++- 1 file changed, 51 insertions(+), 43

[PATCH v7 2/3] scanf: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
Convert the scanf() self-test to a KUnit test. In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case. Reviewed-by: David Gow Signed-off-by: Tamir Duberstein --- M

Re: [PATCH] blackhole_dev: convert self-test to KUnit

2025-02-11 Thread Tamir Duberstein
On Tue, Feb 11, 2025 at 9:47 AM Simon Horman wrote: > > On Fri, Feb 07, 2025 at 06:38:41PM -0500, Tamir Duberstein wrote: > > Convert this very simple smoke test to a KUnit test. > > Hi Tamir, > > I think some text explaining why this change is being made is > warrant

Re: [PATCH] ww_mutex: convert self-test to KUnit

2025-02-12 Thread Tamir Duberstein
Hi Dan, On Wed, Feb 12, 2025 at 6:53 AM Dan Carpenter wrote: > > Hi Tamir, > > kernel test robot noticed the following build warnings: > > url: > https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/ww_mutex-convert-self-test-to-KUnit/2

Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Tamir Duberstein
On Fri, Jan 31, 2025 at 12:11 PM Andy Shevchenko wrote: > > On Fri, Jan 31, 2025 at 10:47:49AM -0500, Tamir Duberstein wrote: > > Convert the scanf() self-test to a KUnit test. > > > > In the interest of keeping the patch reasonably-sized this doesn't > > renam

Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Tamir Duberstein
On Fri, Jan 31, 2025 at 12:22 PM Tamir Duberstein wrote: > > On Fri, Jan 31, 2025 at 12:11 PM Andy Shevchenko > wrote: > > > > On Fri, Jan 31, 2025 at 10:47:49AM -0500, Tamir Duberstein wrote: > > > Convert the scanf() self-test to a KUnit test. > > > >

Re: [PATCH] scanf: convert self-test to KUnit

2025-01-31 Thread Tamir Duberstein
On Fri, Jan 31, 2025 at 12:58 PM Tamir Duberstein wrote: > > On Fri, Jan 31, 2025 at 12:50 PM Andy Shevchenko > wrote: > > > > On Fri, Jan 31, 2025 at 12:22:39PM -0500, Tamir Duberstein wrote: > > > On Fri, Jan 31, 2025 at 12:11 PM Andy Shevchenko > > > wr

Re: [PATCH v2 1/2] kunit: add fallback for os.sched_getaffinity

2025-01-13 Thread Tamir Duberstein
+Shuah Khan On Sat, Dec 7, 2024 at 1:52 PM Tamir Duberstein wrote: > > Thanks David! While the next patch is still plausibly undergoing > discussion, would it be possible to pick this one up? Without it > kunit.py is not usable on macOS. Shuah, could you pick this if you agree? Cheers, Tamir

Re: [PATCH v6 3/3] rust: kunit: allow to know if we are in a test

2025-02-14 Thread Tamir Duberstein
On Fri, Feb 14, 2025 at 2:42 AM David Gow wrote: > > From: José Expósito > > In some cases, we need to call test-only code from outside the test > case, for example, to mock a function or a module. > > In order to check whether we are in a test or not, we need to test if > `CONFIG_KUNIT` is set.

Re: [PATCH v6 1/3] rust: kunit: add KUnit case and suite macros

2025-02-14 Thread Tamir Duberstein
Very excited to see this progress. On Fri, Feb 14, 2025 at 2:41 AM David Gow wrote: > > From: José Expósito > > Add a couple of Rust const functions and macros to allow to develop > KUnit tests without relying on generated C code: > > - The `kunit_unsafe_test_suite!` Rust macro is similar to th

Re: [PATCH v6 2/3] rust: macros: add macro to easily run KUnit tests

2025-02-14 Thread Tamir Duberstein
On Fri, Feb 14, 2025 at 2:41 AM David Gow wrote: > > From: José Expósito > > Add a new procedural macro (`#[kunit_tests(kunit_test_suit_name)]`) to > run KUnit tests using a user-space like syntax. > > The macro, that should be used on modules, transforms every `#[test]` > in a `kunit_case!` and

[PATCH v2] ww_mutex: convert self-test to KUnit

2025-02-13 Thread Tamir Duberstein
Convert this unit test to a KUnit test. This allows the test to benefit from the KUnit tooling. Note that care is taken to avoid test-ending assertions in worker threads, which is unsafe in KUnit (and wasn't done before this change either). Signed-off-by: Tamir Duberstein --- I tested this

Re: [PATCH 3/3] bitmap: break kunit into test cases

2025-02-08 Thread Tamir Duberstein
On Sat, Feb 8, 2025 at 4:07 AM David Gow wrote: > > On Sat, 8 Feb 2025 at 04:14, Tamir Duberstein wrote: > > > > Move some tests into `bitmap_test_cases` and parameterize > > `test_bitmap_print_buf`. This gives us nicer output in the event of a > > failure

[PATCH v5 0/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
:50:19] Testing complete. Ran 1 tests: failed: 1 Signed-off-by: Tamir Duberstein --- Changes in v5: - Rebase against mm/mm-everything. - Correctly EXPORT_SYMBOL(with_primes). - Link to v4: https://lore.kernel.org/r/20250208-prime_numbers-kunit-convert-v4-0-76e36bca0...@gmail.com Apologies for the

[PATCH v5 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
Extract a private header and convert the prime_numbers self-test to a KUnit test. I considered parameterizing the test using `KUNIT_CASE_PARAM` but didn't see how it was possible since the test logic is entangled with the test parameter generation logic. Signed-off-by: Tamir Duberstein ---

  1   2   >