1 #===- test/Makefile ----------------------------------------*- Makefile -*--===#
3 # The LLVM Compiler Infrastructure
5 # This file was developed by the LLVM research group and is distributed under
6 # the University of Illinois Open Source License. See LICENSE.TXT for details.
8 #===------------------------------------------------------------------------===#
14 # Make QMTest the default for testing features and regressions
15 # Do this first to force QMTest to run first
23 # Include other test rules
24 include Makefile.tests
26 # New QMTest functionality:
27 # The test suite is being transitioned over to QMTest. Eventually, it
28 # will use QMTest by default.
30 # QMTest option specifying the location of the QMTest database.
31 QMDB= -D $(LLVM_SRC_ROOT)/test
32 QMCLASSES=$(LLVM_OBJ_ROOT)/test/QMTest
35 # Determine which expectations file we will use
37 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.unknown.qmr
39 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.linux.qmr
43 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.sunos.qmr
47 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.darwin.qmr
51 # This is configuration information used by the test suite. In QM Test, it's
54 CONTEXT= -c "srcroot=$(LLVM_SRC_ROOT)" \
55 -c "buildroot=$(LLVM_OBJ_ROOT)" \
56 -c "buildtype=$(BuildMode)" \
57 -c "tmpdir=$(LLVM_OBJ_ROOT)/test/tmp" \
61 -c "llvmgcc=$(LLVMGCC)" \
62 -c "llvmgxx=$(LLVMGXX)" \
67 # Location of the QMTest program.
69 QMTEST= QMTEST_CLASS_PATH=$(QMCLASSES) qmtest $(QMDB)
75 qmtest:: $(LLVM_OBJ_ROOT)/test/tmp register
76 -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT)
78 %.t:: $(LLVM_OBJ_ROOT)/test/tmp register
79 -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT) $*
82 # Create the temporary directory used by the test suite.
84 $(LLVM_OBJ_ROOT)/test/tmp::
85 ${MKDIR} $(LLVM_OBJ_ROOT)/test/tmp
88 # Right now, QMTest compiles the python test classes and put them into the
89 # source tree. Since Python bytecode is *not* cross-platform compatible (I
90 # think), we'll regenerate every time.
92 # Simultaneous builds won't work, but shared source trees will.
95 $(QMTEST) register test llvm.TestAsmDisasm
96 $(QMTEST) register test llvm.AssembleTest
97 $(QMTEST) register test llvm.ConvertToCTest
98 $(QMTEST) register test llvm.LLToCTest
99 $(QMTEST) register test llvm.MachineCodeTest
100 $(QMTEST) register test llvm.TestOptimizer
101 $(QMTEST) register test llvm.LLITest
102 $(QMTEST) register test llvm.TestRunner
103 $(QMTEST) register test llvm.VerifierTest
104 $(QMTEST) register test llvm.CTest
105 $(QMTEST) register test llvm.CXXTest
106 $(QMTEST) register database llvmdb.llvmdb
108 # Start up the QMTest GUI
110 $(QMTEST) gui --no-browser --daemon
112 # Also get rid of qmtest garbage when we 'make clean' in this directory.
116 $(RM) -rf $(LLVM_OBJ_ROOT)/test/tmp
117 $(RM) -f $(LLVM_SRC_ROOT)/test/QMTest/*.pyo \
118 $(LLVM_OBJ_ROOT)/test/QMTest/*.pyo
119 $(RM) -f $(LLVM_SRC_ROOT)/test/results.qmr \
120 $(LLVM_OBJ_ROOT)/test/results.qmr
122 #===------------------------------------------------------------------------===#
123 # DejaGNU testing support
124 #===------------------------------------------------------------------------===#
127 RUNTESTFLAGS := --tool $(TESTSUITE)
130 check-dejagnu: site.exp
131 -PATH=$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH) \
132 $(RUNTEST) $(RUNTESTFLAGS)
136 $(RM) -rf `find $(LLVM_OBJ_ROOT)/test/Regression -name Output -type d -print`
138 site.exp: Makefile $(LLVM_OBJ_ROOT)/Makefile.config
139 @echo 'Making a new site.exp file...'
140 @echo '## these variables are automatically generated by make ##' >site.tmp
141 @echo '# Do not edit here. If you wish to override these values' >>site.tmp
142 @echo '# edit the last section' >>site.tmp
143 @echo "set target_triplet $(TARGET_TRIPLE)" >> site.tmp
144 @echo 'set prcontext "$(TCLSH) $(LLVM_SRC_ROOT)/test/Scripts/prcontext.tcl"' >> site.tmp
145 @echo 'set srcdir $(LLVM_SRC_ROOT)/test' >>site.tmp
146 @echo "set objdir $(LLVM_OBJ_ROOT)/test" >>site.tmp
147 @echo 'set llvmgcc $(LLVMGCCDIR)/bin/gcc' >> site.tmp
148 @echo 'set llvmgxx $(LLVMGCCDIR)/bin/g++' >> site.tmp
149 @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp
150 @test ! -f site.exp || \
151 sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
153 @test ! -f site.exp || mv site.exp site.bak
154 @mv site.tmp site.exp
156 #===------------------------------------------------------------------------===#
157 # quick-test utility. Just runs TestRunner.sh on all the *.ll files in a
158 # directory. Use like this:
159 # cd llvm/test ; make quick-test QUICKTEST=Regression/Bytecode
160 # where QUICKTEST specifies the directory you want to run the tests on.
161 #===------------------------------------------------------------------------===#
163 @if test -d "${QUICKTEST}" ; then \
164 cd $(LLVM_SRC_ROOT)/test/$(QUICKTEST) ; \
165 find . -name \*.ll -print -exec $(LLVM_SRC_ROOT)/test/TestRunner.sh {} \; ; \
167 echo "Set QUICKTEST=<some directory with TestRunner.sh .ll files in it" ; \