kpatch/test/testmod/doit-client.sh
Seth Jennings 5b62d5f169 add module for testing module patching
A simple kernel module for testing basic kernel module patching.

Just run doit.sh from test/testmod.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-06-02 20:34:38 -05:00

28 lines
485 B
Bash
Executable File

#!/bin/bash
#set -x
rmmod testmod 2> /dev/null
rmmod kpatch 2> /dev/null
insmod testmod.ko || exit 1
insmod kpatch.ko || exit 1
if [[ "$(cat /sys/kernel/testmod/value)" != "2" ]]
then
exit 1
fi
insmod kpatch-patch.ko
dmesg | tail
if [[ "$(cat /sys/kernel/testmod/value)" != "3" ]]
then
exit 1
fi
echo 0 > /sys/kernel/kpatch/patches/kpatch_patch/enabled
rmmod kpatch-patch
if [[ "$(cat /sys/kernel/testmod/value)" != "2" ]]
then
exit 1
fi
rmmod kpatch
rmmod testmod
echo "SUCCESS"