blob: 86ba616576cd636386f89aa68d738f56b89f7043 [file] [log] [blame]
Alkis Evlogimenos2e142f52004-01-07 01:48:26 +00001#!/usr/bin/perl -w
Chris Lattner4c7e3032003-01-20 06:11:03 +00002#
3# Program: NightlyTest.pl
4#
5# Synopsis: Perform a series of tests which are designed to be run nightly.
6# This is used to keep track of the status of the LLVM tree, tracking
7# regressions and performance changes. This generates one web page a
8# day which can be used to access this information.
9#
Brian Gaekeb3dab902003-10-11 05:34:00 +000010# Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR]
11# where
12# OPTIONS may include one or more of the following:
13# -nocheckout Do not create, checkout, update, or configure
14# the source tree.
15# -noremove Do not remove the BUILDDIR after it has been built.
16# -notest Do not even attempt to run the test programs. Implies
17# -norunningtests.
18# -norunningtests Do not run the Olden benchmark suite with
19# LARGE_PROBLEM_SIZE enabled.
Reid Spencer1d914632004-06-23 07:45:46 +000020# -noexternals Do not run the external tests (for cases where povray
21# or SPEC are not installed)
Tanya Lattner056ec062004-12-04 06:25:50 +000022# -nodejagnu Do not run feature or regression tests
Brian Gaekeb3dab902003-10-11 05:34:00 +000023# -parallel Run two parallel jobs with GNU Make.
Reid Spencerf6d02332004-06-11 07:06:22 +000024# -release Build an LLVM Release version
25# -pedantic Enable additional GCC warnings to detect possible errors.
Reid Spencer39ce11b2005-01-13 18:02:40 +000026# -enable-llcbeta Enable testing of beta features in llc.
Brian Gaeke047e6062004-08-05 19:54:59 +000027# -disable-llc Disable LLC tests in the nightly tester.
28# -disable-jit Disable JIT tests in the nightly tester.
Chris Lattner4d00fde2004-05-28 20:30:23 +000029# -verbose Turn on some debug output
30# -debug Print information useful only to maintainers of this script.
Reid Spencercb6a3aa2004-06-22 15:38:37 +000031# -nice Checkout/Configure/Build with "nice" to reduce impact
32# on busy servers.
Misha Brukman2e9ac692004-11-08 03:28:27 +000033# -f2c Next argument specifies path to F2C utility
Reid Spencercb6a3aa2004-06-22 15:38:37 +000034# -gnuplotscript Next argument specifies gnuplot script to use
35# -templatefile Next argument specifies template file to use
Chris Lattner892cdb32004-07-27 08:29:06 +000036# -gccpath Path to gcc/g++ used to build LLVM
Misha Brukmanf5f37f02005-05-26 16:28:55 +000037# -cvstag Check out a specific CVS tag to build LLVM (useful for
38# testing release branches)
Misha Brukman4391bb52005-06-06 19:17:05 +000039# -target Specify the target triplet
Chris Lattnerbb0aca52003-12-19 03:47:31 +000040#
Chris Lattnerb0ddb492005-11-01 17:59:42 +000041# ---------------- Options to configure llvm-test ----------------------------
42# -spec2000path Path to the benchspec directory in the SPEC 2000 distro
43# -spec95path Path to the benchspec directory in the SPEC 95 distro.
44# -povraypath Path to the povray sources
45# -namdpath Path to the namd sources
46#
Brian Gaekeb3dab902003-10-11 05:34:00 +000047# CVSROOT is the CVS repository from which the tree will be checked out,
48# specified either in the full :method:user@host:/dir syntax, or
49# just /dir if using a local repo.
50# BUILDDIR is the directory where sources for this test run will be checked out
51# AND objects for this test run will be built. This directory MUST NOT
52# exist before the script is run; it will be created by the cvs checkout
53# process and erased (unless -noremove is specified; see above.)
54# WEBDIR is the directory into which the test results web page will be written,
55# AND in which the "index.html" is assumed to be a symlink to the most recent
Brian Gaeke90c82b92004-09-28 16:04:00 +000056# copy of the results. This directory will be created if it does not exist.
Reid Spencer932b69f2004-12-26 05:21:13 +000057# LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
58# to. This is the same as you would have for a normal LLVM build.
Chris Lattner4c7e3032003-01-20 06:11:03 +000059#
60use POSIX qw(strftime);
Tanya Lattner5debe8c2004-11-21 00:02:40 +000061use File::Copy;
Chris Lattner4c7e3032003-01-20 06:11:03 +000062
Brian Gaekeb3dab902003-10-11 05:34:00 +000063my $HOME = $ENV{'HOME'};
64my $CVSRootDir = $ENV{'CVSROOT'};
Chris Lattner9d13efa2003-10-14 01:22:08 +000065 $CVSRootDir = "/home/vadve/shared/PublicCVS"
Chris Lattner4d00fde2004-05-28 20:30:23 +000066 unless $CVSRootDir;
67my $BuildDir = $ENV{'BUILDDIR'};
68 $BuildDir = "$HOME/buildtest"
69 unless $BuildDir;
70my $WebDir = $ENV{'WEBDIR'};
71 $WebDir = "$HOME/cvs/testresults-X86"
72 unless $WebDir;
Chris Lattner2f8cb572003-01-20 18:05:27 +000073
74# Calculate the date prefix...
75@TIME = localtime;
76my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
77my $DateString = strftime "%B %d, %Y", localtime;
Chris Lattner004e19e2005-02-13 16:08:30 +000078my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000079
80# Command line argument settings...
81my $NOCHECKOUT = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000082my $NOREMOVE = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000083my $NOTEST = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000084my $NORUNNINGTESTS = 0;
Reid Spencer1d914632004-06-23 07:45:46 +000085my $NOEXTERNALS = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000086my $MAKEOPTS = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000087my $PROGTESTOPTS = "";
Misha Brukman2e9ac692004-11-08 03:28:27 +000088my $VERBOSE = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000089my $DEBUG = 0;
Brian Gaeke047e6062004-08-05 19:54:59 +000090my $CONFIGUREARGS = "";
Misha Brukmanf5f37f02005-05-26 16:28:55 +000091my $CVSCOOPT = "-APR";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000092my $NICE = "";
Tanya Lattner056ec062004-12-04 06:25:50 +000093my $NODEJAGNU = 0;
Chris Lattner2f8cb572003-01-20 18:05:27 +000094
Chris Lattnerb0ddb492005-11-01 17:59:42 +000095my $LLVMTESTCONFIGARGS = "";
96
Chris Lattnerb3440302003-01-22 16:14:05 +000097sub ReadFile {
98 if (open (FILE, $_[0])) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +000099 undef $/;
Chris Lattnerb3440302003-01-22 16:14:05 +0000100 my $Ret = <FILE>;
101 close FILE;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000102 $/ = '\n';
Chris Lattnerb3440302003-01-22 16:14:05 +0000103 return $Ret;
104 } else {
105 print "Could not open file '$_[0]' for reading!";
106 return "";
107 }
108}
109
Chris Lattner2f8cb572003-01-20 18:05:27 +0000110sub WriteFile { # (filename, contents)
111 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
112 print FILE $_[1];
113 close FILE;
114}
115
116sub GetRegex { # (Regex with ()'s, value)
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000117 $_[1] =~ /$_[0]/m;
Chris Lattner08e24762003-08-19 18:35:03 +0000118 if (defined($1)) {
119 return $1;
120 }
Reid Spencera337f0c2004-06-23 06:36:34 +0000121 return "0";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000122}
123
Brian Gaeke90c82b92004-09-28 16:04:00 +0000124sub Touch {
125 my @files = @_;
126 my $now = time;
127 foreach my $file (@files) {
128 if (! -f $file) {
129 open (FILE, ">$file") or warn "Could not create new file $file";
130 close FILE;
131 }
132 utime $now, $now, $file;
133 }
134}
135
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000136sub AddRecord {
137 my ($Val, $Filename) = @_;
138 my @Records;
139 if (open FILE, "$WebDir/$Filename") {
140 @Records = grep !/$DATE/, split "\n", <FILE>;
141 close FILE;
142 }
143 push @Records, "$DATE: $Val";
144 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000145}
146
Chris Lattner2f8cb572003-01-20 18:05:27 +0000147sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
148 $_ = shift;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000149 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner2f8cb572003-01-20 18:05:27 +0000150}
151
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000152sub ChangeDir { # directory, logical name
153 my ($dir,$name) = @_;
154 chomp($dir);
155 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
156 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
157}
158
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000159sub CopyFile { #filename, newfile
160 my ($file, $newfile) = @_;
161 chomp($file);
162 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
163 copy($file, $newfile);
164}
165
Chris Lattner2f8cb572003-01-20 18:05:27 +0000166sub GetDir {
167 my $Suffix = shift;
168 opendir DH, $WebDir;
169 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
170 closedir DH;
171 return @Result;
172}
173
174# DiffFiles - Diff the current version of the file against the last version of
175# the file, reporting things added and removed. This is used to report, for
176# example, added and removed warnings. This returns a pair (added, removed)
177#
178sub DiffFiles {
179 my $Suffix = shift;
180 my @Others = GetDir $Suffix;
181 if (@Others == 0) { # No other files? We added all entries...
182 return (`cat $WebDir/$DATE$Suffix`, "");
183 }
184 # Diff the files now...
185 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
186 my $Added = join "\n", grep /^</, @Diffs;
187 my $Removed = join "\n", grep /^>/, @Diffs;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000188 $Added =~ s/^< //gm;
189 $Removed =~ s/^> //gm;
Chris Lattner2f8cb572003-01-20 18:05:27 +0000190 return ($Added, $Removed);
191}
192
Chris Lattner196a14a2003-08-19 15:08:34 +0000193# FormatTime - Convert a time from 1m23.45 into 83.45
194sub FormatTime {
195 my $Time = shift;
196 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
197 $Time = sprintf("%7.4f", $1*60.0+$2);
198 }
199 return $Time;
200}
201
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000202sub GetRegexNum {
203 my ($Regex, $Num, $Regex2, $File) = @_;
204 my @Items = split "\n", `grep '$Regex' $File`;
205 return GetRegex $Regex2, $Items[$Num];
206}
207
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000208sub GetDejagnuTestResults { # (filename, log)
209 my ($filename, $DejagnuLog) = @_;
210 my @lines;
211 my $firstline;
212 $/ = "\n"; #Make sure we're going line at a time.
Chris Lattner453d0622005-03-10 16:26:50 +0000213
Chris Lattner8f457312005-03-17 16:07:45 +0000214 print "DEJAGNU TEST RESULTS:\n";
Chris Lattner453d0622005-03-10 16:26:50 +0000215
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000216 if (open SRCHFILE, $filename) {
217 # Process test results
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000218 my $first_list = 1;
219 my $should_break = 1;
220 my $nocopy = 0;
221 my $readingsum = 0;
222 while ( <SRCHFILE> ) {
223 if ( length($_) > 1 ) {
224 chomp($_);
225 if ( m/^XPASS:/ || m/^FAIL:/ ) {
226 $nocopy = 0;
227 if ( $first_list ) {
Misha Brukmand3a54122005-03-10 16:32:33 +0000228 push(@lines, "<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n");
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000229 $first_list = 0;
230 $should_break = 1;
Misha Brukmand3a54122005-03-10 16:32:33 +0000231 push(@lines, "<b>$_</b><br/>\n");
Chris Lattner453d0622005-03-10 16:26:50 +0000232 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000233 } else {
Misha Brukmand3a54122005-03-10 16:32:33 +0000234 push(@lines, "</li><li><b>$_</b><br/>\n");
Chris Lattner453d0622005-03-10 16:26:50 +0000235 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000236 }
237 } elsif ( m/Summary/ ) {
Chris Lattner453d0622005-03-10 16:26:50 +0000238 if ( $first_list ) {
Misha Brukmand3a54122005-03-10 16:32:33 +0000239 push(@lines, "<b>PERFECT!</b>");
240 print " PERFECT!\n";
241 } else {
242 push(@lines, "</li></ol>\n");
243 }
244 push(@lines, "<h3>STATISTICS</h3><pre>\n");
Chris Lattner8f457312005-03-17 16:07:45 +0000245 print "\nDEJAGNU STATISTICS:\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000246 $should_break = 0;
247 $nocopy = 0;
248 $readingsum = 1;
249 } elsif ( $readingsum ) {
250 push(@lines,"$_\n");
Chris Lattner8f457312005-03-17 16:07:45 +0000251 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000252 }
253 }
254 }
255 }
256 push(@lines, "</pre>\n");
257 close SRCHFILE;
258
Misha Brukmand3a54122005-03-10 16:32:33 +0000259 my $content = join("", @lines);
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000260 return "$content</li></ol>\n";
261}
262
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000263
264#####################################################################
265## MAIN PROGRAM
266#####################################################################
267
268my $Template = "";
269my $PlotScriptFilename = "";
270
271# Parse arguments...
272while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
273 shift;
274 last if /^--$/; # Stop processing arguments on --
275
276 # List command line options here...
277 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000278 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000279 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000280 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000281 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
282 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000283 if (/^-pedantic$/) {
Misha Brukman4391bb52005-06-06 19:17:05 +0000284 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000285 next;
286 }
Chris Lattnerc82a6c82005-01-08 21:03:58 +0000287 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
Brian Gaeke047e6062004-08-05 19:54:59 +0000288 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
289 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
290 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
291 $CONFIGUREARGS .= " --disable-jit"; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000292 if (/^-verbose$/) { $VERBOSE = 1; next; }
293 if (/^-debug$/) { $DEBUG = 1; next; }
294 if (/^-nice$/) { $NICE = "nice "; next; }
295 if (/^-f2c$/) {
296 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
297 }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000298 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
Reid Spencerc5b67052004-06-23 14:07:12 +0000299 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000300 if (/^-gccpath/) {
301 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
302 }
Misha Brukmanf5f37f02005-05-26 16:28:55 +0000303 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
Misha Brukman4391bb52005-06-06 19:17:05 +0000304 if (/^-target/) {
305 $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next;
306 }
Reid Spencer1d914632004-06-23 07:45:46 +0000307 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
Misha Brukman4391bb52005-06-06 19:17:05 +0000308 if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
Chris Lattnerb0ddb492005-11-01 17:59:42 +0000309 if (/^-spec2000path$/) {
310 $LLVMTESTCONFIGARGS .= " --enable-spec2000=$ARGV[0]"; shift; next;
311 }
312 if (/^-spec95path$/) {
313 $LLVMTESTCONFIGARGS .= " --enable-spec95=$ARGV[0]"; shift; next;
314 }
315 if (/^-povraypath$/) {
316 $LLVMTESTCONFIGARGS .= " --enable-povray=$ARGV[0]"; shift; next;
317 }
318 if (/^-namdpath$/) {
319 $LLVMTESTCONFIGARGS .= " --enable-namd=$ARGV[0]"; shift; next;
320 }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000321 print "Unknown option: $_ : ignoring!\n";
322}
323
Reid Spencer932b69f2004-12-26 05:21:13 +0000324if ($ENV{'LLVMGCCDIR'}) {
325 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
326}
Brian Gaeke047e6062004-08-05 19:54:59 +0000327if ($CONFIGUREARGS !~ /--disable-jit/) {
328 $CONFIGUREARGS .= " --enable-jit";
329}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000330
331die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
332
333if (@ARGV == 3) {
334 $CVSRootDir = $ARGV[0];
335 $BuildDir = $ARGV[1];
336 $WebDir = $ARGV[2];
337}
338
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000339my $Prefix = "$WebDir/$DATE";
340
341#define the file names we'll use
342my $BuildLog = "$Prefix-Build-Log.txt";
343my $CVSLog = "$Prefix-CVS-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000344my $OldenTestsLog = "$Prefix-Olden-tests.txt";
345my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
346my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
347my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000348my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
349my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
350my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000351
352if ($VERBOSE) {
353 print "INITIALIZED\n";
354 print "CVS Root = $CVSRootDir\n";
355 print "BuildDir = $BuildDir\n";
356 print "WebDir = $WebDir\n";
357 print "Prefix = $Prefix\n";
358 print "CVSLog = $CVSLog\n";
359 print "BuildLog = $BuildLog\n";
360}
361
Brian Gaeke90c82b92004-09-28 16:04:00 +0000362if (! -d $WebDir) {
363 mkdir $WebDir, 0777;
364 warn "Warning: $WebDir did not exist; creating it.\n";
365}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000366
367#
368# Create the CVS repository directory
369#
370if (!$NOCHECKOUT) {
371 if (-d $BuildDir) {
372 if (!$NOREMOVE) {
373 system "rm -rf $BuildDir";
374 } else {
375 die "CVS checkout directory $BuildDir already exists!";
376 }
377 }
378 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
379}
380
381ChangeDir( $BuildDir, "CVS checkout directory" );
382
383
384#
385# Check out the llvm tree, saving CVS messages to the cvs log...
386#
Misha Brukmanf5f37f02005-05-26 16:28:55 +0000387my $CVSOPT = "";
388# Use compression if going over ssh.
389$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
390my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000391if (!$NOCHECKOUT) {
392 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
Misha Brukmanf5f37f02005-05-26 16:28:55 +0000393 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
394 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
Reid Spencer10ffe012004-09-05 07:58:10 +0000395 ChangeDir( $BuildDir , "CVS Checkout directory") ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000396}
397
398ChangeDir( "llvm" , "llvm source directory") ;
399
400if (!$NOCHECKOUT) {
401 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
Reid Spencer10ffe012004-09-05 07:58:10 +0000402 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000403}
404
Reid Spencerc5b67052004-06-23 14:07:12 +0000405if ( $Template eq "" ) {
406 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
407}
408die "Template file $Template is not readable" if ( ! -r "$Template" );
409
410if ( $PlotScriptFilename eq "" ) {
411 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
412}
413die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
414
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000415# Read in the HTML template file...
416if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
417my $TemplateContents = ReadFile $Template;
418
419#
420# Get some static statistics about the current state of CVS
421#
422my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
423my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
424my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
Reid Spencere993f462004-09-06 19:32:55 +0000425$LOC = `utils/countloc.sh`;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000426
427#
428# Build the entire tree, saving build messages to the build log
429#
430if (!$NOCHECKOUT) {
431 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
Chris Lattnerb0ddb492005-11-01 17:59:42 +0000432 my $EXTRAFLAGS = "--enable-spec --with-objroot=.$LLVMTESTCONFIGARGS";
Chris Lattnere50caac2005-10-28 16:35:18 +0000433 system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000434
435 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
436 # Build the entire tree, capturing the output into $BuildLog
437 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
438}
439
440
441#
442# Get some statistics about the build...
443#
444my @Linked = split '\n', `grep Linking $BuildLog`;
445my $NumExecutables = scalar(grep(/executable/, @Linked));
446my $NumLibraries = scalar(grep(!/executable/, @Linked));
Chris Lattner0bb48282005-03-11 20:17:04 +0000447my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000448
449my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
450my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
451my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
452my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
453
454my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
455my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
456my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
457my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
458
Misha Brukman9a612752005-01-12 03:31:38 +0000459my $BuildError = 0, $BuildStatus = "OK";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000460if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
461 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
Misha Brukman9a612752005-01-12 03:31:38 +0000462 $BuildStatus = "<h3><font color='red'>error: compilation " .
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000463 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
Misha Brukman9a612752005-01-12 03:31:38 +0000464 $BuildError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000465 if ($VERBOSE) { print "BUILD ERROR\n"; }
466}
467
Tanya Lattner056ec062004-12-04 06:25:50 +0000468if ($BuildError) { $NODEJAGNU=1; }
Brian Gaeke22800982004-06-25 07:25:28 +0000469
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000470my $DejangnuTestResults; # String containing the results of the dejagnu
Tanya Lattner59a86552004-12-04 06:35:14 +0000471if(!$NODEJAGNU) {
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000472 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
473
474 my $dejagnu_output = "$DejagnuTestsLog";
475
476 #Run the feature and regression tests, results are put into testrun.sum
477 #Full log in testrun.log
Tanya Lattner056ec062004-12-04 06:25:50 +0000478 system "(time -p gmake $MAKEOPTS check) > $dejagnu_output 2>&1";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000479
480 #Extract time of dejagnu tests
481 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
482 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
483 $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
484 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
485
486 #Copy the testrun.log and testrun.sum to our webdir
487 CopyFile("test/testrun.log", $DejagnuLog);
488 CopyFile("test/testrun.sum", $DejagnuSum);
489
490 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
Tanya Lattnera2dfbf92004-12-17 20:58:34 +0000491
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000492} else {
493 $DejagnuTestResults = "Skipped by user choice.";
494 $DejagnuTime = "0.0";
495 $DejagnuWallTime = "0.0";
496}
497
Chris Lattner4d00fde2004-05-28 20:30:23 +0000498if ($DEBUG) {
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000499 print $DejagnuTestResults;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000500}
501
502if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerb3440302003-01-22 16:14:05 +0000503#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000504# Get warnings from the build
Chris Lattnerb3440302003-01-22 16:14:05 +0000505#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000506my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000507my @Warnings;
508my $CurDir = "";
509
510foreach $Warning (@Warn) {
511 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
512 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman8e9554a2003-08-14 15:26:28 +0000513 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner4c7e3032003-01-20 06:11:03 +0000514 $CurDir = $1;
515 }
516 } else {
517 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
518 }
519}
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000520my $WarningsFile = join "\n", @Warnings;
521my $WarningsList = AddPreTag $WarningsFile;
522$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000523
Chris Lattner2f8cb572003-01-20 18:05:27 +0000524# Emit the warnings file, so we can diff...
525WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
526my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000527
Chris Lattner9efd7f42003-10-18 19:31:39 +0000528# Output something to stdout if something has changed
529print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
530print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
531
Chris Lattnerbe197872003-10-19 16:54:00 +0000532$WarningsAdded = AddPreTag $WarningsAdded;
533$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattnerb3440302003-01-22 16:14:05 +0000534
535#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000536# Get some statistics about CVS commits over the current day...
Chris Lattnerb3440302003-01-22 16:14:05 +0000537#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000538if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000539@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
540#print join "\n", @CVSHistory; print "\n";
541
542# Extract some information from the CVS history... use a hash so no duplicate
543# stuff is stored.
Misha Brukman1b366892003-07-07 21:27:40 +0000544my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000545
Brian Gaeke43f38672004-06-10 07:44:28 +0000546my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000547
Chris Lattner4c7e3032003-01-20 06:11:03 +0000548# Loop over every record from the CVS history, filling in the hashes.
549foreach $File (@CVSHistory) {
550 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman8e9554a2003-08-14 15:26:28 +0000551 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000552 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattnerd56147d2004-01-12 16:55:30 +0000553 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
554 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman1b366892003-07-07 21:27:40 +0000555 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000556 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner4c7e3032003-01-20 06:11:03 +0000557 } else {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000558 print "UNMATCHABLE: $File\n";
Brian Gaeke43f38672004-06-10 07:44:28 +0000559 next;
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000560 }
561 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
562
563 if ($Filename =~ /^llvm/) {
564 if ($Type eq 'M') { # Modified
565 $ModifiedFiles{$Filename} = 1;
566 $UsersCommitted{$UID} = 1;
567 } elsif ($Type eq 'A') { # Added
568 $AddedFiles{$Filename} = 1;
569 $UsersCommitted{$UID} = 1;
570 } elsif ($Type eq 'R') { # Removed
571 $RemovedFiles{$Filename} = 1;
572 $UsersCommitted{$UID} = 1;
573 } else {
574 $UsersUpdated{$UID} = 1;
575 }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000576 }
577}
578
Chris Lattner5e5d2202005-03-16 17:09:53 +0000579my $UserCommitList = join "\n", sort keys %UsersCommitted;
580my $UserUpdateList = join "\n", sort keys %UsersUpdated;
Chris Lattnerc9cdadf2003-08-06 16:02:50 +0000581my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
582my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
583my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000584
Chris Lattnerec0e3742003-02-28 20:30:20 +0000585my $TestError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000586my $SingleSourceProgramsTable = "!";
587my $MultiSourceProgramsTable = "!";
588my $ExternalProgramsTable = "!";
Chris Lattnerb3440302003-01-22 16:14:05 +0000589
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000590
591sub TestDirectory {
592 my $SubDir = shift;
593
Reid Spencer10ffe012004-09-05 07:58:10 +0000594 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000595
596 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000597
598 # Run the programs tests... creating a report.nightly.html file
599 if (!$NOTEST) {
Chris Lattner20d13ea2004-06-03 03:29:39 +0000600 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000601 . "TEST=nightly > $ProgramTestLog 2>&1";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000602 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000603 system "gunzip ${ProgramTestLog}.gz";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000604 }
605
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000606 my $ProgramsTable;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000607 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
Chris Lattnerec0e3742003-02-28 20:30:20 +0000608 $TestError = 1;
Chris Lattner2e8be142003-05-10 21:40:10 +0000609 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000610 print "ERROR TESTING\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000611 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000612 $TestError = 1;
613 $ProgramsTable =
614 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000615 print "ERROR TESTING\n";
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000616 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000617 $TestError = 0;
618 $ProgramsTable = ReadFile "report.nightly.html";
619
620 #
621 # Create a list of the tests which were run...
622 #
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000623 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000624 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000625 }
626
627 # Compress the test output
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000628 system "gzip -f $ProgramTestLog";
629 ChangeDir( "../../..", "Programs Test Parent Directory" );
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000630 return $ProgramsTable;
631}
632
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000633# If we built the tree successfully, run the nightly programs tests...
Misha Brukman9a612752005-01-12 03:31:38 +0000634if (!$BuildError) {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000635 if ( $VERBOSE ) {
636 print "SingleSource TEST STAGE\n";
637 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000638 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattner4d00fde2004-05-28 20:30:23 +0000639 if ( $VERBOSE ) {
640 print "MultiSource TEST STAGE\n";
641 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000642 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Reid Spencer1d914632004-06-23 07:45:46 +0000643 if ( ! $NOEXTERNALS ) {
644 if ( $VERBOSE ) {
645 print "External TEST STAGE\n";
646 }
647 $ExternalProgramsTable = TestDirectory("External");
648 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000649 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Reid Spencer1d914632004-06-23 07:45:46 +0000650 } else {
Reid Spencerb8e825b2004-12-04 22:18:28 +0000651 $ExternalProgramsTable = '<tr><td>External TEST STAGE SKIPPED</td></tr>';
Reid Spencer1d914632004-06-23 07:45:46 +0000652 if ( $VERBOSE ) {
653 print "External TEST STAGE SKIPPED\n";
654 }
655 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
656 " | sort > $Prefix-Tests.txt";
657 }
Chris Lattner5d6c4382003-01-23 19:31:28 +0000658}
Chris Lattnerb3440302003-01-22 16:14:05 +0000659
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000660if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000661my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
662
Chris Lattnerec0e3742003-02-28 20:30:20 +0000663if ($TestError) {
664 $TestsAdded = "<b>error testing</b><br>";
665 $TestsRemoved = "<b>error testing</b><br>";
666 $TestsFixed = "<b>error testing</b><br>";
667 $TestsBroken = "<b>error testing</b><br>";
668} else {
669 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
670
671 my @RawTestsAddedArray = split '\n', $RTestsAdded;
672 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
673
674 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
675 @RawTestsRemovedArray;
676 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
677 @RawTestsAddedArray;
678
679 foreach $Test (keys %NewTests) {
680 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
681 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000682 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000683 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
684 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
685 } else {
686 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
687 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000688 }
689 }
Chris Lattnerec0e3742003-02-28 20:30:20 +0000690 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
691 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
692 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000693
Chris Lattner91480ff2003-10-21 15:47:31 +0000694 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
695 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
696 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
697 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnerbe197872003-10-19 16:54:00 +0000698
Chris Lattnerec0e3742003-02-28 20:30:20 +0000699 $TestsAdded = AddPreTag $TestsAdded;
700 $TestsRemoved = AddPreTag $TestsRemoved;
701 $TestsFixed = AddPreTag $TestsFixed;
702 $TestsBroken = AddPreTag $TestsBroken;
703}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000704
Chris Lattner9efd7f42003-10-18 19:31:39 +0000705
Chris Lattner196a14a2003-08-19 15:08:34 +0000706# If we built the tree successfully, runs of the Olden suite with
707# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
Misha Brukman9a612752005-01-12 03:31:38 +0000708if (!$BuildError) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000709 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
Chris Lattner08e24762003-08-19 18:35:03 +0000710 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattner196a14a2003-08-19 15:08:34 +0000711 $MachCodeSize) = ("","","","","","","");
Chris Lattner08e24762003-08-19 18:35:03 +0000712 if (!$NORUNNINGTESTS) {
Reid Spencer10ffe012004-09-05 07:58:10 +0000713 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000714 "Olden Test Directory");
Chris Lattner196a14a2003-08-19 15:08:34 +0000715
716 # Clean out previous results...
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000717 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
Chris Lattner196a14a2003-08-19 15:08:34 +0000718
Chris Lattner36dc5c72004-11-06 21:35:40 +0000719 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
720 # GET_STABLE_NUMBERS enabled!
Brian Gaeke85668542004-06-04 00:07:12 +0000721 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattner36dc5c72004-11-06 21:35:40 +0000722 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000723 system "cp report.nightly.raw.out $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000724 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000725 system "gunzip ${OldenTestsLog}.gz";
Chris Lattner196a14a2003-08-19 15:08:34 +0000726 }
727
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000728 # Now we know we have $OldenTestsLog as the raw output file. Split
Chris Lattner196a14a2003-08-19 15:08:34 +0000729 # it up into records and read the useful information.
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000730 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000731 shift @Records; # Delete the first (garbage) record
732
733 # Loop over all of the records, summarizing them into rows for the running
734 # totals file.
Chris Lattnerfed8a142004-12-14 22:42:59 +0000735 my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
Chris Lattner196a14a2003-08-19 15:08:34 +0000736 foreach $Rec (@Records) {
Chris Lattner36dc5c72004-11-06 21:35:40 +0000737 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
738 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
739 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
740 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
Chris Lattnerfed8a142004-12-14 22:42:59 +0000741 my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000742 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000743
744 $NATTime .= " " . FormatTime($rNATTime);
745 $CBETime .= " " . FormatTime($rCBETime);
746 $LLCTime .= " " . FormatTime($rLLCTime);
747 $JITTime .= " " . FormatTime($rJITTime);
748 $OptTime .= " $rOptTime";
Chris Lattner08e24762003-08-19 18:35:03 +0000749 $BytecodeSize .= " $rBytecodeSize";
Chris Lattner196a14a2003-08-19 15:08:34 +0000750 }
751
752 # Now that we have all of the numbers we want, add them to the running totals
753 # files.
Chris Lattner08e24762003-08-19 18:35:03 +0000754 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattner196a14a2003-08-19 15:08:34 +0000755 AddRecord($CBETime, "running_Olden_cbe_time.txt");
756 AddRecord($LLCTime, "running_Olden_llc_time.txt");
757 AddRecord($JITTime, "running_Olden_jit_time.txt");
758 AddRecord($OptTime, "running_Olden_opt_time.txt");
759 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
Chris Lattner08e24762003-08-19 18:35:03 +0000760
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000761 system "gzip -f $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000762}
763
764
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000765#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000766# Get a list of the previous days that we can link to...
Chris Lattnerb3440302003-01-22 16:14:05 +0000767#
Chris Lattner2f8cb572003-01-20 18:05:27 +0000768my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000769
Brian Gaeke253231e2004-06-11 19:55:30 +0000770if ((scalar @PrevDays) > 20) {
771 splice @PrevDays, 20; # Trim down list to something reasonable...
772}
Chris Lattner4c7e3032003-01-20 06:11:03 +0000773
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000774# Format list for sidebar
775my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000776
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000777#
Brian Gaeke90c82b92004-09-28 16:04:00 +0000778# Start outputting files into the web directory
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000779#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000780ChangeDir( $WebDir, "Web Directory" );
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000781
Brian Gaeke90c82b92004-09-28 16:04:00 +0000782# Make sure we don't get errors running the nightly tester the first time
783# because of files that don't exist.
784Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
Chris Lattnere50caac2005-10-28 16:35:18 +0000785 'running_loc.txt',
Brian Gaeke90c82b92004-09-28 16:04:00 +0000786 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
787 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
788 'running_Olden_jit_time.txt');
789
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000790# Add information to the files which accumulate information for graphs...
791AddRecord($LOC, "running_loc.txt");
792AddRecord($BuildTime, "running_build_time.txt");
793
Chris Lattner4d00fde2004-05-28 20:30:23 +0000794if ( $VERBOSE ) {
795 print "GRAPH GENERATION STAGE\n";
796}
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000797#
798# Rebuild the graphs now...
799#
Chris Lattnerfe2597a2004-07-27 18:41:49 +0000800$GNUPLOT = "/usr/bin/gnuplot";
Brian Gaekeb3dab902003-10-11 05:34:00 +0000801$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000802system ("$GNUPLOT", $PlotScriptFilename);
Chris Lattnerb3440302003-01-22 16:14:05 +0000803
Chris Lattner4c7e3032003-01-20 06:11:03 +0000804#
805# Remove the cvs tree...
806#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000807system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000808
Chris Lattner5e5d2202005-03-16 17:09:53 +0000809print "\nUSERS WHO COMMITTED:\n " . (join "\n ", sort keys %UsersCommitted) . "\n"
810 if (scalar %UsersCommitted);
811
812print "\nADDED FILES:\n " . (join "\n ", sort keys %AddedFiles) . "\n"
813 if (scalar %AddedFiles);
814
815print "\nCHANGED FILES:\n " . (join "\n ", sort keys %ModifiedFiles) . "\n"
816 if (scalar %ModifiedFiles);
817
818print "\nREMOVED FILES:\n " . (join "\n ", sort keys %RemovedFiles) . "\n"
819 if (scalar %RemovedFiles);
820
Chris Lattnerb3440302003-01-22 16:14:05 +0000821#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000822# Print out information...
Chris Lattnerb3440302003-01-22 16:14:05 +0000823#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000824if ($VERBOSE) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000825 print "DateString: $DateString\n";
826 print "CVS Checkout: $CVSCheckoutTime seconds\n";
827 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000828 print "Build Time: $BuildTime seconds\n";
829 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
830
831 print "WARNINGS:\n $WarningsList\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000832 print "Previous Days =\n $PrevDaysList\n";
833}
834
Chris Lattnerb3440302003-01-22 16:14:05 +0000835
Chris Lattner2f8cb572003-01-20 18:05:27 +0000836#
837# Output the files...
838#
839
Chris Lattner4d00fde2004-05-28 20:30:23 +0000840if ( $VERBOSE ) {
841 print "OUTPUT STAGE\n";
842}
Chris Lattner2f8cb572003-01-20 18:05:27 +0000843# Main HTML file...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000844my $Output;
Chris Lattner004e19e2005-02-13 16:08:30 +0000845my $TestFinishTime = gmtime() . " GMT<br>" . localtime() . " (local)";
846
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000847my $TestPlatform = `uname -a`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000848eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000849WriteFile "$DATE.html", $Output;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000850system ( "ln -sf $DATE.html index.html" );
Chris Lattner4c7e3032003-01-20 06:11:03 +0000851
852# Change the index.html symlink...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000853
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000854# vim: sw=2 ai