blob: 791a12ea85836f21b615caece474649a6404b1f3 [file] [log] [blame]
Alkis Evlogimenos8b9d36e2004-01-07 01:48:26 +00001#!/usr/bin/perl -w
Chris Lattner6a36dc62003-01-20 06:11:03 +00002#
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#
Brian Gaeke91d16b32003-10-11 05:34:00 +000010# 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.
Chris Lattnera9e9d2c2004-05-28 20:30:23 +000016# -nofeaturetests Do not run the feature tests.
17# -noregressiontests Do not run the regression tests.
Brian Gaeke91d16b32003-10-11 05:34:00 +000018# -notest Do not even attempt to run the test programs. Implies
19# -norunningtests.
20# -norunningtests Do not run the Olden benchmark suite with
21# LARGE_PROBLEM_SIZE enabled.
22# -parallel Run two parallel jobs with GNU Make.
Chris Lattner8f668f262003-12-19 03:47:31 +000023# -enable-linscan Enable linearscan tests
Chris Lattner1c0a0e22004-06-03 03:29:39 +000024# -disable-codegen Disable LLC and JIT tests in the nightly tester.
Chris Lattnera9e9d2c2004-05-28 20:30:23 +000025# -verbose Turn on some debug output
26# -debug Print information useful only to maintainers of this script.
Chris Lattner8f668f262003-12-19 03:47:31 +000027#
Brian Gaeke91d16b32003-10-11 05:34:00 +000028# CVSROOT is the CVS repository from which the tree will be checked out,
29# specified either in the full :method:user@host:/dir syntax, or
30# just /dir if using a local repo.
31# BUILDDIR is the directory where sources for this test run will be checked out
32# AND objects for this test run will be built. This directory MUST NOT
33# exist before the script is run; it will be created by the cvs checkout
34# process and erased (unless -noremove is specified; see above.)
35# WEBDIR is the directory into which the test results web page will be written,
36# AND in which the "index.html" is assumed to be a symlink to the most recent
37# copy of the results. This directory MUST exist before the script is run.
Chris Lattner6a36dc62003-01-20 06:11:03 +000038#
39use POSIX qw(strftime);
40
Brian Gaeke91d16b32003-10-11 05:34:00 +000041my $HOME = $ENV{'HOME'};
42my $CVSRootDir = $ENV{'CVSROOT'};
Chris Lattner4b9c23a2003-10-14 01:22:08 +000043 $CVSRootDir = "/home/vadve/shared/PublicCVS"
Chris Lattnera9e9d2c2004-05-28 20:30:23 +000044 unless $CVSRootDir;
45my $BuildDir = $ENV{'BUILDDIR'};
46 $BuildDir = "$HOME/buildtest"
47 unless $BuildDir;
48my $WebDir = $ENV{'WEBDIR'};
49 $WebDir = "$HOME/cvs/testresults-X86"
50 unless $WebDir;
Chris Lattner3dc06172003-01-20 18:05:27 +000051
52# Calculate the date prefix...
53@TIME = localtime;
54my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
55my $DateString = strftime "%B %d, %Y", localtime;
56
Chris Lattner85d79a02003-01-22 16:14:05 +000057sub ReadFile {
Chris Lattnerd1fc00d2003-08-19 15:08:34 +000058 undef $/;
Chris Lattner85d79a02003-01-22 16:14:05 +000059 if (open (FILE, $_[0])) {
60 my $Ret = <FILE>;
61 close FILE;
62 return $Ret;
63 } else {
64 print "Could not open file '$_[0]' for reading!";
65 return "";
66 }
67}
68
Chris Lattner3dc06172003-01-20 18:05:27 +000069sub WriteFile { # (filename, contents)
70 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
71 print FILE $_[1];
72 close FILE;
73}
74
75sub GetRegex { # (Regex with ()'s, value)
Chris Lattner34debbf2003-01-22 20:35:59 +000076 $_[1] =~ /$_[0]/m;
Chris Lattner05c8f642003-08-19 18:35:03 +000077 if (defined($1)) {
78 return $1;
79 }
80 return "?";
Chris Lattner3dc06172003-01-20 18:05:27 +000081}
82
83sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
84 $_ = shift;
Chris Lattner7f90f612003-01-20 19:18:44 +000085 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner3dc06172003-01-20 18:05:27 +000086}
87
88sub GetDir {
89 my $Suffix = shift;
90 opendir DH, $WebDir;
91 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
92 closedir DH;
93 return @Result;
94}
95
96# DiffFiles - Diff the current version of the file against the last version of
97# the file, reporting things added and removed. This is used to report, for
98# example, added and removed warnings. This returns a pair (added, removed)
99#
100sub DiffFiles {
101 my $Suffix = shift;
102 my @Others = GetDir $Suffix;
103 if (@Others == 0) { # No other files? We added all entries...
104 return (`cat $WebDir/$DATE$Suffix`, "");
105 }
106 # Diff the files now...
107 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
108 my $Added = join "\n", grep /^</, @Diffs;
109 my $Removed = join "\n", grep /^>/, @Diffs;
Chris Lattner7f90f612003-01-20 19:18:44 +0000110 $Added =~ s/^< //gm;
111 $Removed =~ s/^> //gm;
Chris Lattner3dc06172003-01-20 18:05:27 +0000112 return ($Added, $Removed);
113}
114
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000115# FormatTime - Convert a time from 1m23.45 into 83.45
116sub FormatTime {
117 my $Time = shift;
118 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
119 $Time = sprintf("%7.4f", $1*60.0+$2);
120 }
121 return $Time;
122}
123
Chris Lattner3dc06172003-01-20 18:05:27 +0000124
Chris Lattner6a36dc62003-01-20 06:11:03 +0000125# Command line argument settings...
126my $NOCHECKOUT = 0;
127my $NOREMOVE = 0;
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000128my $NOFEATURES = 0;
129my $NOREGRESSIONS = 0;
Chris Lattner85d79a02003-01-22 16:14:05 +0000130my $NOTEST = 0;
Chris Lattner05c8f642003-08-19 18:35:03 +0000131my $NORUNNINGTESTS = 0;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000132my $MAKEOPTS = "";
Chris Lattner1c0a0e22004-06-03 03:29:39 +0000133my $PROGTESTOPTS = "";
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000134my $VERBOSE = 0;
135my $DEBUG = 0;
Brian Gaeke0a716732004-06-03 21:46:56 +0000136my $CONFIGUREARGS = "--enable-jit";
Brian Gaeke91d16b32003-10-11 05:34:00 +0000137
Brian Gaeke0a716732004-06-03 21:46:56 +0000138# Parse arguments...
Chris Lattner6a36dc62003-01-20 06:11:03 +0000139while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
140 shift;
141 last if /^--$/; # Stop processing arguments on --
142
143 # List command line options here...
Chris Lattner05c8f642003-08-19 18:35:03 +0000144 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
145 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Chris Lattner1c0a0e22004-06-03 03:29:39 +0000146 if (/^-nofeaturetests$/) { $NOFEATURES = 1; next; }
147 if (/^-noregressiontests$/){ $NOREGRESSIONS = 1; next; }
Chris Lattner05c8f642003-08-19 18:35:03 +0000148 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
149 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
150 if (/^-parallel$/) { $MAKEOPTS = "-j2 -l3.0"; next; }
Chris Lattner1c0a0e22004-06-03 03:29:39 +0000151 if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; }
Brian Gaeke0a716732004-06-03 21:46:56 +0000152 if (/^-disable-codegen$/){ $PROGTESTOPTS .= " DISABLE_JIT=1 DISABLE_LLC=1";
153 $CONFIGUREARGS="--disable-jit --disable-llc_diffs";
154 next; }
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000155 if (/^-verbose$/) { $VERBOSE = 1; next; }
156 if (/^-debug$/) { $DEBUG = 1; next; }
Chris Lattner6a36dc62003-01-20 06:11:03 +0000157
158 print "Unknown option: $_ : ignoring!\n";
159}
160
Brian Gaeke0a716732004-06-03 21:46:56 +0000161if ($ENV{'LLVMGCCDIR'}) {
162 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
163}
164
Chris Lattner3dc06172003-01-20 18:05:27 +0000165die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
Chris Lattner6a36dc62003-01-20 06:11:03 +0000166
Chris Lattner6a36dc62003-01-20 06:11:03 +0000167if (@ARGV == 3) {
168 $CVSRootDir = $ARGV[0];
169 $BuildDir = $ARGV[1];
170 $WebDir = $ARGV[2];
171}
172
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000173
Misha Brukman6aa98682003-07-07 21:27:40 +0000174my $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000175my $Prefix = "$WebDir/$DATE";
176
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000177if ($VERBOSE) {
178 print "INITIALIZED\n";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000179 print "CVS Root = $CVSRootDir\n";
180 print "BuildDir = $BuildDir\n";
181 print "WebDir = $WebDir\n";
182 print "Prefix = $Prefix\n";
183}
184
Chris Lattner85d79a02003-01-22 16:14:05 +0000185
186#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000187# Create the CVS repository directory
Chris Lattner85d79a02003-01-22 16:14:05 +0000188#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000189if (!$NOCHECKOUT) {
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000190 if (-d $BuildDir) {
191 if (!$NOREMOVE) {
Reid Spencer3b430222004-05-30 00:17:47 +0000192 system "rm -rf $BuildDir";
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000193 } else {
194 die "CVS checkout directory $BuildDir already exists!";
195 }
196 }
Misha Brukman6aa98682003-07-07 21:27:40 +0000197 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000198}
Misha Brukman6aa98682003-07-07 21:27:40 +0000199chdir $BuildDir or die "Could not change to CVS checkout directory $BuildDir!";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000200
Chris Lattner85d79a02003-01-22 16:14:05 +0000201
202#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000203# Check out the llvm tree, saving CVS messages to the cvs log...
Chris Lattner85d79a02003-01-22 16:14:05 +0000204#
Brian Gaeke91d16b32003-10-11 05:34:00 +0000205$CVSOPT = "";
206$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000207if (!$NOCHECKOUT) {
208 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
209 system "(time -p cvs $CVSOPT -d $CVSRootDir co llvm) > $Prefix-CVS-Log.txt 2>&1";
210}
Chris Lattner6a36dc62003-01-20 06:11:03 +0000211
212chdir "llvm" or die "Could not change into llvm directory!";
213
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000214if (!$NOCHECKOUT) {
215 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
216 system "cvs update -P -d > /dev/null 2>&1" ;
217}
Chris Lattner34debbf2003-01-22 20:35:59 +0000218
Chris Lattner6a36dc62003-01-20 06:11:03 +0000219# Read in the HTML template file...
Chris Lattner85d79a02003-01-22 16:14:05 +0000220my $TemplateContents = ReadFile $Template;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000221
Chris Lattner85d79a02003-01-22 16:14:05 +0000222
223#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000224# Get some static statistics about the current state of CVS
Chris Lattner85d79a02003-01-22 16:14:05 +0000225#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000226my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $Prefix-CVS-Log.txt`;
Brian Gaekefed9ed92003-12-01 05:31:12 +0000227my $NumFilesInCVS = `egrep '^U' $Prefix-CVS-Log.txt | wc -l` + 0;
228my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $Prefix-CVS-Log.txt | wc -l` + 0;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000229$LOC = GetRegex "([0-9]+) +total", `wc -l \`utils/getsrcs.sh\` | grep total`;
230
Chris Lattner85d79a02003-01-22 16:14:05 +0000231#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000232# Build the entire tree, saving build messages to the build log
Chris Lattner85d79a02003-01-22 16:14:05 +0000233#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000234if (!$NOCHECKOUT) {
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000235 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
Brian Gaeke0a716732004-06-03 21:46:56 +0000236 system "(time -p ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $Prefix-Build-Log.txt 2>&1";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000237
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000238 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
Chris Lattner6a36dc62003-01-20 06:11:03 +0000239 # Build the entire tree, capturing the output into $Prefix-Build-Log.txt
Chris Lattnerf5410e82003-07-01 16:02:00 +0000240 system "(time -p gmake $MAKEOPTS) >> $Prefix-Build-Log.txt 2>&1";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000241}
242
Chris Lattner85d79a02003-01-22 16:14:05 +0000243
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000244sub GetRegexNum {
245 my ($Regex, $Num, $Regex2, $File) = @_;
246 my @Items = split "\n", `grep '$Regex' $File`;
247 return GetRegex $Regex2, $Items[$Num];
248}
249
Chris Lattner85d79a02003-01-22 16:14:05 +0000250#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000251# Get some statistics about the build...
Chris Lattner85d79a02003-01-22 16:14:05 +0000252#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000253my @Linked = split '\n', `grep Linking $Prefix-Build-Log.txt`;
254my $NumExecutables = scalar(grep(/executable/, @Linked));
255my $NumLibraries = scalar(grep(!/executable/, @Linked));
256my $NumObjects = `grep '^Compiling' $Prefix-Build-Log.txt | wc -l` + 0;
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000257
258my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$Prefix-Build-Log.txt";
259my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$Prefix-Build-Log.txt";
Chris Lattner688d99f2003-08-18 14:07:03 +0000260my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000261my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$Prefix-Build-Log.txt";
262
263my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$Prefix-Build-Log.txt";
264my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$Prefix-Build-Log.txt";
Chris Lattner34debbf2003-01-22 20:35:59 +0000265my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000266my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$Prefix-Build-Log.txt";
267
Chris Lattner85d79a02003-01-22 16:14:05 +0000268my $BuildError = "";
Chris Lattnerd7e18982003-09-23 20:33:04 +0000269if (`grep '^gmake[^:]*: .*Error' $Prefix-Build-Log.txt | wc -l` + 0 ||
Chris Lattner8560a062003-09-23 22:02:01 +0000270 `grep '^gmake: \*\*\*.*Stop.' $Prefix-Build-Log.txt | wc -l`+0) {
Misha Brukman71a1ba62003-08-21 20:22:52 +0000271 $BuildError = "<h3><font color='red'>Build error: compilation " .
272 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
Chris Lattnereb9d2152003-10-19 16:54:00 +0000273 print "BUILD ERROR\n";
Chris Lattner85d79a02003-01-22 16:14:05 +0000274}
Chris Lattner6a36dc62003-01-20 06:11:03 +0000275
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000276sub GetQMTestResults { # (filename)
277 my ($filename) = @_;
278 my @lines;
279 my $firstline;
280 $/ = "\n"; #Make sure we're going line at a time.
281 if (open SRCHFILE, $filename) {
Reid Spencer3b430222004-05-30 00:17:47 +0000282 # Skip stuff before ---TEST RESULTS
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000283 while ( <SRCHFILE> ) {
Reid Spencer8ac57712004-05-31 20:59:55 +0000284 if ( m/^--- TEST RESULTS/ ) { last; }
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000285 }
Reid Spencer3b430222004-05-30 00:17:47 +0000286 # Process test results
Reid Spencer8ac57712004-05-31 20:59:55 +0000287 push(@lines,"<h3>TEST RESULTS</h3><ol><li>\n");
288 my $first_list = 1;
289 my $should_break = 1;
Reid Spencer7d4b8142004-06-08 08:01:33 +0000290 my $nocopy = 0;
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000291 while ( <SRCHFILE> ) {
292 if ( length($_) > 1 ) {
Reid Spencer8ac57712004-05-31 20:59:55 +0000293 chomp($_);
294 if ( ! m/: PASS[ ]*$/ &&
295 ! m/^ qmtest.target:/ &&
296 ! m/^ local/ &&
297 ! m/^gmake:/ ) {
Reid Spencer7d4b8142004-06-08 08:01:33 +0000298 if ( m/: XFAIL/ ) {
299 $nocopy = 1;
300 } elsif ( m/: XPASS/ || m/: FAIL/ ) {
301 $nocopy = 0;
Reid Spencer8ac57712004-05-31 20:59:55 +0000302 if ( $first_list ) {
303 $first_list = 0;
304 $should_break = 1;
305 push(@lines,"<b>$_</b><br/>\n");
306 } else {
307 push(@lines,"</li><li><b>$_</b><br/>\n");
308 }
309 } elsif ( m/^--- STATISTICS/ ) {
310 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
311 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
312 $should_break = 0;
Reid Spencer7d4b8142004-06-08 08:01:33 +0000313 $nocopy = 0;
Reid Spencer8ac57712004-05-31 20:59:55 +0000314 } elsif ( m/^--- TESTS WITH/ ) {
315 $should_break = 1;
316 $first_list = 1;
Reid Spencer7d4b8142004-06-08 08:01:33 +0000317 $nocopy = 0;
Reid Spencer8ac57712004-05-31 20:59:55 +0000318 push(@lines,"</pre><h3>TESTS WITH UNEXPECTED RESULTS</h3><ol><li>\n");
319 } elsif ( m/^real / ) {
320 last;
Reid Spencer7d4b8142004-06-08 08:01:33 +0000321 } elsif (!$nocopy) {
Reid Spencer8ac57712004-05-31 20:59:55 +0000322 if ( $should_break ) {
323 push(@lines,"$_<br/>\n");
324 } else {
325 push(@lines,"$_\n");
326 }
327 }
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000328 }
329 }
330 }
331 close SRCHFILE;
332 }
333 my $content = join("",@lines);
Reid Spencer7d4b8142004-06-08 08:01:33 +0000334 return "$content</li></ol>\n";
335}
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000336
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000337# Get results of feature tests.
338my $FeatureTestResults; # String containing the results of the feature tests
339my $FeatureTime; # System+CPU Time for feature tests
340my $FeatureWallTime; # Wall Clock Time for feature tests
341if (!$NOFEATURES) {
342 if ( $VERBOSE ) { print "FEATURE TEST STAGE\n"; }
343 my $feature_output = "$Prefix-FeatureTests-Log.txt";
344
345 # Run the feature tests so we can summarize the results
346 system "(time -p gmake -C test Feature.t) > $feature_output 2>&1";
347
348 # Extract test results
349 $FeatureTestResults = GetQMTestResults("$feature_output");
350
351 # Extract time of feature tests
352 my $FeatureTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$feature_output";
353 my $FeatureTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$feature_output";
354 $FeatureTime = $FeatureTimeU+$FeatureTimeS; # FeatureTime = User+System
355 $FeatureWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$feature_output";
356 # Run the regression tests so we can summarize the results
357} else {
358 $FeatureTestResults = "Skipped by user choice.";
359 $FeatureTime = "0.0";
360 $FeatureWallTime = "0.0";
361}
362
363if (!$NOREGRESSIONS) {
364 if ( $VERBOSE ) { print "REGRESSION TEST STAGE\n"; }
365 my $regression_output = "$Prefix-RegressionTests-Log.txt";
366
367 # Run the regression tests so we can summarize the results
368 system "(time -p gmake -C test Regression.t) > $regression_output 2>&1";
369
370 # Extract test results
371 $RegressionTestResults = GetQMTestResults("$regression_output");
372
373 # Extract time of regressions tests
374 my $RegressionTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$regression_output";
375 my $RegressionTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$regression_output";
376 $RegressionTime = $RegressionTimeU+$RegressionTimeS; # RegressionTime = User+System
377 $RegressionWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$regression_output";
378} else {
379 $RegressionTestResults = "Skipped by user choice.";
380 $RegressionTime = "0.0";
381 $RegressionWallTime = "0.0";
382}
383
384if ($DEBUG) {
385 print $FeatureTestResults;
386 print $RegressionTestResults;
387}
388
389if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattner85d79a02003-01-22 16:14:05 +0000390#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000391# Get warnings from the build
Chris Lattner85d79a02003-01-22 16:14:05 +0000392#
Misha Brukman6aa98682003-07-07 21:27:40 +0000393my @Warn = split "\n", `egrep 'warning:|Entering dir' $Prefix-Build-Log.txt`;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000394my @Warnings;
395my $CurDir = "";
396
397foreach $Warning (@Warn) {
398 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
399 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman2b6d3382003-08-14 15:26:28 +0000400 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner6a36dc62003-01-20 06:11:03 +0000401 $CurDir = $1;
402 }
403 } else {
404 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
405 }
406}
Chris Lattner7f90f612003-01-20 19:18:44 +0000407my $WarningsFile = join "\n", @Warnings;
408my $WarningsList = AddPreTag $WarningsFile;
409$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000410
Chris Lattner3dc06172003-01-20 18:05:27 +0000411# Emit the warnings file, so we can diff...
412WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
413my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000414
Chris Lattner83ec9452003-10-18 19:31:39 +0000415# Output something to stdout if something has changed
416print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
417print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
418
Chris Lattnereb9d2152003-10-19 16:54:00 +0000419$WarningsAdded = AddPreTag $WarningsAdded;
420$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattner85d79a02003-01-22 16:14:05 +0000421
422#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000423# Get some statistics about CVS commits over the current day...
Chris Lattner85d79a02003-01-22 16:14:05 +0000424#
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000425if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner6a36dc62003-01-20 06:11:03 +0000426@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
427#print join "\n", @CVSHistory; print "\n";
428
429# Extract some information from the CVS history... use a hash so no duplicate
430# stuff is stored.
Misha Brukman6aa98682003-07-07 21:27:40 +0000431my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner6a36dc62003-01-20 06:11:03 +0000432
Brian Gaeke966938c2004-06-10 07:44:28 +0000433my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattner34debbf2003-01-22 20:35:59 +0000434
Chris Lattner6a36dc62003-01-20 06:11:03 +0000435# Loop over every record from the CVS history, filling in the hashes.
436foreach $File (@CVSHistory) {
437 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman2b6d3382003-08-14 15:26:28 +0000438 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner6a36dc62003-01-20 06:11:03 +0000439 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattner4bb9bc32004-01-12 16:55:30 +0000440 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
441 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman6aa98682003-07-07 21:27:40 +0000442 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattner34debbf2003-01-22 20:35:59 +0000443 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner6a36dc62003-01-20 06:11:03 +0000444 } else {
Chris Lattner34debbf2003-01-22 20:35:59 +0000445 print "UNMATCHABLE: $File\n";
Brian Gaeke966938c2004-06-10 07:44:28 +0000446 next;
Chris Lattner34debbf2003-01-22 20:35:59 +0000447 }
448 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
449
450 if ($Filename =~ /^llvm/) {
451 if ($Type eq 'M') { # Modified
452 $ModifiedFiles{$Filename} = 1;
453 $UsersCommitted{$UID} = 1;
454 } elsif ($Type eq 'A') { # Added
455 $AddedFiles{$Filename} = 1;
456 $UsersCommitted{$UID} = 1;
457 } elsif ($Type eq 'R') { # Removed
458 $RemovedFiles{$Filename} = 1;
459 $UsersCommitted{$UID} = 1;
460 } else {
461 $UsersUpdated{$UID} = 1;
462 }
Chris Lattner6a36dc62003-01-20 06:11:03 +0000463 }
464}
465
Chris Lattner7f90f612003-01-20 19:18:44 +0000466my $UserCommitList = join "\n", keys %UsersCommitted;
467my $UserUpdateList = join "\n", keys %UsersUpdated;
Chris Lattnerbade93c2003-08-06 16:02:50 +0000468my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
469my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
470my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000471
Chris Lattner88126c02003-02-28 20:30:20 +0000472my $TestError = 1;
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000473my $SingleSourceProgramsTable;
474my $MultiSourceProgramsTable;
Chris Lattnered51e682003-08-21 15:55:26 +0000475my $ExternalProgramsTable;
Chris Lattner85d79a02003-01-22 16:14:05 +0000476
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000477
478sub TestDirectory {
479 my $SubDir = shift;
480
481 chdir "test/Programs/$SubDir" or
482 die "Could not change into test/Programs/$SubDir testdir!";
Chris Lattner88126c02003-02-28 20:30:20 +0000483
484 # Run the programs tests... creating a report.nightly.html file
485 if (!$NOTEST) {
Chris Lattner1c0a0e22004-06-03 03:29:39 +0000486 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Chris Lattner8f668f262003-12-19 03:47:31 +0000487 . "TEST=nightly > $Prefix-$SubDir-ProgramTest.txt 2>&1";
Chris Lattner88126c02003-02-28 20:30:20 +0000488 } else {
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000489 system "gunzip $Prefix-$SubDir-ProgramTest.txt.gz";
Chris Lattner88126c02003-02-28 20:30:20 +0000490 }
491
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000492 my $ProgramsTable;
Chris Lattner42fee012003-08-20 15:44:33 +0000493 if (`grep '^gmake[^:]: .*Error' $Prefix-$SubDir-ProgramTest.txt | wc -l` + 0){
Chris Lattner88126c02003-02-28 20:30:20 +0000494 $TestError = 1;
Chris Lattnerc09c0b92003-05-10 21:40:10 +0000495 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnereb9d2152003-10-19 16:54:00 +0000496 print "ERROR TESTING\n";
Chris Lattner42fee012003-08-20 15:44:33 +0000497 } elsif (`grep '^gmake[^:]: .*No rule to make target' $Prefix-$SubDir-ProgramTest.txt | wc -l` + 0) {
Chris Lattner0a55e462003-05-11 15:23:10 +0000498 $TestError = 1;
499 $ProgramsTable =
500 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnereb9d2152003-10-19 16:54:00 +0000501 print "ERROR TESTING\n";
Chris Lattner0a55e462003-05-11 15:23:10 +0000502 } else {
Chris Lattner88126c02003-02-28 20:30:20 +0000503 $TestError = 0;
504 $ProgramsTable = ReadFile "report.nightly.html";
505
506 #
507 # Create a list of the tests which were run...
508 #
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000509 system "egrep 'TEST-(PASS|FAIL)' < $Prefix-$SubDir-ProgramTest.txt "
510 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattner88126c02003-02-28 20:30:20 +0000511 }
512
513 # Compress the test output
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000514 system "gzip -f $Prefix-$SubDir-ProgramTest.txt";
515 chdir "../../.." or die "Cannot return to parent directory!";
516 return $ProgramsTable;
517}
518
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000519# If we build the tree successfully, run the nightly programs tests...
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000520if ($BuildError eq "") {
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000521 if ( $VERBOSE ) {
522 print "SingleSource TEST STAGE\n";
523 }
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000524 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000525 if ( $VERBOSE ) {
526 print "MultiSource TEST STAGE\n";
527 }
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000528 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000529 if ( $VERBOSE ) {
530 print "External TEST STAGE\n";
531 }
Chris Lattnered51e682003-08-21 15:55:26 +0000532 $ExternalProgramsTable = TestDirectory("External");
Chris Lattner71f65432003-08-18 15:11:13 +0000533 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnered51e682003-08-21 15:55:26 +0000534 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Chris Lattnerd090dbb2003-01-23 19:31:28 +0000535}
Chris Lattner85d79a02003-01-22 16:14:05 +0000536
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000537if ( $VERBOSE ) {
538 print "TEST INFORMATION COLLECTION STAGE\n";
539}
Chris Lattner34debbf2003-01-22 20:35:59 +0000540my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
541
Chris Lattner88126c02003-02-28 20:30:20 +0000542if ($TestError) {
543 $TestsAdded = "<b>error testing</b><br>";
544 $TestsRemoved = "<b>error testing</b><br>";
545 $TestsFixed = "<b>error testing</b><br>";
546 $TestsBroken = "<b>error testing</b><br>";
547} else {
548 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
549
550 my @RawTestsAddedArray = split '\n', $RTestsAdded;
551 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
552
553 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
554 @RawTestsRemovedArray;
555 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
556 @RawTestsAddedArray;
557
558 foreach $Test (keys %NewTests) {
559 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
560 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattner34debbf2003-01-22 20:35:59 +0000561 } else {
Chris Lattner88126c02003-02-28 20:30:20 +0000562 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
563 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
564 } else {
565 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
566 }
Chris Lattner34debbf2003-01-22 20:35:59 +0000567 }
568 }
Chris Lattner88126c02003-02-28 20:30:20 +0000569 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
570 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
571 }
Chris Lattner34debbf2003-01-22 20:35:59 +0000572
Chris Lattner518f3fd2003-10-21 15:47:31 +0000573 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
574 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
575 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
576 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnereb9d2152003-10-19 16:54:00 +0000577
Chris Lattner88126c02003-02-28 20:30:20 +0000578 $TestsAdded = AddPreTag $TestsAdded;
579 $TestsRemoved = AddPreTag $TestsRemoved;
580 $TestsFixed = AddPreTag $TestsFixed;
581 $TestsBroken = AddPreTag $TestsBroken;
582}
Chris Lattner34debbf2003-01-22 20:35:59 +0000583
Chris Lattner83ec9452003-10-18 19:31:39 +0000584
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000585# If we built the tree successfully, runs of the Olden suite with
586# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
587if ($BuildError eq "") {
Chris Lattner05c8f642003-08-19 18:35:03 +0000588 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000589 $MachCodeSize) = ("","","","","","","");
Chris Lattner05c8f642003-08-19 18:35:03 +0000590 if (!$NORUNNINGTESTS) {
Chris Lattner9aa85982003-09-14 06:00:49 +0000591 chdir "test/Programs/MultiSource/Benchmarks/Olden" or die "Olden tests moved?";
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000592
593 # Clean out previous results...
594 system "gmake $MAKEOPTS clean > /dev/null 2>&1";
595
596 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE enabled!
Brian Gaeke2948d2e2004-06-04 00:07:12 +0000597 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000598 " LARGE_PROBLEM_SIZE=1 > /dev/null 2>&1";
599 system "cp report.nightly.raw.out $Prefix-Olden-tests.txt";
600 } else {
601 system "gunzip $Prefix-Olden-tests.txt.gz";
602 }
603
604 # Now we know we have $Prefix-Olden-tests.txt as the raw output file. Split
605 # it up into records and read the useful information.
Chris Lattner05c8f642003-08-19 18:35:03 +0000606 my @Records = split />>> ========= /, ReadFile "$Prefix-Olden-tests.txt";
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000607 shift @Records; # Delete the first (garbage) record
608
609 # Loop over all of the records, summarizing them into rows for the running
610 # totals file.
611 my $WallTimeRE = "[A-Za-z0-9.: ]+\\(([0-9.]+) wall clock";
612 foreach $Rec (@Records) {
Chris Lattner05c8f642003-08-19 18:35:03 +0000613 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: real\s*([.0-9m]+)', $Rec;
614 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: real\s*([.0-9m]+)', $Rec;
615 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: real\s*([.0-9m]+)', $Rec;
616 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: real\s*([.0-9m]+)', $Rec;
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000617 my $rOptTime = GetRegex "TEST-RESULT-compile: $WallTimeRE", $Rec;
618 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
619 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
620
621 $NATTime .= " " . FormatTime($rNATTime);
622 $CBETime .= " " . FormatTime($rCBETime);
623 $LLCTime .= " " . FormatTime($rLLCTime);
624 $JITTime .= " " . FormatTime($rJITTime);
625 $OptTime .= " $rOptTime";
Chris Lattner05c8f642003-08-19 18:35:03 +0000626 $BytecodeSize .= " $rBytecodeSize";
627 $MachCodeSize .= " $rMachCodeSize";
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000628 }
629
630 # Now that we have all of the numbers we want, add them to the running totals
631 # files.
Chris Lattner05c8f642003-08-19 18:35:03 +0000632 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000633 AddRecord($CBETime, "running_Olden_cbe_time.txt");
634 AddRecord($LLCTime, "running_Olden_llc_time.txt");
635 AddRecord($JITTime, "running_Olden_jit_time.txt");
636 AddRecord($OptTime, "running_Olden_opt_time.txt");
637 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
638 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
Chris Lattner05c8f642003-08-19 18:35:03 +0000639
640 system "gzip -f $Prefix-Olden-tests.txt";
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000641}
642
643
644
645
Chris Lattner34debbf2003-01-22 20:35:59 +0000646#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000647# Get a list of the previous days that we can link to...
Chris Lattner85d79a02003-01-22 16:14:05 +0000648#
Chris Lattner3dc06172003-01-20 18:05:27 +0000649my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000650
651splice @PrevDays, 20; # Trim down list to something reasonable...
652
653my $PrevDaysList = # Format list for sidebar
654 join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
655
Chris Lattner3c81d9a2003-08-18 20:07:54 +0000656#
657# Start outputing files into the web directory
658#
659chdir $WebDir or die "Could not change into web directory!";
660
661# Add information to the files which accumulate information for graphs...
662AddRecord($LOC, "running_loc.txt");
663AddRecord($BuildTime, "running_build_time.txt");
664
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000665if ( $VERBOSE ) {
666 print "GRAPH GENERATION STAGE\n";
667}
Chris Lattner3c81d9a2003-08-18 20:07:54 +0000668#
669# Rebuild the graphs now...
670#
Brian Gaeke91d16b32003-10-11 05:34:00 +0000671$GNUPLOT = "/usr/dcs/software/supported/bin/gnuplot";
672$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
673$PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
674system ($GNUPLOT, $PlotScriptFilename);
Chris Lattner85d79a02003-01-22 16:14:05 +0000675
Chris Lattner6a36dc62003-01-20 06:11:03 +0000676#
677# Remove the cvs tree...
678#
679system "rm -rf $BuildDir" if (!$NOCHECKOUT and !$NOREMOVE);
680
Chris Lattner85d79a02003-01-22 16:14:05 +0000681#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000682# Print out information...
Chris Lattner85d79a02003-01-22 16:14:05 +0000683#
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000684if ($VERBOSE) {
Chris Lattner6a36dc62003-01-20 06:11:03 +0000685 print "DateString: $DateString\n";
686 print "CVS Checkout: $CVSCheckoutTime seconds\n";
687 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000688 print "Build Time: $BuildTime seconds\n";
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000689 print "Feature Test Time: $FeatureTime seconds\n";
690 print "Regression Test Time: $RegressionTime seconds\n";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000691 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
692
693 print "WARNINGS:\n $WarningsList\n";
694
Chris Lattner6a36dc62003-01-20 06:11:03 +0000695 print "Users committed: $UserCommitList\n";
696 print "Added Files: \n $AddedFilesList\n";
697 print "Modified Files: \n $ModifiedFilesList\n";
698 print "Removed Files: \n $RemovedFilesList\n";
699
700 print "Previous Days =\n $PrevDaysList\n";
701}
702
Chris Lattner85d79a02003-01-22 16:14:05 +0000703
Chris Lattner3dc06172003-01-20 18:05:27 +0000704#
705# Output the files...
706#
707
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000708if ( $VERBOSE ) {
709 print "OUTPUT STAGE\n";
710}
Chris Lattner3dc06172003-01-20 18:05:27 +0000711# Main HTML file...
Chris Lattner6a36dc62003-01-20 06:11:03 +0000712my $Output;
713eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
Chris Lattner3dc06172003-01-20 18:05:27 +0000714WriteFile "$DATE.html", $Output;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000715
716# Change the index.html symlink...
717system "ln -sf $DATE.html index.html";
718
719sub AddRecord {
720 my ($Val, $Filename) = @_;
721 my @Records;
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000722 if (open FILE, "$WebDir/$Filename") {
Chris Lattner6a36dc62003-01-20 06:11:03 +0000723 @Records = grep !/$DATE/, split "\n", <FILE>;
724 close FILE;
725 }
726 push @Records, "$DATE: $Val";
Chris Lattner05c8f642003-08-19 18:35:03 +0000727 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000728 return @Records;
729}