net: add skb_segment kunit test
authorWillem de Bruijn <willemb@google.com>
Mon, 9 Oct 2023 14:41:51 +0000 (10:41 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Oct 2023 09:39:01 +0000 (10:39 +0100)
commitb3098d32ed6e6f4c03a95f14426143f1b0af620f
tree7523dcb438a68a4e6569fc6ef2c0b81915ab3c86
parent5247dbf16cee4e83eb89e4d3b87bd5e79c5d1655
net: add skb_segment kunit test

Add unit testing for skb segment. This function is exercised by many
different code paths, such as GSO_PARTIAL or GSO_BY_FRAGS, linear
(with or without head_frag), frags or frag_list skbs, etc.

It is infeasible to manually run tests that cover all code paths when
making changes. The long and complex function also makes it hard to
establish through analysis alone that a patch has no unintended
side-effects.

Add code coverage through kunit regression testing. Introduce kunit
infrastructure for tests under net/core, and add this first test.

This first skb_segment test exercises a simple case: a linear skb.
Follow-on patches will parametrize the test and add more variants.

Tested: Built and ran the test with

    make ARCH=um mrproper

    ./tools/testing/kunit/kunit.py run \
        --kconfig_add CONFIG_NET=y \
        --kconfig_add CONFIG_DEBUG_KERNEL=y \
        --kconfig_add CONFIG_DEBUG_INFO=y \
        --kconfig_add=CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y \
        net_core_gso

Signed-off-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/Kconfig
net/core/Makefile
net/core/gso_test.c [new file with mode: 0644]