Add an out-of-line virtual method for the sdnode class to give it a home.
[oota-llvm.git] / utils / NewNightlyTest.pl
index 8e5dfc45b57086246b1f3c7485b515d85b34c128..bdc65aeab0c0586e59b079fbb571006d42fe3365 100755 (executable)
@@ -20,15 +20,13 @@ use Socket;
 #  -nocheckout      Do not create, checkout, update, or configure
 #                   the source tree.
 #  -noremove        Do not remove the BUILDDIR after it has been built.
+#  -noremoveresults Do not remove the WEBDIR after it has been built.
 #  -nobuild         Do not build llvm. If tests are enabled perform them
 #                   on the llvm build specified in the build directory
 #  -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.
-#  -noexternals     Do not run the external tests (for cases where povray
-#                   or SPEC are not installed)
-#  -with-externals  Specify a directory where the external tests are located.
 #  -nodejagnu       Do not run feature or regression tests
 #  -parallel        Run two parallel jobs with GNU Make.
 #  -release         Build an LLVM Release version
@@ -53,14 +51,15 @@ use Socket;
 #                   override the default.
 #  -ldflags         Next argument specifies that linker options that override
 #                   the default.
-#  -extraflags      Next argument specifies extra options that are passed to
-#                   compile the tests.
+#  -compileflags    Next argument specifies extra options passed to make when
+#                   building LLVM.
 #
 #  ---------------- Options to configure llvm-test ----------------------------
-#  -spec2000path    Path to the benchspec directory in the SPEC 2000 distro
-#  -spec95path      Path to the benchspec directory in the SPEC 95 distro.
-#  -povraypath      Path to the povray sources
-#  -namdpath        Path to the namd sources
+#  -extraflags      Next argument specifies extra options that are passed to
+#                   compile the tests.
+#  -noexternals     Do not run the external tests (for cases where povray
+#                   or SPEC are not installed)
+#  -with-externals  Specify a directory where the external tests are located.
 #
 # CVSROOT is the CVS repository from which the tree will be checked out,
 #  specified either in the full :method:user@host:/dir syntax, or
@@ -119,10 +118,12 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
     if (/^-nocheckout$/)     { $NOCHECKOUT = 1; next; }
     if (/^-nocvsstats$/)     { $NOCVSSTATS = 1; next; }
     if (/^-noremove$/)       { $NOREMOVE = 1; next; }
+    if (/^-noremoveresults$/) { $NOREMOVERESULTS = 1; next; }
     if (/^-notest$/)         { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
     if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
     if (/^-parallel$/)       { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
-    if (/^-release$/)        { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2"; next; }
+    if (/^-release$/)        { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
+                                                                                                                                                  "OPTIMIZE_OPTION=-O2"; next; }
     if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
     if (/^-disable-llc$/)    { $PROGTESTOPTS .= " DISABLE_LLC=1";
                               $CONFIGUREARGS .= " --disable-llc_diffs"; next; } 
@@ -138,8 +139,14 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
        $CONFIGUREARGS .= "--with-externals=$ARGV[0]"; shift; next;
     }
     if (/^-nickname$/)         { $nickname = "$ARGV[0]"; shift; next; }
-    if (/^-gccpath/)         { $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;}
-    if (/^-cvstag/)          { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; } else{ $CVSCOOPT="";}
+    if (/^-gccpath/)         { $CONFIGUREARGS .= 
+                                                                                                          " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; 
+                               $GCCPATH=$ARGV[0]; 
+                               shift;  
+                               next;}
+    else{ $GCCPATH=""; }
+    if (/^-cvstag/)          { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; } 
+    else{ $CVSCOOPT="";}
     if (/^-target/)          {
        $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next;
     }
@@ -161,18 +168,6 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
     if (/^-noexternals$/)    { $NOEXTERNALS = 1; next; }
     if (/^-nodejagnu$/)      { $NODEJAGNU = 1; next; }
     if (/^-nobuild$/)        { $NOBUILD = 1; next; }
-    if (/^-spec2000path$/)   {
-       $LLVMTESTCONFIGARGS .= " --enable-spec2000=$ARGV[0]"; shift; next;
-    } else{ $LLVMTESTCONFIGARGS=""; }
-    if (/^-spec95path$/)     {
-       $LLVMTESTCONFIGARGS .= " --enable-spec95=$ARGV[0]"; shift; next;
-    }
-    if (/^-povraypath$/)     {
-       $LLVMTESTCONFIGARGS .= " --enable-povray=$ARGV[0]"; shift; next;
-    }
-    if (/^-namdpath$/)       {
-       $LLVMTESTCONFIGARGS .= " --enable-namd=$ARGV[0]"; shift; next;
-    }
     print "Unknown option: $_ : ignoring!\n";
 }
 
@@ -293,7 +288,7 @@ sub ReadFile {
        $/ = '\n';
        return $Ret;
     } else {
-       print "Could not open file '$_[0]' for reading!";
+       print "Could not open file '$_[0]' for reading!\n";
        return "";
     }
 }
