4ab3df8c6a8552f17756c90c95a3fe4f0f7afc4a
[oota-llvm.git] / test / Makefile
1 #===- 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
10 LEVEL  = ..
11 DIRS   = 
12
13 #
14 # Make QMTest the default for testing features and regressions
15 # Do this first to force QMTest to run first
16 #
17 all:: qmtest
18
19 # Include other test rules
20 include Makefile.tests
21
22 # New QMTest functionality:
23 #       The test suite is being transitioned over to QMTest.  Eventually, it
24 #       will use QMTest by default.
25
26 # QMTest option specifying the location of the QMTest database.
27 QMDB= -D $(LLVM_SRC_ROOT)/test
28 QMCLASSES=$(LLVM_OBJ_ROOT)/test/QMTest
29
30 #
31 # Determine which expectations file we will use
32 #
33 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.unknown.qmr
34 ifeq ($(OS),Linux)
35 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.linux.qmr
36 endif
37
38 ifeq ($(OS),SunOS)
39 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.sunos.qmr
40 endif
41
42 ifeq ($(OS),Darwin)
43 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.darwin.qmr
44 endif
45
46 #
47 # This is configuration information used by the test suite.  In QM Test, it's
48 # called a 'context.'
49 #
50 CONTEXT= -c "srcroot=$(LLVM_SRC_ROOT)" \
51          -c "buildroot=$(LLVM_OBJ_ROOT)" \
52          -c "buildtype=$(BuildMode)" \
53          -c "tmpdir=$(LLVM_OBJ_ROOT)/test/tmp" \
54          -c "coresize=0" \
55          -c "cc=$(CC)" \
56          -c "cxx=$(CXX)" \
57          -c "llvmgcc=$(LLVMGCC)" \
58          -c "llvmgxx=$(LLVMGXX)" \
59          -c "make=$(MAKE)" \
60          -c "python=$(PYTHON)"
61
62 #
63 # Location of the QMTest program.
64 #
65 QMTEST= QMTEST_CLASS_PATH=$(QMCLASSES) qmtest $(QMDB)
66
67
68 #
69 # Execute the tests
70 #
71 qmtest:: $(LLVM_OBJ_ROOT)/test/tmp register
72         -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT)
73
74 %.t:: $(LLVM_OBJ_ROOT)/test/tmp register
75         -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT) $*
76
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 #
84 # 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.
87 #
88 # Simultaneous builds won't work, but shared source trees will.
89 #
90 register:
91         $(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
96         $(QMTEST) register test llvm.TestOptimizer
97         $(QMTEST) register test llvm.LLITest
98         $(QMTEST) register test llvm.TestRunner
99         $(QMTEST) register test llvm.VerifierTest
100         $(QMTEST) register test llvm.CTest
101         $(QMTEST) register test llvm.CXXTest
102         $(QMTEST) register database llvmdb.llvmdb
103
104 # Start up the QMTest GUI
105 gui::
106         $(QMTEST) gui --no-browser --daemon
107
108 # Also get rid of qmtest garbage when we 'make clean' in this directory.
109 clean:: qmtest-clean
110
111 qmtest-clean:
112         $(RM) -rf $(LLVM_OBJ_ROOT)/test/tmp
113         $(RM) -f $(LLVM_SRC_ROOT)/test/QMTest/*.pyo \
114                 $(LLVM_OBJ_ROOT)/test/QMTest/*.pyo
115         $(RM) -f $(LLVM_SRC_ROOT)/test/results.qmr \
116                 $(LLVM_OBJ_ROOT)/test/results.qmr
117
118 #===------------------------------------------------------------------------===#
119 # DejaGNU testing support
120 #===------------------------------------------------------------------------===#
121
122 ifdef TESTSUITE
123 RUNTESTFLAGS := --tool $(TESTSUITE)
124 endif
125
126 check-dejagnu: site.exp
127         PATH=$(LLVM_SRC_ROOT)/test/Scripts:$(PATH) $(RUNTEST) $(RUNTESTFLAGS)
128
129
130 dejagnu-clean:
131         $(RM) -rf `find $(LLVM_OBJ_ROOT)/test/Regression -name Output -type d -print`
132
133 site.exp: Makefile $(LLVM_OBJ_ROOT)/Makefile.config
134         @echo 'Making a new site.exp file...'
135         @echo '## these variables are automatically generated by make ##' >site.tmp
136         @echo '# Do not edit here.  If you wish to override these values' >>site.tmp
137         @echo '# edit the last section' >>site.tmp
138         @echo "set target_triplet $(TARGET_TRIPLE)" >> site.tmp
139         @echo 'set prcontext "$(PYTHON) $(LLVM_SRC_ROOT)/test/Scripts/prcontext.py"' >> site.tmp
140         @echo 'set srcdir $(LLVM_SRC_ROOT)/test' >>site.tmp
141         @echo "set objdir $(LLVM_OBJ_ROOT)/test" >>site.tmp
142         @echo 'set llvmgcc $(LLVMGCCDIR)/bin/gcc' >> site.tmp
143         @echo 'set llvmgxx $(LLVMGCCDIR)/bin/g++' >> site.tmp
144         @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp
145         @test ! -f site.exp || \
146         sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
147         @-rm -f site.bak
148         @test ! -f site.exp || mv site.exp site.bak
149         @mv site.tmp site.exp
150