kpatch/test/integration/fedora-25/multiple.test
Joe Lawrence 5db4e232ee testing: use common Makefile
Move the integration tests Makefile up a directory level so that it can
be shared.  Update the kpatch-test script to accept a patch-directory
argument and the multiple.test cases to handle this new arrangement.
2016-12-16 16:16:30 -05:00

46 lines
965 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#kpatch-}
}
# make sure any modules added here are disjoint
declare -a modules=(kpatch-cmdline-string.ko kpatch-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