Re: [PATCH net-next v2 2/2] net: hsr: Add KUnit test for PRP

From: Paolo Abeni
Date: Tue Feb 25 2025 - 06:08:39 EST


On 2/21/25 11:10 AM, Jaakko Karrenpalo wrote:
> From: Jaakko Karrenpalo <jaakko.karrenpalo@xxxxxxxxxx>
>
> Add unit tests for the PRP duplicate detection
>
> Signed-off-by: Jaakko Karrenpalo <jaakko.karrenpalo@xxxxxxxxxx>
> Signed-off-by: Jaakko Karrenpalo <jkarrenpalo@xxxxxxxxx>

Only one of the above ;)

> ---
> Changes in v2:
> - Changed KUnit tests to compile as built-in only
>
> net/hsr/Kconfig | 14 +++
> net/hsr/Makefile | 2 +
> net/hsr/prp_dup_discard_test.c | 210 +++++++++++++++++++++++++++++++++
> 3 files changed, 226 insertions(+)
> create mode 100644 net/hsr/prp_dup_discard_test.c
>
> diff --git a/net/hsr/Kconfig b/net/hsr/Kconfig
> index 1b048c17b6c8..07fc0a768b7e 100644
> --- a/net/hsr/Kconfig
> +++ b/net/hsr/Kconfig
> @@ -38,3 +38,17 @@ config HSR
> relying on this code in a safety critical system!
>
> If unsure, say N.
> +
> +config PRP_DUP_DISCARD_KUNIT_TEST
> + bool "PRP duplicate discard KUnit tests" if !KUNIT_ALL_TESTS

IMHO kunits module are better suited to be tristate. Export the HSR
symbols as needed (when PRP_DUP_DISCARD_KUNIT_TEST=m) and add the needed
MODULE_ boilerplate

Thanks,

Paolo