be621518f2ab80acabb31edb59f1e936a74df35d
[oota-llvm.git] / test / Makefile
1 LEVEL  = ..
2 DIRS   = 
3
4 #
5 # Make QMTest the default for testing features and regressions
6 # Do this first to force QMTest to run first
7 #
8 all:: qmtest
9
10 #
11 # Include other test rules
12 #
13 include Makefile.tests
14
15 #
16 # New QMTest functionality:
17 #       The test suite is being transitioned over to QMTest.  Eventually, it
18 #       will use QMTest by default.
19 #
20
21 # QMTest option specifying the location of the QMTest database.
22 QMDB= -D $(LLVM_SRC_ROOT)/test
23 QMCLASSES=$(LLVM_OBJ_ROOT)/test/QMTest
24
25 #
26 # Determine which expectations file we will use
27 #
28 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.unknown.qmr
29 ifeq ($(OS),Linux)
30 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.linux.qmr
31 endif
32
33 ifeq ($(OS),SunOS)
34 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.sunos.qmr
35 endif
36
37 ifeq ($(OS),Darwin)
38 QMEXPECT:=$(LLVM_SRC_ROOT)/test/QMTest/expectations.darwin.qmr
39 endif
40
41 #
42 # This is configuration information used by the test suite.  In QM Test, it's
43 # called a 'context.'
44 #
45 CONTEXT= -c "srcroot=$(LLVM_SRC_ROOT)" \
46          -c "buildroot=$(LLVM_OBJ_ROOT)" \
47          -c "buildtype=$(BuildMode)" \
48          -c "tmpdir=$(LLVM_OBJ_ROOT)/test/tmp" \
49          -c "coresize=0" \
50          -c "cc=$(CC)" \
51          -c "cxx=$(CXX)" \
52          -c "llvmgcc=$(LLVMGCC)" \
53          -c "llvmgxx=$(LLVMGXX)" \
54          -c "make=$(MAKE)" \
55          -c "python=$(PYTHON)"
56
57 #
58 # Location of the QMTest program.
59 #
60 QMTEST= QMTEST_CLASS_PATH=$(QMCLASSES) qmtest $(QMDB)
61
62
63 #
64 # Execute the tests
65 #
66 qmtest:: $(LLVM_OBJ_ROOT)/test/tmp register
67         -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT)
68
69 %.t:: $(LLVM_OBJ_ROOT)/test/tmp register
70         -$(QMTEST) run -O $(QMEXPECT) $(CONTEXT) $*
71
72 #
73 # Create the temporary directory used by the test suite.
74 #
75 $(LLVM_OBJ_ROOT)/test/tmp::
76         ${MKDIR} $(LLVM_OBJ_ROOT)/test/tmp
77
78 #
79 # Right now, QMTest compiles the python test classes and put them into the
80 # source tree.  Since Python bytecode is *not* cross-platform compatible (I
81 # think), we'll regenerate every time.
82 #
83 # Simultaneous builds won't work, but shared source trees will.
84 #
85 register:
86         $(QMTEST) register test llvm.TestAsmDisasm
87         $(QMTEST) register test llvm.AssembleTest
88         $(QMTEST) register test llvm.ConvertToCTest
89         $(QMTEST) register test llvm.LLToCTest
90         $(QMTEST) register test llvm.MachineCodeTest
91         $(QMTEST) register test llvm.TestOptimizer
92         $(QMTEST) register test llvm.LLITest
93         $(QMTEST) register test llvm.TestRunner
94         $(QMTEST) register test llvm.VerifierTest
95         $(QMTEST) register test llvm.CTest
96         $(QMTEST) register test llvm.CXXTest
97         $(QMTEST) register database llvmdb.llvmdb
98
99 # Start up the QMTest GUI
100 gui::
101         $(QMTEST) gui --no-browser --daemon
102
103 # Also get rid of qmtest garbage when we 'make clean' in this directory.
104 clean:: qmtest-clean
105
106 qmtest-clean:
107         $(RM) -rf $(LLVM_OBJ_ROOT)/test/tmp
108         $(RM) -f $(LLVM_SRC_ROOT)/test/QMTest/*.pyo \
109                 $(LLVM_OBJ_ROOT)/test/QMTest/*.pyo
110         $(RM) -f $(LLVM_SRC_ROOT)/test/results.qmr \
111                 $(LLVM_OBJ_ROOT)/test/results.qmr
112
113 EXPECT = expect
114 RUNTEST = runtest
115
116 check-dejagnu: site.exp
117         $(RUNTEST)
118
119 dejagnu-clean:
120         cd $(LLVM_OBJ_ROOT)/test/
121         $(RM) -rf Regression/*/Output
122         $(RM) -rf Regression/*/*/Output
123
124 site.exp: Makefile $(LLVM_OBJ_ROOT)/Makefile.config
125         @echo 'Making a new site.exp file...'
126         @echo '## these variables are automatically generated by make ##' >site.tmp
127         @echo '# Do not edit here.  If you wish to override these values' >>site.tmp
128         @echo '# edit the last section' >>site.tmp
129         @echo "set target_triplet i686-pc-linux-gnu" >> site.tmp
130         @echo 'set prcontext $(LLVM_SRC_ROOT)/test/Scripts/prcontext.py' >> site.tmp
131         @echo 'set srcdir $(LLVM_SRC_ROOT)/test' >>site.tmp
132         @echo "set objdir $(LLVM_OBJ_ROOT)/test" >>site.tmp
133         @echo 'set llvmgcc $(LLVMGCCDIR)/bin/gcc' >> site.tmp
134         @echo 'set llvmgxx $(LLVMGCCDIR)/bin/g++' >> site.tmp
135         @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp
136         @test ! -f site.exp || \
137         sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
138         @-rm -f site.bak
139         @test ! -f site.exp || mv site.exp site.bak
140         @mv site.tmp site.exp