Regenerate.
[oota-llvm.git] / utils / NewNightlyTest.pl
index 1531f72d39a5d17cea5d49d92f8e86c0190f3429..956a952626e4fa4eaaf1a7e4d2aca00ccd39b1fd 100755 (executable)
@@ -29,7 +29,9 @@ use Socket;
 #  -nodejagnu       Do not run feature or regression tests
 #  -parallel        Run two parallel jobs with GNU Make.
 #  -release         Build an LLVM Release version
+#  -release-asserts Build an LLVM ReleaseAsserts version
 #  -enable-llcbeta  Enable testing of beta features in llc.
+#  -enable-lli      Enable testing of lli (interpreter) features, default is off
 #  -disable-llc     Disable LLC tests in the nightly tester.
 #  -disable-jit     Disable JIT tests in the nightly tester.
 #  -disable-cbe     Disable C backend tests in the nightly tester.
@@ -67,7 +69,7 @@ use Socket;
 #                   webserver
 #  -submit-script   Specifies which script to call on the submit server. If
 #                   this option is not specified it defaults to
-#                   /nightlytest/NightlyTestAccept.cgi. This is basically 
+#                   /nightlytest/NightlyTestAccept.php. This is basically 
 #                   everything after the www.yourserver.org.
 #
 # CVSROOT is the CVS repository from which the tree will be checked out,
@@ -117,7 +119,7 @@ $NOTEST=0;
 $NORUNNINGTESTS=0;
 $MAKECMD="make";
 $SUBMITSERVER = "llvm.org";
-$SUBMITSCRIPT = "/nightlytest/NightlyTestAccept.cgi";
+$SUBMITSCRIPT = "/nightlytest/NightlyTestAccept.php";
 
 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
   shift;
