blob: 87f21cfa5460ca5650b823383916a721fd93c5d9 [file] [log] [blame]
Chris Lattner12d632c2004-11-07 05:05:37 +00001#===- test/Makefile ----------------------------------------*- Makefile -*--===#
Mikhail Glushenkov38ead322009-03-06 12:25:56 +00002#
Chris Lattner12d632c2004-11-07 05:05:37 +00003# The LLVM Compiler Infrastructure
4#
Chris Lattner57360d12007-12-29 20:11:13 +00005# This file is distributed under the University of Illinois Open Source
6# License. See LICENSE.TXT for details.
Mikhail Glushenkov38ead322009-03-06 12:25:56 +00007#
Chris Lattner12d632c2004-11-07 05:05:37 +00008#===------------------------------------------------------------------------===#
9
Misha Brukman5eb009a2008-12-31 17:38:27 +000010LEVEL = ..
Mikhail Glushenkov38ead322009-03-06 12:25:56 +000011DIRS =
Chris Lattner52a4e852002-01-23 21:36:59 +000012
Reid Spencer135e1d82004-12-06 05:35:38 +000013all:: check-local
John Criswellee29d2a2003-09-06 15:12:21 +000014
Daniel Dunbar27a99392010-08-02 01:25:20 +000015# 'lit' is the default test runner.
Daniel Dunbar666b4022010-08-02 00:05:18 +000016check-local:: check-local-lit
17
John Criswelld184c672003-10-27 17:46:42 +000018# Include other test rules
John Criswelld184c672003-10-27 17:46:42 +000019include Makefile.tests
20
Chris Lattner12d632c2004-11-07 05:05:37 +000021#===------------------------------------------------------------------------===#
22# DejaGNU testing support
23#===------------------------------------------------------------------------===#
24
Shantonu Sen1b6d3da2009-06-26 05:44:53 +000025ifneq ($(GREP_OPTIONS),)
26$(warning GREP_OPTIONS environment variable may interfere with test results)
27endif
28
Gabor Greif684ed3d2008-02-26 12:08:55 +000029ifdef VERBOSE
30RUNTESTFLAGS := $(VERBOSE)
Chris Lattner0dd0d492010-04-17 19:04:03 +000031LIT_ARGS := -v
Daniel Dunbar70a3b772009-09-08 05:31:44 +000032else
33LIT_ARGS := -s -v
Gabor Greif684ed3d2008-02-26 12:08:55 +000034endif
35
NAKAMURA Takumi9cf3b582010-10-22 09:40:37 +000036# -jN causes crash on Cygwin's python.
37ifneq (,$(filter $(HOST_OS),Cygwin))
38 LIT_ARGS += -j1
39endif
40
Tanya Lattner491e9cd2004-11-07 21:39:41 +000041ifdef TESTSUITE
Daniel Dunbar70a3b772009-09-08 05:31:44 +000042LIT_TESTSUITE := $(TESTSUITE)
Chris Lattner60bdce62004-12-12 21:39:49 +000043CLEANED_TESTSUITE := $(patsubst %/,%,$(TESTSUITE))
Reid Spencerb18ec662006-11-11 01:02:45 +000044CLEANED_TESTSUITE := $(patsubst test/%,%,$(CLEANED_TESTSUITE))
Gabor Greif684ed3d2008-02-26 12:08:55 +000045RUNTESTFLAGS += --tool $(CLEANED_TESTSUITE)
Daniel Dunbar70a3b772009-09-08 05:31:44 +000046else
47LIT_TESTSUITE := .
Tanya Lattner491e9cd2004-11-07 21:39:41 +000048endif
49
Nuno Lopes2bdc07b2008-10-07 14:48:14 +000050ifdef VG
Daniel Dunbar3a9719a2009-09-14 15:27:43 +000051VALGRIND := valgrind --tool=memcheck --quiet --trace-children=yes --error-exitcode=3 --leak-check=full $(VALGRIND_EXTRA_ARGS)
Nuno Lopes2bdc07b2008-10-07 14:48:14 +000052endif
53
Daniel Dunbar2891dbb2009-09-20 19:04:28 +000054# Check what to run for -all.
Daniel Dunbar34185792009-09-20 06:17:21 +000055LIT_ALL_TESTSUITES := $(LIT_TESTSUITE)
Daniel Dunbar2891dbb2009-09-20 19:04:28 +000056
57extra-lit-site-cfgs::
58.PHONY: extra-lit-site-cfgs
59
60ifneq ($(strip $(filter check-local-all,$(MAKECMDGOALS))),)
Daniel Dunbar34185792009-09-20 06:17:21 +000061ifndef TESTSUITE
62ifeq ($(shell test -d $(PROJ_SRC_DIR)/../tools/clang && echo OK), OK)
63LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/clang/test
Daniel Dunbar2891dbb2009-09-20 19:04:28 +000064
65# Force creation of Clang's lit.site.cfg.
66clang-lit-site-cfg: FORCE
67 $(MAKE) -C $(PROJ_OBJ_DIR)/../tools/clang/test lit.site.cfg
68extra-lit-site-cfgs:: clang-lit-site-cfg
69endif
Daniel Dunbar34185792009-09-20 06:17:21 +000070endif
71endif
72
Gordon Henriksen0908d492007-09-18 12:26:17 +000073IGNORE_TESTS :=
74
Reid Spencer15d40592006-05-28 04:21:40 +000075ifndef RUNLLVM2CPP
Gordon Henriksen0908d492007-09-18 12:26:17 +000076IGNORE_TESTS += llvm2cpp.exp
77endif
78
Gordon Henriksen0908d492007-09-18 12:26:17 +000079ifdef IGNORE_TESTS
80RUNTESTFLAGS += --ignore "$(strip $(IGNORE_TESTS))"
Reid Spencer15d40592006-05-28 04:21:40 +000081endif
82
Jeffrey Yasskinfeada942009-11-16 23:32:30 +000083# ulimits like these are redundantly enforced by the buildbots, so
84# just removing them here won't work.
Daniel Dunbar54f97592009-08-01 03:37:54 +000085# Both AuroraUX & Solaris do not have the -m flag for ulimit
Anton Korobeynikove55db742009-08-18 00:40:33 +000086ifeq ($(HOST_OS),SunOS)
Jeffrey Yasskinfeada942009-11-16 23:32:30 +000087ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -v 512000 ;
Edward O'Callaghan7e434392009-10-26 02:37:56 +000088else # !SunOS
89ifeq ($(HOST_OS),AuroraUX)
Jeffrey Yasskinfeada942009-11-16 23:32:30 +000090ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -v 512000 ;
Edward O'Callaghan7e434392009-10-26 02:37:56 +000091else # !AuroraUX
Rafael Espindola6d50ed62010-08-05 03:35:01 +000092# Fedora 13 x86-64 python fails with -v 76800
93ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 1024000 ;
Edward O'Callaghan7e434392009-10-26 02:37:56 +000094endif # AuroraUX
95endif # SunOS
Daniel Dunbar54f97592009-08-01 03:37:54 +000096
Chris Lattner03ed6252006-08-01 00:07:58 +000097ifneq ($(RUNTEST),)
Daniel Dunbar666b4022010-08-02 00:05:18 +000098check-local-dg:: site.exp
Daniel Dunbar54f97592009-08-01 03:37:54 +000099 ( $(ULIMIT) \
Daniel Dunbar8bb233b2009-09-13 02:45:57 +0000100 PATH="$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(LLVMGCCDIR)/bin:$(PATH)" \
Reid Spencerec68fd42007-02-11 20:18:32 +0000101 $(RUNTEST) $(RUNTESTFLAGS) )
Chris Lattner03ed6252006-08-01 00:07:58 +0000102else
Daniel Dunbar666b4022010-08-02 00:05:18 +0000103check-local-dg:: site.exp
Misha Brukman33d0a032009-01-01 20:26:05 +0000104 @echo "*** dejagnu not found. Make sure 'runtest' is in your PATH, then reconfigure LLVM."
Chris Lattner03ed6252006-08-01 00:07:58 +0000105endif
Tanya Lattner491e9cd2004-11-07 21:39:41 +0000106
Daniel Dunbardb5fe932009-09-14 02:39:01 +0000107check-local-lit:: lit.site.cfg Unit/lit.site.cfg
Daniel Dunbar70a3b772009-09-08 05:31:44 +0000108 ( $(ULIMIT) \
Daniel Dunbar5ed7be12009-11-08 09:08:00 +0000109 $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) )
Daniel Dunbar70a3b772009-09-08 05:31:44 +0000110
Daniel Dunbar2891dbb2009-09-20 19:04:28 +0000111check-local-all:: lit.site.cfg Unit/lit.site.cfg extra-lit-site-cfgs
Daniel Dunbar34185792009-09-20 06:17:21 +0000112 ( $(ULIMIT) \
Daniel Dunbar5ed7be12009-11-08 09:08:00 +0000113 $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) )
Daniel Dunbar34185792009-09-20 06:17:21 +0000114
Tanya Lattner9f97b4c2004-12-04 06:25:08 +0000115clean::
Reid Spencerfb15c002007-01-17 07:59:14 +0000116 $(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print`
Tanya Lattner7a7cb4c2004-11-07 04:59:52 +0000117
Devang Patel6748f042009-02-02 21:09:36 +0000118# dsymutil is used on the Darwin to manipulate DWARF debugging information.
Anton Korobeynikove55db742009-08-18 00:40:33 +0000119ifeq ($(TARGET_OS),Darwin)
Devang Patel6748f042009-02-02 21:09:36 +0000120DSYMUTIL=dsymutil
121else
122DSYMUTIL=true
123endif
Evan Cheng802cd842009-03-21 18:12:24 +0000124ifdef TargetCommonOpts
125BUGPOINT_TOPTS="-gcc-tool-args $(TargetCommonOpts)"
126else
127BUGPOINT_TOPTS=""
128endif
Devang Patel6748f042009-02-02 21:09:36 +0000129
Erick Tryzelaarb405bbe2009-09-03 23:27:31 +0000130ifneq ($(OCAMLOPT),)
131CC_FOR_OCAMLOPT := $(shell $(OCAMLOPT) -config | grep native_c_compiler | sed -e 's/native_c_compiler: //')
132CXX_FOR_OCAMLOPT := $(subst gcc,g++,$(CC_FOR_OCAMLOPT))
Bob Wilsonb2f88062009-07-21 21:56:46 +0000133endif
134
Nuno Lopes2bdc07b2008-10-07 14:48:14 +0000135FORCE:
136
137site.exp: FORCE
Tanya Lattner7a7cb4c2004-11-07 04:59:52 +0000138 @echo 'Making a new site.exp file...'
Daniel Dunbar4080d102009-11-08 09:29:52 +0000139 @echo '## Autogenerated by LLVM configuration.' > site.tmp
140 @echo '# Do not edit!' >> site.tmp
Reid Spencerdb4264f2006-04-13 20:33:59 +0000141 @echo 'set target_triplet "$(TARGET_TRIPLE)"' >> site.tmp
Reid Spencere5190d22007-04-21 20:39:26 +0000142 @echo 'set TARGETS_TO_BUILD "$(TARGETS_TO_BUILD)"' >> site.tmp
Reid Spencer51162ba2007-04-21 21:43:18 +0000143 @echo 'set llvmgcc_langs "$(LLVMGCC_LANGS)"' >> site.tmp
Reid Spencer492196c2006-05-28 07:22:42 +0000144 @echo 'set llvmtoolsdir "$(ToolDir)"' >>site.tmp
145 @echo 'set llvmlibsdir "$(LibDir)"' >>site.tmp
Daniel Dunbar840a7182009-09-13 01:41:18 +0000146 @echo 'set llvm_bindings "$(BINDINGS_TO_BUILD)"' >> site.tmp
Reid Spencer15d40592006-05-28 04:21:40 +0000147 @echo 'set srcroot "$(LLVM_SRC_ROOT)"' >>site.tmp
148 @echo 'set objroot "$(LLVM_OBJ_ROOT)"' >>site.tmp
Reid Spencerdb4264f2006-04-13 20:33:59 +0000149 @echo 'set srcdir "$(LLVM_SRC_ROOT)/test"' >>site.tmp
150 @echo 'set objdir "$(LLVM_OBJ_ROOT)/test"' >>site.tmp
Reid Spencer3d89bc52007-04-11 20:57:39 +0000151 @echo 'set gccpath "$(CC)"' >>site.tmp
152 @echo 'set gxxpath "$(CXX)"' >>site.tmp
Michael J. Spencer7b816742010-08-30 15:34:08 +0000153 @echo 'set compile_c "' $(CC) $(CPP.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c '"' >>site.tmp
Michael J. Spencer06b7f582010-08-30 14:49:00 +0000154 @echo 'set compile_cxx "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c -x c++ '"' >> site.tmp
Evan Cheng802cd842009-03-21 18:12:24 +0000155 @echo 'set link "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) '"' >>site.tmp
156 @echo 'set llvmgcc "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp
157 @echo 'set llvmgxx "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp
Evan Cheng802cd842009-03-21 18:12:24 +0000158 @echo 'set bugpoint_topts $(BUGPOINT_TOPTS)' >> site.tmp
Reid Spencer4e3e1152007-04-12 02:49:30 +0000159 @echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp
Erick Tryzelaarb405bbe2009-09-03 23:27:31 +0000160 @echo 'set ocamlopt "$(OCAMLOPT) -cc \"$(CXX_FOR_OCAMLOPT)\" -I $(LibDir)/ocaml"' >> site.tmp
Nuno Lopes2bdc07b2008-10-07 14:48:14 +0000161 @echo 'set valgrind "$(VALGRIND)"' >> site.tmp
Torok Edwin237033e2008-10-21 17:21:32 +0000162 @echo 'set grep "$(GREP)"' >>site.tmp
163 @echo 'set gas "$(GAS)"' >>site.tmp
Devang Patel6748f042009-02-02 21:09:36 +0000164 @echo 'set llvmdsymutil "$(DSYMUTIL)"' >>site.tmp
Tanya Lattner7a7cb4c2004-11-07 04:59:52 +0000165 @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp
166 @test ! -f site.exp || \
167 sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
168 @-rm -f site.bak
169 @test ! -f site.exp || mv site.exp site.bak
170 @mv site.tmp site.exp
Daniel Dunbar70a3b772009-09-08 05:31:44 +0000171
172lit.site.cfg: site.exp
Daniel Dunbar2891dbb2009-09-20 19:04:28 +0000173 @echo "Making LLVM 'lit.site.cfg' file..."
Daniel Dunbarfb76ffb2009-09-22 07:38:33 +0000174 @sed -e "s#@LLVM_SOURCE_DIR@#$(LLVM_SRC_ROOT)#g" \
175 -e "s#@LLVM_BINARY_DIR@#$(LLVM_OBJ_ROOT)#g" \
176 -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
177 -e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \
178 $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
Daniel Dunbardb5fe932009-09-14 02:39:01 +0000179
Torok Edwine1b691f2009-10-02 09:30:03 +0000180Unit/lit.site.cfg: $(PROJ_OBJ_DIR)/Unit/.dir FORCE
Daniel Dunbar2891dbb2009-09-20 19:04:28 +0000181 @echo "Making LLVM unittest 'lit.site.cfg' file..."
Daniel Dunbarfb4fb6d2009-11-08 09:07:51 +0000182 @sed -e "s#@LLVM_SOURCE_DIR@#$(LLVM_SRC_ROOT)#g" \
183 -e "s#@LLVM_BINARY_DIR@#$(LLVM_OBJ_ROOT)#g" \
184 -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
185 -e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \
186 -e "s#@LLVM_BUILD_MODE@#$(BuildMode)#g" \
Jeffrey Yasskinc9017192010-02-25 06:34:33 +0000187 -e "s#@ENABLE_SHARED@#$(ENABLE_SHARED)#g" \
188 -e "s#@SHLIBPATH_VAR@#$(SHLIBPATH_VAR)#g" \
Daniel Dunbarfb4fb6d2009-11-08 09:07:51 +0000189 $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
Chris Lattnerbbcdebb2010-07-15 05:17:36 +0000190