grub_cmd_regexp.in 1.7 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. cmd='regexp -s version "vm-(.*)" vm-1.2.3; echo $version'
  19. v=`echo "$cmd" | @builddir@/grub-shell`
  20. if test "$v" != 1.2.3; then echo "error: $cmd" >&2; exit 1; fi
  21. cmd='regexp -s 1:version "vm-(.*)" vm-1.2.3; echo $version'
  22. v=`echo "$cmd" | @builddir@/grub-shell`
  23. if test "$v" != 1.2.3; then echo "error: $cmd" >&2; exit 1; fi
  24. cmd='regexp -s 0:match "vm-(.*)" vm-1.2.3; echo $match'
  25. v=`echo "$cmd" | @builddir@/grub-shell`
  26. if test "$v" != vm-1.2.3; then echo "error: $cmd" >&2; exit 1; fi
  27. cmd='regexp -s 2:match "vm-(.*)" vm-1.2.3; echo $match'
  28. v=`echo "$cmd" | @builddir@/grub-shell`
  29. if test -n "$v"; then echo "error: $cmd" >&2; exit 1; fi
  30. cmd='regexp -s match "\\\((.*)\\\)" (hd0,msdos1); echo $match'
  31. v=`echo "$cmd" | @builddir@/grub-shell`
  32. if test "$v" != "hd0,msdos1"; then echo "error: $cmd" >&2; exit 1; fi
  33. cmd='regexp -s match "hd([0-9]+)" hd0; echo $match'
  34. v=`echo "$cmd" | @builddir@/grub-shell`
  35. if test "$v" != "0"; then echo "error: $cmd" >&2; exit 1; fi