[llvm-commits] CVS: llvm/utils/NightlyTest.pl

Chris Lattner lattner at cs.uiuc.edu
Wed Jan 22 10:15:01 PST 2003


Changes in directory llvm/utils:

NightlyTest.pl updated: 1.3 -> 1.4

---
Log message:

Implement program tests, and test for compile time problems


---
Diffs of the changes:

Index: llvm/utils/NightlyTest.pl
diff -u llvm/utils/NightlyTest.pl:1.3 llvm/utils/NightlyTest.pl:1.4
--- llvm/utils/NightlyTest.pl:1.3	Mon Jan 20 13:18:44 2003
+++ llvm/utils/NightlyTest.pl	Wed Jan 22 10:14:05 2003
@@ -21,6 +21,17 @@
 my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
 my $DateString = strftime "%B %d, %Y", localtime;
 
+sub ReadFile {
+  if (open (FILE, $_[0])) {
+    my $Ret = <FILE>;
+    close FILE;
+    return $Ret;
+  } else {
+    print "Could not open file '$_[0]' for reading!";
+    return "";
+  }
+}
+
 sub WriteFile {  # (filename, contents)
   open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
   print FILE $_[1];
@@ -68,6 +79,7 @@
 # Command line argument settings...
 my $NOCHECKOUT = 0;
 my $NOREMOVE   = 0;
+my $NOTEST     = 0;
 my $MAKEOPTS   = "";
 
 # Parse arguments...
@@ -78,6 +90,7 @@
   # List command line options here...
   if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
   if (/^-noremove$/)   { $NOREMOVE   = 1; next; }
+  if (/^-notest$/)     { $NOTEST     = 1; next; }
   if (/^-parallel$/)   { $MAKEOPTS   = "-j2 -l3.0"; next; }
 
   print "Unknown option: $_ : ignoring!\n";
@@ -103,13 +116,19 @@
   print "Prefix   = $Prefix\n";
 }
 
+
+#
 # Create the CVS repository directory
+#
 if (!$NOCHECKOUT) {
   mkdir $BuildDir or die "Could not create CVS checkout directory!";
 }
 chdir $BuildDir or die "Could not change to CVS checkout directory!";
 
+
+#
 # Check out the llvm tree, saving CVS messages to the cvs log...
+#
 system "(time -p cvs -d $CVSRootDir co llvm) > $Prefix-CVS-Log.txt 2>&1"
   if (!$NOCHECKOUT);
 
@@ -117,17 +136,20 @@
 
 # Read in the HTML template file...
 undef $/;
-open (TEMPLATEFILE, $Template) or die "Could not open file 'llvm/$Template'!";
-my $TemplateContents = <TEMPLATEFILE>;
-close(TEMPLATEFILE);
+my $TemplateContents = ReadFile $Template;
 
+
+#
 # Get some static statistics about the current state of CVS
+#
 my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $Prefix-CVS-Log.txt`;
 my $NumFilesInCVS = `grep ^U $Prefix-CVS-Log.txt | wc -l` + 0;
 my $NumDirsInCVS  = `grep '^cvs checkout' $Prefix-CVS-Log.txt | wc -l` + 0;
 $LOC = GetRegex "([0-9]+) +total", `wc -l \`utils/getsrcs.sh\` | grep total`;
 
+#
 # Build the entire tree, saving build messages to the build log
+#
 if (!$NOCHECKOUT) {
   # Change the Makefile.config to build into the local directory...
   rename "Makefile.config", "Makefile.config.orig";
@@ -142,15 +164,25 @@
   system "(time -p gmake $MAKEOPTS) > $Prefix-Build-Log.txt 2>&1";
 }
 
+
+#
 # Get some statistics about the build...
+#
 my @Linked = split '\n', `grep Linking $Prefix-Build-Log.txt`;
 my $NumExecutables = scalar(grep(/executable/, @Linked));
 my $NumLibraries   = scalar(grep(!/executable/, @Linked));
 my $NumObjects     = `grep '^Compiling' $Prefix-Build-Log.txt | wc -l` + 0;
 my $BuildTime = GetRegex "([0-9.]+)", `grep '^real' $Prefix-Build-Log.txt`;
+my $BuildError = "";
+if (`grep '^gmake: .*Error' $Prefix-Build-Log.txt | wc -l` + 0) {
+  $BuildError = "<h3>Build error: compilation <a href=\"$DATE-Build-Log.txt\">"
+              . "aborted</a></h3>";
+}
 
 
+#
 # Get warnings from the build
+#
 my @Warn = split "\n", `grep -E 'warning:|Entering dir' $Prefix-Build-Log.txt`;
 my @Warnings;
 my $CurDir = "";
@@ -175,7 +207,10 @@
 $WarningsAdded = AddPreTag $WarningsAdded;
 $WarningsRemoved = AddPreTag $WarningsRemoved;
 
+
+#
 # Get some statistics about CVS commits over the current day...
+#
 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
 #print join "\n", @CVSHistory; print "\n";
 
@@ -214,7 +249,20 @@
 my $ModifiedFilesList = AddPreTag join "\n", keys %ModifiedFiles;
 my $RemovedFilesList = AddPreTag join "\n", keys %RemovedFiles;
 
+#
+# Run the nightly programs tests...
+#
+chdir "test/Programs" or die "Could not change into programs testdir!";
+
+# Run the programs tests... creating a report.nightly.html file
+system "gmake $MAKEOPTS report.nightly.html TEST=nightly "
+     . "> $Prefix-ProgramTest.txt 2>&1" if (!$NOTEST);
+
+my $ProgramsTable = ReadFile "report.nightly.html";
+
+#
 # Get a list of the previous days that we can link to...
+#
 my @PrevDays = map {s/.html//; $_} GetDir ".html";
 
 splice @PrevDays, 20;  # Trim down list to something reasonable...
@@ -222,12 +270,17 @@
 my $PrevDaysList =     # Format list for sidebar
   join "\n  ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
 
+
 #
 # Remove the cvs tree...
 #
+chdir $WebDir or die "Could not change into web directory!";
 system "rm -rf $BuildDir" if (!$NOCHECKOUT and !$NOREMOVE);
 
+
+#
 # Print out information...
+#
 if (0) {
   print "DateString: $DateString\n";
   print "CVS Checkout: $CVSCheckoutTime seconds\n";
@@ -247,12 +300,12 @@
   print "Previous Days =\n  $PrevDaysList\n";
 }
 
+
 #
 # Output the files...
 #
 
 # Main HTML file...
-chdir $WebDir or die "Could not change into web directory!";
 my $Output;
 eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
 WriteFile "$DATE.html", $Output;





More information about the llvm-commits mailing list