grub_script_blockarg.in 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #! @BUILD_SHEBANG@
  2. set -e
  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. error_if_not () {
  19. if test "$1" != "$2"; then
  20. echo "[$1]" != "[$2]"
  21. exit 1
  22. fi
  23. }
  24. cmd='test_blockarg { true }'
  25. v=`echo "$cmd" | @builddir@/grub-shell`
  26. error_if_not "$v" '{ true }'
  27. tmp=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 99
  28. cmd='test_blockarg { test_blockarg { true } }'
  29. echo "$cmd" | @builddir@/grub-shell >$tmp
  30. error_if_not "`head -n1 $tmp|tail -n1`" '{ test_blockarg { true } }'
  31. error_if_not "`head -n2 $tmp|tail -n1`" '{ true }'
  32. cmd='test_blockarg { test_blockarg { test_blockarg { true } }; test_blockarg { true } }'
  33. echo "$cmd" | @builddir@/grub-shell >$tmp
  34. error_if_not "`head -n1 $tmp|tail -n1`" '{ test_blockarg { test_blockarg { true } }; test_blockarg { true } }'
  35. error_if_not "`head -n2 $tmp|tail -n1`" '{ test_blockarg { true } }'
  36. error_if_not "`head -n3 $tmp|tail -n1`" '{ true }'
  37. error_if_not "`head -n4 $tmp|tail -n1`" '{ true }'