hello-amd64.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 -ex
  18. # Build the test
  19. bin/M2-Planet --architecture amd64 -f test/common_amd64/functions/file.c \
  20. -f test/common_amd64/functions/malloc.c \
  21. -f functions/calloc.c \
  22. -f test/test0018/math.c \
  23. --bootstrap-mode \
  24. -o test/test0018/math.M1 || exit 1
  25. # Macro assemble with libc written in M1-Macro
  26. M1 -f test/common_amd64/amd64_defs.M1 \
  27. -f test/common_amd64/libc-core.M1 \
  28. -f test/test0018/math.M1 \
  29. --LittleEndian \
  30. --architecture amd64 \
  31. -o test/test0018/math.hex2 || exit 2
  32. # Resolve all linkages
  33. hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test0018/math.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test0018-amd64-binary --exec_enable || exit 3
  34. # Ensure binary works if host machine supports test
  35. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ]
  36. then
  37. . ./sha256.sh
  38. # Verify that the resulting file works
  39. ./test/results/test0018-amd64-binary >| test/test0018/proof || exit 4
  40. out=$(sha256_check test/test0018/proof.answer)
  41. [ "$out" = "test/test0018/proof: OK" ] || exit 5
  42. fi
  43. exit 0