Magellan Linux

Contents of /tags/grubby-8_34/test.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2685 - (show annotations) (download) (as text)
Wed Jul 16 10:38:09 2014 UTC (9 years, 9 months ago) by niro
Original Path: trunk/grubby/test.sh
File MIME type: application/x-sh
File size: 26806 byte(s)
Support "devicetree" directive in grub2.
1 #!/bin/bash
2 #
3 # test.sh -- grubby regression tests
4 #
5 # Copyright 2007-2008 Red Hat, Inc. All rights reserved.
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #
20
21 if [ -n "$TOPDIR" ]; then
22 LD_LIBRARY_PATH="$TOPDIR/nash:$TOPDIR/bdevid:/usr/lib:/lib"
23 export LD_LIBRARY_PATH
24 fi
25
26 #----------------------------------------------------------------------
27 # Global vars
28 #----------------------------------------------------------------------
29
30 cmd=${0##*/}
31 opt_bootloader=*
32 opt_verbose=false
33 read -d '' usage <<EOT
34 usage: test.sh [ -hv ]
35
36 -b B --bootloader=B Test bootloader B instead of all
37 -h --help Show this help message
38 -v --verbose Verbose output
39 EOT
40 declare -i pass=0 fail=0
41 testing=
42
43 #----------------------------------------------------------------------
44 # Functions
45 #----------------------------------------------------------------------
46
47 oneTest() {
48 typeset mode=$1 cfg=test/$2 correct=test/results/$3
49 shift 3
50
51 local ENV_FILE=""
52 if [ "$mode" == "--grub2" ]; then
53 ENV_FILE="test/grub2-support_files/env_temp"
54 if [ "$1" == "--env" ]; then
55 cp "test/grub2-support_files/$2" "$ENV_FILE"
56 shift 2
57 else
58 cp "test/grub2-support_files/grubenv.0" "$ENV_FILE"
59 fi
60 ENV_FILE="--env=$ENV_FILE"
61 fi
62
63
64 echo "$testing ... $mode $cfg $correct"
65 runme=( ./grubby "$mode" --bad-image-okay $ENV_FILE -c "$cfg" -o - "$@" )
66 if "${runme[@]}" | cmp "$correct" > /dev/null; then
67 (( pass++ ))
68 if $opt_verbose; then
69 echo -------------------------------------------------------------
70 echo -n "PASS: "
71 printf "%q " "${runme[@]}"; echo
72 "${runme[@]}" | diff -U30 "$cfg" -
73 echo
74 fi
75 else
76 (( fail++ ))
77 echo -------------------------------------------------------------
78 echo -n "FAIL: "
79 printf "%q " "${runme[@]}"; echo
80 "${runme[@]}" | diff -U30 "$correct" -
81 echo
82 fi
83 }
84
85 # Test feature that display some information, checking that output instead of
86 # the generated configuration file
87 oneDisplayTest() {
88 typeset mode=$1 cfg=test/$2 correct=test/results/$3
89 shift 3
90
91 local ENV_FILE=""
92 if [ "$mode" == "--grub2" ]; then
93 ENV_FILE="test/grub2-support_files/env_temp"
94 if [ "$1" == "--env" ]; then
95 cp "test/grub2-support_files/$2" "$ENV_FILE"
96 shift 2
97 else
98 cp "test/grub2-support_files/grubenv.0" "$ENV_FILE"
99 fi
100 ENV_FILE="--env=$ENV_FILE"
101 fi
102
103 local BIO="--bad-image-okay"
104 if [ "$1" == "--bad-image-bad" ]; then
105 BIO=""
106 shift
107 fi
108
109 echo "$testing ... $mode $cfg $correct"
110 runme=( ./grubby "$mode" $BIO $ENV_FILE -c "$cfg" "$@" )
111 if "${runme[@]}" 2>&1 | cmp "$correct" > /dev/null; then
112 (( pass++ ))
113 if $opt_verbose; then
114 echo -------------------------------------------------------------
115 echo -n "PASS: "
116 printf "%q " "${runme[@]}"; echo
117 "${runme[@]}" 2>&1 | diff -U30 "$cfg" -
118 echo
119 fi
120 else
121 (( fail++ ))
122 echo -------------------------------------------------------------
123 echo -n "FAIL: "
124 printf "%q " "${runme[@]}"; echo
125 "${runme[@]}" 2>&1 | diff -U30 "$correct" -
126 echo
127 fi
128 }
129
130 commandTest() {
131 description=$1
132 cmd0=$2
133 text1=$3
134 shift 3
135 echo "$description"
136 output0=$(mktemp)
137
138 $cmd0 > $output0
139
140 if echo $text1 | cmp $output0 - >/dev/null; then
141 (( pass++))
142 if $opt_verbose; then
143 echo -------------------------------------------------------------
144 echo -n "PASS: "
145 printf "%q " "\"$cmd0\""; echo
146 echo $text1 | diff -U30 $output0 -
147 echo
148 fi
149 else
150 (( fail++ ))
151 echo -------------------------------------------------------------
152 echo -n "FAIL: "
153 printf "%q " "\"$cmd0\""; echo
154 echo $text1 | diff -U30 $output0 -
155 echo
156 fi
157 }
158
159 # generate convenience functions
160 for b in $(./grubby --help | \
161 sed -n 's/^.*--\([^ ]*\) *configure \1 bootloader$/\1/p'); do
162 eval "${b}Test() { [[ \"$b\" == \$opt_bootloader ]] && oneTest --$b \"\$@\"; }"
163 eval "${b}DisplayTest() { [[ \"$b\" == \$opt_bootloader ]] && oneDisplayTest --$b \"\$@\"; }"
164 done
165
166 #----------------------------------------------------------------------
167 # Main
168 #----------------------------------------------------------------------
169
170 # Use /usr/bin/getopt which supports GNU-style long options
171 args=$(getopt -o b:hv --long bootloader,help,verbose -n "$cmd" -- "$@") || exit
172 eval set -- "$args"
173 while true; do
174 case $1 in
175 -b|--bootloader) opt_bootloader=$2; shift 2 ;;
176 -h|--help) echo "$usage"; exit 0 ;;
177 -v|--verbose) opt_verbose=true; shift ;;
178 --) shift; break ;;
179 *) echo "failed to process cmdline args" >&2; exit 1 ;;
180 esac
181 done
182
183 export MALLOC_CHECK_=2
184 if [ -n "${RANDOM}" ]; then
185 export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
186 else
187 export MALLOC_PERTURB_=1
188 fi
189
190 testing="Parse/write comparison"
191 for n in test/*.[0-9]*; do
192 [ -d $n ] && continue
193 n=${n#*/} # remove test/
194 b=${n%.*} # remove suffix
195 [[ $b == $opt_bootloader ]] || continue
196 ${b}Test $n ../$n --remove-kernel 1234
197 done
198
199 testing="Permission preservation"
200 unset b
201 for n in test/*.[0-9]*; do
202 n=${n#*/} # remove test/
203 [[ ${n%.*} == "$b" ]] && continue
204 b=${n%.*} # remove suffix
205 [[ $b == $opt_bootloader ]] || continue
206
207 echo "$testing ... --$b"
208
209 cp test/$n ${b}-test
210 chmod 0614 ${b}-test
211 touch -t 200301010101.00 ${b}-test
212 time=$(ls -l ${b}-test | awk '{ print $6 " " $7 " "$8}')
213 perm=$(ls -l ${b}-test | awk '{print $1}')
214 ./grubby --${b} --add-kernel bar --title title -c ${b}-test
215 if [[ $? != 0 ]]; then
216 echo " FAIL (grubby returned non-zero)"
217 (( fail++ ))
218 elif newtime=$(ls -l ${b}-test | awk '{ print $6 " " $7 " "$8}') && \
219 newperm=$(ls -l ${b}-test | awk '{print $1}') && \
220 [[ $time == "$newtime" || $perm != "$newperm" ]]
221 then
222 echo " FAIL ($perm $newperm)";
223 (( fail++ ))
224 else
225 (( pass++ ))
226 fi
227 rm -f ${b}-test
228 done
229
230 testing="Following symlinks"
231 unset b
232 for n in test/*.[0-9]*; do
233 n=${n#*/} # remove test/
234 [[ ${n%.*} == "$b" ]] && continue
235 b=${n%.*} # remove suffix
236 [[ $b == $opt_bootloader ]] || continue
237
238 echo "$testing ... --$b"
239
240 cp test/${b}.1 ${b}-test
241 ln -s ./${b}-test mytest
242 ./grubby --${b} --add-kernel bar --title title -c mytest
243 if [[ $? != 0 ]]; then
244 echo " failed (grubby returned non-zero)"
245 (( fail++ ))
246 elif [[ ! -L mytest ]]; then
247 echo " failed (not a symlink)"
248 (( fail++ ))
249 elif target=$(readlink mytest) && [[ $target != "./${b}-test" ]]; then
250 echo " failed (wrong target)"
251 (( fail++ ))
252 else
253 (( pass++ ))
254 fi
255 rm -f ${b}-test mytest
256 done
257
258 testing="GRUB default directive"
259 grubTest grub.1 default/g1.1 --boot-filesystem=/boot --add-kernel /boot/new-kernel --title Some_Title
260 grubTest grub.1 default/g1.2 --boot-filesystem=/boot --add-kernel /boot/new-kernel --title Some_Title --make-default
261 grubTest grub.3 default/g3.1 --boot-filesystem=/boot --set-default=/boot/vmlinuz-2.4.7-2
262 grubTest grub.3 default/g3.2 --boot-filesystem=/boot --set-default=/boot/vmlinuz-2.4.7-2smp
263 grubTest grub.4 default/g4.1 --boot-filesystem=/ --set-default=/boot/vmlinuz-2.4.7-ac3 --remove-kernel /boot/vmlinuz-2.4.7-2.5
264 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
265 grubTest grub.6 default/g6.1 --remove-kernel=/boot/vmlinuz-2.4.7-2.9 --boot-filesystem=/
266
267 testing="GRUB default index directive"
268 grubTest grub.13 setdefaultindex/g.13.0 --set-default-index=0
269 grubTest grub.13 setdefaultindex/g.13.1 --set-default-index=1
270 grubTest grub.13 setdefaultindex/g.13.9 --set-default-index=9
271
272 testing="GRUB display default index"
273 grubDisplayTest grub.1 defaultindex/0 --default-index
274 grubDisplayTest grub.2 defaultindex/0 --default-index
275 grubDisplayTest grub.3 defaultindex/0 --default-index
276 grubDisplayTest grub.4 defaultindex/0 --default-index
277 grubDisplayTest grub.5 defaultindex/0 --default-index
278 grubDisplayTest grub.6 defaultindex/2 --default-index
279 grubDisplayTest grub.7 defaultindex/2 --default-index
280 grubDisplayTest grub.8 defaultindex/0 --default-index
281 grubDisplayTest grub.9 defaultindex/0 --default-index
282 grubDisplayTest grub.10 defaultindex/0 --default-index
283 grubDisplayTest grub.10 defaultindex/0 --default-index
284
285 testing="GRUB display default title"
286 grubDisplayTest grub.1 defaulttitle/g.1 --default-title
287 grubDisplayTest grub.2 defaulttitle/g.2 --default-title
288 grubDisplayTest grub.3 defaulttitle/g.3 --default-title
289 grubDisplayTest grub.4 defaulttitle/g.4 --default-title
290 grubDisplayTest grub.5 defaulttitle/g.5 --default-title
291 grubDisplayTest grub.6 defaulttitle/g.6 --default-title
292 grubDisplayTest grub.7 defaulttitle/g.7 --default-title
293 grubDisplayTest grub.8 defaulttitle/g.8 --default-title
294 grubDisplayTest grub.9 defaulttitle/g.9 --default-title
295 grubDisplayTest grub.10 defaulttitle/g.10 --default-title
296 grubDisplayTest grub.11 defaulttitle/g.11 --default-title
297
298 testing="LILO default directive"
299 liloTest lilo.1 default/l1.1 --set-default=/boot/vmlinuz-2.4.18-4
300 liloTest lilo.1 default/l1.2 --remove-kernel=/boot/vmlinuz-2.4.18-4smp
301 liloTest lilo.1 default/l1.3 --add-kernel /boot/kernel --title label \
302 --copy-default
303 liloTest lilo.1 default/l1.4 --add-kernel /boot/kernel --title label \
304 --copy-default --make-default
305
306 testing="Z/IPL default directive"
307 ziplTest zipl.1 default/z1.1 --add-kernel /boot/new-kernel --title test
308 ziplTest zipl.1 default/z1.2 --add-kernel /boot/new-kernel --title test --make-default
309
310 testing="GRUB fallback directive"
311 grubTest grub.5 fallback/g5.1 --remove-kernel=/boot/vmlinuz-2.4.7-ac3 \
312 --boot-filesystem=/
313 grubTest grub.5 fallback/g5.2 --remove-kernel=/boot/vmlinuz-2.4.7-2.5 \
314 --boot-filesystem=/
315 grubTest grub.5 fallback/g5.3 --remove-kernel=/boot/vmlinuz-2.4.7-2.5 \
316 --boot-filesystem=/ --copy-default --add-kernel=/boot/new-kernel \
317 --title="Some_Title"
318
319 testing="GRUB new kernel argument handling"
320 grubTest grub.1 args/g1.1 --boot-filesystem=/boot \
321 --add-kernel=/boot/foo --title=some_title --args="1234" --copy-default
322 grubTest grub.1 args/g1.2 --boot-filesystem=/boot \
323 --add-kernel=/boot/foo --title=some_title --args="1234"
324
325 testing="GRUB remove kernel"
326 grubTest grub.7 remove/g7.1 --boot-filesystem=/ \
327 --remove-kernel=/boot/vmlinuz-2.4.7-2.5
328 grubTest grub.3 remove/g3.1 --boot-filesystem=/ \
329 --remove-kernel=DEFAULT
330 grubTest grub.9 remove/g9.1 --boot-filesystem=/boot \
331 --remove-kernel=/boot/vmlinuz-2.4.7-2
332
333 testing="YABOOT remove kernel"
334 yabootTest yaboot.1 remove/y1.1 --boot-filesystem=/ --remove-kernel=DEFAULT
335 yabootTest yaboot.1 remove/y1.2 --boot-filesystem=/ --remove-kernel=/boot/vmlinuz-2.5.50-eepro
336 yabootTest yaboot.2 remove/y2.1 --boot-filesystem=/ --remove-kernel=/boot/vmlinux-2.5.50
337
338 testing="Z/IPL remove kernel"
339 ziplTest zipl.1 remove/z1.1 --remove-kernel=/boot/vmlinuz-2.4.9-38
340 ziplTest zipl.1 remove/z1.2 --remove-kernel=DEFAULT
341
342 testing="GRUB update kernel argument handling"
343 grubTest grub.1 updargs/g1.1 --update-kernel=DEFAULT --args="root=/dev/hda1"
344 grubTest grub.1 updargs/g1.2 --update-kernel=DEFAULT \
345 --args="root=/dev/hda1 hda=ide-scsi root=/dev/hda2"
346 grubTest grub.3 updargs/g3.1 --update-kernel=DEFAULT --args "hdd=notide-scsi"
347 grubTest grub.3 updargs/g3.2 --update-kernel=DEFAULT \
348 --args "hdd=notide-scsi root=/dev/hdd1"
349 grubTest grub.3 updargs/g3.2 --update-kernel=DEFAULT \
350 --args "root=/dev/hdd1 hdd=notide-scsi"
351 grubTest grub.3 updargs/g3.4 --update-kernel=ALL --remove-args="hdd"
352 grubTest grub.3 updargs/g3.4 --update-kernel=ALL --remove-args="hdd=ide-scsi"
353 grubTest grub.3 updargs/g3.4 --update-kernel=ALL --remove-args="hdd=foobar"
354 grubTest grub.3 updargs/g3.7 --update-kernel=ALL \
355 --remove-args="hdd root ro"
356 grubTest grub.7 updargs/g7.2 --boot-filesystem=/ \
357 --update-kernel=ALL --args "hde=ide-scsi"
358 grubTest grub.7 updargs/g7.2 --boot-filesystem=/ \
359 --update-kernel=ALL --args "hde=ide-scsi"
360 grubTest grub.7 updargs/g7.3 --boot-filesystem=/ \
361 --update-kernel=DEFAULT --args "hde=ide-scsi"
362 grubTest grub.7 updargs/g7.4 --boot-filesystem=/ \
363 --update-kernel=/vmlinuz-2.4.7-2 \
364 --args "ro root=LABEL=/ console=tty0 console=ttyS1,9600n81 single"
365 grubTest grub.7 updargs/g7.5 --boot-filesystem=/ \
366 --update-kernel=ALL --args "root=/dev/hda2"
367 grubTest grub.11 updargs/g11.1 --boot-filesystem=/ \
368 --update-kernel=/vmlinuz-2.4.7-2smp \
369 --args "ro root=LABEL=/ console=tty0 console=ttyS1,9600n81 single"
370 grubTest grub.11 updargs/g11.2 --boot-filesystem=/ \
371 --update-kernel=/vmlinuz-2.4.7-2smp \
372 --args "ro root=LABEL=/ single"
373
374 testing="GRUB lba and root information on SuSE systems"
375 GRUBBY_SUSE_RELEASE=test/grub.12-support_files/etc/SuSE-release \
376 GRUBBY_SUSE_GRUB_CONF=test/grub.12-support_files/etc/grub.conf \
377 GRUBBY_GRUB_DEVICE_MAP=test/grub.12-support_files/boot/grub/device.map \
378 grubTest grub.12 info/g12.1 --info=0
379
380 testing="LILO update kernel argument handling"
381 liloTest lilo.1 updargs/l1.1 --update-kernel=/boot/vmlinuz-2.4.18-4 \
382 --args="root=/dev/md1"
383 liloTest lilo.1 updargs/l1.2 --update-kernel=/boot/vmlinuz-2.4.18-4smp \
384 --args="root=LABEL=foo"
385 liloTest lilo.1 updargs/l1.3 --update-kernel=DEFAULT --args="foo"
386 liloTest lilo.1 updargs/l1.4 --update-kernel=ALL --args="foo bar root=/dev/md1"
387 liloTest lilo.1 updargs/l1.4 --update-kernel=ALL --args="foo root=/dev/md1 bar"
388 liloTest lilo.1 updargs/l1.6 --update-kernel=ALL --args="foo root=LABEL=/ bar"
389 liloTest lilo.3 updargs/l3.1 --update-kernel=/boot/vmlinuz-2.4.18-4 \
390 --remove-args="hda"
391 liloTest lilo.3 updargs/l3.2 --update-kernel=ALL \
392 --remove-args="single" --args "root=/dev/hda2"
393
394 testing="LILO add kernel"
395 liloTest lilo.4 add/l4.1 --add-kernel=/boot/new-kernel.img --title="title" \
396 --copy-default --boot-filesystem=/boot
397 liloTest lilo.4 add/l4.2 --add-kernel=/boot/new-kernel.img --title="linux" \
398 --copy-default --boot-filesystem=/boot --remove-kernel "TITLE=linux"
399 liloTest lilo.5 add/l5.1 --add-kernel=/boot/new-kernel.img --title="title" \
400 --copy-default --boot-filesystem=/boot
401 liloTest lilo.5 add/l5.2 --add-kernel=/boot/new-kernel.img --title="linux" \
402 --copy-default --boot-filesystem=/boot --remove-kernel "TITLE=linux"
403 liloTest lilo.6 add/l6.1 --add-kernel=/boot/new-kernel.img --title="title" \
404 --initrd=/boot/new-initrd --copy-default --boot-filesystem=/boot
405 liloTest lilo.6 add/l6.2 --add-kernel=/boot/new-kernel.img --title="linux" \
406 --initrd=/boot/new-initrd --copy-default --boot-filesystem=/boot --remove-kernel "TITLE=linux"
407
408
409 testing="GRUB add kernel"
410 grubTest grub.1 add/g1.1 --add-kernel=/boot/new-kernel.img --title='title' \
411 --initrd=/boot/new-initrd --boot-filesystem=/
412 grubTest grub.1 add/g1.2 --add-kernel=/boot/new-kernel.img --title='title' \
413 --initrd=/boot/new-initrd --boot-filesystem=/boot
414 grubTest grub.1 add/g1.3 --add-kernel=/boot/new-kernel.img --title='title' \
415 --initrd=/boot/new-initrd --boot-filesystem=/ --copy-default
416 grubTest grub.1 add/g1.4 --add-kernel=/boot/new-kernel.img --title='title' \
417 --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default
418 grubTest grub.1 add/g1.5 --add-kernel=/boot/new-kernel.img --title='title' \
419 --initrd=/boot/new-initrd --extra-initrd=/boot/extra-initrd --boot-filesystem=/
420 grubTest grub.1 add/g1.6 --add-kernel=/boot/new-kernel.img --title='title' \
421 --initrd=/boot/new-initrd --extra-initrd=/boot/extra-initrd --boot-filesystem=/boot
422 grubTest grub.2 add/g2.1 --add-kernel=/boot/vmlinuz-2.4.7-2 \
423 --initrd=/boot/initrd-2.4.7-new.img --boot-filesystem=/boot --copy-default \
424 --title="Red Hat Linux (2.4.7-2)" \
425 --remove-kernel="TITLE=Red Hat Linux (2.4.7-2)"
426 grubTest grub.8 add/g8.1 --add-kernel=/boot/new-kernel.img --title='title' \
427 --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default
428 grubTest grub.8 add/g8.2 --add-kernel=/boot/new-kernel.img --title='title' \
429 --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default \
430 --args='console=tty0 console=ttyS1,9600n81 single'
431 grubTest grub.11 add/g11.1 --add-kernel=/boot/new-kernel.img --title='title' \
432 --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default \
433 --args='console=tty0 console=ttyS1,9600n81 single'
434
435 testgrub2=n
436 ARCH=$(uname -m | sed s,i[3456789]86,ia32,)
437 case $ARCH in
438 aarch64|ppc|ppc64|ia32|x86_64) testgrub2=y ;;
439 esac
440
441 if [ "$testgrub2" == "y" ]; then
442 testing="GRUB2 add kernel"
443 grub2Test grub2.1 add/g2-1.1 --add-kernel=/boot/new-kernel.img \
444 --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
445 --copy-default
446 grub2Test grub2.1 add/g2-1.6 --add-kernel=/boot/new-kernel.img \
447 --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
448 --copy-default --efi
449 grub2Test grub2.6 add/g2-1.7 --add-kernel=/boot/new-kernel.img \
450 --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
451 --copy-default --efi
452 grub2Test grub2.1 add/g2-1.2 --add-kernel=/boot/new-kernel.img \
453 --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
454 --copy-default --make-default
455 grub2Test grub2.1 add/g2-1.3 --add-kernel=/boot/new-kernel.img \
456 --title='title' --boot-filesystem=/boot/ --copy-default --make-default
457 grub2Test grub2.1 remove/g2-1.4 \
458 --remove-kernel=/boot/vmlinuz-2.6.38.2-9.fc15.x86_64 \
459 --boot-filesystem=/boot/
460 grub2Test grub2.5 add/g2-1.5 --add-kernel=/boot/new-kernel.img \
461 --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
462 --copy-default
463 grub2Test grub2.12 add/g2-1.12 \
464 --add-kernel=/boot/vmlinuz-2.6.38.8-32.fc15.x86_64 \
465 --title='Linux, with Fedora 2.6.38.8-32.fc15.x86_64' \
466 --devtree='/boot/dtb-2.6.38.8-32.fc15.x86_64/foobarbaz.dtb' \
467 --initrd=/boot/initramfs-2.6.38.8-32.fc15.x86_64.img \
468 --boot-filesystem=/boot/ --copy-default --efi
469 grub2Test grub2.13 add/g2-1.13 \
470 --add-kernel=/boot/vmlinuz-2.6.38.8-32.fc15.x86_64 \
471 --title='Linux, with Fedora 2.6.38.8-32.fc15.x86_64' \
472 --devtree='/boot/dtb-2.6.38.8-32.fc15.x86_64/foobarbaz.dtb' \
473 --initrd=/boot/initramfs-2.6.38.8-32.fc15.x86_64.img \
474 --boot-filesystem=/boot/ --copy-default --efi
475
476 testing="GRUB2 add initrd"
477 grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \
478 --initrd=/boot/new-initrd --boot-filesystem=/boot/
479
480 testing="GRUB2 display default index"
481 grub2DisplayTest grub2.1 defaultindex/0 --default-index
482 grub2DisplayTest grub2.2 defaultindex/0 --default-index
483
484 testing="GRUB2 display default title"
485 grub2DisplayTest grub2.1 defaulttitle/g2.1 --default-title
486 grub2DisplayTest grub2.2 defaulttitle/g2.2 --default-title
487
488 testing="GRUB2 display debug failure"
489 grub2DisplayTest grub2.1 debug/g2.1 --bad-image-bad \
490 --boot-filesystem=/boot --default-kernel --debug
491 testing="GRUB2 display debug success"
492 grub2DisplayTest grub2.1 debug/g2.1.2 --boot-filesystem=/boot \
493 --default-kernel --debug
494
495 testing="GRUB2 remove kernel via index"
496 grub2Test grub2.3 remove/g2-1.1 --remove-kernel=1
497
498 testing="GRUB2 remove kernel via title"
499 grub2Test grub2.3 remove/g2-1.1 --remove-kernel="TITLE=title2"
500
501 testing="GRUB2 (submenu) remove kernel via index"
502 grub2Test grub2.4 remove/g2-1.2 --remove-kernel=2
503
504 testing="GRUB2 (submenu) remove kernel via title"
505 grub2Test grub2.4 remove/g2-1.2 --remove-kernel="TITLE=title2"
506
507 testing="GRUB2 default index directive"
508 grub2Test grub2.1 setdefaultindex/g2.1.0 --set-default-index=0
509 grub2Test grub2.1 setdefaultindex/g2.1.1 --set-default-index=1
510 grub2Test grub2.1 setdefaultindex/g2.1.9 --set-default-index=9
511
512 testing="GRUB2 add kernel with default=saved_entry"
513 grub2Test grub2.7 add/g2-1.8 --env grubenv.1 \
514 --add-kernel=/boot/new-kernel.img \
515 --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
516 --copy-default
517 commandTest "saved_default output" \
518 "grub2-editenv test/grub2-support_files/env_temp list" \
519 "saved_entry=Linux, with Fedora 2.6.38.8-32.fc15.x86_64"
520
521 testing="GRUB2 add kernel with default=saved_entry and a terrible title"
522 grub2Test grub2.7 add/g2-1.9 --env grubenv.1 \
523 --add-kernel=/boot/new-kernel.img \
524 --title='Fedora (3.10.3-300.fc19.x86_64) 19 (Schrödinger’s Cat)' \
525 --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
526 --copy-default
527
528 testing="GRUB2 set default with default=saved_entry and a terrible name"
529 grub2Test grub2.9 add/g2-1.9 --env grubenv.1 --set-default-index=0
530 commandTest "saved_default output" \
531 "grub2-editenv test/grub2-support_files/env_temp list" \
532 'saved_entry=Fedora (3.10.3-300.fc19.x86_64) 19 (Schrödinger’s Cat)'
533
534 testing="GRUB2 set default with default=saved_entry"
535 grub2Test grub2.8 add/g2-1.8 --env grubenv.1 --set-default-index=0
536 commandTest "saved_default output" \
537 "grub2-editenv test/grub2-support_files/env_temp list" \
538 "saved_entry=title"
539
540 testing="GRUB2 --default-index with default=saved_entry"
541 grub2DisplayTest grub2.8 defaultindex/1 --env grubenv.1 --default-index
542
543 testing="GRUB2 --default-index with default=saved_entry"
544 grub2DisplayTest grub2.8 defaultindex/0 --env grubenv.2 --default-index
545
546 testing="GRUB2 --default-title with default=saved_entry"
547 grub2DisplayTest grub2.8 defaulttitle/g2.1 --env grubenv.1 --default-title
548
549 testing="GRUB2 --default-index with default=saved_entry and empty grubenv"
550 grub2DisplayTest grub2.8 defaultindex/0 --env grubenv.0 --default-index
551
552 testlinux16=n
553 case $ARCH in
554 ia32|x86_64) testlinux16=y ;;
555 esac
556
557 if [ "$testlinux16" == "y" ]; then
558 testing="GRUB2 add kernel with linux16"
559 grub2Test grub2.10 add/g2-1.10 --add-kernel=/boot/new-kernel.img \
560 --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
561 --copy-default
562
563 testing="GRUB2 add initrd with linux16"
564 grub2Test grub2.11 add/g2-1.11 --update-kernel=/boot/new-kernel.img \
565 --initrd=/boot/new-initrd --boot-filesystem=/boot/
566 fi
567 fi
568
569 testing="YABOOT add kernel"
570 yabootTest yaboot.1 add/y1.1 --copy-default --boot-filesystem=/ --add-kernel=/boot/new-kernel \
571 --title=newtitle
572 yabootTest yaboot.1 add/y1.2 --add-kernel=/boot/new-kernel --boot-filesystem=/ --title=newtitle
573
574 testing="YABOOT empty label"
575 yabootTest yaboot.3 add/y3.1 --add-kernel=/boot/new-kernel --boot-filesystem=/ --title=newtitle
576
577 testing="Z/IPL add kernel"
578 ziplTest zipl.1 add/z1.1 --add-kernel=/boot/new-kernel.img --title test
579 ziplTest zipl.1 add/z1.2 --add-kernel=/boot/new-kernel.img --title test --copy-default
580
581 testing="LILO long titles"
582 liloTest lilo.1 longtitle/l1.1 --add-kernel=/boot/new-kernel.img \
583 --title="linux-longtitle" --copy-default --boot-filesystem=/boot
584 liloTest lilo.1 longtitle/l1.2 --add-kernel=/boot/new-kernel.img \
585 --title="linux-toolongtitle" --copy-default --boot-filesystem=/boot
586 liloTest lilo.7 longtitle/l7.1 --add-kernel=/boot/new-kernel.img \
587 --title="linux-longtitle-fix" --copy-default --boot-filesystem=/boot
588
589 testing="ELILO long titles"
590 eliloTest lilo.7 longtitle/e7.1 --add-kernel=/boot/new-kernel.img \
591 --title="linux-longtitle-fix" --copy-default --boot-filesystem=/boot
592
593 testing="GRUB add multiboot"
594 grubTest grub.1 multiboot/g1.1 --add-multiboot=/boot/xen.gz \
595 --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \
596 --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
597 --mbargs="dom0_mem=130000"
598 grubTest grub.1 multiboot/g1.2 --add-multiboot=/boot/xen.gz \
599 --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \
600 --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
601 --mbargs="dom0_mem=130000" --copy-default
602 grubTest grub.10 multiboot/g10.1 --add-multiboot=/boot/xen.gz \
603 --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \
604 --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
605 --mbargs="dom0_mem=130000"
606 grubTest grub.10 multiboot/g10.2 --add-multiboot=/boot/xen.gz \
607 --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \
608 --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
609 --mbargs="dom0_mem=130000" --copy-default
610 grubTest grub.10 multiboot/g10.3 --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 \
611 --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
612 --copy-default --boot-filesystem=/boot
613 grubTest grub.10 multiboot/g10.4 --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 \
614 --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
615 --boot-filesystem=/boot
616
617 testing="GRUB remove multiboot"
618 grubTest grub.10 multiboot/g10.5 --boot-filesystem=/boot \
619 --remove-kernel=/boot/vmlinuz-2.6.10-1.1076_FC4
620 grubTest grub.10 multiboot/g10.6 --boot-filesystem=/boot \
621 --remove-kernel=/boot/vmlinuz-2.6.10-1.1082_FC4
622 grubTest grub.10 multiboot/g10.7 --boot-filesystem=/boot \
623 --remove-multiboot=/boot/xen.gz
624
625 testing="ELILO add multiboot"
626 eliloTest elilo.1 multiboot/e1.1 --add-multiboot=/boot/xen.gz \
627 --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \
628 --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
629 --mbargs="dom0_mem=130000"
630 eliloTest elilo.1 multiboot/e1.2 --add-multiboot=/boot/xen.gz \
631 --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \
632 --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
633 --mbargs="dom0_mem=130000" --copy-default
634
635 testing="ELILO remove multiboot"
636 eliloTest elilo.2 multiboot/e2.1 --boot-filesystem=/boot \
637 --remove-kernel=/boot/vmlinuz-2.6.10-1.1076_FC4
638 eliloTest elilo.2 multiboot/e2.2 --boot-filesystem=/boot \
639 --remove-kernel=/boot/vmlinuz-2.6.10-1.1082_FC4
640 eliloTest elilo.2 multiboot/e2.3 --boot-filesystem=/boot \
641 --remove-multiboot=/boot/xen.gz
642
643 printf "\n%d (%d%%) tests passed, %d (%d%%) tests failed\n" \
644 $pass $(((100*pass)/(pass+fail))) \
645 $fail $(((100*fail)/(pass+fail)))
646
647 exit $(( !!fail ))

Properties

Name Value
svn:executable *