kpatch/test/integration/rhel-7.6/multiple.test
Artem Savkov 76ebcd2fa4 test/integration: add patches rebased for recent rhel minor releases
This commit contains centos-7 patches rebased and adjusted to work with
recent rhel minors so that integration tests actually pass on those.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-06-14 10:53:57 +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