Modified the logic so that library objects with main() are only linked in
[oota-llvm.git] / utils / NightlyTest.pl
1 #!/usr/dcs/software/supported/bin/perl -w
2 #
3 # Program:  NightlyTest.pl
4 #
5 # Synopsis: Perform a series of tests which are designed to be run nightly.
6 #           This is used to keep track of the status of the LLVM tree, tracking
7 #           regressions and performance changes.  This generates one web page a
8 #           day which can be used to access this information.
9 #
10 # Syntax:   NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR]
11 #   where
12 # OPTIONS may include one or more of the following:
13 #  -nocheckout      Do not create, checkout, update, or configure
14 #                   the source tree.
15 #  -noremove        Do not remove the BUILDDIR after it has been built.
16 #  -notest          Do not even attempt to run the test programs. Implies
17 #                   -norunningtests.
18 #  -norunningtests  Do not run the Olden benchmark suite with
19 #                   LARGE_PROBLEM_SIZE enabled.
20 #  -parallel        Run two parallel jobs with GNU Make.
21 #  -enable-linscan  Enable linearscan tests
22 #
23 # CVSROOT is the CVS repository from which the tree will be checked out,
24 #  specified either in the full :method:user@host:/dir syntax, or
25 #  just /dir if using a local repo.
26 # BUILDDIR is the directory where sources for this test run will be checked out
27 #  AND objects for this test run will be built. This directory MUST NOT
28 #  exist before the script is run; it will be created by the cvs checkout
29 #  process and erased (unless -noremove is specified; see above.)
30 # WEBDIR is the directory into which the test results web page will be written,
31 #  AND in which the "index.html" is assumed to be a symlink to the most recent
32 #  copy of the results. This directory MUST exist before the script is run.
33 #
34 use POSIX qw(strftime);
35
36 my $HOME = $ENV{'HOME'};
37 my $CVSRootDir = $ENV{'CVSROOT'};
38    $CVSRootDir = "/home/vadve/shared/PublicCVS"
39     unless $CVSRootDir;
40 my $BuildDir   = "$HOME/buildtest";
41 my $WebDir     = "$HOME/cvs/testresults-X86";
42
43 # Calculate the date prefix...
44 @TIME = localtime;
45 my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
46 my $DateString = strftime "%B %d, %Y", localtime;
47
48 sub ReadFile {
49   undef $/;
50   if (open (FILE, $_[0])) {
51     my $Ret = <FILE>;
52     close FILE;
53     return $Ret;
54   } else {
55     print "Could not open file '$_[0]' for reading!";
56     return "";
57   }
58 }
59
60 sub WriteFile {  # (filename, contents)
61   open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
62   print FILE $_[1];
63   close FILE;
64 }
65
66 sub GetRegex {   # (Regex with ()'s, value)
67   $_[1] =~ /$_[0]/m;
68   if (defined($1)) {
69     return $1;
70   }
71   return "?";
72 }
73
74 sub AddPreTag {  # Add pre tags around nonempty list, or convert to "none"
75   $_ = shift;
76   if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
77 }
78
79 sub GetDir {
80   my $Suffix = shift;
81   opendir DH, $WebDir;
82   my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
83   closedir DH;
84   return @Result;
85 }
86
87 # DiffFiles - Diff the current version of the file against the last version of
88 # the file, reporting things added and removed.  This is used to report, for
89 # example, added and removed warnings.  This returns a pair (added, removed)
90 #
91 sub DiffFiles {
92   my $Suffix = shift;
93   my @Others = GetDir $Suffix;
94   if (@Others == 0) {  # No other files?  We added all entries...
95     return (`cat $WebDir/$DATE$Suffix`, "");
96   }
97   # Diff the files now...
98   my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
99   my $Added   = join "\n", grep /^</, @Diffs;
100   my $Removed = join "\n", grep /^>/, @Diffs;
101   $Added =~ s/^< //gm;
102   $Removed =~ s/^> //gm;
103   return ($Added, $Removed);
104 }
105
106 # FormatTime - Convert a time from 1m23.45 into 83.45
107 sub FormatTime {
108   my $Time = shift;
109   if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
110     $Time = sprintf("%7.4f", $1*60.0+$2);
111   }
112   return $Time;
113 }
114
115
116 # Command line argument settings...
117 my $NOCHECKOUT = 0;
118 my $NOREMOVE   = 0;
119 my $NOTEST     = 0;
120 my $NORUNNINGTESTS = 0;
121 my $MAKEOPTS   = "";
122 my $ENABLELINEARSCAN = "";
123
124 # Parse arguments...
125 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
126   shift;
127   last if /^--$/;  # Stop processing arguments on --
128
129   # List command line options here...
130   if (/^-nocheckout$/)     { $NOCHECKOUT = 1; next; }
131   if (/^-noremove$/)       { $NOREMOVE   = 1; next; }
132   if (/^-notest$/)         { $NOTEST     = 1; $NORUNNINGTESTS = 1; next; }
133   if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
134   if (/^-parallel$/)       { $MAKEOPTS   = "-j2 -l3.0"; next; }
135   if (/^-enable-linscan$/) { $ENABLELINEARSCAN = "ENABLE_LINEARSCAN=1"; next; }
136
137   print "Unknown option: $_ : ignoring!\n";
138 }
139
140 die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
141
142 if (@ARGV == 3) {
143   $CVSRootDir = $ARGV[0];
144   $BuildDir   = $ARGV[1];
145   $WebDir     = $ARGV[2];
146 }
147
148 my $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
149 my $Prefix = "$WebDir/$DATE";
150
151 if (0) {
152   print "CVS Root = $CVSRootDir\n";
153   print "BuildDir = $BuildDir\n";
154   print "WebDir   = $WebDir\n";
155   print "Prefix   = $Prefix\n";
156 }
157
158
159 #
160 # Create the CVS repository directory
161 #
162 if (!$NOCHECKOUT) {
163   mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
164 }
165 chdir $BuildDir or die "Could not change to CVS checkout directory $BuildDir!";
166
167
168 #
169 # Check out the llvm tree, saving CVS messages to the cvs log...
170 #
171 $CVSOPT = "";
172 $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
173 system "(time -p cvs $CVSOPT -d $CVSRootDir co llvm) > $Prefix-CVS-Log.txt 2>&1"
174   if (!$NOCHECKOUT);
175
176 chdir "llvm" or die "Could not change into llvm directory!";
177
178 system "cvs up -P -d > /dev/null 2>&1" if (!$NOCHECKOUT);
179
180 # Read in the HTML template file...
181 my $TemplateContents = ReadFile $Template;
182
183
184 #
185 # Get some static statistics about the current state of CVS
186 #
187 my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $Prefix-CVS-Log.txt`;
188 my $NumFilesInCVS = `egrep '^U' $Prefix-CVS-Log.txt | wc -l` + 0;
189 my $NumDirsInCVS  = `egrep '^cvs (checkout|server|update):' $Prefix-CVS-Log.txt | wc -l` + 0;
190 $LOC = GetRegex "([0-9]+) +total", `wc -l \`utils/getsrcs.sh\` | grep total`;
191
192 #
193 # Build the entire tree, saving build messages to the build log
194 #
195 if (!$NOCHECKOUT) {
196   system "(time -p ./configure --enable-jit --enable-spec --with-objroot=.) > $Prefix-Build-Log.txt 2>&1";
197
198   # Build the entire tree, capturing the output into $Prefix-Build-Log.txt
199   system "(time -p gmake $MAKEOPTS) >> $Prefix-Build-Log.txt 2>&1";
200 }
201
202
203 sub GetRegexNum {
204   my ($Regex, $Num, $Regex2, $File) = @_;
205   my @Items = split "\n", `grep '$Regex' $File`;
206   return GetRegex $Regex2, $Items[$Num];
207 }
208
209 #
210 # Get some statistics about the build...
211 #
212 my @Linked = split '\n', `grep Linking $Prefix-Build-Log.txt`;
213 my $NumExecutables = scalar(grep(/executable/, @Linked));
214 my $NumLibraries   = scalar(grep(!/executable/, @Linked));
215 my $NumObjects     = `grep '^Compiling' $Prefix-Build-Log.txt | wc -l` + 0;
216
217 my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$Prefix-Build-Log.txt";
218 my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$Prefix-Build-Log.txt";
219 my $ConfigTime  = $ConfigTimeU+$ConfigTimeS;  # ConfigTime = User+System
220 my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$Prefix-Build-Log.txt";
221
222 my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$Prefix-Build-Log.txt";
223 my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$Prefix-Build-Log.txt";
224 my $BuildTime  = $BuildTimeU+$BuildTimeS;  # BuildTime = User+System
225 my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$Prefix-Build-Log.txt";
226
227 my $BuildError = "";
228 if (`grep '^gmake[^:]*: .*Error' $Prefix-Build-Log.txt | wc -l` + 0 ||
229     `grep '^gmake: \*\*\*.*Stop.' $Prefix-Build-Log.txt | wc -l`+0) {
230   $BuildError = "<h3><font color='red'>Build error: compilation " .
231                 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
232   print "BUILD ERROR\n";
233 }
234
235 #
236 # Get warnings from the build
237 #
238 my @Warn = split "\n", `egrep 'warning:|Entering dir' $Prefix-Build-Log.txt`;
239 my @Warnings;
240 my $CurDir = "";
241
242 foreach $Warning (@Warn) {
243   if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
244     $CurDir = $1;                 # Keep track of directory warning is in...
245     if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
246       $CurDir = $1;
247     }
248   } else {
249     push @Warnings, "$CurDir/$Warning";     # Add directory to warning...
250   }
251 }
252 my $WarningsFile =  join "\n", @Warnings;
253 my $WarningsList = AddPreTag $WarningsFile;
254 $WarningsFile =~ s/:[0-9]+:/::/g;
255
256 # Emit the warnings file, so we can diff...
257 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
258 my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
259
260 # Output something to stdout if something has changed
261 print "ADDED   WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
262 print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
263
264 $WarningsAdded = AddPreTag $WarningsAdded;
265 $WarningsRemoved = AddPreTag $WarningsRemoved;
266
267 #
268 # Get some statistics about CVS commits over the current day...
269 #
270 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
271 #print join "\n", @CVSHistory; print "\n";
272
273 # Extract some information from the CVS history... use a hash so no duplicate
274 # stuff is stored.
275 my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
276
277 my $DateRE = "[-:0-9 ]+\\+[0-9]+";
278
279 # Loop over every record from the CVS history, filling in the hashes.
280 foreach $File (@CVSHistory) {
281   my ($Type, $Date, $UID, $Rev, $Filename);
282   if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
283     ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
284   } elsif ($File =~ /([W]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+)/) {
285     ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
286   } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
287     ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
288   } else {
289     print "UNMATCHABLE: $File\n";
290   }
291   # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
292
293   if ($Filename =~ /^llvm/) {
294     if ($Type eq 'M') {        # Modified
295       $ModifiedFiles{$Filename} = 1;
296       $UsersCommitted{$UID} = 1;
297     } elsif ($Type eq 'A') {   # Added
298       $AddedFiles{$Filename} = 1;
299       $UsersCommitted{$UID} = 1;
300     } elsif ($Type eq 'R') {   # Removed
301       $RemovedFiles{$Filename} = 1;
302       $UsersCommitted{$UID} = 1;
303     } else {
304       $UsersUpdated{$UID} = 1;
305     }
306   }
307 }
308
309 my $UserCommitList = join "\n", keys %UsersCommitted;
310 my $UserUpdateList = join "\n", keys %UsersUpdated;
311 my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
312 my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
313 my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
314
315 my $TestError = 1;
316 my $SingleSourceProgramsTable;
317 my $MultiSourceProgramsTable;
318 my $ExternalProgramsTable;
319
320
321 sub TestDirectory {
322   my $SubDir = shift;
323
324   chdir "test/Programs/$SubDir" or
325     die "Could not change into test/Programs/$SubDir testdir!";
326
327   # Run the programs tests... creating a report.nightly.html file
328   if (!$NOTEST) {
329     system "gmake -k $MAKEOPTS $ENABLELINEARSCAN report.nightly.html "
330          . "TEST=nightly > $Prefix-$SubDir-ProgramTest.txt 2>&1";
331   } else {
332     system "gunzip $Prefix-$SubDir-ProgramTest.txt.gz";
333   }
334
335   my $ProgramsTable;
336   if (`grep '^gmake[^:]: .*Error' $Prefix-$SubDir-ProgramTest.txt | wc -l` + 0){
337     $TestError = 1;
338     $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
339     print "ERROR TESTING\n";
340   } elsif (`grep '^gmake[^:]: .*No rule to make target' $Prefix-$SubDir-ProgramTest.txt | wc -l` + 0) {
341     $TestError = 1;
342     $ProgramsTable =
343       "<font color=white><h2>Makefile error running tests!</h2></font>";
344     print "ERROR TESTING\n";
345   } else {
346     $TestError = 0;
347     $ProgramsTable = ReadFile "report.nightly.html";
348
349     #
350     # Create a list of the tests which were run...
351     #
352     system "egrep 'TEST-(PASS|FAIL)' < $Prefix-$SubDir-ProgramTest.txt "
353          . "| sort > $Prefix-$SubDir-Tests.txt";
354   }
355
356   # Compress the test output
357   system "gzip -f $Prefix-$SubDir-ProgramTest.txt";
358   chdir "../../.." or die "Cannot return to parent directory!";
359   return $ProgramsTable;
360 }
361
362 # If we build the tree successfully, run the nightly programs tests...
363 if ($BuildError eq "") {
364   $SingleSourceProgramsTable = TestDirectory("SingleSource");
365   $MultiSourceProgramsTable = TestDirectory("MultiSource");
366   $ExternalProgramsTable = TestDirectory("External");
367   system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
368          " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
369 }
370
371 my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
372
373 if ($TestError) {
374   $TestsAdded   = "<b>error testing</b><br>";
375   $TestsRemoved = "<b>error testing</b><br>";
376   $TestsFixed   = "<b>error testing</b><br>";
377   $TestsBroken  = "<b>error testing</b><br>";
378 } else {
379   my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
380
381   my @RawTestsAddedArray = split '\n', $RTestsAdded;
382   my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
383
384   my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
385     @RawTestsRemovedArray;
386   my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
387     @RawTestsAddedArray;
388
389   foreach $Test (keys %NewTests) {
390     if (!exists $OldTests{$Test}) {  # TestAdded if in New but not old
391       $TestsAdded = "$TestsAdded$Test\n";
392     } else {
393       if ($OldTests{$Test} =~ /TEST-PASS/) {  # Was the old one a pass?
394         $TestsBroken = "$TestsBroken$Test\n";  # New one must be a failure
395       } else {
396         $TestsFixed = "$TestsFixed$Test\n";    # No, new one is a pass.
397       }
398     }
399   }
400   foreach $Test (keys %OldTests) {  # TestRemoved if in Old but not New
401     $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
402   }
403
404   print "\nTESTS ADDED:  \n\n$TestsAdded\n\n"   if (length $TestsAdded);
405   print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
406   print "\nTESTS FIXED:  \n\n$TestsFixed\n\n"   if (length $TestsFixed);
407   print "\nTESTS BROKEN: \n\n$TestsBroken\n\n"  if (length $TestsBroken);
408
409   $TestsAdded   = AddPreTag $TestsAdded;
410   $TestsRemoved = AddPreTag $TestsRemoved;
411   $TestsFixed   = AddPreTag $TestsFixed;
412   $TestsBroken  = AddPreTag $TestsBroken;
413 }
414
415
416 # If we built the tree successfully, runs of the Olden suite with
417 # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
418 if ($BuildError eq "") {
419   my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
420       $MachCodeSize) = ("","","","","","","");
421   if (!$NORUNNINGTESTS) {
422     chdir "test/Programs/MultiSource/Benchmarks/Olden" or die "Olden tests moved?";
423
424     # Clean out previous results...
425     system "gmake $MAKEOPTS clean > /dev/null 2>&1";
426
427     # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE enabled!
428     system "gmake -k $MAKEOPTS report.nightly.raw.out TEST=nightly " .
429            " LARGE_PROBLEM_SIZE=1 > /dev/null 2>&1";
430     system "cp report.nightly.raw.out $Prefix-Olden-tests.txt";
431   } else {
432     system "gunzip $Prefix-Olden-tests.txt.gz";
433   }
434
435   # Now we know we have $Prefix-Olden-tests.txt as the raw output file.  Split
436   # it up into records and read the useful information.
437   my @Records = split />>> ========= /, ReadFile "$Prefix-Olden-tests.txt";
438   shift @Records;  # Delete the first (garbage) record
439
440   # Loop over all of the records, summarizing them into rows for the running
441   # totals file.
442   my $WallTimeRE = "[A-Za-z0-9.: ]+\\(([0-9.]+) wall clock";
443   foreach $Rec (@Records) {
444     my $rNATTime = GetRegex 'TEST-RESULT-nat-time: real\s*([.0-9m]+)', $Rec;
445     my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: real\s*([.0-9m]+)', $Rec;
446     my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: real\s*([.0-9m]+)', $Rec;
447     my $rJITTime = GetRegex 'TEST-RESULT-jit-time: real\s*([.0-9m]+)', $Rec;
448     my $rOptTime = GetRegex "TEST-RESULT-compile: $WallTimeRE", $Rec;
449     my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
450     my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
451
452     $NATTime .= " " . FormatTime($rNATTime);
453     $CBETime .= " " . FormatTime($rCBETime);
454     $LLCTime .= " " . FormatTime($rLLCTime);
455     $JITTime .= " " . FormatTime($rJITTime);
456     $OptTime .= " $rOptTime";
457     $BytecodeSize .= " $rBytecodeSize";
458     $MachCodeSize .= " $rMachCodeSize";
459   }
460
461   # Now that we have all of the numbers we want, add them to the running totals
462   # files.
463   AddRecord($NATTime, "running_Olden_nat_time.txt");
464   AddRecord($CBETime, "running_Olden_cbe_time.txt");
465   AddRecord($LLCTime, "running_Olden_llc_time.txt");
466   AddRecord($JITTime, "running_Olden_jit_time.txt");
467   AddRecord($OptTime, "running_Olden_opt_time.txt");
468   AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
469   AddRecord($MachCodeSize, "running_Olden_machcode.txt");
470
471   system "gzip -f $Prefix-Olden-tests.txt";
472 }
473
474
475
476
477 #
478 # Get a list of the previous days that we can link to...
479 #
480 my @PrevDays = map {s/.html//; $_} GetDir ".html";
481
482 splice @PrevDays, 20;  # Trim down list to something reasonable...
483
484 my $PrevDaysList =     # Format list for sidebar
485   join "\n  ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
486
487 #
488 # Start outputing files into the web directory
489 #
490 chdir $WebDir or die "Could not change into web directory!";
491
492 # Add information to the files which accumulate information for graphs...
493 AddRecord($LOC, "running_loc.txt");
494 AddRecord($BuildTime, "running_build_time.txt");
495
496 #
497 # Rebuild the graphs now...
498 #
499 $GNUPLOT = "/usr/dcs/software/supported/bin/gnuplot";
500 $GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
501 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
502 system ($GNUPLOT, $PlotScriptFilename);
503
504 #
505 # Remove the cvs tree...
506 #
507 system "rm -rf $BuildDir" if (!$NOCHECKOUT and !$NOREMOVE);
508
509 #
510 # Print out information...
511 #
512 if (0) {
513   print "DateString: $DateString\n";
514   print "CVS Checkout: $CVSCheckoutTime seconds\n";
515   print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
516
517   print "Build Time: $BuildTime seconds\n";
518   print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
519
520   print "WARNINGS:\n  $WarningsList\n";
521
522   print "Users committed: $UserCommitList\n";
523   print "Added Files: \n  $AddedFilesList\n";
524   print "Modified Files: \n  $ModifiedFilesList\n";
525   print "Removed Files: \n  $RemovedFilesList\n";
526
527   print "Previous Days =\n  $PrevDaysList\n";
528 }
529
530
531 #
532 # Output the files...
533 #
534
535 # Main HTML file...
536 my $Output;
537 eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
538 WriteFile "$DATE.html", $Output;
539
540 # Change the index.html symlink...
541 system "ln -sf $DATE.html index.html";
542
543 sub AddRecord {
544   my ($Val, $Filename) = @_;
545   my @Records;
546   if (open FILE, "$WebDir/$Filename") {
547     @Records = grep !/$DATE/, split "\n", <FILE>;
548     close FILE;
549   }
550   push @Records, "$DATE: $Val";
551   WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
552   return @Records;
553 }