Fix a broken test.
[oota-llvm.git] / test / Makefile
index 3f21eaffc732e11ed842143d9fdc8b209cfc3cd7..ede1b443174f69d6f671e5d324247a953cc130d1 100644 (file)
@@ -43,7 +43,26 @@ LIT_TESTSUITE := .
 endif
 
 ifdef VG
-VALGRIND := valgrind --tool=memcheck --quiet --trace-children=yes --error-exitcode=3 --leak-check=full
+VALGRIND := valgrind --tool=memcheck --quiet --trace-children=yes --error-exitcode=3 --leak-check=full $(VALGRIND_EXTRA_ARGS)
+endif
+
+# Check what to run for -all.
+LIT_ALL_TESTSUITES := $(LIT_TESTSUITE)
+
+extra-lit-site-cfgs::
+.PHONY: extra-lit-site-cfgs
+
+ifneq ($(strip $(filter check-local-all,$(MAKECMDGOALS))),)
+ifndef TESTSUITE
+ifeq ($(shell test -d $(PROJ_SRC_DIR)/../tools/clang && echo OK), OK)
+LIT_ALL_TESTSUITES += $(PROJ_OBJ_DIR)/../tools/clang/test
+
+# Force creation of Clang's lit.site.cfg.
+clang-lit-site-cfg: FORCE
+       $(MAKE) -C $(PROJ_OBJ_DIR)/../tools/clang/test lit.site.cfg
+extra-lit-site-cfgs:: clang-lit-site-cfg
+endif
+endif
 endif
 
 IGNORE_TESTS :=
@@ -59,9 +78,13 @@ endif
 # 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
+else # !SunOS
+ifeq ($(HOST_OS),AuroraUX)
+ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -v 512000 ;
+else # !AuroraUX
 ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 512000 ;
-endif
+endif # AuroraUX
+endif # SunOS
 
 ifneq ($(RUNTEST),)
 check-local:: site.exp
@@ -81,6 +104,14 @@ check-local-lit:: lit.site.cfg Unit/lit.site.cfg
                --path "$(LLVMGCCDIR)/bin" \
                $(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 \
+               --path "$(LLVMToolDir)" \
+               --path "$(LLVM_SRC_ROOT)/test/Scripts" \
+               --path "$(LLVMGCCDIR)/bin" \
+               $(LIT_ARGS) $(LIT_ALL_TESTSUITES) )
+
 ifdef TESTONE
 CLEANED_TESTONE := $(patsubst %/,%,$(TESTONE))
 CLEANED_TESTONE := $(patsubst test/%,%,$(CLEANED_TESTONE))
@@ -162,18 +193,15 @@ site.exp: FORCE
        @mv site.tmp site.exp
 
 lit.site.cfg: site.exp
-       @echo "Making 'lit.site.cfg' file..."
-       @echo "## Autogenerated by Makefile ##" > $@
-       @echo "# Do not edit!" >> $@
-       @echo >> $@
-       @echo "# Preserve some key paths for use by main LLVM test suite config." >> $@
-       @echo "config.llvm_obj_root = \"\"\"$(LLVM_OBJ_ROOT)\"\"\"" >> $@
-       @echo >> $@
-       @echo "# Let the main config do the real work." >> $@
-       @echo "lit.load_config(config, \"\"\"$(LLVM_SRC_ROOT)/test/lit.cfg\"\"\")" >> $@
-
-Unit/lit.site.cfg: Unit/.dir FORCE
-       @echo "Making unittest 'lit.site.cfg' file..."
+       @echo "Making LLVM 'lit.site.cfg' file..."
+       @sed -e "s#@LLVM_SOURCE_DIR@#$(LLVM_SRC_ROOT)#g" \
+            -e "s#@LLVM_BINARY_DIR@#$(LLVM_OBJ_ROOT)#g" \
+            -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
+            -e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \
+            $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
+
+Unit/lit.site.cfg: $(PROJ_OBJ_DIR)/Unit/.dir FORCE
+       @echo "Making LLVM unittest 'lit.site.cfg' file..."
        @echo "## Autogenerated by Makefile ##" > $@
        @echo "# Do not edit!" >> $@
        @echo >> $@