3 # Usage: make test.N.report
5 # COUNT can be over-ridden to change the number of tests generated per
6 # file, and TESTARGS is used to change the type generation. Make sure
7 # to 'make clean' after changing either of these parameters.
9 TESTARGS := --no-unsigned --no-vector --no-complex --no-bool
17 X_LL_CFLAGS := -emit-llvm -S
19 Y_LL_CFLAGS := -emit-llvm -S
24 ABITESTGEN := ../ABITestGen.py
31 test.%.report: temps/test.%.xx.diff temps/test.%.xy.diff temps/test.%.yx.diff temps/test.%.yy.diff
35 echo "TEST $*: $$t failed"; \
39 if [ $$ok -eq 1 ]; then \
46 .PHONY: test.%.defs-report
47 test.%.defs-report: temps/test.%.defs.diff
50 echo "TEST $*: $$t failed"; \
56 test.%.build: temps/test.%.ref temps/test.%.xx temps/test.%.xy temps/test.%.yx temps/test.%.yy temps/test.%.x.defs temps/test.%.y.defs
65 .PRECIOUS: temps/test.%.xx.diff
66 temps/test.%.xx.diff: temps/test.%.ref.out temps/test.%.xx.out
67 $(Verb) diff $^ > $@ || true
68 .PRECIOUS: temps/test.%.xy.diff
69 temps/test.%.xy.diff: temps/test.%.ref.out temps/test.%.xy.out
70 $(Verb) diff $^ > $@ || true
71 .PRECIOUS: temps/test.%.yx.diff
72 temps/test.%.yx.diff: temps/test.%.ref.out temps/test.%.yx.out
73 $(Verb) diff $^ > $@ || true
74 .PRECIOUS: temps/test.%.yy.diff
75 temps/test.%.yy.diff: temps/test.%.ref.out temps/test.%.yy.out
76 $(Verb) diff $^ > $@ || true
77 .PRECIOUS: temps/test.%.defs.diff
78 temps/test.%.defs.diff: temps/test.%.x.defs temps/test.%.y.defs
79 $(Verb) zipdifflines \
80 --replace "%struct.T[0-9]+" "%struct.s" \
81 --replace "%union.T[0-9]+" "%struct.s" \
82 --replace "byval align [0-9]+" "byval" \
85 .PRECIOUS: temps/test.%.out
86 temps/test.%.out: temps/test.%
91 .PRECIOUS: temps/test.%.ref
92 temps/test.%.ref: temps/test.%.driver.ref.o temps/test.%.a.ref.o temps/test.%.b.ref.o
93 $(Verb) $(CC) $(CFLAGS) $(CC_CFLAGS) -O3 -o $@ $^
94 .PRECIOUS: temps/test.%.xx
95 temps/test.%.xx: temps/test.%.driver.ref.o temps/test.%.a.x.o temps/test.%.b.x.o
96 $(Verb) $(CC) $(CFLAGS) $(CC_CFLAGS) -O3 -o $@ $^
97 .PRECIOUS: temps/test.%.xy
98 temps/test.%.xy: temps/test.%.driver.ref.o temps/test.%.a.x.o temps/test.%.b.y.o
99 $(Verb) $(CC) $(CFLAGS) $(CC_CFLAGS) -O3 -o $@ $^
100 .PRECIOUS: temps/test.%.yx
101 temps/test.%.yx: temps/test.%.driver.ref.o temps/test.%.a.y.o temps/test.%.b.x.o
102 $(Verb) $(CC) $(CFLAGS) $(CC_CFLAGS) -O3 -o $@ $^
103 .PRECIOUS: temps/test.%.yy
104 temps/test.%.yy: temps/test.%.driver.ref.o temps/test.%.a.y.o temps/test.%.b.y.o
105 $(Verb) $(CC) $(CFLAGS) $(CC_CFLAGS) -O3 -o $@ $^
109 .PRECIOUS: temps/test.%.ref.o
110 temps/test.%.ref.o: inputs/test.%.c temps/.dir
111 $(Verb) $(CC) -c $(CFLAGS) $(CC_CFLAGS) -o $@ $<
112 .PRECIOUS: temps/test.%.x.o
113 temps/test.%.x.o: inputs/test.%.c temps/.dir
114 $(Verb) $(X_COMPILER) -c $(CFLAGS) $(X_CFLAGS) -o $@ $<
115 .PRECIOUS: temps/test.%.y.o
116 temps/test.%.y.o: inputs/test.%.c temps/.dir
117 $(Verb) $(Y_COMPILER) -c $(CFLAGS) $(Y_CFLAGS) -o $@ $<
119 .PRECIOUS: temps/test.%.x.defs
120 temps/test.%.x.defs: temps/test.%.a.x.ll temps/.dir
121 -$(Verb) -grep '^define ' $< > $@
122 .PRECIOUS: temps/test.%.y.defs
123 temps/test.%.y.defs: temps/test.%.a.y.ll temps/.dir
124 -$(Verb) -grep '^define ' $< > $@
126 .PRECIOUS: temps/test.%.a.x.ll
127 temps/test.%.a.x.ll: inputs/test.%.a.c temps/.dir
128 $(Verb) $(X_COMPILER) $(CFLAGS) $(X_LL_CFLAGS) $(X_CFLAGS) -o $@ $<
129 .PRECIOUS: temps/test.%.b.x.ll
130 temps/test.%.b.x.ll: inputs/test.%.b.c temps/.dir
131 $(Verb) $(X_COMPILER) $(CFLAGS) $(X_LL_CFLAGS) $(X_CFLAGS) -o $@ $<
132 .PRECIOUS: temps/test.%.a.y.ll
133 temps/test.%.a.y.ll: inputs/test.%.a.c temps/.dir
134 $(Verb) $(Y_COMPILER) $(CFLAGS) $(Y_LL_CFLAGS) $(Y_CFLAGS) -o $@ $<
135 .PRECIOUS: temps/test.%.b.y.ll
136 temps/test.%.b.y.ll: inputs/test.%.b.c temps/.dir
137 $(Verb) $(Y_COMPILER) $(CFLAGS) $(Y_LL_CFLAGS) $(Y_CFLAGS) -o $@ $<
142 test.%.top: inputs/test.%.a.c inputs/test.%.b.c inputs/test.%.driver.c
145 .PRECIOUS: inputs/test.%.a.c inputs/test.%.b.c inputs/test.%.driver.c
146 inputs/test.%.a.c: test.%.generate
148 inputs/test.%.b.c: test.%.generate
150 inputs/test.%.driver.c: test.%.generate
153 .PHONY: test.%.generate
154 .PRECIOUS: inputs/.dir
155 test.%.generate: $(ABITESTGEN) inputs/.dir
156 $(Verb) $(ABITESTGEN) $(TESTARGS) -o inputs/test.$*.a.c -T inputs/test.$*.b.c -D inputs/test.$*.driver.c --min=$(shell expr $* '*' $(COUNT)) --count=$(COUNT)
164 $(Verb) rm -rf temps inputs
169 $(Verb) mkdir -p $* > /dev/null