]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - tests/novaboot.wv
tests: Fix iprelay-cmd test to work on both Debian an NixOS
[novaboot.git] / tests / novaboot.wv
index a23b2c5fd8ed94903f1435116f1e0cb8a04724f5..4b73577729913e66233bd8ff1225e3f86892c8ce 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 cd $(dirname $0)
 . wvtest.sh
@@ -122,5 +122,49 @@ WVPASS test "$(cat t)" = Target2
 WVPASSSH 'NOVABOOT_TARGET=t2 novaboot --target t3 /dev/null'
 WVPASS test "$(cat t)" = Target3
 
+WVSTART --iprelay-cmd
+WVPASS novaboot --iprelay-cmd="$(which echo) -e '<iprelayd: connected>\xFF\xFA\x2C\x97\xDF\xFF\xF0 \xFF\xFA\x2C\x97\xFF\xFF\xF0'" --on
+
+WVSTART Killing of --remote-cmd when it ignores SIGHUP
+WVPASS tee script <<'EOF'
+$SIG{HUP}='IGNORE';
+open(FH, ">", "pid") or die;
+print FH "$$";
+close FH;
+print "ready pid=$$\n";
+print "exit\n";
+sleep;
+EOF
+WVPASS novaboot --remote-cmd='perl script' --remote-expect=ready --exiton=exit /dev/null
+WVFAIL test -d /proc/$(cat pid)
+coproc novaboot --remote-cmd='perl script' --remote-expect=ready /dev/null
+WVPASS sed -e '/ready/q0' <&${COPROC[0]}
+WVPASS kill $COPROC_PID
+WVFAIL wait $COPROC_PID # Signal termination is considered a failure
+WVFAIL test -d /proc/$(cat pid)
+
+WVSTART Correct invocation path
+WVPASS mkdir dir
+WVPASS tee dir/.novaboot <<<'print "Config OK\n";'
+(
+    WVPASS cd dir
+    WVPASS novaboot /dev/null | WVPASS grep "Config OK"
+)
+WVPASS tee dir/Makefile <<EOF
+all:
+       novaboot /dev/null
+EOF
+WVPASS make -C dir | WVPASS grep "Config OK"
+
+WVSTART "INTERACTION variable"
+WVPASS novaboot --remote-cmd=cat <<<INTERACTION=0
+
+WVSTART "Do not accept directories"
+WVPASS mkdir -p tftproot
+WVFAIL novaboot --server=tftproot <<<"load $PWD"
+
+WVSTART "Accept /dev/null file"
+WVPASS mkdir -p tftproot
+WVPASS novaboot --server=tftproot <<<"load /dev/null"
 
 # Hi-lock: (("^.*\\(?:WVSTART\\).*$" (0 (quote hi-black-b) t)))