ChangeDir now returns the correct value
[oota-llvm.git] / utils / NewNightlyTest.pl
index 36942c297ef13cab0644e3e334b9e7dd02adc4e8..033ae1c7af0b9924eb349ec6479968e5b7fe75e4 100755 (executable)
@@ -1,5 +1,4 @@
 #!/usr/bin/perl
-
 use POSIX qw(strftime);
 use File::Copy;
 use Socket;
@@ -20,15 +19,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 +50,17 @@ 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.
+#  -use-gmake                  Use gmake instead of the default make command to build
+#                   llvm and run tests.
 #
 #  ---------------- 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
@@ -107,9 +107,10 @@ my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
 #
 ##############################################################
 $CONFIGUREARGS="";
-
+$nickname="";
 $NOTEST=0;
 $NORUNNINGTESTS=0;
+$MAKECMD="make";
 
 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
     shift;
@@ -119,10 +120,13 @@ 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"; 
+                                                              $BUILDTYPE="release"; next; }
     if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
     if (/^-disable-llc$/)    { $PROGTESTOPTS .= " DISABLE_LLC=1";
                               $CONFIGUREARGS .= " --disable-llc_diffs"; next; } 
@@ -138,8 +142,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;
     }
@@ -155,24 +165,15 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
     if (/^-compileflags/)    {
        $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next;
     }
+    if (/^-use-gmake/)    {
+                       $MAKECMD = "gmake"; shift; next;
+    }
     if (/^-extraflags/)      {
        $PROGTESTOPTS .= " EXTRA_FLAGS=\'$ARGV[0]\'"; shift; next;
     }
     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";
 }
 
@@ -183,7 +184,13 @@ if ($CONFIGUREARGS !~ /--disable-jit/) {
     $CONFIGUREARGS .= " --enable-jit";
 }
 
