git: 0eb0d2333546 - main - ktest: make ktest work with Netlink loaded as a module.

From: Alexander V. Chernikov <melifaro_at_FreeBSD.org>
Date: Tue, 13 Jun 2023 06:04:58 UTC
The branch main has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=0eb0d2333546cc2af4027e43a5a254a0e2790dce

commit 0eb0d2333546cc2af4027e43a5a254a0e2790dce
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-06-01 07:25:41 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-06-13 06:04:14 +0000

    ktest: make ktest work with Netlink loaded as a module.
    
    MFC after:      2 weeks
---
 sys/modules/ktest/ktest_example/Makefile | 1 +
 sys/tests/ktest.h                        | 3 ++-
 tests/atf_python/ktest.py                | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/modules/ktest/ktest_example/Makefile b/sys/modules/ktest/ktest_example/Makefile
index b4a3e778e2ed..3ca304a19a99 100644
--- a/sys/modules/ktest/ktest_example/Makefile
+++ b/sys/modules/ktest/ktest_example/Makefile
@@ -9,5 +9,6 @@ SYSDIR?=${SRCTOP}/sys
 
 KMOD=	ktest_example
 SRCS=	ktest_example.c
+SRCS+=	opt_netlink.h
 
 .include <bsd.kmod.mk>
diff --git a/sys/tests/ktest.h b/sys/tests/ktest.h
index feadb800551b..c767aa31e8e5 100644
--- a/sys/tests/ktest.h
+++ b/sys/tests/ktest.h
@@ -94,7 +94,7 @@ static struct ktest_module_info _module_info = {			\
 };									\
 									\
 static moduledata_t _module_data = {					\
-        "__"  #_n  "_module",						\
+        #_n,								\
         ktest_default_modevent,						\
         &_module_info,							\
 };									\
@@ -102,6 +102,7 @@ static moduledata_t _module_data = {					\
 DECLARE_MODULE(ktest_##_n, _module_data, SI_SUB_PSEUDO, SI_ORDER_ANY);	\
 MODULE_VERSION(ktest_##_n, 1);						\
 MODULE_DEPEND(ktest_##_n, ktestmod, 1, 1, 1);				\
+MODULE_DEPEND(ktest_##_n, netlink, 1, 1, 1);				\
 
 #endif /* _KERNEL */
 
diff --git a/tests/atf_python/ktest.py b/tests/atf_python/ktest.py
index 4cd9970aaec1..a18f47d1dd06 100644
--- a/tests/atf_python/ktest.py
+++ b/tests/atf_python/ktest.py
@@ -91,7 +91,7 @@ class KtestLoader(object):
 
         ret = []
         for rx_msg in NetlinkMultipartIterator(self.nlsock, nlmsg_seq, self.family_id):
-            # test_msg.print_message()
+            # rx_msg.print_message()
             tst = {
                 "mod_name": rx_msg.get_nla(KtestAttrType.KTEST_ATTR_MOD_NAME).text,
                 "name": rx_msg.get_nla(KtestAttrType.KTEST_ATTR_TEST_NAME).text,