Upgraded to 16/24 working tests

This commit is contained in:
Jeremiah Orians 2019-02-28 20:52:01 -05:00
parent 577f19dea9
commit 01658364e5
No known key found for this signature in database
GPG Key ID: 5410E91C14959E87
19 changed files with 213 additions and 42 deletions

View File

@ -26,7 +26,7 @@ Added support for octal and binary numbers
Added support for \0
Added support for GET_MACHINE_FLAGS in tests
Added --architecture flag
Added 14/24 working tests for knight-posix
Added 16/24 working tests for knight-posix
Added working HEAP/malloc to knight-posix
** Changed
@ -41,6 +41,7 @@ Changed default architecture to knight-native
Moved x86 specific exit.c and putchar.c to test/common_x86/functions
Relocated x86 specific libc.M1 to test/common_x86
Formalized Knight-posix execve standard
Relocated x86 specific file.c to test/common_x86/functions
** Fixed
Fixed typo in file headers

View File

@ -77,6 +77,8 @@ test: test00-knight-posix-binary \
test12-knight-posix-binary \
test13-knight-posix-binary \
test14-knight-posix-binary \
test15-knight-posix-binary \
test16-knight-posix-binary \
test00-x86-binary \
test01-x86-binary \
test02-x86-binary \
@ -92,8 +94,8 @@ test: test00-knight-posix-binary \
test12-x86-binary \
test13-x86-binary \
test14-x86-binary \
test15-binary \
test16-binary \
test15-x86-binary \
test16-x86-binary \
test17-binary \
test18-binary \
test19-binary \
@ -151,6 +153,12 @@ test13-knight-posix-binary: M2-Planet | results
test14-knight-posix-binary: M2-Planet | results
test/test14/hello-knight-posix.sh
test15-knight-posix-binary: M2-Planet | results
test/test15/hello-knight-posix.sh
test16-knight-posix-binary: M2-Planet | results
test/test16/hello-knight-posix.sh
test00-x86-binary: M2-Planet | results
test/test00/hello-x86.sh
@ -196,11 +204,11 @@ test13-x86-binary: M2-Planet | results
test14-x86-binary: M2-Planet | results
test/test14/hello-x86.sh
test15-binary: M2-Planet | results
test/test15/hello.sh
test15-x86-binary: M2-Planet | results
test/test15/hello-x86.sh
test16-binary: M2-Planet | results
test/test16/hello.sh
test16-x86-binary: M2-Planet | results
test/test16/hello-x86.sh
test17-binary: M2-Planet | results
test/test17/hello.sh

View File

@ -0,0 +1,72 @@
/* Copyright (C) 2016 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/>.
*/
// CONSTANT stdin 0
// CONSTANT stdout 1
// CONSTANT stderr 2
// CONSTANT EOF 0xFFFFFFFF
int fgetc(FILE* f)
{
asm("LOAD R1 R14 0"
"FGETC");
}
void fputc(char s, FILE* f)
{
asm("LOAD R0 R14 0"
"LOAD R1 R14 4"
"FPUTC");
}
FILE* open_write(char* filename)
{
asm("LOAD R0 R14 0"
"FOPEN_WRITE");
}
FILE* open_read(char* filename)
{
asm("LOAD R0 R14 0"
"FOPEN_READ");
}
FILE* fopen(char* filename, char* mode)
{
FILE* f;
if('w' == mode[0])
{
f = open_write(filename);
}
else
{ /* Everything else is a read */
f = open_read(filename);
}
/* Negative numbers are error codes */
if(0 > f)
{
return 0;
}
return f;
}
int fclose(FILE* stream)
{
asm("LOAD R0 R14 0"
"FCLOSE");
}

View File

@ -18,6 +18,6 @@
void putchar(int c)
{
asm("LOAD R0 R14 0"
"FALSE R1"
"LOADUI R1 1"
"FPUTC");
}

View File

