grub_cmd_regexp.in 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #! /bin/bash -e
  2. # Run GRUB script in a Qemu instance
  3. # Copyright (C) 2010 Free Software Foundation, Inc.
  4. #
  5. # GRUB is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # GRUB is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. cmd='regexp -s version "vm-(.*)" vm-1.2.3; echo $version'
  18. v=`echo "$cmd" | @builddir@/grub-shell`
  19. if test "$v" != 1.2.3; then echo "error: $cmd" >&2; exit 1; fi
  20. cmd='regexp -s 1:version "vm-(.*)" vm-1.2.3; echo $version'
  21. v=`echo "$cmd" | @builddir@/grub-shell`
  22. if test "$v" != 1.2.3; then echo "error: $cmd" >&2; exit 1; fi
  23. cmd='regexp -s 0:match "vm-(.*)" vm-1.2.3; echo $match'
  24. v=`echo "$cmd" | @builddir@/grub-shell`
  25. if test "$v" != vm-1.2.3; then echo "error: $cmd" >&2; exit 1; fi
  26. cmd='regexp -s 2:match "vm-(.*)" vm-1.2.3; echo $match'
  27. v=`echo "$cmd" | @builddir@/grub-shell`
  28. if test -n "$v"; then echo "error: $cmd" >&2; exit 1; fi
  29. cmd='regexp -s match "\\\((.*)\\\)" (hd0,msdos1); echo $match'
  30. v=`echo "$cmd" | @builddir@/grub-shell`
  31. if test "$v" != "hd0,msdos1"; then echo "error: $cmd" >&2; exit 1; fi
  32. cmd='regexp -s match "hd([0-9]+)" hd0; echo $match'
  33. v=`echo "$cmd" | @builddir@/grub-shell`
  34. if test "$v" != "0"; then echo "error: $cmd" >&2; exit 1; fi