blob: fe036bc3423485326eaea67b92ed50e6665a47ca [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.
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.
Reid Spencer1d914632004-06-23 07:45:46 +000020# -noexternals Do not run the external tests (for cases where povray
21# or SPEC are not installed)
Tanya Lattner056ec062004-12-04 06:25:50 +000022# -nodejagnu Do not run feature or regression tests
Brian Gaekeb3dab902003-10-11 05:34:00 +000023# -parallel Run two parallel jobs with GNU Make.
Reid Spencerf6d02332004-06-11 07:06:22 +000024# -release Build an LLVM Release version
25# -pedantic Enable additional GCC warnings to detect possible errors.
Reid Spencer39ce11b2005-01-13 18:02:40 +000026# -enable-llcbeta Enable testing of beta features in llc.
Brian Gaeke047e6062004-08-05 19:54:59 +000027# -disable-llc Disable LLC tests in the nightly tester.
28# -disable-jit Disable JIT tests in the nightly tester.
Chris Lattner4d00fde2004-05-28 20:30:23 +000029# -verbose Turn on some debug output
30# -debug Print information useful only to maintainers of this script.
Reid Spencercb6a3aa2004-06-22 15:38:37 +000031# -nice Checkout/Configure/Build with "nice" to reduce impact
32# on busy servers.
Misha Brukman2e9ac692004-11-08 03:28:27 +000033# -f2c Next argument specifies path to F2C utility
Reid Spencercb6a3aa2004-06-22 15:38:37 +000034# -gnuplotscript Next argument specifies gnuplot script to use
35# -templatefile Next argument specifies template file to use
Chris Lattner892cdb32004-07-27 08:29:06 +000036# -gccpath Path to gcc/g++ used to build LLVM
Chris Lattnerbb0aca52003-12-19 03:47:31 +000037#
Brian Gaekeb3dab902003-10-11 05:34:00 +000038# CVSROOT is the CVS repository from which the tree will be checked out,
39# specified either in the full :method:user@host:/dir syntax, or
40# just /dir if using a local repo.
41# BUILDDIR is the directory where sources for this test run will be checked out
42# AND objects for this test run will be built. This directory MUST NOT
43# exist before the script is run; it will be created by the cvs checkout
44# process and erased (unless -noremove is specified; see above.)
45# WEBDIR is the directory into which the test results web page will be written,
46# AND in which the "index.html" is assumed to be a symlink to the most recent
Brian Gaeke90c82b92004-09-28 16:04:00 +000047# copy of the results. This directory will be created if it does not exist.
Reid Spencer932b69f2004-12-26 05:21:13 +000048# LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
49# to. This is the same as you would have for a normal LLVM build.
Chris Lattner4c7e3032003-01-20 06:11:03 +000050#
51use POSIX qw(strftime);
Tanya Lattner5debe8c2004-11-21 00:02:40 +000052use File::Copy;
Chris Lattner4c7e3032003-01-20 06:11:03 +000053
Brian Gaekeb3dab902003-10-11 05:34:00 +000054my $HOME = $ENV{'HOME'};
55my $CVSRootDir = $ENV{'CVSROOT'};
Chris Lattner9d13efa2003-10-14 01:22:08 +000056 $CVSRootDir = "/home/vadve/shared/PublicCVS"
Chris Lattner4d00fde2004-05-28 20:30:23 +000057 unless $CVSRootDir;
58my $BuildDir = $ENV{'BUILDDIR'};
59 $BuildDir = "$HOME/buildtest"
60 unless $BuildDir;
61my $WebDir = $ENV{'WEBDIR'};
62 $WebDir = "$HOME/cvs/testresults-X86"
63 unless $WebDir;
Chris Lattner2f8cb572003-01-20 18:05:27 +000064
65# Calculate the date prefix...
66@TIME = localtime;
67my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
68my $DateString = strftime "%B %d, %Y", localtime;
Chris Lattner004e19e2005-02-13 16:08:30 +000069my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000070
71# Command line argument settings...
72my $NOCHECKOUT = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000073my $NOREMOVE = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000074my $NOTEST = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000075my $NORUNNINGTESTS = 0;
Reid Spencer1d914632004-06-23 07:45:46 +000076my $NOEXTERNALS = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000077my $MAKEOPTS = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000078my $PROGTESTOPTS = "";
Misha Brukman2e9ac692004-11-08 03:28:27 +000079my $VERBOSE = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000080my $DEBUG = 0;
Brian Gaeke047e6062004-08-05 19:54:59 +000081my $CONFIGUREARGS = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000082my $NICE = "";
Tanya Lattner056ec062004-12-04 06:25:50 +000083my $NODEJAGNU = 0;
Chris Lattner2f8cb572003-01-20 18:05:27 +000084
Chris Lattnerb3440302003-01-22 16:14:05 +000085sub ReadFile {
86 if (open (FILE, $_[0])) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +000087 undef $/;
Chris Lattnerb3440302003-01-22 16:14:05 +000088 my $Ret = <FILE>;
89 close FILE;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000090 $/ = '\n';
Chris Lattnerb3440302003-01-22 16:14:05 +000091 return $Ret;
92 } else {
93 print "Could not open file '$_[0]' for reading!";
94 return "";
95 }
96}
97
Chris Lattner2f8cb572003-01-20 18:05:27 +000098sub WriteFile { # (filename, contents)
99 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
100 print FILE $_[1];
101 close FILE;
102}
103
104sub GetRegex { # (Regex with ()'s, value)
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000105 $_[1] =~ /$_[0]/m;
Chris Lattner08e24762003-08-19 18:35:03 +0000106 if (defined($1)) {
107 return $1;
108 }
Reid Spencera337f0c2004-06-23 06:36:34 +0000109 return "0";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000110}
111
Brian Gaeke90c82b92004-09-28 16:04:00 +0000112sub Touch {
113 my @files = @_;
114 my $now = time;
115 foreach my $file (@files) {
116 if (! -f $file) {
117 open (FILE, ">$file") or warn "Could not create new file $file";
118 close FILE;
119 }
120 utime $now, $now, $file;
121 }
122}
123
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000124sub AddRecord {
125 my ($Val, $Filename) = @_;
126 my @Records;
127 if (open FILE, "$WebDir/$Filename") {
128 @Records = grep !/$DATE/, split "\n", <FILE>;
129 close FILE;
130 }
131 push @Records, "$DATE: $Val";
132 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000133}
134
Chris Lattner2f8cb572003-01-20 18:05:27 +0000135sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
136 $_ = shift;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000137 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner2f8cb572003-01-20 18:05:27 +0000138}
139
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000140sub ChangeDir { # directory, logical name
141 my ($dir,$name) = @_;
142 chomp($dir);
143 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
144 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
145}
146
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000147sub CopyFile { #filename, newfile
148 my ($file, $newfile) = @_;
149 chomp($file);
150 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
151 copy($file, $newfile);
152}
153
Chris Lattner2f8cb572003-01-20 18:05:27 +0000154sub GetDir {
155 my $Suffix = shift;
156 opendir DH, $WebDir;
157 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
158 closedir DH;
159 return @Result;
160}
161
162# DiffFiles - Diff the current version of the file against the last version of
163# the file, reporting things added and removed. This is used to report, for
164# example, added and removed warnings. This returns a pair (added, removed)
165#
166sub DiffFiles {
167 my $Suffix = shift;
168 my @Others = GetDir $Suffix;
169 if (@Others == 0) { # No other files? We added all entries...
170 return (`cat $WebDir/$DATE$Suffix`, "");
171 }
172 # Diff the files now...
173 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
174 my $Added = join "\n", grep /^</, @Diffs;
175 my $Removed = join "\n", grep /^>/, @Diffs;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000176 $Added =~ s/^< //gm;
177 $Removed =~ s/^> //gm;
Chris Lattner2f8cb572003-01-20 18:05:27 +0000178 return ($Added, $Removed);
179}
180
Chris Lattner196a14a2003-08-19 15:08:34 +0000181# FormatTime - Convert a time from 1m23.45 into 83.45
182sub FormatTime {
183 my $Time = shift;
184 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
185 $Time = sprintf("%7.4f", $1*60.0+$2);
186 }
187 return $Time;
188}
189
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000190sub GetRegexNum {
191 my ($Regex, $Num, $Regex2, $File) = @_;
192 my @Items = split "\n", `grep '$Regex' $File`;
193 return GetRegex $Regex2, $Items[$Num];
194}
195
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000196sub GetDejagnuTestResults { # (filename, log)
197 my ($filename, $DejagnuLog) = @_;
198 my @lines;
199 my $firstline;
200 $/ = "\n"; #Make sure we're going line at a time.
Chris Lattner453d0622005-03-10 16:26:50 +0000201
202 print "Dejagnu test results:\n";
203
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000204 if (open SRCHFILE, $filename) {
205 # Process test results
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000206 my $first_list = 1;
207 my $should_break = 1;
208 my $nocopy = 0;
209 my $readingsum = 0;
210 while ( <SRCHFILE> ) {
211 if ( length($_) > 1 ) {
212 chomp($_);
213 if ( m/^XPASS:/ || m/^FAIL:/ ) {
214 $nocopy = 0;
215 if ( $first_list ) {
Chris Lattner453d0622005-03-10 16:26:50 +0000216 push(@lines,"<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n");
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000217 $first_list = 0;
218 $should_break = 1;
219 push(@lines,"<b>$_</b><br/>\n");
Chris Lattner453d0622005-03-10 16:26:50 +0000220 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000221 } else {
222 push(@lines,"</li><li><b>$_</b><br/>\n");
Chris Lattner453d0622005-03-10 16:26:50 +0000223 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000224 }
225 } elsif ( m/Summary/ ) {
Chris Lattner453d0622005-03-10 16:26:50 +0000226 if ( $first_list ) {
227 push(@lines,"<b>PERFECT!</b>");
228 print " PERFECT!\n";
229 } else {
230 push(@lines, "</li></ol>\n");
231 }
232 push(@lines,"<h3>STATISTICS</h3><pre>\n");
233 print "\nSTATISTICS:\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000234 $should_break = 0;
235 $nocopy = 0;
236 $readingsum = 1;
237 } elsif ( $readingsum ) {
238 push(@lines,"$_\n");
Chris Lattner453d0622005-03-10 16:26:50 +0000239 print "$_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000240 }
241 }
242 }
243 }
244 push(@lines, "</pre>\n");
245 close SRCHFILE;
246
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000247 my $content = join("",@lines);
248 return "$content</li></ol>\n";
249}
250
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000251
252#####################################################################
253## MAIN PROGRAM
254#####################################################################
255
256my $Template = "";
257my $PlotScriptFilename = "";
258
259# Parse arguments...
260while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
261 shift;
262 last if /^--$/; # Stop processing arguments on --
263
264 # List command line options here...
265 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000266 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000267 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000268 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000269 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
270 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000271 if (/^-pedantic$/) {
272 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
273 next;
274 }
Chris Lattnerc82a6c82005-01-08 21:03:58 +0000275 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
Brian Gaeke047e6062004-08-05 19:54:59 +0000276 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
277 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
278 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
279 $CONFIGUREARGS .= " --disable-jit"; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000280 if (/^-verbose$/) { $VERBOSE = 1; next; }
281 if (/^-debug$/) { $DEBUG = 1; next; }
282 if (/^-nice$/) { $NICE = "nice "; next; }
283 if (/^-f2c$/) {
284 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
285 }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000286 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
Reid Spencerc5b67052004-06-23 14:07:12 +0000287 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000288 if (/^-gccpath/) {
289 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
290 }
Reid Spencer1d914632004-06-23 07:45:46 +0000291 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
Tanya Lattner056ec062004-12-04 06:25:50 +0000292 if(/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000293
294 print "Unknown option: $_ : ignoring!\n";
295}
296
Reid Spencer932b69f2004-12-26 05:21:13 +0000297if ($ENV{'LLVMGCCDIR'}) {
298 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
299}
Brian Gaeke047e6062004-08-05 19:54:59 +0000300if ($CONFIGUREARGS !~ /--disable-jit/) {
301 $CONFIGUREARGS .= " --enable-jit";
302}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000303
304die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
305
306if (@ARGV == 3) {
307 $CVSRootDir = $ARGV[0];
308 $BuildDir = $ARGV[1];
309 $WebDir = $ARGV[2];
310}
311
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000312my $Prefix = "$WebDir/$DATE";
313
314#define the file names we'll use
315my $BuildLog = "$Prefix-Build-Log.txt";
316my $CVSLog = "$Prefix-CVS-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000317my $OldenTestsLog = "$Prefix-Olden-tests.txt";
318my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
319my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
320my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000321my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
322my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
323my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000324
325if ($VERBOSE) {
326 print "INITIALIZED\n";
327 print "CVS Root = $CVSRootDir\n";
328 print "BuildDir = $BuildDir\n";
329 print "WebDir = $WebDir\n";
330 print "Prefix = $Prefix\n";
331 print "CVSLog = $CVSLog\n";
332 print "BuildLog = $BuildLog\n";
333}
334
Brian Gaeke90c82b92004-09-28 16:04:00 +0000335if (! -d $WebDir) {
336 mkdir $WebDir, 0777;
337 warn "Warning: $WebDir did not exist; creating it.\n";
338}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000339
340#
341# Create the CVS repository directory
342#
343if (!$NOCHECKOUT) {
344 if (-d $BuildDir) {
345 if (!$NOREMOVE) {
346 system "rm -rf $BuildDir";
347 } else {
348 die "CVS checkout directory $BuildDir already exists!";
349 }
350 }
351 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
352}
353
354ChangeDir( $BuildDir, "CVS checkout directory" );
355
356
357#
358# Check out the llvm tree, saving CVS messages to the cvs log...
359#
360$CVSOPT = "";
361$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
362if (!$NOCHECKOUT) {
363 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
Reid Spencer214c6d62004-09-05 20:57:22 +0000364 system "( time -p $NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm; cd llvm/projects ; " .
365 "$NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm-test ) > $CVSLog 2>&1";
Reid Spencer10ffe012004-09-05 07:58:10 +0000366 ChangeDir( $BuildDir , "CVS Checkout directory") ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000367}
368
369ChangeDir( "llvm" , "llvm source directory") ;
370
371if (!$NOCHECKOUT) {
372 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
Reid Spencer10ffe012004-09-05 07:58:10 +0000373 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000374}
375
Reid Spencerc5b67052004-06-23 14:07:12 +0000376if ( $Template eq "" ) {
377 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
378}
379die "Template file $Template is not readable" if ( ! -r "$Template" );
380
381if ( $PlotScriptFilename eq "" ) {
382 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
383}
384die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
385
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000386# Read in the HTML template file...
387if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
388my $TemplateContents = ReadFile $Template;
389
390#
391# Get some static statistics about the current state of CVS
392#
393my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
394my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
395my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
Reid Spencere993f462004-09-06 19:32:55 +0000396$LOC = `utils/countloc.sh`;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000397
398#
399# Build the entire tree, saving build messages to the build log
400#
401if (!$NOCHECKOUT) {
402 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
403 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
404
405 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
406 # Build the entire tree, capturing the output into $BuildLog
407 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
408}
409
410
411#
412# Get some statistics about the build...
413#
414my @Linked = split '\n', `grep Linking $BuildLog`;
415my $NumExecutables = scalar(grep(/executable/, @Linked));
416my $NumLibraries = scalar(grep(!/executable/, @Linked));
417my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0;
418
419my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
420my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
421my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
422my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
423
424my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
425my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
426my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
427my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
428
Misha Brukman9a612752005-01-12 03:31:38 +0000429my $BuildError = 0, $BuildStatus = "OK";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000430if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
431 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
Misha Brukman9a612752005-01-12 03:31:38 +0000432 $BuildStatus = "<h3><font color='red'>error: compilation " .
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000433 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
Misha Brukman9a612752005-01-12 03:31:38 +0000434 $BuildError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000435 if ($VERBOSE) { print "BUILD ERROR\n"; }
436}
437
Tanya Lattner056ec062004-12-04 06:25:50 +0000438if ($BuildError) { $NODEJAGNU=1; }
Brian Gaeke22800982004-06-25 07:25:28 +0000439
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000440my $DejangnuTestResults; # String containing the results of the dejagnu
Tanya Lattner59a86552004-12-04 06:35:14 +0000441if(!$NODEJAGNU) {
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000442 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
443
444 my $dejagnu_output = "$DejagnuTestsLog";
445
446 #Run the feature and regression tests, results are put into testrun.sum
447 #Full log in testrun.log
Tanya Lattner056ec062004-12-04 06:25:50 +0000448 system "(time -p gmake $MAKEOPTS check) > $dejagnu_output 2>&1";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000449
450 #Extract time of dejagnu tests
451 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
452 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
453 $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
454 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
455
456 #Copy the testrun.log and testrun.sum to our webdir
457 CopyFile("test/testrun.log", $DejagnuLog);
458 CopyFile("test/testrun.sum", $DejagnuSum);
459
460 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
Tanya Lattnera2dfbf92004-12-17 20:58:34 +0000461
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000462} else {
463 $DejagnuTestResults = "Skipped by user choice.";
464 $DejagnuTime = "0.0";
465 $DejagnuWallTime = "0.0";
466}
467
Chris Lattner4d00fde2004-05-28 20:30:23 +0000468if ($DEBUG) {
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000469 print $DejagnuTestResults;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000470}
471
472if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerb3440302003-01-22 16:14:05 +0000473#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000474# Get warnings from the build
Chris Lattnerb3440302003-01-22 16:14:05 +0000475#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000476my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000477my @Warnings;
478my $CurDir = "";
479
480foreach $Warning (@Warn) {
481 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
482 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman8e9554a2003-08-14 15:26:28 +0000483 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner4c7e3032003-01-20 06:11:03 +0000484 $CurDir = $1;
485 }
486 } else {
487 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
488 }
489}
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000490my $WarningsFile = join "\n", @Warnings;
491my $WarningsList = AddPreTag $WarningsFile;
492$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000493
Chris Lattner2f8cb572003-01-20 18:05:27 +0000494# Emit the warnings file, so we can diff...
495WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
496my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000497
Chris Lattner9efd7f42003-10-18 19:31:39 +0000498# Output something to stdout if something has changed
499print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
500print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
501
Chris Lattnerbe197872003-10-19 16:54:00 +0000502$WarningsAdded = AddPreTag $WarningsAdded;
503$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattnerb3440302003-01-22 16:14:05 +0000504
505#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000506# Get some statistics about CVS commits over the current day...
Chris Lattnerb3440302003-01-22 16:14:05 +0000507#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000508if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000509@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
510#print join "\n", @CVSHistory; print "\n";
511
512# Extract some information from the CVS history... use a hash so no duplicate
513# stuff is stored.
Misha Brukman1b366892003-07-07 21:27:40 +0000514my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000515
Brian Gaeke43f38672004-06-10 07:44:28 +0000516my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000517
Chris Lattner4c7e3032003-01-20 06:11:03 +0000518# Loop over every record from the CVS history, filling in the hashes.
519foreach $File (@CVSHistory) {
520 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman8e9554a2003-08-14 15:26:28 +0000521 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000522 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattnerd56147d2004-01-12 16:55:30 +0000523 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
524 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman1b366892003-07-07 21:27:40 +0000525 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000526 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner4c7e3032003-01-20 06:11:03 +0000527 } else {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000528 print "UNMATCHABLE: $File\n";
Brian Gaeke43f38672004-06-10 07:44:28 +0000529 next;
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000530 }
531 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
532
533 if ($Filename =~ /^llvm/) {
534 if ($Type eq 'M') { # Modified
535 $ModifiedFiles{$Filename} = 1;
536 $UsersCommitted{$UID} = 1;
537 } elsif ($Type eq 'A') { # Added
538 $AddedFiles{$Filename} = 1;
539 $UsersCommitted{$UID} = 1;
540 } elsif ($Type eq 'R') { # Removed
541 $RemovedFiles{$Filename} = 1;
542 $UsersCommitted{$UID} = 1;
543 } else {
544 $UsersUpdated{$UID} = 1;
545 }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000546 }
547}
548
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000549my $UserCommitList = join "\n", keys %UsersCommitted;
550my $UserUpdateList = join "\n", keys %UsersUpdated;
Chris Lattnerc9cdadf2003-08-06 16:02:50 +0000551my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
552my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
553my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000554
Chris Lattnerec0e3742003-02-28 20:30:20 +0000555my $TestError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000556my $SingleSourceProgramsTable = "!";
557my $MultiSourceProgramsTable = "!";
558my $ExternalProgramsTable = "!";
Chris Lattnerb3440302003-01-22 16:14:05 +0000559
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000560
561sub TestDirectory {
562 my $SubDir = shift;
563
Reid Spencer10ffe012004-09-05 07:58:10 +0000564 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000565
566 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000567
568 # Run the programs tests... creating a report.nightly.html file
569 if (!$NOTEST) {
Chris Lattner20d13ea2004-06-03 03:29:39 +0000570 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000571 . "TEST=nightly > $ProgramTestLog 2>&1";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000572 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000573 system "gunzip ${ProgramTestLog}.gz";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000574 }
575
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000576 my $ProgramsTable;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000577 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
Chris Lattnerec0e3742003-02-28 20:30:20 +0000578 $TestError = 1;
Chris Lattner2e8be142003-05-10 21:40:10 +0000579 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000580 print "ERROR TESTING\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000581 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000582 $TestError = 1;
583 $ProgramsTable =
584 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000585 print "ERROR TESTING\n";
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000586 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000587 $TestError = 0;
588 $ProgramsTable = ReadFile "report.nightly.html";
589
590 #
591 # Create a list of the tests which were run...
592 #
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000593 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000594 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000595 }
596
597 # Compress the test output
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000598 system "gzip -f $ProgramTestLog";
599 ChangeDir( "../../..", "Programs Test Parent Directory" );
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000600 return $ProgramsTable;
601}
602
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000603# If we built the tree successfully, run the nightly programs tests...
Misha Brukman9a612752005-01-12 03:31:38 +0000604if (!$BuildError) {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000605 if ( $VERBOSE ) {
606 print "SingleSource TEST STAGE\n";
607 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000608 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattner4d00fde2004-05-28 20:30:23 +0000609 if ( $VERBOSE ) {
610 print "MultiSource TEST STAGE\n";
611 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000612 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Reid Spencer1d914632004-06-23 07:45:46 +0000613 if ( ! $NOEXTERNALS ) {
614 if ( $VERBOSE ) {
615 print "External TEST STAGE\n";
616 }
617 $ExternalProgramsTable = TestDirectory("External");
618 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000619 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Reid Spencer1d914632004-06-23 07:45:46 +0000620 } else {
Reid Spencerb8e825b2004-12-04 22:18:28 +0000621 $ExternalProgramsTable = '<tr><td>External TEST STAGE SKIPPED</td></tr>';
Reid Spencer1d914632004-06-23 07:45:46 +0000622 if ( $VERBOSE ) {
623 print "External TEST STAGE SKIPPED\n";
624 }
625 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
626 " | sort > $Prefix-Tests.txt";
627 }
Chris Lattner5d6c4382003-01-23 19:31:28 +0000628}
Chris Lattnerb3440302003-01-22 16:14:05 +0000629
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000630if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000631my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
632
Chris Lattnerec0e3742003-02-28 20:30:20 +0000633if ($TestError) {
634 $TestsAdded = "<b>error testing</b><br>";
635 $TestsRemoved = "<b>error testing</b><br>";
636 $TestsFixed = "<b>error testing</b><br>";
637 $TestsBroken = "<b>error testing</b><br>";
638} else {
639 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
640
641 my @RawTestsAddedArray = split '\n', $RTestsAdded;
642 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
643
644 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
645 @RawTestsRemovedArray;
646 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
647 @RawTestsAddedArray;
648
649 foreach $Test (keys %NewTests) {
650 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
651 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000652 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000653 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
654 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
655 } else {
656 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
657 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000658 }
659 }
Chris Lattnerec0e3742003-02-28 20:30:20 +0000660 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
661 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
662 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000663
Chris Lattner91480ff2003-10-21 15:47:31 +0000664 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
665 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
666 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
667 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnerbe197872003-10-19 16:54:00 +0000668
Chris Lattnerec0e3742003-02-28 20:30:20 +0000669 $TestsAdded = AddPreTag $TestsAdded;
670 $TestsRemoved = AddPreTag $TestsRemoved;
671 $TestsFixed = AddPreTag $TestsFixed;
672 $TestsBroken = AddPreTag $TestsBroken;
673}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000674
Chris Lattner9efd7f42003-10-18 19:31:39 +0000675
Chris Lattner196a14a2003-08-19 15:08:34 +0000676# If we built the tree successfully, runs of the Olden suite with
677# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
Misha Brukman9a612752005-01-12 03:31:38 +0000678if (!$BuildError) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000679 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
Chris Lattner08e24762003-08-19 18:35:03 +0000680 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattner196a14a2003-08-19 15:08:34 +0000681 $MachCodeSize) = ("","","","","","","");
Chris Lattner08e24762003-08-19 18:35:03 +0000682 if (!$NORUNNINGTESTS) {
Reid Spencer10ffe012004-09-05 07:58:10 +0000683 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000684 "Olden Test Directory");
Chris Lattner196a14a2003-08-19 15:08:34 +0000685
686 # Clean out previous results...
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000687 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
Chris Lattner196a14a2003-08-19 15:08:34 +0000688
Chris Lattner36dc5c72004-11-06 21:35:40 +0000689 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
690 # GET_STABLE_NUMBERS enabled!
Brian Gaeke85668542004-06-04 00:07:12 +0000691 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattner36dc5c72004-11-06 21:35:40 +0000692 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000693 system "cp report.nightly.raw.out $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000694 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000695 system "gunzip ${OldenTestsLog}.gz";
Chris Lattner196a14a2003-08-19 15:08:34 +0000696 }
697
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000698 # Now we know we have $OldenTestsLog as the raw output file. Split
Chris Lattner196a14a2003-08-19 15:08:34 +0000699 # it up into records and read the useful information.
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000700 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000701 shift @Records; # Delete the first (garbage) record
702
703 # Loop over all of the records, summarizing them into rows for the running
704 # totals file.
Chris Lattnerfed8a142004-12-14 22:42:59 +0000705 my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
Chris Lattner196a14a2003-08-19 15:08:34 +0000706 foreach $Rec (@Records) {
Chris Lattner36dc5c72004-11-06 21:35:40 +0000707 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
708 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
709 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
710 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
Chris Lattnerfed8a142004-12-14 22:42:59 +0000711 my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000712 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
713 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
714
715 $NATTime .= " " . FormatTime($rNATTime);
716 $CBETime .= " " . FormatTime($rCBETime);
717 $LLCTime .= " " . FormatTime($rLLCTime);
718 $JITTime .= " " . FormatTime($rJITTime);
719 $OptTime .= " $rOptTime";
Chris Lattner08e24762003-08-19 18:35:03 +0000720 $BytecodeSize .= " $rBytecodeSize";
721 $MachCodeSize .= " $rMachCodeSize";
Chris Lattner196a14a2003-08-19 15:08:34 +0000722 }
723
724 # Now that we have all of the numbers we want, add them to the running totals
725 # files.
Chris Lattner08e24762003-08-19 18:35:03 +0000726 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattner196a14a2003-08-19 15:08:34 +0000727 AddRecord($CBETime, "running_Olden_cbe_time.txt");
728 AddRecord($LLCTime, "running_Olden_llc_time.txt");
729 AddRecord($JITTime, "running_Olden_jit_time.txt");
730 AddRecord($OptTime, "running_Olden_opt_time.txt");
731 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
732 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
Chris Lattner08e24762003-08-19 18:35:03 +0000733
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000734 system "gzip -f $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000735}
736
737
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000738#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000739# Get a list of the previous days that we can link to...
Chris Lattnerb3440302003-01-22 16:14:05 +0000740#
Chris Lattner2f8cb572003-01-20 18:05:27 +0000741my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000742
Brian Gaeke253231e2004-06-11 19:55:30 +0000743if ((scalar @PrevDays) > 20) {
744 splice @PrevDays, 20; # Trim down list to something reasonable...
745}
Chris Lattner4c7e3032003-01-20 06:11:03 +0000746
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000747# Format list for sidebar
748my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000749
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000750#
Brian Gaeke90c82b92004-09-28 16:04:00 +0000751# Start outputting files into the web directory
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000752#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000753ChangeDir( $WebDir, "Web Directory" );
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000754
Brian Gaeke90c82b92004-09-28 16:04:00 +0000755# Make sure we don't get errors running the nightly tester the first time
756# because of files that don't exist.
757Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
758 'running_loc.txt', 'running_Olden_machcode.txt',
759 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
760 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
761 'running_Olden_jit_time.txt');
762
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000763# Add information to the files which accumulate information for graphs...
764AddRecord($LOC, "running_loc.txt");
765AddRecord($BuildTime, "running_build_time.txt");
766
Chris Lattner4d00fde2004-05-28 20:30:23 +0000767if ( $VERBOSE ) {
768 print "GRAPH GENERATION STAGE\n";
769}
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000770#
771# Rebuild the graphs now...
772#
Chris Lattnerfe2597a2004-07-27 18:41:49 +0000773$GNUPLOT = "/usr/bin/gnuplot";
Brian Gaekeb3dab902003-10-11 05:34:00 +0000774$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000775system ("$GNUPLOT", $PlotScriptFilename);
Chris Lattnerb3440302003-01-22 16:14:05 +0000776
Chris Lattner4c7e3032003-01-20 06:11:03 +0000777#
778# Remove the cvs tree...
779#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000780system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000781
Chris Lattnerb3440302003-01-22 16:14:05 +0000782#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000783# Print out information...
Chris Lattnerb3440302003-01-22 16:14:05 +0000784#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000785if ($VERBOSE) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000786 print "DateString: $DateString\n";
787 print "CVS Checkout: $CVSCheckoutTime seconds\n";
788 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000789 print "Build Time: $BuildTime seconds\n";
790 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
791
792 print "WARNINGS:\n $WarningsList\n";
793
Chris Lattner4c7e3032003-01-20 06:11:03 +0000794 print "Users committed: $UserCommitList\n";
795 print "Added Files: \n $AddedFilesList\n";
796 print "Modified Files: \n $ModifiedFilesList\n";
797 print "Removed Files: \n $RemovedFilesList\n";
798
799 print "Previous Days =\n $PrevDaysList\n";
800}
801
Chris Lattnerb3440302003-01-22 16:14:05 +0000802
Chris Lattner2f8cb572003-01-20 18:05:27 +0000803#
804# Output the files...
805#
806
Chris Lattner4d00fde2004-05-28 20:30:23 +0000807if ( $VERBOSE ) {
808 print "OUTPUT STAGE\n";
809}
Chris Lattner2f8cb572003-01-20 18:05:27 +0000810# Main HTML file...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000811my $Output;
Chris Lattner004e19e2005-02-13 16:08:30 +0000812my $TestFinishTime = gmtime() . " GMT<br>" . localtime() . " (local)";
813
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000814my $TestPlatform = `uname -a`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000815eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000816WriteFile "$DATE.html", $Output;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000817system ( "ln -sf $DATE.html index.html" );
Chris Lattner4c7e3032003-01-20 06:11:03 +0000818
819# Change the index.html symlink...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000820
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000821# vim: sw=2 ai