Chris Lattner | 12d632c | 2004-11-07 05:05:37 +0000 | [diff] [blame] | 1 | #===- test/Makefile ----------------------------------------*- Makefile -*--===# |
Mikhail Glushenkov | 38ead32 | 2009-03-06 12:25:56 +0000 | [diff] [blame] | 2 | # |
Chris Lattner | 12d632c | 2004-11-07 05:05:37 +0000 | [diff] [blame] | 3 | # The LLVM Compiler Infrastructure |
| 4 | # |
Chris Lattner | 57360d1 | 2007-12-29 20:11:13 +0000 | [diff] [blame] | 5 | # This file is distributed under the University of Illinois Open Source |
| 6 | # License. See LICENSE.TXT for details. |
Mikhail Glushenkov | 38ead32 | 2009-03-06 12:25:56 +0000 | [diff] [blame] | 7 | # |
Chris Lattner | 12d632c | 2004-11-07 05:05:37 +0000 | [diff] [blame] | 8 | #===------------------------------------------------------------------------===# |
| 9 | |
Misha Brukman | 5eb009a | 2008-12-31 17:38:27 +0000 | [diff] [blame] | 10 | LEVEL = .. |
Mikhail Glushenkov | 38ead32 | 2009-03-06 12:25:56 +0000 | [diff] [blame] | 11 | DIRS = |
Chris Lattner | 52a4e85 | 2002-01-23 21:36:59 +0000 | [diff] [blame] | 12 | |
Reid Spencer | 135e1d8 | 2004-12-06 05:35:38 +0000 | [diff] [blame] | 13 | all:: check-local |
John Criswell | ee29d2a | 2003-09-06 15:12:21 +0000 | [diff] [blame] | 14 | |
John Criswell | d184c67 | 2003-10-27 17:46:42 +0000 | [diff] [blame] | 15 | # Include other test rules |
John Criswell | d184c67 | 2003-10-27 17:46:42 +0000 | [diff] [blame] | 16 | include Makefile.tests |
| 17 | |
Chris Lattner | 12d632c | 2004-11-07 05:05:37 +0000 | [diff] [blame] | 18 | #===------------------------------------------------------------------------===# |
| 19 | # DejaGNU testing support |
| 20 | #===------------------------------------------------------------------------===# |
| 21 | |
Shantonu Sen | 1b6d3da | 2009-06-26 05:44:53 +0000 | [diff] [blame] | 22 | ifneq ($(GREP_OPTIONS),) |
| 23 | $(warning GREP_OPTIONS environment variable may interfere with test results) |
| 24 | endif |
| 25 | |
Gabor Greif | 684ed3d | 2008-02-26 12:08:55 +0000 | [diff] [blame] | 26 | ifdef VERBOSE |
Chris Lattner | 0dd0d49 | 2010-04-17 19:04:03 +0000 | [diff] [blame] | 27 | LIT_ARGS := -v |
Daniel Dunbar | 70a3b77 | 2009-09-08 05:31:44 +0000 | [diff] [blame] | 28 | else |
| 29 | LIT_ARGS := -s -v |
Gabor Greif | 684ed3d | 2008-02-26 12:08:55 +0000 | [diff] [blame] | 30 | endif |
| 31 | |
Tanya Lattner | 491e9cd | 2004-11-07 21:39:41 +0000 | [diff] [blame] | 32 | ifdef TESTSUITE |
Daniel Dunbar | 70a3b77 | 2009-09-08 05:31:44 +0000 | [diff] [blame] | 33 | LIT_TESTSUITE := $(TESTSUITE) |
Daniel Dunbar | 70a3b77 | 2009-09-08 05:31:44 +0000 | [diff] [blame] | 34 | else |
| 35 | LIT_TESTSUITE := . |
Tanya Lattner | 491e9cd | 2004-11-07 21:39:41 +0000 | [diff] [blame] | 36 | endif |
| 37 | |
Daniel Dunbar | 2891dbb | 2009-09-20 19:04:28 +0000 | [diff] [blame] | 38 | # Check what to run for -all. |
Daniel Dunbar | 3418579 | 2009-09-20 06:17:21 +0000 | [diff] [blame] | 39 | LIT_ALL_TESTSUITES := $(LIT_TESTSUITE) |
Daniel Dunbar | 2891dbb | 2009-09-20 19:04:28 +0000 | [diff] [blame] | 40 | |
Chandler Carruth | 2378aa7 | 2012-06-28 00:03:15 +0000 | [diff] [blame] | 41 | extra-site-cfgs:: |
| 42 | .PHONY: extra-site-cfgs |
Daniel Dunbar | 2891dbb | 2009-09-20 19:04:28 +0000 | [diff] [blame] | 43 | |
| 44 | ifneq ($(strip $(filter check-local-all,$(MAKECMDGOALS))),) |
Daniel Dunbar | 3418579 | 2009-09-20 06:17:21 +0000 | [diff] [blame] | 45 | ifndef TESTSUITE |
NAKAMURA Takumi | 40a4360 | 2011-10-16 02:54:14 +0000 | [diff] [blame] | 46 | ifeq ($(shell test -f $(PROJ_OBJ_DIR)/../tools/clang/Makefile && echo OK), OK) |
Daniel Dunbar | 3418579 | 2009-09-20 06:17:21 +0000 | [diff] [blame] | 47 | LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/clang/test |
Daniel Dunbar | 2891dbb | 2009-09-20 19:04:28 +0000 | [diff] [blame] | 48 | |
| 49 | # Force creation of Clang's lit.site.cfg. |
Chandler Carruth | 2378aa7 | 2012-06-28 00:03:15 +0000 | [diff] [blame] | 50 | clang-site-cfg: FORCE |
NAKAMURA Takumi | ee0056d | 2011-02-03 07:36:02 +0000 | [diff] [blame] | 51 | $(MAKE) -C $(PROJ_OBJ_DIR)/../tools/clang/test lit.site.cfg Unit/lit.site.cfg |
Chandler Carruth | 2378aa7 | 2012-06-28 00:03:15 +0000 | [diff] [blame] | 52 | extra-site-cfgs:: clang-site-cfg |
Daniel Dunbar | 2891dbb | 2009-09-20 19:04:28 +0000 | [diff] [blame] | 53 | endif |
Chandler Carruth | f5ecf02 | 2012-08-09 20:26:41 +0000 | [diff] [blame] | 54 | |
| 55 | ifeq ($(shell test -f $(PROJ_OBJ_DIR)/../tools/clang/tools/extra/Makefile && echo OK), OK) |
| 56 | LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/clang/tools/extra/test |
Galina Kistanova | 57ba122 | 2013-03-22 18:54:14 +0000 | [diff] [blame] | 57 | |
| 58 | # Force creation of Clang Tools' lit.site.cfg. |
| 59 | clang-tools-site-cfg: FORCE |
Benjamin Kramer | 4551342 | 2014-08-13 20:41:26 +0000 | [diff] [blame] | 60 | $(MAKE) -C $(PROJ_OBJ_DIR)/../tools/clang/tools/extra/test lit.site.cfg Unit/lit.site.cfg |
Galina Kistanova | 57ba122 | 2013-03-22 18:54:14 +0000 | [diff] [blame] | 61 | extra-site-cfgs:: clang-tools-site-cfg |
Chandler Carruth | f5ecf02 | 2012-08-09 20:26:41 +0000 | [diff] [blame] | 62 | endif |
Sebastian Pop | b02834c | 2013-05-20 18:49:15 +0000 | [diff] [blame] | 63 | |
Iain Sandoe | d276b15 | 2014-06-06 09:06:25 +0000 | [diff] [blame] | 64 | ifeq ($(shell test -f $(PROJ_OBJ_DIR)/../tools/lld/Makefile && echo OK), OK) |
| 65 | LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/lld/test |
| 66 | |
| 67 | # Force creation of lld's lit.site.cfg. |
| 68 | lld-site-cfg: FORCE |
| 69 | $(MAKE) -C $(PROJ_OBJ_DIR)/../tools/lld/test lit.site.cfg Unit/lit.site.cfg |
| 70 | extra-site-cfgs:: lld-site-cfg |
| 71 | endif |
| 72 | |
Sebastian Pop | b02834c | 2013-05-20 18:49:15 +0000 | [diff] [blame] | 73 | ifeq ($(shell test -f $(PROJ_OBJ_DIR)/../tools/polly/Makefile && echo OK), OK) |
| 74 | LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/polly/test |
| 75 | |
| 76 | # Force creation of Polly's lit.site.cfg. |
| 77 | polly-tools-site-cfg: FORCE |
| 78 | $(MAKE) -C $(PROJ_OBJ_DIR)/../tools/polly/test lit.site.cfg |
| 79 | extra-site-cfgs:: polly-tools-site-cfg |
| 80 | endif |
Daniel Dunbar | 3418579 | 2009-09-20 06:17:21 +0000 | [diff] [blame] | 81 | endif |
| 82 | endif |
| 83 | |
Jeffrey Yasskin | feada94 | 2009-11-16 23:32:30 +0000 | [diff] [blame] | 84 | # ulimits like these are redundantly enforced by the buildbots, so |
| 85 | # just removing them here won't work. |
Rafael Espindola | 1c9cace | 2014-08-14 15:15:09 +0000 | [diff] [blame] | 86 | # Solaris does not have the -m flag for ulimit |
Anton Korobeynikov | e55db74 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 87 | ifeq ($(HOST_OS),SunOS) |
Dimitry Andric | 95c105e | 2015-02-13 19:45:19 +0000 | [diff] [blame] | 88 | ULIMIT=ulimit -t 1200 ; ulimit -d 512000 ; ulimit -v 512000 ; |
Edward O'Callaghan | 7e43439 | 2009-10-26 02:37:56 +0000 | [diff] [blame] | 89 | else # !SunOS |
Benjamin Kramer | f81093a | 2012-12-09 10:34:22 +0000 | [diff] [blame] | 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. |
Patrik Hagglund | 775a266 | 2013-03-12 12:38:10 +0000 | [diff] [blame] | 92 | # When -v is not used, then -s has to be used to limit the stack size. |
Benjamin Kramer | f81093a | 2012-12-09 10:34:22 +0000 | [diff] [blame] | 93 | # FIXME: Those limits should be enforced by lit instead of globally. |
Dimitry Andric | 95c105e | 2015-02-13 19:45:19 +0000 | [diff] [blame] | 94 | ULIMIT=ulimit -t 1200 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -s 8192 ; |
Edward O'Callaghan | 7e43439 | 2009-10-26 02:37:56 +0000 | [diff] [blame] | 95 | endif # SunOS |
Daniel Dunbar | 54f9759 | 2009-08-01 03:37:54 +0000 | [diff] [blame] | 96 | |
Chandler Carruth | 2378aa7 | 2012-06-28 00:03:15 +0000 | [diff] [blame] | 97 | check-local:: lit.site.cfg Unit/lit.site.cfg |
Daniel Dunbar | 70a3b77 | 2009-09-08 05:31:44 +0000 | [diff] [blame] | 98 | ( $(ULIMIT) \ |
Saleem Abdulrasool | 3ef8b0a | 2013-01-30 04:07:37 +0000 | [diff] [blame] | 99 | $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) |
Daniel Dunbar | 70a3b77 | 2009-09-08 05:31:44 +0000 | [diff] [blame] | 100 | |
Chandler Carruth | 2378aa7 | 2012-06-28 00:03:15 +0000 | [diff] [blame] | 101 | # This is a legacy alias dating from when both DejaGNU and lit were in use. |
| 102 | check-local-lit:: check-local |
| 103 | |
| 104 | check-local-all:: lit.site.cfg Unit/lit.site.cfg extra-site-cfgs |
Daniel Dunbar | 3418579 | 2009-09-20 06:17:21 +0000 | [diff] [blame] | 105 | ( $(ULIMIT) \ |
Saleem Abdulrasool | 3ef8b0a | 2013-01-30 04:07:37 +0000 | [diff] [blame] | 106 | $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) ) |
Daniel Dunbar | 3418579 | 2009-09-20 06:17:21 +0000 | [diff] [blame] | 107 | |
Tanya Lattner | 9f97b4c | 2004-12-04 06:25:08 +0000 | [diff] [blame] | 108 | clean:: |
Reid Spencer | fb15c00 | 2007-01-17 07:59:14 +0000 | [diff] [blame] | 109 | $(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print` |
Tanya Lattner | 7a7cb4c | 2004-11-07 04:59:52 +0000 | [diff] [blame] | 110 | |
Nuno Lopes | 2bdc07b | 2008-10-07 14:48:14 +0000 | [diff] [blame] | 111 | FORCE: |
| 112 | |
Andrew Trick | f2a5842 | 2011-06-22 23:23:19 +0000 | [diff] [blame] | 113 | ifeq ($(DISABLE_ASSERTIONS),1) |
| 114 | ENABLE_ASSERTIONS=0 |
| 115 | else |
| 116 | ENABLE_ASSERTIONS=1 |
| 117 | endif |
| 118 | |
Chandler Carruth | 96f41a1 | 2012-06-28 00:16:51 +0000 | [diff] [blame] | 119 | lit.site.cfg: FORCE |
Daniel Dunbar | 2891dbb | 2009-09-20 19:04:28 +0000 | [diff] [blame] | 120 | @echo "Making LLVM 'lit.site.cfg' file..." |
Tim Northover | d66ad6c | 2013-05-04 07:36:23 +0000 | [diff] [blame] | 121 | @$(ECHOPATH) s=@LLVM_HOST_TRIPLE@=$(HOST_TRIPLE)=g > lit.tmp |
Peter Collingbourne | fbb662f | 2013-01-16 17:27:22 +0000 | [diff] [blame] | 122 | @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp |
Chandler Carruth | 96f41a1 | 2012-06-28 00:16:51 +0000 | [diff] [blame] | 123 | @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g >> lit.tmp |
NAKAMURA Takumi | 0272485 | 2011-03-08 12:25:10 +0000 | [diff] [blame] | 124 | @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp |
| 125 | @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp |
Peter Zotov | 91bf887 | 2014-12-30 03:24:11 +0000 | [diff] [blame] | 126 | @$(ECHOPATH) s=@LLVM_LIBRARY_DIR@=$(LibDir)=g >> lit.tmp |
Chandler Carruth | 96f41a1 | 2012-06-28 00:16:51 +0000 | [diff] [blame] | 127 | @$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> lit.tmp |
| 128 | @$(ECHOPATH) s=@SHLIBEXT@=$(SHLIBEXT)=g >> lit.tmp |
Alp Toker | 1214e71 | 2014-01-22 21:52:35 +0000 | [diff] [blame] | 129 | @$(ECHOPATH) s=@EXEEXT@=$(EXEEXT)=g >> lit.tmp |
Saleem Abdulrasool | 3ef8b0a | 2013-01-30 04:07:37 +0000 | [diff] [blame] | 130 | @$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp |
Chandler Carruth | 15db818 | 2015-02-14 09:43:57 +0000 | [diff] [blame] | 131 | @$(ECHOPATH) s=@GOLD_EXECUTABLE@=ld=g >> lit.tmp |
Peter Zotov | 47f88b5 | 2014-10-30 08:29:45 +0000 | [diff] [blame] | 132 | @$(ECHOPATH) s=@OCAMLFIND@=$(OCAMLFIND)=g >> lit.tmp |
Hal Finkel | 6fef94e | 2014-11-13 09:29:30 +0000 | [diff] [blame] | 133 | @$(ECHOPATH) s!@OCAMLFLAGS@!$(addprefix -cclib ,$(LDFLAGS))!g >> lit.tmp |
Peter Zotov | 47f88b5 | 2014-10-30 08:29:45 +0000 | [diff] [blame] | 134 | @$(ECHOPATH) s=@HAVE_OCAMLOPT@=$(HAVE_OCAMLOPT)=g >> lit.tmp |
| 135 | @$(ECHOPATH) s=@HAVE_OCAML_OUNIT@=$(HAVE_OCAML_OUNIT)=g >> lit.tmp |
Peter Collingbourne | 798ace2 | 2014-10-16 22:48:02 +0000 | [diff] [blame] | 136 | @$(ECHOPATH) s=@GO_EXECUTABLE@=$(GO)=g >> lit.tmp |
| 137 | @$(ECHOPATH) s!@HOST_CC@!$(CC)!g >> lit.tmp |
| 138 | @$(ECHOPATH) s!@HOST_CXX@!$(CXX)!g >> lit.tmp |
Chandler Carruth | 14e55b1 | 2014-10-21 00:36:28 +0000 | [diff] [blame] | 139 | @$(ECHOPATH) s!@HOST_LDFLAGS@!$(LDFLAGS)!g >> lit.tmp |
NAKAMURA Takumi | 0272485 | 2011-03-08 12:25:10 +0000 | [diff] [blame] | 140 | @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> lit.tmp |
Andrew Trick | 75d3387 | 2011-06-23 17:52:36 +0000 | [diff] [blame] | 141 | @$(ECHOPATH) s=@ENABLE_ASSERTIONS@=$(ENABLE_ASSERTIONS)=g >> lit.tmp |
Eli Bendersky | 0f0c411 | 2012-02-16 06:28:33 +0000 | [diff] [blame] | 142 | @$(ECHOPATH) s=@TARGETS_TO_BUILD@=$(TARGETS_TO_BUILD)=g >> lit.tmp |
| 143 | @$(ECHOPATH) s=@LLVM_BINDINGS@=$(BINDINGS_TO_BUILD)=g >> lit.tmp |
Danil Malyshev | bb8cef5 | 2012-05-17 21:07:47 +0000 | [diff] [blame] | 144 | @$(ECHOPATH) s=@HOST_OS@=$(HOST_OS)=g >> lit.tmp |
| 145 | @$(ECHOPATH) s=@HOST_ARCH@=$(HOST_ARCH)=g >> lit.tmp |
Alexey Samsonov | 005159e | 2013-04-23 10:17:34 +0000 | [diff] [blame] | 146 | @$(ECHOPATH) s=@HAVE_LIBZ@=$(HAVE_LIBZ)=g >> lit.tmp |
Zachary Turner | ca27e72 | 2015-02-22 07:01:41 +0000 | [diff] [blame] | 147 | @$(ECHOPATH) s=@HAVE_DIA_SDK@=0=g >> lit.tmp |
NAKAMURA Takumi | 0272485 | 2011-03-08 12:25:10 +0000 | [diff] [blame] | 148 | @sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ |
| 149 | @-rm -f lit.tmp |
Daniel Dunbar | db5fe93 | 2009-09-14 02:39:01 +0000 | [diff] [blame] | 150 | |
Torok Edwin | e1b691f | 2009-10-02 09:30:03 +0000 | [diff] [blame] | 151 | Unit/lit.site.cfg: $(PROJ_OBJ_DIR)/Unit/.dir FORCE |
Daniel Dunbar | 2891dbb | 2009-09-20 19:04:28 +0000 | [diff] [blame] | 152 | @echo "Making LLVM unittest 'lit.site.cfg' file..." |
NAKAMURA Takumi | 0272485 | 2011-03-08 12:25:10 +0000 | [diff] [blame] | 153 | @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > unit.tmp |
| 154 | @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> unit.tmp |
| 155 | @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> unit.tmp |
NAKAMURA Takumi | 0272485 | 2011-03-08 12:25:10 +0000 | [diff] [blame] | 156 | @$(ECHOPATH) s=@LLVM_BUILD_MODE@=$(BuildMode)=g >> unit.tmp |
| 157 | @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> unit.tmp |
| 158 | @$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> unit.tmp |
Danil Malyshev | bb8cef5 | 2012-05-17 21:07:47 +0000 | [diff] [blame] | 159 | @$(ECHOPATH) s=@HOST_OS@=$(HOST_OS)=g >> unit.tmp |
| 160 | @$(ECHOPATH) s=@HOST_ARCH@=$(HOST_ARCH)=g >> lit.tmp |
NAKAMURA Takumi | 0272485 | 2011-03-08 12:25:10 +0000 | [diff] [blame] | 161 | @sed -f unit.tmp $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@ |
| 162 | @-rm -f unit.tmp |