hello-aarch64.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #! /bin/sh
  2. ## Copyright (C) 2017 Jeremiah Orians
  3. ## Copyright (C) 2020 deesix <deesix@tuta.io>
  4. ## This file is part of M2-Planet.
  5. ##
  6. ## M2-Planet 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. ## M2-Planet 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 M2-Planet. If not, see <http://www.gnu.org/licenses/>.
  18. set -ex
  19. # Build the test
  20. bin/M2-Planet --architecture aarch64 \
  21. -f test/common_aarch64/functions/putchar.c \
  22. -f test/common_aarch64/functions/exit.c \
  23. -f test/test0013/break-while.c \
  24. -o test/test0013/break-while.M1 || exit 1
  25. # Macro assemble with libc written in M1-Macro
  26. M1 -f test/common_aarch64/aarch64_defs.M1 \
  27. -f test/common_aarch64/libc-core.M1 \
  28. -f test/test0013/break-while.M1 \
  29. --LittleEndian \
  30. --architecture aarch64 \
  31. -o test/test0013/break-while.hex2 || exit 2
  32. # Resolve all linkages
  33. hex2 -f test/common_aarch64/ELF-aarch64.hex2 \
  34. -f test/test0013/break-while.hex2 \
  35. --LittleEndian \
  36. --architecture aarch64 \
  37. --BaseAddress 0x400000 \
  38. -o test/results/test0013-aarch64-binary \
  39. --exec_enable || exit 3
  40. # Ensure binary works if host machine supports test
  41. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ]
  42. then
  43. . ./sha256.sh
  44. # Verify that the resulting file works
  45. ./test/results/test0013-aarch64-binary >| test/test0013/proof || exit 4
  46. out=$(sha256_check test/test0013/proof.answer)
  47. [ "$out" = "test/test0013/proof: OK" ] || exit 5
  48. fi
  49. exit 0