mirror of
https://github.com/dynup/kpatch
synced 2025-04-18 13:05:21 +00:00
Modules were previously prefixed with either 'kpatch-' or 'livepatch-' depending on which was used. This is no longer true and all modules are now prefixed with "test-". Update test scripts accordingly. Signed-off-by: Artem Savkov <asavkov@redhat.com>
46 lines
959 B
Bash
Executable File
46 lines
959 B
Bash
Executable File
#!/bin/bash
|
|
|
|
SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
|
|
ROOTDIR="$(readlink -f $SCRIPTDIR/../../..)"
|
|
KPATCH="sudo $ROOTDIR/kpatch/kpatch"
|
|
|
|
set -o errexit
|
|
|
|
die() {
|
|
echo "ERROR: $@" >&2
|
|
exit 1
|
|
}
|
|
|
|
ko_to_test() {
|
|
tmp=${1%.ko}-LOADED.test
|
|
echo ${tmp#test-}
|
|
}
|
|
|
|
# make sure any modules added here are disjoint
|
|
declare -a modules=(test-cmdline-string.ko test-meminfo-string.ko)
|
|
|
|
for mod in "${modules[@]}"; do
|
|
testprog=$(ko_to_test $mod)
|
|
$SCRIPTDIR/$testprog && die "$SCRIPTDIR/$testprog succeeded before loading any modules"
|
|
done
|
|
|
|
for mod in "${modules[@]}"; do
|
|
$KPATCH load $mod
|
|
done
|
|
|
|
for mod in "${modules[@]}"; do
|
|
testprog=$(ko_to_test $mod)
|
|
$SCRIPTDIR/$testprog || die "$SCRIPTDIR/$testprog failed after loading modules"
|
|
done
|
|
|
|
for mod in "${modules[@]}"; do
|
|
$KPATCH unload $mod
|
|
done
|
|
|
|
for mod in "${modules[@]}"; do
|
|
testprog=$(ko_to_test $mod)
|
|
$SCRIPTDIR/$testprog && die "$SCRIPTDIR/$testprog succeeded after unloading modules"
|
|
done
|
|
|
|
exit 0
|