From 72e2751bfd58b067a29bd90e322de040633d1b1c Mon Sep 17 00:00:00 2001 From: mrdudz Date: Tue, 26 Apr 2022 17:07:57 +0200 Subject: [PATCH] added a test that must fail --- test/asm/Makefile | 2 +- test/asm/err/Makefile | 45 ++++++++++++++++++++++++++++++++++++++++ test/asm/err/bug1538-1.s | 3 +++ test/asm/readme.txt | 8 ++++++- 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 test/asm/err/Makefile create mode 100644 test/asm/err/bug1538-1.s diff --git a/test/asm/Makefile b/test/asm/Makefile index 82a0ba0e9..3481dae78 100644 --- a/test/asm/Makefile +++ b/test/asm/Makefile @@ -12,7 +12,7 @@ endif WORKDIR = ../testwrk/asm -SUBDIRS = cpudetect opcodes listing val +SUBDIRS = cpudetect opcodes listing val err .PHONY: all continue mostlyclean clean diff --git a/test/asm/err/Makefile b/test/asm/err/Makefile new file mode 100644 index 000000000..6d2430d34 --- /dev/null +++ b/test/asm/err/Makefile @@ -0,0 +1,45 @@ +# Makefile for the tests that MUST NOT compile + +ifneq ($(shell echo),) + CMD_EXE = 1 +endif + +ifdef CMD_EXE + S = $(subst /,\,/) + NOT = - # Hack + NULLDEV = nul: + MKDIR = mkdir $(subst /,\,$1) + RMDIR = -rmdir /s /q $(subst /,\,$1) +else + S = / + NOT = ! + NULLDEV = /dev/null + MKDIR = mkdir -p $1 + RMDIR = $(RM) -r $1 +endif + +ifdef QUIET + .SILENT: + NULLERR = 2>$(NULLDEV) +endif + +CA65 := $(if $(wildcard ../../../bin/ca65*),..$S..$S..$Sbin$Sca65,ca65) + +WORKDIR = ../../../testwrk/asm/err + +.PHONY: all clean + +SOURCES := $(wildcard *.s) +TESTS = $(patsubst %.s,$(WORKDIR)/%.prg,$(SOURCES)) + +all: $(TESTS) + +$(WORKDIR): + $(call MKDIR,$(WORKDIR)) + +$(WORKDIR)/%.prg: %.s | $(WORKDIR) + $(if $(QUIET),echo asm/err/$*.s) + $(NOT) $(CA65) -o $@ $< $(NULLERR) + +clean: + @$(call RMDIR,$(WORKDIR)) diff --git a/test/asm/err/bug1538-1.s b/test/asm/err/bug1538-1.s new file mode 100644 index 000000000..334d19c4c --- /dev/null +++ b/test/asm/err/bug1538-1.s @@ -0,0 +1,3 @@ + + ; this should produce a range error + .byte $1234 & $ffff diff --git a/test/asm/readme.txt b/test/asm/readme.txt index 787f2951e..c3198c12a 100644 --- a/test/asm/readme.txt +++ b/test/asm/readme.txt @@ -18,9 +18,15 @@ Overall tests: These go into listing/. Refer to listing/readme.txt -Val: +val: ---- Works very much like the /val directory used to test the compiler - individual tests are run in the simulator and should exit with an exit code of 0 when they pass, or either -1 or a number indicating what part of the test failed on error. + +err: +---- + +Works very much like the /err directory used to test the compiler - individual +tests are assembled and MUST NOT assemble without error.