diff --git a/test/integration/f22/multiple.test b/test/integration/f22/multiple.test index d2da3da..1a545b9 100755 --- a/test/integration/f22/multiple.test +++ b/test/integration/f22/multiple.test @@ -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 diff --git a/test/integration/f22/replace.test b/test/integration/f22/replace.test deleted file mode 100755 index d917a69..0000000 --- a/test/integration/f22/replace.test +++ /dev/null @@ -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 diff --git a/test/integration/kpatch-test b/test/integration/kpatch-test index 1eb672d..d0b7be7 100755 --- a/test/integration/kpatch-test +++ b/test/integration/kpatch-test @@ -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"