grub2: bring back build of aros-side grub2 tools
[AROS.git] / arch / all-pc / boot / grub2-aros / tests / grub_script_blockarg.in
blob2765b61acbb8c1081f620960e0350c5489dc2875
1 #! /bin/bash
3 # Run GRUB script in a Qemu instance
4 # Copyright (C) 2010 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 error_if_not () {
20 if test "$1" != "$2"; then
21 echo "[$1]" != "[$2]"
22 exit 1
26 cmd='test_blockarg { true }'
27 v=`echo "$cmd" | @builddir@/grub-shell`
28 error_if_not "$v" '{ true }'
30 tmp=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
31 cmd='test_blockarg { test_blockarg { true } }'
32 echo "$cmd" | @builddir@/grub-shell >$tmp
33 error_if_not "`head -n1 $tmp|tail -n1`" '{ test_blockarg { true } }'
34 error_if_not "`head -n2 $tmp|tail -n1`" '{ true }'
36 cmd='test_blockarg { test_blockarg { test_blockarg { true } }; test_blockarg { true } }'
37 echo "$cmd" | @builddir@/grub-shell >$tmp
38 error_if_not "`head -n1 $tmp|tail -n1`" '{ test_blockarg { test_blockarg { true } }; test_blockarg { true } }'
39 error_if_not "`head -n2 $tmp|tail -n1`" '{ test_blockarg { true } }'
40 error_if_not "`head -n3 $tmp|tail -n1`" '{ true }'
41 error_if_not "`head -n4 $tmp|tail -n1`" '{ true }'