Daniel Dunbar | 5ce6157 | 2009-01-28 02:01:23 +0000 | [diff] [blame] | 1 | # Usage: make test.N.report |
| 2 | # |
| 3 | # COUNT can be over-ridden to change the number of tests generated per |
| 4 | # file, and TESTARGS is used to change the type generation. Make sure |
| 5 | # to 'make clean' after changing either of these parameters. |
| 6 | |
| 7 | ABITESTGEN := ../ABITestGen.py |
Daniel Dunbar | 59ebd28 | 2009-01-29 20:36:50 +0000 | [diff] [blame] | 8 | TESTARGS := --max-args 0 --test-layout |
Daniel Dunbar | 5ce6157 | 2009-01-28 02:01:23 +0000 | [diff] [blame] | 9 | COUNT := 1000 |
| 10 | TIMEOUT := 5 |
| 11 | |
| 12 | CFLAGS := -std=gnu99 |
| 13 | |
Anders Carlsson | 7b3817d | 2009-07-25 00:26:00 +0000 | [diff] [blame] | 14 | X_COMPILER := llvm-gcc |
Eli Friedman | d9d38c4 | 2009-05-25 22:07:09 +0000 | [diff] [blame] | 15 | Y_COMPILER := clang |
Daniel Dunbar | 5ce6157 | 2009-01-28 02:01:23 +0000 | [diff] [blame] | 16 | CC := gcc |
| 17 | |
Anders Carlsson | 7b3817d | 2009-07-25 00:26:00 +0000 | [diff] [blame] | 18 | ifeq (0, 0) |
Daniel Dunbar | 5ce6157 | 2009-01-28 02:01:23 +0000 | [diff] [blame] | 19 | X_CFLAGS := -m32 |
| 20 | Y_CFLAGS := -m32 |
| 21 | CC_CFLAGS := -m32 |
| 22 | else |
| 23 | X_CFLAGS := -m64 |
| 24 | Y_CFLAGS := -m64 |
| 25 | CC_CFLAGS := -m64 |
| 26 | endif |
| 27 | |
| 28 | .PHONY: test.%.report |
| 29 | test.%.report: test.%.x.diff test.%.y.diff |
| 30 | @for t in $^; do \ |
| 31 | if [ -s $$t ]; then \ |
| 32 | echo "TEST $*: $$t failed"; \ |
| 33 | fi; \ |
| 34 | done |
| 35 | |
| 36 | .PHONY: test.%.build |
| 37 | test.%.build: test.%.ref test.%.x test.%.y |
| 38 | @true |
| 39 | |
| 40 | ### |
| 41 | |
| 42 | .PRECIOUS: test.%.x.diff |
| 43 | test.%.x.diff: test.%.ref.out test.%.x.out |
| 44 | -diff $^ > $@ |
| 45 | .PRECIOUS: test.%.y.diff |
| 46 | test.%.y.diff: test.%.ref.out test.%.y.out |
| 47 | -diff $^ > $@ |
| 48 | |
| 49 | .PRECIOUS: test.%.out |
| 50 | test.%.out: test.% |
| 51 | -./$< > $@ |
| 52 | |
| 53 | .PRECIOUS: test.%.ref |
| 54 | test.%.ref: test.%.c |
| 55 | $(CC) $(CFLAGS) $(CC_CFLAGS) -o $@ $^ |
| 56 | .PRECIOUS: test.%.x |
| 57 | test.%.x: test.%.c |
| 58 | $(X_COMPILER) $(CFLAGS) $(X_CFLAGS) -o $@ $^ |
| 59 | .PRECIOUS: test.%.y |
| 60 | test.%.y: test.%.c |
| 61 | $(Y_COMPILER) $(CFLAGS) $(Y_CFLAGS) -o $@ $^ |
| 62 | |
| 63 | .PRECIOUS: test.%.c |
| 64 | test.%.c: $(ABITESTGEN) |
| 65 | $(ABITESTGEN) $(TESTARGS) -o $@ --min=$(shell expr $* '*' $(COUNT)) --count=$(COUNT) |
| 66 | |
| 67 | clean: |
| 68 | rm -f test.* *~ |