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