Teach LIT2 how to run Clang tests in the objdir for srcdir != objdir builds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81472 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Makefile b/test/Makefile
index 12d713b..1a10975 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -8,6 +8,9 @@
TESTDIRS ?= $(PROJ_SRC_DIR)
endif
+# LIT2 wants objdir paths, so it will pick up the lit.site.cfg.
+LIT2_TESTDIRS := $(TESTDIRS:$(PROJ_SRC_DIR)%=$(PROJ_OBJ_DIR)%)
+
ifndef TESTARGS
ifdef VERBOSE
TESTARGS = -v
@@ -23,12 +26,12 @@
endif
ifdef LIT2
-all::
+all:: lit.site.cfg
@ echo '--- Running clang tests for $(TARGET_TRIPLE) ---'
@ $(LLVM_SRC_ROOT)/utils/lit/lit.py \
--path $(ToolDir) \
--path $(LLVM_SRC_ROOT)/test/Scripts \
- $(TESTARGS) $(TESTDIRS) $(VGARG)
+ $(TESTARGS) $(LIT2_TESTDIRS) $(VGARG)
else
all::
@ echo '--- Running clang tests for $(TARGET_TRIPLE) ---'
@@ -39,6 +42,19 @@
$(TESTARGS) $(TESTDIRS) $(VGARG)
endif
+FORCE:
+
+lit.site.cfg: FORCE
+ @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.clang_obj_root = \"\"\"$(PROJ_OBJ_DIR)/..\"\"\"" >> $@
+ @echo >> $@
+ @echo "# Let the main config do the real work." >> $@
+ @echo "lit.load_config(config, \"\"\"$(PROJ_SRC_DIR)/lit.cfg\"\"\")" >> $@
+
clean::
@ rm -rf Output/