@@ -301,7 +296,7 @@ sub ReadFile {
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 sub WriteFile {  # (filename, contents)
-    open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
+    open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n";
     print FILE $_[1];
     close FILE;
 }
@@ -413,7 +408,8 @@ sub SendData{
 
     $port=80;
     $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n";
-    socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or die "Bad socket\n";
+    socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or 
+                        die "Bad socket\n";
     connect SOCK, $socketaddr or die "Bad connection\n";
     select((select(SOCK), $| = 1)[0]);
 
@@ -440,15 +436,22 @@ sub SendData{
     close(SOCK);
 
     my $sentdata="";
-    foreach $x(keys(%hash_of_data)){
-        $sentdata.= "$x  => $hash_of_data{$x}\n";
+    foreach $x (keys (%$variables)){
+        $value = $variables->{$x};
+        $sentdata.= "$x  => $value\n";
     }
     WriteFile "$Prefix-sentdata.txt", $sentdata;
-
+    
 
     return $result;
 }
 
+##############################################################
+#
+# Getting Start timestamp
+#
+##############################################################
+$starttime = `date`;
 
 ##############################################################
 #
@@ -547,7 +550,7 @@ foreach $File (@CVSHistory) {
            $ModifiedFiles{$Filename} = 1;
            $UsersCommitted{$UID} = 1;
        } elsif ($Type eq 'A') {   # Added
-           $Addediles{$Filename} = 1;
+           $AddedFiles{$Filename} = 1;
            $UsersCommitted{$UID} = 1;
        } elsif ($Type eq 'R') {   # Removed
            $RemovedFiles{$Filename} = 1;
@@ -574,7 +577,7 @@ my $UserUpdateList = join "\n", sort keys %UsersUpdated;
 #
 ##############################################################
 if (!$NOCHECKOUT && !$NOBUILD) {
-    my $EXTRAFLAGS = "--enable-spec --with-objroot=.$LLVMTESTCONFIGARGS";
+    my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
     if ( $VERBOSE )
     {
         print "CONFIGURE STAGE:\n";
@@ -771,18 +774,19 @@ if (!$BuildError && $patrickjenkins) {
     if ( $VERBOSE ) {
        print "SingleSource TEST STAGE\n";
     }
-    ($SingleSourceProgramsTable, $singlesource_llcbeta_options) = TestDirectory("SingleSource");
+    ($SingleSourceProgramsTable, $llcbeta_options) = TestDirectory("SingleSource");
     WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
     if ( $VERBOSE ) {
        print "MultiSource TEST STAGE\n";
     }
-    ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource");
+    ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource");
     WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable;
     if ( ! $NOEXTERNALS ) {
        if ( $VERBOSE ) {
            print "External TEST STAGE\n";
        }
-       ($ExternalProgramsTable, $externalsource_llcbeta_options) = TestDirectory("External");
+       ($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";
     } else {
@@ -910,6 +914,13 @@ if (!$BuildError) {
     #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir);
 }
 
+##############################################################
+#
+# Getting end timestamp
+#
+##############################################################
+$endtime = `date`;
+
 
 ##############################################################
 #
@@ -950,8 +961,16 @@ my $dejagnulog_full;
 @DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog";
 $dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
 
-my $gcc_version_long = `gcc --version`;
-@GCC_VERSION = split "\n", $gcc_version_long;
+my $gcc_version_long="";
+if($GCCPATH ne ""){
+  $gcc_version_long = `$GCCPATH/gcc --version`;
+  print "$GCCPATH/gcc --version\n";
+}
+else{
+  $gcc_version_long = `gcc --version`;
+  print "gcc --version\n";
+}
+@GCC_VERSION = split '\n', $gcc_version_long;
 my $gcc_version = $GCC_VERSION[0];
 
 ##############################################################
@@ -989,7 +1008,7 @@ my %hash_of_data = ('machine_data' => $machine_data,
               'buildstatus' => $BuildStatus,
               'singlesource_programstable' => $SingleSourceProgramsTable,
                'multisource_programstable' => $MultiSourceProgramsTable,
-               'externalsource_programstable' => $ExternalSourceProgramsTable,
+               'externalsource_programstable' => $ExternalProgramsTable,
               'llcbeta_options' => $multisource_llcbeta_options,
                'warnings_removed' => $WarningsRemoved,
                'warnings_added' => $WarningsAdded,
@@ -999,7 +1018,9 @@ my %hash_of_data = ('machine_data' => $machine_data,
                'removed_tests' => $TestsRemoved,
               'unexpfail_tests' => $unexpfail_tests,
               'dejagnutests_log' => $dejagnutests_log,
-              'dejagnutests_sum' => $dejagnutests_sum);
+              'dejagnutests_sum' => $dejagnutests_sum,
+              'starttime' => $starttime,
+              'endtime' => $endtime);
 
 $TESTING = 0;
 
@@ -1020,5 +1041,6 @@ else{
 #
 ##############################################################
 system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
+system ( "$NICE rm -rf $WebDir") if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);