generate reference output using host compiler, compare using diff, fix yacc input file to work on both host and sim65
This commit is contained in:
2
test/.gitignore
vendored
2
test/.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
*.o
|
*.o
|
||||||
*.prg
|
*.prg
|
||||||
*.out
|
*.out
|
||||||
|
*.host
|
||||||
|
*.ref
|
||||||
|
|||||||
@@ -9,9 +9,14 @@ CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
|||||||
SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
|
SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
|
||||||
|
|
||||||
RM := rm -f
|
RM := rm -f
|
||||||
|
DIFF := diff -q
|
||||||
|
|
||||||
|
CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
|
REFS := $(patsubst %.c,%.ref,$(wildcard *.c))
|
||||||
|
|
||||||
TESTS := $(patsubst %.c,%.prg,$(wildcard *.c))
|
TESTS := $(patsubst %.c,%.prg,$(wildcard *.c))
|
||||||
TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c))
|
TESTS += $(patsubst %.c,%.o.prg,$(wildcard *.c))
|
||||||
TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c))
|
TESTS += $(patsubst %.c,%.os.prg,$(wildcard *.c))
|
||||||
@@ -21,42 +26,55 @@ TESTS += $(patsubst %.c,%.oi.prg,$(wildcard *.c))
|
|||||||
TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c))
|
TESTS += $(patsubst %.c,%.oir.prg,$(wildcard *.c))
|
||||||
TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c))
|
TESTS += $(patsubst %.c,%.or.prg,$(wildcard *.c))
|
||||||
|
|
||||||
all: $(TESTS)
|
all: $(REFS) $(TESTS)
|
||||||
|
|
||||||
%.prg: %.c
|
%.ref: %.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $*.host
|
||||||
|
./$*.host > $@
|
||||||
|
|
||||||
|
%.prg: %.c %.ref
|
||||||
$(CL65) $(CC65FLAGS) $< -o $@
|
$(CL65) $(CC65FLAGS) $< -o $@
|
||||||
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
||||||
|
$(DIFF) $*.out $*.ref
|
||||||
|
|
||||||
%.o.prg: %.c
|
%.o.prg: %.c %.ref
|
||||||
$(CL65) $(CC65FLAGS) $< -o $@
|
$(CL65) $(CC65FLAGS) $< -o $@
|
||||||
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
||||||
|
$(DIFF) $*.out $*.ref
|
||||||
|
|
||||||
%.os.prg: %.c
|
%.os.prg: %.c %.ref
|
||||||
$(CL65) $(CC65FLAGS) $< -o $@
|
$(CL65) $(CC65FLAGS) $< -o $@
|
||||||
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
||||||
|
$(DIFF) $*.out $*.ref
|
||||||
|
|
||||||
%.osi.prg: %.c
|
%.osi.prg: %.c %.ref
|
||||||
$(CL65) $(CC65FLAGS) $< -o $@
|
$(CL65) $(CC65FLAGS) $< -o $@
|
||||||
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
||||||
|
$(DIFF) $*.out $*.ref
|
||||||
|
|
||||||
%.osir.prg: %.c
|
%.osir.prg: %.c %.ref
|
||||||
$(CL65) $(CC65FLAGS) $< -o $@
|
$(CL65) $(CC65FLAGS) $< -o $@
|
||||||
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
||||||
|
$(DIFF) $*.out $*.ref
|
||||||
|
|
||||||
%.oi.prg: %.c
|
%.oi.prg: %.c %.ref
|
||||||
$(CL65) $(CC65FLAGS) $< -o $@
|
$(CL65) $(CC65FLAGS) $< -o $@
|
||||||
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
||||||
|
$(DIFF) $*.out $*.ref
|
||||||
|
|
||||||
%.oir.prg: %.c
|
%.oir.prg: %.c %.ref
|
||||||
$(CL65) $(CC65FLAGS) $< -o $@
|
$(CL65) $(CC65FLAGS) $< -o $@
|
||||||
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
||||||
|
$(DIFF) $*.out $*.ref
|
||||||
|
|
||||||
%.or.prg: %.c
|
%.or.prg: %.c %.ref
|
||||||
$(CL65) $(CC65FLAGS) $< -o $@
|
$(CL65) $(CC65FLAGS) $< -o $@
|
||||||
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
$(SIM65) $(SIM65FLAGS) $@ > $*.out
|
||||||
|
$(DIFF) $*.out $*.ref
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@$(RM) *.o
|
@$(RM) *.o
|
||||||
@$(RM) *.prg
|
@$(RM) *.prg
|
||||||
@$(RM) *.out
|
@$(RM) *.out
|
||||||
@$(RM) *.ref
|
@$(RM) *.ref
|
||||||
|
@$(RM) *.host
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
x=(e+1)*3/(3+7)
|
x=(e+1)*3/(3+7)
|
||||||
|
|
||||||
Reference in New Issue
Block a user