From 80b6f47e642fe8e5cac1836ef616a1ae1b3aa269 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 10 Oct 2018 22:21:26 -0700 Subject: 4682 - subx: start testing all layers of 'library' --- subx/050write_stderr.subx | 6 ++++++ subx/051test.subx | 11 +++++++++++ subx/apps/crenshaw2-1 | Bin 2258 -> 2522 bytes subx/apps/factorial | Bin 2256 -> 2520 bytes subx/test_layers | 10 ++++++++++ 5 files changed, 27 insertions(+) (limited to 'subx') diff --git a/subx/050write_stderr.subx b/subx/050write_stderr.subx index 51fd5a80..0eb402df 100644 --- a/subx/050write_stderr.subx +++ b/subx/050write_stderr.subx @@ -4,6 +4,12 @@ # op subop mod rm32 base index scale r32 # 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes +# main: (manual test if this is the last file loaded) + # exit(0) -- we don't bother testing write-stderr just yet + bb/copy-to-EBX 0/imm32 + b8/copy-to-EAX 1/imm32 + cd/syscall 0x80/imm8 + write-stderr: # s : (address array byte) -> # prolog 55/push-EBP diff --git a/subx/051test.subx b/subx/051test.subx index f60ba158..1e3968bf 100644 --- a/subx/051test.subx +++ b/subx/051test.subx @@ -4,6 +4,17 @@ # op subop mod rm32 base index scale r32 # 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes +# main: (manual test if this is the last file loaded) + # check-ints-equal(34, 34) == 1 + 68/push 34/imm32 + 68/push 34/imm32 + e8/call check-ints-equal/disp32 + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP + # exit(0) + bb/copy-to-EBX 0/imm32 + b8/copy-to-EAX 1/imm32 + cd/syscall 0x80/imm8 + # print msg to stderr if a != b, otherwise print "." check-ints-equal: # (a : int, b : int, msg : (address array byte)) -> boolean # prolog diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index dfd1442c..f551dbf9 100755 Binary files a/subx/apps/crenshaw2-1 and b/subx/apps/crenshaw2-1 differ diff --git a/subx/apps/factorial b/subx/apps/factorial index 3127b5c1..5b7811bc 100755 Binary files a/subx/apps/factorial and b/subx/apps/factorial differ diff --git a/subx/test_layers b/subx/test_layers index bd1d8b33..51fa905f 100755 --- a/subx/test_layers +++ b/subx/test_layers @@ -1,11 +1,21 @@ #!/bin/bash # Repeatedly stop building until successive layers, and run all tests built. +# +# Assumes .subx files all come after .cc files. set -e cd `dirname $0` +# add C++ files one at a time for f in [0-9]*cc do echo "=== $f" ./build_and_test_until $f || exit 1 done + +# add SubX files one at a time +for f in [0-9]*.subx +do + echo "=== $f" + CFLAGS=-g ./subx translate $(../enumerate/enumerate --until $f |grep '\.subx$') -o foo && ./subx run foo +done -- cgit 1.4.1-2-gfad0