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 |
| 13 | PROGRESS = echo $< |
| 14 | REPORTFAIL = cat $@ |
| 15 | DONE = true |
| 16 | else |
| 17 | PROGRESS = printf '.' |
| 18 | REPORTFAIL = (echo; echo '----' $< 'failed ----') |
| 19 | DONE = echo |
| 20 | endif |
| 21 | |
Anders Carlsson | 413ad8b | 2008-08-23 21:03:10 +0000 | [diff] [blame] | 22 | TESTS := $(addprefix Output/, $(addsuffix .testresults, $(shell find $(TESTDIRS) \( -name '*.c' -or -name '*.cpp' -or -name '*.m' -or -name '*.mm' \)))) |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 23 | Output/%.testresults: % |
| 24 | @ $(PROGRESS) |
Daniel Dunbar | 4565938 | 2008-08-21 03:03:44 +0000 | [diff] [blame] | 25 | @ 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] | 26 | |
Chris Lattner | 1467e03 | 2007-07-16 04:35:52 +0000 | [diff] [blame] | 27 | all:: |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 28 | @ mkdir -p $(addprefix Output/, $(TESTDIRS)) |
| 29 | @ rm -f $(TESTS) |
| 30 | @ echo '--- Running clang tests ---' |
| 31 | @ $(MAKE) $(TESTS) |
| 32 | @ $(DONE) |
Daniel Dunbar | 4e6153b | 2008-09-17 18:08:07 +0000 | [diff] [blame] | 33 | @ !(cat $(TESTS) | grep -q " FAILED! ") |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 34 | |
| 35 | report: $(TESTS) |
| 36 | @ cat $^ |
Gabor Greif | 17feadf | 2008-03-18 07:03:00 +0000 | [diff] [blame] | 37 | |
| 38 | clean:: |
Gabor Greif | 5267d7c | 2008-03-20 14:28:22 +0000 | [diff] [blame] | 39 | @ rm -rf Output/ |
Gabor Greif | 17feadf | 2008-03-18 07:03:00 +0000 | [diff] [blame] | 40 | |
Chris Lattner | 9d294b9 | 2008-04-06 22:32:01 +0000 | [diff] [blame] | 41 | .PHONY: all report clean |