hello-x86.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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/chdir.c \
  21. -f test/common_x86/functions/malloc.c \
  22. -f test/common_x86/functions/getcwd.c \
  23. -f test/common_x86/functions/fork.c \
  24. -f test/common_x86/functions/execve.c \
  25. -f test/common_x86/functions/exit.c \
  26. -f test/common_x86/functions/file.c \
  27. -f functions/calloc.c \
  28. -f functions/match.c \
  29. -f functions/file_print.c \
  30. -f test/test0021/chdir.c \
  31. --debug \
  32. --bootstrap-mode \
  33. -o test/test0021/chdir.M1 || exit 1
  34. # Build debug footer
  35. blood-elf -f test/test0021/chdir.M1 \
  36. --entry _start \
  37. -o test/test0021/chdir-footer.M1 || exit 2
  38. # Macro assemble with libc written in M1-Macro
  39. M1 -f test/common_x86/x86_defs.M1 \
  40. -f test/common_x86/libc-core.M1 \
  41. -f test/test0021/chdir.M1 \
  42. -f test/test0021/chdir-footer.M1 \
  43. --LittleEndian \
  44. --architecture x86 \
  45. -o test/test0021/chdir.hex2 || exit 3
  46. # Resolve all linkages
  47. hex2 -f test/common_x86/ELF-i386-debug.hex2 \
  48. -f test/test0021/chdir.hex2 \
  49. --LittleEndian \
  50. --architecture x86 \
  51. --BaseAddress 0x8048000 \
  52. -o test/results/test0021-x86-binary \
  53. --exec_enable || exit 4
  54. # Ensure binary works if host machine supports test
  55. if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
  56. then
  57. . ./sha256.sh
  58. # Verify that the resulting file works
  59. ./test/results/test0021-x86-binary
  60. [ 0 = $? ] || exit 5
  61. fi
  62. exit 0