3 # Compares GRUB script output with BASH output.
4 # Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
6 # GRUB is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # GRUB is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 # Initialize some variables.
20 transform
="@program_transform_name@"
23 exec_prefix
=@exec_prefix@
27 PACKAGE_NAME
=@PACKAGE_NAME@
28 PACKAGE_TARNAME
=@PACKAGE_TARNAME@
29 PACKAGE_VERSION
=@PACKAGE_VERSION@
30 target_cpu
=@target_cpu@
32 # Force build directory components
33 PATH
=${builddir}:$PATH
40 Usage: $0 [OPTION] [SOURCE]
41 Compares GRUB script output with BASH shell output.
43 -h, --help print this message and exit
44 -v, --version print the version information and exit
45 --modules=MODULES pre-load specified modules MODULES
46 --qemu-opts=OPTIONS extra options to pass to Qemu instance
48 $0 compares GRUB script output with BASH shell output and prints their
51 Report bugs to <bug-grub@gnu.org>.
55 # Check the arguments.
56 for option
in "$@"; do
62 echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
65 ms
=`echo "$option" | sed -e 's/--modules=//'`
66 modules
="$modules,$ms" ;;
68 qs
=`echo "$option" | sed -e 's/--qemu-opts=//'`
69 qemuopts
="$qemuopts $qs" ;;
71 echo "Unrecognized option \`$option'" 1>&2
76 if [ "x${source}" != x
] ; then
77 echo "too many parameters at the end" 1>&2
85 if [ "x${source}" = x
] ; then
88 echo $REPLY >> ${tmpfile}
94 @builddir@
/grub-shell
--qemu-opts="${qemuopts}" --modules=${modules} ${source} >${outfile1}
97 bash ${source} >${outfile2}
99 if ! diff -q ${outfile1} ${outfile2} >/dev/null
101 echo "${source}: GRUB and BASH outputs did not match (see diff -u ${outfile1} ${outfile2})"
104 rm -f ${outfile1} ${outfile2}