Chris Lattner | 1467e03 | 2007-07-16 04:35:52 +0000 | [diff] [blame] | 1 | LEVEL = ../../.. |
| 2 | include $(LEVEL)/Makefile.common |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3 | |
Daniel Dunbar | 852119e | 2008-08-28 23:28:16 +0000 | [diff] [blame] | 4 | # Test in all immediate subdirectories if unset. |
| 5 | TESTDIRS ?= $(shell echo $(PROJ_SRC_DIR)/*/) |
Chris Lattner | 15bd799 | 2008-03-10 19:32:31 +0000 | [diff] [blame] | 6 | |
| 7 | # Only run rewriter tests on darwin. |
| 8 | ifeq ($(OS),Darwin) |
Ted Kremenek | dd536bf | 2008-06-16 21:21:48 +0000 | [diff] [blame] | 9 | TESTDIRS += |
Chris Lattner | 15bd799 | 2008-03-10 19:32:31 +0000 | [diff] [blame] | 10 | endif |
| 11 | |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 12 | ifdef VERBOSE |
Mike Stump | 039df91 | 2009-03-13 00:21:49 +0000 | [diff] [blame] | 13 | ifeq ($(VERBOSE),0) |
| 14 | PROGRESS = : |
Mike Stump | e3c75e0 | 2009-03-13 00:41:24 +0000 | [diff] [blame] | 15 | REPORTFAIL = echo 'FAIL: clang' $(TARGET_TRIPLE) $(subst $(LLVM_SRC_ROOT)/tools/clang/,,$<) |
Mike Stump | 65633f9 | 2009-03-25 17:56:16 +0000 | [diff] [blame] | 16 | DONE = $(LLVMToolDir)/clang -v |
Mike Stump | 039df91 | 2009-03-13 00:21:49 +0000 | [diff] [blame] | 17 | else |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 18 | PROGRESS = echo $< |
| 19 | REPORTFAIL = cat $@ |
| 20 | DONE = true |
Mike Stump | 9a2f1ac | 2009-03-18 20:25:18 +0000 | [diff] [blame] | 21 | endif |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 22 | else |
| 23 | PROGRESS = printf '.' |
| 24 | REPORTFAIL = (echo; echo '----' $< 'failed ----') |
| 25 | DONE = echo |
| 26 | endif |
| 27 | |
Daniel Dunbar | 5bea06a | 2008-12-01 19:23:47 +0000 | [diff] [blame] | 28 | TESTS := $(addprefix Output/, $(addsuffix .testresults, $(shell find $(TESTDIRS) \( -name '*.c' -or -name '*.cpp' -or -name '*.m' -or -name '*.mm' -or -name '*.S' \) | grep -v "Output/"))) |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 29 | Output/%.testresults: % |
| 30 | @ $(PROGRESS) |
Daniel Dunbar | 4565938 | 2008-08-21 03:03:44 +0000 | [diff] [blame] | 31 | @ PATH=$(ToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$$PATH VG=$(VG) $(PROJ_SRC_DIR)/TestRunner.sh $< > $@ || $(REPORTFAIL) |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 32 | |
Chris Lattner | 1467e03 | 2007-07-16 04:35:52 +0000 | [diff] [blame] | 33 | all:: |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 34 | @ mkdir -p $(addprefix Output/, $(TESTDIRS)) |
| 35 | @ rm -f $(TESTS) |
Mike Stump | e3c75e0 | 2009-03-13 00:41:24 +0000 | [diff] [blame] | 36 | @ echo '--- Running clang tests for $(TARGET_TRIPLE) ---' |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 37 | @ $(MAKE) $(TESTS) |
| 38 | @ $(DONE) |
Daniel Dunbar | 4e6153b | 2008-09-17 18:08:07 +0000 | [diff] [blame] | 39 | @ !(cat $(TESTS) | grep -q " FAILED! ") |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 40 | |
| 41 | report: $(TESTS) |
| 42 | @ cat $^ |
Gabor Greif | 17feadf | 2008-03-18 07:03:00 +0000 | [diff] [blame] | 43 | |
| 44 | clean:: |
Gabor Greif | 5267d7c | 2008-03-20 14:28:22 +0000 | [diff] [blame] | 45 | @ rm -rf Output/ |
Gabor Greif | 17feadf | 2008-03-18 07:03:00 +0000 | [diff] [blame] | 46 | |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 47 | .PHONY: all report clean |