69 |
fi |
fi |
70 |
} |
} |
71 |
|
|
72 |
|
# Test feature that display some information, checking that output instead of |
73 |
|
# the generated configuration file |
74 |
|
oneDisplayTest() { |
75 |
|
typeset mode=$1 cfg=test/$2 correct=test/results/$3 |
76 |
|
shift 3 |
77 |
|
local BIO="--bad-image-okay" |
78 |
|
if [ "$1" == "--bad-image-bad" ]; then |
79 |
|
BIO="" |
80 |
|
shift |
81 |
|
fi |
82 |
|
|
83 |
|
echo "$testing ... $mode $cfg $correct" |
84 |
|
runme=( ./grubby "$mode" $BIO -c "$cfg" "$@" ) |
85 |
|
if "${runme[@]}" |& cmp "$correct" > /dev/null; then |
86 |
|
(( pass++ )) |
87 |
|
if $opt_verbose; then |
88 |
|
echo ------------------------------------------------------------- |
89 |
|
echo -n "PASS: " |
90 |
|
printf "%q " "${runme[@]}"; echo |
91 |
|
"${runme[@]}" |& diff -U30 "$cfg" - |
92 |
|
echo |
93 |
|
fi |
94 |
|
else |
95 |
|
(( fail++ )) |
96 |
|
echo ------------------------------------------------------------- |
97 |
|
echo -n "FAIL: " |
98 |
|
printf "%q " "${runme[@]}"; echo |
99 |
|
"${runme[@]}" |& diff -U30 "$correct" - |
100 |
|
echo |
101 |
|
fi |
102 |
|
} |
103 |
|
|
104 |
# generate convenience functions |
# generate convenience functions |
105 |
for b in $(./grubby --help | \ |
for b in $(./grubby --help | \ |
106 |
sed -n 's/^.*--\([^ ]*\) *configure \1 bootloader$/\1/p'); do |
sed -n 's/^.*--\([^ ]*\) *configure \1 bootloader$/\1/p'); do |
107 |
eval "${b}Test() { [[ \"$b\" == \$opt_bootloader ]] && oneTest --$b \"\$@\"; }" |
eval "${b}Test() { [[ \"$b\" == \$opt_bootloader ]] && oneTest --$b \"\$@\"; }" |
108 |
|
eval "${b}DisplayTest() { [[ \"$b\" == \$opt_bootloader ]] && oneDisplayTest --$b \"\$@\"; }" |
109 |
done |
done |
110 |
|
|
111 |
#---------------------------------------------------------------------- |
#---------------------------------------------------------------------- |
203 |
grubTest grub.4 default/g4.2 --boot-filesystem=/ --set-default=/boot/vmlinuz-2.4.7-ac3 --remove-kernel /boot/vmlinuz-2.4.7-2.5 --add-kernel=/boot/new-kernel --copy-default --title New_Title |
grubTest grub.4 default/g4.2 --boot-filesystem=/ --set-default=/boot/vmlinuz-2.4.7-ac3 --remove-kernel /boot/vmlinuz-2.4.7-2.5 --add-kernel=/boot/new-kernel --copy-default --title New_Title |
204 |
grubTest grub.6 default/g6.1 --remove-kernel=/boot/vmlinuz-2.4.7-2.9 --boot-filesystem=/ |
grubTest grub.6 default/g6.1 --remove-kernel=/boot/vmlinuz-2.4.7-2.9 --boot-filesystem=/ |
205 |
|
|
206 |
|
testing="GRUB display default index" |
207 |
|
grubDisplayTest grub.1 defaultindex/0 --default-index |
208 |
|
grubDisplayTest grub.2 defaultindex/0 --default-index |
209 |
|
grubDisplayTest grub.3 defaultindex/0 --default-index |
210 |
|
grubDisplayTest grub.4 defaultindex/0 --default-index |
211 |
|
grubDisplayTest grub.5 defaultindex/0 --default-index |
212 |
|
grubDisplayTest grub.6 defaultindex/2 --default-index |
213 |
|
grubDisplayTest grub.7 defaultindex/2 --default-index |
214 |
|
grubDisplayTest grub.8 defaultindex/0 --default-index |
215 |
|
grubDisplayTest grub.9 defaultindex/0 --default-index |
216 |
|
grubDisplayTest grub.10 defaultindex/0 --default-index |
217 |
|
grubDisplayTest grub.10 defaultindex/0 --default-index |
218 |
|
|
219 |
|
testing="GRUB display default title" |
220 |
|
grubDisplayTest grub.1 defaulttitle/g.1 --default-title |
221 |
|
grubDisplayTest grub.2 defaulttitle/g.2 --default-title |
222 |
|
grubDisplayTest grub.3 defaulttitle/g.3 --default-title |
223 |
|
grubDisplayTest grub.4 defaulttitle/g.4 --default-title |
224 |
|
grubDisplayTest grub.5 defaulttitle/g.5 --default-title |
225 |
|
grubDisplayTest grub.6 defaulttitle/g.6 --default-title |
226 |
|
grubDisplayTest grub.7 defaulttitle/g.7 --default-title |
227 |
|
grubDisplayTest grub.8 defaulttitle/g.8 --default-title |
228 |
|
grubDisplayTest grub.9 defaulttitle/g.9 --default-title |
229 |
|
grubDisplayTest grub.10 defaulttitle/g.10 --default-title |
230 |
|
grubDisplayTest grub.11 defaulttitle/g.11 --default-title |
231 |
|
|
232 |
testing="LILO default directive" |
testing="LILO default directive" |
233 |
liloTest lilo.1 default/l1.1 --set-default=/boot/vmlinuz-2.4.18-4 |
liloTest lilo.1 default/l1.1 --set-default=/boot/vmlinuz-2.4.18-4 |
234 |
liloTest lilo.1 default/l1.2 --remove-kernel=/boot/vmlinuz-2.4.18-4smp |
liloTest lilo.1 default/l1.2 --remove-kernel=/boot/vmlinuz-2.4.18-4smp |
360 |
--initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default \ |
--initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default \ |
361 |
--args='console=tty0 console=ttyS1,9600n81 single' |
--args='console=tty0 console=ttyS1,9600n81 single' |
362 |
|
|
363 |
|
testing="GRUB2 add kernel" |
364 |
|
grub2Test grub2.1 add/g2-1.1 --add-kernel=/boot/new-kernel.img --title='title' \ |
365 |
|
--initrd=/boot/new-initrd --boot-filesystem=/boot/ --copy-default |
366 |
|
grub2Test grub2.1 add/g2-1.2 --add-kernel=/boot/new-kernel.img --title='title' \ |
367 |
|
--initrd=/boot/new-initrd --boot-filesystem=/boot/ \ |
368 |
|
--copy-default --make-default |
369 |
|
grub2Test grub2.1 add/g2-1.3 --add-kernel=/boot/new-kernel.img --title='title' \ |
370 |
|
--boot-filesystem=/boot/ --copy-default --make-default |
371 |
|
grub2Test grub2.1 remove/g2-1.4 --remove-kernel=/boot/vmlinuz-2.6.38.2-9.fc15.x86_64 \ |
372 |
|
--boot-filesystem=/boot/ |
373 |
|
grub2Test grub2.5 add/g2-1.5 --add-kernel=/boot/new-kernel.img --title='title' \ |
374 |
|
--initrd=/boot/new-initrd --boot-filesystem=/boot/ --copy-default |
375 |
|
|
376 |
|
testing="GRUB2 add initrd" |
377 |
|
grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \ |
378 |
|
--initrd=/boot/new-initrd --boot-filesystem=/boot/ |
379 |
|
|
380 |
|
testing="GRUB2 display default index" |
381 |
|
grub2DisplayTest grub2.1 defaultindex/0 --default-index |
382 |
|
grub2DisplayTest grub2.2 defaultindex/0 --default-index |
383 |
|
|
384 |
|
testing="GRUB2 display default title" |
385 |
|
grub2DisplayTest grub2.1 defaulttitle/g2.1 --default-title |
386 |
|
grub2DisplayTest grub2.2 defaulttitle/g2.2 --default-title |
387 |
|
|
388 |
|
testing="GRUB2 display debug failure" |
389 |
|
grub2DisplayTest grub2.1 debug/g2.1 --bad-image-bad --boot-filesystem=/boot --default-kernel --debug |
390 |
|
testing="GRUB2 display debug success" |
391 |
|
grub2DisplayTest grub2.1 debug/g2.1.2 --boot-filesystem=/boot --default-kernel --debug |
392 |
|
|
393 |
|
testing="GRUB2 remove kernel via index" |
394 |
|
grub2Test grub2.3 remove/g2-1.1 --remove-kernel=1 |
395 |
|
|
396 |
|
testing="GRUB2 remove kernel via title" |
397 |
|
grub2Test grub2.3 remove/g2-1.1 --remove-kernel="TITLE=title2" |
398 |
|
|
399 |
|
testing="GRUB2 (submenu) remove kernel via index" |
400 |
|
grub2Test grub2.4 remove/g2-1.2 --remove-kernel=2 |
401 |
|
|
402 |
|
testing="GRUB2 (submenu) remove kernel via title" |
403 |
|
grub2Test grub2.4 remove/g2-1.2 --remove-kernel="TITLE=title2" |
404 |
|
|
405 |
testing="YABOOT add kernel" |
testing="YABOOT add kernel" |
406 |
yabootTest yaboot.1 add/y1.1 --copy-default --boot-filesystem=/ --add-kernel=/boot/new-kernel \ |
yabootTest yaboot.1 add/y1.1 --copy-default --boot-filesystem=/ --add-kernel=/boot/new-kernel \ |
407 |
--title=newtitle |
--title=newtitle |