blob: 1ebaedd6b7da1673a0803e6f996527bbc8e2ea69 [file] [log] [blame]
Chris Lattner1467e032007-07-16 04:35:52 +00001LEVEL = ../../..
2include $(LEVEL)/Makefile.common
Reid Spencer5f016e22007-07-11 17:01:13 +00003
Daniel Dunbar852119e2008-08-28 23:28:16 +00004# Test in all immediate subdirectories if unset.
5TESTDIRS ?= $(shell echo $(PROJ_SRC_DIR)/*/)
Chris Lattner15bd7992008-03-10 19:32:31 +00006
7# Only run rewriter tests on darwin.
8ifeq ($(OS),Darwin)
Ted Kremenekdd536bf2008-06-16 21:21:48 +00009TESTDIRS +=
Chris Lattner15bd7992008-03-10 19:32:31 +000010endif
11
Chris Lattner9d294b92008-04-06 22:32:01 +000012ifdef VERBOSE
Mike Stump039df912009-03-13 00:21:49 +000013ifeq ($(VERBOSE),0)
14PROGRESS = :
Mike Stumpe3c75e02009-03-13 00:41:24 +000015REPORTFAIL = echo 'FAIL: clang' $(TARGET_TRIPLE) $(subst $(LLVM_SRC_ROOT)/tools/clang/,,$<)
Mike Stump65633f92009-03-25 17:56:16 +000016DONE = $(LLVMToolDir)/clang -v
Mike Stump039df912009-03-13 00:21:49 +000017else
Chris Lattner9d294b92008-04-06 22:32:01 +000018PROGRESS = echo $<
19REPORTFAIL = cat $@
20DONE = true
Mike Stump9a2f1ac2009-03-18 20:25:18 +000021endif
Chris Lattner9d294b92008-04-06 22:32:01 +000022else
23PROGRESS = printf '.'
24REPORTFAIL = (echo; echo '----' $< 'failed ----')
25DONE = echo
26endif
27
Daniel Dunbar5bea06a2008-12-01 19:23:47 +000028TESTS := $(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 Lattner9d294b92008-04-06 22:32:01 +000029Output/%.testresults: %
30 @ $(PROGRESS)
Daniel Dunbar45659382008-08-21 03:03:44 +000031 @ PATH=$(ToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$$PATH VG=$(VG) $(PROJ_SRC_DIR)/TestRunner.sh $< > $@ || $(REPORTFAIL)
Chris Lattner9d294b92008-04-06 22:32:01 +000032
Chris Lattner1467e032007-07-16 04:35:52 +000033all::
Chris Lattner9d294b92008-04-06 22:32:01 +000034 @ mkdir -p $(addprefix Output/, $(TESTDIRS))
35 @ rm -f $(TESTS)
Mike Stumpe3c75e02009-03-13 00:41:24 +000036 @ echo '--- Running clang tests for $(TARGET_TRIPLE) ---'
Chris Lattner9d294b92008-04-06 22:32:01 +000037 @ $(MAKE) $(TESTS)
38 @ $(DONE)
Daniel Dunbar4e6153b2008-09-17 18:08:07 +000039 @ !(cat $(TESTS) | grep -q " FAILED! ")
Chris Lattner9d294b92008-04-06 22:32:01 +000040
41report: $(TESTS)
42 @ cat $^
Gabor Greif17feadf2008-03-18 07:03:00 +000043
44clean::
Gabor Greif5267d7c2008-03-20 14:28:22 +000045 @ rm -rf Output/
Gabor Greif17feadf2008-03-18 07:03:00 +000046
Chris Lattner9d294b92008-04-06 22:32:01 +000047.PHONY: all report clean