• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#===- test/Makefile ----------------------------------------*- Makefile -*--===#
2#
3#                     The LLVM Compiler Infrastructure
4#
5# This file is distributed under the University of Illinois Open Source
6# License. See LICENSE.TXT for details.
7#
8#===------------------------------------------------------------------------===#
9
10LEVEL = ..
11DIRS  =
12
13all:: check-local
14
15# Include other test rules
16include Makefile.tests
17
18#===------------------------------------------------------------------------===#
19# DejaGNU testing support
20#===------------------------------------------------------------------------===#
21
22ifneq ($(GREP_OPTIONS),)
23$(warning GREP_OPTIONS environment variable may interfere with test results)
24endif
25
26ifdef VERBOSE
27LIT_ARGS := -v
28else
29LIT_ARGS := -s -v
30endif
31
32ifdef TESTSUITE
33LIT_TESTSUITE := $(TESTSUITE)
34else
35LIT_TESTSUITE := .
36endif
37
38# Check what to run for -all.
39LIT_ALL_TESTSUITES := $(LIT_TESTSUITE)
40
41extra-site-cfgs::
42.PHONY: extra-site-cfgs
43
44ifneq ($(strip $(filter check-local-all,$(MAKECMDGOALS))),)
45ifndef TESTSUITE
46ifeq ($(shell test -f $(PROJ_OBJ_DIR)/../tools/clang/Makefile && echo OK), OK)
47LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/clang/test
48
49# Force creation of Clang's lit.site.cfg.
50clang-site-cfg: FORCE
51	$(MAKE) -C $(PROJ_OBJ_DIR)/../tools/clang/test lit.site.cfg Unit/lit.site.cfg
52extra-site-cfgs:: clang-site-cfg
53endif
54
55ifeq ($(shell test -f $(PROJ_OBJ_DIR)/../tools/clang/tools/extra/Makefile && echo OK), OK)
56LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/clang/tools/extra/test
57
58# Force creation of Clang Tools' lit.site.cfg.
59clang-tools-site-cfg: FORCE
60	$(MAKE) -C $(PROJ_OBJ_DIR)/../tools/clang/tools/extra/test lit.site.cfg Unit/lit.site.cfg
61extra-site-cfgs:: clang-tools-site-cfg
62endif
63
64ifeq ($(shell test -f $(PROJ_OBJ_DIR)/../tools/lld/Makefile && echo OK), OK)
65LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/lld/test
66
67# Force creation of lld's lit.site.cfg.
68lld-site-cfg: FORCE
69	$(MAKE) -C $(PROJ_OBJ_DIR)/../tools/lld/test lit.site.cfg Unit/lit.site.cfg
70extra-site-cfgs:: lld-site-cfg
71endif
72
73ifeq ($(shell test -f $(PROJ_OBJ_DIR)/../tools/polly/Makefile && echo OK), OK)
74LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/polly/test
75
76# Force creation of Polly's lit.site.cfg.
77polly-tools-site-cfg: FORCE
78	$(MAKE) -C $(PROJ_OBJ_DIR)/../tools/polly/test lit.site.cfg
79extra-site-cfgs:: polly-tools-site-cfg
80endif
81endif
82endif
83
84# ulimits like these are redundantly enforced by the buildbots, so
85# just removing them here won't work.
86# Solaris does not have the -m flag for ulimit
87ifeq ($(HOST_OS),SunOS)
88ULIMIT=ulimit -t 1200 ; ulimit -d 512000 ; ulimit -v 512000 ;
89else # !SunOS
90# Newer versions of python try to allocate an insane amount of address space for
91# its thread-local storage, don't set a limit here.
92# When -v is not used, then -s has to be used to limit the stack size.
93# FIXME: Those limits should be enforced by lit instead of globally.
94ULIMIT=ulimit -t 1200 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -s 8192 ;
95endif # SunOS
96
97check-local:: lit.site.cfg Unit/lit.site.cfg
98	( $(ULIMIT) \
99	  $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) )
100
101# This is a legacy alias dating from when both DejaGNU and lit were in use.
102check-local-lit:: check-local
103
104check-local-all:: lit.site.cfg Unit/lit.site.cfg extra-site-cfgs
105	( $(ULIMIT) \
106	  $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) )
107
108clean::
109	$(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print`
110
111FORCE:
112
113ifeq ($(DISABLE_ASSERTIONS),1)
114ENABLE_ASSERTIONS=0
115else
116ENABLE_ASSERTIONS=1
117endif
118
119lit.site.cfg: FORCE
120	@echo "Making LLVM 'lit.site.cfg' file..."
121	@$(ECHOPATH) s=@LLVM_HOST_TRIPLE@=$(HOST_TRIPLE)=g > lit.tmp
122	@$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
123	@$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g >> lit.tmp
124	@$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
125	@$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
126	@$(ECHOPATH) s=@LLVM_LIBRARY_DIR@=$(LibDir)=g >> lit.tmp
127	@$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> lit.tmp
128	@$(ECHOPATH) s=@SHLIBEXT@=$(SHLIBEXT)=g >> lit.tmp
129	@$(ECHOPATH) s=@EXEEXT@=$(EXEEXT)=g >> lit.tmp
130	@$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp
131	@$(ECHOPATH) s=@GOLD_EXECUTABLE@=ld=g >> lit.tmp
132	@$(ECHOPATH) s=@LD64_EXECUTABLE@=ld=g >> lit.tmp
133	@$(ECHOPATH) s=@OCAMLFIND@=$(OCAMLFIND)=g >> lit.tmp
134	@$(ECHOPATH) s!@OCAMLFLAGS@!$(addprefix -cclib ,$(LDFLAGS))!g >> lit.tmp
135	@$(ECHOPATH) s=@HAVE_OCAMLOPT@=$(HAVE_OCAMLOPT)=g >> lit.tmp
136	@$(ECHOPATH) s=@HAVE_OCAML_OUNIT@=$(HAVE_OCAML_OUNIT)=g >> lit.tmp
137	@$(ECHOPATH) s=@LLVM_INCLUDE_GO_TESTS@=ON=g >> lit.tmp
138	@$(ECHOPATH) s=@GO_EXECUTABLE@=$(GO)=g >> lit.tmp
139	@$(ECHOPATH) s!@HOST_CC@!$(CC)!g >> lit.tmp
140	@$(ECHOPATH) s!@HOST_CXX@!$(CXX)!g >> lit.tmp
141	@$(ECHOPATH) s!@HOST_LDFLAGS@!$(LDFLAGS)!g >> lit.tmp
142	@$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> lit.tmp
143	@$(ECHOPATH) s=@ENABLE_ASSERTIONS@=$(ENABLE_ASSERTIONS)=g >> lit.tmp
144	@$(ECHOPATH) s=@TARGETS_TO_BUILD@=$(TARGETS_TO_BUILD)=g >> lit.tmp
145	@$(ECHOPATH) s=@LLVM_BINDINGS@=$(BINDINGS_TO_BUILD)=g >> lit.tmp
146	@$(ECHOPATH) s=@HOST_OS@=$(HOST_OS)=g >> lit.tmp
147	@$(ECHOPATH) s=@HOST_ARCH@=$(HOST_ARCH)=g >> lit.tmp
148	@$(ECHOPATH) s=@HAVE_LIBZ@=$(HAVE_LIBZ)=g >> lit.tmp
149	@$(ECHOPATH) s=@HAVE_DIA_SDK@=0=g >> lit.tmp
150	@$(ECHOPATH) s=@ENABLE_EXAMPLES@=$(BUILD_EXAMPLES)=g >> lit.tmp
151	@$(ECHOPATH) s=@ENABLE_TIMESTAMPS@=$(ENABLE_TIMESTAMPS)=g >> lit.tmp
152	@sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
153	@-rm -f lit.tmp
154
155Unit/lit.site.cfg: $(PROJ_OBJ_DIR)/Unit/.dir FORCE
156	@echo "Making LLVM unittest 'lit.site.cfg' file..."
157	@$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > unit.tmp
158	@$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> unit.tmp
159	@$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> unit.tmp
160	@$(ECHOPATH) s=@LLVM_BUILD_MODE@=$(BuildMode)=g >> unit.tmp
161	@$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> unit.tmp
162	@$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> unit.tmp
163	@$(ECHOPATH) s=@HOST_OS@=$(HOST_OS)=g >> unit.tmp
164	@$(ECHOPATH) s=@HOST_ARCH@=$(HOST_ARCH)=g >> lit.tmp
165	@sed -f unit.tmp $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
166	@-rm -f unit.tmp
167