[LLVMdev] [PATCH] Parallelized make check

Julien Lerouge jlerouge at apple.com
Wed Feb 25 16:37:45 PST 2009


On Wed, Feb 25, 2009 at 12:02:18PM -0800, Julien Lerouge wrote:
> For 2), I think the NewNightlyTest.pl script would require some small
> changes, to invoke the jcheck target instead of check, pass the desired
> -j flag, and also parse the log. I'll take a look. In any case, the
> changes would only apply to the DejaGNU tests (llvm-test already works
> fine with -jX).

Here is an updated patch. It adds a -jcheck option to the
NewNightlyTest.pl script to invoke the jcheck target instead of check.

The jcheck targets now creates testrun.{log,sum} that look somewhat like
the original ones. I did a test run with the nightly server, it seems it
parsed the logs I sent correctly:
http://llvm.org/nightlytest/fulltest.php?machine=388&night=9813

Looking at the nightly server sources, it seems only the final report
with the total number of pass/xpass/fail/xfail is needed.

I slightly changed the Makefile so that the site.exp creation is always
done, even when check-one is invoked, like it was before.

Hope this helps,
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: test/lib/llvm.exp
===================================================================
--- test/lib/llvm.exp	(revision 65468)
+++ test/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: test/Makefile
===================================================================
--- test/Makefile	(revision 65468)
+++ test/Makefile	(working copy)
@@ -26,6 +26,9 @@
 RUNTESTFLAGS := $(VERBOSE)
 endif
 
+# Leave the possibility to override on the command line.
+FORCESITEEXP ?= FORCE
+
 ifdef TESTSUITE
 CLEANED_TESTSUITE := $(patsubst %/,%,$(TESTSUITE))
 CLEANED_TESTSUITE := $(patsubst test/%,%,$(CLEANED_TESTSUITE))
@@ -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: $(FORCESITEEXP)
 	@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,64 @@
 	@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      := jtestrun.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 FORCE
+	@$(MAKE) check-one TESTONE=$(@:%.log=%) FORCESITEEXP= &>$@
+	@cat $@
+
+jcheck-local: $(JCHECKS)
+	@$(ECHO) "                === Report ===\n" > $(JLOG)
+	@xargs cat < $(JTESTLIST) >> $(JLOG)
+	@$(ECHO) "\n\n\n\n                === Summary ===\n" >> $(JLOG)
+	@for R in PASS FAIL XFAIL XPASS; do \
+           M=`$(GREP) "^$$R" $(JLOG) | wc -l | $(SED) 's/[[:space:]]//g'`; \
+           if [ $$M != 0 ]; then \
+             $(ECHO) "# of $$R       $$M" | \
+               $(SED) 's/XPASS/unexpected passes  /' | \
+               $(SED) 's/XFAIL/expected failures  /' | \
+               $(SED)  's/PASS/expected passes    /' | \
+               $(SED)  's/FAIL/unexpected failures/' >> $(JLOG); \
+           fi; \
+         done
+	@tail -n 5 $(JLOG)
+	@xargs $(RM) -f < $(JTESTLIST)
+	@$(CP) -f $(JLOG) testrun.log
+	@$(CP) -f $(JLOG) testrun.sum
+
+jcheck:
+	@$(RM) -f Makefile.jcheck
+	@$(MAKE) jcheck-local
+	@if [ -n "`$(GREP) "^XPASS" $(JLOG)`" ]; then false; fi
+	@if [ -n "`$(GREP) "^FAIL" $(JLOG)`" ]; then false; fi
Index: utils/NewNightlyTest.pl
===================================================================
--- utils/NewNightlyTest.pl	(revision 65468)
+++ utils/NewNightlyTest.pl	(working copy)
@@ -27,6 +27,7 @@
 #  -norunningtests  Do not run the Olden benchmark suite with
 #                   LARGE_PROBLEM_SIZE enabled.
 #  -nodejagnu       Do not run feature or regression tests
+#  -jcheck          Use the jcheck target instead of check to run dejagnu tests.
 #  -parallel        Run two parallel jobs with GNU Make.
 #  -release         Build an LLVM Release version
 #  -release-asserts Build an LLVM ReleaseAsserts version
@@ -128,6 +129,7 @@
 $SUBMITSERVER = "llvm.org";
 $SUBMITSCRIPT = "/nightlytest/NightlyTestAccept.php";
 $SUBMIT = 1;
+$DEJACHECK = "check";
 
 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
   shift;
@@ -189,6 +191,7 @@
                              " --with-extra-options=\'$ARGV[0]\'"; shift; next;}
   if (/^-noexternals$/)    { $NOEXTERNALS = 1; next; }
   if (/^-nodejagnu$/)      { $NODEJAGNU = 1; next; }
+  if (/^-jcheck$/)         { $DEJACHECK = "-C test jcheck"; next; }
   if (/^-nobuild$/)        { $NOBUILD = 1; next; }
   print "Unknown option: $_ : ignoring!\n";
 }
@@ -807,12 +810,12 @@
 if (!$NODEJAGNU) {
   if($VERBOSE) {
     print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n";
-    print "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1\n";
+    print "(time -p $MAKECMD $MAKEOPTS $DEJACHECK) > $dejagnu_output 2>&1\n";
   }
 
   #Run the feature and regression tests, results are put into testrun.sum
   #Full log in testrun.log
-  system "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1";
+  system "(time -p $MAKECMD $MAKEOPTS $DEJACHECK) > $dejagnu_output 2>&1";
 
   #Copy the testrun.log and testrun.sum to our webdir
   CopyFile("test/testrun.log", $DejagnuLog);


More information about the llvm-dev mailing list