Magellan Linux

Diff of /trunk/grubby/test.sh

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

revision 1698 by niro, Sat Feb 18 00:16:24 2012 UTC revision 1858 by niro, Mon Jul 2 13:14:43 2012 UTC
# Line 69  oneTest() { Line 69  oneTest() {
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[@]}" 2>&1 | 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[@]}" 2>&1 | diff -U30 "$cfg" -
92        echo
93     fi
94        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  # 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  #----------------------------------------------------------------------  #----------------------------------------------------------------------
# Line 93  while true; do Line 126  while true; do
126  done  done
127    
128  export MALLOC_CHECK_=2  export MALLOC_CHECK_=2
129    if [ -n "${RANDOM}" ]; then
130        export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
131    else
132        export MALLOC_PERTURB_=1
133    fi
134    
135  testing="Parse/write comparison"  testing="Parse/write comparison"
136  for n in test/*.[0-9]*; do  for n in test/*.[0-9]*; do
# Line 170  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    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"  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
# Line 309  grub2Test grub2.1 add/g2-1.2 --add-kerne Line 373  grub2Test grub2.1 add/g2-1.2 --add-kerne
373      --copy-default --make-default      --copy-default --make-default
374  grub2Test grub2.1 add/g2-1.3 --add-kernel=/boot/new-kernel.img --title='title' \  grub2Test grub2.1 add/g2-1.3 --add-kernel=/boot/new-kernel.img --title='title' \
375      --boot-filesystem=/boot/ --copy-default --make-default      --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"  testing="GRUB2 add initrd"
382  grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \  grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \
383      --initrd=/boot/new-initrd --boot-filesystem=/boot/      --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"  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

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