@ -1,36 +1,38 @@
9852ca1e2f800d638fdf89b575f52660c6ced5f49b720cc6fc7c70707c39d2f1 test/results/test00-knight-posix-binary
c52562bd0aabb86ce8ca177f22f8d0455769b444df2d4d62894faab63b7151d8 test/results/test00-x86-binary
928eef8ec4892cfd602efbe5509f93e2b787edf868320d0e67d6843566993321 test/results/test01-knight-posix-binary
0aa2ef6098a7a493a736211e518288ca93493981ad218a4e491f04f55080277d test/results/test01-knight-posix-binary
eae96857f2b6d8e8ba86ac06e72345ea572622b358b23978bb5f2db1baadf41c test/results/test01-x86-binary
cbeb10391dbb9f4db172b529bc8daf0daf089f405ebbee3e5a6ec9e515cfdf75 test/results/test02-knight-posix-binary
9df33d73f0542c7fbf79c673fae5d69c69b19ecb606d211948f77bec80e46328 test/results/test02-knight-posix-binary
8ead336d2f3f72d5874230492e0472edec61d355905e8636e3dfb2731695037c test/results/test02-x86-binary
2f26b4307604ab214b197ae2270d102a918bb92805d8d5ed8e2a506990503784 test/results/test03-knight-posix-binary
adefc49f603e8b1dd0ef1b637fad7a7b5129b6d13a0f035053321b20cf0d5fe2 test/results/test03-knight-posix-binary
2313cb3f1a2b9eb6bf15f8d43418e15d6c16f7f1b5c22700fdfc2b38beb59192 test/results/test03-x86-binary
614941257943816b34bb13c6798fb2c3fcc253f1f6a4204282d1c1694cfeebc3 test/results/test04-knight-posix-binary
f89a0d90551202ef5c11cf6db96427d3d90744ae3fc80377697c6074f732b85b test/results/test04-knight-posix-binary
b7ddb37063c541c6a315809c4438aa235d6702f54bb64f4ffc88dbe78617de81 test/results/test04-x86-binary
4ee5729158a7c3682605696f4aa59c2ac373c8bd8fec113da06eb499471c9141 test/results/test05-knight-posix-binary
a2fb27f6f48af191349c0b6e6e3f20d71111c6fade89ca64ecc322f174aa7f6f test/results/test05-knight-posix-binary
b5b76320ccda887a30b0bbefc2a5c302c8f2aa3c398d92ef3a79526690b25d6f test/results/test05-x86-binary
06317267e6f6eb9d6214406d6ece5e8df965c3c3f523d939027099cff275c0f1 test/results/test06-knight-posix-binary
87a40340fd19f9a2ab453f6f829787a20e15b544bf93eea6e32d9a50a6b149f1 test/results/test06-knight-posix-binary
663fc6eefe965f237b6bf5a211398c8ae1210f97ff39b59603677e92462c68c7 test/results/test06-x86-binary
bd0e8878f0a12755d50ae1f9dba169cf49a07ff3d3cff0f5dfc36044dfd1e7db test/results/test07-knight-posix-binary
0391332486fd5d1963d98973e551b7cdec37607438b6b8edaf1dec24cac3f036 test/results/test07-knight-posix-binary
a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/test07-x86-binary
5c5667ef92a7b02b3516b029921ac000d4769a8a112f128b96099b7bbe869bab test/results/test08-knight-posix-binary
85b872f7915b49ecc2fea739c08467975114a9bed377b4da6bddd8d83d480a61 test/results/test08-knight-posix-binary
f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/test08-x86-binary
84a650501212aef7c01d35ccfbab668f7fe35a1ae834b2c874be6eb3ae1fb973 test/results/test09-knight-posix-binary
f7ae952f677689d4ea367e769505742bd33f3334150c743bc1535399313f4fab test/results/test09-knight-posix-binary
3b39e72f3de90ed690adfaf6145af46157cef2ec5e72867ac577fa27a0229894 test/results/test09-x86-binary
24f11239bf55776eddf7116a5fe48e7ff8df3cbdf24e4d8dfd7d46d940df7b96 test/results/test10-knight-posix-binary
242b52e6539ffc2d5e330791b500150f11eaeb8b7ecf5b8b0d7061db31ae0af5 test/results/test10-knight-posix-binary
020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-x86-binary
c50892d9f292bed448ef560b1f8859fb6ee866e03ea46cf9a2c7d8e9b0cc8407 test/results/test100-binary
28653927f7d2929a2168b88ad681b7ad0fb4e68422a097ceaaa5406e2bf500d5 test/results/test11-knight-posix-binary
034b935e21d305f04902e2c723c5987989b54281568af202faa2ef0dc88b0427 test/results/test11-knight-posix-binary
3fd11bad4a426ce1ff8fd9c6d7d2b943effae9f3f5740b7376e426e9b0555851 test/results/test11-x86-binary
8b522a97c51f816e69939b9a1e0c4572a834e5b616bf92acb21c804887c95b31 test/results/test12-knight-posix-binary
fdb1c933804bb3fb557e4d96ad2d5c28671d209309219fe1a7fea426e831c3f0 test/results/test12-knight-posix-binary
f98ab8e4bb35580e0dde96126d7a56aff66bda208d02c8d89390b40d6cff591c test/results/test12-x86-binary
552e4f59224318c5d7b4b790f397c83e20e666af097f01dc32bcb241377242a9 test/results/test13-knight-posix-binary
5725b2f3ac824c642e294deea5ee623212bc9282606ef13202bf4147af412b40 test/results/test13-knight-posix-binary
5051ffca2615144419f8ec1a5d4999486ae81e7781428f59e47e866af97cef92 test/results/test13-x86-binary
4e3b3c645466cd90bafcb1bfddc2bb0b5c7466fc01b3a3a37bd0453567d444af test/results/test14-knight-posix-binary
5228f46ffb9de6be780018842e2c27b21bc32242ecda42fc7690d9699fa28411 test/results/test14-knight-posix-binary
a8218958b628066e2fda63d3933f1bf607c358d7bdfe84fc02596393698ea5f6 test/results/test14-x86-binary
3adb4a5f3995583ba711151361728a26c3fbf0140864d13b4b042978ca45d683 test/results/test15-binary
d70e072f4f1f077d10ff65e9216ca8b423b996e35d68d208025db7a78b062f50 test/results/test16-binary
fb236fc1e19d23192b009649ca27bfee71448595070446dcab78e0a849d4002d test/results/test15-knight-posix-binary
3adb4a5f3995583ba711151361728a26c3fbf0140864d13b4b042978ca45d683 test/results/test15-x86-binary
b38b6b617cd0cde16cb0aea289ae3eeb9fc13e6535c66898afe8ef1e5ac63398 test/results/test16-knight-posix-binary
d70e072f4f1f077d10ff65e9216ca8b423b996e35d68d208025db7a78b062f50 test/results/test16-x86-binary
9b4ba350b07cc1cf4e12dc77d0d960ded1511f13b887363b0eb33421e2f626de test/results/test17-binary
8de7384c4633b1d5c60bbbb298d7f4b738e52fbc266ef4ef9a48b3cb995e3176 test/results/test18-binary
cefc5a53513abdb9069dc8bdb7b4529307420d5dd412a10112c3253bdcd29c46 test/results/test19-binary

