Resolved non-standard behavior across locales thanks to dddddd

This commit is contained in:
Jeremiah Orians 2019-04-07 17:11:18 -04:00
parent 442601197c
commit dc82e76d0d
No known key found for this signature in database
GPG Key ID: 5410E91C14959E87
52 changed files with 355 additions and 48 deletions

View File

@ -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

36
sha256.sh Normal file
View File

@ -0,0 +1,36 @@
#! /bin/sh
# Copyright (C) 2019 ng0 <ng0@n0.is>
#
# 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 <http://www.gnu.org/licenses/>.
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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

61
test/test24/hello-armv7l.sh Executable file
View File

@ -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 <http://www.gnu.org/licenses/>.
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

56
test/test25/hello-armv7l.sh Executable file
View File

@ -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 <http://www.gnu.org/licenses/>.
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

59
test/test26/hello-armv7l.sh Executable file
View File

@ -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 <http://www.gnu.org/licenses/>.
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

48
test/test99/hello-armv7l.sh Executable file
View File

@ -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 <http://www.gnu.org/licenses/>.
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

View File

@ -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

View File

@ -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