Magellan Linux

Diff of /trunk/grubby/test.sh

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

revision 1718 by niro, Sat Feb 18 00:16:24 2012 UTC revision 1719 by niro, Sat Feb 18 00:50:18 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    
78        echo "$testing ... $mode $cfg $correct"
79        runme=( ./grubby "$mode" --bad-image-okay -c "$cfg" "$@" )
80        if "${runme[@]}" | cmp "$correct" > /dev/null; then
81     (( pass++ ))
82     if $opt_verbose; then
83        echo -------------------------------------------------------------
84        echo -n "PASS: "
85        printf "%q " "${runme[@]}"; echo
86        "${runme[@]}" | diff -U30 "$cfg" -
87        echo
88     fi
89        else
90     (( fail++ ))
91     echo -------------------------------------------------------------
92     echo -n "FAIL: "
93     printf "%q " "${runme[@]}"; echo
94     "${runme[@]}" | diff -U30 "$correct" -
95     echo
96        fi
97    }
98    
99  # generate convenience functions  # generate convenience functions
100  for b in $(./grubby --help | \  for b in $(./grubby --help | \
101   sed -n 's/^.*--\([^ ]*\) *configure \1 bootloader$/\1/p'); do   sed -n 's/^.*--\([^ ]*\) *configure \1 bootloader$/\1/p'); do
102      eval "${b}Test() { [[ \"$b\" == \$opt_bootloader ]] && oneTest --$b \"\$@\"; }"      eval "${b}Test() { [[ \"$b\" == \$opt_bootloader ]] && oneTest --$b \"\$@\"; }"
103        eval "${b}DisplayTest() { [[ \"$b\" == \$opt_bootloader ]] && oneDisplayTest --$b \"\$@\"; }"
104  done  done
105    
106  #----------------------------------------------------------------------  #----------------------------------------------------------------------

Legend:
Removed from v.1718  
changed lines
  Added in v.1719