[LLVMdev] [PATCH] Parallelized make check

Julien Lerouge jlerouge at apple.com
Tue Feb 24 22:03:26 PST 2009


On Tue, Feb 24, 2009 at 06:24:17PM -0800, Julien Lerouge wrote:
> I haven't tested with objdir != srcdir.

Ok, that was broken. Attached is a smaller diff that should work in all
cases.

Julien

-- 
Julien Lerouge
PGP Key Id: 0xB1964A62
PGP Fingerprint: 392D 4BAD DB8B CE7F 4E5F FA3C 62DB 4AA7 B196 4A62
PGP Public Key from: keyserver.pgp.com
-------------- next part --------------
Index: lib/llvm.exp
===================================================================
--- lib/llvm.exp	(revision 65432)
+++ lib/llvm.exp	(working copy)
@@ -116,8 +116,18 @@
 # This procedure runs the set of tests for the test_source_files array.
 proc RunLLVMTests { test_source_files } {
   global srcroot objroot srcdir objdir subdir target_triplet llvmgcc_version
+  global listtests
   set timeout 60
 
+  if { [ string length "$listtests" ] } {
+    set chan [open $listtests a]
+    foreach test $test_source_files {
+      puts $chan "$test"
+      flush $chan
+    }
+    return
+  }
+
   set path [file join $objdir $subdir]
   
   #Make Output Directory if it does not exist already
Index: Makefile
===================================================================
--- Makefile	(revision 65432)
+++ Makefile	(working copy)
@@ -26,6 +26,8 @@
 RUNTESTFLAGS := $(VERBOSE)
 endif
 
+FORCETGT := FORCE
+
 ifdef TESTSUITE
 CLEANED_TESTSUITE := $(patsubst %/,%,$(TESTSUITE))
 CLEANED_TESTSUITE := $(patsubst test/%,%,$(CLEANED_TESTSUITE))
@@ -63,6 +65,7 @@
 CLEANED_TESTONE := $(patsubst test/%,%,$(CLEANED_TESTONE))
 SUBDIR := $(shell dirname $(CLEANED_TESTONE))
 TESTPATH := $(LLVM_SRC_ROOT)/test/$(CLEANED_TESTONE)
+FORCETGT :=
 check-one: site.exp $(TCLSH)
 	$(Verb)( echo "source $(LLVM_OBJ_ROOT)/test/site.exp" ; \
 	  echo "set subdir $(SUBDIR)" ; \
@@ -80,6 +83,7 @@
 
 clean::
 	$(RM) -rf `find $(LLVM_OBJ_ROOT)/test -name Output -type d -print`
+	$(RM) -f Makefile.jcheck $(JTESTLIST) $(JLOG)
 
 # dsymutil is used on the Darwin to manipulate DWARF debugging information.
 ifeq ($(OS),Darwin)
@@ -90,7 +94,7 @@
 
 FORCE:
 
-site.exp: FORCE
+site.exp: $(FORCETGT)
 	@echo 'Making a new site.exp file...'
 	@echo '## these variables are automatically generated by make ##' >site.tmp
 	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
@@ -120,9 +124,58 @@
 	@echo 'set grep "$(GREP)"' >>site.tmp
 	@echo 'set gas "$(GAS)"' >>site.tmp
 	@echo 'set llvmdsymutil "$(DSYMUTIL)"' >>site.tmp
+	@echo 'set listtests "$(LISTTESTS)"' >> site.tmp
 	@echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp
 	@test ! -f site.exp || \
 	sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
 	@-rm -f site.bak
 	@test ! -f site.exp || mv site.exp site.bak
 	@mv site.tmp site.exp
+
+#===------------------------------------------------------------------------===#
+# Parallelized check support
+#===------------------------------------------------------------------------===#
+
+JCHECKS   :=
+JLOG      := jrun.log
+JTESTLIST := testlist.jcheck
+
+Makefile.jcheck:
+	@$(ECHO) "Creating list of tests to run... "
+	@$(RM) -f site.exp $(JTESTLIST)
+	@$(MAKE) check LISTTESTS=$(JTESTLIST) &>/dev/null
+	@$(RM) -f site.exp
+	@$(SED) 's,$(PROJ_SRC_ROOT)/test/*\(.*\),\1.log,' < $(JTESTLIST) \
+          > $(JTESTLIST).tmp
+	@$(MV) -f $(JTESTLIST).tmp $(JTESTLIST)
+	@$(ECHO) "JCHECKS := \\" > $@
+	@$(SED) 's/$$/ \\/' < $(JTESTLIST) >> $@
+	@$(ECHO) >> $@
+	@$(ECHO) "Running test... "
+
+ifeq ($(MAKECMDGOALS), jcheck-local)
+    -include Makefile.jcheck
+endif
+
+$(JCHECKS): site.exp
+	@$(MAKE) check-one TESTONE=$(@:%.log=%) &>$@
+	@cat $@
+
+jcheck-local: $(JCHECKS)
+	@$(RM) -f $(JLOG)
+	@xargs cat < $(JTESTLIST) >> $(JLOG)
+	@$(ECHO) "\n\n\n\n== Results ==" >> $(JLOG)
+	@for R in PASS FAIL XFAIL XPASS; do \
+           M=`$(GREP) "^$$R" $(JLOG) | wc -l | $(SED) 's/[[:space:]]//g'`; \
+           if [ $$M != 0 ]; then \
+             $(ECHO) "$$R: $$M" >> $(JLOG); \
+           fi; \
+         done
+	@tail -n 5 $(JLOG)
+	@xargs $(RM) -f < $(JTESTLIST)
+
+jcheck:
+	@$(RM) -f Makefile.jcheck
+	@$(MAKE) jcheck-local
+	@if [ -n "`$(GREP) "^XPASS" $(JLOG)`" ]; then false; fi
+	@if [ -n "`$(GREP) "^FAIL" $(JLOG)`" ]; then false; fi


More information about the llvm-dev mailing list