From 5b3557841e78e1dae51f6b5c71b5867d366cbae0 Mon Sep 17 00:00:00 2001 From: marcobaye Date: Wed, 14 Feb 2024 00:49:01 +0000 Subject: [PATCH] added a few more tests and Makefiles to automate them git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@336 4df02467-bbd4-4a76-a152-e7ce94205b78 --- testing/Makefile | 13 +++++++++++++ testing/cpus/Makefile | 17 +++++++++++++++++ testing/cpus/check-all-cpus.sh | 8 -------- testing/errors/Makefile | 15 +++++++++++++++ testing/errors/opnotsupp2.a | 1 + testing/errors/opnotsupp3.a | 1 + testing/errors/opnotsupp4.a | 1 + testing/errors/valuenotdefined3.a | 2 ++ testing/errors/valuenotdefined4.a | 2 ++ testing/warnings/Makefile | 21 +++++++++++++++++++++ testing/warnings/initmem.a | 2 ++ testing/warnings/limit.a | 6 ++++++ testing/warnings/segment1.a | 6 ++++++ testing/warnings/segment2.a | 6 ++++++ testing/warnings/start.a | 6 ++++++ 15 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 testing/Makefile create mode 100644 testing/cpus/Makefile delete mode 100755 testing/cpus/check-all-cpus.sh create mode 100644 testing/errors/Makefile create mode 100644 testing/errors/opnotsupp2.a create mode 100644 testing/errors/opnotsupp3.a create mode 100644 testing/errors/opnotsupp4.a create mode 100644 testing/errors/valuenotdefined3.a create mode 100644 testing/errors/valuenotdefined4.a create mode 100644 testing/warnings/Makefile create mode 100644 testing/warnings/initmem.a create mode 100644 testing/warnings/limit.a create mode 100644 testing/warnings/segment1.a create mode 100644 testing/warnings/segment2.a create mode 100644 testing/warnings/start.a diff --git a/testing/Makefile b/testing/Makefile new file mode 100644 index 0000000..95d2efb --- /dev/null +++ b/testing/Makefile @@ -0,0 +1,13 @@ + +.SILENT: + +all: + echo "Testing CPUs..." + echo + make -C cpus + echo "Testing errors..." + echo + make -C errors + echo "Testing warnings..." + echo + make -C warnings diff --git a/testing/cpus/Makefile b/testing/cpus/Makefile new file mode 100644 index 0000000..613641c --- /dev/null +++ b/testing/cpus/Makefile @@ -0,0 +1,17 @@ +ACMEFLAGS = -v0 +CPUS := $(subst .a,,$(subst test-,,$(wildcard test-*.a))) +FILES = $(foreach N,$(CPUS),$(N).o) + +.SILENT: + +%.o: test-%.a + echo "Testing CPU:" $(subst .o,,$@) + acme $(ACMEFLAGS) -o test.o $< + cmp test.o expected-$@ + rm test.o + echo "Ok." + +all: $(FILES) + echo + echo "Testing CPUs: PASSED" + echo diff --git a/testing/cpus/check-all-cpus.sh b/testing/cpus/check-all-cpus.sh deleted file mode 100755 index 05f3353..0000000 --- a/testing/cpus/check-all-cpus.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -for CPU in 6502 65c02 r65c02 w65c02 nmos6502 c64dtv2 65ce02 4502 m65 65816 ; do - acme -v0 test-"$CPU".a || exit - cmp out-"$CPU".o expected-"$CPU".o || exit -done -echo -echo "All CPU tests passed successfully." -echo diff --git a/testing/errors/Makefile b/testing/errors/Makefile new file mode 100644 index 0000000..e957db9 --- /dev/null +++ b/testing/errors/Makefile @@ -0,0 +1,15 @@ +ACMEFLAGS = -v0 +FILES := $(wildcard *.a) +TESTS = $(subst .a,.test,$(FILES)) + +.SILENT: + +%.test: %.a + echo "Testing error generation:" $< + ! acme $(ACMEFLAGS) $< + echo "Ok." + +all: $(TESTS) + echo + echo "Testing errors: PASSED" + echo diff --git a/testing/errors/opnotsupp2.a b/testing/errors/opnotsupp2.a new file mode 100644 index 0000000..4162f16 --- /dev/null +++ b/testing/errors/opnotsupp2.a @@ -0,0 +1 @@ + a = 3 != [] ; -> "Operation not supported." diff --git a/testing/errors/opnotsupp3.a b/testing/errors/opnotsupp3.a new file mode 100644 index 0000000..a68c914 --- /dev/null +++ b/testing/errors/opnotsupp3.a @@ -0,0 +1 @@ + b = "str" = [] ; -> "Operation not supported." diff --git a/testing/errors/opnotsupp4.a b/testing/errors/opnotsupp4.a new file mode 100644 index 0000000..b51bc70 --- /dev/null +++ b/testing/errors/opnotsupp4.a @@ -0,0 +1 @@ + c = [] + 3 ; -> "Operation not supported." diff --git a/testing/errors/valuenotdefined3.a b/testing/errors/valuenotdefined3.a new file mode 100644 index 0000000..a9eda7a --- /dev/null +++ b/testing/errors/valuenotdefined3.a @@ -0,0 +1,2 @@ + * = $200 + !by .local ; -> "Value not defined." diff --git a/testing/errors/valuenotdefined4.a b/testing/errors/valuenotdefined4.a new file mode 100644 index 0000000..3fded8a --- /dev/null +++ b/testing/errors/valuenotdefined4.a @@ -0,0 +1,2 @@ + * = $200 + !by @cheap_local ; -> "Value not defined." diff --git a/testing/warnings/Makefile b/testing/warnings/Makefile new file mode 100644 index 0000000..6696a06 --- /dev/null +++ b/testing/warnings/Makefile @@ -0,0 +1,21 @@ +ACMEFLAGS = -v0 +FILES := $(wildcard *.a) +FAILTESTS = $(subst .a,.fail,$(FILES)) +SUCCTESTS = $(subst .a,.succ,$(FILES)) + +.SILENT: + +%.fail: %.a + echo "Testing warning with --strict:" $< + ! acme $(ACMEFLAGS) --strict $< + echo "Ok." + +%.succ: %.a + echo "Testing warning:" $< + acme $(ACMEFLAGS) $< + echo "Ok." + +all: $(FAILTESTS) $(SUCCTESTS) + echo + echo "Testing warnings: PASSED" + echo diff --git a/testing/warnings/initmem.a b/testing/warnings/initmem.a new file mode 100644 index 0000000..0b78669 --- /dev/null +++ b/testing/warnings/initmem.a @@ -0,0 +1,2 @@ + !initmem 0 + !initmem 0 ; -> "Memory already initialised." diff --git a/testing/warnings/limit.a b/testing/warnings/limit.a new file mode 100644 index 0000000..767022d --- /dev/null +++ b/testing/warnings/limit.a @@ -0,0 +1,6 @@ + *=$1000 + !tx "Hinz" + !outfilelimit + !tx "Kunz" + !outfilelimit ; -> "End of output file already chosen." + !tx "Bla" diff --git a/testing/warnings/segment1.a b/testing/warnings/segment1.a new file mode 100644 index 0000000..b21cd02 --- /dev/null +++ b/testing/warnings/segment1.a @@ -0,0 +1,6 @@ + *=$1000 + clc + nop + rts + *=$1001 + brk ; -> "Segment starts inside another one, overwriting it." diff --git a/testing/warnings/segment2.a b/testing/warnings/segment2.a new file mode 100644 index 0000000..0de1a46 --- /dev/null +++ b/testing/warnings/segment2.a @@ -0,0 +1,6 @@ + *=$1001 + brk + *=$1000 + clc + nop ; -> "Segment reached another one, overwriting it." + rts diff --git a/testing/warnings/start.a b/testing/warnings/start.a new file mode 100644 index 0000000..9ff9690 --- /dev/null +++ b/testing/warnings/start.a @@ -0,0 +1,6 @@ + *=$1000 + !tx "Hinz" + !outfilestart + !tx "Kunz" + !outfilestart ; -> "Start of output file already chosen." + !tx "Bla"