hello-x86.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #! /bin/sh
  2. ## Copyright (C) 2017 Jeremiah Orians
  3. ## This file is part of M2-Planet.
  4. ##
  5. ## M2-Planet 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. ## M2-Planet 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 M2-Planet. If not, see <http://www.gnu.org/licenses/>.
  17. set -x
  18. # Build the test
  19. bin/M2-Planet --architecture x86 \
  20. -f test/common_x86/functions/file.c \
  21. -f test/test0023/fseek.c \
  22. --debug \
  23. -o test/test0023/fseek.M1 || exit 1
  24. # Build debug footer
  25. blood-elf -f test/test0023/fseek.M1 \
  26. --entry _start \
  27. -o test/test0023/fseek-footer.M1 || exit 2
  28. # Macro assemble with libc written in M1-Macro
  29. M1 -f test/common_x86/x86_defs.M1 \
  30. -f test/common_x86/libc-core.M1 \
  31. -f test/test0023/fseek.M1 \
  32. -f test/test0023/fseek-footer.M1 \
  33. --LittleEndian \
  34. --architecture x86 \
  35. -o test/test0023/fseek.hex2 || exit 3
  36. # Resolve all linkages
  37. hex2 -f test/common_x86/ELF-i386-debug.hex2 \
  38. -f test/test0023/fseek.hex2 \
  39. --LittleEndian \
  40. --architecture x86 \
  41. --BaseAddress 0x8048000 \
  42. -o test/results/test0023-x86-binary \
  43. --exec_enable || exit 4
  44. # Ensure binary works if host machine supports test
  45. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
  46. then
  47. . ./sha256.sh
  48. # Verify that the resulting file works
  49. ./test/results/test0023-x86-binary test/test0023/question >| test/test0023/proof
  50. [ 0 = $? ] || exit 5
  51. out=$(sha256_check test/test0023/proof.answer)
  52. [ "$out" = "test/test0023/proof: OK" ] || exit 6
  53. fi
  54. exit 0