-die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
+
+if (@ARGV != 0 and @ARGV != 3){
+       foreach $x (@ARGV){
+               print "$x\n";
+       }
+       print "Must specify 0 or 3 options!";
+}
 
 if (@ARGV == 3) {
     $CVSRootDir = $ARGV[0];
@@ -191,6 +198,21 @@ if (@ARGV == 3) {
     $WebDir     = $ARGV[2];
 }
 
+if($CVSRootDir eq "" or
+   $BuildDir   eq "" or
+   $WebDir     eq ""){
+   die("please specify a cvs root directory, a build directory, and a ".
+       "web directory");
+ }
+if($nickname eq ""){
+       die ("Please invoke NewNightlyTest.pl with command line option \"-nickname <nickname>\"");
+}
+
+if($BUILDTYPE ne "release"){
+       $BUILDTYPE = "debug";
+}
+
 ##############################################################
 #
 #define the file names we'll use
@@ -280,7 +302,12 @@ sub ChangeDir { # directory, logical name
     my ($dir,$name) = @_;
     chomp($dir);
     if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
-    chdir($dir) || die "Cannot change directory to: $name ($dir) ";
+    $result = chdir($dir);
+    if(!$result){
+       print "ERROR!!! Cannot change directory to: $name ($dir) because $!"; 
+       return false;
+    }
+    return true;
 }
 
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -293,7 +320,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 +328,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 +440,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 +468,22 @@ sub SendData{
     close(SOCK);
 
     my $sentdata="";
-    foreach $x(keys(%hash_of_data)){
-        $senddata.= "$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 "+20%y-%m-%d %H:%M:%S"`;
 
 ##############################################################
 #
@@ -458,6 +493,9 @@ sub SendData{
 if (!$NOCHECKOUT) {
     if (-d $BuildDir) {
        if (!$NOREMOVE) {
+               if ( $VERBOSE ){
+                       print "Build directory exists! Removing it\n";
+               }
            system "rm -rf $BuildDir";
        } else {
            die "CVS checkout directory $BuildDir already exists!";
@@ -547,7 +585,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,20 +612,19 @@ my $UserUpdateList = join "\n", sort keys %UsersUpdated;
 #
 ##############################################################
 if (!$NOCHECKOUT && !$NOBUILD) {
-    my $EXTRAFLAGS = "--enable-spec --with-objroot=.$LLVMTESTCONFIGARGS";
-    if ( $VERBOSE )
-    {
+    my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
+    if ( $VERBOSE ){
         print "CONFIGURE STAGE:\n";
         print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1\n";
     }
     system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
     if ( $VERBOSE ) 
     { 
-       print "BUILD STAGE:\n";
-       print "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1\n";
+                       print "BUILD STAGE:\n";
+                       print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n";
     }
     # Build the entire tree, capturing the output into $BuildLog
-    system "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1";
+    system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1";
 }
 
 
@@ -624,14 +661,42 @@ if($NOBUILD){
     $BuildStatus = "Skipped by user";
     $BuildError = 1;
 }
-elsif (`grep '^make[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
-    `grep '^make: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
+elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
+    `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
     $BuildStatus = "Error: compilation aborted";
     $BuildError = 1;
     print  "\n***ERROR BUILDING TREE\n\n";
 }
 if ($BuildError) { $NODEJAGNU=1; }
 
+my $a_file_sizes="";
+my $o_file_sizes="";
+if(!$BuildError){
+       if ( $VERBOSE ){
+        print "Organizing size of .o and .a files\n";
+    }
+       ChangeDir( "$BuildDir/llvm", "Build Directory" );
+       $afiles = `find . -iname '*.a' -ls`;
+       $ofiles = `find . -iname '*.o' -ls`;
+       @AFILES = split "\n", $afiles;
+       $a_file_sizes="";
+       foreach $x (@AFILES){
+         $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
+         $a_file_sizes.="$1 $2 $BUILDTYPE\n";
+       }       
+       @OFILES = split "\n", $ofiles;
+       $o_file_sizes="";
+       foreach $x (@OFILES){
+         $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
+         $o_file_sizes.="$1 $2 $BUILDTYPE\n";
+       }
+}
+else{
+       $a_file_sizes="No data due to a bad build.";
+       $o_file_sizes="No data due to a bad build.";
+}
+
+
 ##############################################################
 #
 # Running dejagnu tests
@@ -642,13 +707,13 @@ my $dejagnu_output = "$DejagnuTestsLog";
 if(!$NODEJAGNU) {
     if($VERBOSE) 
     { 
-       print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n"; 
-       print "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1\n";
+                       print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n"; 
+                       print "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1\n";
     }
 
     #Run the feature and regression tests, results are put into testrun.sum
     #Full log in testrun.log
-    system "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1";
+    system "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1";
     
     #Copy the testrun.log and testrun.sum to our webdir
     CopyFile("test/testrun.log", $DejagnuLog);
@@ -697,7 +762,7 @@ $WarningsFile =~ s/:[0-9]+:/::/g;
 
 # Emit the warnings file, so we can diff...
 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
-my ($WarningsAdded, $WarningsRemoved) = DiffFiles "$Prefix-Warnings.txt";
+my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
 
 # Output something to stdout if something has changed
 #print "ADDED   WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
@@ -716,85 +781,78 @@ my ($WarningsAdded, $WarningsRemoved) = DiffFiles "$Prefix-Warnings.txt";
 #
 ##############################################################
 sub TestDirectory {
-    my $SubDir = shift;
-    
-    ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
-
-    my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
-    #my $ProgramTestLog = "$Prefix-MultiSource-ProgramTest.txt"; #CHANGE ME!
-    
-    # Run the programs tests... creating a report.nightly.csv file
-    if (!$NOTEST) {
-       print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
-           . "TEST=nightly > $ProgramTestLog 2>&1\n";
-       system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
-           . "TEST=nightly > $ProgramTestLog 2>&1";
-       $llcbeta_options=`make print-llcbeta-option`;
-    } 
+       my $SubDir = shift;
+       
+       ChangeDir( "$BuildDir/llvm/projects/llvm-test/$SubDir", "Programs Test Subdirectory" ) || return ("", "");
+       
+       my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
+       
+       # Run the programs tests... creating a report.nightly.csv file
+       if (!$NOTEST) {
+               print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
+          "TEST=nightly > $ProgramTestLog 2>&1\n";
+               system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
+           "TEST=nightly > $ProgramTestLog 2>&1";
+         $llcbeta_options=`$MAKECMD print-llcbeta-option`;
+       } 
     
-    my $ProgramsTable;
-    if (`grep '^make[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
-       $TestError = 1;
-       $ProgramsTable="Error running test $SubDir\n";
-       print "ERROR TESTING\n";
-    } elsif (`grep '^make[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
-       $TestError = 1;
-       $ProgramsTable="Makefile error running tests $SubDir!\n";
-       print "ERROR TESTING\n";
-    } else {
-       $TestError = 0;
+  my $ProgramsTable;
+  if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
+    $TestError = 1;
+    $ProgramsTable="Error running test $SubDir\n";
+    print "ERROR TESTING\n";
+  } elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
+    $TestError = 1;
+    $ProgramsTable="Makefile error running tests $SubDir!\n";
+    print "ERROR TESTING\n";
+  } else {
+    $TestError = 0;
+    #
+    # Create a list of the tests which were run...
+    #
+    system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
+           "| sort > $Prefix-multisourceprogramstable.txt";
+  }
+  $ProgramsTable = ReadFile "report.nightly.csv";
 
-       #
-       # Create a list of the tests which were run...
-       #
-       system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
-       . "| sort > $Prefix-multisourceprogramstable.txt";
-    }
-    $ProgramsTable = ReadFile "report.nightly.csv";
-    
-    ChangeDir( "../../..", "Programs Test Parent Directory" );
-    return ($ProgramsTable, $llcbeta_options);
+  ChangeDir( "../../..", "Programs Test Parent Directory" );
+  return ($ProgramsTable, $llcbeta_options);
 }
 
-$patrickjenkins=1;
-if(!$patrickjenkins){
-    if ( $VERBOSE ) {
-        print "Modified Multisource Olden test stage\n";
-    }
-    ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource/");
-    ChangeDir( "../../..", "Programs Test Parent Directory" );
-    
-
-    WriteFile "$WebDir/multisourceprogramstable.txt", $MultiSourceProgramsTable;
-}
-if (!$BuildError && $patrickjenkins) {
-    if ( $VERBOSE ) {
-       print "SingleSource TEST STAGE\n";
-    }
-    ($SingleSourceProgramsTable, $singlesource_llcbeta_options) = TestDirectory("SingleSource");
-    WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
-    if ( $VERBOSE ) {
-       print "MultiSource TEST STAGE\n";
-    }
-    ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource");
-    WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable;
-    if ( ! $NOEXTERNALS ) {
+if (!$BuildError) {
        if ( $VERBOSE ) {
-           print "External TEST STAGE\n";
+    print "SingleSource TEST STAGE\n";
        }
-       ($ExternalProgramsTable, $externalsource_llcbeta_options) = TestDirectory("External");
-       system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
-           " $Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt";
-    } else {
-       $ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
+       ($SingleSourceProgramsTable, $llcbeta_options) = TestDirectory("SingleSource");
        if ( $VERBOSE ) {
-           print "External TEST STAGE SKIPPED\n";
+    print "SingleSource returned $SingleSourceProgramsTable\n";
        }
-       system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
-           " | sort > $Prefix-Tests.txt";
-    }
-    WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
-
+       WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
+       if ( $VERBOSE ) {
+         print "MultiSource TEST STAGE\n";
+       }
+       ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource");
+       WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable;
+       if ( $VERBOSE ) {
+         print "MultiSource returned $MultiSourceProgramsTable\n";
+       }
+       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";
+       } else {
+         $ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
+         if ( $VERBOSE ) {
+                 print "External TEST STAGE SKIPPED\n";
+         }
+         system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
+                      " | sort > $Prefix-Tests.txt";
+       }
+       WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
 }
 
 ##############################################################
@@ -804,50 +862,71 @@ if (!$BuildError && $patrickjenkins) {
 #
 #
 ##############################################################
-my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
-
-if ($TestError) {
-    $TestsAdded   = "<b>error testing</b><br>";
-    $TestsRemoved = "<b>error testing</b><br>";
-    $TestsFixed   = "<b>error testing</b><br>";
-    $TestsBroken  = "<b>error testing</b><br>";
-} else {
-    my ($RTestsAdded, $RTestsRemoved) = DiffFiles "$Prefix-Tests.txt";
-
-    my @RawTestsAddedArray = split '\n', $RTestsAdded;
-    my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
-
-    my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
-    @RawTestsRemovedArray;
-    my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
-    @RawTestsAddedArray;
-
-    foreach $Test (keys %NewTests) {
-       if (!exists $OldTests{$Test}) {  # TestAdded if in New but not old
-           $TestsAdded = "$TestsAdded$Test\n";
-       } else {
-           if ($OldTests{$Test} =~ /TEST-PASS/) {  # Was the old one a pass?
-               $TestsBroken = "$TestsBroken$Test\n";  # New one must be a failure
-           } else {
-               $TestsFixed = "$TestsFixed$Test\n";    # No, new one is a pass.
-           }
-       }
-    }
-    foreach $Test (keys %OldTests) {  # TestRemoved if in Old but not New
-       $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
-    }
+my $dejagnu = ReadFile $DejagnuSum;
+my @DEJAGNU = split "\n", $dejagnu;
 
-    #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);
+my $passes="",
+my $fails="";
+my $xfails="";
 
-    #$TestsAdded   = AddPreTag $TestsAdded;
-    #$TestsRemoved = AddPreTag $TestsRemoved;
-    #$TestsFixed   = AddPreTag $TestsFixed;
-    #$TestsBroken  = AddPreTag $TestsBroken;
+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";
+               }
+       }
 }
 
+# my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
+# 
+# if ($TestError) {
+#     $TestsAdded   = "<b>error testing</b><br>";
+#     $TestsRemoved = "<b>error testing</b><br>";
+#     $TestsFixed   = "<b>error testing</b><br>";
+#     $TestsBroken  = "<b>error testing</b><br>";
+# } else {
+#     my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
+# 
+#     my @RawTestsAddedArray = split '\n', $RTestsAdded;
+#     my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
+# 
+#     my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
+#     @RawTestsRemovedArray;
+#     my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
+#     @RawTestsAddedArray;
+# 
+#     foreach $Test (keys %NewTests) {
+#                      if (!exists $OldTests{$Test}) {  # TestAdded if in New but not old
+#              $TestsAdded = "$TestsAdded$Test\n";
+#                      } else {
+#          if ($OldTests{$Test} =~ /TEST-PASS/) {  # Was the old one a pass?
+#                              $TestsBroken = "$TestsBroken$Test\n";  # New one must be a failure
+#          } else {
+#                              $TestsFixed = "$TestsFixed$Test\n";    # No, new one is a pass.
+#          }
+#              }
+#      }
+#      foreach $Test (keys %OldTests) {  # TestRemoved if in Old but not New
+#              $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
@@ -863,13 +942,13 @@ if (!$BuildError) {
                   "Olden Test Directory");
 
        # Clean out previous results...
-       system "$NICE make $MAKEOPTS clean > /dev/null 2>&1";
+       system "$NICE $MAKECMD $MAKEOPTS clean > /dev/null 2>&1";
        
        # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
        # GET_STABLE_NUMBERS enabled!
-       if( $VERBOSE ) { print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
+       if( $VERBOSE ) { print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
                             " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1\n"; }
-       system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
+       system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
            " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
        system "cp report.nightly.csv $OldenTestsLog";
     } #else {
@@ -910,6 +989,13 @@ if (!$BuildError) {
     #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir);
 }
 
+##############################################################
+#
+# Getting end timestamp
+#
+##############################################################
+$endtime = `date "+20%y-%m-%d %H:%M:%S"`;
+
 
 ##############################################################
 #
@@ -950,10 +1036,20 @@ 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];
 
+$all_tests = ReadFile, "$Prefix-Tests.txt";
+
 ##############################################################
 #
 # Send data via a post request
@@ -966,40 +1062,45 @@ if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
 my $host = "llvm.org";
 my $file = "/nightlytest/NightlyTestAccept.cgi";
 my %hash_of_data = ('machine_data' => $machine_data,
-              'build_data' => $build_data,
-               'gcc_version' => $gcc_version,
-              'nickname' => $nickname,
-              'dejagnutime_wall' => $DejagnuWallTime,
-              'dejagnutime_cpu' => $DejagnuTime,
-              'cvscheckouttime_wall' => $CVSCheckoutTime_Wall,
-              'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU,
-              'configtime_wall' => $ConfigWallTime,
-              'configtime_cpu'=> $ConfigTime,
-              'buildtime_wall' => $BuildWallTime,
-              'buildtime_cpu' => $BuildTime,
-              'warnings' => $WarningsFile,
-              'cvsusercommitlist' => $UserCommitList,
-              'cvsuserupdatelist' => $UserUpdateList,
-              'cvsaddedfiles' => $CVSAddedFiles,
-              'cvsmodifiedfiles' => $CVSModifiedFiles,
-              'cvsremovedfiles' => $CVSRemovedFiles,
-              'lines_of_code' => $LOC,
-              'cvs_file_count' => $NumFilesInCVS,
-              'cvs_dir_count' => $NumDirsInCVS,
-              'buildstatus' => $BuildStatus,
-              'singlesource_programstable' => $SingleSourceProgramsTable,
-               'multisource_programstable' => $MultiSourceProgramsTable,
-               'externalsource_programstable' => $ExternalSourceProgramsTable,
-              'llcbeta_options' => $multisource_llcbeta_options,
-               'warnings_removed' => $WarningsRemoved,
-               'warnings_added' => $WarningsAdded,
-              'newly_passing_tests' => $TestsFixed,
-               'newly_failing_tests' => $TestsBroken,
-               'new_tests' => $TestsAdded,
-               'removed_tests' => $TestsRemoved,
-              'unexpfail_tests' => $unexpfail_tests,
-              'dejagnutests_log' => $dejagnutests_log,
-              'dejagnutests_sum' => $dejagnutests_sum);
+                                                       'build_data' => $build_data,
+                                       'gcc_version' => $gcc_version,
+                                                       'nickname' => $nickname,
+                                                       'dejagnutime_wall' => $DejagnuWallTime,
+                                                                               'dejagnutime_cpu' => $DejagnuTime,
+                                                                               'cvscheckouttime_wall' => $CVSCheckoutTime_Wall,
+                                                                               'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU,
+                                                                               'configtime_wall' => $ConfigWallTime,
+                                                                               'configtime_cpu'=> $ConfigTime,
+                                                                               'buildtime_wall' => $BuildWallTime,
+                                                                               'buildtime_cpu' => $BuildTime,
+                                                                               'warnings' => $WarningsFile,
+                                                                               'cvsusercommitlist' => $UserCommitList,
+                                                                               'cvsuserupdatelist' => $UserUpdateList,
+                                                                               'cvsaddedfiles' => $CVSAddedFiles,
+                                                                               'cvsmodifiedfiles' => $CVSModifiedFiles,
+                                                                               'cvsremovedfiles' => $CVSRemovedFiles,
+                                                                               'lines_of_code' => $LOC,
+                                                                               'cvs_file_count' => $NumFilesInCVS,
+                                                                               'cvs_dir_count' => $NumDirsInCVS,
+                                                                               'buildstatus' => $BuildStatus,
+                                                                               'singlesource_programstable' => $SingleSourceProgramsTable,
+                                                                               'multisource_programstable' => $MultiSourceProgramsTable,
+                                                                               'externalsource_programstable' => $ExternalProgramsTable,
+                                                                               'llcbeta_options' => $multisource_llcbeta_options,
+                                                                               'warnings_removed' => $WarningsRemoved,
+                                                                               'warnings_added' => $WarningsAdded,
+                                                                               'passing_tests' => $passes,
+                                                                               'expfail_tests' => $xfails,
+                                                                               'unexpfail_tests' => $fails,
+                                                                               'all_tests' => $all_tests,
+                                                                               'new_tests' => "",
+                                                                               'removed_tests' => "",
+                                                                               'dejagnutests_log' => $dejagnutests_log,
+                                                                               'dejagnutests_sum' => $dejagnutests_sum,
+                                                                               'starttime' => $starttime,
+                                                                               'endtime' => $endtime,
+                                                                               'o_file_sizes' => $o_file_sizes,
+                                                                               'a_file_sizes' => $a_file_sizes);
 
 $TESTING = 0;
 
@@ -1020,5 +1121,6 @@ else{
 #
 ##############################################################
 system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
+system ( "$NICE rm -rf $WebDir") if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);