Skip to content

Commit 3e5d078

Browse files
Testing: add framework for the kernel unit tests.
This changes intends to reduce the bar to the kernel unit-testing by introducing a new kernel-testing framework ("ktest") based on Netlink, loadable test modules and python test suite integration. This framework provides the following features: * Integration to the FreeBSD test suite * Automatic test discovery * Automatic test module loading * Minimal boiler-plate code in both kernel and userland * Passing any metadata to the test * Convenient environment pre-setup using python testing framework * Streaming messages from the kernel to the userland * Running tests in the dedicated taskqueues * Skipping or parametrizing tests Differential Revision: https://reviews.freebsd.org/D39385 MFC after: 2 weeks
1 parent 2f53b59 commit 3e5d078

File tree

17 files changed

+1078
-2
lines changed

17 files changed

+1078
-2
lines changed

sys/modules/ktest/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SYSDIR?=${SRCTOP}/sys
2+
.include "${SYSDIR}/conf/kern.opts.mk"
3+
4+
SUBDIR= ktest \
5+
ktest_example
6+
7+
.include <bsd.subdir.mk>

sys/modules/ktest/ktest/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# $FreeBSD$
2+
3+
PACKAGE= tests
4+
5+
SYSDIR?=${SRCTOP}/sys
6+
.include "${SYSDIR}/conf/kern.opts.mk"
7+
8+
.PATH: ${SYSDIR}/tests
9+
10+
KMOD= ktest
11+
SRCS= ktest.c
12+
SRCS+= opt_netlink.h
13+
14+
.include <bsd.kmod.mk>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# $FreeBSD$
2+
3+
PACKAGE= tests
4+
5+
SYSDIR?=${SRCTOP}/sys
6+
.include "${SYSDIR}/conf/kern.opts.mk"
7+
8+
.PATH: ${SYSDIR}/tests
9+
10+
KMOD= ktest_example
11+
SRCS= ktest_example.c
12+
13+
.include <bsd.kmod.mk>

0 commit comments

Comments
 (0)