Modified the logic so that library objects with main() are only linked in
[oota-llvm.git] / utils / NightlyTest.pl
index acf32165b9d36f7a4658cb10fb348efe07e3d921..daac2a488be9837c6b879a47eadc45ee98806771 100755 (executable)
@@ -7,12 +7,36 @@
 #           regressions and performance changes.  This generates one web page a
 #           day which can be used to access this information.
 #
-# Syntax:   NightlyTest.pl <CVSRootDir> <BuildDir> <WebDir>
+# Syntax:   NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR]
+#   where
+# OPTIONS may include one or more of the following:
+#  -nocheckout      Do not create, checkout, update, or configure
+#                   the source tree.
+#  -noremove        Do not remove the BUILDDIR after it has been built.
+#  -notest          Do not even attempt to run the test programs. Implies
+#                   -norunningtests.
+#  -norunningtests  Do not run the Olden benchmark suite with
+#                   LARGE_PROBLEM_SIZE enabled.
+#  -parallel        Run two parallel jobs with GNU Make.
+#  -enable-linscan  Enable linearscan tests
+#
+# CVSROOT is the CVS repository from which the tree will be checked out,
+#  specified either in the full :method:user@host:/dir syntax, or
+#  just /dir if using a local repo.
+# BUILDDIR is the directory where sources for this test run will be checked out
+#  AND objects for this test run will be built. This directory MUST NOT
+#  exist before the script is run; it will be created by the cvs checkout
+#  process and erased (unless -noremove is specified; see above.)
+# WEBDIR is the directory into which the test results web page will be written,
+#  AND in which the "index.html" is assumed to be a symlink to the most recent
+#  copy of the results. This directory MUST exist before the script is run.
 #
 use POSIX qw(strftime);
 
-my $HOME = $ENV{HOME};
-my $CVSRootDir = "/home/vadve/vadve/Research/DynOpt/CVSRepository";
+my $HOME = $ENV{'HOME'};
+my $CVSRootDir = $ENV{'CVSROOT'};
+   $CVSRootDir = "/home/vadve/shared/PublicCVS"
+    unless $CVSRootDir;
 my $BuildDir   = "$HOME/buildtest";
 my $WebDir     = "$HOME/cvs/testresults-X86";
 
@@ -95,6 +119,7 @@ my $NOREMOVE   = 0;
 my $NOTEST     = 0;
 my $NORUNNINGTESTS = 0;
 my $MAKEOPTS   = "";
+my $ENABLELINEARSCAN = "";
 
 # Parse arguments...
 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
@@ -107,6 +132,7 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
   if (/^-notest$/)         { $NOTEST     = 1; $NORUNNINGTESTS = 1; next; }
   if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
   if (/^-parallel$/)       { $MAKEOPTS   = "-j2 -l3.0"; next; }
+  if (/^-enable-linscan$/) { $ENABLELINEARSCAN = "ENABLE_LINEARSCAN=1"; next; }
 
   print "Unknown option: $_ : ignoring!\n";
 }
@@ -142,7 +168,9 @@ chdir $BuildDir or die "Could not change to CVS checkout directory $BuildDir!";
 #
 # 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"
+$CVSOPT = "";
+$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
+system "(time -p cvs $CVSOPT -d $CVSRootDir co llvm) > $Prefix-CVS-Log.txt 2>&1"
   if (!$NOCHECKOUT);
 
 chdir "llvm" or die "Could not change into llvm directory!";
@@ -157,8 +185,8 @@ 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;
+my $NumFilesInCVS = `egrep '^U' $Prefix-CVS-Log.txt | wc -l` + 0;
+my $NumDirsInCVS  = `egrep '^cvs (checkout|server|update):' $Prefix-CVS-Log.txt | wc -l` + 0;
 $LOC = GetRegex "([0-9]+) +total", `wc -l \`utils/getsrcs.sh\` | grep total`;
 
 #
@@ -197,9 +225,11 @@ 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 ||
+    `grep '^gmake: \*\*\*.*Stop.' $Prefix-Build-Log.txt | wc -l`+0) {
   $BuildError = "<h3><font color='red'>Build error: compilation " .
                 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
+  print "BUILD ERROR\n";
 }
 
 #
