diff --git a/CHANGELOG.org b/CHANGELOG.org index fabcbc2..045f1f8 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -28,6 +28,7 @@ Added support for GET_MACHINE_FLAGS in tests Added --architecture flag Added first knight-posix test Added second knight-posix test +Added third knight-posix test ** Changed Converted M2-Planet to use GNU style error message @@ -46,6 +47,7 @@ Fixed version number to reflect current version Thanks to akkartik several documentation issues were identified and fixed Corrected missed license headers Fix regression caused by Linux 4.17 +Fixed broken logic comparions for knight-posix ** Removed Removed redundent x86 definitions diff --git a/cc_core.c b/cc_core.c index 08fcd69..4849a62 100644 --- a/cc_core.c +++ b/cc_core.c @@ -596,12 +596,12 @@ void relational_expr_stub() { if(1 == Architecture) { - general_recursion(additive_expr, "CMPSKIP.L R0 R1\nLOADUI R0 1\n", "<", relational_expr_stub); - general_recursion(additive_expr, "CMPSKIP.LE R0 R1\nLOADUI R0 1\n", "<=", relational_expr_stub); - general_recursion(additive_expr, "CMPSKIP.GE R0 R1\nLOADUI R0 1\n", ">=", relational_expr_stub); - general_recursion(additive_expr, "CMPSKIP.G R0 R1\nLOADUI R0 1\n", ">", relational_expr_stub); - general_recursion(additive_expr, "CMPSKIP.E R0 R1\nLOADUI R0 1\n", "==", relational_expr_stub); - general_recursion(additive_expr, "CMPSKIP.NE R0 R1\nLOADUI R0 1\n", "!=", relational_expr_stub); + general_recursion(additive_expr, "CMPSKIP.GE R0 R1\nLOADUI R0 1\n", "<", relational_expr_stub); + general_recursion(additive_expr, "CMPSKIP.G R0 R1\nLOADUI R0 1\n", "<=", relational_expr_stub); + general_recursion(additive_expr, "CMPSKIP.L R0 R1\nLOADUI R0 1\n", ">=", relational_expr_stub); + general_recursion(additive_expr, "CMPSKIP.LE R0 R1\nLOADUI R0 1\n", ">", relational_expr_stub); + general_recursion(additive_expr, "CMPSKIP.NE R0 R1\nLOADUI R0 1\n", "==", relational_expr_stub); + general_recursion(additive_expr, "CMPSKIP.E R0 R1\nLOADUI R0 1\n", "!=", relational_expr_stub); } else if(2 == Architecture) { diff --git a/makefile b/makefile index c86a621..aaa894f 100644 --- a/makefile +++ b/makefile @@ -66,7 +66,8 @@ test: test00-x86-binary \ test00-knight-posix-binary \ test01-x86-binary \ test01-knight-posix-binary \ - test02-binary \ + test02-x86-binary \ + test02-knight-posix-binary \ test03-binary \ test04-binary \ test05-binary \ @@ -105,8 +106,11 @@ test01-x86-binary: M2-Planet | results test01-knight-posix-binary: M2-Planet | results test/test01/hello-knight-posix.sh -test02-binary: M2-Planet | results - test/test02/hello.sh +test02-x86-binary: M2-Planet | results + test/test02/hello-x86.sh + +test02-knight-posix-binary: M2-Planet | results + test/test02/hello-knight-posix.sh test03-binary: M2-Planet | results test/test03/hello.sh diff --git a/test/test.answers b/test/test.answers index 9273d11..617149d 100644 --- a/test/test.answers +++ b/test/test.answers @@ -2,7 +2,8 @@ c52562bd0aabb86ce8ca177f22f8d0455769b444df2d4d62894faab63b7151d8 test/results/test00-x86-binary fab674644b9519e8ec39e254e6b13fe5eccb9f861f7d9e7d2f736d40875b7546 test/results/test01-knight-posix-binary eae96857f2b6d8e8ba86ac06e72345ea572622b358b23978bb5f2db1baadf41c test/results/test01-x86-binary -8ead336d2f3f72d5874230492e0472edec61d355905e8636e3dfb2731695037c test/results/test02-binary +1cd9bdf671f1b26992bb34eebb52c745a4af930b34ef0bb25348a243d0f219aa test/results/test02-knight-posix-binary +8ead336d2f3f72d5874230492e0472edec61d355905e8636e3dfb2731695037c test/results/test02-x86-binary 2313cb3f1a2b9eb6bf15f8d43418e15d6c16f7f1b5c22700fdfc2b38beb59192 test/results/test03-binary b7ddb37063c541c6a315809c4438aa235d6702f54bb64f4ffc88dbe78617de81 test/results/test04-binary 4d4ec6247a7cc9062a5b3d8adfec7199476715446723a0b882268afe6daad1f3 test/results/test05-binary @@ -11,7 +12,7 @@ a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/t f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/test08-binary 3b39e72f3de90ed690adfaf6145af46157cef2ec5e72867ac577fa27a0229894 test/results/test09-binary 020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-binary -0a6eca36e9eea6a72595906b3990a16a0433f5404a6add00d245f99fe6308f75 test/results/test100-binary +3e1476dbe659f8e84d0b1b0fc303db70e5390f6fcb355002e19d90495726b92a test/results/test100-binary 3fd11bad4a426ce1ff8fd9c6d7d2b943effae9f3f5740b7376e426e9b0555851 test/results/test11-binary f98ab8e4bb35580e0dde96126d7a56aff66bda208d02c8d89390b40d6cff591c test/results/test12-binary 5051ffca2615144419f8ec1a5d4999486ae81e7781428f59e47e866af97cef92 test/results/test13-binary diff --git a/test/test02/hello-knight-posix.sh b/test/test02/hello-knight-posix.sh new file mode 100755 index 0000000..14075cf --- /dev/null +++ b/test/test02/hello-knight-posix.sh @@ -0,0 +1,44 @@ +#! /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 knight-posix -f test/common_knight/functions/putchar.c \ + -f test/common_knight/functions/exit.c \ + -f test/test02/if.c \ + -o test/test02/if.M1 || exit 1 + +# Macro assemble with libc written in M1-Macro +M1 -f test/common_knight/knight_defs.M1 \ + -f test/common_knight/libc-core.M1 \ + -f test/test02/if.M1 \ + --BigEndian \ + --architecture knight-posix \ + -o test/test02/if.hex2 || exit 2 + +# Resolve all linkages +hex2 -f test/common_knight/ELF-knight.hex2 -f test/test02/if.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test02-knight-posix-binary --exec_enable || exit 3 + +# Ensure binary works if host machine supports test +if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] +then + # Verify that the compiled program returns the correct result + out=$(./test/results/test02-knight-posix-binary 2>&1 ) + [ 42 = $? ] || exit 4 + [ "$out" = "Hello mes" ] || exit 5 +fi +exit 0 diff --git a/test/test02/hello.sh b/test/test02/hello-x86.sh similarity index 94% rename from test/test02/hello.sh rename to test/test02/hello-x86.sh index 2892050..3405d83 100755 --- a/test/test02/hello.sh +++ b/test/test02/hello-x86.sh @@ -31,13 +31,13 @@ M1 -f test/common_x86/x86_defs.M1 \ -o test/test02/if.hex2 || exit 2 # Resolve all linkages -hex2 -f test/common_x86/ELF-i386.hex2 -f test/test02/if.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test02-binary --exec_enable || exit 3 +hex2 -f test/common_x86/ELF-i386.hex2 -f test/test02/if.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test02-x86-binary --exec_enable || exit 3 # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then # Verify that the compiled program returns the correct result - out=$(./test/results/test02-binary 2>&1 ) + out=$(./test/results/test02-x86-binary 2>&1 ) [ 42 = $? ] || exit 4 [ "$out" = "Hello mes" ] || exit 5 fi diff --git a/test/test100/proof.answer b/test/test100/proof.answer index aea85bd..489793d 100644 --- a/test/test100/proof.answer +++ b/test/test100/proof.answer @@ -1 +1 @@ -690bc220b9748b6328ad98084cccbd83080a4bba09838e364fee5a52dff079d1 test/test100/proof +f81305c04b1a7206ea65f99f9233243a0f888664c8eeba7621d1f4347eb700e6 test/test100/proof