mirror of https://github.com/dynup/kpatch
test: integration test cleanup
- fix kpatch tool path in multiple.test - remove "kpatch replace" tests (replace is deprecated)
This commit is contained in:
parent
2e4dea5236
commit
353f976312
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
|
||||
ROOTDIR="$(readlink -f $SCRIPTDIR/../..)"
|
||||
ROOTDIR="$(readlink -f $SCRIPTDIR/../../..)"
|
||||
KPATCH="sudo $ROOTDIR/kpatch/kpatch"
|
||||
|
||||
set -o errexit
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
#!/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-}
|
||||
}
|
||||
|
||||
test_replace() {
|
||||
$KPATCH load $1
|
||||
$KPATCH replace $2
|
||||
test1=$(ko_to_test $1)
|
||||
test2=$(ko_to_test $2)
|
||||
./$test1 && die "./$test1 succeeded after $1 was replaced by $2"
|
||||
./$test2 || die "./$test2 failed after $1 was replaced by $2"
|
||||
$KPATCH unload $2
|
||||
}
|
||||
|
||||
# subset
|
||||
test_replace kpatch-meminfo-cmdline-rebuild-SLOW.ko kpatch-cmdline-string.ko
|
||||
|
||||
# disjoint
|
||||
test_replace kpatch-cmdline-string.ko kpatch-meminfo-string.ko
|
||||
test_replace kpatch-meminfo-string.ko kpatch-cmdline-string.ko
|
|
@ -149,23 +149,8 @@ run_load_test() {
|
|||
fi
|
||||
|
||||
|
||||
if ! $KPATCH replace $module >> $LOG 2>&1; then
|
||||
error "$prefix: kpatch replace failed"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -e $testprog ]] && ! ./$testprog >> $LOG 2>&1; then
|
||||
error "$prefix: $testprog failed after kpatch replace"
|
||||
return
|
||||
fi
|
||||
|
||||
if ! $KPATCH unload $module >> $LOG 2>&1; then
|
||||
error "$prefix: kpatch unload failed"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -e $testprog ]] && ./$testprog >> $LOG 2>&1; then
|
||||
error "$prefix: $testprog succeeded after kpatch unload"
|
||||
error "$prefix: $testprog succeeded before kpatch load"
|
||||
return
|
||||
fi
|
||||
|
||||
|
@ -176,6 +161,15 @@ run_load_test() {
|
|||
|
||||
if [[ -e $testprog ]] && ! ./$testprog >> $LOG 2>&1; then
|
||||
error "$prefix: $testprog failed after kpatch load"
|
||||
fi
|
||||
|
||||
if ! $KPATCH unload $module >> $LOG 2>&1; then
|
||||
error "$prefix: kpatch unload failed"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -e $testprog ]] && ./$testprog >> $LOG 2>&1; then
|
||||
error "$prefix: $testprog succeeded after kpatch unload"
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
@ -241,17 +235,41 @@ run_combined_test() {
|
|||
|
||||
log "load test: combined module"
|
||||
|
||||
if ! $KPATCH replace kpatch-COMBINED.ko >> $LOG 2>&1; then
|
||||
error "combined: kpatch replace failed"
|
||||
unload_all
|
||||
|
||||
for testprog in *.test; do
|
||||
[[ $testprog != *-LOADED.test ]] && continue
|
||||
if ./$testprog >> $LOG 2>&1; then
|
||||
error "combined: $testprog succeeded before kpatch load"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
if ! $KPATCH load kpatch-COMBINED.ko >> $LOG 2>&1; then
|
||||
error "combined: kpatch load failed"
|
||||
return
|
||||
fi
|
||||
|
||||
for testprog in *.test; do
|
||||
[[ $testprog != *-LOADED.test ]] && continue
|
||||
if ! ./$testprog >> $LOG 2>&1; then
|
||||
error "combined: $testprog failed"
|
||||
error "combined: $testprog failed after kpatch load"
|
||||
fi
|
||||
done
|
||||
|
||||
if ! $KPATCH unload kpatch-COMBINED.ko >> $LOG 2>&1; then
|
||||
error "combined: kpatch unload failed"
|
||||
return
|
||||
fi
|
||||
|
||||
for testprog in *.test; do
|
||||
[[ $testprog != *-LOADED.test ]] && continue
|
||||
if ./$testprog >> $LOG 2>&1; then
|
||||
error "combined: $testprog succeeded after kpatch unload"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
echo "clearing printk buffer"
|
||||
|
|
Loading…
Reference in New Issue