Implements tests for kernel modules
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
# out-of-tree called make with two arguments -- kernel headers path and name
|
||||
# of target binary that MUST be produced by makefile
|
||||
# - $(TARGET).ko_test: name of test binary that MUST be produced by makefile
|
||||
# e.g.:
|
||||
# make KERNEL=/lib/modules/4.8.0-58-generic/build TARGET=hello-world.ko
|
||||
KERNEL := /lib/modules/$(shell uname -r)/build
|
||||
@ -10,6 +11,7 @@ $(TARGET)-objs = module.o
|
||||
|
||||
all:
|
||||
make -C $(KERNEL) M=$(PWD) modules
|
||||
cp test.sh $(TARGET).ko_test
|
||||
|
||||
clean:
|
||||
make -C $(KERNEL) M=$(PWD) clean
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
printk("COOKIE!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
3
examples/kernel-module/test.sh
Normal file
3
examples/kernel-module/test.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# check for message in kernel log
|
||||
dmesg | grep COOKIE
|
Reference in New Issue
Block a user