mirror of
https://github.com/dynup/kpatch
synced 2024-12-24 22:22:03 +00:00
Merge pull request #537 from jpoimboe/test-cleanups
test: integration test cleanup
This commit is contained in:
commit
1bbd5ff365
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
|
SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
|
||||||
ROOTDIR="$(readlink -f $SCRIPTDIR/../..)"
|
ROOTDIR="$(readlink -f $SCRIPTDIR/../../..)"
|
||||||
KPATCH="sudo $ROOTDIR/kpatch/kpatch"
|
KPATCH="sudo $ROOTDIR/kpatch/kpatch"
|
||||||
|
|
||||||
set -o errexit
|
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
|
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
|
if [[ -e $testprog ]] && ./$testprog >> $LOG 2>&1; then
|
||||||
error "$prefix: $testprog succeeded after kpatch unload"
|
error "$prefix: $testprog succeeded before kpatch load"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -176,6 +161,15 @@ run_load_test() {
|
|||||||
|
|
||||||
if [[ -e $testprog ]] && ! ./$testprog >> $LOG 2>&1; then
|
if [[ -e $testprog ]] && ! ./$testprog >> $LOG 2>&1; then
|
||||||
error "$prefix: $testprog failed after kpatch load"
|
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
|
return
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -241,17 +235,41 @@ run_combined_test() {
|
|||||||
|
|
||||||
log "load test: combined module"
|
log "load test: combined module"
|
||||||
|
|
||||||
if ! $KPATCH replace kpatch-COMBINED.ko >> $LOG 2>&1; then
|
unload_all
|
||||||
error "combined: kpatch replace failed"
|
|
||||||
|
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
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for testprog in *.test; do
|
for testprog in *.test; do
|
||||||
[[ $testprog != *-LOADED.test ]] && continue
|
[[ $testprog != *-LOADED.test ]] && continue
|
||||||
if ! ./$testprog >> $LOG 2>&1; then
|
if ! ./$testprog >> $LOG 2>&1; then
|
||||||
error "combined: $testprog failed"
|
error "combined: $testprog failed after kpatch load"
|
||||||
fi
|
fi
|
||||||
done
|
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"
|
echo "clearing printk buffer"
|
||||||
|
Loading…
Reference in New Issue
Block a user