]> 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 da97b45debe5f2723baaa21aa07a5d6e843ca222..4b73577729913e66233bd8ff1225e3f86892c8ce 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 cd $(dirname $0)
 . wvtest.sh
@@ -19,6 +19,13 @@ create_dummy
 WVPASS ./script --gen-only --pulsar --pulsar-root=ASDF
 WVPASS grep "root ASDF" config-novaboot
 
+WVSTART Pulsar supports chld
+create_script <<EOF
+chld grub
+EOF
+WVPASS ./script --gen-only --pulsar
+WVPASS grep "chld grub" config-novaboot
+
 WVSTART Configuration files
 create_dummy
 echo '1;' > .novaboot
@@ -52,7 +59,7 @@ echo '$test_a = 1;' > dir/a
 echo '$test_c = 2;' > dir/c
 echo '$test_c = 1;' > dir/b    # Overriden by the 'c' file
 echo '$test_ign=1;' > dir/b.txt        # Ignored
-WVPASS sh -c 'NOVABOOT_CONFIG_DIR=dir novaboot --dump-config > config'
+WVPASS sh -c 'NOVABOOT_CONFIG_DIR=./dir novaboot --dump-config > config'
 WVPASS sh -c 'grep \$test config > test'
 WVPASS diff -u - test <<'EOF'
 $test_a = 1;
@@ -115,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)))