brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.7 KiB · 3c208ad Raw
171 lines · plain
1# -*- Makefile -*-2 3# Usage: make test.N.report 4#5# COUNT can be over-ridden to change the number of tests generated per6# file, and TESTARGS is used to change the type generation. Make sure7# to 'make clean' after changing either of these parameters.8 9TESTARGS := --no-unsigned --no-vector --no-complex --no-bool10 11COUNT := 112TIMEOUT := 513 14CFLAGS := -std=gnu9915 16X_COMPILER := gcc17X_LL_CFLAGS := -emit-llvm -S18Y_COMPILER := clang19Y_LL_CFLAGS := -emit-llvm -S20CC := gcc21 22###23 24ABITESTGEN := ../ABITestGen.py25 26ifndef VERBOSE27  Verb := @28endif29 30.PHONY: test.%.report31test.%.report: temps/test.%.xx.diff temps/test.%.xy.diff temps/test.%.yx.diff temps/test.%.yy.diff32	@ok=1;\33	for t in $^; do \34		if [ -s $$t ]; then \35			echo "TEST $*: $$t failed"; \36			ok=0;\37		fi; \38	done; \39	if [ $$ok -eq 1 ]; then \40		true; \41	else \42		false; \43	fi44 45 46.PHONY: test.%.defs-report47test.%.defs-report: temps/test.%.defs.diff48	@for t in $^; do \49		if [ -s $$t ]; then \50			echo "TEST $*: $$t failed"; \51			cat $$t; \52		fi; \53	done54 55.PHONY: test.%.build56test.%.build: temps/test.%.ref temps/test.%.xx temps/test.%.xy temps/test.%.yx temps/test.%.yy temps/test.%.x.defs temps/test.%.y.defs57	@true58 59###60 61# Diffs and output62 63.PRECIOUS: temps/.dir64 65.PRECIOUS: temps/test.%.xx.diff66temps/test.%.xx.diff: temps/test.%.ref.out temps/test.%.xx.out67	$(Verb) diff $^ > $@ || true68.PRECIOUS: temps/test.%.xy.diff69temps/test.%.xy.diff: temps/test.%.ref.out temps/test.%.xy.out70	$(Verb) diff $^ > $@ || true71.PRECIOUS: temps/test.%.yx.diff72temps/test.%.yx.diff: temps/test.%.ref.out temps/test.%.yx.out73	$(Verb) diff $^ > $@ || true74.PRECIOUS: temps/test.%.yy.diff75temps/test.%.yy.diff: temps/test.%.ref.out temps/test.%.yy.out76	$(Verb) diff $^ > $@ || true77.PRECIOUS: temps/test.%.defs.diff78temps/test.%.defs.diff: temps/test.%.x.defs temps/test.%.y.defs79	$(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" \83	  $^ > $@84 85.PRECIOUS: temps/test.%.out86temps/test.%.out: temps/test.%87	-$(Verb) ./$< > $@88 89# Executables90 91.PRECIOUS: temps/test.%.ref92temps/test.%.ref: temps/test.%.driver.ref.o temps/test.%.a.ref.o temps/test.%.b.ref.o93	$(Verb) $(CC) $(CFLAGS) $(CC_CFLAGS) -O3 -o $@ $^94.PRECIOUS: temps/test.%.xx95temps/test.%.xx: temps/test.%.driver.ref.o temps/test.%.a.x.o temps/test.%.b.x.o96	$(Verb) $(CC) $(CFLAGS) $(CC_CFLAGS) -O3  -o $@ $^97.PRECIOUS: temps/test.%.xy98temps/test.%.xy: temps/test.%.driver.ref.o temps/test.%.a.x.o temps/test.%.b.y.o99	$(Verb) $(CC) $(CFLAGS) $(CC_CFLAGS) -O3  -o $@ $^100.PRECIOUS: temps/test.%.yx101temps/test.%.yx: temps/test.%.driver.ref.o temps/test.%.a.y.o temps/test.%.b.x.o102	$(Verb) $(CC) $(CFLAGS) $(CC_CFLAGS) -O3  -o $@ $^103.PRECIOUS: temps/test.%.yy104temps/test.%.yy: temps/test.%.driver.ref.o temps/test.%.a.y.o temps/test.%.b.y.o105	$(Verb) $(CC) $(CFLAGS) $(CC_CFLAGS) -O3  -o $@ $^106 107# Object files108 109.PRECIOUS: temps/test.%.ref.o110temps/test.%.ref.o: inputs/test.%.c temps/.dir111	$(Verb) $(CC) -c $(CFLAGS) $(CC_CFLAGS) -o $@ $<112.PRECIOUS: temps/test.%.x.o113temps/test.%.x.o: inputs/test.%.c temps/.dir114	$(Verb) $(X_COMPILER) -c $(CFLAGS) $(X_CFLAGS) -o $@ $<115.PRECIOUS: temps/test.%.y.o116temps/test.%.y.o: inputs/test.%.c temps/.dir117	$(Verb) $(Y_COMPILER) -c $(CFLAGS) $(Y_CFLAGS) -o $@ $<118 119.PRECIOUS: temps/test.%.x.defs120temps/test.%.x.defs: temps/test.%.a.x.ll temps/.dir121	-$(Verb) -grep '^define ' $< > $@122.PRECIOUS: temps/test.%.y.defs123temps/test.%.y.defs: temps/test.%.a.y.ll temps/.dir124	-$(Verb) -grep '^define ' $< > $@125 126.PRECIOUS: temps/test.%.a.x.ll127temps/test.%.a.x.ll: inputs/test.%.a.c temps/.dir128	$(Verb) $(X_COMPILER) $(CFLAGS) $(X_LL_CFLAGS) $(X_CFLAGS) -o $@ $<129.PRECIOUS: temps/test.%.b.x.ll130temps/test.%.b.x.ll: inputs/test.%.b.c temps/.dir131	$(Verb) $(X_COMPILER) $(CFLAGS) $(X_LL_CFLAGS) $(X_CFLAGS) -o $@ $<132.PRECIOUS: temps/test.%.a.y.ll133temps/test.%.a.y.ll: inputs/test.%.a.c temps/.dir134	$(Verb) $(Y_COMPILER) $(CFLAGS) $(Y_LL_CFLAGS) $(Y_CFLAGS) -o $@ $<135.PRECIOUS: temps/test.%.b.y.ll136temps/test.%.b.y.ll: inputs/test.%.b.c temps/.dir137	$(Verb) $(Y_COMPILER) $(CFLAGS) $(Y_LL_CFLAGS) $(Y_CFLAGS) -o $@ $<138 139# Input generation140 141.PHONY: test.%.top142test.%.top: inputs/test.%.a.c inputs/test.%.b.c inputs/test.%.driver.c143	@true144 145.PRECIOUS: inputs/test.%.a.c inputs/test.%.b.c inputs/test.%.driver.c146inputs/test.%.a.c: test.%.generate147	@true148inputs/test.%.b.c: test.%.generate149	@true150inputs/test.%.driver.c: test.%.generate151	@true152 153.PHONY: test.%.generate154.PRECIOUS: inputs/.dir155test.%.generate: $(ABITESTGEN) inputs/.dir156	$(Verb) $(ABITESTGEN) $(TESTARGS) -o inputs/test.$*.a.c -T inputs/test.$*.b.c -D inputs/test.$*.driver.c --min=$(shell expr $* '*' $(COUNT))  --count=$(COUNT)157 158# Cleaning159 160clean-temps:161	$(Verb) rm -rf temps162 163clean:164	$(Verb) rm -rf temps inputs165 166# Etc.167 168%/.dir:169	$(Verb) mkdir -p $* > /dev/null170	$(Verb) $(DATE) > $@171