Fixing a syntax error and adding buildtype to the .a and .o file size information.
[oota-llvm.git] / utils / NewNightlyTest.pl
1 #!/usr/bin/perl
2 use POSIX qw(strftime);
3 use File::Copy;
4 use Socket;
5
6 #
7 # Program:  NewNightlyTest.pl
8 #
9 # Synopsis: Perform a series of tests which are designed to be run nightly.
10 #           This is used to keep track of the status of the LLVM tree, tracking
11 #           regressions and performance changes. Submits this information 
12 #           to llvm.org where it is placed into the nightlytestresults database. 
13 #
14 # Modified heavily by Patrick Jenkins, July 2006
15 #
16 # Syntax:   NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR]
17 #   where
18 # OPTIONS may include one or more of the following:
19 #  -nocheckout      Do not create, checkout, update, or configure
20 #                   the source tree.
21 #  -noremove        Do not remove the BUILDDIR after it has been built.
22 #  -noremoveresults Do not remove the WEBDIR after it has been built.
23 #  -nobuild         Do not build llvm. If tests are enabled perform them
24 #                   on the llvm build specified in the build directory
25 #  -notest          Do not even attempt to run the test programs. Implies
26 #                   -norunningtests.
27 #  -norunningtests  Do not run the Olden benchmark suite with
28 #                   LARGE_PROBLEM_SIZE enabled.
29 #  -nodejagnu       Do not run feature or regression tests
30 #  -parallel        Run two parallel jobs with GNU Make.
31 #  -release         Build an LLVM Release version
32 #  -enable-llcbeta  Enable testing of beta features in llc.
33 #  -disable-llc     Disable LLC tests in the nightly tester.
34 #  -disable-jit     Disable JIT tests in the nightly tester.
35 #  -disable-cbe     Disable C backend tests in the nightly tester.
36 #  -verbose         Turn on some debug output
37 #  -debug           Print information useful only to maintainers of this script.
38 #  -nice            Checkout/Configure/Build with "nice" to reduce impact
39 #                   on busy servers.
40 #  -f2c             Next argument specifies path to F2C utility
41 #  -nickname        The next argument specifieds the nickname this script
42 #                   will submit to the nightlytest results repository.
43 #  -gccpath         Path to gcc/g++ used to build LLVM
44 #  -cvstag          Check out a specific CVS tag to build LLVM (useful for
45 #                   testing release branches)
46 #  -target          Specify the target triplet
47 #  -cflags          Next argument specifies that C compilation options that
48 #                   override the default.
49 #  -cxxflags        Next argument specifies that C++ compilation options that
50 #                   override the default.
51 #  -ldflags         Next argument specifies that linker options that override
52 #                   the default.
53 #  -compileflags    Next argument specifies extra options passed to make when
54 #                   building LLVM.
55 #
56 #  ---------------- Options to configure llvm-test ----------------------------
57 #  -extraflags      Next argument specifies extra options that are passed to
58 #                   compile the tests.
59 #  -noexternals     Do not run the external tests (for cases where povray
60 #                   or SPEC are not installed)
61 #  -with-externals  Specify a directory where the external tests are located.
62 #
63 # CVSROOT is the CVS repository from which the tree will be checked out,
64 #  specified either in the full :method:user@host:/dir syntax, or
65 #  just /dir if using a local repo.
66 # BUILDDIR is the directory where sources for this test run will be checked out
67 #  AND objects for this test run will be built. This directory MUST NOT
68 #  exist before the script is run; it will be created by the cvs checkout
69 #  process and erased (unless -noremove is specified; see above.)
70 # WEBDIR is the directory into which the test results web page will be written,
71 #  AND in which the "index.html" is assumed to be a symlink to the most recent
72 #  copy of the results. This directory will be created if it does not exist.
73 # LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
74 #  to. This is the same as you would have for a normal LLVM build.
75 #
76 ##############################################################
77 #
78 # Getting environment variables
79 #
80 ##############################################################
81 my $HOME = $ENV{'HOME'};
82 my $CVSRootDir = $ENV{'CVSROOT'};
83    $CVSRootDir = "/home/vadve/shared/PublicCVS"
84     unless $CVSRootDir;
85 my $BuildDir   = $ENV{'BUILDDIR'};
86    $BuildDir   = "$HOME/buildtest"
87     unless $BuildDir;
88 my $WebDir     = $ENV{'WEBDIR'};
89    $WebDir     = "$HOME/cvs/testresults-X86"
90     unless $WebDir;
91
92 ##############################################################
93 #
94 # Calculate the date prefix...
95 #
96 ##############################################################
97 @TIME = localtime;
98 my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
99 my $DateString = strftime "%B %d, %Y", localtime;
100 my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
101
102 ##############################################################
103 #
104 # Parse arguments...
105 #
106 ##############################################################
107 $CONFIGUREARGS="";
108 $nickname="";
109 $NOTEST=0;
110 $NORUNNINGTESTS=0;
111
112 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
113     shift;
114     last if /^--$/;  # Stop processing arguments on --
115
116   # List command line options here...
117     if (/^-nocheckout$/)     { $NOCHECKOUT = 1; next; }
118     if (/^-nocvsstats$/)     { $NOCVSSTATS = 1; next; }
119     if (/^-noremove$/)       { $NOREMOVE = 1; next; }
120     if (/^-noremoveresults$/) { $NOREMOVERESULTS = 1; next; }
121     if (/^-notest$/)         { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
122     if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
123     if (/^-parallel$/)       { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
124     if (/^-release$/)        { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
125                                                    "OPTIMIZE_OPTION=-O2"; 
126                                                    $BUILDTYPE="release"; next; }
127     if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
128     if (/^-disable-llc$/)    { $PROGTESTOPTS .= " DISABLE_LLC=1";
129                                $CONFIGUREARGS .= " --disable-llc_diffs"; next; } 
130     if (/^-disable-jit$/)    { $PROGTESTOPTS .= " DISABLE_JIT=1";
131                                $CONFIGUREARGS .= " --disable-jit"; next; }
132     if (/^-verbose$/)        { $VERBOSE = 1; next; }
133     if (/^-debug$/)          { $DEBUG = 1; next; }
134     if (/^-nice$/)           { $NICE = "nice "; next; }
135     if (/^-f2c$/)            {
136         $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
137     }
138     if (/^-with-externals/)  {
139         $CONFIGUREARGS .= "--with-externals=$ARGV[0]"; shift; next;
140     }
141     if (/^-nickname$/)          { $nickname = "$ARGV[0]"; shift; next; }
142     if (/^-gccpath/)         { $CONFIGUREARGS .= 
143                                                                                                            " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; 
144                                $GCCPATH=$ARGV[0]; 
145                                shift;  
146                                next;}
147     else{ $GCCPATH=""; }
148     if (/^-cvstag/)          { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; } 
149     else{ $CVSCOOPT="";}
150     if (/^-target/)          {
151         $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next;
152     }
153     if (/^-cflags/)          {
154         $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; shift; next;
155     }
156     if (/^-cxxflags/)        {
157         $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; shift; next;
158     }
159     if (/^-ldflags/)         {
160         $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; shift; next;
161     }
162     if (/^-compileflags/)    {
163         $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next;
164     }
165     if (/^-extraflags/)      {
166         $PROGTESTOPTS .= " EXTRA_FLAGS=\'$ARGV[0]\'"; shift; next;
167     }
168     if (/^-noexternals$/)    { $NOEXTERNALS = 1; next; }
169     if (/^-nodejagnu$/)      { $NODEJAGNU = 1; next; }
170     if (/^-nobuild$/)        { $NOBUILD = 1; next; }
171     print "Unknown option: $_ : ignoring!\n";
172 }
173
174 if ($ENV{'LLVMGCCDIR'}) {
175     $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
176 }
177 if ($CONFIGUREARGS !~ /--disable-jit/) {
178     $CONFIGUREARGS .= " --enable-jit";
179 }
180
181 die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
182
183 if (@ARGV == 3) {
184     $CVSRootDir = $ARGV[0];
185     $BuildDir   = $ARGV[1];
186     $WebDir     = $ARGV[2];
187 }
188
189 if($nickname eq ""){
190         die ("Please invoke NewNightlyTest.pl with command line option \"-nickname <nickname>\"");
191 }
192 if($BUILDTYPE ne "releaese"){
193         $BUILDTYPE = "debug";
194 }
195
196 ##############################################################
197 #
198 #define the file names we'll use
199 #
200 ##############################################################
201 my $Prefix = "$WebDir/$DATE";
202 my $BuildLog = "$Prefix-Build-Log.txt";
203 my $CVSLog = "$Prefix-CVS-Log.txt";
204 my $OldenTestsLog = "$Prefix-Olden-tests.txt";
205 my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
206 my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
207 my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
208 my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
209 my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
210 my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
211 if (! -d $WebDir) {
212     mkdir $WebDir, 0777;
213     warn "$WebDir did not exist; creating it.\n";
214 }
215
216 if ($VERBOSE) {
217     print "INITIALIZED\n";
218     print "CVS Root = $CVSRootDir\n";
219     print "BuildDir = $BuildDir\n";
220     print "WebDir   = $WebDir\n";
221     print "Prefix   = $Prefix\n";
222     print "CVSLog   = $CVSLog\n";
223     print "BuildLog = $BuildLog\n";
224 }
225
226 ##############################################################
227 #
228 # Helper functions
229 #
230 ##############################################################
231 sub GetDir {
232     my $Suffix = shift;
233     opendir DH, $WebDir;
234     my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
235     closedir DH;
236     return @Result;
237 }
238
239 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
240 #
241 # DiffFiles - Diff the current version of the file against the last version of
242 # the file, reporting things added and removed.  This is used to report, for
243 # example, added and removed warnings.  This returns a pair (added, removed)
244 #
245 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
246 sub DiffFiles {
247     my $Suffix = shift;
248     my @Others = GetDir $Suffix;
249     if (@Others == 0) {  # No other files?  We added all entries...
250         return (`cat $WebDir/$DATE$Suffix`, "");
251     }
252   # Diff the files now...
253     my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
254     my $Added   = join "\n", grep /^</, @Diffs;
255     my $Removed = join "\n", grep /^>/, @Diffs;
256     $Added =~ s/^< //gm;
257     $Removed =~ s/^> //gm;
258     return ($Added, $Removed);
259 }
260
261 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
263 sub GetRegex {   # (Regex with ()'s, value)
264     $_[1] =~ /$_[0]/m;
265     if (defined($1)) {
266         return $1;
267     }
268     return "0";
269 }
270
271 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
273 sub GetRegexNum {
274     my ($Regex, $Num, $Regex2, $File) = @_;
275     my @Items = split "\n", `grep '$Regex' $File`;
276     return GetRegex $Regex2, $Items[$Num];
277 }
278
279 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
280 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281 sub ChangeDir { # directory, logical name
282     my ($dir,$name) = @_;
283     chomp($dir);
284     if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
285     chdir($dir) || (print "Cannot change directory to: $name ($dir) " && return -1);
286     return 0;
287 }
288
289 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
291 sub ReadFile {
292     if (open (FILE, $_[0])) {
293         undef $/;
294         my $Ret = <FILE>;
295         close FILE;
296         $/ = '\n';
297         return $Ret;
298     } else {
299         print "Could not open file '$_[0]' for reading!\n";
300         return "";
301     }
302 }
303
304 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
305 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
306 sub WriteFile {  # (filename, contents)
307     open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n";
308     print FILE $_[1];
309     close FILE;
310 }
311
312 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
313 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314 sub CopyFile { #filename, newfile
315     my ($file, $newfile) = @_;
316     chomp($file);
317     if ($VERBOSE) { print "Copying $file to $newfile\n"; }
318     copy($file, $newfile);
319 }
320
321 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
322 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
323 sub AddRecord {
324     my ($Val, $Filename,$WebDir) = @_;
325     my @Records;
326     if (open FILE, "$WebDir/$Filename") {
327         @Records = grep !/$DATE/, split "\n", <FILE>;
328         close FILE;
329     }
330     push @Records, "$DATE: $Val";
331     WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
332 }
333
334 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
335 #
336 # FormatTime - Convert a time from 1m23.45 into 83.45
337 #
338 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
339 sub FormatTime {
340     my $Time = shift;
341     if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
342         $Time = sprintf("%7.4f", $1*60.0+$2);
343     }
344     return $Time;
345 }
346
347 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
348 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
349 sub GetDejagnuTestResults { # (filename, log)
350     my ($filename, $DejagnuLog) = @_;
351     my @lines;
352     my $firstline;
353     $/ = "\n"; #Make sure we're going line at a time.
354
355     print "DEJAGNU TEST RESULTS:\n";
356
357     if (open SRCHFILE, $filename) {
358     # Process test results
359         my $first_list = 1;
360         my $should_break = 1;
361         my $nocopy = 0;
362         my $readingsum = 0;
363         while ( <SRCHFILE> ) {
364             if ( length($_) > 1 ) {
365                 chomp($_);
366                 if ( m/^XPASS:/ || m/^FAIL:/ ) {
367                     $nocopy = 0;
368                     if ( $first_list ) {
369                         push(@lines, "UNEXPECTED TEST RESULTS\n");
370                         $first_list = 0;
371                         $should_break = 1;
372                         push(@lines, "$_\n");
373                         print "  $_\n";
374                     } else {
375                         push(@lines, "$_\n");
376                         print "  $_\n";
377                     }
378                 } #elsif ( m/Summary/ ) {
379                 #    if ( $first_list ) {
380                 #       push(@lines, "PERFECT!");
381                 #       print "  PERFECT!\n";
382                 #    } else {
383                 #       push(@lines, "</li></ol>\n");
384                 #    }
385                 #    push(@lines, "STATISTICS\n");
386                 #    print "\nDEJAGNU STATISTICS:\n";
387                 #    $should_break = 0;
388                 #    $nocopy = 0;
389                 #    $readingsum = 1;
390                 #} 
391                 elsif ( $readingsum ) {
392                     push(@lines,"$_\n");
393                     print "  $_\n";
394                 }
395
396             }
397         }
398     }
399     close SRCHFILE;
400
401     my $content = join("", @lines);
402     return $content;
403 }
404
405
406 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
407 #
408 # This function acts as a mini web browswer submitting data
409 # to our central server via the post method
410 #
411 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
412 sub SendData{
413     $host = $_[0];
414     $file = $_[1];
415     $variables=$_[2];
416
417     $port=80;
418     $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n";
419     socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or 
420                          die "Bad socket\n";
421     connect SOCK, $socketaddr or die "Bad connection\n";
422     select((select(SOCK), $| = 1)[0]);
423
424     #creating content here
425     my $content;
426     foreach $key (keys (%$variables)){
427         $value = $variables->{$key};
428         $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
429         $content .= "$key=$value&";
430     }
431
432     $length = length($content);
433
434     my $send= "POST $file HTTP/1.0\n";
435     $send.= "Content-Type: application/x-www-form-urlencoded\n";
436     $send.= "Content-length: $length\n\n";
437     $send.= "$content";
438
439     print SOCK $send;
440     my $result;
441     while(<SOCK>){
442         $result  .= $_;
443     }
444     close(SOCK);
445
446     my $sentdata="";
447     foreach $x (keys (%$variables)){
448         $value = $variables->{$x};
449         $sentdata.= "$x  => $value\n";
450     }
451     WriteFile "$Prefix-sentdata.txt", $sentdata;
452     
453
454     return $result;
455 }
456
457 ##############################################################
458 #
459 # Getting Start timestamp
460 #
461 ##############################################################
462 $starttime = `date "+20%y-%m-%d %H:%M:%S"`;
463
464 ##############################################################
465 #
466 # Create the CVS repository directory
467 #
468 ##############################################################
469 if (!$NOCHECKOUT) {
470     if (-d $BuildDir) {
471         if (!$NOREMOVE) {
472                 if ( $VERBOSE ){
473                         print "Build directory exists! Removing it\n";
474                 }
475             system "rm -rf $BuildDir";
476         } else {
477             die "CVS checkout directory $BuildDir already exists!";
478         }
479     }
480     mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
481 }
482 ChangeDir( $BuildDir, "CVS checkout directory" );
483
484
485 ##############################################################
486 #
487 # Check out the llvm tree, saving CVS messages to the cvs log...
488 #
489 ##############################################################
490 my $CVSOPT = "";
491 # Use compression if going over ssh.
492 $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
493 my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
494 if (!$NOCHECKOUT) {
495     if ( $VERBOSE ) 
496     { 
497         print "CHECKOUT STAGE:\n"; 
498         print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) > $CVSLog 2>&1\n";
499     }
500     system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
501         "$CVSCMD llvm-test ) > $CVSLog 2>&1";
502     ChangeDir( $BuildDir , "CVS Checkout directory") ;
503 }
504 ChangeDir( "llvm" , "llvm source directory") ;
505 if (!$NOCHECKOUT) {
506     if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
507     system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
508 }
509
510 ##############################################################
511 #
512 # Get some static statistics about the current state of CVS
513 #
514 # This can probably be put on the server side
515 #
516 ##############################################################
517 my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
518 my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`;
519 my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`;
520 my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
521
522 my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
523 my $NumDirsInCVS  = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
524 my $LOC = `utils/countloc.sh`;
525
526 ##############################################################
527 #
528 # Extract some information from the CVS history... use a hash so no duplicate
529 # stuff is stored. This gets the history from the previous days worth
530 # of cvs activit and parses it.
531 #
532 ##############################################################
533
534 my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
535
536 if(!$NOCVSSTATS){
537
538 if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
539 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
540 #print join "\n", @CVSHistory; print "\n";
541
542 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
543
544 # Loop over every record from the CVS history, filling in the hashes.
545 foreach $File (@CVSHistory) {
546     my ($Type, $Date, $UID, $Rev, $Filename);
547     if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
548         ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
549     } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
550         ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
551     } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
552         ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
553     } else {
554         print "UNMATCHABLE: $File\n";
555         next;
556     }
557     # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
558     
559     if ($Filename =~ /^llvm/) {
560         if ($Type eq 'M') {        # Modified
561             $ModifiedFiles{$Filename} = 1;
562             $UsersCommitted{$UID} = 1;
563         } elsif ($Type eq 'A') {   # Added
564             $AddedFiles{$Filename} = 1;
565             $UsersCommitted{$UID} = 1;
566         } elsif ($Type eq 'R') {   # Removed
567             $RemovedFiles{$Filename} = 1;
568             $UsersCommitted{$UID} = 1;
569         } else {
570             $UsersUpdated{$UID} = 1;
571         }
572     }
573 }
574
575 my $TestError = 1;
576
577 }#!NOCVSSTATS
578
579 my $CVSAddedFiles = join "\n", sort keys %AddedFiles;
580 my $CVSModifiedFiles = join "\n", sort keys %ModifiedFiles;
581 my $CVSRemovedFiles = join "\n", sort keys %RemovedFiles;
582 my $UserCommitList = join "\n", sort keys %UsersCommitted;
583 my $UserUpdateList = join "\n", sort keys %UsersUpdated;
584
585 ##############################################################
586 #
587 # Build the entire tree, saving build messages to the build log
588 #
589 ##############################################################
590 if (!$NOCHECKOUT && !$NOBUILD) {
591     my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
592     if ( $VERBOSE ){
593         print "CONFIGURE STAGE:\n";
594         print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1\n";
595     }
596     system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
597     if ( $VERBOSE ) 
598     { 
599         print "BUILD STAGE:\n";
600         print "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1\n";
601     }
602     # Build the entire tree, capturing the output into $BuildLog
603     system "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1";
604 }
605
606
607 ##############################################################
608 #
609 # Get some statistics about the build...
610 #
611 ##############################################################
612 #this can de done on server
613 #my @Linked = split '\n', `grep Linking $BuildLog`;
614 #my $NumExecutables = scalar(grep(/executable/, @Linked));
615 #my $NumLibraries   = scalar(grep(!/executable/, @Linked));
616 #my $NumObjects     = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
617
618
619 my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
620 my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
621 my $ConfigTime  = $ConfigTimeU+$ConfigTimeS;  # ConfigTime = User+System
622 my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
623
624 $ConfigTime=-1 unless $ConfigTime;
625 $ConfigWallTime=-1 unless $ConfigWallTime;
626
627 my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
628 my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
629 my $BuildTime  = $BuildTimeU+$BuildTimeS;  # BuildTime = User+System
630 my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
631
632 $BuildTime=-1 unless $BuildTime;
633 $BuildWallTime=-1 unless $BuildWallTime;
634
635 my $BuildError = 0, $BuildStatus = "OK";
636 if($NOBUILD){
637     $BuildStatus = "Skipped by user";
638     $BuildError = 1;
639 }
640 elsif (`grep '^make[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
641     `grep '^make: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
642     $BuildStatus = "Error: compilation aborted";
643     $BuildError = 1;
644     print  "\n***ERROR BUILDING TREE\n\n";
645 }
646 if ($BuildError) { $NODEJAGNU=1; }
647
648 my $a_file_sizes="";
649 my $o_file_sizes="";
650 if(!$BuildError){
651         if ( $VERBOSE ){
652         print "Organizing size of .o and .a files\n";
653     }
654         ChangeDir( "$BuildDir/llvm", "Build Directory" );
655         $afiles = `find . -iname '*.a' -ls`;
656         $ofiles = `find . -iname '*.o' -ls`;
657         @AFILES = split "\n", $afiles;
658         $a_file_sizes="";
659         foreach $x (@AFILES){
660           $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
661           $a_file_sizes.="$1 $2 $BUILDTYPE\n";
662         }       
663         @OFILES = split "\n", $ofiles;
664         $o_file_sizes="";
665         foreach $x (@OFILES){
666           $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
667           $o_file_sizes.="$1 $2 $BUILDTYPE\n";
668         }
669 }
670 else{
671         $a_file_sizes="No data due to a bad build.";
672         $o_file_sizes="No data due to a bad build.";
673 }
674
675
676 ##############################################################
677 #
678 # Running dejagnu tests
679 #
680 ##############################################################
681 my $DejangnuTestResults; # String containing the results of the dejagnu
682 my $dejagnu_output = "$DejagnuTestsLog";
683 if(!$NODEJAGNU) {
684     if($VERBOSE) 
685     { 
686         print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n"; 
687         print "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1\n";
688     }
689
690     #Run the feature and regression tests, results are put into testrun.sum
691     #Full log in testrun.log
692     system "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1";
693     
694     #Copy the testrun.log and testrun.sum to our webdir
695     CopyFile("test/testrun.log", $DejagnuLog);
696     CopyFile("test/testrun.sum", $DejagnuSum);
697     #can be done on server
698     $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
699     $unexpfail_tests = $DejagnuTestResults;
700 }
701 #Extract time of dejagnu tests
702 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
703 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
704 $DejagnuTime  = $DejagnuTimeU+$DejagnuTimeS;  # DejagnuTime = User+System
705 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output"; 
706 $DejagnuTestResults = "Dejagnu skipped by user choice." unless $DejagnuTestResults;
707 $DejagnuTime     = "0.0" unless $DejagnuTime;
708 $DejagnuWallTime = "0.0" unless $DejagnuWallTime;
709
710 if ($DEBUG) {
711     print $DejagnuTestResults;
712 }    
713
714 ##############################################################
715 #
716 # Get warnings from the build
717 #
718 ##############################################################
719 if(!$NODEJAGNU){
720
721 if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
722 my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
723 my @Warnings;
724 my $CurDir = "";
725
726 foreach $Warning (@Warn) {
727     if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
728         $CurDir = $1;                 # Keep track of directory warning is in...
729         if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
730             $CurDir = $1;
731         }
732     } else {
733         push @Warnings, "$CurDir/$Warning";     # Add directory to warning...
734     }
735 }
736 my $WarningsFile =  join "\n", @Warnings;
737 $WarningsFile =~ s/:[0-9]+:/::/g;
738
739 # Emit the warnings file, so we can diff...
740 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
741 my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
742
743 # Output something to stdout if something has changed
744 #print "ADDED   WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
745 #print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
746
747 #my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade
748 #my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade
749
750 } #endif !NODEGAGNU
751
752 ##############################################################
753 #
754 # If we built the tree successfully, run the nightly programs tests...
755 #
756 # A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" "External")
757 #
758 ##############################################################
759 sub TestDirectory {
760     my $SubDir = shift;
761     
762     ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" ) || return ("", "");
763
764     my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
765     #my $ProgramTestLog = "$Prefix-MultiSource-ProgramTest.txt"; #CHANGE ME!
766     
767     # Run the programs tests... creating a report.nightly.csv file
768     if (!$NOTEST) {
769         print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
770             . "TEST=nightly > $ProgramTestLog 2>&1\n";
771         system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
772             . "TEST=nightly > $ProgramTestLog 2>&1";
773         $llcbeta_options=`make print-llcbeta-option`;
774     } 
775     
776     my $ProgramsTable;
777     if (`grep '^make[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
778         $TestError = 1;
779         $ProgramsTable="Error running test $SubDir\n";
780         print "ERROR TESTING\n";
781     } elsif (`grep '^make[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
782         $TestError = 1;
783         $ProgramsTable="Makefile error running tests $SubDir!\n";
784         print "ERROR TESTING\n";
785     } else {
786         $TestError = 0;
787
788         #
789         # Create a list of the tests which were run...
790         #
791         system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
792         . "| sort > $Prefix-multisourceprogramstable.txt";
793     }
794     $ProgramsTable = ReadFile "report.nightly.csv";
795     
796     ChangeDir( "../../..", "Programs Test Parent Directory" );
797     return ($ProgramsTable, $llcbeta_options);
798 }
799
800 $patrickjenkins=1;
801 if(!$patrickjenkins){
802     if ( $VERBOSE ) {
803         print "Modified Multisource Olden test stage\n";
804     }
805     ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource/");
806     ChangeDir( "../../..", "Programs Test Parent Directory" );
807     
808
809     WriteFile "$WebDir/multisourceprogramstable.txt", $MultiSourceProgramsTable;
810 }
811 if (!$BuildError && $patrickjenkins) {
812     if ( $VERBOSE ) {
813         print "SingleSource TEST STAGE\n";
814     }
815     ($SingleSourceProgramsTable, $llcbeta_options) = TestDirectory("SingleSource");
816     WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
817     if ( $VERBOSE ) {
818         print "MultiSource TEST STAGE\n";
819     }
820     ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource");
821     WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable;
822     if ( ! $NOEXTERNALS ) {
823         if ( $VERBOSE ) {
824             print "External TEST STAGE\n";
825         }
826         ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External");
827         WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
828         system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
829             " $Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt";
830     } else {
831         $ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
832         if ( $VERBOSE ) {
833             print "External TEST STAGE SKIPPED\n";
834         }
835         system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
836             " | sort > $Prefix-Tests.txt";
837     }
838     WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
839 }
840
841 ##############################################################
842 #
843
844 # gathering tests added removed broken information here
845 #
846 #
847 ##############################################################
848 my $dejagnu = ReadFile $DejagnuSum;
849 my @DEJAGNU = split "\n", $dejagnu;
850
851 my $passes="",
852 my $fails="";
853 my $xfails="";
854
855 if(!$NODEJAGNU) {
856         for($x=0; $x<@DEJAGNU; $x++){
857                 if($DEJAGNU[$x] =~ m/^PASS:/){
858                         $passes.="$DEJAGNU[$x]\n";
859                 }
860                 elsif($DEJAGNU[$x] =~ m/^FAIL:/){
861                         $fails.="$DEJAGNU[$x]\n";
862                 }
863                 elsif($DEJAGNU[$x] =~ m/^XFAIL:/){
864                         $xfails.="$DEJAGNU[$x]\n";
865                 }
866         }
867 }
868
869 # my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
870
871 # if ($TestError) {
872 #     $TestsAdded   = "<b>error testing</b><br>";
873 #     $TestsRemoved = "<b>error testing</b><br>";
874 #     $TestsFixed   = "<b>error testing</b><br>";
875 #     $TestsBroken  = "<b>error testing</b><br>";
876 # } else {
877 #     my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
878
879 #     my @RawTestsAddedArray = split '\n', $RTestsAdded;
880 #     my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
881
882 #     my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
883 #     @RawTestsRemovedArray;
884 #     my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
885 #     @RawTestsAddedArray;
886
887 #     foreach $Test (keys %NewTests) {
888 #                       if (!exists $OldTests{$Test}) {  # TestAdded if in New but not old
889 #               $TestsAdded = "$TestsAdded$Test\n";
890 #                       } else {
891 #           if ($OldTests{$Test} =~ /TEST-PASS/) {  # Was the old one a pass?
892 #                               $TestsBroken = "$TestsBroken$Test\n";  # New one must be a failure
893 #           } else {
894 #                               $TestsFixed = "$TestsFixed$Test\n";    # No, new one is a pass.
895 #           }
896 #               }
897 #       }
898 #       foreach $Test (keys %OldTests) {  # TestRemoved if in Old but not New
899 #               $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
900 #       }
901
902 #     #print "\nTESTS ADDED:  \n\n$TestsAdded\n\n"   if (length $TestsAdded);
903 #     #print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
904 #     #print "\nTESTS FIXED:  \n\n$TestsFixed\n\n"   if (length $TestsFixed);
905 #     #print "\nTESTS BROKEN: \n\n$TestsBroken\n\n"  if (length $TestsBroken);
906
907 #     #$TestsAdded   = AddPreTag $TestsAdded;
908 #     #$TestsRemoved = AddPreTag $TestsRemoved;
909 #     #$TestsFixed   = AddPreTag $TestsFixed;
910 #     #$TestsBroken  = AddPreTag $TestsBroken;
911 # }
912
913 ##############################################################
914 #
915 # If we built the tree successfully, runs of the Olden suite with
916 # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
917 #
918 ##############################################################
919 if (!$BuildError) {
920     if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
921     my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
922         $MachCodeSize) = ("","","","","","","");
923     if (!$NORUNNINGTESTS) {
924         ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
925                    "Olden Test Directory");
926
927         # Clean out previous results...
928         system "$NICE make $MAKEOPTS clean > /dev/null 2>&1";
929         
930         # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
931         # GET_STABLE_NUMBERS enabled!
932         if( $VERBOSE ) { print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
933                              " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1\n"; }
934         system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
935             " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
936         system "cp report.nightly.csv $OldenTestsLog";
937     } #else {
938         #system "gunzip ${OldenTestsLog}.gz";
939     #}
940     
941     # Now we know we have $OldenTestsLog as the raw output file.  Split
942     # it up into records and read the useful information.
943     #my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
944     #shift @Records;  # Delete the first (garbage) record
945     
946     # Loop over all of the records, summarizing them into rows for the running
947     # totals file.
948     #my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
949     #foreach $Rec (@Records) {
950         #my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
951         #my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
952         #my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
953         #my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
954         #my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
955         #my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
956         
957         #$NATTime .= " " . FormatTime($rNATTime);
958         #$CBETime .= " " . FormatTime($rCBETime);
959         #$LLCTime .= " " . FormatTime($rLLCTime);
960         #$JITTime .= " " . FormatTime($rJITTime);
961         #$OptTime .= " $rOptTime";
962         #$BytecodeSize .= " $rBytecodeSize";
963     #}
964     #
965     # Now that we have all of the numbers we want, add them to the running totals
966     # files.
967     #AddRecord($NATTime, "running_Olden_nat_time.txt", $WebDir);
968     #AddRecord($CBETime, "running_Olden_cbe_time.txt", $WebDir);
969     #AddRecord($LLCTime, "running_Olden_llc_time.txt", $WebDir);
970     #AddRecord($JITTime, "running_Olden_jit_time.txt", $WebDir);
971     #AddRecord($OptTime, "running_Olden_opt_time.txt", $WebDir);
972     #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir);
973 }
974
975 ##############################################################
976 #
977 # Getting end timestamp
978 #
979 ##############################################################
980 $endtime = `date "+20%y-%m-%d %H:%M:%S"`;
981
982
983 ##############################################################
984 #
985 # Place all the logs neatly into one humungous file
986 #
987 ##############################################################
988
989 if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
990
991 $machine_data = "uname: ".`uname -a`. 
992                 "hardware: ".`uname -m`.
993                 "os: ".`uname -sr`.
994                 "name: ".`uname -n`.
995                 "date: ".`date \"+20%y-%m-%d\"`.
996                 "time: ".`date +\"%H:%M:%S\"`; 
997
998 my @CVS_DATA;
999 my $cvs_data;
1000 @CVS_DATA = ReadFile "$CVSLog";
1001 $cvs_data = join("\n", @CVS_DATA);
1002
1003 my @BUILD_DATA;
1004 my $build_data;
1005 @BUILD_DATA = ReadFile "$BuildLog";
1006 $build_data = join("\n", @BUILD_DATA);
1007
1008 my @DEJAGNU_LOG;
1009 my @DEJAGNU_SUM;
1010 my $dejagnutests_log;
1011 my $dejagnutests_sum;
1012 @DEJAGNU_LOG = ReadFile "$DejagnuLog";
1013 @DEJAGNU_SUM = ReadFile "$DejagnuSum";
1014 $dejagnutests_log = join("\n", @DEJAGNU_LOG);
1015 $dejagnutests_sum = join("\n", @DEJAGNU_SUM);
1016
1017 my @DEJAGNULOG_FULL;
1018 my $dejagnulog_full;
1019 @DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog";
1020 $dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
1021
1022 my $gcc_version_long="";
1023 if($GCCPATH ne ""){
1024   $gcc_version_long = `$GCCPATH/gcc --version`;
1025   print "$GCCPATH/gcc --version\n";
1026 }
1027 else{
1028   $gcc_version_long = `gcc --version`;
1029   print "gcc --version\n";
1030 }
1031 @GCC_VERSION = split '\n', $gcc_version_long;
1032 my $gcc_version = $GCC_VERSION[0];
1033
1034 $all_tests = ReadFile, "$Prefix-Tests.txt";
1035
1036 ##############################################################
1037 #
1038 # Send data via a post request
1039 #
1040 ##############################################################
1041
1042 if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
1043
1044
1045 my $host = "llvm.org";
1046 my $file = "/nightlytest/NightlyTestAccept.cgi";
1047 my %hash_of_data = ('machine_data' => $machine_data,
1048                                                         'build_data' => $build_data,
1049                                 'gcc_version' => $gcc_version,
1050                                                         'nickname' => $nickname,
1051                                                         'dejagnutime_wall' => $DejagnuWallTime,
1052                                                                                 'dejagnutime_cpu' => $DejagnuTime,
1053                                                                                 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall,
1054                                                                                 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU,
1055                                                                                 'configtime_wall' => $ConfigWallTime,
1056                                                                                 'configtime_cpu'=> $ConfigTime,
1057                                                                                 'buildtime_wall' => $BuildWallTime,
1058                                                                                 'buildtime_cpu' => $BuildTime,
1059                                                                                 'warnings' => $WarningsFile,
1060                                                                                 'cvsusercommitlist' => $UserCommitList,
1061                                                                                 'cvsuserupdatelist' => $UserUpdateList,
1062                                                                                 'cvsaddedfiles' => $CVSAddedFiles,
1063                                                                                 'cvsmodifiedfiles' => $CVSModifiedFiles,
1064                                                                                 'cvsremovedfiles' => $CVSRemovedFiles,
1065                                                                                 'lines_of_code' => $LOC,
1066                                                                                 'cvs_file_count' => $NumFilesInCVS,
1067                                                                                 'cvs_dir_count' => $NumDirsInCVS,
1068                                                                                 'buildstatus' => $BuildStatus,
1069                                                                                 'singlesource_programstable' => $SingleSourceProgramsTable,
1070                                                                                 'multisource_programstable' => $MultiSourceProgramsTable,
1071                                                                                 'externalsource_programstable' => $ExternalProgramsTable,
1072                                                                                 'llcbeta_options' => $multisource_llcbeta_options,
1073                                                                                 'warnings_removed' => $WarningsRemoved,
1074                                                                                 'warnings_added' => $WarningsAdded,
1075                                                                                 'passing_tests' => $passes,
1076                                                                                 'expfail_tests' => $xfails,
1077                                                                                 'unexpfail_tests' => $fails,
1078                                                                                 'all_tests' => $all_tests,
1079                                                                                 'new_tests' => "",
1080                                                                                 'removed_tests' => "",
1081                                                                                 'dejagnutests_log' => $dejagnutests_log,
1082                                                                                 'dejagnutests_sum' => $dejagnutests_sum,
1083                                                                                 'starttime' => $starttime,
1084                                                                                 'endtime' => $endtime,
1085                                                                                 'o_file_sizes' => $o_file_sizes,
1086                                                                                 'a_file_sizes' => $a_file_sizes);
1087
1088 $TESTING = 0;
1089
1090 if($TESTING){
1091     print "============================\n";
1092     foreach $x(keys %hash_of_data){
1093         print "$x  => $hash_of_data{$x}\n";
1094     }
1095 }
1096 else{
1097     my $response = SendData $host,$file,\%hash_of_data;
1098     print "============================\n$response";
1099 }
1100
1101 ##############################################################
1102 #
1103 # Remove the cvs tree...
1104 #
1105 ##############################################################
1106 system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
1107 system ( "$NICE rm -rf $WebDir") if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);
1108
1109