blob: 7393041c277320d5ae7dd4504076cc8d30085cb2 [file] [log] [blame]
Alkis Evlogimenos2e142f52004-01-07 01:48:26 +00001#!/usr/bin/perl -w
Chris Lattner4c7e3032003-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 Gaekeb3dab902003-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 Lattner4d00fde2004-05-28 20:30:23 +000016# -nofeaturetests Do not run the feature tests.
17# -noregressiontests Do not run the regression tests.
Brian Gaekeb3dab902003-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.
Reid Spencerf6d02332004-06-11 07:06:22 +000023# -release Build an LLVM Release version
24# -pedantic Enable additional GCC warnings to detect possible errors.
Chris Lattnerbb0aca52003-12-19 03:47:31 +000025# -enable-linscan Enable linearscan tests
Chris Lattner20d13ea2004-06-03 03:29:39 +000026# -disable-codegen Disable LLC and JIT tests in the nightly tester.
Chris Lattner4d00fde2004-05-28 20:30:23 +000027# -verbose Turn on some debug output
28# -debug Print information useful only to maintainers of this script.
Chris Lattnerbb0aca52003-12-19 03:47:31 +000029#
Brian Gaekeb3dab902003-10-11 05:34:00 +000030# CVSROOT is the CVS repository from which the tree will be checked out,
31# specified either in the full :method:user@host:/dir syntax, or
32# just /dir if using a local repo.
33# BUILDDIR is the directory where sources for this test run will be checked out
34# AND objects for this test run will be built. This directory MUST NOT
35# exist before the script is run; it will be created by the cvs checkout
36# process and erased (unless -noremove is specified; see above.)
37# WEBDIR is the directory into which the test results web page will be written,
38# AND in which the "index.html" is assumed to be a symlink to the most recent
39# copy of the results. This directory MUST exist before the script is run.
Chris Lattner4c7e3032003-01-20 06:11:03 +000040#
41use POSIX qw(strftime);
42
Brian Gaekeb3dab902003-10-11 05:34:00 +000043my $HOME = $ENV{'HOME'};
44my $CVSRootDir = $ENV{'CVSROOT'};
Chris Lattner9d13efa2003-10-14 01:22:08 +000045 $CVSRootDir = "/home/vadve/shared/PublicCVS"
Chris Lattner4d00fde2004-05-28 20:30:23 +000046 unless $CVSRootDir;
47my $BuildDir = $ENV{'BUILDDIR'};
48 $BuildDir = "$HOME/buildtest"
49 unless $BuildDir;
50my $WebDir = $ENV{'WEBDIR'};
51 $WebDir = "$HOME/cvs/testresults-X86"
52 unless $WebDir;
Chris Lattner2f8cb572003-01-20 18:05:27 +000053
54# Calculate the date prefix...
55@TIME = localtime;
56my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
57my $DateString = strftime "%B %d, %Y", localtime;
58
Chris Lattnerb3440302003-01-22 16:14:05 +000059sub ReadFile {
Chris Lattner196a14a2003-08-19 15:08:34 +000060 undef $/;
Chris Lattnerb3440302003-01-22 16:14:05 +000061 if (open (FILE, $_[0])) {
62 my $Ret = <FILE>;
63 close FILE;
64 return $Ret;
65 } else {
66 print "Could not open file '$_[0]' for reading!";
67 return "";
68 }
69}
70
Chris Lattner2f8cb572003-01-20 18:05:27 +000071sub WriteFile { # (filename, contents)
72 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
73 print FILE $_[1];
74 close FILE;
75}
76
77sub GetRegex { # (Regex with ()'s, value)
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +000078 $_[1] =~ /$_[0]/m;
Chris Lattner08e24762003-08-19 18:35:03 +000079 if (defined($1)) {
80 return $1;
81 }
82 return "?";
Chris Lattner2f8cb572003-01-20 18:05:27 +000083}
84
85sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
86 $_ = shift;
Chris Lattner1cbc0a62003-01-20 19:18:44 +000087 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner2f8cb572003-01-20 18:05:27 +000088}
89
90sub GetDir {
91 my $Suffix = shift;
92 opendir DH, $WebDir;
93 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
94 closedir DH;
95 return @Result;
96}
97
98# DiffFiles - Diff the current version of the file against the last version of
99# the file, reporting things added and removed. This is used to report, for
100# example, added and removed warnings. This returns a pair (added, removed)
101#
102sub DiffFiles {
103 my $Suffix = shift;
104 my @Others = GetDir $Suffix;
105 if (@Others == 0) { # No other files? We added all entries...
106 return (`cat $WebDir/$DATE$Suffix`, "");
107 }
108 # Diff the files now...
109 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
110 my $Added = join "\n", grep /^</, @Diffs;
111 my $Removed = join "\n", grep /^>/, @Diffs;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000112 $Added =~ s/^< //gm;
113 $Removed =~ s/^> //gm;
Chris Lattner2f8cb572003-01-20 18:05:27 +0000114 return ($Added, $Removed);
115}
116
Chris Lattner196a14a2003-08-19 15:08:34 +0000117# FormatTime - Convert a time from 1m23.45 into 83.45
118sub FormatTime {
119 my $Time = shift;
120 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
121 $Time = sprintf("%7.4f", $1*60.0+$2);
122 }
123 return $Time;
124}
125
Chris Lattner2f8cb572003-01-20 18:05:27 +0000126
Chris Lattner4c7e3032003-01-20 06:11:03 +0000127# Command line argument settings...
128my $NOCHECKOUT = 0;
129my $NOREMOVE = 0;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000130my $NOFEATURES = 0;
131my $NOREGRESSIONS = 0;
Chris Lattnerb3440302003-01-22 16:14:05 +0000132my $NOTEST = 0;
Chris Lattner08e24762003-08-19 18:35:03 +0000133my $NORUNNINGTESTS = 0;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000134my $MAKEOPTS = "";
Chris Lattner20d13ea2004-06-03 03:29:39 +0000135my $PROGTESTOPTS = "";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000136my $VERBOSE = 0;
137my $DEBUG = 0;
Brian Gaeke1770e2c2004-06-03 21:46:56 +0000138my $CONFIGUREARGS = "--enable-jit";
Brian Gaekeb3dab902003-10-11 05:34:00 +0000139
Brian Gaeke1770e2c2004-06-03 21:46:56 +0000140# Parse arguments...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000141while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
142 shift;
143 last if /^--$/; # Stop processing arguments on --
144
145 # List command line options here...
Chris Lattner08e24762003-08-19 18:35:03 +0000146 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
147 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Chris Lattner20d13ea2004-06-03 03:29:39 +0000148 if (/^-nofeaturetests$/) { $NOFEATURES = 1; next; }
149 if (/^-noregressiontests$/){ $NOREGRESSIONS = 1; next; }
Chris Lattner08e24762003-08-19 18:35:03 +0000150 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
151 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
Reid Spencerf6d02332004-06-11 07:06:22 +0000152 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
153 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
154 if (/^-pedantic$/) {
155 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -Weffc++ -ffor-scope'";
156 next;
157 }
Chris Lattner20d13ea2004-06-03 03:29:39 +0000158 if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; }
Brian Gaeke1770e2c2004-06-03 21:46:56 +0000159 if (/^-disable-codegen$/){ $PROGTESTOPTS .= " DISABLE_JIT=1 DISABLE_LLC=1";
160 $CONFIGUREARGS="--disable-jit --disable-llc_diffs";
161 next; }
Chris Lattner4d00fde2004-05-28 20:30:23 +0000162 if (/^-verbose$/) { $VERBOSE = 1; next; }
163 if (/^-debug$/) { $DEBUG = 1; next; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000164
165 print "Unknown option: $_ : ignoring!\n";
166}
167
Brian Gaeke1770e2c2004-06-03 21:46:56 +0000168if ($ENV{'LLVMGCCDIR'}) {
169 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
170}
171
Chris Lattner2f8cb572003-01-20 18:05:27 +0000172die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000173
Chris Lattner4c7e3032003-01-20 06:11:03 +0000174if (@ARGV == 3) {
175 $CVSRootDir = $ARGV[0];
176 $BuildDir = $ARGV[1];
177 $WebDir = $ARGV[2];
178}
179
Chris Lattner4d00fde2004-05-28 20:30:23 +0000180
Misha Brukman1b366892003-07-07 21:27:40 +0000181my $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000182my $Prefix = "$WebDir/$DATE";
183
Chris Lattner4d00fde2004-05-28 20:30:23 +0000184if ($VERBOSE) {
185 print "INITIALIZED\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000186 print "CVS Root = $CVSRootDir\n";
187 print "BuildDir = $BuildDir\n";
188 print "WebDir = $WebDir\n";
189 print "Prefix = $Prefix\n";
190}
191
Chris Lattnerb3440302003-01-22 16:14:05 +0000192
193#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000194# Create the CVS repository directory
Chris Lattnerb3440302003-01-22 16:14:05 +0000195#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000196if (!$NOCHECKOUT) {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000197 if (-d $BuildDir) {
198 if (!$NOREMOVE) {
Reid Spencer542e8592004-05-30 00:17:47 +0000199 system "rm -rf $BuildDir";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000200 } else {
201 die "CVS checkout directory $BuildDir already exists!";
202 }
203 }
Misha Brukman1b366892003-07-07 21:27:40 +0000204 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000205}
Misha Brukman1b366892003-07-07 21:27:40 +0000206chdir $BuildDir or die "Could not change to CVS checkout directory $BuildDir!";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000207
Chris Lattnerb3440302003-01-22 16:14:05 +0000208
209#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000210# Check out the llvm tree, saving CVS messages to the cvs log...
Chris Lattnerb3440302003-01-22 16:14:05 +0000211#
Brian Gaekeb3dab902003-10-11 05:34:00 +0000212$CVSOPT = "";
213$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
Chris Lattner4d00fde2004-05-28 20:30:23 +0000214if (!$NOCHECKOUT) {
215 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
216 system "(time -p cvs $CVSOPT -d $CVSRootDir co llvm) > $Prefix-CVS-Log.txt 2>&1";
217}
Chris Lattner4c7e3032003-01-20 06:11:03 +0000218
219chdir "llvm" or die "Could not change into llvm directory!";
220
Chris Lattner4d00fde2004-05-28 20:30:23 +0000221if (!$NOCHECKOUT) {
222 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
223 system "cvs update -P -d > /dev/null 2>&1" ;
224}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000225
Chris Lattner4c7e3032003-01-20 06:11:03 +0000226# Read in the HTML template file...
Chris Lattnerb3440302003-01-22 16:14:05 +0000227my $TemplateContents = ReadFile $Template;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000228
Chris Lattnerb3440302003-01-22 16:14:05 +0000229
230#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000231# Get some static statistics about the current state of CVS
Chris Lattnerb3440302003-01-22 16:14:05 +0000232#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000233my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $Prefix-CVS-Log.txt`;
Brian Gaekeac5d96b2003-12-01 05:31:12 +0000234my $NumFilesInCVS = `egrep '^U' $Prefix-CVS-Log.txt | wc -l` + 0;
235my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $Prefix-CVS-Log.txt | wc -l` + 0;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000236$LOC = GetRegex "([0-9]+) +total", `wc -l \`utils/getsrcs.sh\` | grep total`;
237
Chris Lattnerb3440302003-01-22 16:14:05 +0000238#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000239# Build the entire tree, saving build messages to the build log
Chris Lattnerb3440302003-01-22 16:14:05 +0000240#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000241if (!$NOCHECKOUT) {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000242 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
Brian Gaeke1770e2c2004-06-03 21:46:56 +0000243 system "(time -p ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $Prefix-Build-Log.txt 2>&1";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000244
Chris Lattner4d00fde2004-05-28 20:30:23 +0000245 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000246 # Build the entire tree, capturing the output into $Prefix-Build-Log.txt
Chris Lattner42815c82003-07-01 16:02:00 +0000247 system "(time -p gmake $MAKEOPTS) >> $Prefix-Build-Log.txt 2>&1";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000248}
249
Chris Lattnerb3440302003-01-22 16:14:05 +0000250
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000251sub GetRegexNum {
252 my ($Regex, $Num, $Regex2, $File) = @_;
253 my @Items = split "\n", `grep '$Regex' $File`;
254 return GetRegex $Regex2, $Items[$Num];
255}
256
Chris Lattnerb3440302003-01-22 16:14:05 +0000257#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000258# Get some statistics about the build...
Chris Lattnerb3440302003-01-22 16:14:05 +0000259#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000260my @Linked = split '\n', `grep Linking $Prefix-Build-Log.txt`;
261my $NumExecutables = scalar(grep(/executable/, @Linked));
262my $NumLibraries = scalar(grep(!/executable/, @Linked));
263my $NumObjects = `grep '^Compiling' $Prefix-Build-Log.txt | wc -l` + 0;
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000264
265my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$Prefix-Build-Log.txt";
266my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$Prefix-Build-Log.txt";
Chris Lattner00d7af62003-08-18 14:07:03 +0000267my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000268my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$Prefix-Build-Log.txt";
269
270my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$Prefix-Build-Log.txt";
271my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$Prefix-Build-Log.txt";
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000272my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000273my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$Prefix-Build-Log.txt";
274
Chris Lattnerb3440302003-01-22 16:14:05 +0000275my $BuildError = "";
Chris Lattner338dd7e2003-09-23 20:33:04 +0000276if (`grep '^gmake[^:]*: .*Error' $Prefix-Build-Log.txt | wc -l` + 0 ||
Chris Lattnerccee2962003-09-23 22:02:01 +0000277 `grep '^gmake: \*\*\*.*Stop.' $Prefix-Build-Log.txt | wc -l`+0) {
Misha Brukman71b0a312003-08-21 20:22:52 +0000278 $BuildError = "<h3><font color='red'>Build error: compilation " .
279 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000280 print "BUILD ERROR\n";
Chris Lattnerb3440302003-01-22 16:14:05 +0000281}
Chris Lattner4c7e3032003-01-20 06:11:03 +0000282
Chris Lattner4d00fde2004-05-28 20:30:23 +0000283sub GetQMTestResults { # (filename)
284 my ($filename) = @_;
285 my @lines;
286 my $firstline;
287 $/ = "\n"; #Make sure we're going line at a time.
288 if (open SRCHFILE, $filename) {
Reid Spencer542e8592004-05-30 00:17:47 +0000289 # Skip stuff before ---TEST RESULTS
Chris Lattner4d00fde2004-05-28 20:30:23 +0000290 while ( <SRCHFILE> ) {
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000291 if ( m/^--- TEST RESULTS/ ) { last; }
Chris Lattner4d00fde2004-05-28 20:30:23 +0000292 }
Reid Spencer542e8592004-05-30 00:17:47 +0000293 # Process test results
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000294 push(@lines,"<h3>TEST RESULTS</h3><ol><li>\n");
295 my $first_list = 1;
296 my $should_break = 1;
Reid Spencerf5d0af32004-06-08 08:01:33 +0000297 my $nocopy = 0;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000298 while ( <SRCHFILE> ) {
299 if ( length($_) > 1 ) {
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000300 chomp($_);
301 if ( ! m/: PASS[ ]*$/ &&
302 ! m/^ qmtest.target:/ &&
303 ! m/^ local/ &&
304 ! m/^gmake:/ ) {
Reid Spencerf5d0af32004-06-08 08:01:33 +0000305 if ( m/: XFAIL/ ) {
306 $nocopy = 1;
307 } elsif ( m/: XPASS/ || m/: FAIL/ ) {
308 $nocopy = 0;
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000309 if ( $first_list ) {
310 $first_list = 0;
311 $should_break = 1;
312 push(@lines,"<b>$_</b><br/>\n");
313 } else {
314 push(@lines,"</li><li><b>$_</b><br/>\n");
315 }
316 } elsif ( m/^--- STATISTICS/ ) {
317 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
318 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
319 $should_break = 0;
Reid Spencerf5d0af32004-06-08 08:01:33 +0000320 $nocopy = 0;
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000321 } elsif ( m/^--- TESTS WITH/ ) {
322 $should_break = 1;
323 $first_list = 1;
Reid Spencerf5d0af32004-06-08 08:01:33 +0000324 $nocopy = 0;
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000325 push(@lines,"</pre><h3>TESTS WITH UNEXPECTED RESULTS</h3><ol><li>\n");
326 } elsif ( m/^real / ) {
327 last;
Reid Spencerf5d0af32004-06-08 08:01:33 +0000328 } elsif (!$nocopy) {
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000329 if ( $should_break ) {
330 push(@lines,"$_<br/>\n");
331 } else {
332 push(@lines,"$_\n");
333 }
334 }
Chris Lattner4d00fde2004-05-28 20:30:23 +0000335 }
336 }
337 }
338 close SRCHFILE;
339 }
340 my $content = join("",@lines);
Reid Spencerf5d0af32004-06-08 08:01:33 +0000341 return "$content</li></ol>\n";
342}
Chris Lattner4d00fde2004-05-28 20:30:23 +0000343
Chris Lattner4d00fde2004-05-28 20:30:23 +0000344# Get results of feature tests.
345my $FeatureTestResults; # String containing the results of the feature tests
346my $FeatureTime; # System+CPU Time for feature tests
347my $FeatureWallTime; # Wall Clock Time for feature tests
348if (!$NOFEATURES) {
349 if ( $VERBOSE ) { print "FEATURE TEST STAGE\n"; }
350 my $feature_output = "$Prefix-FeatureTests-Log.txt";
351
352 # Run the feature tests so we can summarize the results
353 system "(time -p gmake -C test Feature.t) > $feature_output 2>&1";
354
355 # Extract test results
356 $FeatureTestResults = GetQMTestResults("$feature_output");
357
358 # Extract time of feature tests
359 my $FeatureTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$feature_output";
360 my $FeatureTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$feature_output";
361 $FeatureTime = $FeatureTimeU+$FeatureTimeS; # FeatureTime = User+System
362 $FeatureWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$feature_output";
363 # Run the regression tests so we can summarize the results
364} else {
365 $FeatureTestResults = "Skipped by user choice.";
366 $FeatureTime = "0.0";
367 $FeatureWallTime = "0.0";
368}
369
370if (!$NOREGRESSIONS) {
371 if ( $VERBOSE ) { print "REGRESSION TEST STAGE\n"; }
372 my $regression_output = "$Prefix-RegressionTests-Log.txt";
373
374 # Run the regression tests so we can summarize the results
375 system "(time -p gmake -C test Regression.t) > $regression_output 2>&1";
376
377 # Extract test results
378 $RegressionTestResults = GetQMTestResults("$regression_output");
379
380 # Extract time of regressions tests
381 my $RegressionTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$regression_output";
382 my $RegressionTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$regression_output";
383 $RegressionTime = $RegressionTimeU+$RegressionTimeS; # RegressionTime = User+System
384 $RegressionWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$regression_output";
385} else {
386 $RegressionTestResults = "Skipped by user choice.";
387 $RegressionTime = "0.0";
388 $RegressionWallTime = "0.0";
389}
390
391if ($DEBUG) {
392 print $FeatureTestResults;
393 print $RegressionTestResults;
394}
395
396if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerb3440302003-01-22 16:14:05 +0000397#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000398# Get warnings from the build
Chris Lattnerb3440302003-01-22 16:14:05 +0000399#
Misha Brukman1b366892003-07-07 21:27:40 +0000400my @Warn = split "\n", `egrep 'warning:|Entering dir' $Prefix-Build-Log.txt`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000401my @Warnings;
402my $CurDir = "";
403
404foreach $Warning (@Warn) {
405 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
406 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman8e9554a2003-08-14 15:26:28 +0000407 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner4c7e3032003-01-20 06:11:03 +0000408 $CurDir = $1;
409 }
410 } else {
411 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
412 }
413}
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000414my $WarningsFile = join "\n", @Warnings;
415my $WarningsList = AddPreTag $WarningsFile;
416$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000417
Chris Lattner2f8cb572003-01-20 18:05:27 +0000418# Emit the warnings file, so we can diff...
419WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
420my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000421
Chris Lattner9efd7f42003-10-18 19:31:39 +0000422# Output something to stdout if something has changed
423print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
424print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
425
Chris Lattnerbe197872003-10-19 16:54:00 +0000426$WarningsAdded = AddPreTag $WarningsAdded;
427$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattnerb3440302003-01-22 16:14:05 +0000428
429#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000430# Get some statistics about CVS commits over the current day...
Chris Lattnerb3440302003-01-22 16:14:05 +0000431#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000432if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000433@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
434#print join "\n", @CVSHistory; print "\n";
435
436# Extract some information from the CVS history... use a hash so no duplicate
437# stuff is stored.
Misha Brukman1b366892003-07-07 21:27:40 +0000438my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000439
Brian Gaeke43f38672004-06-10 07:44:28 +0000440my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000441
Chris Lattner4c7e3032003-01-20 06:11:03 +0000442# Loop over every record from the CVS history, filling in the hashes.
443foreach $File (@CVSHistory) {
444 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman8e9554a2003-08-14 15:26:28 +0000445 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000446 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattnerd56147d2004-01-12 16:55:30 +0000447 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
448 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman1b366892003-07-07 21:27:40 +0000449 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000450 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner4c7e3032003-01-20 06:11:03 +0000451 } else {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000452 print "UNMATCHABLE: $File\n";
Brian Gaeke43f38672004-06-10 07:44:28 +0000453 next;
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000454 }
455 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
456
457 if ($Filename =~ /^llvm/) {
458 if ($Type eq 'M') { # Modified
459 $ModifiedFiles{$Filename} = 1;
460 $UsersCommitted{$UID} = 1;
461 } elsif ($Type eq 'A') { # Added
462 $AddedFiles{$Filename} = 1;
463 $UsersCommitted{$UID} = 1;
464 } elsif ($Type eq 'R') { # Removed
465 $RemovedFiles{$Filename} = 1;
466 $UsersCommitted{$UID} = 1;
467 } else {
468 $UsersUpdated{$UID} = 1;
469 }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000470 }
471}
472
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000473my $UserCommitList = join "\n", keys %UsersCommitted;
474my $UserUpdateList = join "\n", keys %UsersUpdated;
Chris Lattnerc9cdadf2003-08-06 16:02:50 +0000475my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
476my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
477my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000478
Chris Lattnerec0e3742003-02-28 20:30:20 +0000479my $TestError = 1;
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000480my $SingleSourceProgramsTable;
481my $MultiSourceProgramsTable;
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000482my $ExternalProgramsTable;
Chris Lattnerb3440302003-01-22 16:14:05 +0000483
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000484
485sub TestDirectory {
486 my $SubDir = shift;
487
488 chdir "test/Programs/$SubDir" or
489 die "Could not change into test/Programs/$SubDir testdir!";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000490
491 # Run the programs tests... creating a report.nightly.html file
492 if (!$NOTEST) {
Chris Lattner20d13ea2004-06-03 03:29:39 +0000493 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Chris Lattnerbb0aca52003-12-19 03:47:31 +0000494 . "TEST=nightly > $Prefix-$SubDir-ProgramTest.txt 2>&1";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000495 } else {
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000496 system "gunzip $Prefix-$SubDir-ProgramTest.txt.gz";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000497 }
498
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000499 my $ProgramsTable;
Chris Lattnerc7294152003-08-20 15:44:33 +0000500 if (`grep '^gmake[^:]: .*Error' $Prefix-$SubDir-ProgramTest.txt | wc -l` + 0){
Chris Lattnerec0e3742003-02-28 20:30:20 +0000501 $TestError = 1;
Chris Lattner2e8be142003-05-10 21:40:10 +0000502 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000503 print "ERROR TESTING\n";
Chris Lattnerc7294152003-08-20 15:44:33 +0000504 } elsif (`grep '^gmake[^:]: .*No rule to make target' $Prefix-$SubDir-ProgramTest.txt | wc -l` + 0) {
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000505 $TestError = 1;
506 $ProgramsTable =
507 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000508 print "ERROR TESTING\n";
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000509 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000510 $TestError = 0;
511 $ProgramsTable = ReadFile "report.nightly.html";
512
513 #
514 # Create a list of the tests which were run...
515 #
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000516 system "egrep 'TEST-(PASS|FAIL)' < $Prefix-$SubDir-ProgramTest.txt "
517 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000518 }
519
520 # Compress the test output
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000521 system "gzip -f $Prefix-$SubDir-ProgramTest.txt";
522 chdir "../../.." or die "Cannot return to parent directory!";
523 return $ProgramsTable;
524}
525
Chris Lattner196a14a2003-08-19 15:08:34 +0000526# If we build the tree successfully, run the nightly programs tests...
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000527if ($BuildError eq "") {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000528 if ( $VERBOSE ) {
529 print "SingleSource TEST STAGE\n";
530 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000531 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattner4d00fde2004-05-28 20:30:23 +0000532 if ( $VERBOSE ) {
533 print "MultiSource TEST STAGE\n";
534 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000535 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Chris Lattner4d00fde2004-05-28 20:30:23 +0000536 if ( $VERBOSE ) {
537 print "External TEST STAGE\n";
538 }
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000539 $ExternalProgramsTable = TestDirectory("External");
Chris Lattnerf5a6ab92003-08-18 15:11:13 +0000540 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000541 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Chris Lattner5d6c4382003-01-23 19:31:28 +0000542}
Chris Lattnerb3440302003-01-22 16:14:05 +0000543
Chris Lattner4d00fde2004-05-28 20:30:23 +0000544if ( $VERBOSE ) {
545 print "TEST INFORMATION COLLECTION STAGE\n";
546}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000547my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
548
Chris Lattnerec0e3742003-02-28 20:30:20 +0000549if ($TestError) {
550 $TestsAdded = "<b>error testing</b><br>";
551 $TestsRemoved = "<b>error testing</b><br>";
552 $TestsFixed = "<b>error testing</b><br>";
553 $TestsBroken = "<b>error testing</b><br>";
554} else {
555 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
556
557 my @RawTestsAddedArray = split '\n', $RTestsAdded;
558 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
559
560 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
561 @RawTestsRemovedArray;
562 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
563 @RawTestsAddedArray;
564
565 foreach $Test (keys %NewTests) {
566 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
567 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000568 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000569 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
570 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
571 } else {
572 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
573 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000574 }
575 }
Chris Lattnerec0e3742003-02-28 20:30:20 +0000576 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
577 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
578 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000579
Chris Lattner91480ff2003-10-21 15:47:31 +0000580 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
581 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
582 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
583 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnerbe197872003-10-19 16:54:00 +0000584
Chris Lattnerec0e3742003-02-28 20:30:20 +0000585 $TestsAdded = AddPreTag $TestsAdded;
586 $TestsRemoved = AddPreTag $TestsRemoved;
587 $TestsFixed = AddPreTag $TestsFixed;
588 $TestsBroken = AddPreTag $TestsBroken;
589}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000590
Chris Lattner9efd7f42003-10-18 19:31:39 +0000591
Chris Lattner196a14a2003-08-19 15:08:34 +0000592# If we built the tree successfully, runs of the Olden suite with
593# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
594if ($BuildError eq "") {
Chris Lattner08e24762003-08-19 18:35:03 +0000595 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattner196a14a2003-08-19 15:08:34 +0000596 $MachCodeSize) = ("","","","","","","");
Chris Lattner08e24762003-08-19 18:35:03 +0000597 if (!$NORUNNINGTESTS) {
Chris Lattner8f9c4bd2003-09-14 06:00:49 +0000598 chdir "test/Programs/MultiSource/Benchmarks/Olden" or die "Olden tests moved?";
Chris Lattner196a14a2003-08-19 15:08:34 +0000599
600 # Clean out previous results...
601 system "gmake $MAKEOPTS clean > /dev/null 2>&1";
602
603 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE enabled!
Brian Gaeke85668542004-06-04 00:07:12 +0000604 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattner196a14a2003-08-19 15:08:34 +0000605 " LARGE_PROBLEM_SIZE=1 > /dev/null 2>&1";
606 system "cp report.nightly.raw.out $Prefix-Olden-tests.txt";
607 } else {
608 system "gunzip $Prefix-Olden-tests.txt.gz";
609 }
610
611 # Now we know we have $Prefix-Olden-tests.txt as the raw output file. Split
612 # it up into records and read the useful information.
Chris Lattner08e24762003-08-19 18:35:03 +0000613 my @Records = split />>> ========= /, ReadFile "$Prefix-Olden-tests.txt";
Chris Lattner196a14a2003-08-19 15:08:34 +0000614 shift @Records; # Delete the first (garbage) record
615
616 # Loop over all of the records, summarizing them into rows for the running
617 # totals file.
618 my $WallTimeRE = "[A-Za-z0-9.: ]+\\(([0-9.]+) wall clock";
619 foreach $Rec (@Records) {
Chris Lattner08e24762003-08-19 18:35:03 +0000620 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: real\s*([.0-9m]+)', $Rec;
621 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: real\s*([.0-9m]+)', $Rec;
622 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: real\s*([.0-9m]+)', $Rec;
623 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: real\s*([.0-9m]+)', $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000624 my $rOptTime = GetRegex "TEST-RESULT-compile: $WallTimeRE", $Rec;
625 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
626 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
627
628 $NATTime .= " " . FormatTime($rNATTime);
629 $CBETime .= " " . FormatTime($rCBETime);
630 $LLCTime .= " " . FormatTime($rLLCTime);
631 $JITTime .= " " . FormatTime($rJITTime);
632 $OptTime .= " $rOptTime";
Chris Lattner08e24762003-08-19 18:35:03 +0000633 $BytecodeSize .= " $rBytecodeSize";
634 $MachCodeSize .= " $rMachCodeSize";
Chris Lattner196a14a2003-08-19 15:08:34 +0000635 }
636
637 # Now that we have all of the numbers we want, add them to the running totals
638 # files.
Chris Lattner08e24762003-08-19 18:35:03 +0000639 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattner196a14a2003-08-19 15:08:34 +0000640 AddRecord($CBETime, "running_Olden_cbe_time.txt");
641 AddRecord($LLCTime, "running_Olden_llc_time.txt");
642 AddRecord($JITTime, "running_Olden_jit_time.txt");
643 AddRecord($OptTime, "running_Olden_opt_time.txt");
644 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
645 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
Chris Lattner08e24762003-08-19 18:35:03 +0000646
647 system "gzip -f $Prefix-Olden-tests.txt";
Chris Lattner196a14a2003-08-19 15:08:34 +0000648}
649
650
651
652
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000653#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000654# Get a list of the previous days that we can link to...
Chris Lattnerb3440302003-01-22 16:14:05 +0000655#
Chris Lattner2f8cb572003-01-20 18:05:27 +0000656my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000657
658splice @PrevDays, 20; # Trim down list to something reasonable...
659
660my $PrevDaysList = # Format list for sidebar
661 join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
662
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000663#
664# Start outputing files into the web directory
665#
666chdir $WebDir or die "Could not change into web directory!";
667
668# Add information to the files which accumulate information for graphs...
669AddRecord($LOC, "running_loc.txt");
670AddRecord($BuildTime, "running_build_time.txt");
671
Chris Lattner4d00fde2004-05-28 20:30:23 +0000672if ( $VERBOSE ) {
673 print "GRAPH GENERATION STAGE\n";
674}
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000675#
676# Rebuild the graphs now...
677#
Brian Gaekeb3dab902003-10-11 05:34:00 +0000678$GNUPLOT = "/usr/dcs/software/supported/bin/gnuplot";
679$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
680$PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
681system ($GNUPLOT, $PlotScriptFilename);
Chris Lattnerb3440302003-01-22 16:14:05 +0000682
Chris Lattner4c7e3032003-01-20 06:11:03 +0000683#
684# Remove the cvs tree...
685#
686system "rm -rf $BuildDir" if (!$NOCHECKOUT and !$NOREMOVE);
687
Chris Lattnerb3440302003-01-22 16:14:05 +0000688#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000689# Print out information...
Chris Lattnerb3440302003-01-22 16:14:05 +0000690#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000691if ($VERBOSE) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000692 print "DateString: $DateString\n";
693 print "CVS Checkout: $CVSCheckoutTime seconds\n";
694 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000695 print "Build Time: $BuildTime seconds\n";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000696 print "Feature Test Time: $FeatureTime seconds\n";
697 print "Regression Test Time: $RegressionTime seconds\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000698 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
699
700 print "WARNINGS:\n $WarningsList\n";
701
Chris Lattner4c7e3032003-01-20 06:11:03 +0000702 print "Users committed: $UserCommitList\n";
703 print "Added Files: \n $AddedFilesList\n";
704 print "Modified Files: \n $ModifiedFilesList\n";
705 print "Removed Files: \n $RemovedFilesList\n";
706
707 print "Previous Days =\n $PrevDaysList\n";
708}
709
Chris Lattnerb3440302003-01-22 16:14:05 +0000710
Chris Lattner2f8cb572003-01-20 18:05:27 +0000711#
712# Output the files...
713#
714
Chris Lattner4d00fde2004-05-28 20:30:23 +0000715if ( $VERBOSE ) {
716 print "OUTPUT STAGE\n";
717}
Chris Lattner2f8cb572003-01-20 18:05:27 +0000718# Main HTML file...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000719my $Output;
720eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000721WriteFile "$DATE.html", $Output;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000722
723# Change the index.html symlink...
724system "ln -sf $DATE.html index.html";
725
726sub AddRecord {
727 my ($Val, $Filename) = @_;
728 my @Records;
Chris Lattner196a14a2003-08-19 15:08:34 +0000729 if (open FILE, "$WebDir/$Filename") {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000730 @Records = grep !/$DATE/, split "\n", <FILE>;
731 close FILE;
732 }
733 push @Records, "$DATE: $Val";
Chris Lattner08e24762003-08-19 18:35:03 +0000734 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000735 return @Records;
736}