@@ -133,7 +135,13 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
   if (/^-parallel$/)       { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
   if (/^-release$/)        { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
                              "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;}
+  if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
+                             "DISABLE-ASSERTIONS=1 ".
+                             "OPTIMIZE_OPTION=-O2"; 
+                             $BUILDTYPE="release-asserts"; next;}
   if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
+  if (/^-enable-lli$/)     { $PROGTESTOPTS .= " ENABLE_LLI=1";
+                             $CONFIGUREARGS .= " --enable-lli"; next; } 
   if (/^-disable-llc$/)    { $PROGTESTOPTS .= " DISABLE_LLC=1";
                              $CONFIGUREARGS .= " --disable-llc_diffs"; next; } 
   if (/^-disable-jit$/)    { $PROGTESTOPTS .= " DISABLE_JIT=1";
@@ -206,7 +214,7 @@ if ($nickname eq "") {
        "\"-nickname <nickname>\"");
 }
 
-if ($BUILDTYPE ne "release") {
+if ($BUILDTYPE ne "release" && $BUILDTYPE ne "release-asserts") {
   $BUILDTYPE = "debug";
 }
 
@@ -227,7 +235,9 @@ my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
 my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
 if (! -d $WebDir) {
   mkdir $WebDir, 0777;
-  warn "$WebDir did not exist; creating it.\n";
+  if($VERBOSE){
+    warn "$WebDir did not exist; creating it.\n";
+  }
 }
 
 if ($VERBOSE) {
@@ -365,64 +375,38 @@ sub FormatTime {
 }
 
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# This function is meant to read in the dejagnu sum file and 
+# return a string with only the results (i.e. PASS/FAIL/XPASS/
+# XFAIL).
+#
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 sub GetDejagnuTestResults { # (filename, log)
-  my ($filename, $DejagnuLog) = @_;
-  my @lines;
-  my $firstline;
-  $/ = "\n"; #Make sure we're going line at a time.
-
-  if( $VERBOSE) { print "DEJAGNU TEST RESULTS:\n"; }
-
-  if (open SRCHFILE, $filename) {
-# Process test results
-    my $first_list = 1;
-    my $should_break = 1;
-    my $nocopy = 0;
-    my $readingsum = 0;
-    while ( <SRCHFILE> ) {
-        if ( length($_) > 1 ) {
-            chomp($_);
-            if ( m/^XPASS:/ || m/^FAIL:/ ) {
-                $nocopy = 0;
-                if ( $first_list ) {
-                    push(@lines, "UNEXPECTED TEST RESULTS\n");
-                    $first_list = 0;
-                    $should_break = 1;
-                    push(@lines, "$_\n");
-                    if( $VERBOSE) { print "  $_\n"; }
-                } else {
-                    push(@lines, "$_\n");
-                    if( $VERBOSE) { print "  $_\n"; }
+    my ($filename, $DejagnuLog) = @_;
+    my @lines;
+    $/ = "\n"; #Make sure we're going line at a time.
+
+    if( $VERBOSE) { print "DEJAGNU TEST RESULTS:\n"; }
+
+    if (open SRCHFILE, $filename) {
+        # Process test results
+        while ( <SRCHFILE> ) {
+            if ( length($_) > 1 ) {
+                chomp($_);
+                if ( m/^(PASS|XPASS|FAIL|XFAIL): .*\/llvm\/test\/(.*)$/ ) {
+                    push(@lines, "$1: test/$2");
                 }
-            } #elsif ( m/Summary/ ) {
-            #    if ( $first_list ) {
-            #   push(@lines, "PERFECT!");
-            #   print "  PERFECT!\n";
-            #    } else {
-            #   push(@lines, "</li></ol>\n");
-            #    }
-            #    push(@lines, "STATISTICS\n");
-            #    print "\nDEJAGNU STATISTICS:\n";
-            #    $should_break = 0;
-            #    $nocopy = 0;
-            #    $readingsum = 1;
-            #} 
-            elsif ( $readingsum ) {
-                push(@lines,"$_\n");
-                if( $VERBOSE) { print "  $_\n"; }
             }
-
         }
     }
-  }
-  close SRCHFILE;
+    close SRCHFILE;
 
-  my $content = join("", @lines);
-  return $content;
+    my $content = join("\n", @lines);
+    return $content;
 }
 
 
+
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #
 # This function acts as a mini web browswer submitting data
@@ -493,11 +477,15 @@ if (!$NOCHECKOUT) {
         print "Build directory exists! Removing it\n";
       }
       system "rm -rf $BuildDir";
+      mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
     } else {
-       die "CVS checkout directory $BuildDir already exists!";
+      if ( $VERBOSE ) {
+        print "Build directory exists!\n";
+      }
     }
+  } else {
+    mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
   }
-  mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
 }
 ChangeDir( $BuildDir, "CVS checkout directory" );
 
@@ -511,7 +499,7 @@ my $CVSOPT = "";
 # Use compression if going over ssh.
 $CVSOPT = "-z3" 
   if $CVSRootDir =~ /^:ext:/;
-my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
+my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT";
 if (!$NOCHECKOUT) {
   if ( $VERBOSE ) { 
     print "CHECKOUT STAGE:\n"; 
@@ -523,10 +511,6 @@ if (!$NOCHECKOUT) {
   ChangeDir( $BuildDir , "CVS Checkout directory") ;
 }
 ChangeDir( "llvm" , "llvm source directory") ;
-if (!$NOCHECKOUT) {
-  if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
-  system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
-}
 
 ##############################################################
 #
@@ -636,10 +620,9 @@ if (!$NOCHECKOUT && !$NOBUILD) {
 #my $NumLibraries   = scalar(grep(!/executable/, @Linked));
 #my $NumObjects     = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
 
-
 # Get the number of lines of source code. Must be here after the build is done
 # because countloc.sh uses the llvm-config script which must be built.
-my $LOC = `utils/countloc.sh`;
+my $LOC = `utils/countloc.sh -topdir $BuildDir/llvm`;
 
 # Get the time taken by the configure script
 my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
@@ -682,6 +665,8 @@ if (!$BuildError) {
   $afiles.= `find tools/ -iname '*.a' -ls`;
   if($BUILDTYPE eq "release"){
     $afiles.= `find Release/ -iname '*.a' -ls`;
+  } elsif($BUILDTYPE eq "release-asserts") {
+   $afiles.= `find Release-Asserts/ -iname '*.a' -ls`;
   } else {
    $afiles.= `find Debug/ -iname '*.a' -ls`;
   }
@@ -691,6 +676,8 @@ if (!$BuildError) {
   $ofiles.= `find tools/ -iname '*.o' -ls`;
   if($BUILDTYPE eq "release"){
     $ofiles.= `find Release/ -iname '*.o' -ls`;
+  } elsif($BUILDTYPE eq "release-asserts") {
+    $ofiles.= `find Release-Asserts/ -iname '*.o' -ls`;
   } else {
     $ofiles.= `find Debug/ -iname '*.o' -ls`;
   }
@@ -717,7 +704,7 @@ if (!$BuildError) {
 # Running dejagnu tests
 #
 ##############################################################
-my $DejangnuTestResults; # String containing the results of the dejagnu
+my $DejangnuTestResults=""; # String containing the results of the dejagnu
 my $dejagnu_output = "$DejagnuTestsLog";
 if (!$NODEJAGNU) {
   if($VERBOSE) { 
@@ -792,8 +779,7 @@ if (!$NODEJAGNU) {
 #
 ##############################################################
 sub TestDirectory {
-  my $SubDir = shift;
-  
+  my $SubDir = shift;  
   ChangeDir( "$BuildDir/llvm/projects/llvm-test/$SubDir", 
              "Programs Test Subdirectory" ) || return ("", "");
   
@@ -825,78 +811,83 @@ sub TestDirectory {
   # Create a list of the tests which were run...
   #
   system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
-         "| sort > $Prefix-multisourceprogramstable.txt";
+         "| sort > $Prefix-$SubDir-Tests.txt";
   }
   $ProgramsTable = ReadFile "report.nightly.csv";
 
   ChangeDir( "../../..", "Programs Test Parent Directory" );
   return ($ProgramsTable, $llcbeta_options);
-}
+} #end sub TestDirectory
 
+##############################################################
+#
+# Calling sub TestDirectory
+#
+##############################################################
 if (!$BuildError) {
   if ( $VERBOSE ) {
      print "SingleSource TEST STAGE\n";
   }
   ($SingleSourceProgramsTable, $llcbeta_options) = 
     TestDirectory("SingleSource");
-  WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
+  WriteFile "$Prefix-SingleSource-Performance.txt", $SingleSourceProgramsTable;
   if ( $VERBOSE ) {
-     print "MultiSource TEST STAGE\n";
+    print "MultiSource TEST STAGE\n";
   }
   ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource");
-  WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable;
+  WriteFile "$Prefix-MultiSource-Performance.txt", $MultiSourceProgramsTable;
   if ( ! $NOEXTERNALS ) {
     if ( $VERBOSE ) {
       print "External TEST STAGE\n";
     }
     ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External");
-    WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
-    system "cat $Prefix-singlesourceprogramstable.txt " . 
-               "$Prefix-multisourceprogramstable.txt ".
-               "$Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt";
+    WriteFile "$Prefix-External-Performance.txt", $ExternalProgramsTable;
+    system "cat $Prefix-SingleSource-Tests.txt " . 
+               "$Prefix-MultiSource-Tests.txt ".
+               "$Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
+    system "cat $Prefix-SingleSource-Performance.txt " . 
+               "$Prefix-MultiSource-Performance.txt ".
+               "$Prefix-External-Performance.txt | sort > $Prefix-Performance.txt";
   } else {
     $ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
     if ( $VERBOSE ) {
       print "External TEST STAGE SKIPPED\n";
     }
-    system "cat $Prefix-singlesourceprogramstable.txt " . 
-               "$Prefix-multisourceprogramstable.txt ".
+    system "cat $Prefix-SingleSource-Tests.txt " . 
+               "$Prefix-MultiSource-Tests.txt ".
                " | sort > $Prefix-Tests.txt";
+    system "cat $Prefix-SingleSource-Performance.txt " . 
+               "$Prefix-MultiSource-Performance.txt ".
+               " | sort > $Prefix-Performance.txt";
   }
-  WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
-}
 
-##############################################################
-#
-# 
-# gathering tests added removed broken information here
-#
-#
-##############################################################
-my $dejagnu = ReadFile $DejagnuSum;
-my @DEJAGNU = split "\n", $dejagnu;
-my $dejagnu_test_list="";
-
-my $passes="",
-my $fails="";
-my $xfails="";
-
-if(!$NODEJAGNU) {
-  for ($x=0; $x<@DEJAGNU; $x++) {
-    if ($DEJAGNU[$x] =~ m/^PASS:/) {
-      $passes.="$DEJAGNU[$x]\n";
-      $dejagnu_test_list.="$DEJAGNU[$x]\n";
-    }
-    elsif ($DEJAGNU[$x] =~ m/^FAIL:/) {
-      $fails.="$DEJAGNU[$x]\n";
-      $dejagnu_test_list.="$DEJAGNU[$x]\n";
-    }
-    elsif ($DEJAGNU[$x] =~ m/^XFAIL:/) {
-      $xfails.="$DEJAGNU[$x]\n";
-      $dejagnu_test_list.="$DEJAGNU[$x]\n";
+  ##############################################################
+  #
+  # 
+  # gathering tests added removed broken information here 
+  #
+  #
+  ##############################################################
+  my $dejagnu_test_list = ReadFile "$Prefix-Tests.txt";
+  my @DEJAGNU = split "\n", $dejagnu_test_list;
+  my ($passes, $fails, $xfails) = "";
+
+  if(!$NODEJAGNU) {
+    for ($x=0; $x<@DEJAGNU; $x++) {
+      if ($DEJAGNU[$x] =~ m/^PASS:/) {
+        $passes.="$DEJAGNU[$x]\n";
+      }
+      elsif ($DEJAGNU[$x] =~ m/^FAIL:/) {
+        $fails.="$DEJAGNU[$x]\n";
+      }
+      elsif ($DEJAGNU[$x] =~ m/^XFAIL:/) {
+        $xfails.="$DEJAGNU[$x]\n";
+      }
     }
   }
-}
+  
+} #end if !$BuildError
+
 
 ##############################################################
 #
@@ -961,30 +952,28 @@ my $build_data;
 @BUILD_DATA = ReadFile "$BuildLog";
 $build_data = join("\n", @BUILD_DATA);
 
-my @DEJAGNU_LOG;
-my @DEJAGNU_SUM;
-my $dejagnutests_log;
-my $dejagnutests_sum;
-@DEJAGNU_LOG = ReadFile "$DejagnuLog";
-@DEJAGNU_SUM = ReadFile "$DejagnuSum";
-$dejagnutests_log = join("\n", @DEJAGNU_LOG);
-$dejagnutests_sum = join("\n", @DEJAGNU_SUM);
-
-my @DEJAGNULOG_FULL;
-my $dejagnulog_full;
-@DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog";
-$dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
-
-my $gcc_version_long="";
+my (@DEJAGNU_LOG, @DEJAGNU_SUM, @DEJAGNULOG_FULL, @GCC_VERSION);
+my ($dejagnutests_log ,$dejagnutests_sum, $dejagnulog_full) = "";
+my ($gcc_version, $gcc_version_long) = "";
+
+$gcc_version_long="";
 if ($GCCPATH ne "") {
-  $gcc_version_long = `$GCCPATH/gcc --version`;
+       $gcc_version_long = `$GCCPATH/gcc --version`;
 } else {
-  $gcc_version_long = `gcc --version`;
+       $gcc_version_long = `gcc --version`;
 }
 @GCC_VERSION = split '\n', $gcc_version_long;
-my $gcc_version = $GCC_VERSION[0];
+$gcc_version = $GCC_VERSION[0];
 
-my $all_tests = ReadFile "$Prefix-Tests.txt";
+if(!$BuildError){
+  @DEJAGNU_LOG = ReadFile "$DejagnuLog";
+  @DEJAGNU_SUM = ReadFile "$DejagnuSum";
+  $dejagnutests_log = join("\n", @DEJAGNU_LOG);
+  $dejagnutests_sum = join("\n", @DEJAGNU_SUM);
+
+  @DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog";
+  $dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
+}
 
 ##############################################################
 #
@@ -1029,8 +1018,8 @@ my %hash_of_data = (
   'all_tests' => $dejagnu_test_list,
   'new_tests' => "",
   'removed_tests' => "",
-  'dejagnutests_log' => $dejagnutests_log,
-  'dejagnutests_sum' => $dejagnutests_sum,
+  'dejagnutests_results' => $DejagnuTestResults,
+  'dejagnutests_log' => $dejagnulog_full,
   'starttime' => $starttime,
   'endtime' => $endtime,
   'o_file_sizes' => $o_file_sizes,