cc389b05fdd60a0c11835d62fa3f8eeba0f1da36
[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 Dejagnu the default for testing
15 #
16 all:: check-local
17
18 # Include other test rules
19 include Makefile.tests
20
21 # New QMTest functionality:
22 #       The test suite is being transitioned over to QMTest.  Eventually, it
23 #       will use QMTest by default.
24
25 # QMTest option specifying the location of the QMTest database.
26 QMDB= -D $(LLVM_SRC_ROOT)/test
27 QMCLASSES=$(LLVM_OBJ_ROOT)/test/QMTest
28
29 #
30 # Determine which expectations file we will use
31 #
32 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.unknown.qmr
33 ifeq ($(OS),Linux)
34 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.linux.qmr
35 endif
36
37 ifeq ($(OS),SunOS)
38 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.sunos.qmr
39 endif
40
41 ifeq ($(OS),Darwin)
42 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.darwin.qmr
43 endif
44
45 #
46 # This is configuration information used by the test suite.  In QM Test, it's
47 # called a 'context.'
48 #
49 CONTEXT= -c "srcroot=$(LLVM_SRC_ROOT)" \
50          -c "buildroot=$(LLVM_OBJ_ROOT)" \
51          -c "buildtype=$(BuildMode)" \
52          -c "tmpdir=$(LLVM_OBJ_ROOT)/test/tmp" \
53          -c "coresize=0" \
54          -c "cc=$(CC)" \
55          -c "cxx=$(CXX)" \
56          -c "llvmgcc=$(LLVMGCC)" \
57          -c "llvmgxx=$(LLVMGXX)" \
58          -c "make=$(MAKE)" \
59          -c "python=$(PYTHON)"
60
61 #
62 # Location of the QMTest program.
63 #
64 QMTEST= QMTEST_CLASS_PATH=$(QMCLASSES) qmtest $(QMDB)
65
66
67 #
68 # Execute the tests
69 #
70 qmtest:: $(LLVM_OBJ_ROOT)/test/tmp register
71         -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT)
72
73 %.t:: $(LLVM_OBJ_ROOT)/test/tmp register
74         -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT) $*
75
76 #
77 # Create the temporary directory used by the test suite.
78 #
79 $(LLVM_OBJ_ROOT)/test/tmp::
80         ${MKDIR} $(LLVM_OBJ_ROOT)/test/tmp
81
82 #
83 # Right now, QMTest compiles the python test classes and put them into the
84 # source tree.  Since Python bytecode is *not* cross-platform compatible (I
85 # think), we'll regenerate every time.
86 #
87 # Simultaneous builds won't work, but shared source trees will.
88 #
89 register:
90         $(QMTEST) register test llvm.TestAsmDisasm
91         $(QMTEST) register test llvm.AssembleTest
92         $(QMTEST) register test llvm.ConvertToCTest
93         $(QMTEST) register test llvm.LLToCTest
94         $(QMTEST) register test llvm.MachineCodeTest
95         $(QMTEST) register test llvm.TestOptimizer
96         $(QMTEST) register test llvm.LLITest
97         $(QMTEST) register test llvm.TestRunner
98         $(QMTEST) register test llvm.VerifierTest
99         $(QMTEST) register test llvm.CTest
100         $(QMTEST) register test llvm.CXXTest
101         $(QMTEST) register database llvmdb.llvmdb
102
103 # Start up the QMTest GUI
104 gui::
105         $(QMTEST) gui --no-browser --daemon
106
107 # Also get rid of qmtest garbage when we 'make clean' in this directory.
108 qmtest-clean:
109         $(RM) -rf $(LLVM_OBJ_ROOT)/test/tmp
110         $(RM) -f $(LLVM_SRC_ROOT)/test/QMTest/*.pyo \
111                 $(LLVM_OBJ_ROOT)/test/QMTest/*.pyo
112         $(RM) -f $(LLVM_SRC_ROOT)/test/results.qmr \
113                 $(LLVM_OBJ_ROOT)/test/results.qmr
114
115 #===------------------------------------------------------------------------===#
116 # DejaGNU testing support
117 #===------------------------------------------------------------------------===#
118
119 ifdef TESTSUITE
120 RUNTESTFLAGS := --tool $(TESTSUITE)
121 endif
122
123 check-local:: site.exp
124         PATH=$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH) \
125         $(RUNTEST) $(RUNTESTFLAGS)
126
127 clean::
128         $(RM) -rf `find $(LLVM_OBJ_ROOT)/test/Regression -name Output -type d -print`
129         $(RM) -rf `find $(LLVM_OBJ_ROOT)/test/Feature -name Output -type d -print`
130
131 site.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 $(TARGET_TRIPLE)" >> site.tmp
137         @echo 'set prcontext "$(TCLSH) $(LLVM_SRC_ROOT)/test/Scripts/prcontext.tcl"' >> 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
148