[llvm] r197661 - Introduce clean-ups in llvm/unittests/Makefile.unittest, to sweep stray *Tests.

NAKAMURA Takumi geek4civic at gmail.com
Wed Dec 18 23:09:28 PST 2013


Author: chapuni
Date: Thu Dec 19 01:09:28 2013
New Revision: 197661

URL: http://llvm.org/viewvc/llvm-project?rev=197661&view=rev
Log:
Introduce clean-ups in llvm/unittests/Makefile.unittest, to sweep stray *Tests.

Stray *Tests might stay after reverting.

FIXME: Could we apply this feature to clang/unittests?
FIXME: Implement this feature to CMake.

Modified:
    llvm/trunk/unittests/Makefile
    llvm/trunk/unittests/Makefile.unittest

Modified: llvm/trunk/unittests/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Makefile?rev=197661&r1=197660&r2=197661&view=diff
==============================================================================
--- llvm/trunk/unittests/Makefile (original)
+++ llvm/trunk/unittests/Makefile Thu Dec 19 01:09:28 2013
@@ -12,7 +12,8 @@ LEVEL = ..
 PARALLEL_DIRS = ADT Analysis Bitcode CodeGen DebugInfo \
 		ExecutionEngine IR MC Object Option Support Transforms
 
-include $(LEVEL)/Makefile.common
+include $(LEVEL)/Makefile.config
+include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
 
 clean::
 	$(Verb) $(RM) -f *Tests

Modified: llvm/trunk/unittests/Makefile.unittest
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Makefile.unittest?rev=197661&r1=197660&r2=197661&view=diff
==============================================================================
--- llvm/trunk/unittests/Makefile.unittest (original)
+++ llvm/trunk/unittests/Makefile.unittest Thu Dec 19 01:09:28 2013
@@ -11,13 +11,23 @@
 #
 ##===----------------------------------------------------------------------===##
 
-# Set up variables for building a unit test.
-ifdef TESTNAME
-
 ifndef MAKEFILE_UNITTEST_NO_INCLUDE_COMMON
 include $(LEVEL)/Makefile.common
 endif
 
+# Clean up out-of-tree stray unittests for Lit not to pick one up.
+.PHONY: cleanup-local
+cleanup-local:
+	$(Verb) $(FIND) $(filter-out $(PARALLEL_DIRS), $(wildcard *)) -type f \
+	  -path '*/$(BuildMode)/*Tests$(EXEEXT)' \
+	  -exec rm -f '{}' \;
+
+all:: cleanup-local
+clean:: cleanup-local
+
+# Set up variables for building a unit test.
+ifdef TESTNAME
+
 LLVMUnitTestExe = $(BuildMode)/$(TESTNAME)Tests$(EXEEXT)
 
 # Note that these flags are duplicated when building GoogleTest itself in





More information about the llvm-commits mailing list