From df2e2daa92b528756e0ab40dcad90bc5816ba1a0 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Mon, 5 May 2014 17:07:13 -0500 Subject: [PATCH] test: send status messages to log file --- test/integration/kpatch-test | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/integration/kpatch-test b/test/integration/kpatch-test index 0d5ce07..c58114d 100755 --- a/test/integration/kpatch-test +++ b/test/integration/kpatch-test @@ -73,10 +73,14 @@ done error() { - echo "ERROR: $@" >&2 + echo "ERROR: $@" |tee -a $LOG >&2 ERROR=$((ERROR + 1)) } +log() { + echo "$@" |tee -a $LOG +} + unload_all() { for i in `lsmod |egrep '^kpatch' |awk '{print $1}'`; do if [[ $i != kpatch ]]; then @@ -104,10 +108,10 @@ build_module() { skip=0 [[ $shouldfail -eq 1 ]] && skip=1 [[ -e $module ]] && skip=1 - [[ $skip -eq 1 ]] && echo "skipping build: $prefix" && return + [[ $skip -eq 1 ]] && log "skipping build: $prefix" && return fi - echo "build: $prefix" + log "build: $prefix" if ! $KPATCHBUILD $file >> $LOG 2>&1; then [[ $shouldfail -eq 0 ]] && error "$prefix: build failed" @@ -124,7 +128,7 @@ run_load_test() { [[ ! -e $testprog ]] && return - echo "load test: $prefix" + log "load test: $prefix" if [[ ! -e $module ]]; then error "$prefix: can't find $module" @@ -168,7 +172,7 @@ run_custom_test() { [[ $testprog = *-LOADED.test ]] && return - echo "custom test: $prefix" + log "custom test: $prefix" if ! ./$testprog >> $LOG 2>&1; then error "$prefix: test failed" @@ -195,6 +199,6 @@ done unload_all -echo "$ERROR errors encountered" +log "$ERROR errors encountered" exit $ERROR