blob: 7642b64aea5f0d2b682263949ce95ef00d4fe873 [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#
17all:: qmtest
18
John Criswelld184c672003-10-27 17:46:42 +000019# Include other test rules
John Criswelld184c672003-10-27 17:46:42 +000020include Makefile.tests
21
John Criswell299e15e2003-08-21 15:09:29 +000022# New QMTest functionality:
23# The test suite is being transitioned over to QMTest. Eventually, it
24# will use QMTest by default.
John Criswell299e15e2003-08-21 15:09:29 +000025
John Criswell299e15e2003-08-21 15:09:29 +000026# QMTest option specifying the location of the QMTest database.
John Criswellf424d742003-10-07 21:13:47 +000027QMDB= -D $(LLVM_SRC_ROOT)/test
28QMCLASSES=$(LLVM_OBJ_ROOT)/test/QMTest
John Criswell299e15e2003-08-21 15:09:29 +000029
30#
John Criswell236c4d42003-11-19 21:13:25 +000031# Determine which expectations file we will use
32#
33QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.unknown.qmr
34ifeq ($(OS),Linux)
35QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.linux.qmr
36endif
37
38ifeq ($(OS),SunOS)
39QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.sunos.qmr
40endif
41
John Criswelld1799612004-03-29 20:23:11 +000042ifeq ($(OS),Darwin)
43QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.darwin.qmr
44endif
45
John Criswell236c4d42003-11-19 21:13:25 +000046#
John Criswell299e15e2003-08-21 15:09:29 +000047# This is configuration information used by the test suite. In QM Test, it's
48# called a 'context.'
49#
Brian Gaekeab9585f2003-10-11 00:10:05 +000050CONTEXT= -c "srcroot=$(LLVM_SRC_ROOT)" \
51 -c "buildroot=$(LLVM_OBJ_ROOT)" \
Brian Gaeke64aeb002004-11-03 17:11:23 +000052 -c "buildtype=$(BuildMode)" \
Brian Gaekeab9585f2003-10-11 00:10:05 +000053 -c "tmpdir=$(LLVM_OBJ_ROOT)/test/tmp" \
54 -c "coresize=0" \
55 -c "cc=$(CC)" \
56 -c "cxx=$(CXX)" \
John Criswellee29d2a2003-09-06 15:12:21 +000057 -c "llvmgcc=$(LLVMGCC)" \
John Criswell28e77672003-09-30 19:04:08 +000058 -c "llvmgxx=$(LLVMGXX)" \
John Criswell955a7422004-08-02 22:29:38 +000059 -c "make=$(MAKE)" \
60 -c "python=$(PYTHON)"
John Criswell299e15e2003-08-21 15:09:29 +000061
62#
63# Location of the QMTest program.
64#
John Criswell1ce5c592003-09-16 02:59:26 +000065QMTEST= QMTEST_CLASS_PATH=$(QMCLASSES) qmtest $(QMDB)
John Criswell299e15e2003-08-21 15:09:29 +000066
67
68#
69# Execute the tests
70#
71qmtest:: $(LLVM_OBJ_ROOT)/test/tmp register
John Criswell236c4d42003-11-19 21:13:25 +000072 -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT)
John Criswell299e15e2003-08-21 15:09:29 +000073
John Criswellf780f772003-09-08 21:25:35 +000074%.t:: $(LLVM_OBJ_ROOT)/test/tmp register
John Criswell236c4d42003-11-19 21:13:25 +000075 -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT) $*
John Criswell299e15e2003-08-21 15:09:29 +000076
77#
78# Create the temporary directory used by the test suite.
79#
80$(LLVM_OBJ_ROOT)/test/tmp::
81 ${MKDIR} $(LLVM_OBJ_ROOT)/test/tmp
82
83#
John Criswell538a3172003-09-15 21:54:49 +000084# Right now, QMTest compiles the python test classes and put them into the
85# source tree. Since Python bytecode is *not* cross-platform compatible (I
86# think), we'll regenerate every time.
John Criswell299e15e2003-08-21 15:09:29 +000087#
John Criswell538a3172003-09-15 21:54:49 +000088# Simultaneous builds won't work, but shared source trees will.
89#
90register:
John Criswell299e15e2003-08-21 15:09:29 +000091 $(QMTEST) register test llvm.TestAsmDisasm
92 $(QMTEST) register test llvm.AssembleTest
93 $(QMTEST) register test llvm.ConvertToCTest
94 $(QMTEST) register test llvm.LLToCTest
95 $(QMTEST) register test llvm.MachineCodeTest
John Criswell299e15e2003-08-21 15:09:29 +000096 $(QMTEST) register test llvm.TestOptimizer
97 $(QMTEST) register test llvm.LLITest
98 $(QMTEST) register test llvm.TestRunner
99 $(QMTEST) register test llvm.VerifierTest
John Criswell299e15e2003-08-21 15:09:29 +0000100 $(QMTEST) register test llvm.CTest
John Criswell28e77672003-09-30 19:04:08 +0000101 $(QMTEST) register test llvm.CXXTest
John Criswell0c9efc22003-10-07 21:30:07 +0000102 $(QMTEST) register database llvmdb.llvmdb
John Criswell299e15e2003-08-21 15:09:29 +0000103
John Criswell1ce5c592003-09-16 02:59:26 +0000104# Start up the QMTest GUI
John Criswell1ce5c592003-09-16 02:59:26 +0000105gui::
106 $(QMTEST) gui --no-browser --daemon
107
Brian Gaekeaa741182003-11-21 01:12:47 +0000108# Also get rid of qmtest garbage when we 'make clean' in this directory.
Brian Gaekef19ae4c2003-12-11 04:48:38 +0000109clean:: qmtest-clean
110
111qmtest-clean:
John Criswell9fd50e22003-10-10 19:52:30 +0000112 $(RM) -rf $(LLVM_OBJ_ROOT)/test/tmp
Brian Gaeke34d25f12003-11-20 19:57:17 +0000113 $(RM) -f $(LLVM_SRC_ROOT)/test/QMTest/*.pyo \
114 $(LLVM_OBJ_ROOT)/test/QMTest/*.pyo
Brian Gaekeaa741182003-11-21 01:12:47 +0000115 $(RM) -f $(LLVM_SRC_ROOT)/test/results.qmr \
116 $(LLVM_OBJ_ROOT)/test/results.qmr
John Criswell9fd50e22003-10-10 19:52:30 +0000117
Chris Lattner12d632c2004-11-07 05:05:37 +0000118#===------------------------------------------------------------------------===#
119# DejaGNU testing support
120#===------------------------------------------------------------------------===#
121
Tanya Lattner7a7cb4c2004-11-07 04:59:52 +0000122EXPECT = expect
123RUNTEST = runtest
124
125check-dejagnu: site.exp
126 $(RUNTEST)
127
128dejagnu-clean:
Chris Lattner12d632c2004-11-07 05:05:37 +0000129 $(RM) -rf `find $(LLVM_OBJ_ROOT)/test/Regression -name Output -type d -print`
Tanya Lattner7a7cb4c2004-11-07 04:59:52 +0000130
131site.exp: Makefile $(LLVM_OBJ_ROOT)/Makefile.config
132 @echo 'Making a new site.exp file...'
133 @echo '## these variables are automatically generated by make ##' >site.tmp
134 @echo '# Do not edit here. If you wish to override these values' >>site.tmp
135 @echo '# edit the last section' >>site.tmp
136 @echo "set target_triplet i686-pc-linux-gnu" >> site.tmp
137 @echo 'set prcontext $(LLVM_SRC_ROOT)/test/Scripts/prcontext.py' >> site.tmp
138 @echo 'set srcdir $(LLVM_SRC_ROOT)/test' >>site.tmp
139 @echo "set objdir $(LLVM_OBJ_ROOT)/test" >>site.tmp
140 @echo 'set llvmgcc $(LLVMGCCDIR)/bin/gcc' >> site.tmp
141 @echo 'set llvmgxx $(LLVMGCCDIR)/bin/g++' >> site.tmp
142 @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp
143 @test ! -f site.exp || \
144 sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
145 @-rm -f site.bak
146 @test ! -f site.exp || mv site.exp site.bak
147 @mv site.tmp site.exp
Chris Lattner12d632c2004-11-07 05:05:37 +0000148