View File

@ -19,7 +19,7 @@ set -ex
# Build the test
if [ -f bin/M2-Planet ]
then
./bin/M2-Planet --architecture x86 -f functions/file.c \
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/file.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/exit.c \
@ -40,7 +40,7 @@ then
elif [ -f bin/M2-Planet-seed ]
then
[ ! -f test/results ] && mkdir test/results
./bin/M2-Planet-seed --architecture x86 -f functions/file.c \
./bin/M2-Planet-seed --architecture x86 -f test/common_x86/functions/file.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/exit.c \
@ -78,7 +78,7 @@ ${CC} ${CFLAGS} \
gcc_req.h \
-o bin/M2-Planet-gcc
./bin/M2-Planet-gcc --architecture x86 -f functions/file.c \
./bin/M2-Planet-gcc --architecture x86 -f test/common_x86/functions/file.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/exit.c \
@ -123,7 +123,7 @@ hex2 -f test/common_x86/ELF-i386-debug.hex2 \
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
then
# Verify that the resulting file works
./test/results/test100-binary --architecture x86 -f functions/file.c \
./test/results/test100-binary --architecture x86 -f test/common_x86/functions/file.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/exit.c \

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 -ex
# Build the test
bin/M2-Planet --architecture knight-posix -f test/common_knight/functions/file.c \
-f test/common_knight/functions/putchar.c \
-f test/test15/file_read.c \
-o test/test15/file_read.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/test15/file_read.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test15/file_read.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test15/file_read.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test15-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 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" = "test/test15/proof: OK" ] || exit 5
fi
exit 0