@@ -226,10 +256,14 @@ $WarningsFile =~ s/:[0-9]+:/::/g;
 # Emit the warnings file, so we can diff...
 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
 my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
+
+# Output something to stdout if something has changed
+print "ADDED   WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
+print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
+
 $WarningsAdded = AddPreTag $WarningsAdded;
 $WarningsRemoved = AddPreTag $WarningsRemoved;
 
-
 #
 # Get some statistics about CVS commits over the current day...
 #
@@ -292,8 +326,8 @@ sub TestDirectory {
 
   # Run the programs tests... creating a report.nightly.html file
   if (!$NOTEST) {
-    system "gmake $MAKEOPTS report.nightly.html TEST=nightly "
-         . "> $Prefix-$SubDir-ProgramTest.txt 2>&1";
+    system "gmake -k $MAKEOPTS $ENABLELINEARSCAN report.nightly.html "
+         . "TEST=nightly > $Prefix-$SubDir-ProgramTest.txt 2>&1";
   } else {
     system "gunzip $Prefix-$SubDir-ProgramTest.txt.gz";
   }
@@ -302,10 +336,12 @@ sub TestDirectory {
   if (`grep '^gmake[^:]: .*Error' $Prefix-$SubDir-ProgramTest.txt | wc -l` + 0){
     $TestError = 1;
     $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
+    print "ERROR TESTING\n";
   } 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>";
+    print "ERROR TESTING\n";
   } else {
     $TestError = 0;
     $ProgramsTable = ReadFile "report.nightly.html";
@@ -365,25 +401,31 @@ if ($TestError) {
     $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
   }
 
+  print "\nTESTS ADDED:  \n\n$TestsAdded\n\n"   if (length $TestsAdded);
+  print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
+  print "\nTESTS FIXED:  \n\n$TestsFixed\n\n"   if (length $TestsFixed);
+  print "\nTESTS BROKEN: \n\n$TestsBroken\n\n"  if (length $TestsBroken);
+
   $TestsAdded   = AddPreTag $TestsAdded;
   $TestsRemoved = AddPreTag $TestsRemoved;
   $TestsFixed   = AddPreTag $TestsFixed;
   $TestsBroken  = AddPreTag $TestsBroken;
 }
 
+
 # If we built the tree successfully, runs of the Olden suite with
 # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
 if ($BuildError eq "") {
   my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
       $MachCodeSize) = ("","","","","","","");
   if (!$NORUNNINGTESTS) {
-    chdir "test/Programs/MultiSource/Olden" or die "Olden tests moved?";
+    chdir "test/Programs/MultiSource/Benchmarks/Olden" or die "Olden tests moved?";
 
     # Clean out previous results...
     system "gmake $MAKEOPTS clean > /dev/null 2>&1";
 
     # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE enabled!
-    system "gmake $MAKEOPTS report.nightly.raw.out TEST=nightly " .
+    system "gmake -k $MAKEOPTS report.nightly.raw.out TEST=nightly " .
            " LARGE_PROBLEM_SIZE=1 > /dev/null 2>&1";
     system "cp report.nightly.raw.out $Prefix-Olden-tests.txt";
   } else {
@@ -454,16 +496,16 @@ AddRecord($BuildTime, "running_build_time.txt");
 #
 # Rebuild the graphs now...
 #
-system "/usr/dcs/software/supported/bin/gnuplot " .
-       "$BuildDir/llvm/utils/NightlyTest.gnuplot";
+$GNUPLOT = "/usr/dcs/software/supported/bin/gnuplot";
+$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
+$PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
+system ($GNUPLOT, $PlotScriptFilename);
 
 #
 # Remove the cvs tree...
 #
 system "rm -rf $BuildDir" if (!$NOCHECKOUT and !$NOREMOVE);
 
-
-
 #
 # Print out information...
 #
@@ -477,7 +519,6 @@ if (0) {
 
   print "WARNINGS:\n  $WarningsList\n";
 
-
   print "Users committed: $UserCommitList\n";
   print "Added Files: \n  $AddedFilesList\n";
   print "Modified Files: \n  $ModifiedFilesList\n";