From 785b3750289fe2bd748ae369c854e2ef36e5d9cf Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 27 Jun 2020 07:41:42 -0400 Subject: [PATCH] tests: separate tests that need to run on z80 vs those that don't --- runtests.sh | 2 -- tests/Makefile | 9 ++++++--- tests/README.md | 4 ++-- tests/cvm/runtests.sh | 26 ++++++++++++++++++++++++++ tests/{forth => cvm}/test_ari.fs | 0 tests/{forth => cvm}/test_cmp.fs | 0 tests/{forth => cvm}/test_flow.fs | 0 tests/{forth => cvm}/test_parse.fs | 0 tests/{forth => }/harness.fs | 0 tests/{forth => z80}/runtests.sh | 2 +- tests/{forth => z80}/test_sdc.fs | 0 11 files changed, 35 insertions(+), 8 deletions(-) create mode 100755 tests/cvm/runtests.sh rename tests/{forth => cvm}/test_ari.fs (100%) rename tests/{forth => cvm}/test_cmp.fs (100%) rename tests/{forth => cvm}/test_flow.fs (100%) rename tests/{forth => cvm}/test_parse.fs (100%) rename tests/{forth => }/harness.fs (100%) rename tests/{forth => z80}/runtests.sh (90%) rename tests/{forth => z80}/test_sdc.fs (100%) diff --git a/runtests.sh b/runtests.sh index b4334e8..122bc40 100755 --- a/runtests.sh +++ b/runtests.sh @@ -4,8 +4,6 @@ git submodule init git submodule update git clean -fxd -make -C cvm -make -C emul make -C tests # verify that forth.bin is stable diff --git a/tests/Makefile b/tests/Makefile index 92d53ec..18b12af 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,6 +1,9 @@ -EMULDIR = ../emul +CDIR = ../cvm +EDIR = ../emul .PHONY: run run: - $(MAKE) -C $(EMULDIR) all - cd forth && ./runtests.sh + $(MAKE) -C $(CDIR) all + $(MAKE) -C $(EDIR) all + cd cvm && ./runtests.sh + cd z80 && ./runtests.sh diff --git a/tests/README.md b/tests/README.md index e805014..1044362 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,4 +1,4 @@ # Testing Collapse OS -This folder contains Collapse OS' automated testing suite. To run, it needs -`/emul` to be built. You can run all tests with `make`. +This folder contains Collapse OS' automated testing suite. You can run all tests +with `make`. diff --git a/tests/cvm/runtests.sh b/tests/cvm/runtests.sh new file mode 100755 index 0000000..4379dda --- /dev/null +++ b/tests/cvm/runtests.sh @@ -0,0 +1,26 @@ +#!/bin/sh -e + +BASE=../.. +EXEC="${BASE}/cvm/forth" +TMP=$(mktemp) + +chk() { + echo "Running test $1" + cat ../harness.fs $1 > ${TMP} + if ! ${EXEC} ${TMP}; then + exit 1 + fi +} + +if [ ! -z $1 ]; then + chk $1 + exit 0 +fi + +# those tests run without any builtin +for fn in test_*.fs; do + chk "${fn}" +done + +echo "All tests passed!" +rm ${TMP} diff --git a/tests/forth/test_ari.fs b/tests/cvm/test_ari.fs similarity index 100% rename from tests/forth/test_ari.fs rename to tests/cvm/test_ari.fs diff --git a/tests/forth/test_cmp.fs b/tests/cvm/test_cmp.fs similarity index 100% rename from tests/forth/test_cmp.fs rename to tests/cvm/test_cmp.fs diff --git a/tests/forth/test_flow.fs b/tests/cvm/test_flow.fs similarity index 100% rename from tests/forth/test_flow.fs rename to tests/cvm/test_flow.fs diff --git a/tests/forth/test_parse.fs b/tests/cvm/test_parse.fs similarity index 100% rename from tests/forth/test_parse.fs rename to tests/cvm/test_parse.fs diff --git a/tests/forth/harness.fs b/tests/harness.fs similarity index 100% rename from tests/forth/harness.fs rename to tests/harness.fs diff --git a/tests/forth/runtests.sh b/tests/z80/runtests.sh similarity index 90% rename from tests/forth/runtests.sh rename to tests/z80/runtests.sh index 5e6ea0e..ed5e469 100755 --- a/tests/forth/runtests.sh +++ b/tests/z80/runtests.sh @@ -6,7 +6,7 @@ TMP=$(mktemp) chk() { echo "Running test $1" - cat harness.fs $1 > ${TMP} + cat ../harness.fs $1 > ${TMP} if ! ${EXEC} ${TMP}; then exit 1 fi diff --git a/tests/forth/test_sdc.fs b/tests/z80/test_sdc.fs similarity index 100% rename from tests/forth/test_sdc.fs rename to tests/z80/test_sdc.fs