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