kpatch/test/integration/rhel-7.7/multiple.test
Artem Savkov 0e0cee369a test/integration: add rhel-7.7 rebased patches
Added integration-test patches rebased against rhel-7.7 GA kernel. No
conflicts, some fuzz.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-08-12 14:36:16 +02:00

66 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
ROOTDIR="$(readlink -f $SCRIPTDIR/../..)"
KPATCH="sudo $ROOTDIR/kpatch/kpatch"
MODULE_PREFIX="test-"
MODULE_POSTFIX=".ko"
TEST_POSTFIX="-LOADED.test"
set -o errexit
die() {
echo "ERROR: $@" >&2
exit 1
}
ko_to_test() {
tmp=${1%${MODULE_POSTFIX}}${TEST_POSTFIX}
echo ${tmp#${MODULE_PREFIX}}
}
# make sure any modules added here are disjoint
declare -a modules
declare -a blacklist=(meminfo-string-LOADED.test)
for file in "${SCRIPTDIR}"/*"${TEST_POSTFIX}"; do
name=$(basename ${file})
skip=0
for bname in "${blacklist[@]}"; do
if [ "${bname}" == "${name}" ]; then
skip=1
break
fi
done
if [ ${skip} -eq 0 ]; then
modules+=(${MODULE_PREFIX}${name%${TEST_POSTFIX}}${MODULE_POSTFIX})
fi
done
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 ((idx=${#modules[@]}-1 ; idx>=0 ; idx--)); do
mod=${modules[idx]}
$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