diff --git a/makefile-tests b/makefile-tests index 2494242..fc07677 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 diff --git a/test/test0000/hello-amd64.sh b/test/test0000/hello-amd64.sh deleted file mode 100755 index fdce59f..0000000 --- a/test/test0000/hello-amd64.sh +++ /dev/null @@ -1,61 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0000/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f test/test0000/return.c \ - -o ${TMPDIR}/return.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-core.M1 \ - -f ${TMPDIR}/return.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/return.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/return.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - ./test/results/test0000-${ARCH}-binary - [ 42 = $? ] || exit 3 -fi -exit 0 diff --git a/test/test0000/hello-aarch64.sh b/test/test0000/run_test.sh similarity index 99% rename from test/test0000/hello-aarch64.sh rename to test/test0000/run_test.sh index db5c220..477221f 100755 --- a/test/test0000/hello-aarch64.sh +++ b/test/test0000/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0000/tmp-${ARCH}" diff --git a/test/test0001/hello-amd64.sh b/test/test0001/hello-amd64.sh deleted file mode 100755 index 11a5e9c..0000000 --- a/test/test0001/hello-amd64.sh +++ /dev/null @@ -1,66 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0001/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/library_call.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/library_call.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/library_call.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0001-${ARCH}-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 99% rename from test/test0001/hello-aarch64.sh rename to test/test0001/run_test.sh index 5f5de74..b84b19a 100755 --- a/test/test0001/hello-aarch64.sh +++ b/test/test0001/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0001/tmp-${ARCH}" diff --git a/test/test0002/hello-amd64.sh b/test/test0002/hello-amd64.sh deleted file mode 100755 index 93f361d..0000000 --- a/test/test0002/hello-amd64.sh +++ /dev/null @@ -1,66 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0002/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/if.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/if.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/if.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0002-${ARCH}-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 99% rename from test/test0002/hello-aarch64.sh rename to test/test0002/run_test.sh index c856ead..eb2aac1 100755 --- a/test/test0002/hello-aarch64.sh +++ b/test/test0002/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0002/tmp-${ARCH}" diff --git a/test/test0003/hello-amd64.sh b/test/test0003/hello-amd64.sh deleted file mode 100755 index 9cdcbb4..0000000 --- a/test/test0003/hello-amd64.sh +++ /dev/null @@ -1,66 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0003/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/constant.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/constant.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/constant.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0003-${ARCH}-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 99% rename from test/test0003/hello-aarch64.sh rename to test/test0003/run_test.sh index db56d12..145b669 100755 --- a/test/test0003/hello-aarch64.sh +++ b/test/test0003/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0003/tmp-${ARCH}" diff --git a/test/test0004/hello-amd64.sh b/test/test0004/hello-amd64.sh deleted file mode 100755 index 8ff5d7f..0000000 --- a/test/test0004/hello-amd64.sh +++ /dev/null @@ -1,66 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0004/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/call.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/call.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/call.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0004-${ARCH}-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 99% rename from test/test0004/hello-aarch64.sh rename to test/test0004/run_test.sh index d1cf360..cdc0d66 100755 --- a/test/test0004/hello-aarch64.sh +++ b/test/test0004/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0004/tmp-${ARCH}" diff --git a/test/test0005/hello-amd64.sh b/test/test0005/hello-amd64.sh deleted file mode 100755 index 774cf72..0000000 --- a/test/test0005/hello-amd64.sh +++ /dev/null @@ -1,66 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0005/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/string.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/string.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/string.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0005-${ARCH}-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 99% rename from test/test0005/hello-aarch64.sh rename to test/test0005/run_test.sh index 7b6e651..399f15d 100755 --- a/test/test0005/hello-aarch64.sh +++ b/test/test0005/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0005/tmp-${ARCH}" diff --git a/test/test0006/hello-amd64.sh b/test/test0006/hello-amd64.sh deleted file mode 100755 index 3c4da79..0000000 --- a/test/test0006/hello-amd64.sh +++ /dev/null @@ -1,67 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0006/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/for.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/for.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/for.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0006/hello-aarch64.sh b/test/test0006/run_test.sh similarity index 99% rename from test/test0006/hello-aarch64.sh rename to test/test0006/run_test.sh index 5cddd8a..498ba04 100755 --- a/test/test0006/hello-aarch64.sh +++ b/test/test0006/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0006/tmp-${ARCH}" diff --git a/test/test0007/hello-amd64.sh b/test/test0007/hello-amd64.sh deleted file mode 100755 index ba27958..0000000 --- a/test/test0007/hello-amd64.sh +++ /dev/null @@ -1,67 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0007/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/do.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/do.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/do.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0007/hello-aarch64.sh b/test/test0007/run_test.sh similarity index 99% rename from test/test0007/hello-aarch64.sh rename to test/test0007/run_test.sh index fb3b7c2..17c6f20 100755 --- a/test/test0007/hello-aarch64.sh +++ b/test/test0007/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0007/tmp-${ARCH}" diff --git a/test/test0008/hello-amd64.sh b/test/test0008/hello-amd64.sh deleted file mode 100755 index 5a63eab..0000000 --- a/test/test0008/hello-amd64.sh +++ /dev/null @@ -1,76 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0008/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/struct.M1 \ - -f ${TMPDIR}/struct-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/struct.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0008-${ARCH}-binary 2>&1 ) - [ 32 = $? ] || 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 99% rename from test/test0008/hello-aarch64.sh rename to test/test0008/run_test.sh index d493341..8d050b9 100755 --- a/test/test0008/hello-aarch64.sh +++ b/test/test0008/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0008/tmp-${ARCH}" diff --git a/test/test0009/hello-amd64.sh b/test/test0009/hello-amd64.sh deleted file mode 100755 index 9f51526..0000000 --- a/test/test0009/hello-amd64.sh +++ /dev/null @@ -1,66 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0009/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/goto.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/goto.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/goto.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0009-${ARCH}-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 99% rename from test/test0009/hello-aarch64.sh rename to test/test0009/run_test.sh index d71bd6e..b8854de 100755 --- a/test/test0009/hello-aarch64.sh +++ b/test/test0009/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0009/tmp-${ARCH}" diff --git a/test/test0010/hello-amd64.sh b/test/test0010/hello-amd64.sh deleted file mode 100755 index b7c4e34..0000000 --- a/test/test0010/hello-amd64.sh +++ /dev/null @@ -1,66 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0010/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/nested_struct.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/nested_struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/nested_struct.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0010-${ARCH}-binary 2>&1 ) - [ 24 = $? ] || 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 99% rename from test/test0010/hello-aarch64.sh rename to test/test0010/run_test.sh index a2c0bbe..1e66d6f 100755 --- a/test/test0010/hello-aarch64.sh +++ b/test/test0010/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0010/tmp-${ARCH}" diff --git a/test/test0011/hello-amd64.sh b/test/test0011/hello-amd64.sh deleted file mode 100755 index 1f4579d..0000000 --- a/test/test0011/hello-amd64.sh +++ /dev/null @@ -1,67 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0011/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/break-do.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/break-do.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/break-do.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0011/hello-aarch64.sh b/test/test0011/run_test.sh similarity index 99% rename from test/test0011/hello-aarch64.sh rename to test/test0011/run_test.sh index bc26261..842261b 100755 --- a/test/test0011/hello-aarch64.sh +++ b/test/test0011/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0011/tmp-${ARCH}" diff --git a/test/test0012/hello-amd64.sh b/test/test0012/hello-amd64.sh deleted file mode 100755 index 0926b8d..0000000 --- a/test/test0012/hello-amd64.sh +++ /dev/null @@ -1,67 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0012/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/break-for.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/break-for.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/break-for.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0012/hello-aarch64.sh b/test/test0012/run_test.sh similarity index 99% rename from test/test0012/hello-aarch64.sh rename to test/test0012/run_test.sh index cbbf7ca..e34aa31 100755 --- a/test/test0012/hello-aarch64.sh +++ b/test/test0012/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0012/tmp-${ARCH}" diff --git a/test/test0013/hello-amd64.sh b/test/test0013/hello-amd64.sh deleted file mode 100755 index 68961fb..0000000 --- a/test/test0013/hello-amd64.sh +++ /dev/null @@ -1,67 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0013/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/break-while.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/break-while.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/break-while.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0013/hello-aarch64.sh b/test/test0013/run_test.sh similarity index 99% rename from test/test0013/hello-aarch64.sh rename to test/test0013/run_test.sh index e16336a..aab90cf 100755 --- a/test/test0013/hello-aarch64.sh +++ b/test/test0013/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0013/tmp-${ARCH}" diff --git a/test/test0014/hello-amd64.sh b/test/test0014/hello-amd64.sh deleted file mode 100755 index fdfc070..0000000 --- a/test/test0014/hello-amd64.sh +++ /dev/null @@ -1,67 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0014/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/basic_args.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/basic_args.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/basic_args.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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/test0014/hello-aarch64.sh b/test/test0014/run_test.sh similarity index 99% rename from test/test0014/hello-aarch64.sh rename to test/test0014/run_test.sh index 20212f9..052242e 100755 --- a/test/test0014/hello-aarch64.sh +++ b/test/test0014/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0014/tmp-${ARCH}" diff --git a/test/test0015/hello-amd64.sh b/test/test0015/hello-amd64.sh deleted file mode 100755 index c912d39..0000000 --- a/test/test0015/hello-amd64.sh +++ /dev/null @@ -1,67 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0015/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/file_read.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/file_read.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/file_read.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0015/hello-aarch64.sh b/test/test0015/run_test.sh similarity index 99% rename from test/test0015/hello-aarch64.sh rename to test/test0015/run_test.sh index 982add3..b77c7d3 100755 --- a/test/test0015/hello-aarch64.sh +++ b/test/test0015/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0015/tmp-${ARCH}" diff --git a/test/test0016/hello-amd64.sh b/test/test0016/hello-amd64.sh deleted file mode 100755 index 7d1f617..0000000 --- a/test/test0016/hello-amd64.sh +++ /dev/null @@ -1,67 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0016/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/file_write.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/file_write.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/file_write.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0016/hello-aarch64.sh b/test/test0016/run_test.sh similarity index 99% rename from test/test0016/hello-aarch64.sh rename to test/test0016/run_test.sh index 3fb68ed..54986a1 100755 --- a/test/test0016/hello-aarch64.sh +++ b/test/test0016/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0016/tmp-${ARCH}" diff --git a/test/test0017/hello-amd64.sh b/test/test0017/hello-amd64.sh deleted file mode 100755 index 4a04fa1..0000000 --- a/test/test0017/hello-amd64.sh +++ /dev/null @@ -1,67 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0017/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/memset.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/memset.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/memset.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0017/hello-aarch64.sh b/test/test0017/run_test.sh similarity index 99% rename from test/test0017/hello-aarch64.sh rename to test/test0017/run_test.sh index a8a800d..712a545 100755 --- a/test/test0017/hello-aarch64.sh +++ b/test/test0017/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0017/tmp-${ARCH}" diff --git a/test/test0018/hello-amd64.sh b/test/test0018/hello-amd64.sh deleted file mode 100755 index 1a3603f..0000000 --- a/test/test0018/hello-amd64.sh +++ /dev/null @@ -1,67 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0018/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/math.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/math.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/math.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0018/hello-aarch64.sh b/test/test0018/run_test.sh similarity index 99% rename from test/test0018/hello-aarch64.sh rename to test/test0018/run_test.sh index 6aed276..a18bfcf 100755 --- a/test/test0018/hello-aarch64.sh +++ b/test/test0018/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0018/tmp-${ARCH}" diff --git a/test/test0019/hello-amd64.sh b/test/test0019/hello-amd64.sh deleted file mode 100755 index f84a032..0000000 --- a/test/test0019/hello-amd64.sh +++ /dev/null @@ -1,71 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0019/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/getopt.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/getopt.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/getopt.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0019/hello-aarch64.sh b/test/test0019/run_test.sh similarity index 99% rename from test/test0019/hello-aarch64.sh rename to test/test0019/run_test.sh index 26dc1f7..de6dabe 100755 --- a/test/test0019/hello-aarch64.sh +++ b/test/test0019/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0019/tmp-${ARCH}" diff --git a/test/test0020/hello-amd64.sh b/test/test0020/hello-amd64.sh deleted file mode 100755 index e70dfb7..0000000 --- a/test/test0020/hello-amd64.sh +++ /dev/null @@ -1,66 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0020/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/struct.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/struct.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/struct.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0020-${ARCH}-binary 2>&1 ) - [ 40 = $? ] || 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 99% rename from test/test0020/hello-aarch64.sh rename to test/test0020/run_test.sh index 91f9bae..074e773 100755 --- a/test/test0020/hello-aarch64.sh +++ b/test/test0020/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0020/tmp-${ARCH}" diff --git a/test/test0021/hello-aarch64.sh b/test/test0021/hello-aarch64.sh deleted file mode 100755 index 5f21515..0000000 --- a/test/test0021/hello-aarch64.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 - -ARCH="aarch64" -. test/env.inc.sh -TMPDIR="test/test0021/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/chdir.M1 \ - -f ${TMPDIR}/chdir-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/chdir.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/chdir.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test0021-${ARCH}-binary - [ 0 = $? ] || exit 5 -fi -exit 0 diff --git a/test/test0021/hello-amd64.sh b/test/test0021/run_test.sh similarity index 99% rename from test/test0021/hello-amd64.sh rename to test/test0021/run_test.sh index 8ae9506..c03bd06 100755 --- a/test/test0021/hello-amd64.sh +++ b/test/test0021/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="amd64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0021/tmp-${ARCH}" diff --git a/test/test0022/hello-aarch64.sh b/test/test0022/hello-aarch64.sh deleted file mode 100755 index 15705c0..0000000 --- a/test/test0022/hello-aarch64.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 - -ARCH="aarch64" -. test/env.inc.sh -TMPDIR="test/test0022/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/continue.M1 \ - -f ${TMPDIR}/continue-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/continue.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/continue.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -fi -exit 0 diff --git a/test/test0022/hello-amd64.sh b/test/test0022/run_test.sh similarity index 99% rename from test/test0022/hello-amd64.sh rename to test/test0022/run_test.sh index 04e786f..6a481a4 100755 --- a/test/test0022/hello-amd64.sh +++ b/test/test0022/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="amd64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0022/tmp-${ARCH}" diff --git a/test/test0023/hello-aarch64.sh b/test/test0023/hello-aarch64.sh deleted file mode 100755 index b238250..0000000 --- a/test/test0023/hello-aarch64.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 - -ARCH="aarch64" -. test/env.inc.sh -TMPDIR="test/test0023/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/fseek.M1 \ - -f ${TMPDIR}/fseek-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/fseek.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/fseek.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -fi -exit 0 diff --git a/test/test0023/hello-amd64.sh b/test/test0023/run_test.sh similarity index 99% rename from test/test0023/hello-amd64.sh rename to test/test0023/run_test.sh index c20b937..ec8be4f 100755 --- a/test/test0023/hello-amd64.sh +++ b/test/test0023/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="amd64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0023/tmp-${ARCH}" diff --git a/test/test0024/hello-amd64.sh b/test/test0024/hello-amd64.sh deleted file mode 100755 index eb5d975..0000000 --- a/test/test0024/hello-amd64.sh +++ /dev/null @@ -1,61 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0024/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f test/test0024/return.c \ - -o ${TMPDIR}/return.M1 \ - || exit 1 - -# Macro assemble with libc written in M1-Macro -M1 \ - -f M2libc/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-core.M1 \ - -f ${TMPDIR}/return.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/return.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/return.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - ./test/results/test0024-${ARCH}-binary - [ 42 = $? ] || exit 3 -fi -exit 0 diff --git a/test/test0024/hello-aarch64.sh b/test/test0024/run_test.sh similarity index 99% rename from test/test0024/hello-aarch64.sh rename to test/test0024/run_test.sh index 013faf8..7567113 100755 --- a/test/test0024/hello-aarch64.sh +++ b/test/test0024/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0024/tmp-${ARCH}" diff --git a/test/test0025/hello-amd64.sh b/test/test0025/hello-amd64.sh deleted file mode 100755 index 147f342..0000000 --- a/test/test0025/hello-amd64.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 -ex - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0025/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/array.M1 \ - -f ${TMPDIR}/array-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/array.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/array.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the resulting file works - ./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 -exit 0 diff --git a/test/test0025/hello-aarch64.sh b/test/test0025/run_test.sh similarity index 99% rename from test/test0025/hello-aarch64.sh rename to test/test0025/run_test.sh index dbea8e5..09e4614 100755 --- a/test/test0025/hello-aarch64.sh +++ b/test/test0025/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0025/tmp-${ARCH}" diff --git a/test/test0100/hello-amd64.sh b/test/test0100/hello-amd64.sh deleted file mode 100755 index ea14fff..0000000 --- a/test/test0100/hello-amd64.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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0100/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/blood-elf.M1 \ - -f ${TMPDIR}/blood-elf-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/blood-elf.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/blood-elf.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - 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-${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 -exit 0 diff --git a/test/test0100/hello-aarch64.sh b/test/test0100/run_test.sh similarity index 99% rename from test/test0100/hello-aarch64.sh rename to test/test0100/run_test.sh index 190ef03..c45faaf 100755 --- a/test/test0100/hello-aarch64.sh +++ b/test/test0100/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0100/tmp-${ARCH}" diff --git a/test/test0101/hello-amd64.sh b/test/test0101/hello-amd64.sh deleted file mode 100755 index 2ec4cc8..0000000 --- a/test/test0101/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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0101/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/hex2_linker.M1 \ - -f ${TMPDIR}/hex2_linker-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/hex2_linker.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/hex2_linker.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - 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-${ARCH}-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 99% rename from test/test0101/hello-aarch64.sh rename to test/test0101/run_test.sh index 48bfc78..b8be868 100755 --- a/test/test0101/hello-aarch64.sh +++ b/test/test0101/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0101/tmp-${ARCH}" diff --git a/test/test0102/hello-amd64.sh b/test/test0102/hello-amd64.sh deleted file mode 100755 index 5b6afa3..0000000 --- a/test/test0102/hello-amd64.sh +++ /dev/null @@ -1,96 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0102/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/M1-macro.M1 \ - -f ${TMPDIR}/M1-macro-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/M1-macro.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/M1-macro.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - 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-${ARCH}-binary \ - -f M2libc/x86/x86_defs.M1 \ - -f M2libc/x86/libc-core.M1 \ - -f test/test0100/test.M1 \ - ${ENDIANNESS_FLAG} \ - --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 99% rename from test/test0102/hello-aarch64.sh rename to test/test0102/run_test.sh index c2513c0..e6deec4 100755 --- a/test/test0102/hello-aarch64.sh +++ b/test/test0102/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0102/tmp-${ARCH}" diff --git a/test/test0103/hello-amd64.sh b/test/test0103/hello-amd64.sh deleted file mode 100755 index 1c21cc3..0000000 --- a/test/test0103/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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0103/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/get_machine.M1 \ - -f ${TMPDIR}/get_machine-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/get_machine.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/get_machine.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - out=$(./test/results/test0103-${ARCH}-binary ${GET_MACHINE_FLAGS} 2>&1 ) - [ 0 = $? ] || exit 5 - [ "$out" = "${ARCH}" ] || exit 6 -fi -exit 0 diff --git a/test/test0103/hello-aarch64.sh b/test/test0103/run_test.sh similarity index 99% rename from test/test0103/hello-aarch64.sh rename to test/test0103/run_test.sh index e2b0eb6..0b78b05 100755 --- a/test/test0103/hello-aarch64.sh +++ b/test/test0103/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0103/tmp-${ARCH}" diff --git a/test/test0104/hello-amd64.sh b/test/test0104/hello-amd64.sh deleted file mode 100755 index 603fc68..0000000 --- a/test/test0104/hello-amd64.sh +++ /dev/null @@ -1,83 +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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0104/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/kaem.M1 \ - -f ${TMPDIR}/kaem-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/kaem.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/kaem.hex2 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - --base-address ${BASE_ADDRESS} \ - -o test/results/test0104-${ARCH}-binary \ - || exit 4 - -if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - 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-${ARCH}-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 99% rename from test/test0104/hello-aarch64.sh rename to test/test0104/run_test.sh index a03f847..c586c39 100755 --- a/test/test0104/hello-aarch64.sh +++ b/test/test0104/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0104/tmp-${ARCH}" diff --git a/test/test0105/hello-amd64.sh b/test/test0105/hello-amd64.sh deleted file mode 100755 index 2dbbbe3..0000000 --- a/test/test0105/hello-amd64.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 - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0105/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/lisp.M1 \ - -f ${TMPDIR}/lisp-footer.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/lisp.hex2 \ - || exit 3 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}-debug.hex2 \ - -f ${TMPDIR}/lisp.hex2 \ - ${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})" = "${ARCH}" ] -then - # Verify that the compiled program returns the correct result - 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-${ARCH}-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 99% rename from test/test0105/hello-aarch64.sh rename to test/test0105/run_test.sh index 7c6a3c8..a5b9a0c 100755 --- a/test/test0105/hello-aarch64.sh +++ b/test/test0105/run_test.sh @@ -18,7 +18,7 @@ set -x -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0105/tmp-${ARCH}" diff --git a/test/test0106/hello-amd64.sh b/test/test0106/hello-amd64.sh deleted file mode 100755 index 46ec793..0000000 --- a/test/test0106/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 -ex - -ARCH="amd64" -. test/env.inc.sh -TMPDIR="test/test0106/tmp-${ARCH}" - -mkdir -p ${TMPDIR} - -# Build the test -bin/M2-Planet \ - --architecture ${ARCH} \ - -f M2libc/${ARCH}/Linux/unistd.h \ - -f M2libc/stdlib.c \ - -f M2libc/${ARCH}/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/${ARCH}/${ARCH}_defs.M1 \ - -f M2libc/${ARCH}/libc-full.M1 \ - -f ${TMPDIR}/cc0.M1 \ - ${ENDIANNESS_FLAG} \ - --architecture ${ARCH} \ - -o ${TMPDIR}/cc0.hex2 \ - || exit 2 - -# Resolve all linkages -hex2 \ - -f M2libc/${ARCH}/ELF-${ARCH}.hex2 \ - -f ${TMPDIR}/cc0.hex2 \ - ${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})" = "${ARCH}" ] -then - . ./sha256.sh - # Verify that the compiled program can compile itself - ./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 - - # 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 99% rename from test/test0106/hello-aarch64.sh rename to test/test0106/run_test.sh index 7fd303b..b4fc1e1 100755 --- a/test/test0106/hello-aarch64.sh +++ b/test/test0106/run_test.sh @@ -18,7 +18,7 @@ set -ex -ARCH="aarch64" +ARCH="$1" . test/env.inc.sh TMPDIR="test/test0106/tmp-${ARCH}"