blob: fd022456e084c7ebd637554dbd828769f74183b5 [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
Reid Spencer39ce11b2005-01-13 18:02:40 +000025# -enable-llcbeta Enable testing of beta features in llc.
Brian Gaeke047e6062004-08-05 19:54:59 +000026# -disable-llc Disable LLC tests in the nightly tester.
27# -disable-jit Disable JIT tests in the nightly tester.
Chris Lattner4d00fde2004-05-28 20:30:23 +000028# -verbose Turn on some debug output
29# -debug Print information useful only to maintainers of this script.
Reid Spencercb6a3aa2004-06-22 15:38:37 +000030# -nice Checkout/Configure/Build with "nice" to reduce impact
31# on busy servers.
Misha Brukman2e9ac692004-11-08 03:28:27 +000032# -f2c Next argument specifies path to F2C utility
Reid Spencercb6a3aa2004-06-22 15:38:37 +000033# -gnuplotscript Next argument specifies gnuplot script to use
34# -templatefile Next argument specifies template file to use
Chris Lattner892cdb32004-07-27 08:29:06 +000035# -gccpath Path to gcc/g++ used to build LLVM
Misha Brukmanf5f37f02005-05-26 16:28:55 +000036# -cvstag Check out a specific CVS tag to build LLVM (useful for
37# testing release branches)
Misha Brukman4391bb52005-06-06 19:17:05 +000038# -target Specify the target triplet
Chris Lattnerbb0aca52003-12-19 03:47:31 +000039#
Chris Lattnerb0ddb492005-11-01 17:59:42 +000040# ---------------- Options to configure llvm-test ----------------------------
41# -spec2000path Path to the benchspec directory in the SPEC 2000 distro
42# -spec95path Path to the benchspec directory in the SPEC 95 distro.
43# -povraypath Path to the povray sources
44# -namdpath Path to the namd sources
45#
Brian Gaekeb3dab902003-10-11 05:34:00 +000046# CVSROOT is the CVS repository from which the tree will be checked out,
47# specified either in the full :method:user@host:/dir syntax, or
48# just /dir if using a local repo.
49# BUILDDIR is the directory where sources for this test run will be checked out
50# AND objects for this test run will be built. This directory MUST NOT
51# exist before the script is run; it will be created by the cvs checkout
52# process and erased (unless -noremove is specified; see above.)
53# WEBDIR is the directory into which the test results web page will be written,
54# AND in which the "index.html" is assumed to be a symlink to the most recent
Brian Gaeke90c82b92004-09-28 16:04:00 +000055# copy of the results. This directory will be created if it does not exist.
Reid Spencer932b69f2004-12-26 05:21:13 +000056# LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
57# to. This is the same as you would have for a normal LLVM build.
Chris Lattner4c7e3032003-01-20 06:11:03 +000058#
59use POSIX qw(strftime);
Tanya Lattner5debe8c2004-11-21 00:02:40 +000060use File::Copy;
Chris Lattner4c7e3032003-01-20 06:11:03 +000061
Brian Gaekeb3dab902003-10-11 05:34:00 +000062my $HOME = $ENV{'HOME'};
63my $CVSRootDir = $ENV{'CVSROOT'};
Chris Lattner9d13efa2003-10-14 01:22:08 +000064 $CVSRootDir = "/home/vadve/shared/PublicCVS"
Chris Lattner4d00fde2004-05-28 20:30:23 +000065 unless $CVSRootDir;
66my $BuildDir = $ENV{'BUILDDIR'};
67 $BuildDir = "$HOME/buildtest"
68 unless $BuildDir;
69my $WebDir = $ENV{'WEBDIR'};
70 $WebDir = "$HOME/cvs/testresults-X86"
71 unless $WebDir;
Chris Lattner2f8cb572003-01-20 18:05:27 +000072
73# Calculate the date prefix...
74@TIME = localtime;
75my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
76my $DateString = strftime "%B %d, %Y", localtime;
Chris Lattner004e19e2005-02-13 16:08:30 +000077my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000078
79# Command line argument settings...
80my $NOCHECKOUT = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000081my $NOREMOVE = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000082my $NOTEST = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000083my $NORUNNINGTESTS = 0;
Reid Spencer1d914632004-06-23 07:45:46 +000084my $NOEXTERNALS = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000085my $MAKEOPTS = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000086my $PROGTESTOPTS = "";
Misha Brukman2e9ac692004-11-08 03:28:27 +000087my $VERBOSE = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000088my $DEBUG = 0;
Brian Gaeke047e6062004-08-05 19:54:59 +000089my $CONFIGUREARGS = "";
Misha Brukmanf5f37f02005-05-26 16:28:55 +000090my $CVSCOOPT = "-APR";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000091my $NICE = "";
Tanya Lattner056ec062004-12-04 06:25:50 +000092my $NODEJAGNU = 0;
Chris Lattner2f8cb572003-01-20 18:05:27 +000093
Chris Lattnerb0ddb492005-11-01 17:59:42 +000094my $LLVMTESTCONFIGARGS = "";
95
Chris Lattnerb3440302003-01-22 16:14:05 +000096sub ReadFile {
97 if (open (FILE, $_[0])) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +000098 undef $/;
Chris Lattnerb3440302003-01-22 16:14:05 +000099 my $Ret = <FILE>;
100 close FILE;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000101 $/ = '\n';
Chris Lattnerb3440302003-01-22 16:14:05 +0000102 return $Ret;
103 } else {
104 print "Could not open file '$_[0]' for reading!";
105 return "";
106 }
107}
108
Chris Lattner2f8cb572003-01-20 18:05:27 +0000109sub WriteFile { # (filename, contents)
110 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
111 print FILE $_[1];
112 close FILE;
113}
114
115sub GetRegex { # (Regex with ()'s, value)
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000116 $_[1] =~ /$_[0]/m;
Chris Lattner08e24762003-08-19 18:35:03 +0000117 if (defined($1)) {
118 return $1;
119 }
Reid Spencera337f0c2004-06-23 06:36:34 +0000120 return "0";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000121}
122
Brian Gaeke90c82b92004-09-28 16:04:00 +0000123sub Touch {
124 my @files = @_;
125 my $now = time;
126 foreach my $file (@files) {
127 if (! -f $file) {
128 open (FILE, ">$file") or warn "Could not create new file $file";
129 close FILE;
130 }
131 utime $now, $now, $file;
132 }
133}
134
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000135sub AddRecord {
136 my ($Val, $Filename) = @_;
137 my @Records;
138 if (open FILE, "$WebDir/$Filename") {
139 @Records = grep !/$DATE/, split "\n", <FILE>;
140 close FILE;
141 }
142 push @Records, "$DATE: $Val";
143 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000144}
145
Chris Lattner2f8cb572003-01-20 18:05:27 +0000146sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
147 $_ = shift;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000148 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner2f8cb572003-01-20 18:05:27 +0000149}
150
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000151sub ChangeDir { # directory, logical name
152 my ($dir,$name) = @_;
153 chomp($dir);
154 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
155 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
156}
157
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000158sub CopyFile { #filename, newfile
159 my ($file, $newfile) = @_;
160 chomp($file);
161 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
162 copy($file, $newfile);
163}
164
Chris Lattner2f8cb572003-01-20 18:05:27 +0000165sub GetDir {
166 my $Suffix = shift;
167 opendir DH, $WebDir;
168 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
169 closedir DH;
170 return @Result;
171}
172
173# DiffFiles - Diff the current version of the file against the last version of
174# the file, reporting things added and removed. This is used to report, for
175# example, added and removed warnings. This returns a pair (added, removed)
176#
177sub DiffFiles {
178 my $Suffix = shift;
179 my @Others = GetDir $Suffix;
180 if (@Others == 0) { # No other files? We added all entries...
181 return (`cat $WebDir/$DATE$Suffix`, "");
182 }
183 # Diff the files now...
184 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
185 my $Added = join "\n", grep /^</, @Diffs;
186 my $Removed = join "\n", grep /^>/, @Diffs;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000187 $Added =~ s/^< //gm;
188 $Removed =~ s/^> //gm;
Chris Lattner2f8cb572003-01-20 18:05:27 +0000189 return ($Added, $Removed);
190}
191
Chris Lattner196a14a2003-08-19 15:08:34 +0000192# FormatTime - Convert a time from 1m23.45 into 83.45
193sub FormatTime {
194 my $Time = shift;
195 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
196 $Time = sprintf("%7.4f", $1*60.0+$2);
197 }
198 return $Time;
199}
200
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000201sub GetRegexNum {
202 my ($Regex, $Num, $Regex2, $File) = @_;
203 my @Items = split "\n", `grep '$Regex' $File`;
204 return GetRegex $Regex2, $Items[$Num];
205}
206
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000207sub GetDejagnuTestResults { # (filename, log)
208 my ($filename, $DejagnuLog) = @_;
209 my @lines;
210 my $firstline;
211 $/ = "\n"; #Make sure we're going line at a time.
Chris Lattner453d0622005-03-10 16:26:50 +0000212
Chris Lattner8f457312005-03-17 16:07:45 +0000213 print "DEJAGNU TEST RESULTS:\n";
Chris Lattner453d0622005-03-10 16:26:50 +0000214
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000215 if (open SRCHFILE, $filename) {
216 # Process test results
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000217 my $first_list = 1;
218 my $should_break = 1;
219 my $nocopy = 0;
220 my $readingsum = 0;
221 while ( <SRCHFILE> ) {
222 if ( length($_) > 1 ) {
223 chomp($_);
224 if ( m/^XPASS:/ || m/^FAIL:/ ) {
225 $nocopy = 0;
226 if ( $first_list ) {
Misha Brukmand3a54122005-03-10 16:32:33 +0000227 push(@lines, "<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n");
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000228 $first_list = 0;
229 $should_break = 1;
Misha Brukmand3a54122005-03-10 16:32:33 +0000230 push(@lines, "<b>$_</b><br/>\n");
Chris Lattner453d0622005-03-10 16:26:50 +0000231 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000232 } else {
Misha Brukmand3a54122005-03-10 16:32:33 +0000233 push(@lines, "</li><li><b>$_</b><br/>\n");
Chris Lattner453d0622005-03-10 16:26:50 +0000234 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000235 }
236 } elsif ( m/Summary/ ) {
Chris Lattner453d0622005-03-10 16:26:50 +0000237 if ( $first_list ) {
Misha Brukmand3a54122005-03-10 16:32:33 +0000238 push(@lines, "<b>PERFECT!</b>");
239 print " PERFECT!\n";
240 } else {
241 push(@lines, "</li></ol>\n");
242 }
243 push(@lines, "<h3>STATISTICS</h3><pre>\n");
Chris Lattner8f457312005-03-17 16:07:45 +0000244 print "\nDEJAGNU STATISTICS:\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000245 $should_break = 0;
246 $nocopy = 0;
247 $readingsum = 1;
248 } elsif ( $readingsum ) {
249 push(@lines,"$_\n");
Chris Lattner8f457312005-03-17 16:07:45 +0000250 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000251 }
252 }
253 }
254 }
255 push(@lines, "</pre>\n");
256 close SRCHFILE;
257
Misha Brukmand3a54122005-03-10 16:32:33 +0000258 my $content = join("", @lines);
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000259 return "$content</li></ol>\n";
260}
261
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000262
263#####################################################################
264## MAIN PROGRAM
265#####################################################################
266
267my $Template = "";
268my $PlotScriptFilename = "";
269
270# Parse arguments...
271while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
272 shift;
273 last if /^--$/; # Stop processing arguments on --
274
275 # List command line options here...
276 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000277 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000278 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000279 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000280 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
281 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
Chris Lattnerc82a6c82005-01-08 21:03:58 +0000282 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
Brian Gaeke047e6062004-08-05 19:54:59 +0000283 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
284 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
285 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
286 $CONFIGUREARGS .= " --disable-jit"; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000287 if (/^-verbose$/) { $VERBOSE = 1; next; }
288 if (/^-debug$/) { $DEBUG = 1; next; }
289 if (/^-nice$/) { $NICE = "nice "; next; }
290 if (/^-f2c$/) {
291 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
292 }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000293 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
Reid Spencerc5b67052004-06-23 14:07:12 +0000294 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000295 if (/^-gccpath/) {
296 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
297 }
Misha Brukmanf5f37f02005-05-26 16:28:55 +0000298 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
Misha Brukman4391bb52005-06-06 19:17:05 +0000299 if (/^-target/) {
300 $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next;
301 }
Reid Spencer1d914632004-06-23 07:45:46 +0000302 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
Misha Brukman4391bb52005-06-06 19:17:05 +0000303 if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
Chris Lattnerb0ddb492005-11-01 17:59:42 +0000304 if (/^-spec2000path$/) {
305 $LLVMTESTCONFIGARGS .= " --enable-spec2000=$ARGV[0]"; shift; next;
306 }
307 if (/^-spec95path$/) {
308 $LLVMTESTCONFIGARGS .= " --enable-spec95=$ARGV[0]"; shift; next;
309 }
310 if (/^-povraypath$/) {
311 $LLVMTESTCONFIGARGS .= " --enable-povray=$ARGV[0]"; shift; next;
312 }
313 if (/^-namdpath$/) {
314 $LLVMTESTCONFIGARGS .= " --enable-namd=$ARGV[0]"; shift; next;
315 }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000316 print "Unknown option: $_ : ignoring!\n";
317}
318
Reid Spencer932b69f2004-12-26 05:21:13 +0000319if ($ENV{'LLVMGCCDIR'}) {
320 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
321}
Brian Gaeke047e6062004-08-05 19:54:59 +0000322if ($CONFIGUREARGS !~ /--disable-jit/) {
323 $CONFIGUREARGS .= " --enable-jit";
324}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000325
326die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
327
328if (@ARGV == 3) {
329 $CVSRootDir = $ARGV[0];
330 $BuildDir = $ARGV[1];
331 $WebDir = $ARGV[2];
332}
333
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000334my $Prefix = "$WebDir/$DATE";
335
336#define the file names we'll use
337my $BuildLog = "$Prefix-Build-Log.txt";
338my $CVSLog = "$Prefix-CVS-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000339my $OldenTestsLog = "$Prefix-Olden-tests.txt";
340my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
341my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
342my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000343my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
344my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
345my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000346
347if ($VERBOSE) {
348 print "INITIALIZED\n";
349 print "CVS Root = $CVSRootDir\n";
350 print "BuildDir = $BuildDir\n";
351 print "WebDir = $WebDir\n";
352 print "Prefix = $Prefix\n";
353 print "CVSLog = $CVSLog\n";
354 print "BuildLog = $BuildLog\n";
355}
356
Brian Gaeke90c82b92004-09-28 16:04:00 +0000357if (! -d $WebDir) {
358 mkdir $WebDir, 0777;
359 warn "Warning: $WebDir did not exist; creating it.\n";
360}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000361
362#
363# Create the CVS repository directory
364#
365if (!$NOCHECKOUT) {
366 if (-d $BuildDir) {
367 if (!$NOREMOVE) {
368 system "rm -rf $BuildDir";
369 } else {
370 die "CVS checkout directory $BuildDir already exists!";
371 }
372 }
373 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
374}
375
376ChangeDir( $BuildDir, "CVS checkout directory" );
377
378
379#
380# Check out the llvm tree, saving CVS messages to the cvs log...
381#
Misha Brukmanf5f37f02005-05-26 16:28:55 +0000382my $CVSOPT = "";
383# Use compression if going over ssh.
384$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
385my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000386if (!$NOCHECKOUT) {
387 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
Misha Brukmanf5f37f02005-05-26 16:28:55 +0000388 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
389 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
Reid Spencer10ffe012004-09-05 07:58:10 +0000390 ChangeDir( $BuildDir , "CVS Checkout directory") ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000391}
392
393ChangeDir( "llvm" , "llvm source directory") ;
394
395if (!$NOCHECKOUT) {
396 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
Reid Spencer10ffe012004-09-05 07:58:10 +0000397 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000398}
399
Reid Spencerc5b67052004-06-23 14:07:12 +0000400if ( $Template eq "" ) {
401 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
402}
403die "Template file $Template is not readable" if ( ! -r "$Template" );
404
405if ( $PlotScriptFilename eq "" ) {
406 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
407}
408die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
409
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000410# Read in the HTML template file...
411if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
412my $TemplateContents = ReadFile $Template;
413
414#
415# Get some static statistics about the current state of CVS
416#
417my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
418my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
419my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
Reid Spencere993f462004-09-06 19:32:55 +0000420$LOC = `utils/countloc.sh`;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000421
422#
423# Build the entire tree, saving build messages to the build log
424#
425if (!$NOCHECKOUT) {
426 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
Chris Lattnerb0ddb492005-11-01 17:59:42 +0000427 my $EXTRAFLAGS = "--enable-spec --with-objroot=.$LLVMTESTCONFIGARGS";
Chris Lattnere50caac2005-10-28 16:35:18 +0000428 system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000429
430 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
431 # Build the entire tree, capturing the output into $BuildLog
432 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
433}
434
435
436#
437# Get some statistics about the build...
438#
439my @Linked = split '\n', `grep Linking $BuildLog`;
440my $NumExecutables = scalar(grep(/executable/, @Linked));
441my $NumLibraries = scalar(grep(!/executable/, @Linked));
Chris Lattner0bb48282005-03-11 20:17:04 +0000442my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000443
444my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
445my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
446my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
447my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
448
449my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
450my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
451my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
452my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
453
Misha Brukman9a612752005-01-12 03:31:38 +0000454my $BuildError = 0, $BuildStatus = "OK";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000455if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
456 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
Misha Brukman9a612752005-01-12 03:31:38 +0000457 $BuildStatus = "<h3><font color='red'>error: compilation " .
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000458 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
Misha Brukman9a612752005-01-12 03:31:38 +0000459 $BuildError = 1;
Chris Lattner08313102005-12-11 19:55:39 +0000460 print "\n***ERROR BUILDING TREE\n\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000461}
462
Tanya Lattner056ec062004-12-04 06:25:50 +0000463if ($BuildError) { $NODEJAGNU=1; }
Brian Gaeke22800982004-06-25 07:25:28 +0000464
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000465my $DejangnuTestResults; # String containing the results of the dejagnu
Tanya Lattner59a86552004-12-04 06:35:14 +0000466if(!$NODEJAGNU) {
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000467 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
468
469 my $dejagnu_output = "$DejagnuTestsLog";
470
471 #Run the feature and regression tests, results are put into testrun.sum
472 #Full log in testrun.log
Tanya Lattner056ec062004-12-04 06:25:50 +0000473 system "(time -p gmake $MAKEOPTS check) > $dejagnu_output 2>&1";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000474
475 #Extract time of dejagnu tests
476 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
477 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
478 $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
479 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
480
481 #Copy the testrun.log and testrun.sum to our webdir
482 CopyFile("test/testrun.log", $DejagnuLog);
483 CopyFile("test/testrun.sum", $DejagnuSum);
484
485 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
Tanya Lattnera2dfbf92004-12-17 20:58:34 +0000486
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000487} else {
488 $DejagnuTestResults = "Skipped by user choice.";
489 $DejagnuTime = "0.0";
490 $DejagnuWallTime = "0.0";
491}
492
Chris Lattner4d00fde2004-05-28 20:30:23 +0000493if ($DEBUG) {
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000494 print $DejagnuTestResults;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000495}
496
497if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerb3440302003-01-22 16:14:05 +0000498#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000499# Get warnings from the build
Chris Lattnerb3440302003-01-22 16:14:05 +0000500#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000501my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000502my @Warnings;
503my $CurDir = "";
504
505foreach $Warning (@Warn) {
506 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
507 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman8e9554a2003-08-14 15:26:28 +0000508 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner4c7e3032003-01-20 06:11:03 +0000509 $CurDir = $1;
510 }
511 } else {
512 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
513 }
514}
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000515my $WarningsFile = join "\n", @Warnings;
516my $WarningsList = AddPreTag $WarningsFile;
517$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000518
Chris Lattner2f8cb572003-01-20 18:05:27 +0000519# Emit the warnings file, so we can diff...
520WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
521my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000522
Chris Lattner9efd7f42003-10-18 19:31:39 +0000523# Output something to stdout if something has changed
524print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
525print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
526
Chris Lattnerbe197872003-10-19 16:54:00 +0000527$WarningsAdded = AddPreTag $WarningsAdded;
528$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattnerb3440302003-01-22 16:14:05 +0000529
530#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000531# Get some statistics about CVS commits over the current day...
Chris Lattnerb3440302003-01-22 16:14:05 +0000532#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000533if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000534@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
535#print join "\n", @CVSHistory; print "\n";
536
537# Extract some information from the CVS history... use a hash so no duplicate
538# stuff is stored.
Misha Brukman1b366892003-07-07 21:27:40 +0000539my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000540
Brian Gaeke43f38672004-06-10 07:44:28 +0000541my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000542
Chris Lattner4c7e3032003-01-20 06:11:03 +0000543# Loop over every record from the CVS history, filling in the hashes.
544foreach $File (@CVSHistory) {
545 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman8e9554a2003-08-14 15:26:28 +0000546 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000547 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattnerd56147d2004-01-12 16:55:30 +0000548 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
549 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman1b366892003-07-07 21:27:40 +0000550 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000551 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner4c7e3032003-01-20 06:11:03 +0000552 } else {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000553 print "UNMATCHABLE: $File\n";
Brian Gaeke43f38672004-06-10 07:44:28 +0000554 next;
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000555 }
556 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
557
558 if ($Filename =~ /^llvm/) {
559 if ($Type eq 'M') { # Modified
560 $ModifiedFiles{$Filename} = 1;
561 $UsersCommitted{$UID} = 1;
562 } elsif ($Type eq 'A') { # Added
563 $AddedFiles{$Filename} = 1;
564 $UsersCommitted{$UID} = 1;
565 } elsif ($Type eq 'R') { # Removed
566 $RemovedFiles{$Filename} = 1;
567 $UsersCommitted{$UID} = 1;
568 } else {
569 $UsersUpdated{$UID} = 1;
570 }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000571 }
572}
573
Chris Lattner5e5d2202005-03-16 17:09:53 +0000574my $UserCommitList = join "\n", sort keys %UsersCommitted;
575my $UserUpdateList = join "\n", sort keys %UsersUpdated;
Chris Lattnerc9cdadf2003-08-06 16:02:50 +0000576my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
577my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
578my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000579
Chris Lattnerec0e3742003-02-28 20:30:20 +0000580my $TestError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000581my $SingleSourceProgramsTable = "!";
582my $MultiSourceProgramsTable = "!";
583my $ExternalProgramsTable = "!";
Chris Lattnerb3440302003-01-22 16:14:05 +0000584
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000585
586sub TestDirectory {
587 my $SubDir = shift;
588
Reid Spencer10ffe012004-09-05 07:58:10 +0000589 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000590
591 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000592
593 # Run the programs tests... creating a report.nightly.html file
594 if (!$NOTEST) {
Chris Lattner20d13ea2004-06-03 03:29:39 +0000595 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000596 . "TEST=nightly > $ProgramTestLog 2>&1";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000597 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000598 system "gunzip ${ProgramTestLog}.gz";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000599 }
600
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000601 my $ProgramsTable;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000602 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
Chris Lattnerec0e3742003-02-28 20:30:20 +0000603 $TestError = 1;
Chris Lattner2e8be142003-05-10 21:40:10 +0000604 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000605 print "ERROR TESTING\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000606 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000607 $TestError = 1;
608 $ProgramsTable =
609 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000610 print "ERROR TESTING\n";
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000611 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000612 $TestError = 0;
613 $ProgramsTable = ReadFile "report.nightly.html";
614
615 #
616 # Create a list of the tests which were run...
617 #
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000618 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000619 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000620 }
621
622 # Compress the test output
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000623 system "gzip -f $ProgramTestLog";
624 ChangeDir( "../../..", "Programs Test Parent Directory" );
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000625 return $ProgramsTable;
626}
627
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000628# If we built the tree successfully, run the nightly programs tests...
Misha Brukman9a612752005-01-12 03:31:38 +0000629if (!$BuildError) {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000630 if ( $VERBOSE ) {
631 print "SingleSource TEST STAGE\n";
632 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000633 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattner4d00fde2004-05-28 20:30:23 +0000634 if ( $VERBOSE ) {
635 print "MultiSource TEST STAGE\n";
636 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000637 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Reid Spencer1d914632004-06-23 07:45:46 +0000638 if ( ! $NOEXTERNALS ) {
639 if ( $VERBOSE ) {
640 print "External TEST STAGE\n";
641 }
642 $ExternalProgramsTable = TestDirectory("External");
643 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000644 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Reid Spencer1d914632004-06-23 07:45:46 +0000645 } else {
Reid Spencerb8e825b2004-12-04 22:18:28 +0000646 $ExternalProgramsTable = '<tr><td>External TEST STAGE SKIPPED</td></tr>';
Reid Spencer1d914632004-06-23 07:45:46 +0000647 if ( $VERBOSE ) {
648 print "External TEST STAGE SKIPPED\n";
649 }
650 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
651 " | sort > $Prefix-Tests.txt";
652 }
Chris Lattner5d6c4382003-01-23 19:31:28 +0000653}
Chris Lattnerb3440302003-01-22 16:14:05 +0000654
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000655if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000656my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
657
Chris Lattnerec0e3742003-02-28 20:30:20 +0000658if ($TestError) {
659 $TestsAdded = "<b>error testing</b><br>";
660 $TestsRemoved = "<b>error testing</b><br>";
661 $TestsFixed = "<b>error testing</b><br>";
662 $TestsBroken = "<b>error testing</b><br>";
663} else {
664 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
665
666 my @RawTestsAddedArray = split '\n', $RTestsAdded;
667 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
668
669 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
670 @RawTestsRemovedArray;
671 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
672 @RawTestsAddedArray;
673
674 foreach $Test (keys %NewTests) {
675 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
676 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000677 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000678 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
679 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
680 } else {
681 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
682 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000683 }
684 }
Chris Lattnerec0e3742003-02-28 20:30:20 +0000685 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
686 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
687 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000688
Chris Lattner91480ff2003-10-21 15:47:31 +0000689 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
690 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
691 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
692 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnerbe197872003-10-19 16:54:00 +0000693
Chris Lattnerec0e3742003-02-28 20:30:20 +0000694 $TestsAdded = AddPreTag $TestsAdded;
695 $TestsRemoved = AddPreTag $TestsRemoved;
696 $TestsFixed = AddPreTag $TestsFixed;
697 $TestsBroken = AddPreTag $TestsBroken;
698}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000699
Chris Lattner9efd7f42003-10-18 19:31:39 +0000700
Chris Lattner196a14a2003-08-19 15:08:34 +0000701# If we built the tree successfully, runs of the Olden suite with
702# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
Misha Brukman9a612752005-01-12 03:31:38 +0000703if (!$BuildError) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000704 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
Chris Lattner08e24762003-08-19 18:35:03 +0000705 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattner196a14a2003-08-19 15:08:34 +0000706 $MachCodeSize) = ("","","","","","","");
Chris Lattner08e24762003-08-19 18:35:03 +0000707 if (!$NORUNNINGTESTS) {
Reid Spencer10ffe012004-09-05 07:58:10 +0000708 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000709 "Olden Test Directory");
Chris Lattner196a14a2003-08-19 15:08:34 +0000710
711 # Clean out previous results...
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000712 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
Chris Lattner196a14a2003-08-19 15:08:34 +0000713
Chris Lattner36dc5c72004-11-06 21:35:40 +0000714 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
715 # GET_STABLE_NUMBERS enabled!
Brian Gaeke85668542004-06-04 00:07:12 +0000716 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattner36dc5c72004-11-06 21:35:40 +0000717 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000718 system "cp report.nightly.raw.out $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000719 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000720 system "gunzip ${OldenTestsLog}.gz";
Chris Lattner196a14a2003-08-19 15:08:34 +0000721 }
722
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000723 # Now we know we have $OldenTestsLog as the raw output file. Split
Chris Lattner196a14a2003-08-19 15:08:34 +0000724 # it up into records and read the useful information.
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000725 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000726 shift @Records; # Delete the first (garbage) record
727
728 # Loop over all of the records, summarizing them into rows for the running
729 # totals file.
Chris Lattnerfed8a142004-12-14 22:42:59 +0000730 my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
Chris Lattner196a14a2003-08-19 15:08:34 +0000731 foreach $Rec (@Records) {
Chris Lattner36dc5c72004-11-06 21:35:40 +0000732 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
733 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
734 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
735 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
Chris Lattnerfed8a142004-12-14 22:42:59 +0000736 my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000737 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000738
739 $NATTime .= " " . FormatTime($rNATTime);
740 $CBETime .= " " . FormatTime($rCBETime);
741 $LLCTime .= " " . FormatTime($rLLCTime);
742 $JITTime .= " " . FormatTime($rJITTime);
743 $OptTime .= " $rOptTime";
Chris Lattner08e24762003-08-19 18:35:03 +0000744 $BytecodeSize .= " $rBytecodeSize";
Chris Lattner196a14a2003-08-19 15:08:34 +0000745 }
746
747 # Now that we have all of the numbers we want, add them to the running totals
748 # files.
Chris Lattner08e24762003-08-19 18:35:03 +0000749 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattner196a14a2003-08-19 15:08:34 +0000750 AddRecord($CBETime, "running_Olden_cbe_time.txt");
751 AddRecord($LLCTime, "running_Olden_llc_time.txt");
752 AddRecord($JITTime, "running_Olden_jit_time.txt");
753 AddRecord($OptTime, "running_Olden_opt_time.txt");
754 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
Chris Lattner08e24762003-08-19 18:35:03 +0000755
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000756 system "gzip -f $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000757}
758
759
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000760#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000761# Get a list of the previous days that we can link to...
Chris Lattnerb3440302003-01-22 16:14:05 +0000762#
Chris Lattner2f8cb572003-01-20 18:05:27 +0000763my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000764
Brian Gaeke253231e2004-06-11 19:55:30 +0000765if ((scalar @PrevDays) > 20) {
766 splice @PrevDays, 20; # Trim down list to something reasonable...
767}
Chris Lattner4c7e3032003-01-20 06:11:03 +0000768
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000769# Format list for sidebar
770my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000771
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000772#
Brian Gaeke90c82b92004-09-28 16:04:00 +0000773# Start outputting files into the web directory
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000774#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000775ChangeDir( $WebDir, "Web Directory" );
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000776
Brian Gaeke90c82b92004-09-28 16:04:00 +0000777# Make sure we don't get errors running the nightly tester the first time
778# because of files that don't exist.
779Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
Chris Lattnere50caac2005-10-28 16:35:18 +0000780 'running_loc.txt',
Brian Gaeke90c82b92004-09-28 16:04:00 +0000781 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
782 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
783 'running_Olden_jit_time.txt');
784
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000785# Add information to the files which accumulate information for graphs...
786AddRecord($LOC, "running_loc.txt");
787AddRecord($BuildTime, "running_build_time.txt");
788
Chris Lattner4d00fde2004-05-28 20:30:23 +0000789if ( $VERBOSE ) {
790 print "GRAPH GENERATION STAGE\n";
791}
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000792#
793# Rebuild the graphs now...
794#
Chris Lattnerfe2597a2004-07-27 18:41:49 +0000795$GNUPLOT = "/usr/bin/gnuplot";
Brian Gaekeb3dab902003-10-11 05:34:00 +0000796$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000797system ("$GNUPLOT", $PlotScriptFilename);
Chris Lattnerb3440302003-01-22 16:14:05 +0000798
Chris Lattner4c7e3032003-01-20 06:11:03 +0000799#
800# Remove the cvs tree...
801#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000802system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000803
Chris Lattner5e5d2202005-03-16 17:09:53 +0000804print "\nUSERS WHO COMMITTED:\n " . (join "\n ", sort keys %UsersCommitted) . "\n"
805 if (scalar %UsersCommitted);
806
807print "\nADDED FILES:\n " . (join "\n ", sort keys %AddedFiles) . "\n"
808 if (scalar %AddedFiles);
809
810print "\nCHANGED FILES:\n " . (join "\n ", sort keys %ModifiedFiles) . "\n"
811 if (scalar %ModifiedFiles);
812
813print "\nREMOVED FILES:\n " . (join "\n ", sort keys %RemovedFiles) . "\n"
814 if (scalar %RemovedFiles);
815
Chris Lattnerb3440302003-01-22 16:14:05 +0000816#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000817# Print out information...
Chris Lattnerb3440302003-01-22 16:14:05 +0000818#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000819if ($VERBOSE) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000820 print "DateString: $DateString\n";
821 print "CVS Checkout: $CVSCheckoutTime seconds\n";
822 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000823 print "Build Time: $BuildTime seconds\n";
824 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
825
826 print "WARNINGS:\n $WarningsList\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000827 print "Previous Days =\n $PrevDaysList\n";
828}
829
Chris Lattnerb3440302003-01-22 16:14:05 +0000830
Chris Lattner2f8cb572003-01-20 18:05:27 +0000831#
832# Output the files...
833#
834
Chris Lattner4d00fde2004-05-28 20:30:23 +0000835if ( $VERBOSE ) {
836 print "OUTPUT STAGE\n";
837}
Chris Lattner2f8cb572003-01-20 18:05:27 +0000838# Main HTML file...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000839my $Output;
Chris Lattner004e19e2005-02-13 16:08:30 +0000840my $TestFinishTime = gmtime() . " GMT<br>" . localtime() . " (local)";
841
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000842my $TestPlatform = `uname -a`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000843eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000844WriteFile "$DATE.html", $Output;
Chris Lattnerd9aadd42006-01-31 16:10:53 +0000845
846# Remove the symlink before creating it for systems that don't have "ln -sf".
847system ("rm index.html");
848system ("ln -s $DATE.html index.html");
Chris Lattner4c7e3032003-01-20 06:11:03 +0000849
850# Change the index.html symlink...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000851
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000852# vim: sw=2 ai