fi
echo "! $WVCALLER_FILE:$WVCALLER_LINE $TEXT $OK" >&2
if [ "$CODE" -ne 0 ]; then
- exit $CODE
+ return $CODE
else
return 0
fi
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()
{
echo >&2
_wvfind_caller
echo "Testing \"$*\" in $WVCALLER_FILE:" >&2
+ cd "$WV_BASE_DIR"
+ local dir=test.$(echo $* | tr -s '[[:blank:]]' _ | tr "A-Z" "a-z")
+ rm -rf "$dir"
+ mkdir -p "$dir"
+ cd "$dir"
+}
+
+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
+
+function create_script ()
+{
+ (echo "#!/usr/bin/env novaboot"; cat) > script
+ chmod +x script
+}
+
+function create_dummy ()
+{
+ create_script <<EOF
+load kernel
+load file
+EOF
+ touch kernel
+ touch file
}