diff --git a/CHANGELOG.org b/CHANGELOG.org index 1cf0d28..c5a9fa2 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -16,12 +16,13 @@ * Current ** Added -Added 15/24 working tests for armv7l +Added 17/24 working tests for armv7l ** Changed ** Fixed Fixed unsigned division in ARMv7l port +Fixed non-uniform behavior across locales and *BSDs ** Removed diff --git a/sha256.sh b/sha256.sh new file mode 100644 index 0000000..32d1863 --- /dev/null +++ b/sha256.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2019 ng0 +# +# This file is part of mescc-tools +# +# mescc-tools 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. +# +# mescc-tools 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 mescc-tools. If not, see . + +set -ex +# It's bad to rely on the uname here, but it's a start. +# What this does is to consider the major implementations of +# sha256sum tools and their differences and call them +# accordingly. +sha256_check() +{ + if [ "$(get_machine --OS)" = "Linux" ]; then + LANG=C sha256sum -c "$1" + elif [ "$(get_machine --OS)" = "NetBSD" ]; then + sum -a SHA256 -n -c "$1" + elif [ "$(get_machine --OS)" = "FreeBSD" ]; then + sha256 -r -c "$1" + else + echo "Unsupported sha256 tool, please send a patch to support it" + exit 77 + fi +} diff --git a/test/test06/hello-armv7l.sh b/test/test06/hello-armv7l.sh index a8b9eee..8470ad6 100755 --- a/test/test06/hello-armv7l.sh +++ b/test/test06/hello-armv7l.sh @@ -35,9 +35,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test06/for.hex2 --LittleEndia # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test06-armv7l-binary >| test/test06/proof || exit 4 - out=$(sha256sum -c test/test06/proof.answer) + out=$(sha256_check test/test06/proof.answer) [ "$out" = "test/test06/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test06/hello-knight-posix.sh b/test/test06/hello-knight-posix.sh index fa1b200..5d729d2 100755 --- a/test/test06/hello-knight-posix.sh +++ b/test/test06/hello-knight-posix.sh @@ -35,9 +35,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test06/for.hex2 --BigEndian - # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test06-knight-posix-binary >| test/test06/proof || exit 4 - out=$(sha256sum -c test/test06/proof.answer) + out=$(sha256_check test/test06/proof.answer) [ "$out" = "test/test06/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test06/hello-x86.sh b/test/test06/hello-x86.sh index 905c296..03d656a 100755 --- a/test/test06/hello-x86.sh +++ b/test/test06/hello-x86.sh @@ -35,9 +35,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test06/for.hex2 --LittleEndian --a # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test06-x86-binary >| test/test06/proof || exit 4 - out=$(sha256sum -c test/test06/proof.answer) + out=$(sha256_check test/test06/proof.answer) [ "$out" = "test/test06/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test07/hello-armv7l.sh b/test/test07/hello-armv7l.sh index 0c48f3c..e50f97a 100755 --- a/test/test07/hello-armv7l.sh +++ b/test/test07/hello-armv7l.sh @@ -36,9 +36,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test07/do.hex2 --LittleEndian # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test07-armv7l-binary >| test/test07/proof || exit 4 - out=$(sha256sum -c test/test07/proof.answer) + out=$(sha256_check test/test07/proof.answer) [ "$out" = "test/test07/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test07/hello-knight-posix.sh b/test/test07/hello-knight-posix.sh index 1b2e25e..ec6db4d 100755 --- a/test/test07/hello-knight-posix.sh +++ b/test/test07/hello-knight-posix.sh @@ -36,9 +36,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test07/do.hex2 --BigEndian -- # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test07-knight-posix-binary >| test/test07/proof || exit 4 - out=$(sha256sum -c test/test07/proof.answer) + out=$(sha256_check test/test07/proof.answer) [ "$out" = "test/test07/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test07/hello-x86.sh b/test/test07/hello-x86.sh index ed5edfb..36b3247 100755 --- a/test/test07/hello-x86.sh +++ b/test/test07/hello-x86.sh @@ -36,9 +36,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test07/do.hex2 --LittleEndian --ar # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test07-x86-binary >| test/test07/proof || exit 4 - out=$(sha256sum -c test/test07/proof.answer) + out=$(sha256_check test/test07/proof.answer) [ "$out" = "test/test07/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test100/hello-knight-posix.sh b/test/test100/hello-knight-posix.sh index 1f0dc59..a051be8 100755 --- a/test/test100/hello-knight-posix.sh +++ b/test/test100/hello-knight-posix.sh @@ -76,7 +76,8 @@ then -f cc.c \ -o test/test100/proof || exit 4 - out=$(sha256sum -c test/test100/proof.answer) + . ./sha256.sh + out=$(sha256_check test/test100/proof.answer) [ "$out" = "test/test100/proof: OK" ] || exit 5 [ ! -e bin/M2-Planet ] && mv test/results/test100-knight-posix-binary bin/M2-Planet fi diff --git a/test/test100/hello-x86.sh b/test/test100/hello-x86.sh index f4c4303..d873462 100755 --- a/test/test100/hello-x86.sh +++ b/test/test100/hello-x86.sh @@ -81,7 +81,8 @@ then -f cc.c \ -o test/test100/proof || exit 5 - out=$(sha256sum -c test/test100/proof.answer) + . ./sha256.sh + out=$(sha256_check test/test100/proof.answer) [ "$out" = "test/test100/proof: OK" ] || exit 6 [ ! -e bin/M2-Planet ] && mv test/results/test100-x86-binary bin/M2-Planet fi diff --git a/test/test11/hello-armv7l.sh b/test/test11/hello-armv7l.sh index 843d758..ec9c397 100755 --- a/test/test11/hello-armv7l.sh +++ b/test/test11/hello-armv7l.sh @@ -36,9 +36,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test11/break-do.hex2 --Little # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test11-armv7l-binary >| test/test11/proof || exit 4 - out=$(sha256sum -c test/test11/proof.answer) + out=$(sha256_check test/test11/proof.answer) [ "$out" = "test/test11/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test11/hello-knight-posix.sh b/test/test11/hello-knight-posix.sh index f289cc2..29161fd 100755 --- a/test/test11/hello-knight-posix.sh +++ b/test/test11/hello-knight-posix.sh @@ -36,9 +36,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test11/break-do.hex2 --BigEnd # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test11-knight-posix-binary >| test/test11/proof || exit 4 - out=$(sha256sum -c test/test11/proof.answer) + out=$(sha256_check test/test11/proof.answer) [ "$out" = "test/test11/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test11/hello-x86.sh b/test/test11/hello-x86.sh index 0abb50e..2358733 100755 --- a/test/test11/hello-x86.sh +++ b/test/test11/hello-x86.sh @@ -36,9 +36,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test11/break-do.hex2 --LittleEndia # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test11-x86-binary >| test/test11/proof || exit 4 - out=$(sha256sum -c test/test11/proof.answer) + out=$(sha256_check test/test11/proof.answer) [ "$out" = "test/test11/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test12/hello-armv7l.sh b/test/test12/hello-armv7l.sh index 4b51637..f615509 100755 --- a/test/test12/hello-armv7l.sh +++ b/test/test12/hello-armv7l.sh @@ -36,9 +36,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test12/break-for.hex2 --Littl # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test12-armv7l-binary >| test/test12/proof || exit 4 - out=$(sha256sum -c test/test12/proof.answer) + out=$(sha256_check test/test12/proof.answer) [ "$out" = "test/test12/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test12/hello-knight-posix.sh b/test/test12/hello-knight-posix.sh index ccc20b0..0cc9780 100755 --- a/test/test12/hello-knight-posix.sh +++ b/test/test12/hello-knight-posix.sh @@ -36,9 +36,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test12/break-for.hex2 --BigEn # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test12-knight-posix-binary >| test/test12/proof || exit 4 - out=$(sha256sum -c test/test12/proof.answer) + out=$(sha256_check test/test12/proof.answer) [ "$out" = "test/test12/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test12/hello-x86.sh b/test/test12/hello-x86.sh index 530510e..fd3ada9 100755 --- a/test/test12/hello-x86.sh +++ b/test/test12/hello-x86.sh @@ -36,9 +36,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test12/break-for.hex2 --LittleEndi # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test12-x86-binary >| test/test12/proof || exit 4 - out=$(sha256sum -c test/test12/proof.answer) + out=$(sha256_check test/test12/proof.answer) [ "$out" = "test/test12/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test13/hello-armv7l.sh b/test/test13/hello-armv7l.sh index 80a237f..0ed5bbb 100755 --- a/test/test13/hello-armv7l.sh +++ b/test/test13/hello-armv7l.sh @@ -36,9 +36,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test13/break-while.hex2 --Lit # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test13-armv7l-binary >| test/test13/proof || exit 4 - out=$(sha256sum -c test/test13/proof.answer) + out=$(sha256_check test/test13/proof.answer) [ "$out" = "test/test13/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test13/hello-knight-posix.sh b/test/test13/hello-knight-posix.sh index 563c984..531b636 100755 --- a/test/test13/hello-knight-posix.sh +++ b/test/test13/hello-knight-posix.sh @@ -36,9 +36,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test13/break-while.hex2 --Big # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test13-kight-posix-binary >| test/test13/proof || exit 4 - out=$(sha256sum -c test/test13/proof.answer) + out=$(sha256_check test/test13/proof.answer) [ "$out" = "test/test13/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test13/hello-x86.sh b/test/test13/hello-x86.sh index fbbee74..8d17b29 100755 --- a/test/test13/hello-x86.sh +++ b/test/test13/hello-x86.sh @@ -36,9 +36,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test13/break-while.hex2 --LittleEn # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test13-x86-binary >| test/test13/proof || exit 4 - out=$(sha256sum -c test/test13/proof.answer) + out=$(sha256_check test/test13/proof.answer) [ "$out" = "test/test13/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test14/hello-armv7l.sh b/test/test14/hello-armv7l.sh index f8d3cbb..32ad36a 100755 --- a/test/test14/hello-armv7l.sh +++ b/test/test14/hello-armv7l.sh @@ -35,9 +35,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test14/basic_args.hex2 --Litt # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test14-armv7l-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test14/proof || exit 4 - out=$(sha256sum -c test/test14/proof-armv7l.answer) + out=$(sha256_check test/test14/proof-armv7l.answer) [ "$out" = "test/test14/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test14/hello-knight-posix.sh b/test/test14/hello-knight-posix.sh index a9cf23f..f4488bf 100755 --- a/test/test14/hello-knight-posix.sh +++ b/test/test14/hello-knight-posix.sh @@ -35,9 +35,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test14/basic_args.hex2 --BigE # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test14-knight-posix-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test14/proof || exit 4 - out=$(sha256sum -c test/test14/proof-knight-posix.answer) + out=$(sha256_check test/test14/proof-knight-posix.answer) [ "$out" = "test/test14/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test14/hello-x86.sh b/test/test14/hello-x86.sh index c9f5ce0..bac948f 100755 --- a/test/test14/hello-x86.sh +++ b/test/test14/hello-x86.sh @@ -35,9 +35,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test14/basic_args.hex2 --LittleEnd # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test14-x86-binary 314 1 5926 5 35897 932384626 43 383279 50288 419 71693 99375105 820974944 >| test/test14/proof || exit 4 - out=$(sha256sum -c test/test14/proof-x86.answer) + out=$(sha256_check test/test14/proof-x86.answer) [ "$out" = "test/test14/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test15/hello-armv7l.sh b/test/test15/hello-armv7l.sh index 80e49fd..e994f5c 100755 --- a/test/test15/hello-armv7l.sh +++ b/test/test15/hello-armv7l.sh @@ -36,9 +36,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test15/file_read.hex2 --Littl # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test15-armv7l-binary test/test15/file_read.c >| test/test15/proof || exit 4 - out=$(sha256sum -c test/test15/proof.answer) + out=$(sha256_check test/test15/proof.answer) [ "$out" = "test/test15/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test15/hello-knight-posix.sh b/test/test15/hello-knight-posix.sh index d0c19f9..35110dc 100755 --- a/test/test15/hello-knight-posix.sh +++ b/test/test15/hello-knight-posix.sh @@ -36,9 +36,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test15/file_read.hex2 --BigEn # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "Knight*" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test15-knight-posix-binary test/test15/file_read.c >| test/test15/proof || exit 4 - out=$(sha256sum -c test/test15/proof.answer) + out=$(sha256_check test/test15/proof.answer) [ "$out" = "test/test15/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test15/hello-x86.sh b/test/test15/hello-x86.sh index 1ddfa3d..800582e 100755 --- a/test/test15/hello-x86.sh +++ b/test/test15/hello-x86.sh @@ -36,9 +36,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test15/file_read.hex2 --LittleEndi # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test15-x86-binary test/test15/file_read.c >| test/test15/proof || exit 4 - out=$(sha256sum -c test/test15/proof.answer) + out=$(sha256_check test/test15/proof.answer) [ "$out" = "test/test15/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test16/hello-armv7l.sh b/test/test16/hello-armv7l.sh index 492cf98..1d6583e 100755 --- a/test/test16/hello-armv7l.sh +++ b/test/test16/hello-armv7l.sh @@ -36,9 +36,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test16/file_write.hex2 --Litt # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test16-armv7l-binary test/test16/proof || exit 4 - out=$(sha256sum -c test/test16/proof.answer) + out=$(sha256_check test/test16/proof.answer) [ "$out" = "test/test16/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test16/hello-knight-posix.sh b/test/test16/hello-knight-posix.sh index b98396f..f9e0037 100755 --- a/test/test16/hello-knight-posix.sh +++ b/test/test16/hello-knight-posix.sh @@ -36,9 +36,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test16/file_write.hex2 --BigE # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test16-knight-posix-binary test/test16/proof || exit 4 - out=$(sha256sum -c test/test16/proof.answer) + out=$(sha256_check test/test16/proof.answer) [ "$out" = "test/test16/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test16/hello-x86.sh b/test/test16/hello-x86.sh index 1565b50..6059a6f 100755 --- a/test/test16/hello-x86.sh +++ b/test/test16/hello-x86.sh @@ -36,9 +36,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test16/file_write.hex2 --LittleEnd # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test16-x86-binary test/test16/proof || exit 4 - out=$(sha256sum -c test/test16/proof.answer) + out=$(sha256_check test/test16/proof.answer) [ "$out" = "test/test16/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test17/hello-armv7l.sh b/test/test17/hello-armv7l.sh index 2bc165e..954520c 100755 --- a/test/test17/hello-armv7l.sh +++ b/test/test17/hello-armv7l.sh @@ -37,9 +37,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test17/memset.hex2 --LittleEn # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test17-armv7l-binary >| test/test17/proof || exit 4 - out=$(sha256sum -c test/test17/proof.answer) + out=$(sha256_check test/test17/proof.answer) [ "$out" = "test/test17/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test17/hello-knight-posix.sh b/test/test17/hello-knight-posix.sh index bac942e..c9615ae 100755 --- a/test/test17/hello-knight-posix.sh +++ b/test/test17/hello-knight-posix.sh @@ -37,9 +37,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test17/memset.hex2 --BigEndia # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test17-knight-posix-binary >| test/test17/proof || exit 4 - out=$(sha256sum -c test/test17/proof.answer) + out=$(sha256_check test/test17/proof.answer) [ "$out" = "test/test17/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test17/hello-x86.sh b/test/test17/hello-x86.sh index 4f48030..60266a0 100755 --- a/test/test17/hello-x86.sh +++ b/test/test17/hello-x86.sh @@ -37,9 +37,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test17/memset.hex2 --LittleEndian # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test17-x86-binary >| test/test17/proof || exit 4 - out=$(sha256sum -c test/test17/proof.answer) + out=$(sha256_check test/test17/proof.answer) [ "$out" = "test/test17/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test18/hello-armv7l.sh b/test/test18/hello-armv7l.sh index 22fe3f4..c1c2a17 100755 --- a/test/test18/hello-armv7l.sh +++ b/test/test18/hello-armv7l.sh @@ -37,9 +37,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test18/math.hex2 --LittleEndi # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test18-armv7l-binary >| test/test18/proof || exit 4 - out=$(sha256sum -c test/test18/proof.answer) + out=$(sha256_check test/test18/proof.answer) [ "$out" = "test/test18/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test18/hello-knight-posix.sh b/test/test18/hello-knight-posix.sh index 5708d24..e029697 100755 --- a/test/test18/hello-knight-posix.sh +++ b/test/test18/hello-knight-posix.sh @@ -37,9 +37,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test18/math.hex2 --BigEndian # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test18-knight-posix-binary >| test/test18/proof || exit 4 - out=$(sha256sum -c test/test18/proof.answer) + out=$(sha256_check test/test18/proof.answer) [ "$out" = "test/test18/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test18/hello-x86.sh b/test/test18/hello-x86.sh index 7e1e78a..e4a9d3f 100755 --- a/test/test18/hello-x86.sh +++ b/test/test18/hello-x86.sh @@ -37,9 +37,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test18/math.hex2 --LittleEndian -- # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test18-x86-binary >| test/test18/proof || exit 4 - out=$(sha256sum -c test/test18/proof.answer) + out=$(sha256_check test/test18/proof.answer) [ "$out" = "test/test18/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test19/hello-armv7l.sh b/test/test19/hello-armv7l.sh index 8908b98..a11d1b8 100755 --- a/test/test19/hello-armv7l.sh +++ b/test/test19/hello-armv7l.sh @@ -41,9 +41,10 @@ hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test19/getopt.hex2 --LittleEn # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test19-armv7l-binary -f test/test19/input -o test/test19/proof || exit 4 - out=$(sha256sum -c test/test19/proof.answer) + out=$(sha256_check test/test19/proof.answer) [ "$out" = "test/test19/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test19/hello-knight-posix.sh b/test/test19/hello-knight-posix.sh index 8da0f5a..6a6e0a7 100755 --- a/test/test19/hello-knight-posix.sh +++ b/test/test19/hello-knight-posix.sh @@ -41,9 +41,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test19/getopt.hex2 --BigEndia # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test19-knight-posix-binary -f test/test19/input -o test/test19/proof || exit 4 - out=$(sha256sum -c test/test19/proof.answer) + out=$(sha256_check test/test19/proof.answer) [ "$out" = "test/test19/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test19/hello-x86.sh b/test/test19/hello-x86.sh index 134c7d7..fde08c9 100755 --- a/test/test19/hello-x86.sh +++ b/test/test19/hello-x86.sh @@ -41,9 +41,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test19/getopt.hex2 --LittleEndian # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the resulting file works ./test/results/test19-x86-binary -f test/test19/input -o test/test19/proof || exit 4 - out=$(sha256sum -c test/test19/proof.answer) + out=$(sha256_check test/test19/proof.answer) [ "$out" = "test/test19/proof: OK" ] || exit 5 fi exit 0 diff --git a/test/test21/hello-armv7l.sh b/test/test21/hello-armv7l.sh index 990156c..16f30cb 100755 --- a/test/test21/hello-armv7l.sh +++ b/test/test21/hello-armv7l.sh @@ -58,9 +58,10 @@ then [ "$out" = "blood-elf 0.1 (Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6 + . ./sha256.sh # Verify that the resulting file works ./test/results/test21-armv7l-binary -f test/test21/test.M1 -o test/test21/proof || exit 7 - out=$(sha256sum -c test/test21/proof.answer) + out=$(sha256_check test/test21/proof.answer) [ "$out" = "test/test21/proof: OK" ] || exit 8 fi exit 0 diff --git a/test/test21/hello-knight-posix.sh b/test/test21/hello-knight-posix.sh index d6937ea..e1aa151 100755 --- a/test/test21/hello-knight-posix.sh +++ b/test/test21/hello-knight-posix.sh @@ -53,9 +53,10 @@ then [ "$out" = "blood-elf 0.1 (Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6 + . ./sha256.sh # Verify that the resulting file works ./test/results/test21-knight-posix-binary -f test/test21/test.M1 -o test/test21/proof || exit 7 - out=$(sha256sum -c test/test21/proof.answer) + out=$(sha256_check test/test21/proof.answer) [ "$out" = "test/test21/proof: OK" ] || exit 8 fi exit 0 diff --git a/test/test21/hello-x86.sh b/test/test21/hello-x86.sh index 7c2eda3..dd9f83a 100755 --- a/test/test21/hello-x86.sh +++ b/test/test21/hello-x86.sh @@ -58,9 +58,10 @@ then [ "$out" = "blood-elf 0.1 (Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6 + . ./sha256.sh # Verify that the resulting file works ./test/results/test21-x86-binary -f test/test21/test.M1 -o test/test21/proof || exit 7 - out=$(sha256sum -c test/test21/proof.answer) + out=$(sha256_check test/test21/proof.answer) [ "$out" = "test/test21/proof: OK" ] || exit 8 fi exit 0 diff --git a/test/test22/hello-armv7l.sh b/test/test22/hello-armv7l.sh index 321514c..d3a46a2 100755 --- a/test/test22/hello-armv7l.sh +++ b/test/test22/hello-armv7l.sh @@ -60,6 +60,7 @@ then [ 0 = $? ] || exit 5 [ "$out" = "hex2 0.3" ] || exit 6 + . ./sha256.sh # Verify that the resulting file works ./test/results/test22-armv7l-binary -f test/common_x86/ELF-i386.hex2 \ -f test/test22/test.hex2 \ @@ -67,7 +68,7 @@ then --architecture x86 \ --BaseAddress 0x8048000 \ -o test/test22/proof || exit 7 - out=$(sha256sum -c test/test22/proof.answer) + out=$(sha256_check test/test22/proof.answer) [ "$out" = "test/test22/proof: OK" ] || exit 8 fi exit 0 diff --git a/test/test22/hello-knight-posix.sh b/test/test22/hello-knight-posix.sh index b58590d..7611002 100755 --- a/test/test22/hello-knight-posix.sh +++ b/test/test22/hello-knight-posix.sh @@ -54,6 +54,7 @@ then [ 0 = $? ] || exit 5 [ "$out" = "hex2 0.3" ] || exit 6 + . ./sha256.sh # Verify that the resulting file works ./test/results/test22-knight-posix-binary -f test/common_x86/ELF-i386.hex2 \ -f test/test22/test.hex2 \ @@ -61,7 +62,7 @@ then --architecture x86 \ --BaseAddress 0x8048000 \ -o test/test22/proof || exit 7 - out=$(sha256sum -c test/test22/proof.answer) + out=$(sha256_check test/test22/proof.answer) [ "$out" = "test/test22/proof: OK" ] || exit 8 fi exit 0 diff --git a/test/test22/hello-x86.sh b/test/test22/hello-x86.sh index 186a09c..05a8dc2 100755 --- a/test/test22/hello-x86.sh +++ b/test/test22/hello-x86.sh @@ -60,6 +60,7 @@ then [ 0 = $? ] || exit 5 [ "$out" = "hex2 0.3" ] || exit 6 + . ./sha256.sh # Verify that the resulting file works ./test/results/test22-x86-binary -f test/common_x86/ELF-i386.hex2 \ -f test/test22/test.hex2 \ @@ -67,7 +68,7 @@ then --architecture x86 \ --BaseAddress 0x8048000 \ -o test/test22/proof || exit 7 - out=$(sha256sum -c test/test22/proof.answer) + out=$(sha256_check test/test22/proof.answer) [ "$out" = "test/test22/proof: OK" ] || exit 8 fi exit 0 diff --git a/test/test23/hello-armv7l.sh b/test/test23/hello-armv7l.sh index ea05310..587aef9 100755 --- a/test/test23/hello-armv7l.sh +++ b/test/test23/hello-armv7l.sh @@ -69,7 +69,8 @@ then --architecture x86 \ -o test/test23/proof || exit 7 - out=$(sha256sum -c test/test23/proof.answer) + . ./sha256.sh + out=$(sha256_check test/test23/proof.answer) [ "$out" = "test/test23/proof: OK" ] || exit 8 fi exit 0 diff --git a/test/test23/hello-knight-posix.sh b/test/test23/hello-knight-posix.sh index 1c5e9b9..c63182a 100755 --- a/test/test23/hello-knight-posix.sh +++ b/test/test23/hello-knight-posix.sh @@ -63,7 +63,8 @@ then --architecture x86 \ -o test/test23/proof || exit 7 - out=$(sha256sum -c test/test23/proof.answer) + . ./sha256.sh + out=$(sha256_check test/test23/proof.answer) [ "$out" = "test/test23/proof: OK" ] || exit 8 fi exit 0 diff --git a/test/test23/hello-x86.sh b/test/test23/hello-x86.sh index 31dcaa0..e20f021 100755 --- a/test/test23/hello-x86.sh +++ b/test/test23/hello-x86.sh @@ -69,7 +69,8 @@ then --architecture x86 \ -o test/test23/proof || exit 7 - out=$(sha256sum -c test/test23/proof.answer) + . ./sha256.sh + out=$(sha256_check test/test23/proof.answer) [ "$out" = "test/test23/proof: OK" ] || exit 8 fi exit 0 diff --git a/test/test24/hello-armv7l.sh b/test/test24/hello-armv7l.sh new file mode 100755 index 0000000..9145e51 --- /dev/null +++ b/test/test24/hello-armv7l.sh @@ -0,0 +1,61 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## 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 +# Build the test +./bin/M2-Planet --architecture armv7l -f test/common_armv7l/functions/exit.c \ + -f test/common_armv7l/functions/file.c \ + -f functions/file_print.c \ + -f test/common_armv7l/functions/malloc.c \ + -f functions/calloc.c \ + -f test/common_armv7l/functions/uname.c \ + -f functions/match.c \ + -f test/test24/get_machine.c \ + --debug \ + -o test/test24/get_machine.M1 || exit 1 + +# Build debug footer +blood-elf -f test/test24/get_machine.M1 \ + -o test/test24/get_machine-footer.M1 || exit 2 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_armv7l/armv7l_defs.M1 \ + -f test/common_armv7l/libc-core.M1 \ + -f test/test24/get_machine.M1 \ + -f test/test24/get_machine-footer.M1 \ + --LittleEndian \ + --architecture armv7l \ + -o test/test24/get_machine.hex2 || exit 3 + +# Resolve all linkages +hex2 -f test/common_armv7l/ELF-armv7l-debug.hex2 \ + -f test/test24/get_machine.hex2 \ + --LittleEndian \ + --architecture armv7l \ + --BaseAddress 0x10000 \ + -o test/results/test24-armv7l-binary \ + --exec_enable || exit 4 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] +then + # Verify that the compiled program returns the correct result + out=$(./test/results/test24-armv7l-binary ${GET_MACHINE_FLAGS} 2>&1 ) + [ 0 = $? ] || exit 5 + [ "$out" = "armv7l" ] || exit 6 +fi +exit 0 diff --git a/test/test25/hello-armv7l.sh b/test/test25/hello-armv7l.sh new file mode 100755 index 0000000..d3f52d0 --- /dev/null +++ b/test/test25/hello-armv7l.sh @@ -0,0 +1,56 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## 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 +# Build the test +./bin/M2-Planet --architecture armv7l -f test/common_armv7l/functions/exit.c \ + -f test/common_armv7l/functions/file.c \ + -f functions/file_print.c \ + -f test/common_armv7l/functions/malloc.c \ + -f functions/calloc.c \ + -f functions/match.c \ + -f functions/in_set.c \ + -f functions/numerate_number.c \ + -f test/common_armv7l/functions/fork.c \ + -f test/common_armv7l/functions/execve.c \ + -f test/test25/kaem.c \ + --debug \ + -o test/test25/kaem.M1 || exit 1 + +# Build debug footer +blood-elf -f test/test25/kaem.M1 \ + -o test/test25/kaem-footer.M1 || exit 2 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_armv7l/armv7l_defs.M1 \ + -f test/common_armv7l/libc-core.M1 \ + -f test/test25/kaem.M1 \ + -f test/test25/kaem-footer.M1 \ + --LittleEndian \ + --architecture armv7l \ + -o test/test25/kaem.hex2 || exit 3 + +# Resolve all linkages +hex2 -f test/common_armv7l/ELF-armv7l-debug.hex2 \ + -f test/test25/kaem.hex2 \ + --LittleEndian \ + --architecture armv7l \ + --BaseAddress 0x10000 \ + -o test/results/test25-binary \ + --exec_enable || exit 4 + +exit 0 diff --git a/test/test26/hello-armv7l.sh b/test/test26/hello-armv7l.sh new file mode 100755 index 0000000..2b8f6d8 --- /dev/null +++ b/test/test26/hello-armv7l.sh @@ -0,0 +1,59 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## 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 +# Build the test +./bin/M2-Planet --architecture armv7l -f test/test26/lisp.h \ + -f test/common_armv7l/functions/malloc.c \ + -f functions/calloc.c \ + -f functions/in_set.c \ + -f functions/numerate_number.c \ + -f functions/match.c \ + -f test/common_armv7l/functions/file.c \ + -f functions/file_print.c \ + -f test/common_armv7l/functions/exit.c \ + -f test/test26/lisp.c \ + -f test/test26/lisp_cell.c \ + -f test/test26/lisp_eval.c \ + -f test/test26/lisp_print.c \ + -f test/test26/lisp_read.c \ + --debug \ + -o test/test26/lisp.M1 || exit 1 + +# Build debug footer +blood-elf -f test/test26/lisp.M1 \ + -o test/test26/lisp-footer.M1 || exit 2 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_armv7l/armv7l_defs.M1 \ + -f test/common_armv7l/libc-core.M1 \ + -f test/test26/lisp.M1 \ + -f test/test26/lisp-footer.M1 \ + --LittleEndian \ + --architecture armv7l \ + -o test/test26/lisp.hex2 || exit 3 + +# Resolve all linkages +hex2 -f test/common_armv7l/ELF-armv7l-debug.hex2 \ + -f test/test26/lisp.hex2 \ + --LittleEndian \ + --architecture armv7l \ + --BaseAddress 0x10000 \ + -o test/results/test26-binary \ + --exec_enable || exit 4 + +exit 0 diff --git a/test/test99/hello-armv7l.sh b/test/test99/hello-armv7l.sh new file mode 100755 index 0000000..05b823b --- /dev/null +++ b/test/test99/hello-armv7l.sh @@ -0,0 +1,48 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## 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 +# Build the test +bin/M2-Planet --architecture armv7l \ + -f test/common_armv7l/functions/putchar.c \ + -f test/common_armv7l/functions/getchar.c \ + -f test/common_armv7l/functions/exit.c \ + -f test/common_armv7l/functions/malloc.c \ + -f test/test99/cc500.c \ + -o test/test99/cc0.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_armv7l/armv7l_defs.M1 \ + -f test/common_armv7l/libc-core.M1 \ + -f test/test99/cc0.M1 \ + --LittleEndian \ + --architecture armv7l \ + -o test/test99/cc0.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test99/cc0.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test99-armv7l-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] +then + . ./sha256.sh + # Verify that the compiled program can compile itself + ./test/results/test99-armv7l-binary < test/test99/cc500.c >| test/test99/cc1 || exit 4 + out=$(sha256_check test/test99/proof0.answer) + [ "$out" = "test/test99/cc1: OK" ] || exit 5 +fi +exit 0 diff --git a/test/test99/hello-knight-posix.sh b/test/test99/hello-knight-posix.sh index f190616..2269d2e 100755 --- a/test/test99/hello-knight-posix.sh +++ b/test/test99/hello-knight-posix.sh @@ -39,9 +39,10 @@ hex2 -f test/common_knight/ELF-knight.hex2 -f test/test99/cc0.hex2 --BigEndian - # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] then + . ./sha256.sh # Verify that the compiled program can compile itself ./test/results/test99-binary < test/test99/cc500.c >| test/test99/cc1 || exit 4 - out=$(sha256sum -c test/test99/proof0.answer) + out=$(sha256_check test/test99/proof0.answer) [ "$out" = "test/test99/cc1: OK" ] || exit 5 fi exit 0 diff --git a/test/test99/hello-x86.sh b/test/test99/hello-x86.sh index 054760b..d2c0623 100755 --- a/test/test99/hello-x86.sh +++ b/test/test99/hello-x86.sh @@ -39,9 +39,10 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test99/cc0.hex2 --LittleEndian --a # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then + . ./sha256.sh # Verify that the compiled program can compile itself ./test/results/test99-x86-binary < test/test99/cc500.c >| test/test99/cc1 || exit 4 - out=$(sha256sum -c test/test99/proof0.answer) + out=$(sha256_check test/test99/proof0.answer) [ "$out" = "test/test99/cc1: OK" ] || exit 5 # Make it executable @@ -49,7 +50,7 @@ then # Verify that the result of it compiling itself can compile itself ./test/test99/cc1 < test/test99/cc500.c >| test/test99/cc2 || exit 6 - out=$(sha256sum -c test/test99/proof1.answer) + out=$(sha256_check test/test99/proof1.answer) [ "$out" = "test/test99/cc2: OK" ] || exit 7 fi exit 0