]> git.proxmox.com Git - grub2.git/blob - tests/grub_script_blockarg.in
merge mainline into nested
[grub2.git] / tests / grub_script_blockarg.in
1 #! /bin/bash
2
3 # Run GRUB script in a Qemu instance
4 # Copyright (C) 2010 Free Software Foundation, Inc.
5 #
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.
10 #
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.
15 #
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/>.
18
19 error_if_not () {
20 if test "$1" != "$2"; then
21 echo "[$1]" != "[$2]"
22 exit 1
23 fi
24 }
25
26 cmd='test_blockarg { true }'
27 v=`echo "$cmd" | @builddir@/grub-shell`
28 error_if_not "$v" '{ true }'
29
30 tmp=`mktemp`
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 }'
35
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 }'