Added support for test03 for knight-posix

This commit is contained in:
Jeremiah Orians 2019-02-24 06:48:31 -05:00
parent 65f47417d4
commit a1309ae4b9
No known key found for this signature in database
GPG Key ID: 5410E91C14959E87
36 changed files with 103 additions and 52 deletions

View File

@ -29,6 +29,7 @@ Added --architecture flag
Added first knight-posix test
Added second knight-posix test
Added third knight-posix test
Added fourth knight-posix test
** Changed
Converted M2-Planet to use GNU style error message
@ -48,6 +49,7 @@ 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
Fixed CONSTANT logic for knight-posix
** Removed
Removed redundent x86 definitions

View File

@ -201,7 +201,7 @@ void function_call(char* s, int bool)
void constant_load(struct token_list* a)
{
if(1 == Architecture) emit_out("LOADI R0 @");
if(1 == Architecture) emit_out("LOADI R0 ");
else if(2 == Architecture) emit_out("LOAD_IMMEDIATE_eax %");
emit_out(a->arguments->s);
emit_out("\n");

View File

@ -62,13 +62,14 @@ results:
mkdir -p test/results
# tests
test: test00-x86-binary \
test00-knight-posix-binary \
test01-x86-binary \
test: test00-knight-posix-binary \
test01-knight-posix-binary \
test02-x86-binary \
test02-knight-posix-binary \
test03-binary \
test03-knight-posix-binary \
test00-x86-binary \
test01-x86-binary \
test02-x86-binary \
test03-x86-binary \
test04-binary \
test05-binary \
test06-binary \
@ -94,26 +95,29 @@ test: test00-x86-binary \
test100-binary | results
sha256sum -c test/test.answers
test00-x86-binary: M2-Planet | results
test/test00/hello-x86.sh
test00-knight-posix-binary: M2-Planet | results
test/test00/hello-knight-posix.sh
test01-x86-binary: M2-Planet | results
test/test01/hello-x86.sh
test01-knight-posix-binary: M2-Planet | results
test/test01/hello-knight-posix.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
test03-knight-posix-binary: M2-Planet | results
test/test03/hello-knight-posix.sh
test00-x86-binary: M2-Planet | results
test/test00/hello-x86.sh
test01-x86-binary: M2-Planet | results
test/test01/hello-x86.sh
test02-x86-binary: M2-Planet | results
test/test02/hello-x86.sh
test03-x86-binary: M2-Planet | results
test/test03/hello-x86.sh
test04-binary: M2-Planet | results
test/test04/hello.sh

View File

@ -4,7 +4,8 @@ fab674644b9519e8ec39e254e6b13fe5eccb9f861f7d9e7d2f736d40875b7546 test/results/t
eae96857f2b6d8e8ba86ac06e72345ea572622b358b23978bb5f2db1baadf41c test/results/test01-x86-binary
1cd9bdf671f1b26992bb34eebb52c745a4af930b34ef0bb25348a243d0f219aa test/results/test02-knight-posix-binary
8ead336d2f3f72d5874230492e0472edec61d355905e8636e3dfb2731695037c test/results/test02-x86-binary
2313cb3f1a2b9eb6bf15f8d43418e15d6c16f7f1b5c22700fdfc2b38beb59192 test/results/test03-binary
25f4fcd3834351b24f76eb78571770b4afa9812970fca3000600d2e26abe35f3 test/results/test03-knight-posix-binary
2313cb3f1a2b9eb6bf15f8d43418e15d6c16f7f1b5c22700fdfc2b38beb59192 test/results/test03-x86-binary
b7ddb37063c541c6a315809c4438aa235d6702f54bb64f4ffc88dbe78617de81 test/results/test04-binary
4d4ec6247a7cc9062a5b3d8adfec7199476715446723a0b882268afe6daad1f3 test/results/test05-binary
663fc6eefe965f237b6bf5a211398c8ae1210f97ff39b59603677e92462c68c7 test/results/test06-binary
@ -12,7 +13,7 @@ a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/t
f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/test08-binary
3b39e72f3de90ed690adfaf6145af46157cef2ec5e72867ac577fa27a0229894 test/results/test09-binary
020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-binary
3e1476dbe659f8e84d0b1b0fc303db70e5390f6fcb355002e19d90495726b92a test/results/test100-binary
8bcd6f50512d0c300d2fc0939363d4dbcfc17f255e8b0f938508149097023ee7 test/results/test100-binary
3fd11bad4a426ce1ff8fd9c6d7d2b943effae9f3f5740b7376e426e9b0555851 test/results/test11-binary
f98ab8e4bb35580e0dde96126d7a56aff66bda208d02c8d89390b40d6cff591c test/results/test12-binary
5051ffca2615144419f8ec1a5d4999486ae81e7781428f59e47e866af97cef92 test/results/test13-binary

View File

@ -22,7 +22,7 @@ bin/M2-Planet --architecture x86 -f test/test00/return.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test00/return.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test01/library_call.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test02/if.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -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 <http://www.gnu.org/licenses/>.
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/test03/constant.c \
-o test/test03/constant.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/test03/constant.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test03/constant.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test03/constant.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test03-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/test03-knight-posix-binary 2>&1 )
[ 42 = $? ] || exit 4
[ "$out" = "Hello mes" ] || exit 5
fi
exit 0

