]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - tests/novaboot.wv
Allow specifying target in NOVABOOT_TARGET environment variable
[novaboot.git] / tests / novaboot.wv
index 9fc60569f50b1ab3b780bd71e007dccb584422b1..da97b45debe5f2723baaa21aa07a5d6e843ca222 100755 (executable)
@@ -46,6 +46,19 @@ EOF
 WVPASS ./script --gen-only
 WVPASS test -f build/file
 
+WVSTART Configuration directory
+mkdir -p dir
+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 'grep \$test config > test'
+WVPASS diff -u - test <<'EOF'
+$test_a = 1;
+$test_c = 2;
+EOF
+
 WVSTART Fail with unknown target
 create_dummy
 WVFAIL sh -c "./script --gen-only -t non-existing-target"
@@ -67,7 +80,7 @@ WVPASS grep "exec HYP" config-novaboot
 
 WVSTART ISO image generation
 create_dummy
-WVPASS ./script --iso --target ''
+WVPASS ./script --iso --gen-only
 
 WVSTART Recursive target definition
 create_dummy
@@ -88,5 +101,19 @@ EOF
 WVPASS sh -c "./script --target=t1 2>&1 |tee output"
 WVPASS grep -q "Error in target definition" output
 
+WVSTART Different ways of specifying target
+cat > .novaboot <<'EOF'
+%targets = ('t1' => '--remote-cmd="echo Target1 > t"',
+            't2' => '--remote-cmd="echo Target2 > t"',
+            't3' => '--remote-cmd="echo Target3 > t"');
+$default_target = 't1';
+EOF
+WVPASSSH 'novaboot /dev/null'
+WVPASS test "$(cat t)" = Target1
+WVPASSSH 'NOVABOOT_TARGET=t2 novaboot /dev/null'
+WVPASS test "$(cat t)" = Target2
+WVPASSSH 'NOVABOOT_TARGET=t2 novaboot --target t3 /dev/null'
+WVPASS test "$(cat t)" = Target3
+
 
 # Hi-lock: (("^.*\\(?:WVSTART\\).*$" (0 (quote hi-black-b) t)))