blob: ae7fea19507779261d0583d95e71d48e456c43a2 [file] [log] [blame]
Chris Lattner12d632c2004-11-07 05:05:37 +00001#===- test/Makefile ----------------------------------------*- Makefile -*--===#
2#
3# The LLVM Compiler Infrastructure
4#
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.
7#
8#===------------------------------------------------------------------------===#
9
Vikram S. Adve38b86202001-11-05 00:22:16 +000010LEVEL = ..
Reid Spencereb32ffe2004-09-05 08:18:23 +000011DIRS =
Chris Lattner52a4e852002-01-23 21:36:59 +000012
John Criswell299e15e2003-08-21 15:09:29 +000013#
John Criswellee29d2a2003-09-06 15:12:21 +000014# Make QMTest the default for testing features and regressions
John Criswelld184c672003-10-27 17:46:42 +000015# Do this first to force QMTest to run first
John Criswellee29d2a2003-09-06 15:12:21 +000016#
Chris Lattner5b0a4ff2004-11-30 17:45:08 +000017ifdef TESTSUITE
18all:: check-dejagnu
19else
John Criswellee29d2a2003-09-06 15:12:21 +000020all:: qmtest
Chris Lattner5b0a4ff2004-11-30 17:45:08 +000021endif
John Criswellee29d2a2003-09-06 15:12:21 +000022
John Criswelld184c672003-10-27 17:46:42 +000023# Include other test rules
John Criswelld184c672003-10-27 17:46:42 +000024include Makefile.tests
25
John Criswell299e15e2003-08-21 15:09:29 +000026# New QMTest functionality:
27# The test suite is being transitioned over to QMTest. Eventually, it
28# will use QMTest by default.
John Criswell299e15e2003-08-21 15:09:29 +000029
John Criswell299e15e2003-08-21 15:09:29 +000030# QMTest option specifying the location of the QMTest database.
John Criswellf424d742003-10-07 21:13:47 +000031QMDB= -D $(LLVM_SRC_ROOT)/test
32QMCLASSES=$(LLVM_OBJ_ROOT)/test/QMTest
John Criswell299e15e2003-08-21 15:09:29 +000033
34#
John Criswell236c4d42003-11-19 21:13:25 +000035# Determine which expectations file we will use
36#
37QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.unknown.qmr
38ifeq ($(OS),Linux)
39QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.linux.qmr
40endif
41
42ifeq ($(OS),SunOS)
43QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.sunos.qmr
44endif
45
John Criswelld1799612004-03-29 20:23:11 +000046ifeq ($(OS),Darwin)
47QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.darwin.qmr
48endif
49
John Criswell236c4d42003-11-19 21:13:25 +000050#
John Criswell299e15e2003-08-21 15:09:29 +000051# This is configuration information used by the test suite. In QM Test, it's
52# called a 'context.'
53#
Brian Gaekeab9585f2003-10-11 00:10:05 +000054CONTEXT= -c "srcroot=$(LLVM_SRC_ROOT)" \
55 -c "buildroot=$(LLVM_OBJ_ROOT)" \
Brian Gaeke64aeb002004-11-03 17:11:23 +000056 -c "buildtype=$(BuildMode)" \
Brian Gaekeab9585f2003-10-11 00:10:05 +000057 -c "tmpdir=$(LLVM_OBJ_ROOT)/test/tmp" \
58 -c "coresize=0" \
59 -c "cc=$(CC)" \
60 -c "cxx=$(CXX)" \
John Criswellee29d2a2003-09-06 15:12:21 +000061 -c "llvmgcc=$(LLVMGCC)" \
John Criswell28e77672003-09-30 19:04:08 +000062 -c "llvmgxx=$(LLVMGXX)" \
John Criswell955a7422004-08-02 22:29:38 +000063 -c "make=$(MAKE)" \
64 -c "python=$(PYTHON)"
John Criswell299e15e2003-08-21 15:09:29 +000065
66#
67# Location of the QMTest program.
68#
John Criswell1ce5c592003-09-16 02:59:26 +000069QMTEST= QMTEST_CLASS_PATH=$(QMCLASSES) qmtest $(QMDB)
John Criswell299e15e2003-08-21 15:09:29 +000070
71
72#
73# Execute the tests
74#
75qmtest:: $(LLVM_OBJ_ROOT)/test/tmp register
John Criswell236c4d42003-11-19 21:13:25 +000076 -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT)
John Criswell299e15e2003-08-21 15:09:29 +000077
John Criswellf780f772003-09-08 21:25:35 +000078%.t:: $(LLVM_OBJ_ROOT)/test/tmp register
John Criswell236c4d42003-11-19 21:13:25 +000079 -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT) $*
John Criswell299e15e2003-08-21 15:09:29 +000080
81#
82# Create the temporary directory used by the test suite.
83#
84$(LLVM_OBJ_ROOT)/test/tmp::
85 ${MKDIR} $(LLVM_OBJ_ROOT)/test/tmp
86
87#
John Criswell538a3172003-09-15 21:54:49 +000088# 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.
John Criswell299e15e2003-08-21 15:09:29 +000091#
John Criswell538a3172003-09-15 21:54:49 +000092# Simultaneous builds won't work, but shared source trees will.
93#
94register:
John Criswell299e15e2003-08-21 15:09:29 +000095 $(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
John Criswell299e15e2003-08-21 15:09:29 +0000100 $(QMTEST) register test llvm.TestOptimizer
101 $(QMTEST) register test llvm.LLITest
102 $(QMTEST) register test llvm.TestRunner
103 $(QMTEST) register test llvm.VerifierTest
John Criswell299e15e2003-08-21 15:09:29 +0000104 $(QMTEST) register test llvm.CTest
John Criswell28e77672003-09-30 19:04:08 +0000105 $(QMTEST) register test llvm.CXXTest
John Criswell0c9efc22003-10-07 21:30:07 +0000106 $(QMTEST) register database llvmdb.llvmdb
John Criswell299e15e2003-08-21 15:09:29 +0000107
John Criswell1ce5c592003-09-16 02:59:26 +0000108# Start up the QMTest GUI
John Criswell1ce5c592003-09-16 02:59:26 +0000109gui::
110 $(QMTEST) gui --no-browser --daemon
111
Brian Gaekeaa741182003-11-21 01:12:47 +0000112# Also get rid of qmtest garbage when we 'make clean' in this directory.
Brian Gaekef19ae4c2003-12-11 04:48:38 +0000113clean:: qmtest-clean
114
115qmtest-clean:
John Criswell9fd50e22003-10-10 19:52:30 +0000116 $(RM) -rf $(LLVM_OBJ_ROOT)/test/tmp
Brian Gaeke34d25f12003-11-20 19:57:17 +0000117 $(RM) -f $(LLVM_SRC_ROOT)/test/QMTest/*.pyo \
118 $(LLVM_OBJ_ROOT)/test/QMTest/*.pyo
Brian Gaekeaa741182003-11-21 01:12:47 +0000119 $(RM) -f $(LLVM_SRC_ROOT)/test/results.qmr \
120 $(LLVM_OBJ_ROOT)/test/results.qmr
John Criswell9fd50e22003-10-10 19:52:30 +0000121
Chris Lattner12d632c2004-11-07 05:05:37 +0000122#===------------------------------------------------------------------------===#
123# DejaGNU testing support
124#===------------------------------------------------------------------------===#
125
Tanya Lattner491e9cd2004-11-07 21:39:41 +0000126ifdef TESTSUITE
Tanya Lattnerd09fbdc2004-11-07 23:26:13 +0000127RUNTESTFLAGS := --tool $(TESTSUITE)
Tanya Lattner491e9cd2004-11-07 21:39:41 +0000128endif
129
Tanya Lattner7a7cb4c2004-11-07 04:59:52 +0000130check-dejagnu: site.exp
Chris Lattnerbaf790e2004-11-22 19:06:22 +0000131 -PATH=$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH) \
Alkis Evlogimenos440add22004-11-08 05:44:05 +0000132 $(RUNTEST) $(RUNTESTFLAGS)
Tanya Lattner491e9cd2004-11-07 21:39:41 +0000133
Tanya Lattner7a7cb4c2004-11-07 04:59:52 +0000134
135dejagnu-clean:
Chris Lattner12d632c2004-11-07 05:05:37 +0000136 $(RM) -rf `find $(LLVM_OBJ_ROOT)/test/Regression -name Output -type d -print`
Tanya Lattner7a7cb4c2004-11-07 04:59:52 +0000137
138site.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
Tanya Lattner491e9cd2004-11-07 21:39:41 +0000143 @echo "set target_triplet $(TARGET_TRIPLE)" >> site.tmp
Tanya Lattner78887f42004-11-30 19:13:06 +0000144 @echo 'set prcontext "$(TCLSH) $(LLVM_SRC_ROOT)/test/Scripts/prcontext.tcl"' >> site.tmp
Tanya Lattner7a7cb4c2004-11-07 04:59:52 +0000145 @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
152 @-rm -f site.bak
153 @test ! -f site.exp || mv site.exp site.bak
154 @mv site.tmp site.exp
Chris Lattner12d632c2004-11-07 05:05:37 +0000155
Reid Spencer8db573e12004-11-09 06:32:58 +0000156#===------------------------------------------------------------------------===#
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#===------------------------------------------------------------------------===#
Reid Spencered8c0892004-11-09 06:28:32 +0000162quick-test:
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 {} \; ; \
166 else \
167 echo "Set QUICKTEST=<some directory with TestRunner.sh .ll files in it" ; \
168 fi