file_filter_test.in 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #! /bin/sh
  2. # Copyright (C) 2014 Free Software Foundation, Inc.
  3. #
  4. # GRUB is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # GRUB is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  16. set -e
  17. grubshell=@builddir@/grub-shell
  18. . "@builddir@/grub-core/modinfo.sh"
  19. filters="gzio xzio lzopio verify"
  20. modules="cat mpi"
  21. for mod in $(cut -d ' ' -f 2 "@builddir@/grub-core/crypto.lst" | sort -u); do
  22. modules="$modules $mod"
  23. done
  24. for file in file.gz file.xz file.lzop file.gz.sig file.xz.sig file.lzop.sig keys.pub; do
  25. files="$files /$file=@srcdir@/tests/file_filter/$file"
  26. done
  27. # GRUB cat command adds extra newline after file
  28. result="Hello, user!
  29. Hello, user!
  30. Hello, user!"
  31. out="$("${grubshell}" --modules="$modules $filters" --files="$files" "@srcdir@/tests/file_filter/test.cfg")"
  32. if [ "$out" != "$result" ]; then
  33. echo LOCAL FAIL
  34. echo "$out"
  35. exit 1
  36. fi
  37. # Taken from netboot_test
  38. case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
  39. # PLATFORM: emu is different
  40. *-emu)
  41. exit 0;;
  42. # PLATFORM: Flash targets
  43. i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips)
  44. exit 0;;
  45. # FIXME: currently grub-shell uses only -kernel for loongson
  46. mipsel-loongson)
  47. exit 0;;
  48. # FIXME: no rtl8139 support
  49. i386-multiboot)
  50. exit 0;;
  51. # FIXME: We don't fully support netboot on ARC
  52. *-arc)
  53. exit 0;;
  54. # FIXME: Many QEMU firmware have no netboot capability
  55. *-efi | i386-ieee1275 | powerpc-ieee1275 | sparc64-ieee1275)
  56. exit 0;;
  57. esac
  58. out="$("${grubshell}" --boot=net --modules="$modules $filters" --files="$files" "@srcdir@/tests/file_filter/test.cfg")"
  59. if [ "$out" != "$result" ]; then
  60. echo NET FAIL
  61. echo "$out"
  62. exit 1
  63. fi
  64. exit 0