]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - tests/wvtest.sh
tests: Fix ssh key setup for server tests
[novaboot.git] / tests / wvtest.sh
index ac5f65afbc1a2f75e2335fb7eaf7f772425351cd..6c15ca9ec8646d3983e44a5f467cfe4740cf7785 100644 (file)
@@ -46,7 +46,7 @@ _wvcheck()
        fi
        echo "! $WVCALLER_FILE:$WVCALLER_LINE  $TEXT  $OK" >&2
        if [ "$CODE" -ne 0 ]; then
-               exit $CODE
+               return $CODE
        else
                return 0
        fi
@@ -68,6 +68,23 @@ WVPASS()
        fi
 }
 
+# Use WVPASSSH instead of WVPASS when the command includes pipe or
+# output redirection. The whole command must be one argument - quote
+# it.
+WVPASSSH()
+{
+       TEXT="$1"
+
+       _wvfind_caller
+       if bash -o pipefail -c "$@"; then
+               _wvcheck 0 "$TEXT"
+               return 0
+       else
+               _wvcheck 1 "$TEXT"
+               # NOTREACHED
+               return 1
+       fi
+}
 
 WVFAIL()
 {
@@ -146,6 +163,8 @@ WVSTART()
 
 WV_BASE_DIR="$PWD"
 export NOVABOOT_TEST=1
+export NOVABOOT_CONFIG_DIR=/dev/null # Do not read config from /etc/novaboot.d
+export XDG_CONFIG_HOME=/dev/null # Do not read user config from ~/.config/novaboot
 
 PATH=$(dirname $PWD):$PATH # Find our version of novaboot first
 
@@ -158,8 +177,8 @@ function create_script ()
 function create_dummy ()
 {
     create_script <<EOF
-kernel
-file
+load kernel
+load file
 EOF
     touch kernel
     touch file