Contents of /trunk/grubby/test.sh
Parent Directory | Revision Log
Revision 532 -
(show annotations)
(download)
(as text)
Sat Sep 1 22:45:15 2007 UTC (17 years, 1 month ago) by niro
Original Path: trunk/mkinitrd-magellan/grubby/test.sh
File MIME type: application/x-sh
File size: 13264 byte(s)
Sat Sep 1 22:45:15 2007 UTC (17 years, 1 month ago) by niro
Original Path: trunk/mkinitrd-magellan/grubby/test.sh
File MIME type: application/x-sh
File size: 13264 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | #!/bin/bash |
2 | |
3 | ARCH=$(uname -m) |
4 | |
5 | elilotest="" |
6 | lilotest="" |
7 | grubtest="" |
8 | zipltest="" |
9 | yaboottest="" |
10 | |
11 | case "$ARCH" in |
12 | i?86) |
13 | lilotest="yes" |
14 | grubtest="yes" |
15 | ;; |
16 | x86_64) |
17 | lilotest="yes" |
18 | grubtest="yes" |
19 | ;; |
20 | ppc*) |
21 | yaboottest="yes" |
22 | ;; |
23 | s390*) |
24 | zipltest="yes" |
25 | ;; |
26 | *) |
27 | echo "Not running any tests for $ARCH" |
28 | exit 0 |
29 | esac |
30 | |
31 | export MALLOC_CHECK_=2 |
32 | |
33 | RESULT=0 |
34 | |
35 | oneTest () { |
36 | mode=$1 |
37 | cfg=test/$2 |
38 | correct=test/results/$3 |
39 | shift; shift; shift |
40 | ./grubby $mode --bad-image-okay -c $cfg -o - "$@" | cmp $correct > /dev/null |
41 | |
42 | if [ $? != 0 ]; then |
43 | echo ------------------------------------------------------------- |
44 | echo FAILURE: $cfg $correct "$@" |
45 | echo -n ./grubby $mode --bad-image-okay -c $cfg -o - |
46 | for arg in "$@"; do |
47 | echo -n " \"$arg\"" |
48 | done |
49 | echo "" |
50 | ./grubby $mode --bad-image-okay -c $cfg -o - "$@" | diff -u $correct -; |
51 | RESULT=1 |
52 | fi |
53 | } |
54 | |
55 | liloTest() { |
56 | if [ -z "$lilotest" ]; then echo "skipping LILO test" ; return; fi |
57 | oneTest --lilo "$@" |
58 | } |
59 | |
60 | eliloTest() { |
61 | if [ -z "$elilotest" ]; then echo "skipping ELILO test" ; return; fi |
62 | oneTest --elilo "$@" |
63 | } |
64 | |
65 | grubTest() { |
66 | if [ -z "$grubtest" ]; then echo "skipping GRUB test" ; return; fi |
67 | oneTest --grub "$@" |
68 | } |
69 | |
70 | yabootTest() { |
71 | if [ -z "$yaboottest" ]; then echo "skipping YABOOT test" ; return; fi |
72 | oneTest --yaboot "$@" |
73 | } |
74 | |
75 | ziplTest() { |
76 | if [ -z "$zipltest" ]; then echo "skipping Z/IPL test" ; return; fi |
77 | oneTest --zipl "$@" |
78 | } |
79 | |
80 | echo "Parse/write comparison..." |
81 | for n in $(cd test; echo grub.[0-9]*); do |
82 | grubTest $n ../$n --remove-kernel 1234 |
83 | done |
84 | |
85 | for n in $(cd test; echo lilo.[0-9]*); do |
86 | liloTest $n ../$n --remove-kernel 1234 |
87 | done |
88 | |
89 | echo "Permission preservation..." |
90 | cp test/grub.1 grub-test |
91 | chmod 0614 grub-test |
92 | touch -t 200301010101.00 grub-test |
93 | time=$(ls -l grub-test | awk '{ print $6 " " $7 " "$8}') |
94 | perm=$(ls -l grub-test | awk '{print $1}') |
95 | ./grubby --grub --add-kernel bar --title title -c grub-test |
96 | newtime=$(ls -l grub-test | awk '{ print $6 " " $7 " "$8}') |
97 | newperm=$(ls -l grub-test | awk '{print $1}') |
98 | if [ "$time" == "$newtime" -o "$perm" != "$newperm" ]; then |
99 | echo " failed ($perm $newperm)"; |
100 | fi |
101 | rm -f grub-test |
102 | |
103 | cp test/lilo.1 lilo-test |
104 | chmod 0614 lilo-test |
105 | touch -t 200301010101.00 lilo-test |
106 | time=$(ls -l lilo-test | awk '{ print $6 " " $7 " "$8}') |
107 | perm=$(ls -l lilo-test | awk '{print $1}') |
108 | ./grubby --lilo --add-kernel bar --title title -c lilo-test |
109 | newtime=$(ls -l lilo-test | awk '{ print $6 " " $7 " "$8}') |
110 | newperm=$(ls -l lilo-test | awk '{print $1}') |
111 | if [ "$time" == "$newtime" -o "$perm" != "$newperm" ]; then |
112 | echo " failed ($perm $newperm)"; |
113 | fi |
114 | rm -f lilo-test |
115 | |
116 | echo "Following symlinks..." |
117 | cp test/grub.1 grub-test |
118 | ln -s grub-test mytest |
119 | ./grubby --grub --add-kernel bar --title title -c mytest |
120 | if [ ! -L mytest ]; then |
121 | echo " failed (not a symlink)" |
122 | fi |
123 | target=$(ls -l mytest | awk '{ print $11 }') |
124 | if [ "$target" != grub-test ]; then |
125 | echo " failed (wrong target)" |
126 | fi |
127 | rm -f grub-test mytest |
128 | |
129 | echo "GRUB default directive..." |
130 | grubTest grub.1 default/g1.1 --boot-filesystem=/boot --add-kernel /boot/new-kernel --title Some_Title |
131 | grubTest grub.1 default/g1.2 --boot-filesystem=/boot --add-kernel /boot/new-kernel --title Some_Title --make-default |
132 | grubTest grub.3 default/g3.1 --boot-filesystem=/boot --set-default=/boot/vmlinuz-2.4.7-2 |
133 | grubTest grub.3 default/g3.2 --boot-filesystem=/boot --set-default=/boot/vmlinuz-2.4.7-2smp |
134 | 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 |
135 | 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 |
136 | grubTest grub.6 default/g6.1 --remove-kernel=/boot/vmlinuz-2.4.7-2.9 --boot-filesystem=/ |
137 | |
138 | echo "LILO default directive..." |
139 | liloTest lilo.1 default/l1.1 --set-default=/boot/vmlinuz-2.4.18-4 |
140 | liloTest lilo.1 default/l1.2 --remove-kernel=/boot/vmlinuz-2.4.18-4smp |
141 | liloTest lilo.1 default/l1.3 --add-kernel /boot/kernel --title label \ |
142 | --copy-default |
143 | liloTest lilo.1 default/l1.4 --add-kernel /boot/kernel --title label \ |
144 | --copy-default --make-default |
145 | |
146 | echo "Z/IPL default directive..." |
147 | ziplTest zipl.1 default/z1.1 --add-kernel /boot/new-kernel --title test |
148 | ziplTest zipl.1 default/z1.2 --add-kernel /boot/new-kernel --title test --make-default |
149 | |
150 | echo "GRUB fallback directive..." |
151 | grubTest grub.5 fallback/g5.1 --remove-kernel=/boot/vmlinuz-2.4.7-ac3 \ |
152 | --boot-filesystem=/ |
153 | grubTest grub.5 fallback/g5.2 --remove-kernel=/boot/vmlinuz-2.4.7-2.5 \ |
154 | --boot-filesystem=/ |
155 | grubTest grub.5 fallback/g5.3 --remove-kernel=/boot/vmlinuz-2.4.7-2.5 \ |
156 | --boot-filesystem=/ --copy-default --add-kernel=/boot/new-kernel \ |
157 | --title="Some_Title" |
158 | |
159 | echo "GRUB new kernel argument handling..." |
160 | grubTest grub.1 args/g1.1 --boot-filesystem=/boot \ |
161 | --add-kernel=/boot/foo --title=some_title --args="1234" --copy-default |
162 | grubTest grub.1 args/g1.2 --boot-filesystem=/boot \ |
163 | --add-kernel=/boot/foo --title=some_title --args="1234" |
164 | |
165 | echo "GRUB remove kernel..." |
166 | grubTest grub.7 remove/g7.1 --boot-filesystem=/ \ |
167 | --remove-kernel=/boot/vmlinuz-2.4.7-2.5 |
168 | grubTest grub.3 remove/g3.1 --boot-filesystem=/ \ |
169 | --remove-kernel=DEFAULT |
170 | grubTest grub.9 remove/g9.1 --boot-filesystem=/boot \ |
171 | --remove-kernel=/boot/vmlinuz-2.4.7-2 |
172 | |
173 | echo "YABOOT remove kernel..." |
174 | yabootTest yaboot.1 remove/y1.1 --boot-filesystem=/ --remove-kernel=DEFAULT |
175 | yabootTest yaboot.1 remove/y1.2 --boot-filesystem=/ --remove-kernel=/boot/vmlinuz-2.5.50-eepro |
176 | yabootTest yaboot.2 remove/y2.1 --boot-filesystem=/ --remove-kernel=/boot/vmlinux-2.5.50 |
177 | |
178 | echo "Z/IPL remove kernel..." |
179 | ziplTest zipl.1 remove/z1.1 --remove-kernel=/boot/vmlinuz-2.4.9-38 |
180 | ziplTest zipl.1 remove/z1.2 --remove-kernel=DEFAULT |
181 | |
182 | echo "GRUB update kernel argument handling..." |
183 | grubTest grub.1 updargs/g1.1 --update-kernel=DEFAULT --args="root=/dev/hda1" |
184 | grubTest grub.1 updargs/g1.2 --update-kernel=DEFAULT \ |
185 | --args="root=/dev/hda1 hda=ide-scsi root=/dev/hda2" |
186 | grubTest grub.3 updargs/g3.1 --update-kernel=DEFAULT --args "hdd=notide-scsi" |
187 | grubTest grub.3 updargs/g3.2 --update-kernel=DEFAULT \ |
188 | --args "hdd=notide-scsi root=/dev/hdd1" |
189 | grubTest grub.3 updargs/g3.2 --update-kernel=DEFAULT \ |
190 | --args "root=/dev/hdd1 hdd=notide-scsi" |
191 | grubTest grub.3 updargs/g3.4 --update-kernel=ALL --remove-args="hdd" |
192 | grubTest grub.3 updargs/g3.4 --update-kernel=ALL --remove-args="hdd=ide-scsi" |
193 | grubTest grub.3 updargs/g3.4 --update-kernel=ALL --remove-args="hdd=foobar" |
194 | grubTest grub.3 updargs/g3.7 --update-kernel=ALL \ |
195 | --remove-args="hdd root ro" |
196 | grubTest grub.7 updargs/g7.2 --boot-filesystem=/ \ |
197 | --update-kernel=ALL --args "hde=ide-scsi" |
198 | grubTest grub.7 updargs/g7.2 --boot-filesystem=/ \ |
199 | --update-kernel=ALL --args "hde=ide-scsi" |
200 | grubTest grub.7 updargs/g7.3 --boot-filesystem=/ \ |
201 | --update-kernel=DEFAULT --args "hde=ide-scsi" |
202 | grubTest grub.7 updargs/g7.4 --boot-filesystem=/ \ |
203 | --update-kernel=/vmlinuz-2.4.7-2 \ |
204 | --args "ro root=LABEL=/ console=tty0 console=ttyS1,9600n81 single" |
205 | grubTest grub.11 updargs/g11.1 --boot-filesystem=/ \ |
206 | --update-kernel=/vmlinuz-2.4.7-2smp \ |
207 | --args "ro root=LABEL=/ console=tty0 console=ttyS1,9600n81 single" |
208 | grubTest grub.11 updargs/g11.2 --boot-filesystem=/ \ |
209 | --update-kernel=/vmlinuz-2.4.7-2smp \ |
210 | --args "ro root=LABEL=/ single" |
211 | |
212 | echo "LILO update kernel argument handling..." |
213 | liloTest lilo.1 updargs/l1.1 --update-kernel=/boot/vmlinuz-2.4.18-4 \ |
214 | --args="root=/dev/md1" |
215 | liloTest lilo.1 updargs/l1.2 --update-kernel=/boot/vmlinuz-2.4.18-4smp \ |
216 | --args="root=LABEL=foo" |
217 | liloTest lilo.1 updargs/l1.3 --update-kernel=DEFAULT --args="foo" |
218 | liloTest lilo.1 updargs/l1.4 --update-kernel=ALL --args="foo bar root=/dev/md1" |
219 | liloTest lilo.1 updargs/l1.4 --update-kernel=ALL --args="foo root=/dev/md1 bar" |
220 | liloTest lilo.1 updargs/l1.6 --update-kernel=ALL --args="foo root=LABEL=/ bar" |
221 | liloTest lilo.3 updargs/l3.1 --update-kernel=/boot/vmlinuz-2.4.18-4 \ |
222 | --remove-args="hda" |
223 | liloTest lilo.3 updargs/l3.2 --update-kernel=ALL \ |
224 | --remove-args="single" --args "root=/dev/hda2" |
225 | |
226 | echo "LILO add kernel..." |
227 | liloTest lilo.4 add/l4.1 --add-kernel=/boot/new-kernel.img --title="title" \ |
228 | --copy-default --boot-filesystem=/boot |
229 | liloTest lilo.4 add/l4.2 --add-kernel=/boot/new-kernel.img --title="linux" \ |
230 | --copy-default --boot-filesystem=/boot --remove-kernel "TITLE=linux" |
231 | liloTest lilo.5 add/l5.1 --add-kernel=/boot/new-kernel.img --title="title" \ |
232 | --copy-default --boot-filesystem=/boot |
233 | liloTest lilo.5 add/l5.2 --add-kernel=/boot/new-kernel.img --title="linux" \ |
234 | --copy-default --boot-filesystem=/boot --remove-kernel "TITLE=linux" |
235 | liloTest lilo.6 add/l6.1 --add-kernel=/boot/new-kernel.img --title="title" \ |
236 | --initrd=/boot/new-initrd --copy-default --boot-filesystem=/boot |
237 | liloTest lilo.6 add/l6.2 --add-kernel=/boot/new-kernel.img --title="linux" \ |
238 | --initrd=/boot/new-initrd --copy-default --boot-filesystem=/boot --remove-kernel "TITLE=linux" |
239 | |
240 | |
241 | echo "GRUB add kernel..." |
242 | grubTest grub.1 add/g1.1 --add-kernel=/boot/new-kernel.img --title='title' \ |
243 | --initrd=/boot/new-initrd --boot-filesystem=/ |
244 | grubTest grub.1 add/g1.2 --add-kernel=/boot/new-kernel.img --title='title' \ |
245 | --initrd=/boot/new-initrd --boot-filesystem=/boot |
246 | grubTest grub.1 add/g1.3 --add-kernel=/boot/new-kernel.img --title='title' \ |
247 | --initrd=/boot/new-initrd --boot-filesystem=/ --copy-default |
248 | grubTest grub.1 add/g1.4 --add-kernel=/boot/new-kernel.img --title='title' \ |
249 | --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default |
250 | grubTest grub.2 add/g2.1 --add-kernel=/boot/vmlinuz-2.4.7-2 \ |
251 | --initrd=/boot/initrd-2.4.7-new.img --boot-filesystem=/boot --copy-default \ |
252 | --title="Red Hat Linux (2.4.7-2)" \ |
253 | --remove-kernel="TITLE=Red Hat Linux (2.4.7-2)" |
254 | grubTest grub.8 add/g8.1 --add-kernel=/boot/new-kernel.img --title='title' \ |
255 | --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default |
256 | grubTest grub.8 add/g8.2 --add-kernel=/boot/new-kernel.img --title='title' \ |
257 | --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default \ |
258 | --args='console=tty0 console=ttyS1,9600n81 single' |
259 | grubTest grub.11 add/g11.1 --add-kernel=/boot/new-kernel.img --title='title' \ |
260 | --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default \ |
261 | --args='console=tty0 console=ttyS1,9600n81 single' |
262 | |
263 | echo "YABOOT add kernel..." |
264 | yabootTest yaboot.1 add/y1.1 --copy-default --boot-filesystem=/ --add-kernel=/boot/new-kernel \ |
265 | --title=newtitle |
266 | yabootTest yaboot.1 add/y1.2 --add-kernel=/boot/new-kernel --boot-filesystem=/ --title=newtitle |
267 | |
268 | echo "YABOOT empty label..." |
269 | yabootTest yaboot.3 add/y3.1 --add-kernel=/boot/new-kernel --boot-filesystem=/ --title=newtitle |
270 | |
271 | echo "Z/IPL add kernel..." |
272 | ziplTest zipl.1 add/z1.1 --add-kernel=/boot/new-kernel.img --title test |
273 | ziplTest zipl.1 add/z1.2 --add-kernel=/boot/new-kernel.img --title test --copy-default |
274 | |
275 | echo "LILO long titles..." |
276 | liloTest lilo.1 longtitle/l1.1 --add-kernel=/boot/new-kernel.img \ |
277 | --title="linux-longtitle" --copy-default --boot-filesystem=/boot |
278 | liloTest lilo.1 longtitle/l1.2 --add-kernel=/boot/new-kernel.img \ |
279 | --title="linux-toolongtitle" --copy-default --boot-filesystem=/boot |
280 | liloTest lilo.7 longtitle/l7.1 --add-kernel=/boot/new-kernel.img \ |
281 | --title="linux-longtitle-fix" --copy-default --boot-filesystem=/boot |
282 | |
283 | echo "ELILO long titles..." |
284 | eliloTest lilo.7 longtitle/e7.1 --add-kernel=/boot/new-kernel.img \ |
285 | --title="linux-longtitle-fix" --copy-default --boot-filesystem=/boot |
286 | |
287 | echo "GRUB add multiboot..." |
288 | grubTest grub.1 multiboot/g1.1 --add-multiboot=/boot/xen.gz \ |
289 | --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \ |
290 | --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \ |
291 | --mbargs="dom0_mem=130000" |
292 | grubTest grub.1 multiboot/g1.2 --add-multiboot=/boot/xen.gz \ |
293 | --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \ |
294 | --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \ |
295 | --mbargs="dom0_mem=130000" --copy-default |
296 | grubTest grub.10 multiboot/g10.1 --add-multiboot=/boot/xen.gz \ |
297 | --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \ |
298 | --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \ |
299 | --mbargs="dom0_mem=130000" |
300 | grubTest grub.10 multiboot/g10.2 --add-multiboot=/boot/xen.gz \ |
301 | --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \ |
302 | --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \ |
303 | --mbargs="dom0_mem=130000" --copy-default |
304 | grubTest grub.10 multiboot/g10.3 --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 \ |
305 | --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \ |
306 | --copy-default --boot-filesystem=/boot |
307 | grubTest grub.10 multiboot/g10.4 --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 \ |
308 | --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \ |
309 | --boot-filesystem=/boot |
310 | |
311 | echo "GRUB remove multiboot..." |
312 | grubTest grub.10 multiboot/g10.5 --boot-filesystem=/boot \ |
313 | --remove-kernel=/boot/vmlinuz-2.6.10-1.1076_FC4 |
314 | grubTest grub.10 multiboot/g10.6 --boot-filesystem=/boot \ |
315 | --remove-kernel=/boot/vmlinuz-2.6.10-1.1082_FC4 |
316 | grubTest grub.10 multiboot/g10.7 --boot-filesystem=/boot \ |
317 | --remove-multiboot=/boot/xen.gz |
318 | |
319 | exit $RESULT |
Properties
Name | Value |
---|---|
svn:executable | * |