blob: 7dd067e4f61ee77112d3e7a1bc44d51822e1b075 [file] [log] [blame]
Alkis Evlogimenos8b9d36e2004-01-07 01:48:26 +00001#!/usr/bin/perl -w
Chris Lattner6a36dc62003-01-20 06:11:03 +00002#
3# Program: NightlyTest.pl
4#
5# Synopsis: Perform a series of tests which are designed to be run nightly.
6# This is used to keep track of the status of the LLVM tree, tracking
7# regressions and performance changes. This generates one web page a
8# day which can be used to access this information.
9#
Brian Gaeke91d16b32003-10-11 05:34:00 +000010# Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR]
11# where
12# OPTIONS may include one or more of the following:
13# -nocheckout Do not create, checkout, update, or configure
14# the source tree.
15# -noremove Do not remove the BUILDDIR after it has been built.
Chris Lattnera9e9d2c2004-05-28 20:30:23 +000016# -nofeaturetests Do not run the feature tests.
17# -noregressiontests Do not run the regression tests.
Brian Gaeke91d16b32003-10-11 05:34:00 +000018# -notest Do not even attempt to run the test programs. Implies
19# -norunningtests.
20# -norunningtests Do not run the Olden benchmark suite with
21# LARGE_PROBLEM_SIZE enabled.
Reid Spencer2e44d872004-06-23 07:45:46 +000022# -noexternals Do not run the external tests (for cases where povray
23# or SPEC are not installed)
Tanya Lattnerc3d696f2004-11-21 00:02:40 +000024# -rundejagnu Runs features and regressions using Dejagnu
Brian Gaeke91d16b32003-10-11 05:34:00 +000025# -parallel Run two parallel jobs with GNU Make.
Reid Spencer80ae8442004-06-11 07:06:22 +000026# -release Build an LLVM Release version
27# -pedantic Enable additional GCC warnings to detect possible errors.
Chris Lattner8f668f262003-12-19 03:47:31 +000028# -enable-linscan Enable linearscan tests
Brian Gaekec5189252004-08-05 19:54:59 +000029# -disable-llc Disable LLC tests in the nightly tester.
30# -disable-jit Disable JIT tests in the nightly tester.
Chris Lattnera9e9d2c2004-05-28 20:30:23 +000031# -verbose Turn on some debug output
32# -debug Print information useful only to maintainers of this script.
Reid Spencer7b27d082004-06-22 15:38:37 +000033# -nice Checkout/Configure/Build with "nice" to reduce impact
34# on busy servers.
Misha Brukmanc350bd22004-11-08 03:28:27 +000035# -f2c Next argument specifies path to F2C utility
Reid Spencer7b27d082004-06-22 15:38:37 +000036# -gnuplotscript Next argument specifies gnuplot script to use
37# -templatefile Next argument specifies template file to use
Chris Lattner5174f432004-07-27 08:29:06 +000038# -gccpath Path to gcc/g++ used to build LLVM
Chris Lattner8f668f262003-12-19 03:47:31 +000039#
Brian Gaeke91d16b32003-10-11 05:34:00 +000040# CVSROOT is the CVS repository from which the tree will be checked out,
41# specified either in the full :method:user@host:/dir syntax, or
42# just /dir if using a local repo.
43# BUILDDIR is the directory where sources for this test run will be checked out
44# AND objects for this test run will be built. This directory MUST NOT
45# exist before the script is run; it will be created by the cvs checkout
46# process and erased (unless -noremove is specified; see above.)
47# WEBDIR is the directory into which the test results web page will be written,
48# AND in which the "index.html" is assumed to be a symlink to the most recent
Brian Gaeke99d3dee2004-09-28 16:04:00 +000049# copy of the results. This directory will be created if it does not exist.
Reid Spencer7b27d082004-06-22 15:38:37 +000050# LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
51# to. This is the same as you would have for a normal LLVM build.
Chris Lattner6a36dc62003-01-20 06:11:03 +000052#
53use POSIX qw(strftime);
Tanya Lattnerc3d696f2004-11-21 00:02:40 +000054use File::Copy;
Chris Lattner6a36dc62003-01-20 06:11:03 +000055
Brian Gaeke91d16b32003-10-11 05:34:00 +000056my $HOME = $ENV{'HOME'};
57my $CVSRootDir = $ENV{'CVSROOT'};
Chris Lattner4b9c23a2003-10-14 01:22:08 +000058 $CVSRootDir = "/home/vadve/shared/PublicCVS"
Chris Lattnera9e9d2c2004-05-28 20:30:23 +000059 unless $CVSRootDir;
60my $BuildDir = $ENV{'BUILDDIR'};
61 $BuildDir = "$HOME/buildtest"
62 unless $BuildDir;
63my $WebDir = $ENV{'WEBDIR'};
64 $WebDir = "$HOME/cvs/testresults-X86"
65 unless $WebDir;
Chris Lattner3dc06172003-01-20 18:05:27 +000066
67# Calculate the date prefix...
68@TIME = localtime;
69my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
70my $DateString = strftime "%B %d, %Y", localtime;
Reid Spencer7b27d082004-06-22 15:38:37 +000071my $TestStartTime = gmtime;
72
73# Command line argument settings...
74my $NOCHECKOUT = 0;
Misha Brukmanc350bd22004-11-08 03:28:27 +000075my $NOREMOVE = 0;
Reid Spencer7b27d082004-06-22 15:38:37 +000076my $NOFEATURES = 0;
77my $NOREGRESSIONS = 0;
Misha Brukmanc350bd22004-11-08 03:28:27 +000078my $NOTEST = 0;
Reid Spencer7b27d082004-06-22 15:38:37 +000079my $NORUNNINGTESTS = 0;
Reid Spencer2e44d872004-06-23 07:45:46 +000080my $NOEXTERNALS = 0;
Misha Brukmanc350bd22004-11-08 03:28:27 +000081my $MAKEOPTS = "";
Reid Spencer7b27d082004-06-22 15:38:37 +000082my $PROGTESTOPTS = "";
Misha Brukmanc350bd22004-11-08 03:28:27 +000083my $VERBOSE = 0;
Reid Spencer7b27d082004-06-22 15:38:37 +000084my $DEBUG = 0;
Brian Gaekec5189252004-08-05 19:54:59 +000085my $CONFIGUREARGS = "";
Reid Spencer7b27d082004-06-22 15:38:37 +000086my $NICE = "";
Tanya Lattnerc3d696f2004-11-21 00:02:40 +000087my $RUNDEJAGNU = 0;
Chris Lattner3dc06172003-01-20 18:05:27 +000088
Chris Lattner85d79a02003-01-22 16:14:05 +000089sub ReadFile {
90 if (open (FILE, $_[0])) {
Reid Spencer7b27d082004-06-22 15:38:37 +000091 undef $/;
Chris Lattner85d79a02003-01-22 16:14:05 +000092 my $Ret = <FILE>;
93 close FILE;
Reid Spencer7b27d082004-06-22 15:38:37 +000094 $/ = '\n';
Chris Lattner85d79a02003-01-22 16:14:05 +000095 return $Ret;
96 } else {
97 print "Could not open file '$_[0]' for reading!";
98 return "";
99 }
100}
101
Chris Lattner3dc06172003-01-20 18:05:27 +0000102sub WriteFile { # (filename, contents)
103 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
104 print FILE $_[1];
105 close FILE;
106}
107
108sub GetRegex { # (Regex with ()'s, value)
Chris Lattner34debbf2003-01-22 20:35:59 +0000109 $_[1] =~ /$_[0]/m;
Chris Lattner05c8f642003-08-19 18:35:03 +0000110 if (defined($1)) {
111 return $1;
112 }
Reid Spencer64889c62004-06-23 06:36:34 +0000113 return "0";
Chris Lattner3dc06172003-01-20 18:05:27 +0000114}
115
Brian Gaeke99d3dee2004-09-28 16:04:00 +0000116sub Touch {
117 my @files = @_;
118 my $now = time;
119 foreach my $file (@files) {
120 if (! -f $file) {
121 open (FILE, ">$file") or warn "Could not create new file $file";
122 close FILE;
123 }
124 utime $now, $now, $file;
125 }
126}
127
Reid Spencer7b27d082004-06-22 15:38:37 +0000128sub AddRecord {
129 my ($Val, $Filename) = @_;
130 my @Records;
131 if (open FILE, "$WebDir/$Filename") {
132 @Records = grep !/$DATE/, split "\n", <FILE>;
133 close FILE;
134 }
135 push @Records, "$DATE: $Val";
136 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
Reid Spencer7b27d082004-06-22 15:38:37 +0000137}
138
Chris Lattner3dc06172003-01-20 18:05:27 +0000139sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
140 $_ = shift;
Chris Lattner7f90f612003-01-20 19:18:44 +0000141 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner3dc06172003-01-20 18:05:27 +0000142}
143
Reid Spencer7b27d082004-06-22 15:38:37 +0000144sub ChangeDir { # directory, logical name
145 my ($dir,$name) = @_;
146 chomp($dir);
147 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
148 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
149}
150
Tanya Lattnerc3d696f2004-11-21 00:02:40 +0000151sub CopyFile { #filename, newfile
152 my ($file, $newfile) = @_;
153 chomp($file);
154 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
155 copy($file, $newfile);
156}
157
Chris Lattner3dc06172003-01-20 18:05:27 +0000158sub GetDir {
159 my $Suffix = shift;
160 opendir DH, $WebDir;
161 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
162 closedir DH;
163 return @Result;
164}
165
166# DiffFiles - Diff the current version of the file against the last version of
167# the file, reporting things added and removed. This is used to report, for
168# example, added and removed warnings. This returns a pair (added, removed)
169#
170sub DiffFiles {
171 my $Suffix = shift;
172 my @Others = GetDir $Suffix;
173 if (@Others == 0) { # No other files? We added all entries...
174 return (`cat $WebDir/$DATE$Suffix`, "");
175 }
176 # Diff the files now...
177 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
178 my $Added = join "\n", grep /^</, @Diffs;
179 my $Removed = join "\n", grep /^>/, @Diffs;
Chris Lattner7f90f612003-01-20 19:18:44 +0000180 $Added =~ s/^< //gm;
181 $Removed =~ s/^> //gm;
Chris Lattner3dc06172003-01-20 18:05:27 +0000182 return ($Added, $Removed);
183}
184
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000185# FormatTime - Convert a time from 1m23.45 into 83.45
186sub FormatTime {
187 my $Time = shift;
188 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
189 $Time = sprintf("%7.4f", $1*60.0+$2);
190 }
191 return $Time;
192}
193
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000194sub GetRegexNum {
195 my ($Regex, $Num, $Regex2, $File) = @_;
196 my @Items = split "\n", `grep '$Regex' $File`;
197 return GetRegex $Regex2, $Items[$Num];
198}
199
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000200sub GetQMTestResults { # (filename)
201 my ($filename) = @_;
202 my @lines;
203 my $firstline;
204 $/ = "\n"; #Make sure we're going line at a time.
205 if (open SRCHFILE, $filename) {
Reid Spencer3b430222004-05-30 00:17:47 +0000206 # Skip stuff before ---TEST RESULTS
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000207 while ( <SRCHFILE> ) {
Reid Spencer8ac57712004-05-31 20:59:55 +0000208 if ( m/^--- TEST RESULTS/ ) { last; }
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000209 }
Reid Spencer3b430222004-05-30 00:17:47 +0000210 # Process test results
Reid Spencer8ac57712004-05-31 20:59:55 +0000211 push(@lines,"<h3>TEST RESULTS</h3><ol><li>\n");
212 my $first_list = 1;
213 my $should_break = 1;
Reid Spencer7d4b8142004-06-08 08:01:33 +0000214 my $nocopy = 0;
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000215 while ( <SRCHFILE> ) {
216 if ( length($_) > 1 ) {
Reid Spencer7b27d082004-06-22 15:38:37 +0000217 chomp($_);
218 if ( ! m/: PASS[ ]*$/ &&
219 ! m/^ qmtest.target:/ &&
220 ! m/^ local/ &&
221 ! m/^gmake:/ ) {
222 if ( m/: XFAIL/ ) {
223 $nocopy = 1;
224 } elsif ( m/: XPASS/ || m/: FAIL/ ) {
225 $nocopy = 0;
226 if ( $first_list ) {
227 $first_list = 0;
228 $should_break = 1;
229 push(@lines,"<b>$_</b><br/>\n");
230 } else {
231 push(@lines,"</li><li><b>$_</b><br/>\n");
232 }
233 } elsif ( m/^--- STATISTICS/ ) {
234 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
235 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
236 $should_break = 0;
237 $nocopy = 0;
238 } elsif ( m/^--- TESTS WITH/ ) {
239 $should_break = 1;
240 $first_list = 1;
241 $nocopy = 0;
242 push(@lines,"</pre><h3>TESTS WITH UNEXPECTED RESULTS</h3><ol><li>\n");
243 } elsif ( m/^real / ) {
244 last;
245 } elsif (!$nocopy) {
246 if ( $should_break ) {
247 push(@lines,"$_<br/>\n");
248 } else {
249 push(@lines,"$_\n");
250 }
251 }
252 }
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000253 }
254 }
255 close SRCHFILE;
256 }
257 my $content = join("",@lines);
Reid Spencer7d4b8142004-06-08 08:01:33 +0000258 return "$content</li></ol>\n";
259}
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000260
Tanya Lattnerc3d696f2004-11-21 00:02:40 +0000261sub GetDejagnuTestResults { # (filename, log)
262 my ($filename, $DejagnuLog) = @_;
263 my @lines;
264 my $firstline;
265 $/ = "\n"; #Make sure we're going line at a time.
266 if (open SRCHFILE, $filename) {
267 # Process test results
268 push(@lines,"<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n");
269 my $first_list = 1;
270 my $should_break = 1;
271 my $nocopy = 0;
272 my $readingsum = 0;
273 while ( <SRCHFILE> ) {
274 if ( length($_) > 1 ) {
275 chomp($_);
276 if ( m/^XPASS:/ || m/^FAIL:/ ) {
277 $nocopy = 0;
278 if ( $first_list ) {
279 $first_list = 0;
280 $should_break = 1;
281 push(@lines,"<b>$_</b><br/>\n");
282 } else {
283 push(@lines,"</li><li><b>$_</b><br/>\n");
284 }
285 } elsif ( m/Summary/ ) {
286 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
287 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
288 $should_break = 0;
289 $nocopy = 0;
290 $readingsum = 1;
291 } elsif ( $readingsum ) {
292 push(@lines,"$_\n");
293 }
294 }
295 }
296 }
297 push(@lines, "</pre>\n");
298 close SRCHFILE;
299
Tanya Lattnerc3d696f2004-11-21 00:02:40 +0000300 my $content = join("",@lines);
301 return "$content</li></ol>\n";
302}
303
Reid Spencer7b27d082004-06-22 15:38:37 +0000304
305#####################################################################
306## MAIN PROGRAM
307#####################################################################
308
309my $Template = "";
310my $PlotScriptFilename = "";
311
312# Parse arguments...
313while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
314 shift;
315 last if /^--$/; # Stop processing arguments on --
316
317 # List command line options here...
318 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
Misha Brukmanc350bd22004-11-08 03:28:27 +0000319 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Reid Spencer7b27d082004-06-22 15:38:37 +0000320 if (/^-nofeaturetests$/) { $NOFEATURES = 1; next; }
321 if (/^-noregressiontests$/){ $NOREGRESSIONS = 1; next; }
Misha Brukmanc350bd22004-11-08 03:28:27 +0000322 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
Reid Spencer7b27d082004-06-22 15:38:37 +0000323 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
Misha Brukmanc350bd22004-11-08 03:28:27 +0000324 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
325 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
Reid Spencer7b27d082004-06-22 15:38:37 +0000326 if (/^-pedantic$/) {
327 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
328 next;
329 }
330 if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; }
Brian Gaekec5189252004-08-05 19:54:59 +0000331 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
332 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
333 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
334 $CONFIGUREARGS .= " --disable-jit"; next; }
Misha Brukmanc350bd22004-11-08 03:28:27 +0000335 if (/^-verbose$/) { $VERBOSE = 1; next; }
336 if (/^-debug$/) { $DEBUG = 1; next; }
337 if (/^-nice$/) { $NICE = "nice "; next; }
338 if (/^-f2c$/) {
339 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
340 }
Reid Spencer7b27d082004-06-22 15:38:37 +0000341 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
Reid Spencer250b0312004-06-23 14:07:12 +0000342 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
Misha Brukmanc350bd22004-11-08 03:28:27 +0000343 if (/^-gccpath/) {
344 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
345 }
Reid Spencer2e44d872004-06-23 07:45:46 +0000346 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
Tanya Lattner72aca852004-11-21 00:10:12 +0000347 if(/^-rundejagnu$/) { $RUNDEJAGNU = 1; next; }
Reid Spencer7b27d082004-06-22 15:38:37 +0000348
349 print "Unknown option: $_ : ignoring!\n";
350}
351
352if ($ENV{'LLVMGCCDIR'}) {
353 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
354}
Brian Gaekec5189252004-08-05 19:54:59 +0000355if ($CONFIGUREARGS !~ /--disable-jit/) {
356 $CONFIGUREARGS .= " --enable-jit";
357}
Reid Spencer7b27d082004-06-22 15:38:37 +0000358
359die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
360
361if (@ARGV == 3) {
362 $CVSRootDir = $ARGV[0];
363 $BuildDir = $ARGV[1];
364 $WebDir = $ARGV[2];
365}
366
Reid Spencer7b27d082004-06-22 15:38:37 +0000367my $Prefix = "$WebDir/$DATE";
368
369#define the file names we'll use
370my $BuildLog = "$Prefix-Build-Log.txt";
371my $CVSLog = "$Prefix-CVS-Log.txt";
372my $FeatureTestsLog = "$Prefix-FeatureTests-Log.txt";
373my $RegressionTestsLog = "$Prefix-RegressionTests-Log.txt";
374my $OldenTestsLog = "$Prefix-Olden-tests.txt";
375my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
376my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
377my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
Tanya Lattnerc3d696f2004-11-21 00:02:40 +0000378my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
379my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
380my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
Reid Spencer7b27d082004-06-22 15:38:37 +0000381
382if ($VERBOSE) {
383 print "INITIALIZED\n";
384 print "CVS Root = $CVSRootDir\n";
385 print "BuildDir = $BuildDir\n";
386 print "WebDir = $WebDir\n";
387 print "Prefix = $Prefix\n";
388 print "CVSLog = $CVSLog\n";
389 print "BuildLog = $BuildLog\n";
390}
391
Brian Gaeke99d3dee2004-09-28 16:04:00 +0000392if (! -d $WebDir) {
393 mkdir $WebDir, 0777;
394 warn "Warning: $WebDir did not exist; creating it.\n";
395}
Reid Spencer7b27d082004-06-22 15:38:37 +0000396
397#
398# Create the CVS repository directory
399#
400if (!$NOCHECKOUT) {
401 if (-d $BuildDir) {
402 if (!$NOREMOVE) {
403 system "rm -rf $BuildDir";
404 } else {
405 die "CVS checkout directory $BuildDir already exists!";
406 }
407 }
408 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
409}
410
411ChangeDir( $BuildDir, "CVS checkout directory" );
412
413
414#
415# Check out the llvm tree, saving CVS messages to the cvs log...
416#
417$CVSOPT = "";
418$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
419if (!$NOCHECKOUT) {
420 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
Reid Spencerd5de72c2004-09-05 20:57:22 +0000421 system "( time -p $NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm; cd llvm/projects ; " .
422 "$NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm-test ) > $CVSLog 2>&1";
Reid Spencer22632032004-09-05 07:58:10 +0000423 ChangeDir( $BuildDir , "CVS Checkout directory") ;
Reid Spencer7b27d082004-06-22 15:38:37 +0000424}
425
426ChangeDir( "llvm" , "llvm source directory") ;
427
428if (!$NOCHECKOUT) {
429 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
Reid Spencer22632032004-09-05 07:58:10 +0000430 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
Reid Spencer7b27d082004-06-22 15:38:37 +0000431}
432
Reid Spencer250b0312004-06-23 14:07:12 +0000433if ( $Template eq "" ) {
434 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
435}
436die "Template file $Template is not readable" if ( ! -r "$Template" );
437
438if ( $PlotScriptFilename eq "" ) {
439 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
440}
441die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
442
Reid Spencer7b27d082004-06-22 15:38:37 +0000443# Read in the HTML template file...
444if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
445my $TemplateContents = ReadFile $Template;
446
447#
448# Get some static statistics about the current state of CVS
449#
450my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
451my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
452my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
Reid Spencerec0c48e2004-09-06 19:32:55 +0000453$LOC = `utils/countloc.sh`;
Reid Spencer7b27d082004-06-22 15:38:37 +0000454
455#
456# Build the entire tree, saving build messages to the build log
457#
458if (!$NOCHECKOUT) {
459 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
460 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
461
462 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
463 # Build the entire tree, capturing the output into $BuildLog
464 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
465}
466
467
468#
469# Get some statistics about the build...
470#
471my @Linked = split '\n', `grep Linking $BuildLog`;
472my $NumExecutables = scalar(grep(/executable/, @Linked));
473my $NumLibraries = scalar(grep(!/executable/, @Linked));
474my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0;
475
476my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
477my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
478my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
479my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
480
481my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
482my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
483my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
484my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
485
486my $BuildError = "";
487if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
488 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
489 $BuildError = "<h3><font color='red'>Build error: compilation " .
490 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
491 if ($VERBOSE) { print "BUILD ERROR\n"; }
492}
493
Tanya Lattnerc3d696f2004-11-21 00:02:40 +0000494if ($BuildError) { $NOFEATURES = 1; $NOREGRESSIONS = 1; $RUNDEJAGNU=0; }
Brian Gaeke537851f2004-06-25 07:25:28 +0000495
Tanya Lattnerc3d696f2004-11-21 00:02:40 +0000496my $DejangnuTestResults; # String containing the results of the dejagnu
497if($RUNDEJAGNU) {
498 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
499
500 my $dejagnu_output = "$DejagnuTestsLog";
501
502 #Run the feature and regression tests, results are put into testrun.sum
503 #Full log in testrun.log
Reid Spencerf675b492004-11-23 16:23:50 +0000504 system "(time -p gmake $MAKEOPTS check-dejagnu) > $dejagnu_output 2>&1";
Tanya Lattnerc3d696f2004-11-21 00:02:40 +0000505
506 #Extract time of dejagnu tests
507 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
508 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
509 $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
510 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
511
512 #Copy the testrun.log and testrun.sum to our webdir
513 CopyFile("test/testrun.log", $DejagnuLog);
514 CopyFile("test/testrun.sum", $DejagnuSum);
515
516 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
517} else {
518 $DejagnuTestResults = "Skipped by user choice.";
519 $DejagnuTime = "0.0";
520 $DejagnuWallTime = "0.0";
521}
522
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000523if ($DEBUG) {
Tanya Lattnerc3d696f2004-11-21 00:02:40 +0000524 print $DejagnuTestResults;
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000525}
526
527if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattner85d79a02003-01-22 16:14:05 +0000528#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000529# Get warnings from the build
Chris Lattner85d79a02003-01-22 16:14:05 +0000530#
Reid Spencer7b27d082004-06-22 15:38:37 +0000531my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000532my @Warnings;
533my $CurDir = "";
534
535foreach $Warning (@Warn) {
536 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
537 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman2b6d3382003-08-14 15:26:28 +0000538 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner6a36dc62003-01-20 06:11:03 +0000539 $CurDir = $1;
540 }
541 } else {
542 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
543 }
544}
Chris Lattner7f90f612003-01-20 19:18:44 +0000545my $WarningsFile = join "\n", @Warnings;
546my $WarningsList = AddPreTag $WarningsFile;
547$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000548
Chris Lattner3dc06172003-01-20 18:05:27 +0000549# Emit the warnings file, so we can diff...
550WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
551my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000552
Chris Lattner83ec9452003-10-18 19:31:39 +0000553# Output something to stdout if something has changed
554print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
555print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
556
Chris Lattnereb9d2152003-10-19 16:54:00 +0000557$WarningsAdded = AddPreTag $WarningsAdded;
558$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattner85d79a02003-01-22 16:14:05 +0000559
560#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000561# Get some statistics about CVS commits over the current day...
Chris Lattner85d79a02003-01-22 16:14:05 +0000562#
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000563if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner6a36dc62003-01-20 06:11:03 +0000564@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
565#print join "\n", @CVSHistory; print "\n";
566
567# Extract some information from the CVS history... use a hash so no duplicate
568# stuff is stored.
Misha Brukman6aa98682003-07-07 21:27:40 +0000569my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner6a36dc62003-01-20 06:11:03 +0000570
Brian Gaeke966938c2004-06-10 07:44:28 +0000571my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattner34debbf2003-01-22 20:35:59 +0000572
Chris Lattner6a36dc62003-01-20 06:11:03 +0000573# Loop over every record from the CVS history, filling in the hashes.
574foreach $File (@CVSHistory) {
575 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman2b6d3382003-08-14 15:26:28 +0000576 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner6a36dc62003-01-20 06:11:03 +0000577 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattner4bb9bc32004-01-12 16:55:30 +0000578 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
579 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman6aa98682003-07-07 21:27:40 +0000580 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattner34debbf2003-01-22 20:35:59 +0000581 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner6a36dc62003-01-20 06:11:03 +0000582 } else {
Chris Lattner34debbf2003-01-22 20:35:59 +0000583 print "UNMATCHABLE: $File\n";
Brian Gaeke966938c2004-06-10 07:44:28 +0000584 next;
Chris Lattner34debbf2003-01-22 20:35:59 +0000585 }
586 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
587
588 if ($Filename =~ /^llvm/) {
589 if ($Type eq 'M') { # Modified
590 $ModifiedFiles{$Filename} = 1;
591 $UsersCommitted{$UID} = 1;
592 } elsif ($Type eq 'A') { # Added
593 $AddedFiles{$Filename} = 1;
594 $UsersCommitted{$UID} = 1;
595 } elsif ($Type eq 'R') { # Removed
596 $RemovedFiles{$Filename} = 1;
597 $UsersCommitted{$UID} = 1;
598 } else {
599 $UsersUpdated{$UID} = 1;
600 }
Chris Lattner6a36dc62003-01-20 06:11:03 +0000601 }
602}
603
Chris Lattner7f90f612003-01-20 19:18:44 +0000604my $UserCommitList = join "\n", keys %UsersCommitted;
605my $UserUpdateList = join "\n", keys %UsersUpdated;
Chris Lattnerbade93c2003-08-06 16:02:50 +0000606my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
607my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
608my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000609
Chris Lattner88126c02003-02-28 20:30:20 +0000610my $TestError = 1;
Reid Spencer7b27d082004-06-22 15:38:37 +0000611my $SingleSourceProgramsTable = "!";
612my $MultiSourceProgramsTable = "!";
613my $ExternalProgramsTable = "!";
Chris Lattner85d79a02003-01-22 16:14:05 +0000614
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000615
616sub TestDirectory {
617 my $SubDir = shift;
618
Reid Spencer22632032004-09-05 07:58:10 +0000619 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
Reid Spencer7b27d082004-06-22 15:38:37 +0000620
621 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
Chris Lattner88126c02003-02-28 20:30:20 +0000622
623 # Run the programs tests... creating a report.nightly.html file
624 if (!$NOTEST) {
Chris Lattner1c0a0e22004-06-03 03:29:39 +0000625 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Reid Spencer7b27d082004-06-22 15:38:37 +0000626 . "TEST=nightly > $ProgramTestLog 2>&1";
Chris Lattner88126c02003-02-28 20:30:20 +0000627 } else {
Reid Spencer7b27d082004-06-22 15:38:37 +0000628 system "gunzip ${ProgramTestLog}.gz";
Chris Lattner88126c02003-02-28 20:30:20 +0000629 }
630
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000631 my $ProgramsTable;
Reid Spencer7b27d082004-06-22 15:38:37 +0000632 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
Chris Lattner88126c02003-02-28 20:30:20 +0000633 $TestError = 1;
Chris Lattnerc09c0b92003-05-10 21:40:10 +0000634 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnereb9d2152003-10-19 16:54:00 +0000635 print "ERROR TESTING\n";
Reid Spencer7b27d082004-06-22 15:38:37 +0000636 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
Chris Lattner0a55e462003-05-11 15:23:10 +0000637 $TestError = 1;
638 $ProgramsTable =
639 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnereb9d2152003-10-19 16:54:00 +0000640 print "ERROR TESTING\n";
Chris Lattner0a55e462003-05-11 15:23:10 +0000641 } else {
Chris Lattner88126c02003-02-28 20:30:20 +0000642 $TestError = 0;
643 $ProgramsTable = ReadFile "report.nightly.html";
644
645 #
646 # Create a list of the tests which were run...
647 #
Reid Spencer7b27d082004-06-22 15:38:37 +0000648 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000649 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattner88126c02003-02-28 20:30:20 +0000650 }
651
652 # Compress the test output
Reid Spencer7b27d082004-06-22 15:38:37 +0000653 system "gzip -f $ProgramTestLog";
654 ChangeDir( "../../..", "Programs Test Parent Directory" );
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000655 return $ProgramsTable;
656}
657
Reid Spencer7b27d082004-06-22 15:38:37 +0000658# If we built the tree successfully, run the nightly programs tests...
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000659if ($BuildError eq "") {
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000660 if ( $VERBOSE ) {
661 print "SingleSource TEST STAGE\n";
662 }
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000663 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000664 if ( $VERBOSE ) {
665 print "MultiSource TEST STAGE\n";
666 }
Chris Lattnerf5ba14b2003-08-18 06:05:21 +0000667 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Reid Spencer2e44d872004-06-23 07:45:46 +0000668 if ( ! $NOEXTERNALS ) {
669 if ( $VERBOSE ) {
670 print "External TEST STAGE\n";
671 }
672 $ExternalProgramsTable = TestDirectory("External");
673 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnered51e682003-08-21 15:55:26 +0000674 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Reid Spencer2e44d872004-06-23 07:45:46 +0000675 } else {
676 if ( $VERBOSE ) {
677 print "External TEST STAGE SKIPPED\n";
678 }
679 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
680 " | sort > $Prefix-Tests.txt";
681 }
Chris Lattnerd090dbb2003-01-23 19:31:28 +0000682}
Chris Lattner85d79a02003-01-22 16:14:05 +0000683
Reid Spencer7b27d082004-06-22 15:38:37 +0000684if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
Chris Lattner34debbf2003-01-22 20:35:59 +0000685my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
686
Chris Lattner88126c02003-02-28 20:30:20 +0000687if ($TestError) {
688 $TestsAdded = "<b>error testing</b><br>";
689 $TestsRemoved = "<b>error testing</b><br>";
690 $TestsFixed = "<b>error testing</b><br>";
691 $TestsBroken = "<b>error testing</b><br>";
692} else {
693 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
694
695 my @RawTestsAddedArray = split '\n', $RTestsAdded;
696 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
697
698 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
699 @RawTestsRemovedArray;
700 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
701 @RawTestsAddedArray;
702
703 foreach $Test (keys %NewTests) {
704 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
705 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattner34debbf2003-01-22 20:35:59 +0000706 } else {
Chris Lattner88126c02003-02-28 20:30:20 +0000707 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
708 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
709 } else {
710 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
711 }
Chris Lattner34debbf2003-01-22 20:35:59 +0000712 }
713 }
Chris Lattner88126c02003-02-28 20:30:20 +0000714 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
715 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
716 }
Chris Lattner34debbf2003-01-22 20:35:59 +0000717
Chris Lattner518f3fd2003-10-21 15:47:31 +0000718 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
719 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
720 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
721 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnereb9d2152003-10-19 16:54:00 +0000722
Chris Lattner88126c02003-02-28 20:30:20 +0000723 $TestsAdded = AddPreTag $TestsAdded;
724 $TestsRemoved = AddPreTag $TestsRemoved;
725 $TestsFixed = AddPreTag $TestsFixed;
726 $TestsBroken = AddPreTag $TestsBroken;
727}
Chris Lattner34debbf2003-01-22 20:35:59 +0000728
Chris Lattner83ec9452003-10-18 19:31:39 +0000729
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000730# If we built the tree successfully, runs of the Olden suite with
731# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
732if ($BuildError eq "") {
Reid Spencer7b27d082004-06-22 15:38:37 +0000733 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
Chris Lattner05c8f642003-08-19 18:35:03 +0000734 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000735 $MachCodeSize) = ("","","","","","","");
Chris Lattner05c8f642003-08-19 18:35:03 +0000736 if (!$NORUNNINGTESTS) {
Reid Spencer22632032004-09-05 07:58:10 +0000737 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
Reid Spencer7b27d082004-06-22 15:38:37 +0000738 "Olden Test Directory");
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000739
740 # Clean out previous results...
Reid Spencer7b27d082004-06-22 15:38:37 +0000741 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000742
Chris Lattner0ff18282004-11-06 21:35:40 +0000743 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
744 # GET_STABLE_NUMBERS enabled!
Brian Gaeke2948d2e2004-06-04 00:07:12 +0000745 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattner0ff18282004-11-06 21:35:40 +0000746 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
Reid Spencer7b27d082004-06-22 15:38:37 +0000747 system "cp report.nightly.raw.out $OldenTestsLog";
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000748 } else {
Reid Spencer7b27d082004-06-22 15:38:37 +0000749 system "gunzip ${OldenTestsLog}.gz";
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000750 }
751
Reid Spencer7b27d082004-06-22 15:38:37 +0000752 # Now we know we have $OldenTestsLog as the raw output file. Split
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000753 # it up into records and read the useful information.
Reid Spencer7b27d082004-06-22 15:38:37 +0000754 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000755 shift @Records; # Delete the first (garbage) record
756
757 # Loop over all of the records, summarizing them into rows for the running
758 # totals file.
759 my $WallTimeRE = "[A-Za-z0-9.: ]+\\(([0-9.]+) wall clock";
760 foreach $Rec (@Records) {
Chris Lattner0ff18282004-11-06 21:35:40 +0000761 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
762 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
763 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
764 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000765 my $rOptTime = GetRegex "TEST-RESULT-compile: $WallTimeRE", $Rec;
766 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
767 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
768
769 $NATTime .= " " . FormatTime($rNATTime);
770 $CBETime .= " " . FormatTime($rCBETime);
771 $LLCTime .= " " . FormatTime($rLLCTime);
772 $JITTime .= " " . FormatTime($rJITTime);
773 $OptTime .= " $rOptTime";
Chris Lattner05c8f642003-08-19 18:35:03 +0000774 $BytecodeSize .= " $rBytecodeSize";
775 $MachCodeSize .= " $rMachCodeSize";
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000776 }
777
778 # Now that we have all of the numbers we want, add them to the running totals
779 # files.
Chris Lattner05c8f642003-08-19 18:35:03 +0000780 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000781 AddRecord($CBETime, "running_Olden_cbe_time.txt");
782 AddRecord($LLCTime, "running_Olden_llc_time.txt");
783 AddRecord($JITTime, "running_Olden_jit_time.txt");
784 AddRecord($OptTime, "running_Olden_opt_time.txt");
785 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
786 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
Chris Lattner05c8f642003-08-19 18:35:03 +0000787
Reid Spencer7b27d082004-06-22 15:38:37 +0000788 system "gzip -f $OldenTestsLog";
Chris Lattnerd1fc00d2003-08-19 15:08:34 +0000789}
790
791
Chris Lattner34debbf2003-01-22 20:35:59 +0000792#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000793# Get a list of the previous days that we can link to...
Chris Lattner85d79a02003-01-22 16:14:05 +0000794#
Chris Lattner3dc06172003-01-20 18:05:27 +0000795my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000796
Brian Gaeke787ed2f2004-06-11 19:55:30 +0000797if ((scalar @PrevDays) > 20) {
798 splice @PrevDays, 20; # Trim down list to something reasonable...
799}
Chris Lattner6a36dc62003-01-20 06:11:03 +0000800
Reid Spencer7b27d082004-06-22 15:38:37 +0000801# Format list for sidebar
802my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000803
Chris Lattner3c81d9a2003-08-18 20:07:54 +0000804#
Brian Gaeke99d3dee2004-09-28 16:04:00 +0000805# Start outputting files into the web directory
Chris Lattner3c81d9a2003-08-18 20:07:54 +0000806#
Reid Spencer7b27d082004-06-22 15:38:37 +0000807ChangeDir( $WebDir, "Web Directory" );
Chris Lattner3c81d9a2003-08-18 20:07:54 +0000808
Brian Gaeke99d3dee2004-09-28 16:04:00 +0000809# Make sure we don't get errors running the nightly tester the first time
810# because of files that don't exist.
811Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
812 'running_loc.txt', 'running_Olden_machcode.txt',
813 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
814 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
815 'running_Olden_jit_time.txt');
816
Chris Lattner3c81d9a2003-08-18 20:07:54 +0000817# Add information to the files which accumulate information for graphs...
818AddRecord($LOC, "running_loc.txt");
819AddRecord($BuildTime, "running_build_time.txt");
820
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000821if ( $VERBOSE ) {
822 print "GRAPH GENERATION STAGE\n";
823}
Chris Lattner3c81d9a2003-08-18 20:07:54 +0000824#
825# Rebuild the graphs now...
826#
Chris Lattnere4a72a02004-07-27 18:41:49 +0000827$GNUPLOT = "/usr/bin/gnuplot";
Brian Gaeke91d16b32003-10-11 05:34:00 +0000828$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
Reid Spencer7b27d082004-06-22 15:38:37 +0000829system ("$GNUPLOT", $PlotScriptFilename);
Chris Lattner85d79a02003-01-22 16:14:05 +0000830
Chris Lattner6a36dc62003-01-20 06:11:03 +0000831#
832# Remove the cvs tree...
833#
Reid Spencer7b27d082004-06-22 15:38:37 +0000834system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Chris Lattner6a36dc62003-01-20 06:11:03 +0000835
Chris Lattner85d79a02003-01-22 16:14:05 +0000836#
Chris Lattner6a36dc62003-01-20 06:11:03 +0000837# Print out information...
Chris Lattner85d79a02003-01-22 16:14:05 +0000838#
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000839if ($VERBOSE) {
Chris Lattner6a36dc62003-01-20 06:11:03 +0000840 print "DateString: $DateString\n";
841 print "CVS Checkout: $CVSCheckoutTime seconds\n";
842 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
Chris Lattner6a36dc62003-01-20 06:11:03 +0000843 print "Build Time: $BuildTime seconds\n";
844 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
845
846 print "WARNINGS:\n $WarningsList\n";
847
Chris Lattner6a36dc62003-01-20 06:11:03 +0000848 print "Users committed: $UserCommitList\n";
849 print "Added Files: \n $AddedFilesList\n";
850 print "Modified Files: \n $ModifiedFilesList\n";
851 print "Removed Files: \n $RemovedFilesList\n";
852
853 print "Previous Days =\n $PrevDaysList\n";
854}
855
Chris Lattner85d79a02003-01-22 16:14:05 +0000856
Chris Lattner3dc06172003-01-20 18:05:27 +0000857#
858# Output the files...
859#
860
Chris Lattnera9e9d2c2004-05-28 20:30:23 +0000861if ( $VERBOSE ) {
862 print "OUTPUT STAGE\n";
863}
Chris Lattner3dc06172003-01-20 18:05:27 +0000864# Main HTML file...
Chris Lattner6a36dc62003-01-20 06:11:03 +0000865my $Output;
Reid Spencer7b27d082004-06-22 15:38:37 +0000866my $TestFinishTime = gmtime;
867my $TestPlatform = `uname -a`;
Chris Lattner6a36dc62003-01-20 06:11:03 +0000868eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
Chris Lattner3dc06172003-01-20 18:05:27 +0000869WriteFile "$DATE.html", $Output;
Reid Spencer7b27d082004-06-22 15:38:37 +0000870system ( "ln -sf $DATE.html index.html" );
Chris Lattner6a36dc62003-01-20 06:11:03 +0000871
872# Change the index.html symlink...
Chris Lattner6a36dc62003-01-20 06:11:03 +0000873
Reid Spencer7b27d082004-06-22 15:38:37 +0000874# vim: sw=2 ai