* Split the programs table into MultiSource and SingleSource components
[oota-llvm.git] / utils / NightlyTest.pl
index aaa7a809af6ce3f1afdc20340093d9e734b09c6a..99ca4d454e713c7947dd86974cf3a5d516e65748 100755 (executable)
@@ -151,13 +151,19 @@ $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) {
-  system "(time -p ./configure --enable-jit --with-objroot=.) > $Prefix-Build-Log.txt 2>&1";
+  system "(time -p ./configure --enable-jit --enable-spec --with-objroot=.) > $Prefix-Build-Log.txt 2>&1";
 
   # Build the entire tree, capturing the output into $Prefix-Build-Log.txt
   system "(time -p gmake $MAKEOPTS) >> $Prefix-Build-Log.txt 2>&1";
 }
 
 
+sub GetRegexNum {
+  my ($Regex, $Num, $Regex2, $File) = @_;
+  my @Items = split "\n", `grep '$Regex' $File`;
+  return GetRegex $Regex2, $Items[$Num];
+}
+
 #
 # Get some statistics about the build...
 #
@@ -165,12 +171,19 @@ 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 $BuildTimeU = GetRegex "([0-9.]+)", `grep '^user' $Prefix-Build-Log.txt`;
-my $BuildTimeS = GetRegex "([0-9.]+)", `grep '^sys' $Prefix-Build-Log.txt`;
-my $BuildWallTime = GetRegex "([0-9.]+)", `grep '^real' $Prefix-Build-Log.txt`;
+
+my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$Prefix-Build-Log.txt";
+my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$Prefix-Build-Log.txt";
+my $ConfigTime  = $BuildTimeU+$BuildTimeS;  # ConfigTime = User+System
+my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$Prefix-Build-Log.txt";
+
+my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$Prefix-Build-Log.txt";
+my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$Prefix-Build-Log.txt";
 my $BuildTime  = $BuildTimeU+$BuildTimeS;  # BuildTime = User+System
+my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$Prefix-Build-Log.txt";
+
 my $BuildError = "";
-if (`grep '^gmake: .*Error' $Prefix-Build-Log.txt | wc -l` + 0) {
+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>";
 }
@@ -186,7 +199,7 @@ my $CurDir = "";
 foreach $Warning (@Warn) {
   if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
     $CurDir = $1;                 # Keep track of directory warning is in...
-    if ($CurDir =~ m|$BuildDir/llvm/(.*)|) { # Remove buildir prefix if included
+    if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
       $CurDir = $1;
     }
   } else {
@@ -219,7 +232,7 @@ my $DateRE = "[-:0-9 ]+\\+[0-9]+";
 # Loop over every record from the CVS history, filling in the hashes.
 foreach $File (@CVSHistory) {
   my ($Type, $Date, $UID, $Rev, $Filename);
-  if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([0-9\.]+) +([^ ]+) +([^ ]+)/) {
+  if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([]+) +([^ ]+) +([^ ]+)/) {
     ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
   } elsif ($File =~ /([W]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+)/) {
     ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
@@ -248,29 +261,34 @@ foreach $File (@CVSHistory) {
 
 my $UserCommitList = join "\n", keys %UsersCommitted;
 my $UserUpdateList = join "\n", keys %UsersUpdated;
-my $AddedFilesList = AddPreTag join "\n", keys %AddedFiles;
-my $ModifiedFilesList = AddPreTag join "\n", keys %ModifiedFiles;
-my $RemovedFilesList = AddPreTag join "\n", keys %RemovedFiles;
+my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
+my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
+my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
 
 my $TestError = 1;
-my $ProgramsTable;
+my $SingleSourceProgramsTable;
+my $MultiSourceProgramsTable;
 
-# If we build the tree successfully, the nightly programs tests...
-if ($BuildError eq "") {
-  chdir "test/Programs" or die "Could not change into programs testdir!";
+
+sub TestDirectory {
+  my $SubDir = shift;
+
+  chdir "test/Programs/$SubDir" or
+    die "Could not change into test/Programs/$SubDir testdir!";
 
   # Run the programs tests... creating a report.nightly.html file
   if (!$NOTEST) {
     system "gmake $MAKEOPTS report.nightly.html TEST=nightly "
-         . "RUNTIMELIMIT=300 > $Prefix-ProgramTest.txt 2>&1";
+         . "RUNTIMELIMIT=300 > $Prefix-$SubDir-ProgramTest.txt 2>&1";
   } else {
-    system "gunzip $Prefix-ProgramTest.txt.gz";
+    system "gunzip $Prefix-$SubDir-ProgramTest.txt.gz";
   }
 
-  if (`grep '^gmake: .*Error' $Prefix-ProgramTest.txt | wc -l` + 0) {
+  my $ProgramsTable;
+  if (`grep '^gmake: .*Error' $Prefix-$SubDir-ProgramTest.txt | wc -l` + 0) {
     $TestError = 1;
     $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
-  } elsif (`grep '^gmake: .*No rule to make target' $Prefix-ProgramTest.txt | wc -l` + 0) {
+  } elsif (`grep '^gmake: .*No rule to make target' $Prefix-$SubDir-ProgramTest.txt | wc -l` + 0) {
     $TestError = 1;
     $ProgramsTable =
       "<font color=white><h2>Makefile error running tests!</h2></font>";
@@ -281,12 +299,21 @@ if ($BuildError eq "") {
     #
     # Create a list of the tests which were run...
     #
-    system "egrep 'TEST-(PASS|FAIL)' < $Prefix-ProgramTest.txt "
-         . "| sort > $Prefix-Tests.txt";
+    system "egrep 'TEST-(PASS|FAIL)' < $Prefix-$SubDir-ProgramTest.txt "
+         . "| sort > $Prefix-$SubDir-Tests.txt";
   }
 
   # Compress the test output
-  system "gzip -f $Prefix-ProgramTest.txt";
+  system "gzip -f $Prefix-$SubDir-ProgramTest.txt";
+  chdir "../../.." or die "Cannot return to parent directory!";
+  return $ProgramsTable;
+}
+
+# If we build the tree successfully, the nightly programs tests...
+if ($BuildError eq "") {
+  $SingleSourceProgramsTable = TestDirectory("SingleSource");
+  $MultiSourceProgramsTable = TestDirectory("MultiSource");
+  system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt > $Prefix-$SubDir-Tests.txt";
 }
 
 my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");