integration: dynamic module list in multiple.test

Dynamically compile module list based on -LOADED.test files in all
multiple.test scripts.
The scripts is now the same across all three directories so it might be
good to deduplicate it somehow along with other common tests.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
Artem Savkov 2019-01-14 17:34:10 +01:00 committed by Artem Savkov
parent 7c774350fc
commit 70f9221c01
3 changed files with 36 additions and 9 deletions

View File

@ -4,6 +4,10 @@ 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() {
@ -12,12 +16,17 @@ die() {
}
ko_to_test() {
tmp=${1%.ko}-LOADED.test
echo ${tmp#test-}
tmp=${1%${MODULE_POSTFIX}}${TEST_POSTFIX}
echo ${tmp#${MODULE_PREFIX}}
}
# make sure any modules added here are disjoint
declare -a modules=(test-cmdline-string.ko test-meminfo-string.ko)
declare -a modules
for file in "${SCRIPTDIR}"/*"${TEST_POSTFIX}"; do
name=$(basename ${file})
modules+=(${MODULE_PREFIX}${name%${TEST_POSTFIX}}${MODULE_POSTFIX})
done
for mod in "${modules[@]}"; do
testprog=$(ko_to_test $mod)

View File

@ -4,6 +4,10 @@ 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() {
@ -12,12 +16,17 @@ die() {
}
ko_to_test() {
tmp=${1%.ko}-LOADED.test
echo ${tmp#test-}
tmp=${1%${MODULE_POSTFIX}}${TEST_POSTFIX}
echo ${tmp#${MODULE_PREFIX}}
}
# make sure any modules added here are disjoint
declare -a modules=(test-data-new.ko test-shadow-newpid.ko)
declare -a modules
for file in "${SCRIPTDIR}"/*"${TEST_POSTFIX}"; do
name=$(basename ${file})
modules+=(${MODULE_PREFIX}${name%${TEST_POSTFIX}}${MODULE_POSTFIX})
done
for mod in "${modules[@]}"; do
testprog=$(ko_to_test $mod)

View File

@ -4,6 +4,10 @@ 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() {
@ -12,12 +16,17 @@ die() {
}
ko_to_test() {
tmp=${1%.ko}-LOADED.test
echo ${tmp#test-}
tmp=${1%${MODULE_POSTFIX}}${TEST_POSTFIX}
echo ${tmp#${MODULE_PREFIX}}
}
# make sure any modules added here are disjoint
declare -a modules=(test-cmdline-string.ko test-meminfo-string.ko)
declare -a modules
for file in "${SCRIPTDIR}"/*"${TEST_POSTFIX}"; do
name=$(basename ${file})
modules+=(${MODULE_PREFIX}${name%${TEST_POSTFIX}}${MODULE_POSTFIX})
done
for mod in "${modules[@]}"; do
testprog=$(ko_to_test $mod)