1 #===- test/Makefile ----------------------------------------*- Makefile -*--===#
3 # The LLVM Compiler Infrastructure
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
8 #===------------------------------------------------------------------------===#
14 # Make Dejagnu the default for testing
18 # Include other test rules
19 include Makefile.tests
21 #===------------------------------------------------------------------------===#
22 # DejaGNU testing support
23 #===------------------------------------------------------------------------===#
26 RUNTESTFLAGS := $(VERBOSE)
30 CLEANED_TESTSUITE := $(patsubst %/,%,$(TESTSUITE))
31 CLEANED_TESTSUITE := $(patsubst test/%,%,$(CLEANED_TESTSUITE))
32 RUNTESTFLAGS += --tool $(CLEANED_TESTSUITE)
36 VALGRIND := valgrind --tool=memcheck --quiet --trace-children=yes --error-exitcode=3 --leak-check=full
42 IGNORE_TESTS += llvm2cpp.exp
45 IGNORE_TESTS += $(filter-out $(BINDINGS_TO_BUILD:=.exp),$(ALL_BINDINGS:=.exp))
48 RUNTESTFLAGS += --ignore "$(strip $(IGNORE_TESTS))"
52 check-local:: site.exp
53 ( ulimit -t 600 ; ulimit -d 512000 ; \
54 ulimit -m 512000 ; ulimit -v 512000 ; \
55 PATH="$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH)" \
56 $(RUNTEST) $(RUNTESTFLAGS) )
58 check-local:: site.exp
59 @echo "*** dejagnu not found. Make sure 'runtest' is in your PATH, then reconfigure LLVM."
63 CLEANED_TESTONE := $(patsubst %/,%,$(TESTONE))
64 CLEANED_TESTONE := $(patsubst test/%,%,$(CLEANED_TESTONE))
65 SUBDIR := $(shell dirname $(CLEANED_TESTONE))
66 TESTPATH := $(LLVM_SRC_ROOT)/test/$(CLEANED_TESTONE)
67 check-one: site.exp $(TCLSH)
68 $(Verb)( echo "source $(LLVM_OBJ_ROOT)/test/site.exp" ; \
69 echo "set subdir $(SUBDIR)" ; \
70 echo "proc pass { msg } { puts \"PASS: \$$msg\" } "; \
71 echo "proc fail { msg } { puts \"FAIL: \$$msg\" }" ; \
72 echo "proc xfail { msg } { puts \"XFAIL: \$$msg\" }" ; \
73 echo "proc xpass { msg } { puts \"XPASS: \$$msg\" }" ; \
74 echo "proc verbose args { }" ; \
75 echo "source $(LLVM_SRC_ROOT)/test/lib/llvm.exp" ; \
76 echo "RunLLVMTests $(TESTPATH)" ) | \
77 ( ulimit -t 600 ; ulimit -d 512000 ; \
78 ulimit -m 512000 ; ulimit -v 512000 ; \
79 PATH="$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH)" \
84 $(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print`
86 # dsymutil is used on the Darwin to manipulate DWARF debugging information.
92 ifdef TargetCommonOpts
93 BUGPOINT_TOPTS="-gcc-tool-args $(TargetCommonOpts)"
101 @echo 'Making a new site.exp file...'
102 @echo '## these variables are automatically generated by make ##' >site.tmp
103 @echo '# Do not edit here. If you wish to override these values' >>site.tmp
104 @echo '# edit the last section' >>site.tmp
105 @echo 'set target_triplet "$(TARGET_TRIPLE)"' >> site.tmp
106 @echo 'set TARGETS_TO_BUILD "$(TARGETS_TO_BUILD)"' >> site.tmp
107 @echo 'set llvmgcc_langs "$(LLVMGCC_LANGS)"' >> site.tmp
108 @echo 'set llvmgcc_version "$(LLVMGCC_VERSION)"' >> site.tmp
109 @echo 'set prcontext "$(TCLSH) $(LLVM_SRC_ROOT)/test/Scripts/prcontext.tcl"' >> site.tmp
110 @echo 'set llvmtoolsdir "$(ToolDir)"' >>site.tmp
111 @echo 'set llvmlibsdir "$(LibDir)"' >>site.tmp
112 @echo 'set srcroot "$(LLVM_SRC_ROOT)"' >>site.tmp
113 @echo 'set objroot "$(LLVM_OBJ_ROOT)"' >>site.tmp
114 @echo 'set srcdir "$(LLVM_SRC_ROOT)/test"' >>site.tmp
115 @echo 'set objdir "$(LLVM_OBJ_ROOT)/test"' >>site.tmp
116 @echo 'set gccpath "$(CC)"' >>site.tmp
117 @echo 'set gxxpath "$(CXX)"' >>site.tmp
118 @echo 'set compile_c "' $(CC) $(CPP.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c '"' >>site.tmp
119 @echo 'set compile_cxx "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) -c '"' >> site.tmp
120 @echo 'set link "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) '"' >>site.tmp
121 @echo 'set llvmgcc "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp
122 @echo 'set llvmgxx "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp
123 @echo 'set llvmgccmajvers "$(LLVMGCC_MAJVERS)"' >> site.tmp
124 @echo 'set bugpoint_topts $(BUGPOINT_TOPTS)' >> site.tmp
125 @echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp
126 @echo 'set ocamlc "$(OCAMLC) -cc $(CXX) -I $(LibDir)/ocaml"' >> site.tmp
127 @echo 'set valgrind "$(VALGRIND)"' >> site.tmp
128 @echo 'set grep "$(GREP)"' >>site.tmp
129 @echo 'set gas "$(GAS)"' >>site.tmp
130 @echo 'set llvmdsymutil "$(DSYMUTIL)"' >>site.tmp
131 @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp
132 @test ! -f site.exp || \
133 sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
135 @test ! -f site.exp || mv site.exp site.bak
136 @mv site.tmp site.exp