Magellan Linux

Diff of /tags/grubby-8_32/test.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/mkinitrd-magellan/grubby/test.sh revision 532 by niro, Sat Sep 1 22:45:15 2007 UTC trunk/grubby/test.sh revision 1858 by niro, Mon Jul 2 13:14:43 2012 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/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  ARCH=$(uname -m)  #----------------------------------------------------------------------
27    # Global vars
28  elilotest=""  #----------------------------------------------------------------------
29  lilotest=""  
30  grubtest=""  cmd=${0##*/}
31  zipltest=""  opt_bootloader=*
32  yaboottest=""  opt_verbose=false
33    read -d '' usage <<EOT
34  case "$ARCH" in  usage: test.sh [ -hv ]
35      i?86)  
36   lilotest="yes"      -b B   --bootloader=B  Test bootloader B instead of all
37   grubtest="yes"      -h     --help          Show this help message
38   ;;      -v     --verbose       Verbose output
39      x86_64)  EOT
40   lilotest="yes"  declare -i pass=0 fail=0
41   grubtest="yes"  testing=
42   ;;  
43      ppc*)  #----------------------------------------------------------------------
44   yaboottest="yes"  # Functions
45   ;;  #----------------------------------------------------------------------
46      s390*)  
47   zipltest="yes"  oneTest() {
48   ;;      typeset mode=$1 cfg=test/$2 correct=test/results/$3
49      *)      shift 3
50   echo "Not running any tests for $ARCH"  
51   exit 0      echo "$testing ... $mode $cfg $correct"
52  esac      runme=( ./grubby "$mode" --bad-image-okay -c "$cfg" -o - "$@" )
53        if "${runme[@]}" | cmp "$correct" > /dev/null; then
54  export MALLOC_CHECK_=2   (( pass++ ))
55     if $opt_verbose; then
56  RESULT=0      echo -------------------------------------------------------------
57        echo -n "PASS: "
58  oneTest () {      printf "%q " "${runme[@]}"; echo
59      mode=$1      "${runme[@]}" | diff -U30 "$cfg" -
60      cfg=test/$2      echo
61      correct=test/results/$3   fi
62      shift; shift; shift      else
63      ./grubby $mode --bad-image-okay -c $cfg -o - "$@" | cmp $correct > /dev/null   (( fail++ ))
   
     if [ $? != 0 ]; then  
64   echo -------------------------------------------------------------   echo -------------------------------------------------------------
65   echo FAILURE: $cfg $correct "$@"   echo -n "FAIL: "
66   echo -n ./grubby $mode --bad-image-okay -c $cfg -o -   printf "%q " "${runme[@]}"; echo
67   for arg in "$@"; do   "${runme[@]}" | diff -U30 "$correct" -
68      echo -n " \"$arg\""   echo
  done  
  echo ""  
  ./grubby $mode --bad-image-okay -c $cfg -o - "$@" | diff -u $correct -;  
  RESULT=1  
69      fi      fi
70  }  }
71    
72  liloTest() {  # Test feature that display some information, checking that output instead of
73      if [ -z "$lilotest" ]; then echo "skipping LILO test" ; return; fi  # the generated configuration file
74      oneTest --lilo "$@"  oneDisplayTest() {
75  }      typeset mode=$1 cfg=test/$2 correct=test/results/$3
76        shift 3
77  eliloTest() {      local BIO="--bad-image-okay"
78      if [ -z "$elilotest" ]; then echo "skipping ELILO test" ; return; fi      if [ "$1" == "--bad-image-bad" ]; then
79      oneTest --elilo "$@"          BIO=""
80  }          shift
81        fi
82  grubTest() {  
83      if [ -z "$grubtest" ]; then echo "skipping GRUB test" ; return; fi      echo "$testing ... $mode $cfg $correct"
84      oneTest --grub "$@"      runme=( ./grubby "$mode" $BIO -c "$cfg" "$@" )
85  }      if "${runme[@]}" 2>&1 | cmp "$correct" > /dev/null; then
86     (( pass++ ))
87  yabootTest() {   if $opt_verbose; then
88      if [ -z "$yaboottest" ]; then echo "skipping YABOOT test" ; return; fi      echo -------------------------------------------------------------
89      oneTest --yaboot "$@"      echo -n "PASS: "
90  }      printf "%q " "${runme[@]}"; echo
91        "${runme[@]}" 2>&1 | diff -U30 "$cfg" -
92  ziplTest() {      echo
93      if [ -z "$zipltest" ]; then echo "skipping Z/IPL test" ; return; fi   fi
94      oneTest --zipl "$@"      else
95     (( fail++ ))
96     echo -------------------------------------------------------------
97     echo -n "FAIL: "
98     printf "%q " "${runme[@]}"; echo
99     "${runme[@]}" 2>&1 | diff -U30 "$correct" -
100     echo
101        fi
102  }  }
103    
104  echo "Parse/write comparison..."  # generate convenience functions
105  for n in $(cd test; echo grub.[0-9]*); do  for b in $(./grubby --help | \
106      grubTest $n ../$n --remove-kernel 1234   sed -n 's/^.*--\([^ ]*\) *configure \1 bootloader$/\1/p'); do
107        eval "${b}Test() { [[ \"$b\" == \$opt_bootloader ]] && oneTest --$b \"\$@\"; }"
108        eval "${b}DisplayTest() { [[ \"$b\" == \$opt_bootloader ]] && oneDisplayTest --$b \"\$@\"; }"
109  done  done
110    
111  for n in $(cd test; echo lilo.[0-9]*); do  #----------------------------------------------------------------------
112      liloTest $n ../$n --remove-kernel 1234  # Main
113    #----------------------------------------------------------------------
114    
115    # Use /usr/bin/getopt which supports GNU-style long options
116    args=$(getopt -o b:hv --long bootloader,help,verbose -n "$cmd" -- "$@") || exit
117    eval set -- "$args"
118    while true; do
119        case $1 in
120     -b|--bootloader) opt_bootloader=$2; shift 2 ;;
121     -h|--help) echo "$usage"; exit 0 ;;
122     -v|--verbose) opt_verbose=true; shift ;;
123            --) shift; break ;;
124            *) echo "failed to process cmdline args" >&2; exit 1 ;;
125        esac
126  done  done
127    
128  echo "Permission preservation..."  export MALLOC_CHECK_=2
129  cp test/grub.1 grub-test  if [ -n "${RANDOM}" ]; then
130  chmod 0614 grub-test      export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
131  touch -t 200301010101.00 grub-test  else
132  time=$(ls -l grub-test | awk '{ print $6 " " $7 " "$8}')      export MALLOC_PERTURB_=1
 perm=$(ls -l grub-test | awk '{print $1}')  
 ./grubby --grub --add-kernel bar --title title -c grub-test  
 newtime=$(ls -l grub-test | awk '{ print $6 " " $7 " "$8}')  
 newperm=$(ls -l grub-test | awk '{print $1}')  
 if [ "$time" == "$newtime" -o "$perm" != "$newperm" ]; then  
     echo "  failed ($perm $newperm)";  
