Upgraded to 23/24 working tests

This commit is contained in:
Jeremiah Orians 2019-03-09 11:56:16 -05:00
parent 01658364e5
commit f01f805803
No known key found for this signature in database
GPG Key ID: 5410E91C14959E87
37 changed files with 915 additions and 120 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 16/24 working tests for knight-posix
Added 23/24 working tests for knight-posix
Added working HEAP/malloc to knight-posix
** Changed

View File

@ -87,7 +87,7 @@ blood-elf -f seed.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 seed.M1 \
-f bin/seed-footer.M1 \
--LittleEndian \
@ -104,4 +104,4 @@ hex2 -f test/common_x86/ELF-i386-debug.hex2 \
--exec_enable || exit 2
# self-host
./test/test100/hello.sh
./test/test100/hello-x86.sh

View File

@ -150,9 +150,9 @@ void function_call(char* s, int bool)
{
if(KNIGHT_POSIX == Architecture)
{
emit_out("LOAD R0 R15 @");
emit_out("LOAD R0 R14 ");
emit_out(s);
emit_out("MOVE R14 R13\n");
emit_out("\nMOVE R14 R13\n");
emit_out("CALL R0 R15\n");
}
else if(X86 == Architecture)
@ -574,11 +574,11 @@ void additive_expr_stub()
{
if(KNIGHT_POSIX == Architecture)
{
general_recursion(postfix_expr, "ADD R0 R0 R1\n", "+", additive_expr_stub);
general_recursion(postfix_expr, "ADD R0 R1 R0\n", "+", additive_expr_stub);
general_recursion(postfix_expr, "SUB R0 R1 R0\n", "-", additive_expr_stub);
general_recursion(postfix_expr, "MUL R0 R0 R1\n", "*", additive_expr_stub);
general_recursion(postfix_expr, "DIV R0 R0 R1\n", "/", additive_expr_stub);
general_recursion(postfix_expr, "MOD R0 R0 R1\n", "%", additive_expr_stub);
general_recursion(postfix_expr, "MUL R0 R1 R0\n", "*", additive_expr_stub);
general_recursion(postfix_expr, "DIVU R0 R1 R0\n", "/", additive_expr_stub);
general_recursion(postfix_expr, "MODU R0 R1 R0\n", "%", additive_expr_stub);
general_recursion(postfix_expr, "SAL R0 R1 R0\n", "<<", additive_expr_stub);
general_recursion(postfix_expr, "SAR R0 R1 R0\n", ">>", additive_expr_stub);
}

View File

@ -20,7 +20,7 @@ VPATH = bin:test:test/results
all: M2-Planet
M2-Planet: bin results
./test/test100/hello.sh
./test/test100/hello-x86.sh
# Clean up after ourselves
.PHONY: clean
@ -79,6 +79,15 @@ test: test00-knight-posix-binary \
test14-knight-posix-binary \
test15-knight-posix-binary \
test16-knight-posix-binary \
test17-knight-posix-binary \
test18-knight-posix-binary \
test19-knight-posix-binary \
test20-knight-posix-binary \
test21-knight-posix-binary \
test22-knight-posix-binary \
test23-knight-posix-binary \
test24-knight-posix-binary \
test99-knight-posix-binary \
test00-x86-binary \
test01-x86-binary \
test02-x86-binary \
@ -96,16 +105,16 @@ test: test00-knight-posix-binary \
test14-x86-binary \
test15-x86-binary \
test16-x86-binary \
test17-binary \
test18-binary \
test19-binary \
test20-binary \
test21-binary \
test22-binary \
test23-binary \
test24-binary \
test99-binary \
test100-binary | results
test17-x86-binary \
test18-x86-binary \
test19-x86-binary \
test20-x86-binary \
test21-x86-binary \
test22-x86-binary \
test23-x86-binary \
test24-x86-binary \
test99-x86-binary \
test100-x86-binary | results
sha256sum -c test/test.answers
test00-knight-posix-binary: M2-Planet | results
@ -159,6 +168,33 @@ test15-knight-posix-binary: M2-Planet | results
test16-knight-posix-binary: M2-Planet | results
test/test16/hello-knight-posix.sh
test17-knight-posix-binary: M2-Planet | results
test/test17/hello-knight-posix.sh
test18-knight-posix-binary: M2-Planet | results
test/test18/hello-knight-posix.sh
test19-knight-posix-binary: M2-Planet | results
test/test19/hello-knight-posix.sh
test20-knight-posix-binary: M2-Planet | results
test/test20/hello-knight-posix.sh
test21-knight-posix-binary: M2-Planet | results
test/test21/hello-knight-posix.sh
test22-knight-posix-binary: M2-Planet | results
test/test22/hello-knight-posix.sh
test23-knight-posix-binary: M2-Planet | results
test/test23/hello-knight-posix.sh
test24-knight-posix-binary: M2-Planet | results
test/test24/hello-knight-posix.sh
test99-knight-posix-binary: M2-Planet | results
test/test99/hello-knight-posix.sh
test00-x86-binary: M2-Planet | results
test/test00/hello-x86.sh
@ -210,35 +246,35 @@ test15-x86-binary: M2-Planet | results
test16-x86-binary: M2-Planet | results
test/test16/hello-x86.sh
test17-binary: M2-Planet | results
test/test17/hello.sh
test17-x86-binary: M2-Planet | results
test/test17/hello-x86.sh
test18-binary: M2-Planet | results
test/test18/hello.sh
test18-x86-binary: M2-Planet | results
test/test18/hello-x86.sh
test19-binary: M2-Planet | results
test/test19/hello.sh
test19-x86-binary: M2-Planet | results
test/test19/hello-x86.sh
test20-binary: M2-Planet | results
test/test20/hello.sh
test20-x86-binary: M2-Planet | results
test/test20/hello-x86.sh
test21-binary: M2-Planet | results
test/test21/hello.sh
test21-x86-binary: M2-Planet | results
test/test21/hello-x86.sh
test22-binary: M2-Planet | results
test/test22/hello.sh
test22-x86-binary: M2-Planet | results
test/test22/hello-x86.sh
test23-binary: M2-Planet | results
test/test23/hello.sh
test23-x86-binary: M2-Planet | results
test/test23/hello-x86.sh
test24-binary: M2-Planet | results
test/test24/hello.sh
test24-x86-binary: M2-Planet | results
test/test24/hello-x86.sh
test99-binary: M2-Planet | results
test/test99/hello.sh
test99-x86-binary: M2-Planet | results
test/test99/hello-x86.sh
test100-binary: M2-Planet | results
test/test100/hello.sh
test100-x86-binary: M2-Planet | results
test/test100/hello-x86.sh
# Generate test answers
.PHONY: Generate-test-answers

View File

@ -20,6 +20,6 @@
void exit(int value)
{
/* Until we need to do a better job */
asm("HALT");
asm("LOAD R0 R14 0"
"EXIT");
}

View File

@ -33,28 +33,37 @@ void fputc(char s, FILE* f)
"FPUTC");
}
FILE* open_write(char* filename)
{
asm("LOAD R0 R14 0"
"FOPEN_WRITE");
}
/* Important values needed for open
* O_RDONLY => 0
* O_WRONLY => 1
* O_RDWR => 2
* O_CREAT => 64
* O_TRUNC => 512
* S_IRWXU => 00700
* S_IXUSR => 00100
* S_IWUSR => 00200
* S_IRUSR => 00400
*/
FILE* open_read(char* filename)
FILE* open(char* filename, int flag, int mode)
{
asm("LOAD R0 R14 0"
"FOPEN_READ");
"LOAD R1 R14 4"
"LOAD R2 R14 8"
"FOPEN"
"FALSE R2");
}
FILE* fopen(char* filename, char* mode)
{
FILE* f;
if('w' == mode[0])
{
f = open_write(filename);
{ /* 577 is O_WRONLY|O_CREAT|O_TRUNC, 384 is 600 in octal */
f = open(filename, 577, 384);
}
else
{ /* Everything else is a read */
f = open_read(filename);
f = open(filename, 0, 0);
}
/* Negative numbers are error codes */

View File

@ -0,0 +1,22 @@
/* 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/>.
*/
int getchar()
{
asm("LOADUI R1 0"
"FGETC");
}

View File

@ -15,6 +15,8 @@
* along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
*/
CONSTANT NULL 0
void* malloc(int size)
{
asm("LOAD R0 R14 0"

View File

@ -0,0 +1,48 @@
/* 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/>.
*/
/*
* chmod() changes the mode of the file specified whose pathname is given in
* pathname, which is dereferenced if it is a symbolic link.
* fchmod() changes the mode of the file referred to by the open file
* descriptor fd.
* The new file mode is specified in mode, which is a bit mask created by
* ORing together zero or more of the following:
* S_ISUID (04000) set-user-ID (set process effective user ID on execve(2))
* S_ISGID (02000) set-group-ID (set process effective group ID on execve(2)
* mandatory locking, as described in fcntl(2); take a new file's group from
* parent directory, as described in chown(2) and mkdir(2))
* S_ISVTX (01000) sticky bit (restricted deletion flag, as described in
* unlink(2))
* S_IRUSR (00400) read by owner
* S_IWUSR (00200) write by owner
* S_IXUSR (00100) execute/search by owner ("search" applies for directories
* , and means that entries within the directory can be accessed)
* S_IRGRP (00040) read by group
* S_IWGRP (00020) write by group
* S_IXGRP (00010) execute/search by group
* S_IROTH (00004) read by others
* S_IWOTH (00002) write by others
* S_IXOTH (00001) execute/search by others
*/
int chmod(char *pathname, int mode)
{
asm("LOAD R0 R14 0"
"LOAD R1 R14 4"
"CHMOD");
}

View File

@ -0,0 +1,31 @@
/* 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/>.
*/
struct utsname
{
char sysname[65]; /* Operating system name (e.g., "Linux") */
char nodename[65]; /* Name within "some implementation-defined network" */
char release[65]; /* Operating system release (e.g., "2.6.28") */
char version[65]; /* Operating system version */
char machine[65]; /* Hardware identifier */
};
int uname(struct utsname* unameData)
{
asm("LOAD R0 R14 0"
"UNAME");
}

View File

@ -239,14 +239,14 @@ DEFINE CMPSKIPUI.L E000A15
DEFINE JUMP 3C00
# HALCODE Group
DEFINE FOPEN_READ 42100000
DEFINE FOPEN_WRITE 42100001
DEFINE FCLOSE 42100002
DEFINE REWIND 42100003
DEFINE FSEEK 42100004
DEFINE FOPEN 42000002
DEFINE FCLOSE 42000003
DEFINE FSEEK 42000008
DEFINE EXIT 4200003C
DEFINE UNAME 4200003F
DEFINE CHMOD 4200005A
DEFINE FGETC 42100100
DEFINE FPUTC 42100200
DEFINE HAL_MEM 42110000
# 0OP Group
DEFINE NOP 00000000

View File

@ -27,7 +27,7 @@
CALLI R15 @FUNCTION_main
;; Exit to kernel
HALT ; Simply halt for now
EXIT ; Return what is in R0
;; Our default heap pointer
:HEAP

View File

@ -1,44 +1,53 @@
9852ca1e2f800d638fdf89b575f52660c6ced5f49b720cc6fc7c70707c39d2f1 test/results/test00-knight-posix-binary
ecb6e61a22a91dbb16dd38c39d4e96e0fe2fe08618870e73de952eba8407fde8 test/results/test00-knight-posix-binary
c52562bd0aabb86ce8ca177f22f8d0455769b444df2d4d62894faab63b7151d8 test/results/test00-x86-binary
0aa2ef6098a7a493a736211e518288ca93493981ad218a4e491f04f55080277d test/results/test01-knight-posix-binary
f9cd9d4163191ff823470ad9326d4781c9326df2ec30f67f3c4969b7ebd204d7 test/results/test01-knight-posix-binary
eae96857f2b6d8e8ba86ac06e72345ea572622b358b23978bb5f2db1baadf41c test/results/test01-x86-binary
9df33d73f0542c7fbf79c673fae5d69c69b19ecb606d211948f77bec80e46328 test/results/test02-knight-posix-binary
c44f7bf03b04597407d7799240621cd2f8ab4c7f493d9b387457b9bcab474abe test/results/test02-knight-posix-binary
8ead336d2f3f72d5874230492e0472edec61d355905e8636e3dfb2731695037c test/results/test02-x86-binary
adefc49f603e8b1dd0ef1b637fad7a7b5129b6d13a0f035053321b20cf0d5fe2 test/results/test03-knight-posix-binary
029d1612a23dca14be326f1e59b799d7bb32146f93d429b3fe562485ef9d3e2b test/results/test03-knight-posix-binary
2313cb3f1a2b9eb6bf15f8d43418e15d6c16f7f1b5c22700fdfc2b38beb59192 test/results/test03-x86-binary
f89a0d90551202ef5c11cf6db96427d3d90744ae3fc80377697c6074f732b85b test/results/test04-knight-posix-binary
34a3ab7245eb2b8b7d9ecb5c70910aab35f0251d92c83808d7bd351fcf3a1b53 test/results/test04-knight-posix-binary
b7ddb37063c541c6a315809c4438aa235d6702f54bb64f4ffc88dbe78617de81 test/results/test04-x86-binary
a2fb27f6f48af191349c0b6e6e3f20d71111c6fade89ca64ecc322f174aa7f6f test/results/test05-knight-posix-binary
37fc203ef5cceeb990269cc9f1b2fc2048242d602c5e602c70085cf083695ba5 test/results/test05-knight-posix-binary
b5b76320ccda887a30b0bbefc2a5c302c8f2aa3c398d92ef3a79526690b25d6f test/results/test05-x86-binary
87a40340fd19f9a2ab453f6f829787a20e15b544bf93eea6e32d9a50a6b149f1 test/results/test06-knight-posix-binary
848c3a38b388ca6ac5365d479a4a2e38db66e352d325744a867883de3ef2b56b test/results/test06-knight-posix-binary
663fc6eefe965f237b6bf5a211398c8ae1210f97ff39b59603677e92462c68c7 test/results/test06-x86-binary
0391332486fd5d1963d98973e551b7cdec37607438b6b8edaf1dec24cac3f036 test/results/test07-knight-posix-binary
e2fd7b3828464283bd4047bc7b1fc0c293536901c8163f1ebabce5e7edc9cab3 test/results/test07-knight-posix-binary
a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/test07-x86-binary
85b872f7915b49ecc2fea739c08467975114a9bed377b4da6bddd8d83d480a61 test/results/test08-knight-posix-binary
1846f5dc1b565f9193551b75539bfd15648e569ad3030ac349c5ff6a477fd2e5 test/results/test08-knight-posix-binary
f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/test08-x86-binary
f7ae952f677689d4ea367e769505742bd33f3334150c743bc1535399313f4fab test/results/test09-knight-posix-binary
8d3a62bbec7b97712bf762279eca9a4cac19bc36856cf8bc2e71cfc4dae64c23 test/results/test09-knight-posix-binary
3b39e72f3de90ed690adfaf6145af46157cef2ec5e72867ac577fa27a0229894 test/results/test09-x86-binary
242b52e6539ffc2d5e330791b500150f11eaeb8b7ecf5b8b0d7061db31ae0af5 test/results/test10-knight-posix-binary
4002710fb3ae948391cb9ad07615569ad66c9b3c725da50c9fbb213ca2ad365e test/results/test10-knight-posix-binary
020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-x86-binary
c50892d9f292bed448ef560b1f8859fb6ee866e03ea46cf9a2c7d8e9b0cc8407 test/results/test100-binary
034b935e21d305f04902e2c723c5987989b54281568af202faa2ef0dc88b0427 test/results/test11-knight-posix-binary
cfc679289c923122f70105359c458fc9c37223040f646402ba5596781f1b5392 test/results/test100-x86-binary
00e90d3873786cbd98ebf53e4497af74c3a5893a9155d101f01965b732c9fa73 test/results/test11-knight-posix-binary
3fd11bad4a426ce1ff8fd9c6d7d2b943effae9f3f5740b7376e426e9b0555851 test/results/test11-x86-binary
fdb1c933804bb3fb557e4d96ad2d5c28671d209309219fe1a7fea426e831c3f0 test/results/test12-knight-posix-binary
95d2b26308e9990770d051ab6329ff0271225de56bf48683dfc44ab819e93fb7 test/results/test12-knight-posix-binary
f98ab8e4bb35580e0dde96126d7a56aff66bda208d02c8d89390b40d6cff591c test/results/test12-x86-binary
5725b2f3ac824c642e294deea5ee623212bc9282606ef13202bf4147af412b40 test/results/test13-knight-posix-binary
396f41af4f2c7a1b5609bd14bafd22a97fb01bf1e617212cabfc2de80efa1ed2 test/results/test13-knight-posix-binary
5051ffca2615144419f8ec1a5d4999486ae81e7781428f59e47e866af97cef92 test/results/test13-x86-binary
5228f46ffb9de6be780018842e2c27b21bc32242ecda42fc7690d9699fa28411 test/results/test14-knight-posix-binary
ac5d4a515eaaa9613e680660dff1d1431e3bcf8364705733f937eead57cba3a2 test/results/test14-knight-posix-binary
a8218958b628066e2fda63d3933f1bf607c358d7bdfe84fc02596393698ea5f6 test/results/test14-x86-binary
fb236fc1e19d23192b009649ca27bfee71448595070446dcab78e0a849d4002d test/results/test15-knight-posix-binary
fd2089fb70f04263db1c77850f01451ac62277fcf43396a26d77ab12f62778eb test/results/test15-knight-posix-binary
3adb4a5f3995583ba711151361728a26c3fbf0140864d13b4b042978ca45d683 test/results/test15-x86-binary
b38b6b617cd0cde16cb0aea289ae3eeb9fc13e6535c66898afe8ef1e5ac63398 test/results/test16-knight-posix-binary
9535702c742f8cc1f080d6d73e74532e46b8c2b55ffceb45503353db861a470f 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
365c96fb8368710d620a76facd6bebcdeeb6f6d30ceaf0a6f1567fc3fcbe9b54 test/results/test20-binary
3c7654eb26247e5f0460dad9e539220a68078cd8c56aae8457b5a97dc6eab892 test/results/test21-binary
3d0a08c9f38b995318f459884880dbcd309930fb9f51de05c83eb1fcc3fa1825 test/results/test22-binary
3060147b0d56e30c6d9a36ed4675feed306c398df365d2c1c9e2d1c88b40cf3e test/results/test23-binary
ff810940f7e8a9df916b20bc95d7d83a7165c57853e343417826a9f5a607c2db test/results/test24-binary
140af7fb3ef89d84b21bd3fe69f0d3260650ec0467c0ffadf9268fad573a397f test/results/test99-binary
e59bc15dc72b2cc9ad5d7c32049bb8685d8ee3c479300d036aea79b5daae27c3 test/results/test17-knight-posix-binary
9b4ba350b07cc1cf4e12dc77d0d960ded1511f13b887363b0eb33421e2f626de test/results/test17-x86-binary
1914f1ee41d8b93a674302cb74476750c2d5adb72b4f500d55d857e07350791d test/results/test18-knight-posix-binary
8de7384c4633b1d5c60bbbb298d7f4b738e52fbc266ef4ef9a48b3cb995e3176 test/results/test18-x86-binary
0b7143f4b5acf033c2e4cfb92b3b33207cb6192a1aa93cf3fcc0f6cdad08ecf1 test/results/test19-knight-posix-binary
cefc5a53513abdb9069dc8bdb7b4529307420d5dd412a10112c3253bdcd29c46 test/results/test19-x86-binary
69431d7394bb562da4a1f52e1d99ddd76157adcf1d9cbbd8319f24d63cae1976 test/results/test20-knight-posix-binary
365c96fb8368710d620a76facd6bebcdeeb6f6d30ceaf0a6f1567fc3fcbe9b54 test/results/test20-x86-binary
610062cdfd9122450b52bb979ea867bb035be497ff6b1022bce71e289fa290de test/results/test21-knight-posix-binary
3c7654eb26247e5f0460dad9e539220a68078cd8c56aae8457b5a97dc6eab892 test/results/test21-x86-binary
c813eb07c8b0d111b5be195341bead571f7a97341f63e08bfe07daeab40b28dc test/results/test22-knight-posix-binary
3d0a08c9f38b995318f459884880dbcd309930fb9f51de05c83eb1fcc3fa1825 test/results/test22-x86-binary
6ff4275400660e7b14db53230da0be3e2106892af73cb5c99d39a18186dafe09 test/results/test23-knight-posix-binary
3060147b0d56e30c6d9a36ed4675feed306c398df365d2c1c9e2d1c88b40cf3e test/results/test23-x86-binary
7f5ef758eaafbc4b5364f7400332865c91c3224d60407cc4093eddfb09eddcb4 test/results/test24-knight-posix-binary
ff810940f7e8a9df916b20bc95d7d83a7165c57853e343417826a9f5a607c2db test/results/test24-x86-binary
6ae47d659b0eefa641e361d4e6c57c89c121ec0618a0d0817b35b6887aa24a1a test/results/test99-knight-posix-binary
140af7fb3ef89d84b21bd3fe69f0d3260650ec0467c0ffadf9268fad573a397f test/results/test99-x86-binary

View File

@ -0,0 +1,151 @@
#! /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
if [ -f bin/M2-Planet ]
then
./bin/M2-Planet --architecture knight-posix \
-f test/common_knight/functions/file.c \
-f test/common_knight/functions/malloc.c \
-f functions/calloc.c \
-f test/common_knight/functions/exit.c \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/file_print.c \
-f functions/number_pack.c \
-f functions/string.c \
-f cc.h \
-f cc_reader.c \
-f cc_strings.c \
-f cc_types.c \
-f cc_core.c \
-f cc.c \
--debug \
-o test/test100/cc.M1 || exit 1
elif [ -f bin/M2-Planet-seed ]
then
[ ! -f test/results ] && mkdir -p test/results
./bin/M2-Planet-seed -f test/common_knight/functions/file.c \
-f test/common_knight/functions/malloc.c \
-f functions/calloc.c \
-f test/common_knight/functions/exit.c \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/file_print.c \
-f functions/number_pack.c \
-f functions/string.c \
-f cc.h \
-f cc_reader.c \
-f cc_strings.c \
-f cc_types.c \
-f cc_core.c \
-f cc.c \
--debug \
-o test/test100/cc.M1 || exit 1
else
[ -z "${CC+x}" ] && export CC=gcc
[ -z "${CFLAGS+x}" ] && export CFLAGS=" -D_GNU_SOURCE -O0 -std=c99 -ggdb"
${CC} ${CFLAGS} \
functions/match.c \
functions/in_set.c \
functions/numerate_number.c \
functions/file_print.c \
functions/number_pack.c \
functions/string.c \
cc_reader.c \
cc_strings.c \
cc_types.c \
cc_core.c \
cc.c \
cc.h \
gcc_req.h \
-o bin/M2-Planet-gcc
./bin/M2-Planet-gcc --architecture knight-posix \
-f test/common_knight/functions/file.c \
-f test/common_knight/functions/malloc.c \
-f functions/calloc.c \
-f test/common_knight/functions/exit.c \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/file_print.c \
-f functions/number_pack.c \
-f functions/string.c \
-f cc.h \
-f cc_reader.c \
-f cc_strings.c \
-f cc_types.c \
-f cc_core.c \
-f cc.c \
--debug \
-o test/test100/cc.M1 || exit 1
fi
# 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/test100/cc.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test100/cc.hex2 || exit 3
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 \
-f test/test100/cc.hex2 \
--BigEndian \
--architecture knight-posix \
--BaseAddress 0x00 \
-o test/results/test100-knight-posix-binary --exec_enable || exit 4
# Ensure binary works if host machine supports test
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
then
# Verify that the resulting file works
./test/results/test100-knight-posix-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 \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/file_print.c \
-f functions/number_pack.c \
-f functions/string.c \
-f cc.h \
-f cc_reader.c \
-f cc_strings.c \
-f cc_types.c \
-f cc_core.c \
-f cc.c \
-o test/test100/proof || exit 5
out=$(sha256sum -c test/test100/proof.answer)
[ "$out" = "test/test100/proof: OK" ] || exit 6
[ ! -e bin/M2-Planet ] && mv test/results/test100-knight-posix-binary bin/M2-Planet
else
[ -e bin/M2-Planet-gcc ] && cp bin/M2-Planet-gcc bin/M2-Planet
# Seeds only exist if you can build natively
[ -e bin/M2-Planet-seed ] && cp test/results/test100-knight-posix-binary bin/M2-Planet
fi
exit 0

View File

@ -19,7 +19,8 @@ set -ex
# Build the test
if [ -f bin/M2-Planet ]
then
./bin/M2-Planet --architecture x86 -f test/common_x86/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 \
@ -39,8 +40,8 @@ then
-o test/test100/cc.M1 || exit 1
elif [ -f bin/M2-Planet-seed ]
then
[ ! -f test/results ] && mkdir test/results
./bin/M2-Planet-seed --architecture x86 -f test/common_x86/functions/file.c \
[ ! -f test/results ] && mkdir -p test/results
./bin/M2-Planet-seed -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 +79,8 @@ ${CC} ${CFLAGS} \
gcc_req.h \
-o bin/M2-Planet-gcc
./bin/M2-Planet-gcc --architecture x86 -f test/common_x86/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 \
@ -117,13 +119,14 @@ hex2 -f test/common_x86/ELF-i386-debug.hex2 \
--LittleEndian \
--architecture x86 \
--BaseAddress 0x8048000 \
-o test/results/test100-binary --exec_enable || exit 4
-o test/results/test100-x86-binary --exec_enable || exit 4
# Ensure binary works if host machine supports test
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
then
# Verify that the resulting file works
./test/results/test100-binary --architecture x86 -f test/common_x86/functions/file.c \
./test/results/test100-x86-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 \
@ -143,11 +146,11 @@ then
out=$(sha256sum -c test/test100/proof.answer)
[ "$out" = "test/test100/proof: OK" ] || exit 6
[ ! -e bin/M2-Planet ] && mv test/results/test100-binary bin/M2-Planet
[ ! -e bin/M2-Planet ] && mv test/results/test100-x86-binary bin/M2-Planet
else
[ -e bin/M2-Planet-gcc ] && cp bin/M2-Planet-gcc bin/M2-Planet
# Seeds only exist if you can build natively
[ -e bin/M2-Planet-seed ] && cp test/results/test100-binary bin/M2-Planet
[ -e bin/M2-Planet-seed ] && cp test/results/test100-x86-binary bin/M2-Planet
fi
exit 0

View File

@ -1 +1 @@
22a36afd9af84a5b94c48d700c30a664db3fc4fdff6c07ec150b86afd6993d51 test/test100/proof
8a1a2003dbe7e6f08b7501879d82212e19e0d8d54aecca9e744b627b2ebf079b test/test100/proof

View File

@ -0,0 +1,45 @@
#! /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/malloc.c \
-f functions/calloc.c \
-f test/common_knight/functions/putchar.c \
-f test/test17/memset.c \
-o test/test17/memset.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/test17/memset.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test17/memset.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test17/memset.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test17-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/test17-knight-posix-binary >| test/test17/proof || exit 4
out=$(sha256sum -c test/test17/proof.answer)
[ "$out" = "test/test17/proof: OK" ] || exit 5
fi
exit 0

View File

@ -32,13 +32,13 @@ M1 -f test/common_x86/x86_defs.M1 \
-o test/test17/memset.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test17/memset.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test17-binary --exec_enable || exit 3
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test17/memset.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test17-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/test17-binary >| test/test17/proof || exit 4
./test/results/test17-x86-binary >| test/test17/proof || exit 4
out=$(sha256sum -c test/test17/proof.answer)
[ "$out" = "test/test17/proof: OK" ] || exit 5
fi

View File

@ -0,0 +1,45 @@
#! /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/malloc.c \
-f functions/calloc.c \
-f test/test18/math.c \
-o test/test18/math.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/test18/math.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test18/math.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test18/math.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test18-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/test18-knight-posix-binary >| test/test18/proof || exit 4
out=$(sha256sum -c test/test18/proof.answer)
[ "$out" = "test/test18/proof: OK" ] || exit 5
fi
exit 0

View File

@ -32,13 +32,13 @@ M1 -f test/common_x86/x86_defs.M1 \
-o test/test18/math.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test18/math.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test18-binary --exec_enable || exit 3
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test18/math.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test18-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/test18-binary >| test/test18/proof || exit 4
./test/results/test18-x86-binary >| test/test18/proof || exit 4
out=$(sha256sum -c test/test18/proof.answer)
[ "$out" = "test/test18/proof: OK" ] || exit 5
fi

View File

@ -0,0 +1,49 @@
#! /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/malloc.c \
-f functions/calloc.c \
-f test/common_knight/functions/exit.c \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f test/test19/getopt.c \
-o test/test19/getopt.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/test19/getopt.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test19/getopt.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test19/getopt.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test19-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/test19-knight-posix-binary -f test/test19/input -o test/test19/proof || exit 4
out=$(sha256sum -c test/test19/proof.answer)
[ "$out" = "test/test19/proof: OK" ] || exit 5
fi
exit 0

View File

@ -36,13 +36,13 @@ M1 -f test/common_x86/x86_defs.M1 \
-o test/test19/getopt.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test19/getopt.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test19-binary --exec_enable || exit 3
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test19/getopt.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test19-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/test19-binary -f test/test19/input -o test/test19/proof || exit 4
./test/results/test19-x86-binary -f test/test19/input -o test/test19/proof || exit 4
out=$(sha256sum -c test/test19/proof.answer)
[ "$out" = "test/test19/proof: OK" ] || exit 5
fi

View File

@ -0,0 +1,45 @@
#! /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/common_knight/functions/malloc.c \
-f test/test20/struct.c \
-o test/test20/struct.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/test20/struct.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test20/struct.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test20/struct.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test20-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/test20-knight-posix-binary 2>&1 )
[ 20 = $? ] || exit 4
[ "$out" = "35419896642975313541989657891634" ] || exit 5
fi
exit 0

View File

@ -32,13 +32,13 @@ M1 -f test/common_x86/x86_defs.M1 \
-o test/test20/struct.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test20/struct.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test20-binary --exec_enable || exit 3
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test20/struct.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test20-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/test20-binary 2>&1 )
out=$(./test/results/test20-x86-binary 2>&1 )
[ 20 = $? ] || exit 4
[ "$out" = "35419896642975313541989657891634" ] || exit 5
fi

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 knight-posix \
-f test/common_knight/functions/exit.c \
-f test/common_knight/functions/file.c \
-f functions/file_print.c \
-f test/common_knight/functions/malloc.c \
-f functions/calloc.c \
-f functions/match.c \
-f test/test21/blood-elf.c \
-o test/test21/blood-elf.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/test21/blood-elf.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test21/blood-elf.hex2 || exit 3
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 \
-f test/test21/blood-elf.hex2 \
--BigEndian \
--architecture knight-posix \
--BaseAddress 0x00 \
-o test/results/test21-knight-posix-binary \
--exec_enable || exit 4
# 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/test21-knight-posix-binary --version 2>&1 )
[ 0 = $? ] || exit 5
[ "$out" = "blood-elf 0.1
(Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6
# 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" = "test/test21/proof: OK" ] || exit 8
fi
exit 0

View File

@ -46,20 +46,20 @@ hex2 -f test/common_x86/ELF-i386-debug.hex2 \
--LittleEndian \
--architecture x86 \
--BaseAddress 0x8048000 \
-o test/results/test21-binary \
-o test/results/test21-x86-binary \
--exec_enable || exit 4
# 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/test21-binary --version 2>&1 )
out=$(./test/results/test21-x86-binary --version 2>&1 )
[ 0 = $? ] || exit 5
[ "$out" = "blood-elf 0.1
(Basically Launches Odd Object Dump ExecutabLe Files" ] || exit 6
# Verify that the resulting file works
./test/results/test21-binary -f test/test21/test.M1 -o test/test21/proof || exit 7
./test/results/test21-x86-binary -f test/test21/test.M1 -o test/test21/proof || exit 7
out=$(sha256sum -c test/test21/proof.answer)
[ "$out" = "test/test21/proof: OK" ] || exit 8
fi

View File

@ -0,0 +1,67 @@
#! /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/exit.c \
-f test/common_knight/functions/file.c \
-f functions/file_print.c \
-f test/common_knight/functions/malloc.c \
-f functions/calloc.c \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f test/common_knight/functions/stat.c \
-f test/test22/hex2_linker.c \
-o test/test22/hex2_linker.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/test22/hex2_linker.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test22/hex2_linker.hex2 || exit 3
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 \
-f test/test22/hex2_linker.hex2 \
--BigEndian \
--architecture knight-posix \
--BaseAddress 0x00 \
-o test/results/test22-knight-posix-binary \
--exec_enable || exit 4
# 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/test22-knight-posix-binary --version 2>&1 )
[ 0 = $? ] || exit 5
[ "$out" = "hex2 0.3" ] || exit 6
# Verify that the resulting file works
./test/results/test22-knight-posix-binary -f test/common_x86/ELF-i386.hex2 \
-f test/test22/test.hex2 \
--LittleEndian \
--architecture x86 \
--BaseAddress 0x8048000 \
-o test/test22/proof || exit 7
out=$(sha256sum -c test/test22/proof.answer)
[ "$out" = "test/test22/proof: OK" ] || exit 8
fi
exit 0

View File

@ -25,7 +25,7 @@ set -x
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/stat.c \
-f test/common_x86/functions/stat.c \
-f test/test22/hex2_linker.c \
--debug \
-o test/test22/hex2_linker.M1 || exit 1
@ -49,19 +49,19 @@ hex2 -f test/common_x86/ELF-i386-debug.hex2 \
--LittleEndian \
--architecture x86 \
--BaseAddress 0x8048000 \
-o test/results/test22-binary \
-o test/results/test22-x86-binary \
--exec_enable || exit 4
# 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/test22-binary --version 2>&1 )
out=$(./test/results/test22-x86-binary --version 2>&1 )
[ 0 = $? ] || exit 5
[ "$out" = "hex2 0.3" ] || exit 6
# Verify that the resulting file works
./test/results/test22-binary -f test/common_x86/ELF-i386.hex2 \
./test/results/test22-x86-binary -f test/common_x86/ELF-i386.hex2 \
-f test/test22/test.hex2 \
--LittleEndian \
--architecture x86 \

View File

@ -0,0 +1,69 @@
#! /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/exit.c \
-f test/common_knight/functions/file.c \
-f functions/file_print.c \
-f test/common_knight/functions/malloc.c \
-f functions/calloc.c \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/string.c \
-f test/test23/M1-macro.c \
-o test/test23/M1-macro.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/test23/M1-macro.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test23/M1-macro.hex2 || exit 3
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 \
-f test/test23/M1-macro.hex2 \
--BigEndian \
--architecture knight-posix \
--BaseAddress 0x00 \
-o test/results/test23-knight-posix-binary \
--exec_enable || exit 4
# 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/test23-knight-posix-binary --version 2>&1 )
[ 0 = $? ] || exit 5
[ "$out" = "M1 0.3" ] || exit 6
# Verify that the resulting file works
./test/results/test23-knight-posix-binary -f \
test/common_x86/x86_defs.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test21/test.M1 \
--LittleEndian \
--architecture x86 \
-o test/test23/proof || exit 7
out=$(sha256sum -c test/test23/proof.answer)
[ "$out" = "test/test23/proof: OK" ] || exit 8
fi
exit 0

View File

@ -49,19 +49,19 @@ hex2 -f test/common_x86/ELF-i386-debug.hex2 \
--LittleEndian \
--architecture x86 \
--BaseAddress 0x8048000 \
-o test/results/test23-binary \
-o test/results/test23-x86-binary \
--exec_enable || exit 4
# 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/test23-binary --version 2>&1 )
out=$(./test/results/test23-x86-binary --version 2>&1 )
[ 0 = $? ] || exit 5
[ "$out" = "M1 0.3" ] || exit 6
# Verify that the resulting file works
./test/results/test23-binary -f \
./test/results/test23-x86-binary -f \
test/common_x86/x86_defs.M1 \
-f test/common_x86/libc-core.M1 \
-f test/test21/test.M1 \

View File

@ -0,0 +1,55 @@
#! /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/exit.c \
-f test/common_knight/functions/file.c \
-f functions/file_print.c \
-f test/common_knight/functions/malloc.c \
-f functions/calloc.c \
-f test/common_knight/functions/uname.c \
-f functions/match.c \
-f test/test24/get_machine.c \
-o test/test24/get_machine.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/test24/get_machine.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test24/get_machine.hex2 || exit 3
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 \
-f test/test24/get_machine.hex2 \
--BigEndian \
--architecture knight-posix \
--BaseAddress 0x00 \
-o test/results/test24-knight-posix-binary \
--exec_enable || exit 4
# 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/test24-knight-posix-binary ${GET_MACHINE_FLAGS} 2>&1 )
[ 0 = $? ] || exit 5
[ "$out" = "knight*" ] || exit 6
fi
exit 0

View File

@ -22,7 +22,7 @@ set -x
-f functions/file_print.c \
-f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f functions/uname.c \
-f test/common_x86/functions/uname.c \
-f functions/match.c \
-f test/test24/get_machine.c \
--debug \
@ -47,14 +47,14 @@ hex2 -f test/common_x86/ELF-i386-debug.hex2 \
--LittleEndian \
--architecture x86 \
--BaseAddress 0x8048000 \
-o test/results/test24-binary \
-o test/results/test24-x86-binary \
--exec_enable || exit 4
# 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/test24-binary ${GET_MACHINE_FLAGS} 2>&1 )
out=$(./test/results/test24-x86-binary ${GET_MACHINE_FLAGS} 2>&1 )
[ 0 = $? ] || exit 5
[ "$out" = "x86" ] || exit 6
fi

View File

@ -0,0 +1,47 @@
#! /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/putchar.c \
-f test/common_knight/functions/getchar.c \
-f test/common_knight/functions/exit.c \
-f test/common_knight/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_knight/knight_defs.M1 \
-f test/common_knight/libc-core.M1 \
-f test/test99/cc0.M1 \
--BigEndian \
--architecture knight-posix \
-o test/test99/cc0.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test99/cc0.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test99-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 can compile itself
./test/results/test99-binary < test/test99/cc500.c >| test/test99/cc1 || exit 4
out=$(sha256sum -c test/test99/proof0.answer)
[ "$out" = "test/test99/cc1: OK" ] || exit 5
fi
exit 0

View File

@ -17,8 +17,9 @@
set -ex
# Build the test
bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
-f functions/getchar.c \
bin/M2-Planet --architecture x86 \
-f test/common_x86/functions/putchar.c \
-f test/common_x86/functions/getchar.c \
-f test/common_x86/functions/exit.c \
-f test/common_x86/functions/malloc.c \
-f test/test99/cc500.c \
@ -33,13 +34,13 @@ M1 -f test/common_x86/x86_defs.M1 \
-o test/test99/cc0.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test99/cc0.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test99-binary --exec_enable || exit 3
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test99/cc0.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test99-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 can compile itself
./test/results/test99-binary < test/test99/cc500.c >| test/test99/cc1 || exit 4
./test/results/test99-x86-binary < test/test99/cc500.c >| test/test99/cc1 || exit 4
out=$(sha256sum -c test/test99/proof0.answer)
[ "$out" = "test/test99/cc1: OK" ] || exit 5