View File

@ -17,7 +17,7 @@
set -ex
# Build the test
bin/M2-Planet --architecture x86 -f functions/file.c \
bin/M2-Planet --architecture x86 -f test/common_x86/functions/file.c \
-f test/common_x86/functions/putchar.c \
-f test/test15/file_read.c \
-o test/test15/file_read.M1 || exit 1
@ -31,13 +31,13 @@ M1 -f test/common_x86/x86_defs.M1 \
-o test/test15/file_read.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test15/file_read.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test15-binary --exec_enable || exit 3
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test15/file_read.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test15-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 resulting file works
./test/results/test15-binary test/test15/file_read.c >| test/test15/proof || exit 4
./test/results/test15-x86-binary test/test15/file_read.c >| test/test15/proof || exit 4
out=$(sha256sum -c test/test15/proof.answer)
[ "$out" = "test/test15/proof: OK" ] || exit 5
fi

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 -ex
# Build the test
bin/M2-Planet --architecture knight-posix -f test/common_knight/functions/file.c \
-f test/common_knight/functions/putchar.c \
-f test/test16/file_write.c \
-o test/test16/file_write.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/test16/file_write.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test16/file_write.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test16/file_write.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test16-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 resulting file works
./test/results/test16-knight-posix-binary test/test16/proof || exit 4
out=$(sha256sum -c test/test16/proof.answer)
[ "$out" = "test/test16/proof: OK" ] || exit 5
fi
exit 0

View File

@ -17,7 +17,7 @@
set -ex
# Build the test
bin/M2-Planet --architecture x86 -f functions/file.c \
bin/M2-Planet --architecture x86 -f test/common_x86/functions/file.c \
-f test/common_x86/functions/putchar.c \
-f test/test16/file_write.c \
-o test/test16/file_write.M1 || exit 1
@ -31,13 +31,13 @@ M1 -f test/common_x86/x86_defs.M1 \
-o test/test16/file_write.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test16/file_write.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test16-binary --exec_enable || exit 3
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test16/file_write.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test16-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 resulting file works
./test/results/test16-binary test/test16/proof || exit 4
./test/results/test16-x86-binary test/test16/proof || exit 4
out=$(sha256sum -c test/test16/proof.answer)
[ "$out" = "test/test16/proof: OK" ] || exit 5
fi

View File

@ -17,7 +17,7 @@
set -ex
# Build the test
bin/M2-Planet --architecture x86 -f functions/file.c \
bin/M2-Planet --architecture x86 -f test/common_x86/functions/file.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/test18/math.c \

View File

@ -17,7 +17,7 @@
set -ex
# Build the test
bin/M2-Planet --architecture x86 -f functions/file.c \
bin/M2-Planet --architecture x86 -f test/common_x86/functions/file.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/exit.c \

View File

@ -18,7 +18,7 @@
set -x
# Build the test
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/exit.c \
-f functions/file.c \
-f test/common_x86/functions/file.c \
-f functions/file_print.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \

View File

@ -18,7 +18,7 @@
set -x
# Build the test
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/exit.c \
-f functions/file.c \
-f test/common_x86/functions/file.c \
-f functions/file_print.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \

View File

@ -18,7 +18,7 @@
set -x
# Build the test
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/exit.c \
-f functions/file.c \
-f test/common_x86/functions/file.c \
-f functions/file_print.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \

View File

@ -18,7 +18,7 @@
set -x
# Build the test
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/exit.c \
-f functions/file.c \
-f test/common_x86/functions/file.c \
-f functions/file_print.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \

View File

@ -18,7 +18,7 @@
set -x
# Build the test
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/exit.c \
-f functions/file.c \
-f test/common_x86/functions/file.c \
-f functions/file_print.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \

View File

@ -23,7 +23,7 @@ set -x
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/match.c \
-f functions/file.c \
-f test/common_x86/functions/file.c \
-f functions/file_print.c \
-f test/common_x86/functions/exit.c \
-f test/test26/lisp.c \