-#
-# Right now, QMTest compiles the python test classes and put them into the
-# source tree. Since Python bytecode is *not* cross-platform compatible (I
-# think), we'll regenerate every time.
-#
-# Simultaneous builds won't work, but shared source trees will.
-#
-register:
- $(QMTEST) register test llvm.TestAsmDisasm
- $(QMTEST) register test llvm.AssembleTest
- $(QMTEST) register test llvm.ConvertToCTest
- $(QMTEST) register test llvm.LLToCTest
- $(QMTEST) register test llvm.MachineCodeTest
- $(QMTEST) register test llvm.TestOptimizer
- $(QMTEST) register test llvm.LLITest
- $(QMTEST) register test llvm.TestRunner
- $(QMTEST) register test llvm.VerifierTest
- $(QMTEST) register test llvm.CTest
- $(QMTEST) register test llvm.CXXTest
- $(QMTEST) register database llvmdb.llvmdb
-
-# Start up the QMTest GUI
-gui::
- $(QMTEST) gui --no-browser --daemon
-
-# Also get rid of qmtest garbage when we 'make clean' in this directory.
-clean:: qmtest-clean
-
-qmtest-clean:
- $(RM) -rf $(LLVM_OBJ_ROOT)/test/tmp
- $(RM) -f $(LLVM_SRC_ROOT)/test/QMTest/*.pyo \
- $(LLVM_OBJ_ROOT)/test/QMTest/*.pyo
- $(RM) -f $(LLVM_SRC_ROOT)/test/results.qmr \
- $(LLVM_OBJ_ROOT)/test/results.qmr
-
-EXPECT = expect
-RUNTEST = runtest
-
-check-dejagnu: site.exp
- $(RUNTEST)
-
-dejagnu-clean:
- cd $(LLVM_OBJ_ROOT)/test/
- $(RM) -rf Regression/*/Output
- $(RM) -rf Regression/*/*/Output
-
-site.exp: Makefile $(LLVM_OBJ_ROOT)/Makefile.config
+ifdef IGNORE_TESTS
+RUNTESTFLAGS += --ignore "$(strip $(IGNORE_TESTS))"
+endif
+
+# ulimits like these are redundantly enforced by the buildbots, so
+# just removing them here won't work.
+# Both AuroraUX & Solaris do not have the -m flag for ulimit
+ifeq ($(HOST_OS),SunOS)
+ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -v 512000 ;
+else # !SunOS
+ifeq ($(HOST_OS),AuroraUX)
+ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -v 512000 ;
+else # !AuroraUX
+# Fedora 13 x86-64 python fails with -v 76800
+ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 1024000 ;
+endif # AuroraUX
+endif # SunOS
+
+ifneq ($(RUNTEST),)
+check-local-dg:: site.exp
+ ( $(ULIMIT) \
+ PATH="$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(LLVMGCCDIR)/bin:$(PATH)" \
+ $(RUNTEST) $(RUNTESTFLAGS) )
+else
+check-local-dg:: site.exp
+ @echo "*** dejagnu not found. Make sure 'runtest' is in your PATH, then reconfigure LLVM."
+endif
+
+check-local-lit:: lit.site.cfg Unit/lit.site.cfg
+ ( $(ULIMIT) \
+ $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) )
+
+check-local-all:: lit.site.cfg Unit/lit.site.cfg extra-lit-site-cfgs
+ ( $(ULIMIT) \
+ $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) )
+
+clean::
+ $(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print`
+
+# dsymutil is used on the Darwin to manipulate DWARF debugging information.
+ifeq ($(TARGET_OS),Darwin)
+DSYMUTIL=dsymutil
+else
+DSYMUTIL=true
+endif
+ifdef TargetCommonOpts
+BUGPOINT_TOPTS="-gcc-tool-args $(TargetCommonOpts)"
+else
+BUGPOINT_TOPTS=""
+endif
+
+ifneq ($(OCAMLOPT),)
+CC_FOR_OCAMLOPT := $(shell $(OCAMLOPT) -config | grep native_c_compiler | sed -e 's/native_c_compiler: //')
+CXX_FOR_OCAMLOPT := $(subst gcc,g++,$(CC_FOR_OCAMLOPT))
+endif
+
+FORCE:
+
+site.exp: FORCE