diff --git a/makefile-tests b/makefile-tests index 2494242..67f711e 100644 --- a/makefile-tests +++ b/makefile-tests @@ -222,205 +222,205 @@ x86-tests: \ test1000-x86-binary | results test0000-aarch64-binary: M2-Planet | results - test/test0000/hello-aarch64.sh + test/test0000/run_test.sh aarch64 test0001-aarch64-binary: M2-Planet | results - test/test0001/hello-aarch64.sh + test/test0001/run_test.sh aarch64 test0002-aarch64-binary: M2-Planet | results - test/test0002/hello-aarch64.sh + test/test0002/run_test.sh aarch64 test0003-aarch64-binary: M2-Planet | results - test/test0003/hello-aarch64.sh + test/test0003/run_test.sh aarch64 test0004-aarch64-binary: M2-Planet | results - test/test0004/hello-aarch64.sh + test/test0004/run_test.sh aarch64 test0005-aarch64-binary: M2-Planet | results - test/test0005/hello-aarch64.sh + test/test0005/run_test.sh aarch64 test0006-aarch64-binary: M2-Planet | results - test/test0006/hello-aarch64.sh + test/test0006/run_test.sh aarch64 test0007-aarch64-binary: M2-Planet | results - test/test0007/hello-aarch64.sh + test/test0007/run_test.sh aarch64 test0008-aarch64-binary: M2-Planet | results - test/test0008/hello-aarch64.sh + test/test0008/run_test.sh aarch64 test0009-aarch64-binary: M2-Planet | results - test/test0009/hello-aarch64.sh + test/test0009/run_test.sh aarch64 test0010-aarch64-binary: M2-Planet | results - test/test0010/hello-aarch64.sh + test/test0010/run_test.sh aarch64 test0011-aarch64-binary: M2-Planet | results - test/test0011/hello-aarch64.sh + test/test0011/run_test.sh aarch64 test0012-aarch64-binary: M2-Planet | results - test/test0012/hello-aarch64.sh + test/test0012/run_test.sh aarch64 test0013-aarch64-binary: M2-Planet | results - test/test0013/hello-aarch64.sh + test/test0013/run_test.sh aarch64 test0014-aarch64-binary: M2-Planet | results - test/test0014/hello-aarch64.sh + test/test0014/run_test.sh aarch64 test0015-aarch64-binary: M2-Planet | results - test/test0015/hello-aarch64.sh + test/test0015/run_test.sh aarch64 test0016-aarch64-binary: M2-Planet | results - test/test0016/hello-aarch64.sh + test/test0016/run_test.sh aarch64 test0017-aarch64-binary: M2-Planet | results - test/test0017/hello-aarch64.sh + test/test0017/run_test.sh aarch64 test0018-aarch64-binary: M2-Planet | results - test/test0018/hello-aarch64.sh + test/test0018/run_test.sh aarch64 test0019-aarch64-binary: M2-Planet | results - test/test0019/hello-aarch64.sh + test/test0019/run_test.sh aarch64 test0020-aarch64-binary: M2-Planet | results - test/test0020/hello-aarch64.sh + test/test0020/run_test.sh aarch64 test0021-aarch64-binary: M2-Planet | results - test/test0021/hello-aarch64.sh + test/test0021/run_test.sh aarch64 test0022-aarch64-binary: M2-Planet | results - test/test0022/hello-aarch64.sh + test/test0022/run_test.sh aarch64 test0023-aarch64-binary: M2-Planet | results - test/test0023/hello-aarch64.sh + test/test0023/run_test.sh aarch64 test0024-aarch64-binary: M2-Planet | results - test/test0024/hello-aarch64.sh + test/test0024/run_test.sh aarch64 test0025-aarch64-binary: M2-Planet | results - test/test0025/hello-aarch64.sh + test/test0025/run_test.sh aarch64 test0100-aarch64-binary: M2-Planet | results - test/test0100/hello-aarch64.sh + test/test0100/run_test.sh aarch64 test0101-aarch64-binary: M2-Planet | results - test/test0101/hello-aarch64.sh + test/test0101/run_test.sh aarch64 test0102-aarch64-binary: M2-Planet | results - test/test0102/hello-aarch64.sh + test/test0102/run_test.sh aarch64 test0103-aarch64-binary: M2-Planet | results - test/test0103/hello-aarch64.sh + test/test0103/run_test.sh aarch64 test0104-aarch64-binary: M2-Planet | results - test/test0104/hello-aarch64.sh + test/test0104/run_test.sh aarch64 test0105-aarch64-binary: M2-Planet | results - test/test0105/hello-aarch64.sh + test/test0105/run_test.sh aarch64 test0106-aarch64-binary: M2-Planet | results - test/test0106/hello-aarch64.sh + test/test0106/run_test.sh aarch64 test1000-aarch64-binary: M2-Planet | results test/test1000/hello-aarch64.sh test0000-amd64-binary: M2-Planet | results - test/test0000/hello-amd64.sh + test/test0000/run_test.sh amd64 test0001-amd64-binary: M2-Planet | results - test/test0001/hello-amd64.sh + test/test0001/run_test.sh amd64 test0002-amd64-binary: M2-Planet | results - test/test0002/hello-amd64.sh + test/test0002/run_test.sh amd64 test0003-amd64-binary: M2-Planet | results - test/test0003/hello-amd64.sh + test/test0003/run_test.sh amd64 test0004-amd64-binary: M2-Planet | results - test/test0004/hello-amd64.sh + test/test0004/run_test.sh amd64 test0005-amd64-binary: M2-Planet | results - test/test0005/hello-amd64.sh + test/test0005/run_test.sh amd64 test0006-amd64-binary: M2-Planet | results - test/test0006/hello-amd64.sh + test/test0006/run_test.sh amd64 test0007-amd64-binary: M2-Planet | results - test/test0007/hello-amd64.sh + test/test0007/run_test.sh amd64 test0008-amd64-binary: M2-Planet | results - test/test0008/hello-amd64.sh + test/test0008/run_test.sh amd64 test0009-amd64-binary: M2-Planet | results - test/test0009/hello-amd64.sh + test/test0009/run_test.sh amd64 test0010-amd64-binary: M2-Planet | results - test/test0010/hello-amd64.sh + test/test0010/run_test.sh amd64 test0011-amd64-binary: M2-Planet | results - test/test0011/hello-amd64.sh + test/test0011/run_test.sh amd64 test0012-amd64-binary: M2-Planet | results - test/test0012/hello-amd64.sh + test/test0012/run_test.sh amd64 test0013-amd64-binary: M2-Planet | results - test/test0013/hello-amd64.sh + test/test0013/run_test.sh amd64 test0014-amd64-binary: M2-Planet | results - test/test0014/hello-amd64.sh + test/test0014/run_test.sh amd64 test0015-amd64-binary: M2-Planet | results - test/test0015/hello-amd64.sh + test/test0015/run_test.sh amd64 test0016-amd64-binary: M2-Planet | results - test/test0016/hello-amd64.sh + test/test0016/run_test.sh amd64 test0017-amd64-binary: M2-Planet | results - test/test0017/hello-amd64.sh + test/test0017/run_test.sh amd64 test0018-amd64-binary: M2-Planet | results - test/test0018/hello-amd64.sh + test/test0018/run_test.sh amd64 test0019-amd64-binary: M2-Planet | results - test/test0019/hello-amd64.sh + test/test0019/run_test.sh amd64 test0020-amd64-binary: M2-Planet | results - test/test0020/hello-amd64.sh + test/test0020/run_test.sh amd64 test0021-amd64-binary: M2-Planet | results - test/test0021/hello-amd64.sh + test/test0021/run_test.sh amd64 test0022-amd64-binary: M2-Planet | results - test/test0022/hello-amd64.sh + test/test0022/run_test.sh amd64 test0023-amd64-binary: M2-Planet | results - test/test0023/hello-amd64.sh + test/test0023/run_test.sh amd64 test0024-amd64-binary: M2-Planet | results - test/test0024/hello-amd64.sh + test/test0024/run_test.sh amd64 test0025-amd64-binary: M2-Planet | results - test/test0025/hello-amd64.sh + test/test0025/run_test.sh amd64 test0100-amd64-binary: M2-Planet | results - test/test0100/hello-amd64.sh + test/test0100/run_test.sh amd64 test0101-amd64-binary: M2-Planet | results - test/test0101/hello-amd64.sh + test/test0101/run_test.sh amd64 test0102-amd64-binary: M2-Planet | results - test/test0102/hello-amd64.sh + test/test0102/run_test.sh amd64 test0103-amd64-binary: M2-Planet | results - test/test0103/hello-amd64.sh + test/test0103/run_test.sh amd64 test0104-amd64-binary: M2-Planet | results - test/test0104/hello-amd64.sh + test/test0104/run_test.sh amd64 test0105-amd64-binary: M2-Planet | results - test/test0105/hello-amd64.sh + test/test0105/run_test.sh amd64 test0106-amd64-binary: M2-Planet | results - test/test0106/hello-amd64.sh + test/test0106/run_test.sh amd64 test1000-amd64-binary: M2-Planet | results test/test1000/hello-amd64.sh @@ -576,205 +576,205 @@ test0106-knight-native-binary: M2-Planet | results test/test0106/hello-knight-native.sh test0000-armv7l-binary: M2-Planet | results - test/test0000/hello-armv7l.sh + test/test0000/run_test.sh armv7l test0001-armv7l-binary: M2-Planet | results - test/test0001/hello-armv7l.sh + test/test0001/run_test.sh armv7l test0002-armv7l-binary: M2-Planet | results - test/test0002/hello-armv7l.sh + test/test0002/run_test.sh armv7l test0003-armv7l-binary: M2-Planet | results - test/test0003/hello-armv7l.sh + test/test0003/run_test.sh armv7l test0004-armv7l-binary: M2-Planet | results - test/test0004/hello-armv7l.sh + test/test0004/run_test.sh armv7l test0005-armv7l-binary: M2-Planet | results - test/test0005/hello-armv7l.sh + test/test0005/run_test.sh armv7l test0006-armv7l-binary: M2-Planet | results - test/test0006/hello-armv7l.sh + test/test0006/run_test.sh armv7l test0007-armv7l-binary: M2-Planet | results - test/test0007/hello-armv7l.sh + test/test0007/run_test.sh armv7l test0008-armv7l-binary: M2-Planet | results - test/test0008/hello-armv7l.sh + test/test0008/run_test.sh armv7l test0009-armv7l-binary: M2-Planet | results - test/test0009/hello-armv7l.sh + test/test0009/run_test.sh armv7l test0010-armv7l-binary: M2-Planet | results - test/test0010/hello-armv7l.sh + test/test0010/run_test.sh armv7l test0011-armv7l-binary: M2-Planet | results - test/test0011/hello-armv7l.sh + test/test0011/run_test.sh armv7l test0012-armv7l-binary: M2-Planet | results - test/test0012/hello-armv7l.sh + test/test0012/run_test.sh armv7l test0013-armv7l-binary: M2-Planet | results - test/test0013/hello-armv7l.sh + test/test0013/run_test.sh armv7l test0014-armv7l-binary: M2-Planet | results - test/test0014/hello-armv7l.sh + test/test0014/run_test.sh armv7l test0015-armv7l-binary: M2-Planet | results - test/test0015/hello-armv7l.sh + test/test0015/run_test.sh armv7l test0016-armv7l-binary: M2-Planet | results - test/test0016/hello-armv7l.sh + test/test0016/run_test.sh armv7l test0017-armv7l-binary: M2-Planet | results - test/test0017/hello-armv7l.sh + test/test0017/run_test.sh armv7l test0018-armv7l-binary: M2-Planet | results - test/test0018/hello-armv7l.sh + test/test0018/run_test.sh armv7l test0019-armv7l-binary: M2-Planet | results - test/test0019/hello-armv7l.sh + test/test0019/run_test.sh armv7l test0020-armv7l-binary: M2-Planet | results - test/test0020/hello-armv7l.sh + test/test0020/run_test.sh armv7l test0021-armv7l-binary: M2-Planet | results - test/test0021/hello-armv7l.sh + test/test0021/run_test.sh armv7l test0022-armv7l-binary: M2-Planet | results - test/test0022/hello-armv7l.sh + test/test0022/run_test.sh armv7l test0023-armv7l-binary: M2-Planet | results - test/test0023/hello-armv7l.sh + test/test0023/run_test.sh armv7l test0024-armv7l-binary: M2-Planet | results - test/test0024/hello-armv7l.sh + test/test0024/run_test.sh armv7l test0025-armv7l-binary: M2-Planet | results - test/test0025/hello-armv7l.sh + test/test0025/run_test.sh armv7l test0100-armv7l-binary: M2-Planet | results - test/test0100/hello-armv7l.sh + test/test0100/run_test.sh armv7l test0101-armv7l-binary: M2-Planet | results - test/test0101/hello-armv7l.sh + test/test0101/run_test.sh armv7l test0102-armv7l-binary: M2-Planet | results - test/test0102/hello-armv7l.sh + test/test0102/run_test.sh armv7l test0103-armv7l-binary: M2-Planet | results - test/test0103/hello-armv7l.sh + test/test0103/run_test.sh armv7l test0104-armv7l-binary: M2-Planet | results - test/test0104/hello-armv7l.sh + test/test0104/run_test.sh armv7l test0105-armv7l-binary: M2-Planet | results - test/test0105/hello-armv7l.sh + test/test0105/run_test.sh armv7l test0106-armv7l-binary: M2-Planet | results - test/test0106/hello-armv7l.sh + test/test0106/run_test.sh armv7l test1000-armv7l-binary: M2-Planet | results test/test1000/hello-armv7l.sh test0000-x86-binary: M2-Planet | results - test/test0000/hello-x86.sh + test/test0000/run_test.sh x86 test0001-x86-binary: M2-Planet | results - test/test0001/hello-x86.sh + test/test0001/run_test.sh x86 test0002-x86-binary: M2-Planet | results - test/test0002/hello-x86.sh + test/test0002/run_test.sh x86 test0003-x86-binary: M2-Planet | results - test/test0003/hello-x86.sh + test/test0003/run_test.sh x86 test0004-x86-binary: M2-Planet | results - test/test0004/hello-x86.sh + test/test0004/run_test.sh x86 test0005-x86-binary: M2-Planet | results - test/test0005/hello-x86.sh + test/test0005/run_test.sh x86 test0006-x86-binary: M2-Planet | results - test/test0006/hello-x86.sh + test/test0006/run_test.sh x86 test0007-x86-binary: M2-Planet | results - test/test0007/hello-x86.sh + test/test0007/run_test.sh x86 test0008-x86-binary: M2-Planet | results - test/test0008/hello-x86.sh + test/test0008/run_test.sh x86 test0009-x86-binary: M2-Planet | results - test/test0009/hello-x86.sh + test/test0009/run_test.sh x86 test0010-x86-binary: M2-Planet | results - test/test0010/hello-x86.sh + test/test0010/run_test.sh x86 test0011-x86-binary: M2-Planet | results - test/test0011/hello-x86.sh + test/test0011/run_test.sh x86 test0012-x86-binary: M2-Planet | results - test/test0012/hello-x86.sh + test/test0012/run_test.sh x86 test0013-x86-binary: M2-Planet | results - test/test0013/hello-x86.sh + test/test0013/run_test.sh x86 test0014-x86-binary: M2-Planet | results - test/test0014/hello-x86.sh + test/test0014/run_test.sh x86 test0015-x86-binary: M2-Planet | results - test/test0015/hello-x86.sh + test/test0015/run_test.sh x86 test0016-x86-binary: M2-Planet | results - test/test0016/hello-x86.sh + test/test0016/run_test.sh x86 test0017-x86-binary: M2-Planet | results - test/test0017/hello-x86.sh + test/test0017/run_test.sh x86 test0018-x86-binary: M2-Planet | results - test/test0018/hello-x86.sh + test/test0018/run_test.sh x86 test0019-x86-binary: M2-Planet | results - test/test0019/hello-x86.sh + test/test0019/run_test.sh x86 test0020-x86-binary: M2-Planet | results - test/test0020/hello-x86.sh + test/test0020/run_test.sh x86 test0021-x86-binary: M2-Planet | results - test/test0021/hello-x86.sh + test/test0021/run_test.sh x86 test0022-x86-binary: M2-Planet | results - test/test0022/hello-x86.sh + test/test0022/run_test.sh x86 test0023-x86-binary: M2-Planet | results - test/test0023/hello-x86.sh + test/test0023/run_test.sh x86 test0024-x86-binary: M2-Planet | results - test/test0024/hello-x86.sh + test/test0024/run_test.sh x86 test0025-x86-binary: M2-Planet | results - test/test0025/hello-x86.sh + test/test0025/run_test.sh x86 test0100-x86-binary: M2-Planet | results - test/test0100/hello-x86.sh + test/test0100/run_test.sh x86 test0101-x86-binary: M2-Planet | results - test/test0101/hello-x86.sh + test/test0101/run_test.sh x86 test0102-x86-binary: M2-Planet | results - test/test0102/hello-x86.sh + test/test0102/run_test.sh x86 test0103-x86-binary: M2-Planet | results - test/test0103/hello-x86.sh + test/test0103/run_test.sh x86 test0104-x86-binary: M2-Planet | results - test/test0104/hello-x86.sh + test/test0104/run_test.sh x86 test0105-x86-binary: M2-Planet | results - test/test0105/hello-x86.sh + test/test0105/run_test.sh x86 test0106-x86-binary: M2-Planet | results - test/test0106/hello-x86.sh + test/test0106/run_test.sh x86 test1000-x86-binary: M2-Planet | results test/test1000/hello-x86.sh diff --git a/test/env.inc.sh b/test/env.inc.sh new file mode 100644 index 0000000..1d47732 --- /dev/null +++ b/test/env.inc.sh @@ -0,0 +1,48 @@ +## Copyright (C) 2021 deesix +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +# To be sourced from test scripts, with ARCH already set. + +case "${ARCH}" in + aarch64) + ARCH_IS_64_BITS="yes" + BASE_ADDRESS="0x00400000" + BLOOD_ELF_WORD_SIZE_FLAG="--64" + ENDIANNESS_FLAG="--little-endian" + ;; + amd64) + ARCH_IS_64_BITS="yes" + BASE_ADDRESS="0x00600000" + BLOOD_ELF_WORD_SIZE_FLAG="--64" + ENDIANNESS_FLAG="--little-endian" + ;; + armv7l) + ARCH_IS_64_BITS="no" + BASE_ADDRESS="0x00010000" + BLOOD_ELF_WORD_SIZE_FLAG="" + ENDIANNESS_FLAG="--little-endian" + ;; + x86) + ARCH_IS_64_BITS="no" + BASE_ADDRESS="0x08048000" + BLOOD_ELF_WORD_SIZE_FLAG="" + ENDIANNESS_FLAG="--little-endian" + ;; + *) + echo "$0: Unknown architecture (${ARCH})." + exit 77 + ;; +esac diff --git a/test/test.answers b/test/test.answers index 06c828f..09a32c0 100644 --- a/test/test.answers +++ b/test/test.answers @@ -30,7 +30,7 @@ c3a3da0b2ac7ef462caac44852c8a5eb368e3bf7d1cda9353b35d5a595df81a0 test/results/t 2a1d89cb448190ffa361da3d50d6c8de86c5f5a676898d75bd6d88663b3b3aeb test/results/test0004-x86-binary 5b222eeca4293ed3612fa1fca6275c849235831d8bb801ae299f429a712b9403 test/results/test0005-aarch64-binary c68c4ef34f81a44e65d3d6e8849273fde3ab092bb64413104fc04e2afba3eb38 test/results/test0005-amd64-binary -02eaf979cb1711a7cd590dc23beaa6d2c6573cce34e07fdecb9932f26c14639c test/results/test0005-armv7l-binary +adfd4764d18b06b69dcd710a2681cf6bcd71796afc870eb84fad95cd9d34d290 test/results/test0005-armv7l-binary 0c6158b6ff964ea83af1b4b7421a52ea5c045b2801dfe15a5364fe51870bb4cc test/results/test0005-knight-native-binary e34e9968c82ea72554359da38d92d0a8c68259b83d14d8f99897b4e269f13715 test/results/test0005-knight-posix-binary 037d1ac518d74124f6aaf6c6cacd35d38b3a6091786708cc8bcc3f42559bdb20 test/results/test0005-x86-binary @@ -40,7 +40,7 @@ c2deb2f279d9f25685625f94f5db4a2307f59e4bdfdde6f85cf298519967dca4 test/results/t d15bef3d26121ee7dc05826cc1b6bddf4babd1274ae4fc30dd0733705fd44d7d test/results/test0006-knight-native-binary 03610aa9f4409e29deea14ba2920a73369981b61d9e2efb53999ae472fb09e62 test/results/test0006-knight-posix-binary 6f8f93562ff5df512247524c9b8f1b106e80fedd4be690a18cdc56a6248dccf0 test/results/test0006-x86-binary -ea5caeeaf5b40793015106ca0dd2079955e80bb32cf3e102bc736c3e6c39292d test/results/test0007-aarch64-binary +926162d7f1dcfcd46e6d5826b9a3a65ceb62585fe11d5a28aed88be96613603f test/results/test0007-aarch64-binary 8004a374f99731e1c264277e89a13b6ce509e5af8dd91f307f4a36ae3010900c test/results/test0007-amd64-binary 5132b08ba97c02927a70787b99bc58e82398e1d11845bcac3ef1b8aed0a922a1 test/results/test0007-armv7l-binary 6489afacdb23afec9e6642abe2c4665653cbeebe91566a84985912351d03137b test/results/test0007-knight-native-binary @@ -48,7 +48,7 @@ ea5caeeaf5b40793015106ca0dd2079955e80bb32cf3e102bc736c3e6c39292d test/results/t 0d7e91161bd88505373e9c6f814ce90690d3a945e9f871f1c4f4aba050dad79e test/results/test0007-x86-binary b8dc6e6fa668ff3e613ae667f972cd6fd3b9e4cc17de1fcfa046e02844bcd906 test/results/test0008-aarch64-binary c71f68ef9e2741b4dda5490363125a2b11931bf0059eb7cd9bdd595ecb2918a9 test/results/test0008-amd64-binary -0802a44a7cb20af7d157b5cabdef2e969db92495eeebb7a6e11fe83f19740962 test/results/test0008-armv7l-binary +4d9d4401938e94a5ce1d921e7d24df93988dae486546422258d518ddf1374d86 test/results/test0008-armv7l-binary 08697dd3d8758b1a2ee55beb7b39ced1dd0abcc03dc5e3626ac1444a46880b56 test/results/test0008-knight-native-binary b333157869634e98ade87b5892459bd3afebb2e38d9736f914e520f0c752dcbb test/results/test0008-knight-posix-binary 17b5f6861c7344f2a210f13fef955b8077181068df71b3041dd08a23a1c2f4e1 test/results/test0008-x86-binary @@ -145,7 +145,7 @@ b4dfdb3f7cef6571968fadd3e586a19226a546b3d470cafb8b7c556e1d2d3bfd test/results/t 1077826dafc5ac7f1819357319a3d750ae982d83a8d25bedccde287f5f805a4f test/results/test0025-amd64-binary b034a738a04ec6c717abdc417b0733f3408af9961b264639444860d481f0db2b test/results/test0025-armv7l-binary d1b69f0bb8022d55cd1aa5b532ece08f3f70f222c4728130397dc837fc30102e test/results/test0025-x86-binary -23e2e22bfe9f432f35c53552c6b3e1a47182f7c1a4e48cf1b9b7b67189ba35b7 test/results/test0100-aarch64-binary +e7b32b5086a7d631a545d05ef512c70f741fc35165eebfee9a4075993d56038a test/results/test0100-aarch64-binary 6aa42a4ce991607ff88d346b5c7c7b3ad45ef586f0ee02aba3452f3739b9dfb1 test/results/test0100-amd64-binary 9e09b53286eb6dee4db32d847d67fcf3c2eb53e473be92de2ee4856afaf8dea7 test/results/test0100-armv7l-binary a0f44a9a1ba083063b9a757eb808fecede995ad1319c6c67214ac1cd156ef653 test/results/test0100-knight-posix-binary @@ -173,7 +173,7 @@ a1ba562bdb81c0451507f3b12949f50bfdf5151ed2cf583398f8d00db3242835 test/results/t 99f5ea70b5e2ca0ca67cdd230c19f467e4d62a860aa46c787e87c7a1c3f990d1 test/results/test0105-amd64-binary 487b2c5d6920ead036f19a47615b87821ecb2178949e60702f18bb546586c147 test/results/test0105-armv7l-binary 1a0d21925bf43cf6b4833a2a9350a4b1b08d6e8f5858b79116abf1c66ee1f3f5 test/results/test0105-x86-binary -bb3079247b42191a7bd60b5bec6a8235ff8370628724b5cc2a585b695fd01170 test/results/test0106-aarch64-binary +7f8bb01babab389d69f8b61221cf9e487ec6b7bb1aff6f0a4dee89d98056e0c9 test/results/test0106-aarch64-binary 53e1b665d4ab05c821ff6e1873a5b2475661a509030318f3067ae55ff08a26d7 test/results/test0106-amd64-binary 699897f817fc4df837ab1ea5c507361a4e6bd73214bb9920c3edd79d6abde06b test/results/test0106-armv7l-binary 4b02919462685bcfa15d66b7e11eace031d3f424750f89cc4d0bb739fbfb5123 test/results/test0106-knight-native-binary diff --git a/test/test0000/hello-amd64.sh b/test/test0000/hello-amd64.sh deleted file mode 100755 index 3c61e2d..0000000 --- a/test/test0000/hello-amd64.sh +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0000/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f test/test0000/return.c \ - -o ${TMPDIR}/return.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-core.M1 \ - -f ${TMPDIR}/return.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/return.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/return.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0000-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - ./test/results/test0000-amd64-binary - [ 42 = $? ] || exit 3 -fi -exit 0 diff --git a/test/test0000/hello-armv7l.sh b/test/test0000/hello-armv7l.sh deleted file mode 100755 index 9b70455..0000000 --- a/test/test0000/hello-armv7l.sh +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0000/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f test/test0000/return.c \ - -o ${TMPDIR}/return.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-core.M1 \ - -f ${TMPDIR}/return.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/return.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/return.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0000-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - ./test/results/test0000-armv7l-binary - [ 42 = $? ] || exit 3 -fi -exit 0 diff --git a/test/test0000/hello-x86.sh b/test/test0000/hello-x86.sh deleted file mode 100755 index 76aad92..0000000 --- a/test/test0000/hello-x86.sh +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0000/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f test/test0000/return.c \ - -o ${TMPDIR}/return.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-core.M1 \ - -f ${TMPDIR}/return.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/return.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/return.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0000-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - ./test/results/test0000-x86-binary - [ 42 = $? ] || exit 3 -fi -exit 0 diff --git a/test/test0000/hello-aarch64.sh b/test/test0000/run_test.sh similarity index 72% rename from test/test0000/hello-aarch64.sh rename to test/test0000/run_test.sh index c025bad..477221f 100755 --- a/test/test0000/hello-aarch64.sh +++ b/test/test0000/run_test.sh @@ -18,41 +18,44 @@ set -x -TMPDIR="test/test0000/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0000/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ + --architecture ${ARCH} \ -f test/test0000/return.c \ -o ${TMPDIR}/return.M1 \ || exit 1 # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-core.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-core.M1 \ -f ${TMPDIR}/return.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/return.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/return.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0000-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0000-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - ./test/results/test0000-aarch64-binary + ./test/results/test0000-${ARCH}-binary [ 42 = $? ] || exit 4 fi exit 0 diff --git a/test/test0001/hello-amd64.sh b/test/test0001/hello-amd64.sh deleted file mode 100755 index 181865b..0000000 --- a/test/test0001/hello-amd64.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0001/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0001/library_call.c \ - -o ${TMPDIR}/library_call.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/library_call.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/library_call.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/library_call.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0001-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0001-amd64-binary 2>&1) - [ 42 = $? ] || exit 3 - [ "$out" = "Hello mes" ] || exit 4 -fi -exit 0 diff --git a/test/test0001/hello-armv7l.sh b/test/test0001/hello-armv7l.sh deleted file mode 100755 index dab9265..0000000 --- a/test/test0001/hello-armv7l.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0001/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0001/library_call.c \ - -o ${TMPDIR}/library_call.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/library_call.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/library_call.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/library_call.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0001-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0001-armv7l-binary 2>&1) - [ 42 = $? ] || exit 3 - [ "$out" = "Hello mes" ] || exit 4 -fi -exit 0 diff --git a/test/test0001/hello-x86.sh b/test/test0001/hello-x86.sh deleted file mode 100755 index ecab79b..0000000 --- a/test/test0001/hello-x86.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0001/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0001/library_call.c \ - -o ${TMPDIR}/library_call.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/library_call.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/library_call.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/library_call.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0001-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0001-x86-binary 2>&1) - [ 42 = $? ] || exit 3 - [ "$out" = "Hello mes" ] || exit 4 -fi -exit 0 diff --git a/test/test0001/hello-aarch64.sh b/test/test0001/run_test.sh similarity index 71% rename from test/test0001/hello-aarch64.sh rename to test/test0001/run_test.sh index bec79b3..b84b19a 100755 --- a/test/test0001/hello-aarch64.sh +++ b/test/test0001/run_test.sh @@ -18,15 +18,18 @@ set -x -TMPDIR="test/test0001/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0001/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0001/library_call.c \ -o ${TMPDIR}/library_call.M1 \ @@ -34,29 +37,29 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/library_call.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/library_call.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/library_call.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0001-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0001-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0001-aarch64-binary 2>&1) + out=$(./test/results/test0001-${ARCH}-binary 2>&1) [ 42 = $? ] || exit 3 [ "$out" = "Hello mes" ] || exit 4 fi diff --git a/test/test0002/hello-amd64.sh b/test/test0002/hello-amd64.sh deleted file mode 100755 index 27fb110..0000000 --- a/test/test0002/hello-amd64.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0002/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0002/if.c \ - -o ${TMPDIR}/if.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/if.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/if.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/if.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0002-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0002-amd64-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0002/hello-armv7l.sh b/test/test0002/hello-armv7l.sh deleted file mode 100755 index ef82e79..0000000 --- a/test/test0002/hello-armv7l.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0002/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0002/if.c \ - -o ${TMPDIR}/if.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/if.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/if.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/if.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0002-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0002-armv7l-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0002/hello-x86.sh b/test/test0002/hello-x86.sh deleted file mode 100755 index dae54c6..0000000 --- a/test/test0002/hello-x86.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0002/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0002/if.c \ - -o ${TMPDIR}/if.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/if.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/if.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/if.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0002-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0002-x86-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0002/hello-aarch64.sh b/test/test0002/run_test.sh similarity index 70% rename from test/test0002/hello-aarch64.sh rename to test/test0002/run_test.sh index c24d7e8..eb2aac1 100755 --- a/test/test0002/hello-aarch64.sh +++ b/test/test0002/run_test.sh @@ -18,15 +18,18 @@ set -x -TMPDIR="test/test0002/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0002/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0002/if.c \ -o ${TMPDIR}/if.M1 \ @@ -34,29 +37,29 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/if.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/if.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/if.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0002-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0002-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0002-aarch64-binary 2>&1) + out=$(./test/results/test0002-${ARCH}-binary 2>&1) [ 42 = $? ] || exit 4 [ "$out" = "Hello mes" ] || exit 5 fi diff --git a/test/test0003/hello-amd64.sh b/test/test0003/hello-amd64.sh deleted file mode 100755 index c8f1522..0000000 --- a/test/test0003/hello-amd64.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0003/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0003/constant.c \ - -o ${TMPDIR}/constant.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/constant.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/constant.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/constant.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0003-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0003-amd64-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0003/hello-armv7l.sh b/test/test0003/hello-armv7l.sh deleted file mode 100755 index 8e58f17..0000000 --- a/test/test0003/hello-armv7l.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0003/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0003/constant.c \ - -o ${TMPDIR}/constant.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/constant.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/constant.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/constant.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0003-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0003-armv7l-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0003/hello-x86.sh b/test/test0003/hello-x86.sh deleted file mode 100755 index 0a12d8d..0000000 --- a/test/test0003/hello-x86.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0003/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0003/constant.c \ - -o ${TMPDIR}/constant.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/constant.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/constant.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/constant.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0003-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0003-x86-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0003/hello-aarch64.sh b/test/test0003/run_test.sh similarity index 70% rename from test/test0003/hello-aarch64.sh rename to test/test0003/run_test.sh index 0cba87b..145b669 100755 --- a/test/test0003/hello-aarch64.sh +++ b/test/test0003/run_test.sh @@ -18,15 +18,18 @@ set -x -TMPDIR="test/test0003/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0003/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0003/constant.c \ -o ${TMPDIR}/constant.M1 \ @@ -34,29 +37,29 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/constant.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/constant.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/constant.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0003-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0003-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0003-aarch64-binary 2>&1) + out=$(./test/results/test0003-${ARCH}-binary 2>&1) [ 42 = $? ] || exit 4 [ "$out" = "Hello mes" ] || exit 5 fi diff --git a/test/test0004/hello-amd64.sh b/test/test0004/hello-amd64.sh deleted file mode 100755 index 669bf72..0000000 --- a/test/test0004/hello-amd64.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0004/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0004/call.c \ - -o ${TMPDIR}/call.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/call.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/call.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/call.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0004-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0004-amd64-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0004/hello-armv7l.sh b/test/test0004/hello-armv7l.sh deleted file mode 100755 index 9bfbdf3..0000000 --- a/test/test0004/hello-armv7l.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0004/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0004/call.c \ - -o ${TMPDIR}/call.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/call.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/call.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/call.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0004-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0004-armv7l-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0004/hello-x86.sh b/test/test0004/hello-x86.sh deleted file mode 100755 index ac25569..0000000 --- a/test/test0004/hello-x86.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0004/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0004/call.c \ - -o ${TMPDIR}/call.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/call.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/call.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/call.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0004-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0004-x86-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0004/hello-aarch64.sh b/test/test0004/run_test.sh similarity index 70% rename from test/test0004/hello-aarch64.sh rename to test/test0004/run_test.sh index 7671cf7..cdc0d66 100755 --- a/test/test0004/hello-aarch64.sh +++ b/test/test0004/run_test.sh @@ -18,15 +18,18 @@ set -x -TMPDIR="test/test0004/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0004/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0004/call.c \ -o ${TMPDIR}/call.M1 \ @@ -34,29 +37,29 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/call.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/call.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/call.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0004-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0004-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0004-aarch64-binary 2>&1) + out=$(./test/results/test0004-${ARCH}-binary 2>&1) [ 42 = $? ] || exit 4 [ "$out" = "Hello mes" ] || exit 5 fi diff --git a/test/test0005/hello-amd64.sh b/test/test0005/hello-amd64.sh deleted file mode 100755 index c11bf4e..0000000 --- a/test/test0005/hello-amd64.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0005/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0005/string.c \ - -o ${TMPDIR}/string.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/string.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/string.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/string.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0005-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0005-amd64-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0005/hello-armv7l.sh b/test/test0005/hello-armv7l.sh deleted file mode 100755 index 1550f6f..0000000 --- a/test/test0005/hello-armv7l.sh +++ /dev/null @@ -1,70 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0005/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0005/string.c \ - --debug \ - -o ${TMPDIR}/string.M1 \ - || exit 1 - -blood-elf \ - -f ${TMPDIR}/string.M1 \ - -o ${TMPDIR}/string-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/string.M1 \ - -f ${TMPDIR}/string-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/string.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/string.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0005-armv7l-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0005-armv7l-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0005/hello-x86.sh b/test/test0005/hello-x86.sh deleted file mode 100755 index cd003d0..0000000 --- a/test/test0005/hello-x86.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0005/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0005/string.c \ - -o ${TMPDIR}/string.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/string.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/string.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/string.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0005-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0005-x86-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0005/hello-aarch64.sh b/test/test0005/run_test.sh similarity index 70% rename from test/test0005/hello-aarch64.sh rename to test/test0005/run_test.sh index 209677c..399f15d 100755 --- a/test/test0005/hello-aarch64.sh +++ b/test/test0005/run_test.sh @@ -18,15 +18,18 @@ set -x -TMPDIR="test/test0005/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0005/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0005/string.c \ -o ${TMPDIR}/string.M1 \ @@ -34,29 +37,29 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/string.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/string.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/string.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0005-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0005-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0005-aarch64-binary 2>&1) + out=$(./test/results/test0005-${ARCH}-binary 2>&1) [ 42 = $? ] || exit 4 [ "$out" = "Hello mes" ] || exit 5 fi diff --git a/test/test0006/hello-amd64.sh b/test/test0006/hello-amd64.sh deleted file mode 100755 index d60213c..0000000 --- a/test/test0006/hello-amd64.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0006/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0006/for.c \ - -o ${TMPDIR}/for.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/for.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/for.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/for.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0006-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0006-amd64-binary >| test/test0006/proof || exit 4 - out=$(sha256_check test/test0006/proof.answer) - [ "$out" = "test/test0006/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0006/hello-armv7l.sh b/test/test0006/hello-armv7l.sh deleted file mode 100755 index ac62f49..0000000 --- a/test/test0006/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0006/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0006/for.c \ - -o ${TMPDIR}/for.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/for.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/for.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/for.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0006-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0006-armv7l-binary >| test/test0006/proof || exit 4 - out=$(sha256_check test/test0006/proof.answer) - [ "$out" = "test/test0006/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0006/hello-x86.sh b/test/test0006/hello-x86.sh deleted file mode 100755 index 2f6aa0d..0000000 --- a/test/test0006/hello-x86.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0006/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0006/for.c \ - -o ${TMPDIR}/for.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/for.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/for.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/for.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0006-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0006-x86-binary >| test/test0006/proof || exit 4 - out=$(sha256_check test/test0006/proof.answer) - [ "$out" = "test/test0006/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0006/hello-aarch64.sh b/test/test0006/run_test.sh similarity index 70% rename from test/test0006/hello-aarch64.sh rename to test/test0006/run_test.sh index 12358de..498ba04 100755 --- a/test/test0006/hello-aarch64.sh +++ b/test/test0006/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0006/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0006/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0006/for.c \ -o ${TMPDIR}/for.M1 \ @@ -34,30 +37,30 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/for.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/for.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/for.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0006-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0006-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0006-aarch64-binary >| test/test0006/proof || exit 4 + ./test/results/test0006-${ARCH}-binary >| test/test0006/proof || exit 4 out=$(sha256_check test/test0006/proof.answer) [ "$out" = "test/test0006/proof: OK" ] || exit 5 fi diff --git a/test/test0007/hello-aarch64.sh b/test/test0007/hello-aarch64.sh deleted file mode 100755 index c2d15b1..0000000 --- a/test/test0007/hello-aarch64.sh +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2020-2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0007/tmp-aarch64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0007/do.c \ - --debug \ - -o ${TMPDIR}/do.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/do.M1 \ - --entry _start \ - -o ${TMPDIR}/do-footer.M1 \ - || exit 2 - - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ - -f ${TMPDIR}/do.M1 \ - -f ${TMPDIR}/do-footer.M1 \ - --little-endian \ - --architecture aarch64 \ - -o ${TMPDIR}/do.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ - -f ${TMPDIR}/do.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0007-aarch64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0007-aarch64-binary >| test/test0007/proof || exit 4 - out=$(sha256_check test/test0007/proof.answer) - [ "$out" = "test/test0007/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0007/hello-amd64.sh b/test/test0007/hello-amd64.sh deleted file mode 100755 index cb57a9d..0000000 --- a/test/test0007/hello-amd64.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0007/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0007/do.c \ - -o ${TMPDIR}/do.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/do.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/do.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/do.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0007-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0007-amd64-binary >| test/test0007/proof || exit 4 - out=$(sha256_check test/test0007/proof.answer) - [ "$out" = "test/test0007/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0007/hello-armv7l.sh b/test/test0007/hello-armv7l.sh deleted file mode 100755 index dd0e4af..0000000 --- a/test/test0007/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0007/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0007/do.c \ - -o ${TMPDIR}/do.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/do.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/do.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/do.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0007-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0007-armv7l-binary >| test/test0007/proof || exit 4 - out=$(sha256_check test/test0007/proof.answer) - [ "$out" = "test/test0007/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0007/hello-x86.sh b/test/test0007/run_test.sh similarity index 67% rename from test/test0007/hello-x86.sh rename to test/test0007/run_test.sh index 6524196..17c6f20 100755 --- a/test/test0007/hello-x86.sh +++ b/test/test0007/run_test.sh @@ -1,6 +1,6 @@ #! /bin/sh ## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix +## Copyright (C) 2020-2021 deesix ## This file is part of M2-Planet. ## ## M2-Planet is free software: you can redistribute it and/or modify @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0007/tmp-x86" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0007/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0007/do.c \ -o ${TMPDIR}/do.M1 \ @@ -34,30 +37,30 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/do.M1 \ - --little-endian \ - --architecture x86 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/do.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/do.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0007-x86-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0007-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0007-x86-binary >| test/test0007/proof || exit 4 + ./test/results/test0007-${ARCH}-binary >| test/test0007/proof || exit 4 out=$(sha256_check test/test0007/proof.answer) [ "$out" = "test/test0007/proof: OK" ] || exit 5 fi diff --git a/test/test0008/hello-amd64.sh b/test/test0008/hello-amd64.sh deleted file mode 100755 index 5784ddc..0000000 --- a/test/test0008/hello-amd64.sh +++ /dev/null @@ -1,73 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0008/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0008/struct.c \ - --debug \ - -o ${TMPDIR}/struct.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/struct.M1 \ - --entry _start \ - -o ${TMPDIR}/struct-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/struct.M1 \ - -f ${TMPDIR}/struct-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/struct.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0008-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0008-amd64-binary 2>&1 ) - [ 32 = $? ] || exit 4 - [ "$out" = "35419896642975313541989657891634" ] || exit 5 -fi -exit 0 diff --git a/test/test0008/hello-armv7l.sh b/test/test0008/hello-armv7l.sh deleted file mode 100755 index cab02fb..0000000 --- a/test/test0008/hello-armv7l.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0008/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0008/struct.c \ - -o ${TMPDIR}/struct.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/struct.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/struct.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0008-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0008-armv7l-binary 2>&1 ) - [ 16 = $? ] || exit 4 - [ "$out" = "35419896642975313541989657891634" ] || exit 5 -fi -exit 0 diff --git a/test/test0008/hello-x86.sh b/test/test0008/hello-x86.sh deleted file mode 100755 index bd3a287..0000000 --- a/test/test0008/hello-x86.sh +++ /dev/null @@ -1,72 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0008/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0008/struct.c \ - --debug \ - -o ${TMPDIR}/struct.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/struct.M1 \ - --entry _start \ - -o ${TMPDIR}/struct-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/struct.M1 \ - -f ${TMPDIR}/struct-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/struct.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0008-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0008-x86-binary 2>&1 ) - [ 16 = $? ] || exit 4 - [ "$out" = "35419896642975313541989657891634" ] || exit 5 -fi -exit 0 diff --git a/test/test0008/hello-aarch64.sh b/test/test0008/run_test.sh similarity index 68% rename from test/test0008/hello-aarch64.sh rename to test/test0008/run_test.sh index 31a4c63..91a73eb 100755 --- a/test/test0008/hello-aarch64.sh +++ b/test/test0008/run_test.sh @@ -18,15 +18,18 @@ set -x -TMPDIR="test/test0008/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0008/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0008/struct.c \ --debug \ @@ -35,7 +38,7 @@ bin/M2-Planet \ # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/struct.M1 \ --entry _start \ -o ${TMPDIR}/struct-footer.M1 \ @@ -43,31 +46,34 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/struct.M1 \ -f ${TMPDIR}/struct-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/struct.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/struct.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0008-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0008-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0008-aarch64-binary 2>&1 ) - [ 32 = $? ] || exit 4 + EXPECTED=16 + [ "yes" = "${ARCH_IS_64_BITS}" ] && EXPECTED=32 + + out=$(./test/results/test0008-${ARCH}-binary 2>&1 ) + [ ${EXPECTED} = $? ] || exit 4 [ "$out" = "35419896642975313541989657891634" ] || exit 5 fi exit 0 diff --git a/test/test0009/hello-amd64.sh b/test/test0009/hello-amd64.sh deleted file mode 100755 index 9703464..0000000 --- a/test/test0009/hello-amd64.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0009/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0009/goto.c \ - -o ${TMPDIR}/goto.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/goto.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/goto.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/goto.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0009-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0009-amd64-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0009/hello-armv7l.sh b/test/test0009/hello-armv7l.sh deleted file mode 100755 index 9cdfe6a..0000000 --- a/test/test0009/hello-armv7l.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0009/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0009/goto.c \ - -o ${TMPDIR}/goto.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/goto.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/goto.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/goto.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0009-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0009-armv7l-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0009/hello-x86.sh b/test/test0009/hello-x86.sh deleted file mode 100755 index 85557f8..0000000 --- a/test/test0009/hello-x86.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0009/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0009/goto.c \ - -o ${TMPDIR}/goto.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/goto.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/goto.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/goto.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0009-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0009-x86-binary 2>&1 ) - [ 42 = $? ] || exit 4 - [ "$out" = "Hello mes" ] || exit 5 -fi -exit 0 diff --git a/test/test0009/hello-aarch64.sh b/test/test0009/run_test.sh similarity index 70% rename from test/test0009/hello-aarch64.sh rename to test/test0009/run_test.sh index cbd540f..b8854de 100755 --- a/test/test0009/hello-aarch64.sh +++ b/test/test0009/run_test.sh @@ -18,15 +18,18 @@ set -x -TMPDIR="test/test0009/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0009/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0009/goto.c \ -o ${TMPDIR}/goto.M1 \ @@ -34,29 +37,29 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/goto.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/goto.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/goto.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0009-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0009-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0009-aarch64-binary 2>&1 ) + out=$(./test/results/test0009-${ARCH}-binary 2>&1 ) [ 42 = $? ] || exit 4 [ "$out" = "Hello mes" ] || exit 5 fi diff --git a/test/test0010/hello-amd64.sh b/test/test0010/hello-amd64.sh deleted file mode 100755 index 6515937..0000000 --- a/test/test0010/hello-amd64.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0010/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0010/nested_struct.c \ - -o ${TMPDIR}/nested_struct.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/nested_struct.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/nested_struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/nested_struct.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0010-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0010-amd64-binary 2>&1 ) - [ 24 = $? ] || exit 4 - [ "$out" = "35419896642975313541989657891634" ] || exit 5 -fi -exit 0 diff --git a/test/test0010/hello-armv7l.sh b/test/test0010/hello-armv7l.sh deleted file mode 100755 index 2a7129f..0000000 --- a/test/test0010/hello-armv7l.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0010/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0010/nested_struct.c \ - -o ${TMPDIR}/nested_struct.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/nested_struct.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/nested_struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/nested_struct.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0010-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0010-armv7l-binary 2>&1 ) - [ 12 = $? ] || exit 4 - [ "$out" = "35419896642975313541989657891634" ] || exit 5 -fi -exit 0 diff --git a/test/test0010/hello-x86.sh b/test/test0010/hello-x86.sh deleted file mode 100755 index 3ab5079..0000000 --- a/test/test0010/hello-x86.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0010/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0010/nested_struct.c \ - -o ${TMPDIR}/nested_struct.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/nested_struct.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/nested_struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/nested_struct.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0010-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0010-x86-binary 2>&1 ) - [ 12 = $? ] || exit 4 - [ "$out" = "35419896642975313541989657891634" ] || exit 5 -fi -exit 0 diff --git a/test/test0010/hello-aarch64.sh b/test/test0010/run_test.sh similarity index 67% rename from test/test0010/hello-aarch64.sh rename to test/test0010/run_test.sh index 7c446e2..6173626 100755 --- a/test/test0010/hello-aarch64.sh +++ b/test/test0010/run_test.sh @@ -18,15 +18,18 @@ set -x -TMPDIR="test/test0010/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0010/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0010/nested_struct.c \ -o ${TMPDIR}/nested_struct.M1 \ @@ -34,30 +37,33 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/nested_struct.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/nested_struct.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/nested_struct.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0010-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0010-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0010-aarch64-binary 2>&1 ) - [ 24 = $? ] || exit 4 + EXPECTED=12 + [ "yes" = "${ARCH_IS_64_BITS}" ] && EXPECTED=24 + + out=$(./test/results/test0010-${ARCH}-binary 2>&1 ) + [ ${EXPECTED} = $? ] || exit 4 [ "$out" = "35419896642975313541989657891634" ] || exit 5 fi exit 0 diff --git a/test/test0011/hello-amd64.sh b/test/test0011/hello-amd64.sh deleted file mode 100755 index f7b109b..0000000 --- a/test/test0011/hello-amd64.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0011/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0011/break-do.c \ - -o ${TMPDIR}/break-do.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/break-do.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/break-do.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/break-do.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0011-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0011-amd64-binary >| test/test0011/proof || exit 4 - out=$(sha256_check test/test0011/proof.answer) - [ "$out" = "test/test0011/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0011/hello-armv7l.sh b/test/test0011/hello-armv7l.sh deleted file mode 100755 index 326086a..0000000 --- a/test/test0011/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0011/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0011/break-do.c \ - -o ${TMPDIR}/break-do.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/break-do.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/break-do.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/break-do.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0011-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0011-armv7l-binary >| test/test0011/proof || exit 4 - out=$(sha256_check test/test0011/proof.answer) - [ "$out" = "test/test0011/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0011/hello-x86.sh b/test/test0011/hello-x86.sh deleted file mode 100755 index 21ce86f..0000000 --- a/test/test0011/hello-x86.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0011/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0011/break-do.c \ - -o ${TMPDIR}/break-do.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/break-do.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/break-do.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/break-do.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0011-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0011-x86-binary >| test/test0011/proof || exit 4 - out=$(sha256_check test/test0011/proof.answer) - [ "$out" = "test/test0011/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0011/hello-aarch64.sh b/test/test0011/run_test.sh similarity index 70% rename from test/test0011/hello-aarch64.sh rename to test/test0011/run_test.sh index 3804d8c..842261b 100755 --- a/test/test0011/hello-aarch64.sh +++ b/test/test0011/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0011/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0011/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0011/break-do.c \ -o ${TMPDIR}/break-do.M1 \ @@ -34,30 +37,30 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/break-do.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/break-do.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/break-do.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0011-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0011-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0011-aarch64-binary >| test/test0011/proof || exit 4 + ./test/results/test0011-${ARCH}-binary >| test/test0011/proof || exit 4 out=$(sha256_check test/test0011/proof.answer) [ "$out" = "test/test0011/proof: OK" ] || exit 5 fi diff --git a/test/test0012/hello-amd64.sh b/test/test0012/hello-amd64.sh deleted file mode 100755 index 5eb9829..0000000 --- a/test/test0012/hello-amd64.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0012/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0012/break-for.c \ - -o ${TMPDIR}/break-for.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/break-for.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/break-for.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/break-for.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0012-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0012-amd64-binary >| test/test0012/proof || exit 4 - out=$(sha256_check test/test0012/proof.answer) - [ "$out" = "test/test0012/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0012/hello-armv7l.sh b/test/test0012/hello-armv7l.sh deleted file mode 100755 index 981ca3a..0000000 --- a/test/test0012/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0012/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0012/break-for.c \ - -o ${TMPDIR}/break-for.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/break-for.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/break-for.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/break-for.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0012-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0012-armv7l-binary >| test/test0012/proof || exit 4 - out=$(sha256_check test/test0012/proof.answer) - [ "$out" = "test/test0012/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0012/hello-x86.sh b/test/test0012/hello-x86.sh deleted file mode 100755 index 3a40a5c..0000000 --- a/test/test0012/hello-x86.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0012/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0012/break-for.c \ - -o ${TMPDIR}/break-for.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/break-for.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/break-for.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/break-for.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0012-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0012-x86-binary >| test/test0012/proof || exit 4 - out=$(sha256_check test/test0012/proof.answer) - [ "$out" = "test/test0012/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0012/hello-aarch64.sh b/test/test0012/run_test.sh similarity index 70% rename from test/test0012/hello-aarch64.sh rename to test/test0012/run_test.sh index 5ba6ea7..e34aa31 100755 --- a/test/test0012/hello-aarch64.sh +++ b/test/test0012/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0012/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0012/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0012/break-for.c \ -o ${TMPDIR}/break-for.M1 \ @@ -34,30 +37,30 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/break-for.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/break-for.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/break-for.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0012-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0012-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0012-aarch64-binary >| test/test0012/proof || exit 4 + ./test/results/test0012-${ARCH}-binary >| test/test0012/proof || exit 4 out=$(sha256_check test/test0012/proof.answer) [ "$out" = "test/test0012/proof: OK" ] || exit 5 fi diff --git a/test/test0013/hello-amd64.sh b/test/test0013/hello-amd64.sh deleted file mode 100755 index b881216..0000000 --- a/test/test0013/hello-amd64.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0013/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0013/break-while.c \ - -o ${TMPDIR}/break-while.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/break-while.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/break-while.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/break-while.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0013-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0013-amd64-binary >| test/test0013/proof || exit 4 - out=$(sha256_check test/test0013/proof.answer) - [ "$out" = "test/test0013/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0013/hello-armv7l.sh b/test/test0013/hello-armv7l.sh deleted file mode 100755 index ad75533..0000000 --- a/test/test0013/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0013/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0013/break-while.c \ - -o ${TMPDIR}/break-while.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/break-while.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/break-while.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/break-while.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0013-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0013-armv7l-binary >| test/test0013/proof || exit 4 - out=$(sha256_check test/test0013/proof.answer) - [ "$out" = "test/test0013/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0013/hello-x86.sh b/test/test0013/hello-x86.sh deleted file mode 100755 index ff30b09..0000000 --- a/test/test0013/hello-x86.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0013/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0013/break-while.c \ - -o ${TMPDIR}/break-while.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/break-while.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/break-while.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/break-while.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0013-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0013-x86-binary >| test/test0013/proof || exit 4 - out=$(sha256_check test/test0013/proof.answer) - [ "$out" = "test/test0013/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0013/hello-aarch64.sh b/test/test0013/run_test.sh similarity index 71% rename from test/test0013/hello-aarch64.sh rename to test/test0013/run_test.sh index 9350a26..aab90cf 100755 --- a/test/test0013/hello-aarch64.sh +++ b/test/test0013/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0013/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0013/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0013/break-while.c \ -o ${TMPDIR}/break-while.M1 \ @@ -34,30 +37,30 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/break-while.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/break-while.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/break-while.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0013-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0013-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0013-aarch64-binary >| test/test0013/proof || exit 4 + ./test/results/test0013-${ARCH}-binary >| test/test0013/proof || exit 4 out=$(sha256_check test/test0013/proof.answer) [ "$out" = "test/test0013/proof: OK" ] || exit 5 fi diff --git a/test/test0014/hello-amd64.sh b/test/test0014/hello-amd64.sh deleted file mode 100755 index 7819d3a..0000000 --- a/test/test0014/hello-amd64.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0014/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0014/basic_args.c \ - -o ${TMPDIR}/basic_args.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/basic_args.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/basic_args.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/basic_args.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0014-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0014-amd64-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test0014/proof || exit 4 - out=$(sha256_check test/test0014/proof-amd64.answer) - [ "$out" = "test/test0014/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0014/hello-armv7l.sh b/test/test0014/hello-armv7l.sh deleted file mode 100755 index 59bddfd..0000000 --- a/test/test0014/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0014/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0014/basic_args.c \ - -o ${TMPDIR}/basic_args.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/basic_args.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/basic_args.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/basic_args.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0014-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0014-armv7l-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test0014/proof || exit 4 - out=$(sha256_check test/test0014/proof-armv7l.answer) - [ "$out" = "test/test0014/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0014/hello-x86.sh b/test/test0014/hello-x86.sh deleted file mode 100755 index bc8b6d2..0000000 --- a/test/test0014/hello-x86.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0014/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0014/basic_args.c \ - -o ${TMPDIR}/basic_args.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/basic_args.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/basic_args.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/basic_args.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0014-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0014-x86-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test0014/proof || exit 4 - out=$(sha256_check test/test0014/proof-x86.answer) - [ "$out" = "test/test0014/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0014/hello-aarch64.sh b/test/test0014/run_test.sh similarity index 69% rename from test/test0014/hello-aarch64.sh rename to test/test0014/run_test.sh index dc5242d..052242e 100755 --- a/test/test0014/hello-aarch64.sh +++ b/test/test0014/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0014/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0014/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0014/basic_args.c \ -o ${TMPDIR}/basic_args.M1 \ @@ -34,31 +37,31 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/basic_args.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/basic_args.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/basic_args.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0014-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0014-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0014-aarch64-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test0014/proof || exit 4 - out=$(sha256_check test/test0014/proof-aarch64.answer) + ./test/results/test0014-${ARCH}-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test0014/proof || exit 4 + out=$(sha256_check test/test0014/proof-${ARCH}.answer) [ "$out" = "test/test0014/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test0015/hello-amd64.sh b/test/test0015/hello-amd64.sh deleted file mode 100755 index 2c39d24..0000000 --- a/test/test0015/hello-amd64.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0015/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0015/file_read.c \ - -o ${TMPDIR}/file_read.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/file_read.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/file_read.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/file_read.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0015-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0015-amd64-binary test/test0015/file_read.c >| test/test0015/proof || exit 4 - out=$(sha256_check test/test0015/proof.answer) - [ "$out" = "test/test0015/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0015/hello-armv7l.sh b/test/test0015/hello-armv7l.sh deleted file mode 100755 index 810477a..0000000 --- a/test/test0015/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0015/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0015/file_read.c \ - -o ${TMPDIR}/file_read.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/file_read.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/file_read.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/file_read.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0015-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0015-armv7l-binary test/test0015/file_read.c >| test/test0015/proof || exit 4 - out=$(sha256_check test/test0015/proof.answer) - [ "$out" = "test/test0015/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0015/hello-x86.sh b/test/test0015/hello-x86.sh deleted file mode 100755 index 963c067..0000000 --- a/test/test0015/hello-x86.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0015/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0015/file_read.c \ - -o ${TMPDIR}/file_read.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/file_read.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/file_read.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/file_read.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0015-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0015-x86-binary test/test0015/file_read.c >| test/test0015/proof || exit 4 - out=$(sha256_check test/test0015/proof.answer) - [ "$out" = "test/test0015/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0015/hello-aarch64.sh b/test/test0015/run_test.sh similarity index 71% rename from test/test0015/hello-aarch64.sh rename to test/test0015/run_test.sh index 48acb0a..b77c7d3 100755 --- a/test/test0015/hello-aarch64.sh +++ b/test/test0015/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0015/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0015/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0015/file_read.c \ -o ${TMPDIR}/file_read.M1 \ @@ -34,30 +37,30 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/file_read.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/file_read.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/file_read.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0015-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0015-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0015-aarch64-binary test/test0015/file_read.c >| test/test0015/proof || exit 4 + ./test/results/test0015-${ARCH}-binary test/test0015/file_read.c >| test/test0015/proof || exit 4 out=$(sha256_check test/test0015/proof.answer) [ "$out" = "test/test0015/proof: OK" ] || exit 5 fi diff --git a/test/test0016/hello-amd64.sh b/test/test0016/hello-amd64.sh deleted file mode 100755 index 9f8d33e..0000000 --- a/test/test0016/hello-amd64.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0016/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0016/file_write.c \ - -o ${TMPDIR}/file_write.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/file_write.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/file_write.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/file_write.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0016-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0016-amd64-binary test/test0016/proof || exit 4 - out=$(sha256_check test/test0016/proof.answer) - [ "$out" = "test/test0016/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0016/hello-armv7l.sh b/test/test0016/hello-armv7l.sh deleted file mode 100755 index 716d9ed..0000000 --- a/test/test0016/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0016/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0016/file_write.c \ - -o ${TMPDIR}/file_write.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/file_write.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/file_write.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/file_write.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0016-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0016-armv7l-binary test/test0016/proof || exit 4 - out=$(sha256_check test/test0016/proof.answer) - [ "$out" = "test/test0016/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0016/hello-x86.sh b/test/test0016/hello-x86.sh deleted file mode 100755 index ff7b168..0000000 --- a/test/test0016/hello-x86.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0016/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0016/file_write.c \ - -o ${TMPDIR}/file_write.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/file_write.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/file_write.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/file_write.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0016-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0016-x86-binary test/test0016/proof || exit 4 - out=$(sha256_check test/test0016/proof.answer) - [ "$out" = "test/test0016/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0016/hello-aarch64.sh b/test/test0016/run_test.sh similarity index 71% rename from test/test0016/hello-aarch64.sh rename to test/test0016/run_test.sh index e421bfc..54986a1 100755 --- a/test/test0016/hello-aarch64.sh +++ b/test/test0016/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0016/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0016/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0016/file_write.c \ -o ${TMPDIR}/file_write.M1 \ @@ -34,30 +37,30 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/file_write.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/file_write.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/file_write.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0016-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0016-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0016-aarch64-binary test/test0016/proof || exit 4 + ./test/results/test0016-${ARCH}-binary test/test0016/proof || exit 4 out=$(sha256_check test/test0016/proof.answer) [ "$out" = "test/test0016/proof: OK" ] || exit 5 fi diff --git a/test/test0017/hello-amd64.sh b/test/test0017/hello-amd64.sh deleted file mode 100755 index 005d00a..0000000 --- a/test/test0017/hello-amd64.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0017/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0017/memset.c \ - -o ${TMPDIR}/memset.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/memset.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/memset.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/memset.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0017-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0017-amd64-binary >| test/test0017/proof || exit 4 - out=$(sha256_check test/test0017/proof.answer) - [ "$out" = "test/test0017/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0017/hello-armv7l.sh b/test/test0017/hello-armv7l.sh deleted file mode 100755 index 9ce100e..0000000 --- a/test/test0017/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0017/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0017/memset.c \ - -o ${TMPDIR}/memset.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/memset.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/memset.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/memset.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0017-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0017-armv7l-binary >| test/test0017/proof || exit 4 - out=$(sha256_check test/test0017/proof.answer) - [ "$out" = "test/test0017/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0017/hello-x86.sh b/test/test0017/hello-x86.sh deleted file mode 100755 index 67de167..0000000 --- a/test/test0017/hello-x86.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0017/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0017/memset.c \ - -o ${TMPDIR}/memset.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/memset.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/memset.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/memset.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0017-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0017-x86-binary >| test/test0017/proof || exit 4 - out=$(sha256_check test/test0017/proof.answer) - [ "$out" = "test/test0017/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0017/hello-aarch64.sh b/test/test0017/run_test.sh similarity index 70% rename from test/test0017/hello-aarch64.sh rename to test/test0017/run_test.sh index 401ad13..712a545 100755 --- a/test/test0017/hello-aarch64.sh +++ b/test/test0017/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0017/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0017/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0017/memset.c \ -o ${TMPDIR}/memset.M1 \ @@ -34,30 +37,30 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/memset.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/memset.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/memset.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0017-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0017-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0017-aarch64-binary >| test/test0017/proof || exit 4 + ./test/results/test0017-${ARCH}-binary >| test/test0017/proof || exit 4 out=$(sha256_check test/test0017/proof.answer) [ "$out" = "test/test0017/proof: OK" ] || exit 5 fi diff --git a/test/test0018/hello-amd64.sh b/test/test0018/hello-amd64.sh deleted file mode 100755 index f723498..0000000 --- a/test/test0018/hello-amd64.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0018/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0018/math.c \ - -o ${TMPDIR}/math.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/math.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/math.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/math.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0018-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0018-amd64-binary >| test/test0018/proof || exit 4 - out=$(sha256_check test/test0018/proof.answer) - [ "$out" = "test/test0018/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0018/hello-armv7l.sh b/test/test0018/hello-armv7l.sh deleted file mode 100755 index f877e75..0000000 --- a/test/test0018/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0018/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0018/math.c \ - -o ${TMPDIR}/math.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/math.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/math.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/math.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0018-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0018-armv7l-binary >| test/test0018/proof || exit 4 - out=$(sha256_check test/test0018/proof.answer) - [ "$out" = "test/test0018/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0018/hello-x86.sh b/test/test0018/hello-x86.sh deleted file mode 100755 index 3d0e39c..0000000 --- a/test/test0018/hello-x86.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0018/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0018/math.c \ - -o ${TMPDIR}/math.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/math.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/math.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/math.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0018-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0018-x86-binary >| test/test0018/proof || exit 4 - out=$(sha256_check test/test0018/proof.answer) - [ "$out" = "test/test0018/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0018/hello-aarch64.sh b/test/test0018/run_test.sh similarity index 70% rename from test/test0018/hello-aarch64.sh rename to test/test0018/run_test.sh index bc34406..a18bfcf 100755 --- a/test/test0018/hello-aarch64.sh +++ b/test/test0018/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0018/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0018/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0018/math.c \ -o ${TMPDIR}/math.M1 \ @@ -34,30 +37,30 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/math.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/math.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/math.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0018-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0018-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0018-aarch64-binary >| test/test0018/proof || exit 4 + ./test/results/test0018-${ARCH}-binary >| test/test0018/proof || exit 4 out=$(sha256_check test/test0018/proof.answer) [ "$out" = "test/test0018/proof: OK" ] || exit 5 fi diff --git a/test/test0019/hello-amd64.sh b/test/test0019/hello-amd64.sh deleted file mode 100755 index e58cbcc..0000000 --- a/test/test0019/hello-amd64.sh +++ /dev/null @@ -1,68 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0019/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/file_print.c \ - -f test/test0019/getopt.c \ - -o ${TMPDIR}/getopt.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/getopt.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/getopt.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/getopt.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0019-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0019-amd64-binary -f test/test0019/input -o test/test0019/proof || exit 4 - out=$(sha256_check test/test0019/proof.answer) - [ "$out" = "test/test0019/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0019/hello-armv7l.sh b/test/test0019/hello-armv7l.sh deleted file mode 100755 index 8257724..0000000 --- a/test/test0019/hello-armv7l.sh +++ /dev/null @@ -1,68 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0019/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/file_print.c \ - -f test/test0019/getopt.c \ - -o ${TMPDIR}/getopt.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/getopt.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/getopt.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/getopt.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0019-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0019-armv7l-binary -f test/test0019/input -o test/test0019/proof || exit 4 - out=$(sha256_check test/test0019/proof.answer) - [ "$out" = "test/test0019/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0019/hello-x86.sh b/test/test0019/hello-x86.sh deleted file mode 100755 index d1952e3..0000000 --- a/test/test0019/hello-x86.sh +++ /dev/null @@ -1,68 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0019/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/file_print.c \ - -f test/test0019/getopt.c \ - -o ${TMPDIR}/getopt.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/getopt.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/getopt.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/getopt.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0019-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0019-x86-binary -f test/test0019/input -o test/test0019/proof || exit 4 - out=$(sha256_check test/test0019/proof.answer) - [ "$out" = "test/test0019/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0019/hello-aarch64.sh b/test/test0019/run_test.sh similarity index 72% rename from test/test0019/hello-aarch64.sh rename to test/test0019/run_test.sh index 90d6e35..de6dabe 100755 --- a/test/test0019/hello-aarch64.sh +++ b/test/test0019/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0019/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0019/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f functions/match.c \ -f functions/in_set.c \ @@ -38,30 +41,30 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/getopt.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/getopt.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/getopt.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0019-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0019-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0019-aarch64-binary -f test/test0019/input -o test/test0019/proof || exit 4 + ./test/results/test0019-${ARCH}-binary -f test/test0019/input -o test/test0019/proof || exit 4 out=$(sha256_check test/test0019/proof.answer) [ "$out" = "test/test0019/proof: OK" ] || exit 5 fi diff --git a/test/test0020/hello-amd64.sh b/test/test0020/hello-amd64.sh deleted file mode 100755 index 7a03519..0000000 --- a/test/test0020/hello-amd64.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0020/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0020/struct.c \ - -o ${TMPDIR}/struct.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/struct.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/struct.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0020-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0020-amd64-binary 2>&1 ) - [ 40 = $? ] || exit 4 - [ "$out" = "35419896642975313541989657891634" ] || exit 5 -fi -exit 0 diff --git a/test/test0020/hello-armv7l.sh b/test/test0020/hello-armv7l.sh deleted file mode 100755 index fe62cf6..0000000 --- a/test/test0020/hello-armv7l.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0020/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0020/struct.c \ - -o ${TMPDIR}/struct.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/struct.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/struct.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0020-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0020-armv7l-binary 2>&1 ) - [ 20 = $? ] || exit 4 - [ "$out" = "35419896642975313541989657891634" ] || exit 5 -fi -exit 0 diff --git a/test/test0020/hello-x86.sh b/test/test0020/hello-x86.sh deleted file mode 100755 index a9b7817..0000000 --- a/test/test0020/hello-x86.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0020/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0020/struct.c \ - -o ${TMPDIR}/struct.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/struct.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/struct.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0020-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0020-x86-binary 2>&1 ) - [ 20 = $? ] || exit 4 - [ "$out" = "35419896642975313541989657891634" ] || exit 5 -fi -exit 0 diff --git a/test/test0020/hello-aarch64.sh b/test/test0020/run_test.sh similarity index 67% rename from test/test0020/hello-aarch64.sh rename to test/test0020/run_test.sh index 1b99e56..a7e425c 100755 --- a/test/test0020/hello-aarch64.sh +++ b/test/test0020/run_test.sh @@ -18,15 +18,18 @@ set -x -TMPDIR="test/test0020/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0020/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0020/struct.c \ -o ${TMPDIR}/struct.M1 \ @@ -34,30 +37,33 @@ bin/M2-Planet \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/struct.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/struct.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/struct.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0020-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0020-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0020-aarch64-binary 2>&1 ) - [ 40 = $? ] || exit 4 + EXPECTED=20 + [ "yes" = "${ARCH_IS_64_BITS}" ] && EXPECTED=40 + + out=$(./test/results/test0020-${ARCH}-binary 2>&1 ) + [ ${EXPECTED} = $? ] || exit 4 [ "$out" = "35419896642975313541989657891634" ] || exit 5 fi exit 0 diff --git a/test/test0021/hello-amd64.sh b/test/test0021/hello-amd64.sh deleted file mode 100755 index 24a0d06..0000000 --- a/test/test0021/hello-amd64.sh +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0021/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test0021/chdir.c \ - --debug \ - -o ${TMPDIR}/chdir.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/chdir.M1 \ - --entry _start \ - -o ${TMPDIR}/chdir-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/chdir.M1 \ - -f ${TMPDIR}/chdir-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/chdir.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/chdir.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0021-amd64-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0021-amd64-binary - [ 0 = $? ] || exit 5 -fi -exit 0 diff --git a/test/test0021/hello-armv7l.sh b/test/test0021/hello-armv7l.sh deleted file mode 100755 index 0ee4673..0000000 --- a/test/test0021/hello-armv7l.sh +++ /dev/null @@ -1,74 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0021/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test0021/chdir.c \ - --debug \ - -o ${TMPDIR}/chdir.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/chdir.M1 \ - --entry _start \ - -o ${TMPDIR}/chdir-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/chdir.M1 \ - -f ${TMPDIR}/chdir-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/chdir.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/chdir.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0021-armv7l-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0021-armv7l-binary - [ 0 = $? ] || exit 5 -fi -exit 0 diff --git a/test/test0021/hello-knight-posix.sh b/test/test0021/hello-knight-posix.sh index 30ae202..e5f7b25 100755 --- a/test/test0021/hello-knight-posix.sh +++ b/test/test0021/hello-knight-posix.sh @@ -16,7 +16,7 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex TMPDIR="test/test0021/tmp-knight-posix" mkdir -p ${TMPDIR} diff --git a/test/test0021/hello-x86.sh b/test/test0021/hello-x86.sh deleted file mode 100755 index 7a01163..0000000 --- a/test/test0021/hello-x86.sh +++ /dev/null @@ -1,74 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0021/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test0021/chdir.c \ - --debug \ - -o ${TMPDIR}/chdir.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/chdir.M1 \ - --entry _start \ - -o ${TMPDIR}/chdir-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/chdir.M1 \ - -f ${TMPDIR}/chdir-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/chdir.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/chdir.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0021-x86-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0021-x86-binary - [ 0 = $? ] || exit 5 -fi -exit 0 diff --git a/test/test0021/hello-aarch64.sh b/test/test0021/run_test.sh similarity index 71% rename from test/test0021/hello-aarch64.sh rename to test/test0021/run_test.sh index 41f6179..6b87260 100755 --- a/test/test0021/hello-aarch64.sh +++ b/test/test0021/run_test.sh @@ -16,17 +16,20 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex + +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0021/tmp-${ARCH}" -TMPDIR="test/test0021/tmp-aarch64" mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f functions/match.c \ -f functions/file_print.c \ @@ -37,7 +40,7 @@ bin/M2-Planet \ # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/chdir.M1 \ --entry _start \ -o ${TMPDIR}/chdir-footer.M1 \ @@ -45,31 +48,31 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/chdir.M1 \ -f ${TMPDIR}/chdir-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/chdir.hex2 \ || exit 3 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/chdir.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0021-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0021-${ARCH}-binary \ || exit 4 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0021-aarch64-binary + ./test/results/test0021-${ARCH}-binary [ 0 = $? ] || exit 5 fi exit 0 diff --git a/test/test0022/hello-amd64.sh b/test/test0022/hello-amd64.sh deleted file mode 100755 index a7a1fc9..0000000 --- a/test/test0022/hello-amd64.sh +++ /dev/null @@ -1,78 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0022/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/file_print.c \ - -f test/test0022/continue.c \ - --debug \ - -o ${TMPDIR}/continue.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/continue.M1 \ - --entry _start \ - -o ${TMPDIR}/continue-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/continue.M1 \ - -f ${TMPDIR}/continue-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/continue.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/continue.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0022-amd64-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0022-amd64-binary >| test/test0022/proof - [ 0 = $? ] || exit 5 - out=$(sha256_check test/test0022/proof.answer) - [ "$out" = "test/test0022/proof: OK" ] || exit 6 -fi -exit 0 diff --git a/test/test0022/hello-armv7l.sh b/test/test0022/hello-armv7l.sh deleted file mode 100755 index 0aeb015..0000000 --- a/test/test0022/hello-armv7l.sh +++ /dev/null @@ -1,77 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0022/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/file_print.c \ - -f test/test0022/continue.c \ - --debug \ - -o ${TMPDIR}/continue.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/continue.M1 \ - --entry _start \ - -o ${TMPDIR}/continue-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/continue.M1 \ - -f ${TMPDIR}/continue-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/continue.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/continue.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0022-armv7l-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0022-armv7l-binary >| test/test0022/proof - [ 0 = $? ] || exit 5 - out=$(sha256_check test/test0022/proof.answer) - [ "$out" = "test/test0022/proof: OK" ] || exit 6 -fi -exit 0 diff --git a/test/test0022/hello-knight-posix.sh b/test/test0022/hello-knight-posix.sh index 40bc001..0102506 100755 --- a/test/test0022/hello-knight-posix.sh +++ b/test/test0022/hello-knight-posix.sh @@ -16,7 +16,7 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex TMPDIR="test/test0022/tmp-knight-posix" mkdir -p ${TMPDIR} diff --git a/test/test0022/hello-x86.sh b/test/test0022/hello-x86.sh deleted file mode 100755 index 1d6dcd4..0000000 --- a/test/test0022/hello-x86.sh +++ /dev/null @@ -1,77 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0022/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/file_print.c \ - -f test/test0022/continue.c \ - --debug \ - -o ${TMPDIR}/continue.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/continue.M1 \ - --entry _start \ - -o ${TMPDIR}/continue-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/continue.M1 \ - -f ${TMPDIR}/continue-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/continue.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/continue.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0022-x86-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0022-x86-binary >| test/test0022/proof - [ 0 = $? ] || exit 5 - out=$(sha256_check test/test0022/proof.answer) - [ "$out" = "test/test0022/proof: OK" ] || exit 6 -fi -exit 0 diff --git a/test/test0022/hello-aarch64.sh b/test/test0022/run_test.sh similarity index 72% rename from test/test0022/hello-aarch64.sh rename to test/test0022/run_test.sh index 63c7933..728a1d8 100755 --- a/test/test0022/hello-aarch64.sh +++ b/test/test0022/run_test.sh @@ -16,17 +16,20 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex + +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0022/tmp-${ARCH}" -TMPDIR="test/test0022/tmp-aarch64" mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f functions/in_set.c \ -f functions/numerate_number.c \ @@ -38,7 +41,7 @@ bin/M2-Planet \ # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/continue.M1 \ --entry _start \ -o ${TMPDIR}/continue-footer.M1 \ @@ -46,31 +49,31 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/continue.M1 \ -f ${TMPDIR}/continue-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/continue.hex2 \ || exit 3 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/continue.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0022-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0022-${ARCH}-binary \ || exit 4 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0022-aarch64-binary >| test/test0022/proof + ./test/results/test0022-${ARCH}-binary >| test/test0022/proof [ 0 = $? ] || exit 5 out=$(sha256_check test/test0022/proof.answer) [ "$out" = "test/test0022/proof: OK" ] || exit 6 diff --git a/test/test0023/hello-amd64.sh b/test/test0023/hello-amd64.sh deleted file mode 100755 index 53c90b1..0000000 --- a/test/test0023/hello-amd64.sh +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0023/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0023/fseek.c \ - --debug \ - -o ${TMPDIR}/fseek.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/fseek.M1 \ - --entry _start \ - -o ${TMPDIR}/fseek-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/fseek.M1 \ - -f ${TMPDIR}/fseek-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/fseek.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/fseek.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0023-amd64-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0023-amd64-binary test/test0023/question >| test/test0023/proof - [ 0 = $? ] || exit 5 - out=$(sha256_check test/test0023/proof.answer) - [ "$out" = "test/test0023/proof: OK" ] || exit 6 -fi -exit 0 diff --git a/test/test0023/hello-armv7l.sh b/test/test0023/hello-armv7l.sh deleted file mode 100755 index 0d9c837..0000000 --- a/test/test0023/hello-armv7l.sh +++ /dev/null @@ -1,74 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0023/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0023/fseek.c \ - --debug \ - -o ${TMPDIR}/fseek.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/fseek.M1 \ - --entry _start \ - -o ${TMPDIR}/fseek-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/fseek.M1 \ - -f ${TMPDIR}/fseek-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/fseek.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/fseek.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0023-armv7l-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0023-armv7l-binary test/test0023/question >| test/test0023/proof - [ 0 = $? ] || exit 5 - out=$(sha256_check test/test0023/proof.answer) - [ "$out" = "test/test0023/proof: OK" ] || exit 6 -fi -exit 0 diff --git a/test/test0023/hello-knight-posix.sh b/test/test0023/hello-knight-posix.sh index 37d9839..e53a936 100755 --- a/test/test0023/hello-knight-posix.sh +++ b/test/test0023/hello-knight-posix.sh @@ -16,7 +16,7 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex TMPDIR="test/test0023/tmp-knight-posix" mkdir -p ${TMPDIR} diff --git a/test/test0023/hello-x86.sh b/test/test0023/hello-x86.sh deleted file mode 100755 index b7270ad..0000000 --- a/test/test0023/hello-x86.sh +++ /dev/null @@ -1,74 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0023/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0023/fseek.c \ - --debug \ - -o ${TMPDIR}/fseek.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/fseek.M1 \ - --entry _start \ - -o ${TMPDIR}/fseek-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/fseek.M1 \ - -f ${TMPDIR}/fseek-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/fseek.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/fseek.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0023-x86-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0023-x86-binary test/test0023/question >| test/test0023/proof - [ 0 = $? ] || exit 5 - out=$(sha256_check test/test0023/proof.answer) - [ "$out" = "test/test0023/proof: OK" ] || exit 6 -fi -exit 0 diff --git a/test/test0023/hello-aarch64.sh b/test/test0023/run_test.sh similarity index 71% rename from test/test0023/hello-aarch64.sh rename to test/test0023/run_test.sh index ecc2d97..93a2daa 100755 --- a/test/test0023/hello-aarch64.sh +++ b/test/test0023/run_test.sh @@ -16,17 +16,20 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex + +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0023/tmp-${ARCH}" -TMPDIR="test/test0023/tmp-aarch64" mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0023/fseek.c \ --debug \ @@ -35,7 +38,7 @@ bin/M2-Planet \ # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/fseek.M1 \ --entry _start \ -o ${TMPDIR}/fseek-footer.M1 \ @@ -43,31 +46,31 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/fseek.M1 \ -f ${TMPDIR}/fseek-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/fseek.hex2 \ || exit 3 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/fseek.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0023-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0023-${ARCH}-binary \ || exit 4 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0023-aarch64-binary test/test0023/question >| test/test0023/proof + ./test/results/test0023-${ARCH}-binary test/test0023/question >| test/test0023/proof [ 0 = $? ] || exit 5 out=$(sha256_check test/test0023/proof.answer) [ "$out" = "test/test0023/proof: OK" ] || exit 6 diff --git a/test/test0024/hello-amd64.sh b/test/test0024/hello-amd64.sh deleted file mode 100755 index a72c437..0000000 --- a/test/test0024/hello-amd64.sh +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0024/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f test/test0024/return.c \ - -o ${TMPDIR}/return.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-core.M1 \ - -f ${TMPDIR}/return.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/return.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/return.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0024-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - ./test/results/test0024-amd64-binary - [ 42 = $? ] || exit 3 -fi -exit 0 diff --git a/test/test0024/hello-armv7l.sh b/test/test0024/hello-armv7l.sh deleted file mode 100755 index 8d81b35..0000000 --- a/test/test0024/hello-armv7l.sh +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0024/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f test/test0024/return.c \ - -o ${TMPDIR}/return.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-core.M1 \ - -f ${TMPDIR}/return.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/return.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/return.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0024-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - ./test/results/test0024-armv7l-binary - [ 42 = $? ] || exit 3 -fi -exit 0 diff --git a/test/test0024/hello-x86.sh b/test/test0024/hello-x86.sh deleted file mode 100755 index 3d1effd..0000000 --- a/test/test0024/hello-x86.sh +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0024/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f test/test0024/return.c \ - -o ${TMPDIR}/return.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-core.M1 \ - -f ${TMPDIR}/return.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/return.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/return.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0024-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - ./test/results/test0024-x86-binary - [ 42 = $? ] || exit 3 -fi -exit 0 diff --git a/test/test0024/hello-aarch64.sh b/test/test0024/run_test.sh similarity index 72% rename from test/test0024/hello-aarch64.sh rename to test/test0024/run_test.sh index 7cbd9a5..7567113 100755 --- a/test/test0024/hello-aarch64.sh +++ b/test/test0024/run_test.sh @@ -18,41 +18,44 @@ set -x -TMPDIR="test/test0024/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0024/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ + --architecture ${ARCH} \ -f test/test0024/return.c \ -o ${TMPDIR}/return.M1 \ || exit 1 # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-core.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-core.M1 \ -f ${TMPDIR}/return.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/return.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/return.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0024-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0024-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - ./test/results/test0024-aarch64-binary + ./test/results/test0024-${ARCH}-binary [ 42 = $? ] || exit 4 fi exit 0 diff --git a/test/test0025/hello-amd64.sh b/test/test0025/hello-amd64.sh deleted file mode 100755 index 1103fe1..0000000 --- a/test/test0025/hello-amd64.sh +++ /dev/null @@ -1,73 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0025/tmp-amd64" -mkdir -p ${TMPDIR} - -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0025/array.c \ - --debug \ - -o ${TMPDIR}/array.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/array.M1 \ - --entry _start \ - -o ${TMPDIR}/array-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/array.M1 \ - -f ${TMPDIR}/array-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/array.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/array.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0025-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0025-amd64-binary 2>| test/test0025/proof || exit 4 - out=$(sha256_check test/test0025/proof.answer) - [ "$out" = "test/test0025/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0025/hello-armv7l.sh b/test/test0025/hello-armv7l.sh deleted file mode 100755 index ccba7e3..0000000 --- a/test/test0025/hello-armv7l.sh +++ /dev/null @@ -1,73 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0025/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0025/array.c \ - --debug \ - -o ${TMPDIR}/array.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/array.M1 \ - --entry _start \ - -o ${TMPDIR}/array-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/array.M1 \ - -f ${TMPDIR}/array-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/array.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/array.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0025-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0025-armv7l-binary 2>| test/test0025/proof || exit 4 - out=$(sha256_check test/test0025/proof.answer) - [ "$out" = "test/test0025/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0025/hello-x86.sh b/test/test0025/hello-x86.sh deleted file mode 100755 index 69ad3c7..0000000 --- a/test/test0025/hello-x86.sh +++ /dev/null @@ -1,73 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0025/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0025/array.c \ - --debug \ - -o ${TMPDIR}/array.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/array.M1 \ - --entry _start \ - -o ${TMPDIR}/array-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/array.M1 \ - -f ${TMPDIR}/array-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/array.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/array.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0025-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0025-x86-binary 2>| test/test0025/proof || exit 4 - out=$(sha256_check test/test0025/proof.answer) - [ "$out" = "test/test0025/proof: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0025/hello-aarch64.sh b/test/test0025/run_test.sh similarity index 71% rename from test/test0025/hello-aarch64.sh rename to test/test0025/run_test.sh index 9e90f15..5f97d09 100755 --- a/test/test0025/hello-aarch64.sh +++ b/test/test0025/run_test.sh @@ -18,15 +18,18 @@ set -ex -TMPDIR="test/test0025/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0025/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0025/array.c \ --debug \ @@ -35,7 +38,7 @@ bin/M2-Planet \ # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/array.M1 \ --entry _start \ -o ${TMPDIR}/array-footer.M1 \ @@ -43,31 +46,31 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/array.M1 \ -f ${TMPDIR}/array-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/array.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/array.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0025-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0025-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the resulting file works - ./test/results/test0025-aarch64-binary 2>| test/test0025/proof || exit 4 + ./test/results/test0025-${ARCH}-binary 2>| test/test0025/proof || exit 4 out=$(sha256_check test/test0025/proof.answer) [ "$out" = "test/test0025/proof: OK" ] || exit 5 fi diff --git a/test/test0100/hello-amd64.sh b/test/test0100/hello-amd64.sh deleted file mode 100755 index b780d55..0000000 --- a/test/test0100/hello-amd64.sh +++ /dev/null @@ -1,82 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0100/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f test/test0100/blood-elf.c \ - --debug \ - -o ${TMPDIR}/blood-elf.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/blood-elf.M1 \ - --entry _start \ - -o ${TMPDIR}/blood-elf-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/blood-elf.M1 \ - -f ${TMPDIR}/blood-elf-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/blood-elf.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/blood-elf.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0100-amd64-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0100-amd64-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "blood-elf 0.1 -(Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6 - - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0100-amd64-binary -f test/test0100/test.M1 -o test/test0100/proof || exit 7 - out=$(sha256_check test/test0100/proof.answer) - [ "$out" = "test/test0100/proof: OK" ] || exit 8 -fi -exit 0 diff --git a/test/test0100/hello-armv7l.sh b/test/test0100/hello-armv7l.sh deleted file mode 100755 index aebc75b..0000000 --- a/test/test0100/hello-armv7l.sh +++ /dev/null @@ -1,81 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0100/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f test/test0100/blood-elf.c \ - --debug \ - -o ${TMPDIR}/blood-elf.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/blood-elf.M1 \ - --entry _start \ - -o ${TMPDIR}/blood-elf-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/blood-elf.M1 \ - -f ${TMPDIR}/blood-elf-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/blood-elf.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/blood-elf.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0100-armv7l-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0100-armv7l-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "blood-elf 0.1 -(Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6 - - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0100-armv7l-binary -f test/test0100/test.M1 -o test/test0100/proof || exit 7 - out=$(sha256_check test/test0100/proof.answer) - [ "$out" = "test/test0100/proof: OK" ] || exit 8 -fi -exit 0 diff --git a/test/test0100/hello-knight-posix.sh b/test/test0100/hello-knight-posix.sh index a3a9ca0..917fc04 100755 --- a/test/test0100/hello-knight-posix.sh +++ b/test/test0100/hello-knight-posix.sh @@ -16,7 +16,7 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex TMPDIR="test/test0100/tmp-knight-posix" mkdir -p ${TMPDIR} diff --git a/test/test0100/hello-x86.sh b/test/test0100/hello-x86.sh deleted file mode 100755 index 5477892..0000000 --- a/test/test0100/hello-x86.sh +++ /dev/null @@ -1,81 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0100/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f test/test0100/blood-elf.c \ - --debug \ - -o ${TMPDIR}/blood-elf.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/blood-elf.M1 \ - --entry _start \ - -o ${TMPDIR}/blood-elf-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/blood-elf.M1 \ - -f ${TMPDIR}/blood-elf-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/blood-elf.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/blood-elf.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0100-x86-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0100-x86-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "blood-elf 0.1 -(Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6 - - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0100-x86-binary -f test/test0100/test.M1 -o test/test0100/proof || exit 7 - out=$(sha256_check test/test0100/proof.answer) - [ "$out" = "test/test0100/proof: OK" ] || exit 8 -fi -exit 0 diff --git a/test/test0100/hello-aarch64.sh b/test/test0100/run_test.sh similarity index 72% rename from test/test0100/hello-aarch64.sh rename to test/test0100/run_test.sh index 66ced76..c3fd31f 100755 --- a/test/test0100/hello-aarch64.sh +++ b/test/test0100/run_test.sh @@ -16,17 +16,20 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex + +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0100/tmp-${ARCH}" -TMPDIR="test/test0100/tmp-aarch64" mkdir -p ${TMPDIR} # Build the test ./bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f functions/file_print.c \ -f functions/match.c \ @@ -37,7 +40,7 @@ mkdir -p ${TMPDIR} # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/blood-elf.M1 \ --entry _start \ -o ${TMPDIR}/blood-elf-footer.M1 \ @@ -45,37 +48,37 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/blood-elf.M1 \ -f ${TMPDIR}/blood-elf-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/blood-elf.hex2 \ || exit 3 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/blood-elf.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0100-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0100-${ARCH}-binary \ || exit 4 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0100-aarch64-binary --version 2>&1 ) + out=$(./test/results/test0100-${ARCH}-binary --version 2>&1 ) [ 0 = $? ] || exit 5 [ "$out" = "blood-elf 0.1 (Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6 . ./sha256.sh # Verify that the resulting file works - ./test/results/test0100-aarch64-binary -f test/test0100/test.M1 -o test/test0100/proof || exit 7 + ./test/results/test0100-${ARCH}-binary -f test/test0100/test.M1 -o test/test0100/proof || exit 7 out=$(sha256_check test/test0100/proof.answer) [ "$out" = "test/test0100/proof: OK" ] || exit 8 fi diff --git a/test/test0101/hello-amd64.sh b/test/test0101/hello-amd64.sh deleted file mode 100755 index dd03bf3..0000000 --- a/test/test0101/hello-amd64.sh +++ /dev/null @@ -1,90 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0101/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f test/test0101/hex2_linker.c \ - --debug \ - -o ${TMPDIR}/hex2_linker.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/hex2_linker.M1 \ - --entry _start \ - -o ${TMPDIR}/hex2_linker-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/hex2_linker.M1 \ - -f ${TMPDIR}/hex2_linker-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/hex2_linker.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/hex2_linker.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0101-amd64-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0101-amd64-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "hex2 0.3" ] || exit 6 - - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0101-amd64-binary \ - -f M2libc/x86/ELF-x86.hex2 \ - -f test/test0101/test.hex2 \ - --LittleEndian \ - --architecture x86 \ - --BaseAddress 0x8048000 \ - -o test/test0101/proof \ - || exit 7 - out=$(sha256_check test/test0101/proof.answer) - [ "$out" = "test/test0101/proof: OK" ] || exit 8 -fi -exit 0 diff --git a/test/test0101/hello-armv7l.sh b/test/test0101/hello-armv7l.sh deleted file mode 100755 index 317d623..0000000 --- a/test/test0101/hello-armv7l.sh +++ /dev/null @@ -1,89 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0101/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f test/test0101/hex2_linker.c \ - --debug \ - -o ${TMPDIR}/hex2_linker.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/hex2_linker.M1 \ - --entry _start \ - -o ${TMPDIR}/hex2_linker-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/hex2_linker.M1 \ - -f ${TMPDIR}/hex2_linker-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/hex2_linker.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/hex2_linker.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0101-armv7l-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0101-armv7l-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "hex2 0.3" ] || exit 6 - - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0101-armv7l-binary \ - -f M2libc/x86/ELF-x86.hex2 \ - -f test/test0101/test.hex2 \ - --LittleEndian \ - --architecture x86 \ - --BaseAddress 0x8048000 \ - -o test/test0101/proof \ - || exit 7 - out=$(sha256_check test/test0101/proof.answer) - [ "$out" = "test/test0101/proof: OK" ] || exit 8 -fi -exit 0 diff --git a/test/test0101/hello-knight-posix.sh b/test/test0101/hello-knight-posix.sh index 1727a51..1443822 100755 --- a/test/test0101/hello-knight-posix.sh +++ b/test/test0101/hello-knight-posix.sh @@ -16,7 +16,7 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex TMPDIR="test/test0101/tmp-knight-posix" mkdir -p ${TMPDIR} diff --git a/test/test0101/hello-x86.sh b/test/test0101/hello-x86.sh deleted file mode 100755 index 3583e74..0000000 --- a/test/test0101/hello-x86.sh +++ /dev/null @@ -1,89 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0101/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f test/test0101/hex2_linker.c \ - --debug \ - -o ${TMPDIR}/hex2_linker.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/hex2_linker.M1 \ - --entry _start \ - -o ${TMPDIR}/hex2_linker-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/hex2_linker.M1 \ - -f ${TMPDIR}/hex2_linker-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/hex2_linker.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/hex2_linker.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0101-x86-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0101-x86-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "hex2 0.3" ] || exit 6 - - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0101-x86-binary \ - -f M2libc/x86/ELF-x86.hex2 \ - -f test/test0101/test.hex2 \ - --LittleEndian \ - --architecture x86 \ - --BaseAddress 0x8048000 \ - -o test/test0101/proof \ - || exit 7 - out=$(sha256_check test/test0101/proof.answer) - [ "$out" = "test/test0101/proof: OK" ] || exit 8 -fi -exit 0 diff --git a/test/test0101/hello-aarch64.sh b/test/test0101/run_test.sh similarity index 75% rename from test/test0101/hello-aarch64.sh rename to test/test0101/run_test.sh index 89243ec..c94ed4a 100755 --- a/test/test0101/hello-aarch64.sh +++ b/test/test0101/run_test.sh @@ -16,17 +16,20 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex + +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0101/tmp-${ARCH}" -TMPDIR="test/test0101/tmp-aarch64" mkdir -p ${TMPDIR} # Build the test ./bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f functions/file_print.c \ -f functions/match.c \ @@ -39,7 +42,7 @@ mkdir -p ${TMPDIR} # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/hex2_linker.M1 \ --entry _start \ -o ${TMPDIR}/hex2_linker-footer.M1 \ @@ -47,36 +50,36 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/hex2_linker.M1 \ -f ${TMPDIR}/hex2_linker-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/hex2_linker.hex2 \ || exit 3 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/hex2_linker.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0101-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0101-${ARCH}-binary \ || exit 4 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0101-aarch64-binary --version 2>&1 ) + out=$(./test/results/test0101-${ARCH}-binary --version 2>&1 ) [ 0 = $? ] || exit 5 [ "$out" = "hex2 0.3" ] || exit 6 . ./sha256.sh # Verify that the resulting file works - ./test/results/test0101-aarch64-binary \ + ./test/results/test0101-${ARCH}-binary \ -f M2libc/x86/ELF-x86.hex2 \ -f test/test0101/test.hex2 \ --LittleEndian \ diff --git a/test/test0102/hello-amd64.sh b/test/test0102/hello-amd64.sh deleted file mode 100755 index e6312f3..0000000 --- a/test/test0102/hello-amd64.sh +++ /dev/null @@ -1,93 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0102/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/string.c \ - -f functions/require.c \ - -f test/test0102/M1-macro.c \ - --debug \ - -o ${TMPDIR}/M1-macro.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/M1-macro.M1 \ - --entry _start \ - -o ${TMPDIR}/M1-macro-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/M1-macro.M1 \ - -f ${TMPDIR}/M1-macro-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/M1-macro.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/M1-macro.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0102-amd64-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0102-amd64-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "M1 1.0.0" ] || exit 6 - - # Verify that the resulting file works - ./test/results/test0102-amd64-binary \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-core.M1 \ - -f test/test0100/test.M1 \ - --little-endian \ - --architecture x86 \ - -o test/test0102/proof \ - || exit 7 - - . ./sha256.sh - out=$(sha256_check test/test0102/proof.answer) - [ "$out" = "test/test0102/proof: OK" ] || exit 8 -fi -exit 0 diff --git a/test/test0102/hello-armv7l.sh b/test/test0102/hello-armv7l.sh deleted file mode 100755 index 7f8c725..0000000 --- a/test/test0102/hello-armv7l.sh +++ /dev/null @@ -1,92 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0102/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/string.c \ - -f functions/require.c \ - -f test/test0102/M1-macro.c \ - --debug \ - -o ${TMPDIR}/M1-macro.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/M1-macro.M1 \ - --entry _start \ - -o ${TMPDIR}/M1-macro-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/M1-macro.M1 \ - -f ${TMPDIR}/M1-macro-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/M1-macro.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/M1-macro.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0102-armv7l-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0102-armv7l-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "M1 1.0.0" ] || exit 6 - - # Verify that the resulting file works - ./test/results/test0102-armv7l-binary \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-core.M1 \ - -f test/test0100/test.M1 \ - --little-endian \ - --architecture x86 \ - -o test/test0102/proof \ - || exit 7 - - . ./sha256.sh - out=$(sha256_check test/test0102/proof.answer) - [ "$out" = "test/test0102/proof: OK" ] || exit 8 -fi -exit 0 diff --git a/test/test0102/hello-knight-posix.sh b/test/test0102/hello-knight-posix.sh index bae8df5..cd84ef5 100755 --- a/test/test0102/hello-knight-posix.sh +++ b/test/test0102/hello-knight-posix.sh @@ -16,7 +16,7 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex TMPDIR="test/test0102/tmp-knight-posix" mkdir -p ${TMPDIR} diff --git a/test/test0102/hello-x86.sh b/test/test0102/hello-x86.sh deleted file mode 100755 index 3c67f4b..0000000 --- a/test/test0102/hello-x86.sh +++ /dev/null @@ -1,92 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0102/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/string.c \ - -f functions/require.c \ - -f test/test0102/M1-macro.c \ - --debug \ - -o ${TMPDIR}/M1-macro.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/M1-macro.M1 \ - --entry _start \ - -o ${TMPDIR}/M1-macro-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/M1-macro.M1 \ - -f ${TMPDIR}/M1-macro-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/M1-macro.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/M1-macro.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0102-x86-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0102-x86-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "M1 1.0.0" ] || exit 6 - - # Verify that the resulting file works - ./test/results/test0102-x86-binary \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-core.M1 \ - -f test/test0100/test.M1 \ - --little-endian \ - --architecture x86 \ - -o test/test0102/proof \ - || exit 7 - - . ./sha256.sh - out=$(sha256_check test/test0102/proof.answer) - [ "$out" = "test/test0102/proof: OK" ] || exit 8 -fi -exit 0 diff --git a/test/test0102/hello-aarch64.sh b/test/test0102/run_test.sh similarity index 74% rename from test/test0102/hello-aarch64.sh rename to test/test0102/run_test.sh index 6095dd3..8d43cb1 100755 --- a/test/test0102/hello-aarch64.sh +++ b/test/test0102/run_test.sh @@ -16,17 +16,20 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex + +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0102/tmp-${ARCH}" -TMPDIR="test/test0102/tmp-aarch64" mkdir -p ${TMPDIR} # Build the test ./bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f functions/file_print.c \ -f functions/match.c \ @@ -41,7 +44,7 @@ mkdir -p ${TMPDIR} # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/M1-macro.M1 \ --entry _start \ -o ${TMPDIR}/M1-macro-footer.M1 \ @@ -49,39 +52,39 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/M1-macro.M1 \ -f ${TMPDIR}/M1-macro-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/M1-macro.hex2 \ || exit 3 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/M1-macro.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0102-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0102-${ARCH}-binary \ || exit 4 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0102-aarch64-binary --version 2>&1 ) + out=$(./test/results/test0102-${ARCH}-binary --version 2>&1 ) [ 0 = $? ] || exit 5 [ "$out" = "M1 1.0.0" ] || exit 6 # Verify that the resulting file works - ./test/results/test0102-aarch64-binary \ + ./test/results/test0102-${ARCH}-binary \ -f M2libc/x86/x86_defs.M1 \ -f M2libc/x86/libc-core.M1 \ -f test/test0100/test.M1 \ - --little-endian \ + ${ENDIANNESS_FLAG} \ --architecture x86 \ -o test/test0102/proof \ || exit 7 diff --git a/test/test0103/hello-amd64.sh b/test/test0103/hello-amd64.sh deleted file mode 100755 index bd0b484..0000000 --- a/test/test0103/hello-amd64.sh +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0103/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f test/test0103/get_machine.c \ - --debug \ - -o ${TMPDIR}/get_machine.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/get_machine.M1 \ - --entry _start \ - -o ${TMPDIR}/get_machine-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/get_machine.M1 \ - -f ${TMPDIR}/get_machine-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/get_machine.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/get_machine.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0103-amd64-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0103-amd64-binary ${GET_MACHINE_FLAGS} 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "amd64" ] || exit 6 -fi -exit 0 diff --git a/test/test0103/hello-armv7l.sh b/test/test0103/hello-armv7l.sh deleted file mode 100755 index b0295e2..0000000 --- a/test/test0103/hello-armv7l.sh +++ /dev/null @@ -1,74 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0103/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f test/test0103/get_machine.c \ - --debug \ - -o ${TMPDIR}/get_machine.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/get_machine.M1 \ - --entry _start \ - -o ${TMPDIR}/get_machine-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/get_machine.M1 \ - -f ${TMPDIR}/get_machine-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/get_machine.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/get_machine.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0103-armv7l-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0103-armv7l-binary ${GET_MACHINE_FLAGS} 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "armv7l" ] || exit 6 -fi -exit 0 diff --git a/test/test0103/hello-knight-posix.sh b/test/test0103/hello-knight-posix.sh index 2495b0b..ebb8fc4 100755 --- a/test/test0103/hello-knight-posix.sh +++ b/test/test0103/hello-knight-posix.sh @@ -16,7 +16,7 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex TMPDIR="test/test0103/tmp-knight-posix" mkdir -p ${TMPDIR} diff --git a/test/test0103/hello-x86.sh b/test/test0103/hello-x86.sh deleted file mode 100755 index c9f6d05..0000000 --- a/test/test0103/hello-x86.sh +++ /dev/null @@ -1,74 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0103/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f test/test0103/get_machine.c \ - --debug \ - -o ${TMPDIR}/get_machine.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/get_machine.M1 \ - --entry _start \ - -o ${TMPDIR}/get_machine-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/get_machine.M1 \ - -f ${TMPDIR}/get_machine-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/get_machine.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/get_machine.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0103-x86-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0103-x86-binary ${GET_MACHINE_FLAGS} 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "x86" ] || exit 6 -fi -exit 0 diff --git a/test/test0103/hello-aarch64.sh b/test/test0103/run_test.sh similarity index 70% rename from test/test0103/hello-aarch64.sh rename to test/test0103/run_test.sh index 9182149..cc39376 100755 --- a/test/test0103/hello-aarch64.sh +++ b/test/test0103/run_test.sh @@ -16,17 +16,20 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex + +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0103/tmp-${ARCH}" -TMPDIR="test/test0103/tmp-aarch64" mkdir -p ${TMPDIR} # Build the test ./bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f functions/file_print.c \ -f functions/match.c \ @@ -37,7 +40,7 @@ mkdir -p ${TMPDIR} # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/get_machine.M1 \ --entry _start \ -o ${TMPDIR}/get_machine-footer.M1 \ @@ -45,31 +48,31 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/get_machine.M1 \ -f ${TMPDIR}/get_machine-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/get_machine.hex2 \ || exit 3 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/get_machine.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0103-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0103-${ARCH}-binary \ || exit 4 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0103-aarch64-binary ${GET_MACHINE_FLAGS} 2>&1 ) + out=$(./test/results/test0103-${ARCH}-binary ${GET_MACHINE_FLAGS} 2>&1 ) [ 0 = $? ] || exit 5 - [ "$out" = "aarch64" ] || exit 6 + [ "$out" = "${ARCH}" ] || exit 6 fi exit 0 diff --git a/test/test0104/hello-amd64.sh b/test/test0104/hello-amd64.sh deleted file mode 100755 index 057f208..0000000 --- a/test/test0104/hello-amd64.sh +++ /dev/null @@ -1,80 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0104/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f test/test0104/kaem.c \ - --debug \ - -o ${TMPDIR}/kaem.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/kaem.M1 \ - --entry _start \ - -o ${TMPDIR}/kaem-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/kaem.M1 \ - -f ${TMPDIR}/kaem-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/kaem.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/kaem.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0104-amd64-binary \ - || exit 4 - -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0104-amd64-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "kaem version 0.6.0" ] || exit 6 - - # Verify that the resulting file works - out=$(./test/results/test0104-amd64-binary --file test/test0104/kaem.run) - [ "$out" = "hello world" ] || exit 7 -fi -exit 0 diff --git a/test/test0104/hello-armv7l.sh b/test/test0104/hello-armv7l.sh deleted file mode 100755 index fa15a32..0000000 --- a/test/test0104/hello-armv7l.sh +++ /dev/null @@ -1,79 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0104/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f test/test0104/kaem.c \ - --debug \ - -o ${TMPDIR}/kaem.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/kaem.M1 \ - --entry _start \ - -o ${TMPDIR}/kaem-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/kaem.M1 \ - -f ${TMPDIR}/kaem-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/kaem.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/kaem.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0104-armv7l-binary \ - || exit 4 - -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0104-armv7l-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "kaem version 0.6.0" ] || exit 6 - - # Verify that the resulting file works - out=$(./test/results/test0104-armv7l-binary --file test/test0104/kaem.run) - [ "$out" = "hello world" ] || exit 7 -fi -exit 0 diff --git a/test/test0104/hello-x86.sh b/test/test0104/hello-x86.sh deleted file mode 100755 index df0ac74..0000000 --- a/test/test0104/hello-x86.sh +++ /dev/null @@ -1,79 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0104/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f functions/file_print.c \ - -f functions/match.c \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f test/test0104/kaem.c \ - --debug \ - -o ${TMPDIR}/kaem.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/kaem.M1 \ - --entry _start \ - -o ${TMPDIR}/kaem-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/kaem.M1 \ - -f ${TMPDIR}/kaem-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/kaem.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/kaem.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0104-x86-binary \ - || exit 4 - -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0104-x86-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "kaem version 0.6.0" ] || exit 6 - - # Verify that the resulting file works - out=$(./test/results/test0104-x86-binary --file test/test0104/kaem.run) - [ "$out" = "hello world" ] || exit 7 -fi -exit 0 diff --git a/test/test0104/hello-aarch64.sh b/test/test0104/run_test.sh similarity index 70% rename from test/test0104/hello-aarch64.sh rename to test/test0104/run_test.sh index d2db015..19cc25e 100755 --- a/test/test0104/hello-aarch64.sh +++ b/test/test0104/run_test.sh @@ -16,17 +16,20 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex + +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0104/tmp-${ARCH}" -TMPDIR="test/test0104/tmp-aarch64" mkdir -p ${TMPDIR} # Build the test ./bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f functions/file_print.c \ -f functions/match.c \ @@ -39,7 +42,7 @@ mkdir -p ${TMPDIR} # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/kaem.M1 \ --entry _start \ -o ${TMPDIR}/kaem-footer.M1 \ @@ -47,34 +50,34 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/kaem.M1 \ -f ${TMPDIR}/kaem-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/kaem.hex2 \ || exit 3 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/kaem.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0104-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0104-${ARCH}-binary \ || exit 4 -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0104-aarch64-binary --version 2>&1 ) + out=$(./test/results/test0104-${ARCH}-binary --version 2>&1 ) [ 0 = $? ] || exit 5 [ "$out" = "kaem version 0.6.0" ] || exit 6 # Verify that the resulting file works - out=$(./test/results/test0104-aarch64-binary --file test/test0104/kaem.run) + out=$(./test/results/test0104-${ARCH}-binary --file test/test0104/kaem.run) [ "$out" = "hello world" ] || exit 7 fi exit 0 diff --git a/test/test0105/hello-amd64.sh b/test/test0105/hello-amd64.sh deleted file mode 100755 index 25da7fc..0000000 --- a/test/test0105/hello-amd64.sh +++ /dev/null @@ -1,86 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0105/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0105/lisp.h \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test0105/lisp.c \ - -f test/test0105/lisp_cell.c \ - -f test/test0105/lisp_eval.c \ - -f test/test0105/lisp_print.c \ - -f test/test0105/lisp_read.c \ - --debug \ - -o ${TMPDIR}/lisp.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - --64 \ - -f ${TMPDIR}/lisp.M1 \ - --entry _start \ - -o ${TMPDIR}/lisp-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/lisp.M1 \ - -f ${TMPDIR}/lisp-footer.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/lisp.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64-debug.hex2 \ - -f ${TMPDIR}/lisp.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0105-amd64-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0105-amd64-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "Slow_Lisp 0.1" ] || exit 6 - - # Verify that the resulting file works - out=$(./test/results/test0105-amd64-binary --file test/test0105/test.scm) - [ "$out" = "42" ] || exit 7 -fi -exit 0 diff --git a/test/test0105/hello-armv7l.sh b/test/test0105/hello-armv7l.sh deleted file mode 100755 index 04d9b95..0000000 --- a/test/test0105/hello-armv7l.sh +++ /dev/null @@ -1,85 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0105/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0105/lisp.h \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test0105/lisp.c \ - -f test/test0105/lisp_cell.c \ - -f test/test0105/lisp_eval.c \ - -f test/test0105/lisp_print.c \ - -f test/test0105/lisp_read.c \ - --debug \ - -o ${TMPDIR}/lisp.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/lisp.M1 \ - --entry _start \ - -o ${TMPDIR}/lisp-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/lisp.M1 \ - -f ${TMPDIR}/lisp-footer.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/lisp.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l-debug.hex2 \ - -f ${TMPDIR}/lisp.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0105-armv7l-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0105-armv7l-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "Slow_Lisp 0.1" ] || exit 6 - - # Verify that the resulting file works - out=$(./test/results/test0105-armv7l-binary --file test/test0105/test.scm) - [ "$out" = "42" ] || exit 7 -fi -exit 0 diff --git a/test/test0105/hello-x86.sh b/test/test0105/hello-x86.sh deleted file mode 100755 index ad3230b..0000000 --- a/test/test0105/hello-x86.sh +++ /dev/null @@ -1,85 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -x - -TMPDIR="test/test0105/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0105/lisp.h \ - -f functions/in_set.c \ - -f functions/numerate_number.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test0105/lisp.c \ - -f test/test0105/lisp_cell.c \ - -f test/test0105/lisp_eval.c \ - -f test/test0105/lisp_print.c \ - -f test/test0105/lisp_read.c \ - --debug \ - -o ${TMPDIR}/lisp.M1 \ - || exit 1 - -# Build debug footer -blood-elf \ - -f ${TMPDIR}/lisp.M1 \ - --entry _start \ - -o ${TMPDIR}/lisp-footer.M1 \ - || exit 2 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/lisp.M1 \ - -f ${TMPDIR}/lisp-footer.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/lisp.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86-debug.hex2 \ - -f ${TMPDIR}/lisp.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0105-x86-binary \ - || exit 4 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0105-x86-binary --version 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "Slow_Lisp 0.1" ] || exit 6 - - # Verify that the resulting file works - out=$(./test/results/test0105-x86-binary --file test/test0105/test.scm) - [ "$out" = "42" ] || exit 7 -fi -exit 0 diff --git a/test/test0105/hello-aarch64.sh b/test/test0105/run_test.sh similarity index 73% rename from test/test0105/hello-aarch64.sh rename to test/test0105/run_test.sh index 2de7f4f..48cb56e 100755 --- a/test/test0105/hello-aarch64.sh +++ b/test/test0105/run_test.sh @@ -16,17 +16,20 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -set -x +set -ex + +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0105/tmp-${ARCH}" -TMPDIR="test/test0105/tmp-aarch64" mkdir -p ${TMPDIR} # Build the test ./bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0105/lisp.h \ -f functions/in_set.c \ @@ -44,7 +47,7 @@ mkdir -p ${TMPDIR} # Build debug footer blood-elf \ - --64 \ + ${BLOOD_ELF_WORD_SIZE_FLAG} \ -f ${TMPDIR}/lisp.M1 \ --entry _start \ -o ${TMPDIR}/lisp-footer.M1 \ @@ -52,35 +55,35 @@ blood-elf \ # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/lisp.M1 \ -f ${TMPDIR}/lisp-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/lisp.hex2 \ || exit 3 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ -f ${TMPDIR}/lisp.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0105-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0105-${ARCH}-binary \ || exit 4 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test0105-aarch64-binary --version 2>&1 ) + out=$(./test/results/test0105-${ARCH}-binary --version 2>&1 ) [ 0 = $? ] || exit 5 [ "$out" = "Slow_Lisp 0.1" ] || exit 6 # Verify that the resulting file works - out=$(./test/results/test0105-aarch64-binary --file test/test0105/test.scm) + out=$(./test/results/test0105-${ARCH}-binary --file test/test0105/test.scm) [ "$out" = "42" ] || exit 7 fi exit 0 diff --git a/test/test0106/hello-amd64.sh b/test/test0106/hello-amd64.sh deleted file mode 100755 index b191bc4..0000000 --- a/test/test0106/hello-amd64.sh +++ /dev/null @@ -1,72 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0106/tmp-amd64" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture amd64 \ - -f M2libc/amd64/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/amd64/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0106/cc500.c \ - -o ${TMPDIR}/cc0.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/amd64/amd64_defs.M1 \ - -f M2libc/amd64/libc-full.M1 \ - -f ${TMPDIR}/cc0.M1 \ - --little-endian \ - --architecture amd64 \ - -o ${TMPDIR}/cc0.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/amd64/ELF-amd64.hex2 \ - -f ${TMPDIR}/cc0.hex2 \ - --little-endian \ - --architecture amd64 \ - --base-address 0x00600000 \ - -o test/results/test0106-amd64-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] -then - . ./sha256.sh - # Verify that the compiled program can compile itself - ./test/results/test0106-amd64-binary < test/test0106/cc500.c >| test/test0106/cc1 || exit 4 - out=$(sha256_check test/test0106/proof0.answer) - [ "$out" = "test/test0106/cc1: OK" ] || exit 5 - - # Make it executable - chmod u+x test/test0106/cc1 - - # Verify that the result of it compiling itself can compile itself - ./test/test0106/cc1 < test/test0106/cc500.c >| test/test0106/cc2 || exit 6 - out=$(sha256_check test/test0106/proof1.answer) - [ "$out" = "test/test0106/cc2: OK" ] || exit 7 -fi -exit 0 diff --git a/test/test0106/hello-armv7l.sh b/test/test0106/hello-armv7l.sh deleted file mode 100755 index 6261aff..0000000 --- a/test/test0106/hello-armv7l.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0106/tmp-armv7l" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture armv7l \ - -f M2libc/armv7l/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/armv7l/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0106/cc500.c \ - -o ${TMPDIR}/cc0.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/armv7l/armv7l_defs.M1 \ - -f M2libc/armv7l/libc-full.M1 \ - -f ${TMPDIR}/cc0.M1 \ - --little-endian \ - --architecture armv7l \ - -o ${TMPDIR}/cc0.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/armv7l/ELF-armv7l.hex2 \ - -f ${TMPDIR}/cc0.hex2 \ - --little-endian \ - --architecture armv7l \ - --base-address 0x10000 \ - -o test/results/test0106-armv7l-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] -then - . ./sha256.sh - # Verify that the compiled program can compile itself - ./test/results/test0106-armv7l-binary < test/test0106/cc500.c >| test/test0106/cc1 || exit 4 - out=$(sha256_check test/test0106/proof0.answer) - [ "$out" = "test/test0106/cc1: OK" ] || exit 5 -fi -exit 0 diff --git a/test/test0106/hello-x86.sh b/test/test0106/hello-x86.sh deleted file mode 100755 index b26b292..0000000 --- a/test/test0106/hello-x86.sh +++ /dev/null @@ -1,72 +0,0 @@ -#! /bin/sh -## Copyright (C) 2017 Jeremiah Orians -## Copyright (C) 2021 deesix -## This file is part of M2-Planet. -## -## M2-Planet is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## M2-Planet is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with M2-Planet. If not, see . - -set -ex - -TMPDIR="test/test0106/tmp-x86" -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture x86 \ - -f M2libc/x86/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/x86/Linux/fcntl.h \ - -f M2libc/stdio.c \ - -f test/test0106/cc500.c \ - -o ${TMPDIR}/cc0.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-full.M1 \ - -f ${TMPDIR}/cc0.M1 \ - --little-endian \ - --architecture x86 \ - -o ${TMPDIR}/cc0.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/x86/ELF-x86.hex2 \ - -f ${TMPDIR}/cc0.hex2 \ - --little-endian \ - --architecture x86 \ - --base-address 0x8048000 \ - -o test/results/test0106-x86-binary \ - || exit 3 - -# Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] -then - . ./sha256.sh - # Verify that the compiled program can compile itself - ./test/results/test0106-x86-binary < test/test0106/cc500.c >| test/test0106/cc1 || exit 4 - out=$(sha256_check test/test0106/proof0.answer) - [ "$out" = "test/test0106/cc1: OK" ] || exit 5 - - # Make it executable - chmod u+x test/test0106/cc1 - - # Verify that the result of it compiling itself can compile itself - ./test/test0106/cc1 < test/test0106/cc500.c >| test/test0106/cc2 || exit 6 - out=$(sha256_check test/test0106/proof1.answer) - [ "$out" = "test/test0106/cc2: OK" ] || exit 7 -fi -exit 0 diff --git a/test/test0106/hello-aarch64.sh b/test/test0106/run_test.sh similarity index 67% rename from test/test0106/hello-aarch64.sh rename to test/test0106/run_test.sh index bf50e60..b4fc1e1 100755 --- a/test/test0106/hello-aarch64.sh +++ b/test/test0106/run_test.sh @@ -18,55 +18,49 @@ set -ex -TMPDIR="test/test0106/tmp-aarch64" +ARCH="$1" +. test/env.inc.sh +TMPDIR="test/test0106/tmp-${ARCH}" + mkdir -p ${TMPDIR} # Build the test bin/M2-Planet \ - --architecture aarch64 \ - -f M2libc/aarch64/Linux/unistd.h \ + --architecture ${ARCH} \ + -f M2libc/${ARCH}/Linux/unistd.h \ -f M2libc/stdlib.c \ - -f M2libc/aarch64/Linux/fcntl.h \ + -f M2libc/${ARCH}/Linux/fcntl.h \ -f M2libc/stdio.c \ -f test/test0106/cc500.c \ - --debug \ -o ${TMPDIR}/cc0.M1 \ || exit 1 -blood-elf \ - --64 \ - -f ${TMPDIR}/cc0.M1 \ - --entry _start \ - -o ${TMPDIR}/cc0-footer.M1 \ - || exit 2 - # Macro assemble with libc written in M1-Macro M1 \ - -f M2libc/aarch64/aarch64_defs.M1 \ - -f M2libc/aarch64/libc-full.M1 \ + -f M2libc/${ARCH}/${ARCH}_defs.M1 \ + -f M2libc/${ARCH}/libc-full.M1 \ -f ${TMPDIR}/cc0.M1 \ - -f ${TMPDIR}/cc0-footer.M1 \ - --little-endian \ - --architecture aarch64 \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ -o ${TMPDIR}/cc0.hex2 \ || exit 2 # Resolve all linkages hex2 \ - -f M2libc/aarch64/ELF-aarch64-debug.hex2 \ + -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ -f ${TMPDIR}/cc0.hex2 \ - --little-endian \ - --architecture aarch64 \ - --base-address 0x400000 \ - -o test/results/test0106-aarch64-binary \ + ${ENDIANNESS_FLAG} \ + --architecture ${ARCH} \ + --base-address ${BASE_ADDRESS} \ + -o test/results/test0106-${ARCH}-binary \ || exit 3 # Ensure binary works if host machine supports test -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] then . ./sha256.sh # Verify that the compiled program can compile itself - ./test/results/test0106-aarch64-binary < test/test0106/cc500.c >| test/test0106/cc1 || exit 4 + ./test/results/test0106-${ARCH}-binary < test/test0106/cc500.c >| test/test0106/cc1 || exit 4 out=$(sha256_check test/test0106/proof0.answer) [ "$out" = "test/test0106/cc1: OK" ] || exit 5 fi