From 253674ea0508dff063e2e0730dd7bf4eb9f505b8 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 19 Jul 2019 14:24:35 -0400 Subject: [PATCH] Fix broken tests Also, make tests run in a *BSD environment --- kernel/stdio.asm | 24 ++++++++++++------------ tools/tests/unit/runtests.sh | 1 - tools/tests/unit/test_expr.asm | 2 ++ tools/tests/unit/test_parse_z.asm | 2 ++ tools/tests/unit/test_symbol.asm | 1 + tools/tests/zasm/errtests.sh | 2 +- tools/tests/zasm/geninstrs.py | 2 +- tools/tests/zasm/test7.asm | 2 ++ 8 files changed, 21 insertions(+), 15 deletions(-) diff --git a/kernel/stdio.asm b/kernel/stdio.asm index 0ecf8b9..edf0822 100644 --- a/kernel/stdio.asm +++ b/kernel/stdio.asm @@ -134,18 +134,18 @@ stdioReadC: ; save char for later ex af, af' ld a, (STDIO_BUFIDX) - push hl ;<| - ld hl, STDIO_BUF ; | - ; make HL point to dest spot | - call addHL ; | - ; Write our char down | - ex af, af' ; | - ld (hl), a ; | - ; follow up with a null char | - inc hl ; | - xor a ; | - ld (hl), a ; | - pop hl ;<| + push hl ; --> lvl 1 + ld hl, STDIO_BUF + ; make HL point to dest spot + call addHL + ; Write our char down + ex af, af' + ld (hl), a + ; follow up with a null char + inc hl + xor a + ld (hl), a + pop hl ; <-- lvl 1 ; inc idx, which still is in AF' ex af, af' inc a diff --git a/tools/tests/unit/runtests.sh b/tools/tests/unit/runtests.sh index e7fdb58..2174d76 100755 --- a/tools/tests/unit/runtests.sh +++ b/tools/tests/unit/runtests.sh @@ -1,7 +1,6 @@ #!/bin/sh set -e -set -o pipefail BASE=../../.. TOOLS=../.. diff --git a/tools/tests/unit/test_expr.asm b/tools/tests/unit/test_expr.asm index fd6b0f3..3b323d2 100644 --- a/tools/tests/unit/test_expr.asm +++ b/tools/tests/unit/test_expr.asm @@ -3,8 +3,10 @@ jp test #include "core.asm" #include "parse.asm" +#include "lib/util.asm" #include "zasm/util.asm" #include "zasm/const.asm" +#include "lib/parse.asm" #include "zasm/parse.asm" .equ SYM_RAMSTART RAMSTART #include "zasm/symbol.asm" diff --git a/tools/tests/unit/test_parse_z.asm b/tools/tests/unit/test_parse_z.asm index 30333c9..a7f765a 100644 --- a/tools/tests/unit/test_parse_z.asm +++ b/tools/tests/unit/test_parse_z.asm @@ -2,7 +2,9 @@ jp test #include "core.asm" #include "parse.asm" +#include "lib/util.asm" #include "zasm/util.asm" +#include "lib/parse.asm" #include "zasm/parse.asm" ; mocks. aren't used in tests diff --git a/tools/tests/unit/test_symbol.asm b/tools/tests/unit/test_symbol.asm index 03bd791..bff4b45 100644 --- a/tools/tests/unit/test_symbol.asm +++ b/tools/tests/unit/test_symbol.asm @@ -2,6 +2,7 @@ jp test #include "core.asm" +#include "lib/util.asm" #include "zasm/util.asm" #include "zasm/const.asm" .equ SYM_RAMSTART RAMSTART diff --git a/tools/tests/zasm/errtests.sh b/tools/tests/zasm/errtests.sh index 70a6a90..87537a9 100755 --- a/tools/tests/zasm/errtests.sh +++ b/tools/tests/zasm/errtests.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # no "set -e" because we test errors diff --git a/tools/tests/zasm/geninstrs.py b/tools/tests/zasm/geninstrs.py index 9bd1b33..580e5f5 100755 --- a/tools/tests/zasm/geninstrs.py +++ b/tools/tests/zasm/geninstrs.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # Generate almost all possible combination for instructions from instruction # tables diff --git a/tools/tests/zasm/test7.asm b/tools/tests/zasm/test7.asm index 7a01cac..1b28c11 100644 --- a/tools/tests/zasm/test7.asm +++ b/tools/tests/zasm/test7.asm @@ -30,11 +30,13 @@ #include "err.h" #include "zasm/const.asm" +#include "lib/util.asm" #include "zasm/util.asm" .equ IO_RAMSTART USER_RAMSTART #include "zasm/io.asm" .equ SYM_RAMSTART IO_RAMEND #include "zasm/symbol.asm" +#include "lib/parse.asm" #include "zasm/parse.asm" .equ TOK_RAMSTART SYM_RAMEND #include "zasm/tok.asm"