blob: 4919d53bb26fcb7045ddd05e5e35e2a4771824fa [file] [log] [blame]
Alkis Evlogimenos2e142f52004-01-07 01:48:26 +00001#!/usr/bin/perl -w
Chris Lattner4c7e3032003-01-20 06:11:03 +00002#
3# Program: NightlyTest.pl
4#
5# Synopsis: Perform a series of tests which are designed to be run nightly.
6# This is used to keep track of the status of the LLVM tree, tracking
7# regressions and performance changes. This generates one web page a
8# day which can be used to access this information.
9#
Brian Gaekeb3dab902003-10-11 05:34:00 +000010# Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR]
11# where
12# OPTIONS may include one or more of the following:
13# -nocheckout Do not create, checkout, update, or configure
14# the source tree.
15# -noremove Do not remove the BUILDDIR after it has been built.
Chris Lattner4d00fde2004-05-28 20:30:23 +000016# -nofeaturetests Do not run the feature tests.
17# -noregressiontests Do not run the regression tests.
Brian Gaekeb3dab902003-10-11 05:34:00 +000018# -notest Do not even attempt to run the test programs. Implies
19# -norunningtests.
20# -norunningtests Do not run the Olden benchmark suite with
21# LARGE_PROBLEM_SIZE enabled.
Reid Spencer1d914632004-06-23 07:45:46 +000022# -noexternals Do not run the external tests (for cases where povray
23# or SPEC are not installed)
Tanya Lattner5debe8c2004-11-21 00:02:40 +000024# -rundejagnu Runs features and regressions using Dejagnu
Brian Gaekeb3dab902003-10-11 05:34:00 +000025# -parallel Run two parallel jobs with GNU Make.
Reid Spencerf6d02332004-06-11 07:06:22 +000026# -release Build an LLVM Release version
27# -pedantic Enable additional GCC warnings to detect possible errors.
Chris Lattnerbb0aca52003-12-19 03:47:31 +000028# -enable-linscan Enable linearscan tests
Brian Gaeke047e6062004-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 Lattner4d00fde2004-05-28 20:30:23 +000031# -verbose Turn on some debug output
32# -debug Print information useful only to maintainers of this script.
Reid Spencercb6a3aa2004-06-22 15:38:37 +000033# -nice Checkout/Configure/Build with "nice" to reduce impact
34# on busy servers.
Misha Brukman2e9ac692004-11-08 03:28:27 +000035# -f2c Next argument specifies path to F2C utility
Reid Spencercb6a3aa2004-06-22 15:38:37 +000036# -gnuplotscript Next argument specifies gnuplot script to use
37# -templatefile Next argument specifies template file to use
Chris Lattner892cdb32004-07-27 08:29:06 +000038# -gccpath Path to gcc/g++ used to build LLVM
Chris Lattnerbb0aca52003-12-19 03:47:31 +000039#
Brian Gaekeb3dab902003-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 Gaeke90c82b92004-09-28 16:04:00 +000049# copy of the results. This directory will be created if it does not exist.
Reid Spencercb6a3aa2004-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 Lattner4c7e3032003-01-20 06:11:03 +000052#
53use POSIX qw(strftime);
Tanya Lattner5debe8c2004-11-21 00:02:40 +000054use File::Copy;
Chris Lattner4c7e3032003-01-20 06:11:03 +000055
Brian Gaekeb3dab902003-10-11 05:34:00 +000056my $HOME = $ENV{'HOME'};
57my $CVSRootDir = $ENV{'CVSROOT'};
Chris Lattner9d13efa2003-10-14 01:22:08 +000058 $CVSRootDir = "/home/vadve/shared/PublicCVS"
Chris Lattner4d00fde2004-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 Lattner2f8cb572003-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 Spencercb6a3aa2004-06-22 15:38:37 +000071my $TestStartTime = gmtime;
72
73# Command line argument settings...
74my $NOCHECKOUT = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000075my $NOREMOVE = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000076my $NOFEATURES = 0;
77my $NOREGRESSIONS = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000078my $NOTEST = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000079my $NORUNNINGTESTS = 0;
Reid Spencer1d914632004-06-23 07:45:46 +000080my $NOEXTERNALS = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000081my $MAKEOPTS = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000082my $PROGTESTOPTS = "";
Misha Brukman2e9ac692004-11-08 03:28:27 +000083my $VERBOSE = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000084my $DEBUG = 0;
Brian Gaeke047e6062004-08-05 19:54:59 +000085my $CONFIGUREARGS = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000086my $NICE = "";
Tanya Lattner5debe8c2004-11-21 00:02:40 +000087my $RUNDEJAGNU = 0;
Chris Lattner2f8cb572003-01-20 18:05:27 +000088
Chris Lattnerb3440302003-01-22 16:14:05 +000089sub ReadFile {
90 if (open (FILE, $_[0])) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +000091 undef $/;
Chris Lattnerb3440302003-01-22 16:14:05 +000092 my $Ret = <FILE>;
93 close FILE;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000094 $/ = '\n';
Chris Lattnerb3440302003-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 Lattner2f8cb572003-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 Lattnerd9bdbaa2003-01-22 20:35:59 +0000109 $_[1] =~ /$_[0]/m;
Chris Lattner08e24762003-08-19 18:35:03 +0000110 if (defined($1)) {
111 return $1;
112 }
Reid Spencera337f0c2004-06-23 06:36:34 +0000113 return "0";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000114}
115
Brian Gaeke90c82b92004-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 Spencercb6a3aa2004-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 Spencercb6a3aa2004-06-22 15:38:37 +0000137}
138
Chris Lattner2f8cb572003-01-20 18:05:27 +0000139sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
140 $_ = shift;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000141 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner2f8cb572003-01-20 18:05:27 +0000142}
143
Reid Spencercb6a3aa2004-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 Lattner5debe8c2004-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 Lattner2f8cb572003-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 Lattner1cbc0a62003-01-20 19:18:44 +0000180 $Added =~ s/^< //gm;
181 $Removed =~ s/^> //gm;
Chris Lattner2f8cb572003-01-20 18:05:27 +0000182 return ($Added, $Removed);
183}
184
Chris Lattner196a14a2003-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 Lattnerbf6a4dc2003-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 Lattner4d00fde2004-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 Spencer542e8592004-05-30 00:17:47 +0000206 # Skip stuff before ---TEST RESULTS
Chris Lattner4d00fde2004-05-28 20:30:23 +0000207 while ( <SRCHFILE> ) {
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000208 if ( m/^--- TEST RESULTS/ ) { last; }
Chris Lattner4d00fde2004-05-28 20:30:23 +0000209 }
Reid Spencer542e8592004-05-30 00:17:47 +0000210 # Process test results
Reid Spenceraa0bfbe2004-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 Spencerf5d0af32004-06-08 08:01:33 +0000214 my $nocopy = 0;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000215 while ( <SRCHFILE> ) {
216 if ( length($_) > 1 ) {
Reid Spencercb6a3aa2004-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 Lattner4d00fde2004-05-28 20:30:23 +0000253 }
254 }
255 close SRCHFILE;
256 }
257 my $content = join("",@lines);
Reid Spencerf5d0af32004-06-08 08:01:33 +0000258 return "$content</li></ol>\n";
259}
Chris Lattner4d00fde2004-05-28 20:30:23 +0000260
Tanya Lattner5debe8c2004-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
300 #add link to complete testing log
301 push(@lines, "<p>A complete log of testing <a href=\"$DejagnuLog\">Feature and Regression</a> is available for further analysis.</p>\n");
302
303 my $content = join("",@lines);
304 return "$content</li></ol>\n";
305}
306
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000307
308#####################################################################
309## MAIN PROGRAM
310#####################################################################
311
312my $Template = "";
313my $PlotScriptFilename = "";
314
315# Parse arguments...
316while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
317 shift;
318 last if /^--$/; # Stop processing arguments on --
319
320 # List command line options here...
321 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000322 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000323 if (/^-nofeaturetests$/) { $NOFEATURES = 1; next; }
324 if (/^-noregressiontests$/){ $NOREGRESSIONS = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000325 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000326 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000327 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
328 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000329 if (/^-pedantic$/) {
330 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
331 next;
332 }
333 if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; }
Brian Gaeke047e6062004-08-05 19:54:59 +0000334 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
335 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
336 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
337 $CONFIGUREARGS .= " --disable-jit"; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000338 if (/^-verbose$/) { $VERBOSE = 1; next; }
339 if (/^-debug$/) { $DEBUG = 1; next; }
340 if (/^-nice$/) { $NICE = "nice "; next; }
341 if (/^-f2c$/) {
342 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
343 }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000344 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
Reid Spencerc5b67052004-06-23 14:07:12 +0000345 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000346 if (/^-gccpath/) {
347 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
348 }
Reid Spencer1d914632004-06-23 07:45:46 +0000349 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000350 if(/^-runDejagnu$/) { $RUNDEJAGNU = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000351
352 print "Unknown option: $_ : ignoring!\n";
353}
354
355if ($ENV{'LLVMGCCDIR'}) {
356 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
357}
Brian Gaeke047e6062004-08-05 19:54:59 +0000358if ($CONFIGUREARGS !~ /--disable-jit/) {
359 $CONFIGUREARGS .= " --enable-jit";
360}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000361
362die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
363
364if (@ARGV == 3) {
365 $CVSRootDir = $ARGV[0];
366 $BuildDir = $ARGV[1];
367 $WebDir = $ARGV[2];
368}
369
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000370my $Prefix = "$WebDir/$DATE";
371
372#define the file names we'll use
373my $BuildLog = "$Prefix-Build-Log.txt";
374my $CVSLog = "$Prefix-CVS-Log.txt";
375my $FeatureTestsLog = "$Prefix-FeatureTests-Log.txt";
376my $RegressionTestsLog = "$Prefix-RegressionTests-Log.txt";
377my $OldenTestsLog = "$Prefix-Olden-tests.txt";
378my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
379my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
380my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000381my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
382my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
383my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000384
385if ($VERBOSE) {
386 print "INITIALIZED\n";
387 print "CVS Root = $CVSRootDir\n";
388 print "BuildDir = $BuildDir\n";
389 print "WebDir = $WebDir\n";
390 print "Prefix = $Prefix\n";
391 print "CVSLog = $CVSLog\n";
392 print "BuildLog = $BuildLog\n";
393}
394
Brian Gaeke90c82b92004-09-28 16:04:00 +0000395if (! -d $WebDir) {
396 mkdir $WebDir, 0777;
397 warn "Warning: $WebDir did not exist; creating it.\n";
398}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000399
400#
401# Create the CVS repository directory
402#
403if (!$NOCHECKOUT) {
404 if (-d $BuildDir) {
405 if (!$NOREMOVE) {
406 system "rm -rf $BuildDir";
407 } else {
408 die "CVS checkout directory $BuildDir already exists!";
409 }
410 }
411 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
412}
413
414ChangeDir( $BuildDir, "CVS checkout directory" );
415
416
417#
418# Check out the llvm tree, saving CVS messages to the cvs log...
419#
420$CVSOPT = "";
421$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
422if (!$NOCHECKOUT) {
423 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
Reid Spencer214c6d62004-09-05 20:57:22 +0000424 system "( time -p $NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm; cd llvm/projects ; " .
425 "$NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm-test ) > $CVSLog 2>&1";
Reid Spencer10ffe012004-09-05 07:58:10 +0000426 ChangeDir( $BuildDir , "CVS Checkout directory") ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000427}
428
429ChangeDir( "llvm" , "llvm source directory") ;
430
431if (!$NOCHECKOUT) {
432 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
Reid Spencer10ffe012004-09-05 07:58:10 +0000433 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000434}
435
Reid Spencerc5b67052004-06-23 14:07:12 +0000436if ( $Template eq "" ) {
437 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
438}
439die "Template file $Template is not readable" if ( ! -r "$Template" );
440
441if ( $PlotScriptFilename eq "" ) {
442 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
443}
444die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
445
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000446# Read in the HTML template file...
447if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
448my $TemplateContents = ReadFile $Template;
449
450#
451# Get some static statistics about the current state of CVS
452#
453my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
454my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
455my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
Reid Spencere993f462004-09-06 19:32:55 +0000456$LOC = `utils/countloc.sh`;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000457
458#
459# Build the entire tree, saving build messages to the build log
460#
461if (!$NOCHECKOUT) {
462 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
463 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
464
465 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
466 # Build the entire tree, capturing the output into $BuildLog
467 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
468}
469
470
471#
472# Get some statistics about the build...
473#
474my @Linked = split '\n', `grep Linking $BuildLog`;
475my $NumExecutables = scalar(grep(/executable/, @Linked));
476my $NumLibraries = scalar(grep(!/executable/, @Linked));
477my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0;
478
479my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
480my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
481my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
482my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
483
484my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
485my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
486my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
487my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
488
489my $BuildError = "";
490if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
491 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
492 $BuildError = "<h3><font color='red'>Build error: compilation " .
493 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
494 if ($VERBOSE) { print "BUILD ERROR\n"; }
495}
496
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000497if ($BuildError) { $NOFEATURES = 1; $NOREGRESSIONS = 1; $RUNDEJAGNU=0; }
Brian Gaeke22800982004-06-25 07:25:28 +0000498
Chris Lattner4d00fde2004-05-28 20:30:23 +0000499# Get results of feature tests.
500my $FeatureTestResults; # String containing the results of the feature tests
501my $FeatureTime; # System+CPU Time for feature tests
502my $FeatureWallTime; # Wall Clock Time for feature tests
503if (!$NOFEATURES) {
504 if ( $VERBOSE ) { print "FEATURE TEST STAGE\n"; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000505 my $feature_output = "$FeatureTestsLog";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000506
507 # Run the feature tests so we can summarize the results
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000508 system "(time -p gmake $MAKEOPTS -C test Feature.t) > $feature_output 2>&1";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000509
510 # Extract test results
511 $FeatureTestResults = GetQMTestResults("$feature_output");
512
513 # Extract time of feature tests
514 my $FeatureTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$feature_output";
515 my $FeatureTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$feature_output";
516 $FeatureTime = $FeatureTimeU+$FeatureTimeS; # FeatureTime = User+System
517 $FeatureWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$feature_output";
518 # Run the regression tests so we can summarize the results
519} else {
520 $FeatureTestResults = "Skipped by user choice.";
521 $FeatureTime = "0.0";
522 $FeatureWallTime = "0.0";
523}
524
525if (!$NOREGRESSIONS) {
526 if ( $VERBOSE ) { print "REGRESSION TEST STAGE\n"; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000527 my $regression_output = "$RegressionTestsLog";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000528
529 # Run the regression tests so we can summarize the results
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000530 system "(time -p gmake $MAKEOPTS -C test Regression.t) > $regression_output 2>&1";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000531
532 # Extract test results
533 $RegressionTestResults = GetQMTestResults("$regression_output");
534
535 # Extract time of regressions tests
536 my $RegressionTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$regression_output";
537 my $RegressionTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$regression_output";
538 $RegressionTime = $RegressionTimeU+$RegressionTimeS; # RegressionTime = User+System
539 $RegressionWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$regression_output";
540} else {
541 $RegressionTestResults = "Skipped by user choice.";
542 $RegressionTime = "0.0";
543 $RegressionWallTime = "0.0";
544}
545
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000546my $DejangnuTestResults; # String containing the results of the dejagnu
547if($RUNDEJAGNU) {
548 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
549
550 my $dejagnu_output = "$DejagnuTestsLog";
551
552 #Run the feature and regression tests, results are put into testrun.sum
553 #Full log in testrun.log
554 system "time -p gmake $MAKEOPTS check-dejagnu >& $dejagnu_output";
555
556 #Extract time of dejagnu tests
557 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
558 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
559 $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
560 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
561
562 #Copy the testrun.log and testrun.sum to our webdir
563 CopyFile("test/testrun.log", $DejagnuLog);
564 CopyFile("test/testrun.sum", $DejagnuSum);
565
566 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
567} else {
568 $DejagnuTestResults = "Skipped by user choice.";
569 $DejagnuTime = "0.0";
570 $DejagnuWallTime = "0.0";
571}
572
Chris Lattner4d00fde2004-05-28 20:30:23 +0000573if ($DEBUG) {
574 print $FeatureTestResults;
575 print $RegressionTestResults;
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000576 print $DejagnuTestResults;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000577}
578
579if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerb3440302003-01-22 16:14:05 +0000580#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000581# Get warnings from the build
Chris Lattnerb3440302003-01-22 16:14:05 +0000582#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000583my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000584my @Warnings;
585my $CurDir = "";
586
587foreach $Warning (@Warn) {
588 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
589 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman8e9554a2003-08-14 15:26:28 +0000590 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner4c7e3032003-01-20 06:11:03 +0000591 $CurDir = $1;
592 }
593 } else {
594 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
595 }
596}
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000597my $WarningsFile = join "\n", @Warnings;
598my $WarningsList = AddPreTag $WarningsFile;
599$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000600
Chris Lattner2f8cb572003-01-20 18:05:27 +0000601# Emit the warnings file, so we can diff...
602WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
603my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000604
Chris Lattner9efd7f42003-10-18 19:31:39 +0000605# Output something to stdout if something has changed
606print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
607print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
608
Chris Lattnerbe197872003-10-19 16:54:00 +0000609$WarningsAdded = AddPreTag $WarningsAdded;
610$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattnerb3440302003-01-22 16:14:05 +0000611
612#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000613# Get some statistics about CVS commits over the current day...
Chris Lattnerb3440302003-01-22 16:14:05 +0000614#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000615if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000616@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
617#print join "\n", @CVSHistory; print "\n";
618
619# Extract some information from the CVS history... use a hash so no duplicate
620# stuff is stored.
Misha Brukman1b366892003-07-07 21:27:40 +0000621my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000622
Brian Gaeke43f38672004-06-10 07:44:28 +0000623my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000624
Chris Lattner4c7e3032003-01-20 06:11:03 +0000625# Loop over every record from the CVS history, filling in the hashes.
626foreach $File (@CVSHistory) {
627 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman8e9554a2003-08-14 15:26:28 +0000628 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000629 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattnerd56147d2004-01-12 16:55:30 +0000630 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
631 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman1b366892003-07-07 21:27:40 +0000632 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000633 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner4c7e3032003-01-20 06:11:03 +0000634 } else {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000635 print "UNMATCHABLE: $File\n";
Brian Gaeke43f38672004-06-10 07:44:28 +0000636 next;
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000637 }
638 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
639
640 if ($Filename =~ /^llvm/) {
641 if ($Type eq 'M') { # Modified
642 $ModifiedFiles{$Filename} = 1;
643 $UsersCommitted{$UID} = 1;
644 } elsif ($Type eq 'A') { # Added
645 $AddedFiles{$Filename} = 1;
646 $UsersCommitted{$UID} = 1;
647 } elsif ($Type eq 'R') { # Removed
648 $RemovedFiles{$Filename} = 1;
649 $UsersCommitted{$UID} = 1;
650 } else {
651 $UsersUpdated{$UID} = 1;
652 }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000653 }
654}
655
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000656my $UserCommitList = join "\n", keys %UsersCommitted;
657my $UserUpdateList = join "\n", keys %UsersUpdated;
Chris Lattnerc9cdadf2003-08-06 16:02:50 +0000658my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
659my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
660my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000661
Chris Lattnerec0e3742003-02-28 20:30:20 +0000662my $TestError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000663my $SingleSourceProgramsTable = "!";
664my $MultiSourceProgramsTable = "!";
665my $ExternalProgramsTable = "!";
Chris Lattnerb3440302003-01-22 16:14:05 +0000666
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000667
668sub TestDirectory {
669 my $SubDir = shift;
670
Reid Spencer10ffe012004-09-05 07:58:10 +0000671 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000672
673 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000674
675 # Run the programs tests... creating a report.nightly.html file
676 if (!$NOTEST) {
Chris Lattner20d13ea2004-06-03 03:29:39 +0000677 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000678 . "TEST=nightly > $ProgramTestLog 2>&1";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000679 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000680 system "gunzip ${ProgramTestLog}.gz";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000681 }
682
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000683 my $ProgramsTable;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000684 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
Chris Lattnerec0e3742003-02-28 20:30:20 +0000685 $TestError = 1;
Chris Lattner2e8be142003-05-10 21:40:10 +0000686 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000687 print "ERROR TESTING\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000688 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000689 $TestError = 1;
690 $ProgramsTable =
691 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000692 print "ERROR TESTING\n";
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000693 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000694 $TestError = 0;
695 $ProgramsTable = ReadFile "report.nightly.html";
696
697 #
698 # Create a list of the tests which were run...
699 #
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000700 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000701 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000702 }
703
704 # Compress the test output
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000705 system "gzip -f $ProgramTestLog";
706 ChangeDir( "../../..", "Programs Test Parent Directory" );
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000707 return $ProgramsTable;
708}
709
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000710# If we built the tree successfully, run the nightly programs tests...
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000711if ($BuildError eq "") {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000712 if ( $VERBOSE ) {
713 print "SingleSource TEST STAGE\n";
714 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000715 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattner4d00fde2004-05-28 20:30:23 +0000716 if ( $VERBOSE ) {
717 print "MultiSource TEST STAGE\n";
718 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000719 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Reid Spencer1d914632004-06-23 07:45:46 +0000720 if ( ! $NOEXTERNALS ) {
721 if ( $VERBOSE ) {
722 print "External TEST STAGE\n";
723 }
724 $ExternalProgramsTable = TestDirectory("External");
725 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000726 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Reid Spencer1d914632004-06-23 07:45:46 +0000727 } else {
728 if ( $VERBOSE ) {
729 print "External TEST STAGE SKIPPED\n";
730 }
731 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
732 " | sort > $Prefix-Tests.txt";
733 }
Chris Lattner5d6c4382003-01-23 19:31:28 +0000734}
Chris Lattnerb3440302003-01-22 16:14:05 +0000735
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000736if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000737my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
738
Chris Lattnerec0e3742003-02-28 20:30:20 +0000739if ($TestError) {
740 $TestsAdded = "<b>error testing</b><br>";
741 $TestsRemoved = "<b>error testing</b><br>";
742 $TestsFixed = "<b>error testing</b><br>";
743 $TestsBroken = "<b>error testing</b><br>";
744} else {
745 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
746
747 my @RawTestsAddedArray = split '\n', $RTestsAdded;
748 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
749
750 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
751 @RawTestsRemovedArray;
752 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
753 @RawTestsAddedArray;
754
755 foreach $Test (keys %NewTests) {
756 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
757 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000758 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000759 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
760 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
761 } else {
762 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
763 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000764 }
765 }
Chris Lattnerec0e3742003-02-28 20:30:20 +0000766 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
767 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
768 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000769
Chris Lattner91480ff2003-10-21 15:47:31 +0000770 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
771 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
772 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
773 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnerbe197872003-10-19 16:54:00 +0000774
Chris Lattnerec0e3742003-02-28 20:30:20 +0000775 $TestsAdded = AddPreTag $TestsAdded;
776 $TestsRemoved = AddPreTag $TestsRemoved;
777 $TestsFixed = AddPreTag $TestsFixed;
778 $TestsBroken = AddPreTag $TestsBroken;
779}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000780
Chris Lattner9efd7f42003-10-18 19:31:39 +0000781
Chris Lattner196a14a2003-08-19 15:08:34 +0000782# If we built the tree successfully, runs of the Olden suite with
783# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
784if ($BuildError eq "") {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000785 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
Chris Lattner08e24762003-08-19 18:35:03 +0000786 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattner196a14a2003-08-19 15:08:34 +0000787 $MachCodeSize) = ("","","","","","","");
Chris Lattner08e24762003-08-19 18:35:03 +0000788 if (!$NORUNNINGTESTS) {
Reid Spencer10ffe012004-09-05 07:58:10 +0000789 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000790 "Olden Test Directory");
Chris Lattner196a14a2003-08-19 15:08:34 +0000791
792 # Clean out previous results...
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000793 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
Chris Lattner196a14a2003-08-19 15:08:34 +0000794
Chris Lattner36dc5c72004-11-06 21:35:40 +0000795 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
796 # GET_STABLE_NUMBERS enabled!
Brian Gaeke85668542004-06-04 00:07:12 +0000797 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattner36dc5c72004-11-06 21:35:40 +0000798 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000799 system "cp report.nightly.raw.out $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000800 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000801 system "gunzip ${OldenTestsLog}.gz";
Chris Lattner196a14a2003-08-19 15:08:34 +0000802 }
803
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000804 # Now we know we have $OldenTestsLog as the raw output file. Split
Chris Lattner196a14a2003-08-19 15:08:34 +0000805 # it up into records and read the useful information.
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000806 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000807 shift @Records; # Delete the first (garbage) record
808
809 # Loop over all of the records, summarizing them into rows for the running
810 # totals file.
811 my $WallTimeRE = "[A-Za-z0-9.: ]+\\(([0-9.]+) wall clock";
812 foreach $Rec (@Records) {
Chris Lattner36dc5c72004-11-06 21:35:40 +0000813 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
814 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
815 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
816 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000817 my $rOptTime = GetRegex "TEST-RESULT-compile: $WallTimeRE", $Rec;
818 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
819 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
820
821 $NATTime .= " " . FormatTime($rNATTime);
822 $CBETime .= " " . FormatTime($rCBETime);
823 $LLCTime .= " " . FormatTime($rLLCTime);
824 $JITTime .= " " . FormatTime($rJITTime);
825 $OptTime .= " $rOptTime";
Chris Lattner08e24762003-08-19 18:35:03 +0000826 $BytecodeSize .= " $rBytecodeSize";
827 $MachCodeSize .= " $rMachCodeSize";
Chris Lattner196a14a2003-08-19 15:08:34 +0000828 }
829
830 # Now that we have all of the numbers we want, add them to the running totals
831 # files.
Chris Lattner08e24762003-08-19 18:35:03 +0000832 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattner196a14a2003-08-19 15:08:34 +0000833 AddRecord($CBETime, "running_Olden_cbe_time.txt");
834 AddRecord($LLCTime, "running_Olden_llc_time.txt");
835 AddRecord($JITTime, "running_Olden_jit_time.txt");
836 AddRecord($OptTime, "running_Olden_opt_time.txt");
837 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
838 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
Chris Lattner08e24762003-08-19 18:35:03 +0000839
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000840 system "gzip -f $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000841}
842
843
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000844#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000845# Get a list of the previous days that we can link to...
Chris Lattnerb3440302003-01-22 16:14:05 +0000846#
Chris Lattner2f8cb572003-01-20 18:05:27 +0000847my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000848
Brian Gaeke253231e2004-06-11 19:55:30 +0000849if ((scalar @PrevDays) > 20) {
850 splice @PrevDays, 20; # Trim down list to something reasonable...
851}
Chris Lattner4c7e3032003-01-20 06:11:03 +0000852
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000853# Format list for sidebar
854my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000855
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000856#
Brian Gaeke90c82b92004-09-28 16:04:00 +0000857# Start outputting files into the web directory
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000858#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000859ChangeDir( $WebDir, "Web Directory" );
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000860
Brian Gaeke90c82b92004-09-28 16:04:00 +0000861# Make sure we don't get errors running the nightly tester the first time
862# because of files that don't exist.
863Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
864 'running_loc.txt', 'running_Olden_machcode.txt',
865 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
866 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
867 'running_Olden_jit_time.txt');
868
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000869# Add information to the files which accumulate information for graphs...
870AddRecord($LOC, "running_loc.txt");
871AddRecord($BuildTime, "running_build_time.txt");
872
Chris Lattner4d00fde2004-05-28 20:30:23 +0000873if ( $VERBOSE ) {
874 print "GRAPH GENERATION STAGE\n";
875}
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000876#
877# Rebuild the graphs now...
878#
Chris Lattnerfe2597a2004-07-27 18:41:49 +0000879$GNUPLOT = "/usr/bin/gnuplot";
Brian Gaekeb3dab902003-10-11 05:34:00 +0000880$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000881system ("$GNUPLOT", $PlotScriptFilename);
Chris Lattnerb3440302003-01-22 16:14:05 +0000882
Chris Lattner4c7e3032003-01-20 06:11:03 +0000883#
884# Remove the cvs tree...
885#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000886system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000887
Chris Lattnerb3440302003-01-22 16:14:05 +0000888#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000889# Print out information...
Chris Lattnerb3440302003-01-22 16:14:05 +0000890#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000891if ($VERBOSE) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000892 print "DateString: $DateString\n";
893 print "CVS Checkout: $CVSCheckoutTime seconds\n";
894 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000895 print "Build Time: $BuildTime seconds\n";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000896 print "Feature Test Time: $FeatureTime seconds\n";
897 print "Regression Test Time: $RegressionTime seconds\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000898 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
899
900 print "WARNINGS:\n $WarningsList\n";
901
Chris Lattner4c7e3032003-01-20 06:11:03 +0000902 print "Users committed: $UserCommitList\n";
903 print "Added Files: \n $AddedFilesList\n";
904 print "Modified Files: \n $ModifiedFilesList\n";
905 print "Removed Files: \n $RemovedFilesList\n";
906
907 print "Previous Days =\n $PrevDaysList\n";
908}
909
Chris Lattnerb3440302003-01-22 16:14:05 +0000910
Chris Lattner2f8cb572003-01-20 18:05:27 +0000911#
912# Output the files...
913#
914
Chris Lattner4d00fde2004-05-28 20:30:23 +0000915if ( $VERBOSE ) {
916 print "OUTPUT STAGE\n";
917}
Chris Lattner2f8cb572003-01-20 18:05:27 +0000918# Main HTML file...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000919my $Output;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000920my $TestFinishTime = gmtime;
921my $TestPlatform = `uname -a`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000922eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000923WriteFile "$DATE.html", $Output;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000924system ( "ln -sf $DATE.html index.html" );
Chris Lattner4c7e3032003-01-20 06:11:03 +0000925
926# Change the index.html symlink...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000927
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000928# vim: sw=2 ai