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