133  fi  fi
 rm -f grub-test  
134    
135  cp test/lilo.1 lilo-test  testing="Parse/write comparison"
136  chmod 0614 lilo-test  for n in test/*.[0-9]*; do
137  touch -t 200301010101.00 lilo-test      n=${n#*/} # remove test/
138  time=$(ls -l lilo-test | awk '{ print $6 " " $7 " "$8}')      b=${n%.*} # remove suffix
139  perm=$(ls -l lilo-test | awk '{print $1}')      [[ $b == $opt_bootloader ]] || continue
140  ./grubby --lilo --add-kernel bar --title title -c lilo-test      ${b}Test $n ../$n --remove-kernel 1234
141  newtime=$(ls -l lilo-test | awk '{ print $6 " " $7 " "$8}')  done
 newperm=$(ls -l lilo-test | awk '{print $1}')  
 if [ "$time" == "$newtime" -o "$perm" != "$newperm" ]; then  
     echo "  failed ($perm $newperm)";  
 fi  
 rm -f lilo-test  
142    
143  echo "Following symlinks..."  testing="Permission preservation"
144  cp test/grub.1 grub-test  unset b
145  ln -s grub-test mytest  for n in test/*.[0-9]*; do
146  ./grubby --grub --add-kernel bar --title title -c mytest      n=${n#*/} # remove test/
147  if [ ! -L mytest ]; then      [[ ${n%.*} == "$b" ]] && continue
148      echo " failed (not a symlink)"      b=${n%.*} # remove suffix
149  fi      [[ $b == $opt_bootloader ]] || continue
150  target=$(ls -l mytest | awk '{ print $11 }')  
151  if [ "$target" != grub-test ]; then      echo "$testing ... --$b"
152      echo "  failed (wrong target)"  
153  fi      cp test/$n ${b}-test
154  rm -f grub-test mytest      chmod 0614 ${b}-test
155        touch -t 200301010101.00 ${b}-test
156        time=$(ls -l ${b}-test | awk '{ print $6 " " $7 " "$8}')
157        perm=$(ls -l ${b}-test | awk '{print $1}')
158        ./grubby --${b} --add-kernel bar --title title -c ${b}-test
159        if [[ $? != 0 ]]; then
160     echo "  FAIL (grubby returned non-zero)"
161     (( fail++ ))
162        elif newtime=$(ls -l ${b}-test | awk '{ print $6 " " $7 " "$8}') && \
163     newperm=$(ls -l ${b}-test | awk '{print $1}') && \
164     [[ $time == "$newtime" || $perm != "$newperm" ]]
165        then
166     echo "  FAIL ($perm $newperm)";
167     (( fail++ ))
168        else
169     (( pass++ ))
170        fi
171        rm -f ${b}-test
172    done
173    
174    testing="Following symlinks"
175    unset b
176    for n in test/*.[0-9]*; do
177        n=${n#*/} # remove test/
178        [[ ${n%.*} == "$b" ]] && continue
179        b=${n%.*} # remove suffix
180        [[ $b == $opt_bootloader ]] || continue
181    
182        echo "$testing ... --$b"
183    
184        cp test/${b}.1 ${b}-test
185        ln -s ./${b}-test mytest
186        ./grubby --${b} --add-kernel bar --title title -c mytest
187        if [[ $? != 0 ]]; then
188     echo "  failed (grubby returned non-zero)"
189     (( fail++ ))
190        elif [[ ! -L mytest ]]; then
191     echo "  failed (not a symlink)"
192     (( fail++ ))
193        elif target=$(readlink mytest) && [[ $target != "./${b}-test" ]]; then
194     echo "  failed (wrong target)"
195     (( fail++ ))
196        else
197     (( pass++ ))
198        fi
199        rm -f ${b}-test mytest
200    done
201    
202  echo "GRUB default directive..."  testing="GRUB default directive"
203  grubTest grub.1 default/g1.1 --boot-filesystem=/boot --add-kernel /boot/new-kernel --title Some_Title  grubTest grub.1 default/g1.1 --boot-filesystem=/boot --add-kernel /boot/new-kernel --title Some_Title
204  grubTest grub.1 default/g1.2 --boot-filesystem=/boot --add-kernel /boot/new-kernel --title Some_Title --make-default  grubTest grub.1 default/g1.2 --boot-filesystem=/boot --add-kernel /boot/new-kernel --title Some_Title --make-default
205  grubTest grub.3 default/g3.1 --boot-filesystem=/boot --set-default=/boot/vmlinuz-2.4.7-2  grubTest grub.3 default/g3.1 --boot-filesystem=/boot --set-default=/boot/vmlinuz-2.4.7-2
# Line 135  grubTest grub.4 default/g4.1 --boot-file Line 208  grubTest grub.4 default/g4.1 --boot-file
208  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
209  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=/
210    
211  echo "LILO default directive..."  testing="GRUB display default index"
212    grubDisplayTest grub.1 defaultindex/0 --default-index
213    grubDisplayTest grub.2 defaultindex/0 --default-index
214    grubDisplayTest grub.3 defaultindex/0 --default-index
215    grubDisplayTest grub.4 defaultindex/0 --default-index
216    grubDisplayTest grub.5 defaultindex/0 --default-index
217    grubDisplayTest grub.6 defaultindex/2 --default-index
218    grubDisplayTest grub.7 defaultindex/2 --default-index
219    grubDisplayTest grub.8 defaultindex/0 --default-index
220    grubDisplayTest grub.9 defaultindex/0 --default-index
221    grubDisplayTest grub.10 defaultindex/0 --default-index
222    grubDisplayTest grub.10 defaultindex/0 --default-index
223    
224    testing="GRUB display default title"
225    grubDisplayTest grub.1 defaulttitle/g.1 --default-title
226    grubDisplayTest grub.2 defaulttitle/g.2 --default-title
227    grubDisplayTest grub.3 defaulttitle/g.3 --default-title
228    grubDisplayTest grub.4 defaulttitle/g.4 --default-title
229    grubDisplayTest grub.5 defaulttitle/g.5 --default-title
230    grubDisplayTest grub.6 defaulttitle/g.6 --default-title
231    grubDisplayTest grub.7 defaulttitle/g.7 --default-title
232    grubDisplayTest grub.8 defaulttitle/g.8 --default-title
233    grubDisplayTest grub.9 defaulttitle/g.9 --default-title
234    grubDisplayTest grub.10 defaulttitle/g.10 --default-title
235    grubDisplayTest grub.11 defaulttitle/g.11 --default-title
236    
237    testing="LILO default directive"
238  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
239  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
240  liloTest lilo.1 default/l1.3 --add-kernel /boot/kernel --title label \  liloTest lilo.1 default/l1.3 --add-kernel /boot/kernel --title label \
# Line 143  liloTest lilo.1 default/l1.3 --add-kerne Line 242  liloTest lilo.1 default/l1.3 --add-kerne
242  liloTest lilo.1 default/l1.4 --add-kernel /boot/kernel --title label \  liloTest lilo.1 default/l1.4 --add-kernel /boot/kernel --title label \
243      --copy-default --make-default      --copy-default --make-default
244    
245  echo "Z/IPL default directive..."  testing="Z/IPL default directive"
246  ziplTest zipl.1 default/z1.1 --add-kernel /boot/new-kernel --title test  ziplTest zipl.1 default/z1.1 --add-kernel /boot/new-kernel --title test
247  ziplTest zipl.1 default/z1.2 --add-kernel /boot/new-kernel --title test --make-default  ziplTest zipl.1 default/z1.2 --add-kernel /boot/new-kernel --title test --make-default
248    
249  echo "GRUB fallback directive..."  testing="GRUB fallback directive"
250  grubTest grub.5 fallback/g5.1 --remove-kernel=/boot/vmlinuz-2.4.7-ac3 \  grubTest grub.5 fallback/g5.1 --remove-kernel=/boot/vmlinuz-2.4.7-ac3 \
251      --boot-filesystem=/      --boot-filesystem=/
252  grubTest grub.5 fallback/g5.2 --remove-kernel=/boot/vmlinuz-2.4.7-2.5 \  grubTest grub.5 fallback/g5.2 --remove-kernel=/boot/vmlinuz-2.4.7-2.5 \
# Line 156  grubTest grub.5 fallback/g5.3 --remove-k Line 255  grubTest grub.5 fallback/g5.3 --remove-k
255      --boot-filesystem=/ --copy-default --add-kernel=/boot/new-kernel \      --boot-filesystem=/ --copy-default --add-kernel=/boot/new-kernel \
256      --title="Some_Title"      --title="Some_Title"
257    
258  echo "GRUB new kernel argument handling..."  testing="GRUB new kernel argument handling"
259  grubTest grub.1 args/g1.1 --boot-filesystem=/boot \  grubTest grub.1 args/g1.1 --boot-filesystem=/boot \
260      --add-kernel=/boot/foo --title=some_title --args="1234" --copy-default      --add-kernel=/boot/foo --title=some_title --args="1234" --copy-default
261  grubTest grub.1 args/g1.2 --boot-filesystem=/boot \  grubTest grub.1 args/g1.2 --boot-filesystem=/boot \
262      --add-kernel=/boot/foo --title=some_title --args="1234"      --add-kernel=/boot/foo --title=some_title --args="1234"
263    
264  echo "GRUB remove kernel..."  testing="GRUB remove kernel"
265  grubTest grub.7 remove/g7.1 --boot-filesystem=/ \  grubTest grub.7 remove/g7.1 --boot-filesystem=/ \
266      --remove-kernel=/boot/vmlinuz-2.4.7-2.5      --remove-kernel=/boot/vmlinuz-2.4.7-2.5
267  grubTest grub.3 remove/g3.1 --boot-filesystem=/ \  grubTest grub.3 remove/g3.1 --boot-filesystem=/ \
# Line 170  grubTest grub.3 remove/g3.1 --boot-files Line 269  grubTest grub.3 remove/g3.1 --boot-files
269  grubTest grub.9 remove/g9.1 --boot-filesystem=/boot \  grubTest grub.9 remove/g9.1 --boot-filesystem=/boot \
270      --remove-kernel=/boot/vmlinuz-2.4.7-2      --remove-kernel=/boot/vmlinuz-2.4.7-2
271    
272  echo "YABOOT remove kernel..."  testing="YABOOT remove kernel"
273  yabootTest yaboot.1 remove/y1.1 --boot-filesystem=/ --remove-kernel=DEFAULT  yabootTest yaboot.1 remove/y1.1 --boot-filesystem=/ --remove-kernel=DEFAULT
274  yabootTest yaboot.1 remove/y1.2 --boot-filesystem=/ --remove-kernel=/boot/vmlinuz-2.5.50-eepro  yabootTest yaboot.1 remove/y1.2 --boot-filesystem=/ --remove-kernel=/boot/vmlinuz-2.5.50-eepro
275  yabootTest yaboot.2 remove/y2.1 --boot-filesystem=/ --remove-kernel=/boot/vmlinux-2.5.50  yabootTest yaboot.2 remove/y2.1 --boot-filesystem=/ --remove-kernel=/boot/vmlinux-2.5.50
276    
277  echo "Z/IPL remove kernel..."  testing="Z/IPL remove kernel"
278  ziplTest zipl.1 remove/z1.1 --remove-kernel=/boot/vmlinuz-2.4.9-38  ziplTest zipl.1 remove/z1.1 --remove-kernel=/boot/vmlinuz-2.4.9-38
279  ziplTest zipl.1 remove/z1.2 --remove-kernel=DEFAULT  ziplTest zipl.1 remove/z1.2 --remove-kernel=DEFAULT
280    
281  echo "GRUB update kernel argument handling..."  testing="GRUB update kernel argument handling"
282  grubTest grub.1 updargs/g1.1 --update-kernel=DEFAULT --args="root=/dev/hda1"  grubTest grub.1 updargs/g1.1 --update-kernel=DEFAULT --args="root=/dev/hda1"
283  grubTest grub.1 updargs/g1.2 --update-kernel=DEFAULT \  grubTest grub.1 updargs/g1.2 --update-kernel=DEFAULT \
284      --args="root=/dev/hda1 hda=ide-scsi root=/dev/hda2"      --args="root=/dev/hda1 hda=ide-scsi root=/dev/hda2"
# Line 202  grubTest grub.7 updargs/g7.3 --boot-file Line 301  grubTest grub.7 updargs/g7.3 --boot-file
301  grubTest grub.7 updargs/g7.4 --boot-filesystem=/    \  grubTest grub.7 updargs/g7.4 --boot-filesystem=/    \
302      --update-kernel=/vmlinuz-2.4.7-2 \      --update-kernel=/vmlinuz-2.4.7-2 \
303      --args "ro root=LABEL=/ console=tty0 console=ttyS1,9600n81 single"      --args "ro root=LABEL=/ console=tty0 console=ttyS1,9600n81 single"
304    grubTest grub.7 updargs/g7.5 --boot-filesystem=/    \
305        --update-kernel=ALL --args "root=/dev/hda2"
306  grubTest grub.11 updargs/g11.1 --boot-filesystem=/    \  grubTest grub.11 updargs/g11.1 --boot-filesystem=/    \
307      --update-kernel=/vmlinuz-2.4.7-2smp \      --update-kernel=/vmlinuz-2.4.7-2smp \
308      --args "ro root=LABEL=/ console=tty0 console=ttyS1,9600n81 single"      --args "ro root=LABEL=/ console=tty0 console=ttyS1,9600n81 single"
# Line 209  grubTest grub.11 updargs/g11.2 --boot-fi Line 310  grubTest grub.11 updargs/g11.2 --boot-fi
310      --update-kernel=/vmlinuz-2.4.7-2smp \      --update-kernel=/vmlinuz-2.4.7-2smp \
311      --args "ro root=LABEL=/ single"      --args "ro root=LABEL=/ single"
312    
313  echo "LILO update kernel argument handling..."  testing="LILO update kernel argument handling"
314  liloTest lilo.1 updargs/l1.1 --update-kernel=/boot/vmlinuz-2.4.18-4 \  liloTest lilo.1 updargs/l1.1 --update-kernel=/boot/vmlinuz-2.4.18-4 \
315      --args="root=/dev/md1"      --args="root=/dev/md1"
316  liloTest lilo.1 updargs/l1.2 --update-kernel=/boot/vmlinuz-2.4.18-4smp \  liloTest lilo.1 updargs/l1.2 --update-kernel=/boot/vmlinuz-2.4.18-4smp \
# Line 223  liloTest lilo.3 updargs/l3.1 --update-ke Line 324  liloTest lilo.3 updargs/l3.1 --update-ke
324  liloTest lilo.3 updargs/l3.2 --update-kernel=ALL \  liloTest lilo.3 updargs/l3.2 --update-kernel=ALL \
325      --remove-args="single" --args "root=/dev/hda2"      --remove-args="single" --args "root=/dev/hda2"
326    
327  echo "LILO add kernel..."  testing="LILO add kernel"
328  liloTest lilo.4 add/l4.1 --add-kernel=/boot/new-kernel.img --title="title" \  liloTest lilo.4 add/l4.1 --add-kernel=/boot/new-kernel.img --title="title" \
329      --copy-default --boot-filesystem=/boot      --copy-default --boot-filesystem=/boot
330  liloTest lilo.4 add/l4.2 --add-kernel=/boot/new-kernel.img --title="linux" \  liloTest lilo.4 add/l4.2 --add-kernel=/boot/new-kernel.img --title="linux" \
# Line 238  liloTest lilo.6 add/l6.2 --add-kernel=/b Line 339  liloTest lilo.6 add/l6.2 --add-kernel=/b
339    --initrd=/boot/new-initrd --copy-default --boot-filesystem=/boot --remove-kernel "TITLE=linux"    --initrd=/boot/new-initrd --copy-default --boot-filesystem=/boot --remove-kernel "TITLE=linux"
340    
341    
342  echo "GRUB add kernel..."  testing="GRUB add kernel"
343  grubTest grub.1 add/g1.1 --add-kernel=/boot/new-kernel.img --title='title' \  grubTest grub.1 add/g1.1 --add-kernel=/boot/new-kernel.img --title='title' \
344      --initrd=/boot/new-initrd --boot-filesystem=/      --initrd=/boot/new-initrd --boot-filesystem=/
345  grubTest grub.1 add/g1.2 --add-kernel=/boot/new-kernel.img --title='title' \  grubTest grub.1 add/g1.2 --add-kernel=/boot/new-kernel.img --title='title' \
# Line 247  grubTest grub.1 add/g1.3 --add-kernel=/b Line 348  grubTest grub.1 add/g1.3 --add-kernel=/b
348      --initrd=/boot/new-initrd --boot-filesystem=/ --copy-default      --initrd=/boot/new-initrd --boot-filesystem=/ --copy-default
349  grubTest grub.1 add/g1.4 --add-kernel=/boot/new-kernel.img --title='title' \  grubTest grub.1 add/g1.4 --add-kernel=/boot/new-kernel.img --title='title' \
350      --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default      --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default
351    grubTest grub.1 add/g1.5 --add-kernel=/boot/new-kernel.img --title='title' \
352        --initrd=/boot/new-initrd --extra-initrd=/boot/extra-initrd --boot-filesystem=/
353    grubTest grub.1 add/g1.6 --add-kernel=/boot/new-kernel.img --title='title' \
354        --initrd=/boot/new-initrd --extra-initrd=/boot/extra-initrd --boot-filesystem=/boot
355  grubTest grub.2 add/g2.1 --add-kernel=/boot/vmlinuz-2.4.7-2    \  grubTest grub.2 add/g2.1 --add-kernel=/boot/vmlinuz-2.4.7-2    \
356      --initrd=/boot/initrd-2.4.7-new.img --boot-filesystem=/boot --copy-default \      --initrd=/boot/initrd-2.4.7-new.img --boot-filesystem=/boot --copy-default \
357      --title="Red Hat Linux (2.4.7-2)"    \      --title="Red Hat Linux (2.4.7-2)"    \
# Line 260  grubTest grub.11 add/g11.1 --add-kernel= Line 365  grubTest grub.11 add/g11.1 --add-kernel=
365      --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default \      --initrd=/boot/new-initrd --boot-filesystem=/boot --copy-default \
366      --args='console=tty0 console=ttyS1,9600n81 single'      --args='console=tty0 console=ttyS1,9600n81 single'
367    
368  echo "YABOOT add kernel..."  testing="GRUB2 add kernel"
369    grub2Test grub2.1 add/g2-1.1 --add-kernel=/boot/new-kernel.img --title='title' \
370        --initrd=/boot/new-initrd --boot-filesystem=/boot/ --copy-default
371    grub2Test grub2.1 add/g2-1.2 --add-kernel=/boot/new-kernel.img --title='title' \
372        --initrd=/boot/new-initrd --boot-filesystem=/boot/ \
373        --copy-default --make-default
374    grub2Test grub2.1 add/g2-1.3 --add-kernel=/boot/new-kernel.img --title='title' \
375        --boot-filesystem=/boot/ --copy-default --make-default
376    grub2Test grub2.1 remove/g2-1.4 --remove-kernel=/boot/vmlinuz-2.6.38.2-9.fc15.x86_64 \
377        --boot-filesystem=/boot/
378    grub2Test grub2.5 add/g2-1.5 --add-kernel=/boot/new-kernel.img --title='title' \
379        --initrd=/boot/new-initrd --boot-filesystem=/boot/ --copy-default
380    
381    testing="GRUB2 add initrd"
382    grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \
383        --initrd=/boot/new-initrd --boot-filesystem=/boot/
384    
385    testing="GRUB2 display default index"
386    grub2DisplayTest grub2.1 defaultindex/0 --default-index
387    grub2DisplayTest grub2.2 defaultindex/0 --default-index
388    
389    testing="GRUB2 display default title"
390    grub2DisplayTest grub2.1 defaulttitle/g2.1 --default-title
391    grub2DisplayTest grub2.2 defaulttitle/g2.2 --default-title
392    
393    testing="GRUB2 display debug failure"
394    grub2DisplayTest grub2.1 debug/g2.1 --bad-image-bad --boot-filesystem=/boot --default-kernel --debug
395    testing="GRUB2 display debug success"
396    grub2DisplayTest grub2.1 debug/g2.1.2 --boot-filesystem=/boot --default-kernel --debug
397    
398    testing="GRUB2 remove kernel via index"
399    grub2Test grub2.3 remove/g2-1.1 --remove-kernel=1
400    
401    testing="GRUB2 remove kernel via title"
402    grub2Test grub2.3 remove/g2-1.1 --remove-kernel="TITLE=title2"
403    
404    testing="GRUB2 (submenu) remove kernel via index"
405    grub2Test grub2.4 remove/g2-1.2 --remove-kernel=2
406    
407    testing="GRUB2 (submenu) remove kernel via title"
408    grub2Test grub2.4 remove/g2-1.2 --remove-kernel="TITLE=title2"
409    
410    testing="YABOOT add kernel"
411  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  \
412      --title=newtitle      --title=newtitle
413  yabootTest yaboot.1 add/y1.2 --add-kernel=/boot/new-kernel --boot-filesystem=/ --title=newtitle  yabootTest yaboot.1 add/y1.2 --add-kernel=/boot/new-kernel --boot-filesystem=/ --title=newtitle
414    
415  echo "YABOOT empty label..."  testing="YABOOT empty label"
416  yabootTest yaboot.3 add/y3.1 --add-kernel=/boot/new-kernel --boot-filesystem=/ --title=newtitle  yabootTest yaboot.3 add/y3.1 --add-kernel=/boot/new-kernel --boot-filesystem=/ --title=newtitle
417    
418  echo "Z/IPL add kernel..."  testing="Z/IPL add kernel"
419  ziplTest zipl.1 add/z1.1 --add-kernel=/boot/new-kernel.img --title test  ziplTest zipl.1 add/z1.1 --add-kernel=/boot/new-kernel.img --title test
420  ziplTest zipl.1 add/z1.2 --add-kernel=/boot/new-kernel.img --title test --copy-default  ziplTest zipl.1 add/z1.2 --add-kernel=/boot/new-kernel.img --title test --copy-default
421    
422  echo "LILO long titles..."  testing="LILO long titles"
423  liloTest lilo.1 longtitle/l1.1 --add-kernel=/boot/new-kernel.img \  liloTest lilo.1 longtitle/l1.1 --add-kernel=/boot/new-kernel.img \
424      --title="linux-longtitle" --copy-default --boot-filesystem=/boot      --title="linux-longtitle" --copy-default --boot-filesystem=/boot
425  liloTest lilo.1 longtitle/l1.2 --add-kernel=/boot/new-kernel.img \  liloTest lilo.1 longtitle/l1.2 --add-kernel=/boot/new-kernel.img \
# Line 280  liloTest lilo.1 longtitle/l1.2 --add-ker Line 427  liloTest lilo.1 longtitle/l1.2 --add-ker
427  liloTest lilo.7 longtitle/l7.1 --add-kernel=/boot/new-kernel.img \  liloTest lilo.7 longtitle/l7.1 --add-kernel=/boot/new-kernel.img \
428      --title="linux-longtitle-fix" --copy-default --boot-filesystem=/boot      --title="linux-longtitle-fix" --copy-default --boot-filesystem=/boot
429    
430  echo "ELILO long titles..."  testing="ELILO long titles"
431  eliloTest lilo.7 longtitle/e7.1 --add-kernel=/boot/new-kernel.img \  eliloTest lilo.7 longtitle/e7.1 --add-kernel=/boot/new-kernel.img \
432      --title="linux-longtitle-fix" --copy-default --boot-filesystem=/boot      --title="linux-longtitle-fix" --copy-default --boot-filesystem=/boot
433    
434  echo "GRUB add multiboot..."  testing="GRUB add multiboot"
435  grubTest grub.1 multiboot/g1.1 --add-multiboot=/boot/xen.gz \  grubTest grub.1 multiboot/g1.1 --add-multiboot=/boot/xen.gz \
436      --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \      --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \
437      --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \      --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
# Line 308  grubTest grub.10 multiboot/g10.4 --add-k Line 455  grubTest grub.10 multiboot/g10.4 --add-k
455      --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \      --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
456      --boot-filesystem=/boot      --boot-filesystem=/boot
457    
458  echo "GRUB remove multiboot..."  testing="GRUB remove multiboot"
459  grubTest grub.10 multiboot/g10.5 --boot-filesystem=/boot \  grubTest grub.10 multiboot/g10.5 --boot-filesystem=/boot \
460      --remove-kernel=/boot/vmlinuz-2.6.10-1.1076_FC4      --remove-kernel=/boot/vmlinuz-2.6.10-1.1076_FC4
461  grubTest grub.10 multiboot/g10.6 --boot-filesystem=/boot \  grubTest grub.10 multiboot/g10.6 --boot-filesystem=/boot \
# Line 316  grubTest grub.10 multiboot/g10.6 --boot- Line 463  grubTest grub.10 multiboot/g10.6 --boot-
463  grubTest grub.10 multiboot/g10.7 --boot-filesystem=/boot \  grubTest grub.10 multiboot/g10.7 --boot-filesystem=/boot \
464      --remove-multiboot=/boot/xen.gz      --remove-multiboot=/boot/xen.gz
465    
466  exit $RESULT  testing="ELILO add multiboot"
467    eliloTest elilo.1 multiboot/e1.1 --add-multiboot=/boot/xen.gz \
468        --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \
469        --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
470        --mbargs="dom0_mem=130000"
471    eliloTest elilo.1 multiboot/e1.2 --add-multiboot=/boot/xen.gz \
472        --add-kernel=/boot/vmlinuz-2.6.10-1.1088_FC4 --boot-filesystem=/boot \
473        --initrd=/boot/initrd-2.6.10-1.1088_FC4.img --title foo \
474        --mbargs="dom0_mem=130000" --copy-default
475    
476    testing="ELILO remove multiboot"
477    eliloTest elilo.2 multiboot/e2.1 --boot-filesystem=/boot \
478        --remove-kernel=/boot/vmlinuz-2.6.10-1.1076_FC4
479    eliloTest elilo.2 multiboot/e2.2 --boot-filesystem=/boot \
480        --remove-kernel=/boot/vmlinuz-2.6.10-1.1082_FC4
481    eliloTest elilo.2 multiboot/e2.3 --boot-filesystem=/boot \
482        --remove-multiboot=/boot/xen.gz
483    
484    printf "\n%d (%d%%) tests passed, %d (%d%%) tests failed\n" \
485        $pass $(((100*pass)/(pass+fail))) \
486        $fail $(((100*fail)/(pass+fail)))
487    
488    exit $(( !!fail ))

Legend:
Removed from v.532  
changed lines
  Added in v.1858