blob: 3e225316412f88c5377b90a0225e4cc13a04fb03 [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)
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 Spencer932b69f2004-12-26 05:21:13 +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;
Chris Lattner004e19e2005-02-13 16:08:30 +000071my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000072
73# Command line argument settings...
74my $NOCHECKOUT = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000075my $NOREMOVE = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000076my $NOTEST = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000077my $NORUNNINGTESTS = 0;
Reid Spencer1d914632004-06-23 07:45:46 +000078my $NOEXTERNALS = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000079my $MAKEOPTS = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000080my $PROGTESTOPTS = "";
Misha Brukman2e9ac692004-11-08 03:28:27 +000081my $VERBOSE = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000082my $DEBUG = 0;
Brian Gaeke047e6062004-08-05 19:54:59 +000083my $CONFIGUREARGS = "";
Misha Brukmanf5f37f02005-05-26 16:28:55 +000084my $CVSCOOPT = "-APR";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000085my $NICE = "";
Tanya Lattner056ec062004-12-04 06:25:50 +000086my $NODEJAGNU = 0;
Chris Lattner2f8cb572003-01-20 18:05:27 +000087
Chris Lattnerb3440302003-01-22 16:14:05 +000088sub ReadFile {
89 if (open (FILE, $_[0])) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +000090 undef $/;
Chris Lattnerb3440302003-01-22 16:14:05 +000091 my $Ret = <FILE>;
92 close FILE;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000093 $/ = '\n';
Chris Lattnerb3440302003-01-22 16:14:05 +000094 return $Ret;
95 } else {
96 print "Could not open file '$_[0]' for reading!";
97 return "";
98 }
99}
100
Chris Lattner2f8cb572003-01-20 18:05:27 +0000101sub WriteFile { # (filename, contents)
102 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
103 print FILE $_[1];
104 close FILE;
105}
106
107sub GetRegex { # (Regex with ()'s, value)
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000108 $_[1] =~ /$_[0]/m;
Chris Lattner08e24762003-08-19 18:35:03 +0000109 if (defined($1)) {
110 return $1;
111 }
Reid Spencera337f0c2004-06-23 06:36:34 +0000112 return "0";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000113}
114
Brian Gaeke90c82b92004-09-28 16:04:00 +0000115sub Touch {
116 my @files = @_;
117 my $now = time;
118 foreach my $file (@files) {
119 if (! -f $file) {
120 open (FILE, ">$file") or warn "Could not create new file $file";
121 close FILE;
122 }
123 utime $now, $now, $file;
124 }
125}
126
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000127sub AddRecord {
128 my ($Val, $Filename) = @_;
129 my @Records;
130 if (open FILE, "$WebDir/$Filename") {
131 @Records = grep !/$DATE/, split "\n", <FILE>;
132 close FILE;
133 }
134 push @Records, "$DATE: $Val";
135 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000136}
137
Chris Lattner2f8cb572003-01-20 18:05:27 +0000138sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
139 $_ = shift;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000140 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner2f8cb572003-01-20 18:05:27 +0000141}
142
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000143sub ChangeDir { # directory, logical name
144 my ($dir,$name) = @_;
145 chomp($dir);
146 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
147 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
148}
149
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000150sub CopyFile { #filename, newfile
151 my ($file, $newfile) = @_;
152 chomp($file);
153 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
154 copy($file, $newfile);
155}
156
Chris Lattner2f8cb572003-01-20 18:05:27 +0000157sub GetDir {
158 my $Suffix = shift;
159 opendir DH, $WebDir;
160 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
161 closedir DH;
162 return @Result;
163}
164
165# DiffFiles - Diff the current version of the file against the last version of
166# the file, reporting things added and removed. This is used to report, for
167# example, added and removed warnings. This returns a pair (added, removed)
168#
169sub DiffFiles {
170 my $Suffix = shift;
171 my @Others = GetDir $Suffix;
172 if (@Others == 0) { # No other files? We added all entries...
173 return (`cat $WebDir/$DATE$Suffix`, "");
174 }
175 # Diff the files now...
176 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
177 my $Added = join "\n", grep /^</, @Diffs;
178 my $Removed = join "\n", grep /^>/, @Diffs;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000179 $Added =~ s/^< //gm;
180 $Removed =~ s/^> //gm;
Chris Lattner2f8cb572003-01-20 18:05:27 +0000181 return ($Added, $Removed);
182}
183
Chris Lattner196a14a2003-08-19 15:08:34 +0000184# FormatTime - Convert a time from 1m23.45 into 83.45
185sub FormatTime {
186 my $Time = shift;
187 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
188 $Time = sprintf("%7.4f", $1*60.0+$2);
189 }
190 return $Time;
191}
192
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000193sub GetRegexNum {
194 my ($Regex, $Num, $Regex2, $File) = @_;
195 my @Items = split "\n", `grep '$Regex' $File`;
196 return GetRegex $Regex2, $Items[$Num];
197}
198
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000199sub GetDejagnuTestResults { # (filename, log)
200 my ($filename, $DejagnuLog) = @_;
201 my @lines;
202 my $firstline;
203 $/ = "\n"; #Make sure we're going line at a time.
Chris Lattner453d0622005-03-10 16:26:50 +0000204
Chris Lattner8f457312005-03-17 16:07:45 +0000205 print "DEJAGNU TEST RESULTS:\n";
Chris Lattner453d0622005-03-10 16:26:50 +0000206
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000207 if (open SRCHFILE, $filename) {
208 # Process test results
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000209 my $first_list = 1;
210 my $should_break = 1;
211 my $nocopy = 0;
212 my $readingsum = 0;
213 while ( <SRCHFILE> ) {
214 if ( length($_) > 1 ) {
215 chomp($_);
216 if ( m/^XPASS:/ || m/^FAIL:/ ) {
217 $nocopy = 0;
218 if ( $first_list ) {
Misha Brukmand3a54122005-03-10 16:32:33 +0000219 push(@lines, "<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n");
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000220 $first_list = 0;
221 $should_break = 1;
Misha Brukmand3a54122005-03-10 16:32:33 +0000222 push(@lines, "<b>$_</b><br/>\n");
Chris Lattner453d0622005-03-10 16:26:50 +0000223 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000224 } else {
Misha Brukmand3a54122005-03-10 16:32:33 +0000225 push(@lines, "</li><li><b>$_</b><br/>\n");
Chris Lattner453d0622005-03-10 16:26:50 +0000226 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000227 }
228 } elsif ( m/Summary/ ) {
Chris Lattner453d0622005-03-10 16:26:50 +0000229 if ( $first_list ) {
Misha Brukmand3a54122005-03-10 16:32:33 +0000230 push(@lines, "<b>PERFECT!</b>");
231 print " PERFECT!\n";
232 } else {
233 push(@lines, "</li></ol>\n");
234 }
235 push(@lines, "<h3>STATISTICS</h3><pre>\n");
Chris Lattner8f457312005-03-17 16:07:45 +0000236 print "\nDEJAGNU STATISTICS:\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000237 $should_break = 0;
238 $nocopy = 0;
239 $readingsum = 1;
240 } elsif ( $readingsum ) {
241 push(@lines,"$_\n");
Chris Lattner8f457312005-03-17 16:07:45 +0000242 print " $_\n";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000243 }
244 }
245 }
246 }
247 push(@lines, "</pre>\n");
248 close SRCHFILE;
249
Misha Brukmand3a54122005-03-10 16:32:33 +0000250 my $content = join("", @lines);
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000251 return "$content</li></ol>\n";
252}
253
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000254
255#####################################################################
256## MAIN PROGRAM
257#####################################################################
258
259my $Template = "";
260my $PlotScriptFilename = "";
261
262# Parse arguments...
263while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
264 shift;
265 last if /^--$/; # Stop processing arguments on --
266
267 # List command line options here...
268 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000269 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000270 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000271 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000272 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
273 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000274 if (/^-pedantic$/) {
275 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
276 next;
277 }
Chris Lattnerc82a6c82005-01-08 21:03:58 +0000278 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
Brian Gaeke047e6062004-08-05 19:54:59 +0000279 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
280 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
281 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
282 $CONFIGUREARGS .= " --disable-jit"; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000283 if (/^-verbose$/) { $VERBOSE = 1; next; }
284 if (/^-debug$/) { $DEBUG = 1; next; }
285 if (/^-nice$/) { $NICE = "nice "; next; }
286 if (/^-f2c$/) {
287 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
288 }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000289 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
Reid Spencerc5b67052004-06-23 14:07:12 +0000290 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000291 if (/^-gccpath/) {
292 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
293 }
Misha Brukmanf5f37f02005-05-26 16:28:55 +0000294 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
Reid Spencer1d914632004-06-23 07:45:46 +0000295 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
Tanya Lattner056ec062004-12-04 06:25:50 +0000296 if(/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000297
298 print "Unknown option: $_ : ignoring!\n";
299}
300
Reid Spencer932b69f2004-12-26 05:21:13 +0000301if ($ENV{'LLVMGCCDIR'}) {
302 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
303}
Brian Gaeke047e6062004-08-05 19:54:59 +0000304if ($CONFIGUREARGS !~ /--disable-jit/) {
305 $CONFIGUREARGS .= " --enable-jit";
306}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000307
308die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
309
310if (@ARGV == 3) {
311 $CVSRootDir = $ARGV[0];
312 $BuildDir = $ARGV[1];
313 $WebDir = $ARGV[2];
314}
315
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000316my $Prefix = "$WebDir/$DATE";
317
318#define the file names we'll use
319my $BuildLog = "$Prefix-Build-Log.txt";
320my $CVSLog = "$Prefix-CVS-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000321my $OldenTestsLog = "$Prefix-Olden-tests.txt";
322my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
323my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
324my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000325my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
326my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
327my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000328
329if ($VERBOSE) {
330 print "INITIALIZED\n";
331 print "CVS Root = $CVSRootDir\n";
332 print "BuildDir = $BuildDir\n";
333 print "WebDir = $WebDir\n";
334 print "Prefix = $Prefix\n";
335 print "CVSLog = $CVSLog\n";
336 print "BuildLog = $BuildLog\n";
337}
338
Brian Gaeke90c82b92004-09-28 16:04:00 +0000339if (! -d $WebDir) {
340 mkdir $WebDir, 0777;
341 warn "Warning: $WebDir did not exist; creating it.\n";
342}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000343
344#
345# Create the CVS repository directory
346#
347if (!$NOCHECKOUT) {
348 if (-d $BuildDir) {
349 if (!$NOREMOVE) {
350 system "rm -rf $BuildDir";
351 } else {
352 die "CVS checkout directory $BuildDir already exists!";
353 }
354 }
355 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
356}
357
358ChangeDir( $BuildDir, "CVS checkout directory" );
359
360
361#
362# Check out the llvm tree, saving CVS messages to the cvs log...
363#
Misha Brukmanf5f37f02005-05-26 16:28:55 +0000364my $CVSOPT = "";
365# Use compression if going over ssh.
366$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
367my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000368if (!$NOCHECKOUT) {
369 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
Misha Brukmanf5f37f02005-05-26 16:28:55 +0000370 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
371 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
Reid Spencer10ffe012004-09-05 07:58:10 +0000372 ChangeDir( $BuildDir , "CVS Checkout directory") ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000373}
374
375ChangeDir( "llvm" , "llvm source directory") ;
376
377if (!$NOCHECKOUT) {
378 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
Reid Spencer10ffe012004-09-05 07:58:10 +0000379 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000380}
381
Reid Spencerc5b67052004-06-23 14:07:12 +0000382if ( $Template eq "" ) {
383 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
384}
385die "Template file $Template is not readable" if ( ! -r "$Template" );
386
387if ( $PlotScriptFilename eq "" ) {
388 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
389}
390die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
391
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000392# Read in the HTML template file...
393if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
394my $TemplateContents = ReadFile $Template;
395
396#
397# Get some static statistics about the current state of CVS
398#
399my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
400my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
401my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
Reid Spencere993f462004-09-06 19:32:55 +0000402$LOC = `utils/countloc.sh`;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000403
404#
405# Build the entire tree, saving build messages to the build log
406#
407if (!$NOCHECKOUT) {
408 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
409 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
410
411 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
412 # Build the entire tree, capturing the output into $BuildLog
413 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
414}
415
416
417#
418# Get some statistics about the build...
419#
420my @Linked = split '\n', `grep Linking $BuildLog`;
421my $NumExecutables = scalar(grep(/executable/, @Linked));
422my $NumLibraries = scalar(grep(!/executable/, @Linked));
Chris Lattner0bb48282005-03-11 20:17:04 +0000423my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000424
425my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
426my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
427my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
428my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
429
430my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
431my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
432my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
433my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
434
Misha Brukman9a612752005-01-12 03:31:38 +0000435my $BuildError = 0, $BuildStatus = "OK";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000436if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
437 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
Misha Brukman9a612752005-01-12 03:31:38 +0000438 $BuildStatus = "<h3><font color='red'>error: compilation " .
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000439 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
Misha Brukman9a612752005-01-12 03:31:38 +0000440 $BuildError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000441 if ($VERBOSE) { print "BUILD ERROR\n"; }
442}
443
Tanya Lattner056ec062004-12-04 06:25:50 +0000444if ($BuildError) { $NODEJAGNU=1; }
Brian Gaeke22800982004-06-25 07:25:28 +0000445
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000446my $DejangnuTestResults; # String containing the results of the dejagnu
Tanya Lattner59a86552004-12-04 06:35:14 +0000447if(!$NODEJAGNU) {
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000448 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
449
450 my $dejagnu_output = "$DejagnuTestsLog";
451
452 #Run the feature and regression tests, results are put into testrun.sum
453 #Full log in testrun.log
Tanya Lattner056ec062004-12-04 06:25:50 +0000454 system "(time -p gmake $MAKEOPTS check) > $dejagnu_output 2>&1";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000455
456 #Extract time of dejagnu tests
457 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
458 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
459 $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
460 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
461
462 #Copy the testrun.log and testrun.sum to our webdir
463 CopyFile("test/testrun.log", $DejagnuLog);
464 CopyFile("test/testrun.sum", $DejagnuSum);
465
466 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
Tanya Lattnera2dfbf92004-12-17 20:58:34 +0000467
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000468} else {
469 $DejagnuTestResults = "Skipped by user choice.";
470 $DejagnuTime = "0.0";
471 $DejagnuWallTime = "0.0";
472}
473
Chris Lattner4d00fde2004-05-28 20:30:23 +0000474if ($DEBUG) {
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000475 print $DejagnuTestResults;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000476}
477
478if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerb3440302003-01-22 16:14:05 +0000479#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000480# Get warnings from the build
Chris Lattnerb3440302003-01-22 16:14:05 +0000481#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000482my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000483my @Warnings;
484my $CurDir = "";
485
486foreach $Warning (@Warn) {
487 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
488 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman8e9554a2003-08-14 15:26:28 +0000489 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner4c7e3032003-01-20 06:11:03 +0000490 $CurDir = $1;
491 }
492 } else {
493 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
494 }
495}
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000496my $WarningsFile = join "\n", @Warnings;
497my $WarningsList = AddPreTag $WarningsFile;
498$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000499
Chris Lattner2f8cb572003-01-20 18:05:27 +0000500# Emit the warnings file, so we can diff...
501WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
502my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000503
Chris Lattner9efd7f42003-10-18 19:31:39 +0000504# Output something to stdout if something has changed
505print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
506print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
507
Chris Lattnerbe197872003-10-19 16:54:00 +0000508$WarningsAdded = AddPreTag $WarningsAdded;
509$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattnerb3440302003-01-22 16:14:05 +0000510
511#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000512# Get some statistics about CVS commits over the current day...
Chris Lattnerb3440302003-01-22 16:14:05 +0000513#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000514if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000515@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
516#print join "\n", @CVSHistory; print "\n";
517
518# Extract some information from the CVS history... use a hash so no duplicate
519# stuff is stored.
Misha Brukman1b366892003-07-07 21:27:40 +0000520my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000521
Brian Gaeke43f38672004-06-10 07:44:28 +0000522my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000523
Chris Lattner4c7e3032003-01-20 06:11:03 +0000524# Loop over every record from the CVS history, filling in the hashes.
525foreach $File (@CVSHistory) {
526 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman8e9554a2003-08-14 15:26:28 +0000527 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000528 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattnerd56147d2004-01-12 16:55:30 +0000529 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
530 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman1b366892003-07-07 21:27:40 +0000531 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000532 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner4c7e3032003-01-20 06:11:03 +0000533 } else {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000534 print "UNMATCHABLE: $File\n";
Brian Gaeke43f38672004-06-10 07:44:28 +0000535 next;
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000536 }
537 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
538
539 if ($Filename =~ /^llvm/) {
540 if ($Type eq 'M') { # Modified
541 $ModifiedFiles{$Filename} = 1;
542 $UsersCommitted{$UID} = 1;
543 } elsif ($Type eq 'A') { # Added
544 $AddedFiles{$Filename} = 1;
545 $UsersCommitted{$UID} = 1;
546 } elsif ($Type eq 'R') { # Removed
547 $RemovedFiles{$Filename} = 1;
548 $UsersCommitted{$UID} = 1;
549 } else {
550 $UsersUpdated{$UID} = 1;
551 }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000552 }
553}
554
Chris Lattner5e5d2202005-03-16 17:09:53 +0000555my $UserCommitList = join "\n", sort keys %UsersCommitted;
556my $UserUpdateList = join "\n", sort keys %UsersUpdated;
Chris Lattnerc9cdadf2003-08-06 16:02:50 +0000557my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
558my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
559my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000560
Chris Lattnerec0e3742003-02-28 20:30:20 +0000561my $TestError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000562my $SingleSourceProgramsTable = "!";
563my $MultiSourceProgramsTable = "!";
564my $ExternalProgramsTable = "!";
Chris Lattnerb3440302003-01-22 16:14:05 +0000565
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000566
567sub TestDirectory {
568 my $SubDir = shift;
569
Reid Spencer10ffe012004-09-05 07:58:10 +0000570 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000571
572 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000573
574 # Run the programs tests... creating a report.nightly.html file
575 if (!$NOTEST) {
Chris Lattner20d13ea2004-06-03 03:29:39 +0000576 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000577 . "TEST=nightly > $ProgramTestLog 2>&1";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000578 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000579 system "gunzip ${ProgramTestLog}.gz";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000580 }
581
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000582 my $ProgramsTable;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000583 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
Chris Lattnerec0e3742003-02-28 20:30:20 +0000584 $TestError = 1;
Chris Lattner2e8be142003-05-10 21:40:10 +0000585 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000586 print "ERROR TESTING\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000587 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000588 $TestError = 1;
589 $ProgramsTable =
590 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000591 print "ERROR TESTING\n";
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000592 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000593 $TestError = 0;
594 $ProgramsTable = ReadFile "report.nightly.html";
595
596 #
597 # Create a list of the tests which were run...
598 #
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000599 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000600 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000601 }
602
603 # Compress the test output
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000604 system "gzip -f $ProgramTestLog";
605 ChangeDir( "../../..", "Programs Test Parent Directory" );
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000606 return $ProgramsTable;
607}
608
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000609# If we built the tree successfully, run the nightly programs tests...
Misha Brukman9a612752005-01-12 03:31:38 +0000610if (!$BuildError) {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000611 if ( $VERBOSE ) {
612 print "SingleSource TEST STAGE\n";
613 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000614 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattner4d00fde2004-05-28 20:30:23 +0000615 if ( $VERBOSE ) {
616 print "MultiSource TEST STAGE\n";
617 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000618 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Reid Spencer1d914632004-06-23 07:45:46 +0000619 if ( ! $NOEXTERNALS ) {
620 if ( $VERBOSE ) {
621 print "External TEST STAGE\n";
622 }
623 $ExternalProgramsTable = TestDirectory("External");
624 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000625 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Reid Spencer1d914632004-06-23 07:45:46 +0000626 } else {
Reid Spencerb8e825b2004-12-04 22:18:28 +0000627 $ExternalProgramsTable = '<tr><td>External TEST STAGE SKIPPED</td></tr>';
Reid Spencer1d914632004-06-23 07:45:46 +0000628 if ( $VERBOSE ) {
629 print "External TEST STAGE SKIPPED\n";
630 }
631 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
632 " | sort > $Prefix-Tests.txt";
633 }
Chris Lattner5d6c4382003-01-23 19:31:28 +0000634}
Chris Lattnerb3440302003-01-22 16:14:05 +0000635
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000636if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000637my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
638
Chris Lattnerec0e3742003-02-28 20:30:20 +0000639if ($TestError) {
640 $TestsAdded = "<b>error testing</b><br>";
641 $TestsRemoved = "<b>error testing</b><br>";
642 $TestsFixed = "<b>error testing</b><br>";
643 $TestsBroken = "<b>error testing</b><br>";
644} else {
645 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
646
647 my @RawTestsAddedArray = split '\n', $RTestsAdded;
648 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
649
650 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
651 @RawTestsRemovedArray;
652 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
653 @RawTestsAddedArray;
654
655 foreach $Test (keys %NewTests) {
656 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
657 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000658 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000659 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
660 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
661 } else {
662 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
663 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000664 }
665 }
Chris Lattnerec0e3742003-02-28 20:30:20 +0000666 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
667 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
668 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000669
Chris Lattner91480ff2003-10-21 15:47:31 +0000670 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
671 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
672 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
673 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnerbe197872003-10-19 16:54:00 +0000674
Chris Lattnerec0e3742003-02-28 20:30:20 +0000675 $TestsAdded = AddPreTag $TestsAdded;
676 $TestsRemoved = AddPreTag $TestsRemoved;
677 $TestsFixed = AddPreTag $TestsFixed;
678 $TestsBroken = AddPreTag $TestsBroken;
679}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000680
Chris Lattner9efd7f42003-10-18 19:31:39 +0000681
Chris Lattner196a14a2003-08-19 15:08:34 +0000682# If we built the tree successfully, runs of the Olden suite with
683# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
Misha Brukman9a612752005-01-12 03:31:38 +0000684if (!$BuildError) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000685 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
Chris Lattner08e24762003-08-19 18:35:03 +0000686 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattner196a14a2003-08-19 15:08:34 +0000687 $MachCodeSize) = ("","","","","","","");
Chris Lattner08e24762003-08-19 18:35:03 +0000688 if (!$NORUNNINGTESTS) {
Reid Spencer10ffe012004-09-05 07:58:10 +0000689 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000690 "Olden Test Directory");
Chris Lattner196a14a2003-08-19 15:08:34 +0000691
692 # Clean out previous results...
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000693 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
Chris Lattner196a14a2003-08-19 15:08:34 +0000694
Chris Lattner36dc5c72004-11-06 21:35:40 +0000695 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
696 # GET_STABLE_NUMBERS enabled!
Brian Gaeke85668542004-06-04 00:07:12 +0000697 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattner36dc5c72004-11-06 21:35:40 +0000698 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000699 system "cp report.nightly.raw.out $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000700 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000701 system "gunzip ${OldenTestsLog}.gz";
Chris Lattner196a14a2003-08-19 15:08:34 +0000702 }
703
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000704 # Now we know we have $OldenTestsLog as the raw output file. Split
Chris Lattner196a14a2003-08-19 15:08:34 +0000705 # it up into records and read the useful information.
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000706 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000707 shift @Records; # Delete the first (garbage) record
708
709 # Loop over all of the records, summarizing them into rows for the running
710 # totals file.
Chris Lattnerfed8a142004-12-14 22:42:59 +0000711 my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
Chris Lattner196a14a2003-08-19 15:08:34 +0000712 foreach $Rec (@Records) {
Chris Lattner36dc5c72004-11-06 21:35:40 +0000713 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
714 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
715 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
716 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
Chris Lattnerfed8a142004-12-14 22:42:59 +0000717 my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000718 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
719 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
720
721 $NATTime .= " " . FormatTime($rNATTime);
722 $CBETime .= " " . FormatTime($rCBETime);
723 $LLCTime .= " " . FormatTime($rLLCTime);
724 $JITTime .= " " . FormatTime($rJITTime);
725 $OptTime .= " $rOptTime";
Chris Lattner08e24762003-08-19 18:35:03 +0000726 $BytecodeSize .= " $rBytecodeSize";
727 $MachCodeSize .= " $rMachCodeSize";
Chris Lattner196a14a2003-08-19 15:08:34 +0000728 }
729
730 # Now that we have all of the numbers we want, add them to the running totals
731 # files.
Chris Lattner08e24762003-08-19 18:35:03 +0000732 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattner196a14a2003-08-19 15:08:34 +0000733 AddRecord($CBETime, "running_Olden_cbe_time.txt");
734 AddRecord($LLCTime, "running_Olden_llc_time.txt");
735 AddRecord($JITTime, "running_Olden_jit_time.txt");
736 AddRecord($OptTime, "running_Olden_opt_time.txt");
737 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
738 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
Chris Lattner08e24762003-08-19 18:35:03 +0000739
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000740 system "gzip -f $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000741}
742
743
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000744#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000745# Get a list of the previous days that we can link to...
Chris Lattnerb3440302003-01-22 16:14:05 +0000746#
Chris Lattner2f8cb572003-01-20 18:05:27 +0000747my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000748
Brian Gaeke253231e2004-06-11 19:55:30 +0000749if ((scalar @PrevDays) > 20) {
750 splice @PrevDays, 20; # Trim down list to something reasonable...
751}
Chris Lattner4c7e3032003-01-20 06:11:03 +0000752
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000753# Format list for sidebar
754my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000755
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000756#
Brian Gaeke90c82b92004-09-28 16:04:00 +0000757# Start outputting files into the web directory
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000758#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000759ChangeDir( $WebDir, "Web Directory" );
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000760
Brian Gaeke90c82b92004-09-28 16:04:00 +0000761# Make sure we don't get errors running the nightly tester the first time
762# because of files that don't exist.
763Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
764 'running_loc.txt', 'running_Olden_machcode.txt',
765 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
766 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
767 'running_Olden_jit_time.txt');
768
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000769# Add information to the files which accumulate information for graphs...
770AddRecord($LOC, "running_loc.txt");
771AddRecord($BuildTime, "running_build_time.txt");
772
Chris Lattner4d00fde2004-05-28 20:30:23 +0000773if ( $VERBOSE ) {
774 print "GRAPH GENERATION STAGE\n";
775}
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000776#
777# Rebuild the graphs now...
778#
Chris Lattnerfe2597a2004-07-27 18:41:49 +0000779$GNUPLOT = "/usr/bin/gnuplot";
Brian Gaekeb3dab902003-10-11 05:34:00 +0000780$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000781system ("$GNUPLOT", $PlotScriptFilename);
Chris Lattnerb3440302003-01-22 16:14:05 +0000782
Chris Lattner4c7e3032003-01-20 06:11:03 +0000783#
784# Remove the cvs tree...
785#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000786system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000787
Chris Lattner5e5d2202005-03-16 17:09:53 +0000788print "\nUSERS WHO COMMITTED:\n " . (join "\n ", sort keys %UsersCommitted) . "\n"
789 if (scalar %UsersCommitted);
790
791print "\nADDED FILES:\n " . (join "\n ", sort keys %AddedFiles) . "\n"
792 if (scalar %AddedFiles);
793
794print "\nCHANGED FILES:\n " . (join "\n ", sort keys %ModifiedFiles) . "\n"
795 if (scalar %ModifiedFiles);
796
797print "\nREMOVED FILES:\n " . (join "\n ", sort keys %RemovedFiles) . "\n"
798 if (scalar %RemovedFiles);
799
Chris Lattnerb3440302003-01-22 16:14:05 +0000800#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000801# Print out information...
Chris Lattnerb3440302003-01-22 16:14:05 +0000802#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000803if ($VERBOSE) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000804 print "DateString: $DateString\n";
805 print "CVS Checkout: $CVSCheckoutTime seconds\n";
806 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000807 print "Build Time: $BuildTime seconds\n";
808 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
809
810 print "WARNINGS:\n $WarningsList\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000811 print "Previous Days =\n $PrevDaysList\n";
812}
813
Chris Lattnerb3440302003-01-22 16:14:05 +0000814
Chris Lattner2f8cb572003-01-20 18:05:27 +0000815#
816# Output the files...
817#
818
Chris Lattner4d00fde2004-05-28 20:30:23 +0000819if ( $VERBOSE ) {
820 print "OUTPUT STAGE\n";
821}
Chris Lattner2f8cb572003-01-20 18:05:27 +0000822# Main HTML file...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000823my $Output;
Chris Lattner004e19e2005-02-13 16:08:30 +0000824my $TestFinishTime = gmtime() . " GMT<br>" . localtime() . " (local)";
825
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000826my $TestPlatform = `uname -a`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000827eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000828WriteFile "$DATE.html", $Output;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000829system ( "ln -sf $DATE.html index.html" );
Chris Lattner4c7e3032003-01-20 06:11:03 +0000830
831# Change the index.html symlink...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000832
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000833# vim: sw=2 ai