Skip to content

Commit

Permalink
net/handshake: Add Kunit tests for the handshake consumer API
Browse files Browse the repository at this point in the history
These verify the API contracts and help exercise lifetime rules for
consumer sockets and handshake_req structures.

One way to run these tests:

./tools/testing/kunit/kunit.py run --kunitconfig ./net/handshake/.kunitconfig

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Chuck Lever authored and Jakub Kicinski committed Apr 20, 2023
1 parent 2fd5532 commit 88232ec
Show file tree
Hide file tree
Showing 8 changed files with 569 additions and 0 deletions.
15 changes: 15 additions & 0 deletions net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ config NET_HANDSHAKE
depends on SUNRPC || NVME_TARGET_TCP || NVME_TCP
default y

config NET_HANDSHAKE_KUNIT_TEST
tristate "KUnit tests for the handshake upcall mechanism" if !KUNIT_ALL_TESTS
default KUNIT_ALL_TESTS
depends on KUNIT
help
This builds the KUnit tests for the handshake upcall mechanism.

KUnit tests run during boot and output the results to the debug
log in TAP format (https://testanything.org/). Only useful for
kernel devs running KUnit test harness and are not for inclusion
into a production build.

For more information on KUnit and unit tests in general, refer
to the KUnit documentation in Documentation/dev-tools/kunit/.

config INET
bool "TCP/IP networking"
help
Expand Down
11 changes: 11 additions & 0 deletions net/handshake/.kunitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CONFIG_KUNIT=y
CONFIG_UBSAN=y
CONFIG_STACKTRACE=y
CONFIG_NET=y
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_INET=y
CONFIG_MULTIUSER=y
CONFIG_NFS_FS=y
CONFIG_SUNRPC=y
CONFIG_NET_HANDSHAKE=y
CONFIG_NET_HANDSHAKE_KUNIT_TEST=y
2 changes: 2 additions & 0 deletions net/handshake/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@

obj-y += handshake.o
handshake-y := genl.o netlink.o request.o tlshd.o trace.o

obj-$(CONFIG_NET_HANDSHAKE_KUNIT_TEST) += handshake-test.o
Loading

0 comments on commit 88232ec

Please sign in to comment.