View File

@ -24,20 +24,20 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test03/constant.M1 \
--LittleEndian \
--architecture x86 \
-o test/test03/constant.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test03/constant.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test03-binary --exec_enable || exit 3
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test03/constant.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test03-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/test03-binary 2>&1 )
out=$(./test/results/test03-x86-binary 2>&1 )
[ 42 = $? ] || exit 4
[ "$out" = "Hello mes" ] || exit 5
fi

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test04/call.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test05/string.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -23,7 +23,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test06/for.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test07/do.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -25,7 +25,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test08/struct.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test09/goto.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -25,7 +25,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test10/nested_struct.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -100,7 +100,7 @@ blood-elf -f test/test100/cc.M1 \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test100/cc.M1 \
-f test/test100/cc-footer.M1 \
--LittleEndian \

View File

@ -1 +1 @@
f81305c04b1a7206ea65f99f9233243a0f888664c8eeba7621d1f4347eb700e6 test/test100/proof
8e3df151387b36580dfdf827ad2df237c72654ee31696f53e6961975d9baf4e3 test/test100/proof

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test11/break-do.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test12/break-for.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test13/break-while.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -23,7 +23,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test14/basic_args.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f functions/file.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test15/file_read.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -24,7 +24,7 @@ bin/M2-Planet --architecture x86 -f functions/file.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test16/file_write.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -25,7 +25,7 @@ bin/M2-Planet --architecture x86 -f functions/malloc.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test17/memset.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -25,7 +25,7 @@ bin/M2-Planet --architecture x86 -f functions/file.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test18/math.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -29,7 +29,7 @@ bin/M2-Planet --architecture x86 -f functions/file.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test19/getopt.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -25,7 +25,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test20/struct.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -33,7 +33,7 @@ blood-elf -f test/test21/blood-elf.M1 \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test21/blood-elf.M1 \
-f test/test21/blood-elf-footer.M1 \
--LittleEndian \

View File

@ -36,7 +36,7 @@ blood-elf -f test/test22/hex2_linker.M1 \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test22/hex2_linker.M1 \
-f test/test22/hex2_linker-footer.M1 \
--LittleEndian \

View File

@ -36,7 +36,7 @@ blood-elf -f test/test23/M1-macro.M1 \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test23/M1-macro.M1 \
-f test/test23/M1-macro-footer.M1 \
--LittleEndian \
@ -63,7 +63,7 @@ then
# Verify that the resulting file works
./test/results/test23-binary -f \
test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test21/test.M1 \
--LittleEndian \
--architecture x86 \

View File

@ -34,7 +34,7 @@ blood-elf -f test/test24/get_machine.M1 \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test24/get_machine.M1 \
-f test/test24/get_machine-footer.M1 \
--LittleEndian \

View File

@ -37,7 +37,7 @@ blood-elf -f test/test25/kaem.M1 \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test25/kaem.M1 \
-f test/test25/kaem-footer.M1 \
--LittleEndian \

View File

@ -40,7 +40,7 @@ blood-elf -f test/test26/lisp.M1 \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test26/lisp.M1 \
-f test/test26/lisp-footer.M1 \
--LittleEndian \

View File

@ -26,7 +26,7 @@ bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
-f functions/libc-core.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test99/cc0.M1 \
--LittleEndian \
--architecture x86 \