]> rtime.felk.cvut.cz Git - novaboot.git/blob - tests/novaboot.wv
Support both old and new isolinux versions
[novaboot.git] / tests / novaboot.wv
1 #!/bin/bash
2
3 cd $(dirname $0)
4 . wvtest.sh
5
6 WVSTART Invoke with no script
7 WVPASS novaboot -t '' < /dev/null
8
9 WVSTART Invoke as script
10 create_dummy
11 WVPASS ./script --gen-only
12
13 WVSTART Invoke as script with absolute path
14 create_dummy
15 WVPASS $PWD/script --gen-only
16
17 WVSTART Pulsar root
18 create_dummy
19 WVPASS ./script --gen-only --pulsar --pulsar-root=ASDF
20 WVPASS grep "root ASDF" config-novaboot
21
22 WVSTART Configuration files
23 create_dummy
24 echo '1;' > .novaboot
25 WVPASS sh -c "./script --gen-only 2> log"
26 WVPASS grep "novaboot: Read $PWD/.novaboot" log
27
28 WVSTART Configuration files in symlinked directories
29 mkdir config
30 echo '1;' > config/.novaboot
31 mkdir script
32 ( cd script; create_dummy )
33 ln -s ../script config
34 WVPASS sh -c "./config/script/script --gen-only 2> log"
35 WVPASS grep "novaboot: Read $PWD/config/.novaboot" log
36
37 WVSTART Builddir configuration variable
38 WVPASS mkdir -p build
39 cat > .novaboot <<'EOF'
40 $builddir="build";
41 1;
42 EOF
43 create_script <<'EOF'
44 load file < echo Hello
45 EOF
46 WVPASS ./script --gen-only
47 WVPASS test -f build/file
48
49 WVSTART Configuration directory
50 mkdir -p dir
51 echo '$test_a = 1;' > dir/a
52 echo '$test_c = 2;' > dir/c
53 echo '$test_c = 1;' > dir/b     # Overriden by the 'c' file
54 echo '$test_ign=1;' > dir/b.txt # Ignored
55 WVPASS sh -c 'NOVABOOT_CONFIG_DIR=dir novaboot --dump-config > config'
56 WVPASS sh -c 'grep \$test config > test'
57 WVPASS diff -u - test <<'EOF'
58 $test_a = 1;
59 $test_c = 2;
60 EOF
61
62 WVSTART Fail with unknown target
63 create_dummy
64 WVFAIL sh -c "./script --gen-only -t non-existing-target"
65
66 WVSTART BUILDDIR variable
67 WVPASS mkdir -p build
68 create_script <<'EOF'
69 BUILDDIR=build
70 load file < echo Hello
71 EOF
72 WVPASS ./script --gen-only
73 WVPASS test -f build/file
74
75 WVSTART Hypervisor configuration variable
76 create_dummy
77 echo '$hypervisor="HYP";' > .novaboot
78 WVPASS ./script --gen-only --pulsar
79 WVPASS grep "exec HYP" config-novaboot
80
81 WVSTART ISO image generation
82 create_dummy
83 WVPASS ./script --iso --gen-only
84
85 WVSTART Recursive target definition
86 create_dummy
87 cat > .novaboot <<EOF
88 %targets = (
89     't1' => '--reset-cmd="echo MyResetCmd"',
90     't2' => '--target t1',
91 );
92 EOF
93 WVPASS sh -c "./script --target=t2|tee output"
94 WVPASS grep -q ^MyResetCmd output
95
96 WVSTART Wrong target definition
97 create_dummy
98 cat > .novaboot <<EOF
99 %targets = ('t1' => '--nonsense');
100 EOF
101 WVPASS sh -c "./script --target=t1 2>&1 |tee output"
102 WVPASS grep -q "Error in target definition" output
103
104
105 # Hi-lock: (("^.*\\(?:WVSTART\\).*$" (0 (quote hi-black-b) t)))