2004-11-07 13:05:37 +08:00
|
|
|
#===- test/Makefile ----------------------------------------*- Makefile -*--===#
|
2009-03-06 20:25:56 +08:00
|
|
|
#
|
2004-11-07 13:05:37 +08:00
|
|
|
# The LLVM Compiler Infrastructure
|
|
|
|
#
|
2007-12-30 04:11:13 +08:00
|
|
|
# This file is distributed under the University of Illinois Open Source
|
|
|
|
# License. See LICENSE.TXT for details.
|
2009-03-06 20:25:56 +08:00
|
|
|
#
|
2004-11-07 13:05:37 +08:00
|
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
|
2009-01-01 01:38:27 +08:00
|
|
|
LEVEL = ..
|
2009-03-06 20:25:56 +08:00
|
|
|
DIRS =
|
2002-01-24 05:36:59 +08:00
|
|
|
|
2003-09-06 23:12:21 +08:00
|
|
|
#
|
2004-12-04 14:25:08 +08:00
|
|
|
# Make Dejagnu the default for testing
|
2003-09-06 23:12:21 +08:00
|
|
|
#
|
2004-12-06 13:35:38 +08:00
|
|
|
all:: check-local
|
2003-09-06 23:12:21 +08:00
|
|
|
|
2003-10-28 01:46:42 +08:00
|
|
|
# Include other test rules
|
|
|
|
include Makefile.tests
|
|
|
|
|
2004-11-07 13:05:37 +08:00
|
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
# DejaGNU testing support
|
|
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
|
2009-06-26 13:44:53 +08:00
|
|
|
ifneq ($(GREP_OPTIONS),)
|
|
|
|
$(warning GREP_OPTIONS environment variable may interfere with test results)
|
|
|
|
endif
|
|
|
|
|
2008-02-26 20:08:55 +08:00
|
|
|
ifdef VERBOSE
|
|
|
|
RUNTESTFLAGS := $(VERBOSE)
|
2009-09-08 13:31:44 +08:00
|
|
|
LIT_ARGS := -v
|
|
|
|
else
|
|
|
|
LIT_ARGS := -s -v
|
2008-02-26 20:08:55 +08:00
|
|
|
endif
|
|
|
|
|
2004-11-08 05:39:41 +08:00
|
|
|
ifdef TESTSUITE
|
2009-09-08 13:31:44 +08:00
|
|
|
LIT_TESTSUITE := $(TESTSUITE)
|
2004-12-13 05:39:49 +08:00
|
|
|
CLEANED_TESTSUITE := $(patsubst %/,%,$(TESTSUITE))
|
2006-11-11 09:02:45 +08:00
|
|
|
CLEANED_TESTSUITE := $(patsubst test/%,%,$(CLEANED_TESTSUITE))
|
2008-02-26 20:08:55 +08:00
|
|
|
RUNTESTFLAGS += --tool $(CLEANED_TESTSUITE)
|
2009-09-08 13:31:44 +08:00
|
|
|
else
|
|
|
|
LIT_TESTSUITE := .
|
2004-11-08 05:39:41 +08:00
|
|
|
endif
|
|
|
|
|
2008-10-07 22:48:14 +08:00
|
|
|
ifdef VG
|
2009-09-14 23:27:43 +08:00
|
|
|
VALGRIND := valgrind --tool=memcheck --quiet --trace-children=yes --error-exitcode=3 --leak-check=full $(VALGRIND_EXTRA_ARGS)
|
2008-10-07 22:48:14 +08:00
|
|
|
endif
|
|
|
|
|
2009-09-21 03:04:28 +08:00
|
|
|
# Check what to run for -all.
|
2009-09-20 14:17:21 +08:00
|
|
|
LIT_ALL_TESTSUITES := $(LIT_TESTSUITE)
|
2009-09-21 03:04:28 +08:00
|
|
|
|
|
|
|
extra-lit-site-cfgs::
|
|
|
|
.PHONY: extra-lit-site-cfgs
|
|
|
|
|
|
|
|
ifneq ($(strip $(filter check-local-all,$(MAKECMDGOALS))),)
|
2009-09-20 14:17:21 +08:00
|
|
|
ifndef TESTSUITE
|
|
|
|
ifeq ($(shell test -d $(PROJ_SRC_DIR)/../tools/clang && echo OK), OK)
|
|
|
|
LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/clang/test
|
2009-09-21 03:04:28 +08:00
|
|
|
|
|
|
|
# Force creation of Clang's lit.site.cfg.
|
|
|
|
clang-lit-site-cfg: FORCE
|
|
|
|
$(MAKE) -C $(PROJ_OBJ_DIR)/../tools/clang/test lit.site.cfg
|
|
|
|
extra-lit-site-cfgs:: clang-lit-site-cfg
|
|
|
|
endif
|
2009-09-20 14:17:21 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2007-09-18 20:26:17 +08:00
|
|
|
IGNORE_TESTS :=
|
|
|
|
|
2006-05-28 12:21:40 +08:00
|
|
|
ifndef RUNLLVM2CPP
|
2007-09-18 20:26:17 +08:00
|
|
|
IGNORE_TESTS += llvm2cpp.exp
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef IGNORE_TESTS
|
|
|
|
RUNTESTFLAGS += --ignore "$(strip $(IGNORE_TESTS))"
|
2006-05-28 12:21:40 +08:00
|
|
|
endif
|
|
|
|
|
2009-11-17 07:32:30 +08:00
|
|
|
# ulimits like these are redundantly enforced by the buildbots, so
|
|
|
|
# just removing them here won't work.
|
2009-08-01 11:37:54 +08:00
|
|
|
# Both AuroraUX & Solaris do not have the -m flag for ulimit
|
2009-08-18 08:40:33 +08:00
|
|
|
ifeq ($(HOST_OS),SunOS)
|
2009-11-17 07:32:30 +08:00
|
|
|
ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -v 512000 ;
|
2009-10-26 10:37:56 +08:00
|
|
|
else # !SunOS
|
|
|
|
ifeq ($(HOST_OS),AuroraUX)
|
2009-11-17 07:32:30 +08:00
|
|
|
ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -v 512000 ;
|
2009-10-26 10:37:56 +08:00
|
|
|
else # !AuroraUX
|
2009-11-17 07:32:30 +08:00
|
|
|
ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 512000 ;
|
2009-10-26 10:37:56 +08:00
|
|
|
endif # AuroraUX
|
|
|
|
endif # SunOS
|
2009-08-01 11:37:54 +08:00
|
|
|
|
2006-08-01 08:07:58 +08:00
|
|
|
ifneq ($(RUNTEST),)
|
2004-12-06 13:35:38 +08:00
|
|
|
check-local:: site.exp
|
2009-08-01 11:37:54 +08:00
|
|
|
( $(ULIMIT) \
|
2009-09-13 10:45:57 +08:00
|
|
|
PATH="$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(LLVMGCCDIR)/bin:$(PATH)" \
|
2007-02-12 04:18:32 +08:00
|
|
|
$(RUNTEST) $(RUNTESTFLAGS) )
|
2006-08-01 08:07:58 +08:00
|
|
|
else
|
|
|
|
check-local:: site.exp
|
2009-01-02 04:26:05 +08:00
|
|
|
@echo "*** dejagnu not found. Make sure 'runtest' is in your PATH, then reconfigure LLVM."
|
2006-08-01 08:07:58 +08:00
|
|
|
endif
|
2004-11-08 05:39:41 +08:00
|
|
|
|
2009-09-14 10:39:01 +08:00
|
|
|
check-local-lit:: lit.site.cfg Unit/lit.site.cfg
|
2009-09-08 13:31:44 +08:00
|
|
|
( $(ULIMIT) \
|
2009-11-08 17:08:00 +08:00
|
|
|
$(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) )
|
2009-09-08 13:31:44 +08:00
|
|
|
|
2009-09-21 03:04:28 +08:00
|
|
|
check-local-all:: lit.site.cfg Unit/lit.site.cfg extra-lit-site-cfgs
|
2009-09-20 14:17:21 +08:00
|
|
|
( $(ULIMIT) \
|
2009-11-08 17:08:00 +08:00
|
|
|
$(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) )
|
2009-09-20 14:17:21 +08:00
|
|
|
|
2007-04-15 14:18:50 +08:00
|
|
|
ifdef TESTONE
|
|
|
|
CLEANED_TESTONE := $(patsubst %/,%,$(TESTONE))
|
|
|
|
CLEANED_TESTONE := $(patsubst test/%,%,$(CLEANED_TESTONE))
|
|
|
|
SUBDIR := $(shell dirname $(CLEANED_TESTONE))
|
|
|
|
TESTPATH := $(LLVM_SRC_ROOT)/test/$(CLEANED_TESTONE)
|
|
|
|
check-one: site.exp $(TCLSH)
|
2007-04-17 00:45:12 +08:00
|
|
|
$(Verb)( echo "source $(LLVM_OBJ_ROOT)/test/site.exp" ; \
|
2007-04-15 14:18:50 +08:00
|
|
|
echo "set subdir $(SUBDIR)" ; \
|
|
|
|
echo "proc pass { msg } { puts \"PASS: \$$msg\" } "; \
|
|
|
|
echo "proc fail { msg } { puts \"FAIL: \$$msg\" }" ; \
|
|
|
|
echo "proc xfail { msg } { puts \"XFAIL: \$$msg\" }" ; \
|
|
|
|
echo "proc xpass { msg } { puts \"XPASS: \$$msg\" }" ; \
|
2008-02-26 21:27:49 +08:00
|
|
|
echo "proc verbose args { }" ; \
|
2007-04-15 14:18:50 +08:00
|
|
|
echo "source $(LLVM_SRC_ROOT)/test/lib/llvm.exp" ; \
|
|
|
|
echo "RunLLVMTests $(TESTPATH)" ) | \
|
2009-08-01 11:37:54 +08:00
|
|
|
( $(ULIMIT) \
|
2007-04-15 14:18:50 +08:00
|
|
|
PATH="$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH)" \
|
|
|
|
$(TCLSH) )
|
|
|
|
endif
|
|
|
|
|
2004-12-04 14:25:08 +08:00
|
|
|
clean::
|
2007-01-17 15:59:14 +08:00
|
|
|
$(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print`
|
2004-11-07 12:59:52 +08:00
|
|
|
|
2009-02-03 05:09:36 +08:00
|
|
|
# dsymutil is used on the Darwin to manipulate DWARF debugging information.
|
2009-08-18 08:40:33 +08:00
|
|
|
ifeq ($(TARGET_OS),Darwin)
|
2009-02-03 05:09:36 +08:00
|
|
|
DSYMUTIL=dsymutil
|
|
|
|
else
|
|
|
|
DSYMUTIL=true
|
|
|
|
endif
|
2009-03-22 02:12:24 +08:00
|
|
|
ifdef TargetCommonOpts
|
|
|
|
BUGPOINT_TOPTS="-gcc-tool-args $(TargetCommonOpts)"
|
|
|
|
else
|
|
|
|
BUGPOINT_TOPTS=""
|
|
|
|
endif
|
2009-02-03 05:09:36 +08:00
|
|
|
|
2009-09-04 07:27:31 +08:00
|
|
|
ifneq ($(OCAMLOPT),)
|
|
|
|
CC_FOR_OCAMLOPT := $(shell $(OCAMLOPT) -config | grep native_c_compiler | sed -e 's/native_c_compiler: //')
|
|
|
|
CXX_FOR_OCAMLOPT := $(subst gcc,g++,$(CC_FOR_OCAMLOPT))
|
2009-07-22 05:56:46 +08:00
|
|
|
endif
|
|
|
|
|
2008-10-07 22:48:14 +08:00
|
|
|
FORCE:
|
|
|
|
|
|
|
|
site.exp: FORCE
|
2004-11-07 12:59:52 +08:00
|
|
|
@echo 'Making a new site.exp file...'
|
2009-11-08 17:29:52 +08:00
|
|
|
@echo '## Autogenerated by LLVM configuration.' > site.tmp
|
|
|
|
@echo '# Do not edit!' >> site.tmp
|
2006-04-14 04:33:59 +08:00
|
|
|
@echo 'set target_triplet "$(TARGET_TRIPLE)"' >> site.tmp
|
2007-04-22 04:39:26 +08:00
|
|
|
@echo 'set TARGETS_TO_BUILD "$(TARGETS_TO_BUILD)"' >> site.tmp
|
2007-04-22 05:43:18 +08:00
|
|
|
@echo 'set llvmgcc_langs "$(LLVMGCC_LANGS)"' >> site.tmp
|
2006-04-14 04:33:59 +08:00
|
|
|
@echo 'set llvmgcc_version "$(LLVMGCC_VERSION)"' >> site.tmp
|
2006-05-28 15:22:42 +08:00
|
|
|
@echo 'set llvmtoolsdir "$(ToolDir)"' >>site.tmp
|
|
|
|
@echo 'set llvmlibsdir "$(LibDir)"' >>site.tmp
|
2009-09-13 09:41:18 +08:00
|
|
|
@echo 'set llvm_bindings "$(BINDINGS_TO_BUILD)"' >> site.tmp
|
2006-05-28 12:21:40 +08:00
|
|
|
@echo 'set srcroot "$(LLVM_SRC_ROOT)"' >>site.tmp
|
|
|
|
@echo 'set objroot "$(LLVM_OBJ_ROOT)"' >>site.tmp
|
2006-04-14 04:33:59 +08:00
|
|
|
@echo 'set srcdir "$(LLVM_SRC_ROOT)/test"' >>site.tmp
|
|
|
|
@echo 'set objdir "$(LLVM_OBJ_ROOT)/test"' >>site.tmp
|
2007-04-12 04:57:39 +08:00
|
|
|
@echo 'set gccpath "$(CC)"' >>site.tmp
|
|
|
|
@echo 'set gxxpath "$(CXX)"' >>site.tmp
|
2009-03-22 02:12:24 +08:00
|
|
|
@echo 'set compile_c "' $(CC) $(CPP.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c '"' >>site.tmp
|
|
|
|
@echo 'set compile_cxx "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c '"' >> site.tmp
|
|
|
|
@echo 'set link "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) '"' >>site.tmp
|
|
|
|
@echo 'set llvmgcc "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp
|
|
|
|
@echo 'set llvmgxx "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp
|
2006-04-07 06:22:08 +08:00
|
|
|
@echo 'set llvmgccmajvers "$(LLVMGCC_MAJVERS)"' >> site.tmp
|
2009-03-22 02:12:24 +08:00
|
|
|
@echo 'set bugpoint_topts $(BUGPOINT_TOPTS)' >> site.tmp
|
2007-04-12 10:49:30 +08:00
|
|
|
@echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp
|
2009-09-04 07:27:31 +08:00
|
|
|
@echo 'set ocamlopt "$(OCAMLOPT) -cc \"$(CXX_FOR_OCAMLOPT)\" -I $(LibDir)/ocaml"' >> site.tmp
|
2008-10-07 22:48:14 +08:00
|
|
|
@echo 'set valgrind "$(VALGRIND)"' >> site.tmp
|
2008-10-22 01:21:32 +08:00
|
|
|
@echo 'set grep "$(GREP)"' >>site.tmp
|
|
|
|
@echo 'set gas "$(GAS)"' >>site.tmp
|
2009-02-03 05:09:36 +08:00
|
|
|
@echo 'set llvmdsymutil "$(DSYMUTIL)"' >>site.tmp
|
2004-11-07 12:59:52 +08:00
|
|
|
@echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp
|
|
|
|
@test ! -f site.exp || \
|
|
|
|
sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
|
|
|
|
@-rm -f site.bak
|
|
|
|
@test ! -f site.exp || mv site.exp site.bak
|
|
|
|
@mv site.tmp site.exp
|
2009-09-08 13:31:44 +08:00
|
|
|
|
|
|
|
lit.site.cfg: site.exp
|
2009-09-21 03:04:28 +08:00
|
|
|
@echo "Making LLVM 'lit.site.cfg' file..."
|
2009-09-22 15:38:33 +08:00
|
|
|
@sed -e "s#@LLVM_SOURCE_DIR@#$(LLVM_SRC_ROOT)#g" \
|
|
|
|
-e "s#@LLVM_BINARY_DIR@#$(LLVM_OBJ_ROOT)#g" \
|
|
|
|
-e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
|
|
|
|
-e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \
|
|
|
|
$(PROJ_SRC_DIR)/lit.site.cfg.in > $@
|
2009-09-14 10:39:01 +08:00
|
|
|
|
2009-10-02 17:30:03 +08:00
|
|
|
Unit/lit.site.cfg: $(PROJ_OBJ_DIR)/Unit/.dir FORCE
|
2009-09-21 03:04:28 +08:00
|
|
|
@echo "Making LLVM unittest 'lit.site.cfg' file..."
|
2009-11-08 17:07:51 +08:00
|
|
|
@sed -e "s#@LLVM_SOURCE_DIR@#$(LLVM_SRC_ROOT)#g" \
|
|
|
|
-e "s#@LLVM_BINARY_DIR@#$(LLVM_OBJ_ROOT)#g" \
|
|
|
|
-e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
|
|
|
|
-e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \
|
|
|
|
-e "s#@LLVM_BUILD_MODE@#$(BuildMode)#g" \
|
|
|
|
$(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
|