-
Notifications
You must be signed in to change notification settings - Fork 37
Running 0 tests from 0 test suites. #29
Description
first .i do it from the guide https://blogs.oracle.com/linux/post/writing-kernel-tests-with-the-new-kernel-test-framework-ktf
has some errors:
/home/luhy/build/3.10.0-1160.36.2.el7.x86_64/kernel/ktf_nl.c:70:8: error: ‘GENL_ID_GENERATE’ undeclared here (not in a function)
.id = GENL_ID_GENERATE,
^
/home/luhy/build/3.10.0-1160.36.2.el7.x86_64/kernel/ktf_nl.c: In function ‘ktf_nl_register’:
/home/luhy/build/3.10.0-1160.36.2.el7.x86_64/kernel/ktf_nl.c:525:2: error: implicit declaration of function ‘genl_register_family_with_ops’ [-Werror=implicit-function-declaration]
int stat = genl_register_family_with_ops(&ktf_gnl_family, ktf_ops,
then i fixed it as bellow
int ktf_nl_register(void)
{
#if 0
//#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 7))
int stat = genl_register_family_with_ops(&ktf_gnl_family, ktf_ops,
ARRAY_SIZE(ktf_ops));
#else
int stat = genl_register_family(&ktf_gnl_family);
#endif
return stat;
}
static struct genl_family ktf_gnl_family = {
#if 0//(KERNEL_VERSION(4, 10, 0) > LINUX_VERSION_CODE)
.id = GENL_ID_GENERATE,
#else
.module = THIS_MODULE,
#endif
then fix the erros and build out the ktf.ko
next , i run the examples .
the follow as bellow
[luhy@localhost 3.10.0-1160.36.2.el7.x86_64]$ sudo insmod examples/hello.ko
[luhy@localhost 3.10.0-1160.36.2.el7.x86_64]$ sudo insmod examples/h2.ko
[luhy@localhost 3.10.0-1160.36.2.el7.x86_64]$ sudo insmod examples/h3.ko
[luhy@localhost 3.10.0-1160.36.2.el7.x86_64]$ sudo insmod skbtest/kernel/skbtest.ko
[luhy@localhost 3.10.0-1160.36.2.el7.x86_64]$ lsmod |grep ktf
ktf 41039 4 h2,h3,hello,skbtest
[luhy@localhost 3.10.0-1160.36.2.el7.x86_64]$ ktfrun
[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[ PASSED ] 0 tests.
dmesg log:
[16784.205329] ktf pid [9281] hello_init: hello: loaded
what's wrong