Skip to content

Commit 88232ec

Browse files
chuckleverkuba-moo
authored andcommitted
net/handshake: Add Kunit tests for the handshake consumer API
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 <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2fd5532 commit 88232ec

File tree

8 files changed

+569
-0
lines changed

8 files changed

+569
-0
lines changed

net/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ config NET_HANDSHAKE
7373
depends on SUNRPC || NVME_TARGET_TCP || NVME_TCP
7474
default y
7575

76+
config NET_HANDSHAKE_KUNIT_TEST
77+
tristate "KUnit tests for the handshake upcall mechanism" if !KUNIT_ALL_TESTS
78+
default KUNIT_ALL_TESTS
79+
depends on KUNIT
80+
help
81+
This builds the KUnit tests for the handshake upcall mechanism.
82+
83+
KUnit tests run during boot and output the results to the debug
84+
log in TAP format (https://testanything.org/). Only useful for
85+
kernel devs running KUnit test harness and are not for inclusion
86+
into a production build.
87+
88+
For more information on KUnit and unit tests in general, refer
89+
to the KUnit documentation in Documentation/dev-tools/kunit/.
90+
7691
config INET
7792
bool "TCP/IP networking"
7893
help

net/handshake/.kunitconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CONFIG_KUNIT=y
2+
CONFIG_UBSAN=y
3+
CONFIG_STACKTRACE=y
4+
CONFIG_NET=y
5+
CONFIG_NETWORK_FILESYSTEMS=y
6+
CONFIG_INET=y
7+
CONFIG_MULTIUSER=y
8+
CONFIG_NFS_FS=y
9+
CONFIG_SUNRPC=y
10+
CONFIG_NET_HANDSHAKE=y
11+
CONFIG_NET_HANDSHAKE_KUNIT_TEST=y

net/handshake/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99

1010
obj-y += handshake.o
1111
handshake-y := genl.o netlink.o request.o tlshd.o trace.o
12+
13+
obj-$(CONFIG_NET_HANDSHAKE_KUNIT_TEST) += handshake-test.o

0 commit comments

Comments
 (0)