blob: 9d94c10d0c6dcf9d2d8dc4d77c8bc27c51e50f28 [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)
Brian Gaekeb3dab902003-10-11 05:34:00 +000024# -parallel Run two parallel jobs with GNU Make.
Reid Spencerf6d02332004-06-11 07:06:22 +000025# -release Build an LLVM Release version
26# -pedantic Enable additional GCC warnings to detect possible errors.
Chris Lattnerbb0aca52003-12-19 03:47:31 +000027# -enable-linscan Enable linearscan tests
Brian Gaeke047e6062004-08-05 19:54:59 +000028# -disable-llc Disable LLC tests in the nightly tester.
29# -disable-jit Disable JIT tests in the nightly tester.
Chris Lattner4d00fde2004-05-28 20:30:23 +000030# -verbose Turn on some debug output
31# -debug Print information useful only to maintainers of this script.
Reid Spencercb6a3aa2004-06-22 15:38:37 +000032# -nice Checkout/Configure/Build with "nice" to reduce impact
33# on busy servers.
Misha Brukman2e9ac692004-11-08 03:28:27 +000034# -f2c Next argument specifies path to F2C utility
Reid Spencercb6a3aa2004-06-22 15:38:37 +000035# -gnuplotscript Next argument specifies gnuplot script to use
36# -templatefile Next argument specifies template file to use
Chris Lattner892cdb32004-07-27 08:29:06 +000037# -gccpath Path to gcc/g++ used to build LLVM
Chris Lattnerbb0aca52003-12-19 03:47:31 +000038#
Brian Gaekeb3dab902003-10-11 05:34:00 +000039# CVSROOT is the CVS repository from which the tree will be checked out,
40# specified either in the full :method:user@host:/dir syntax, or
41# just /dir if using a local repo.
42# BUILDDIR is the directory where sources for this test run will be checked out
43# AND objects for this test run will be built. This directory MUST NOT
44# exist before the script is run; it will be created by the cvs checkout
45# process and erased (unless -noremove is specified; see above.)
46# WEBDIR is the directory into which the test results web page will be written,
47# AND in which the "index.html" is assumed to be a symlink to the most recent
Brian Gaeke90c82b92004-09-28 16:04:00 +000048# copy of the results. This directory will be created if it does not exist.
Reid Spencercb6a3aa2004-06-22 15:38:37 +000049# LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
50# to. This is the same as you would have for a normal LLVM build.
Chris Lattner4c7e3032003-01-20 06:11:03 +000051#
52use POSIX qw(strftime);
53
Brian Gaekeb3dab902003-10-11 05:34:00 +000054my $HOME = $ENV{'HOME'};
55my $CVSRootDir = $ENV{'CVSROOT'};
Chris Lattner9d13efa2003-10-14 01:22:08 +000056 $CVSRootDir = "/home/vadve/shared/PublicCVS"
Chris Lattner4d00fde2004-05-28 20:30:23 +000057 unless $CVSRootDir;
58my $BuildDir = $ENV{'BUILDDIR'};
59 $BuildDir = "$HOME/buildtest"
60 unless $BuildDir;
61my $WebDir = $ENV{'WEBDIR'};
62 $WebDir = "$HOME/cvs/testresults-X86"
63 unless $WebDir;
Chris Lattner2f8cb572003-01-20 18:05:27 +000064
65# Calculate the date prefix...
66@TIME = localtime;
67my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
68my $DateString = strftime "%B %d, %Y", localtime;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000069my $TestStartTime = gmtime;
70
71# Command line argument settings...
72my $NOCHECKOUT = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000073my $NOREMOVE = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000074my $NOFEATURES = 0;
75my $NOREGRESSIONS = 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 = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000084my $NICE = "";
Chris Lattner2f8cb572003-01-20 18:05:27 +000085
Chris Lattnerb3440302003-01-22 16:14:05 +000086sub ReadFile {
87 if (open (FILE, $_[0])) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +000088 undef $/;
Chris Lattnerb3440302003-01-22 16:14:05 +000089 my $Ret = <FILE>;
90 close FILE;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000091 $/ = '\n';
Chris Lattnerb3440302003-01-22 16:14:05 +000092 return $Ret;
93 } else {
94 print "Could not open file '$_[0]' for reading!";
95 return "";
96 }
97}
98
Chris Lattner2f8cb572003-01-20 18:05:27 +000099sub WriteFile { # (filename, contents)
100 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
101 print FILE $_[1];
102 close FILE;
103}
104
105sub GetRegex { # (Regex with ()'s, value)
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000106 $_[1] =~ /$_[0]/m;
Chris Lattner08e24762003-08-19 18:35:03 +0000107 if (defined($1)) {
108 return $1;
109 }
Reid Spencera337f0c2004-06-23 06:36:34 +0000110 return "0";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000111}
112
Brian Gaeke90c82b92004-09-28 16:04:00 +0000113sub Touch {
114 my @files = @_;
115 my $now = time;
116 foreach my $file (@files) {
117 if (! -f $file) {
118 open (FILE, ">$file") or warn "Could not create new file $file";
119 close FILE;
120 }
121 utime $now, $now, $file;
122 }
123}
124
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000125sub AddRecord {
126 my ($Val, $Filename) = @_;
127 my @Records;
128 if (open FILE, "$WebDir/$Filename") {
129 @Records = grep !/$DATE/, split "\n", <FILE>;
130 close FILE;
131 }
132 push @Records, "$DATE: $Val";
133 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000134}
135
Chris Lattner2f8cb572003-01-20 18:05:27 +0000136sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
137 $_ = shift;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000138 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner2f8cb572003-01-20 18:05:27 +0000139}
140
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000141sub ChangeDir { # directory, logical name
142 my ($dir,$name) = @_;
143 chomp($dir);
144 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
145 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
146}
147
Chris Lattner2f8cb572003-01-20 18:05:27 +0000148sub GetDir {
149 my $Suffix = shift;
150 opendir DH, $WebDir;
151 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
152 closedir DH;
153 return @Result;
154}
155
156# DiffFiles - Diff the current version of the file against the last version of
157# the file, reporting things added and removed. This is used to report, for
158# example, added and removed warnings. This returns a pair (added, removed)
159#
160sub DiffFiles {
161 my $Suffix = shift;
162 my @Others = GetDir $Suffix;
163 if (@Others == 0) { # No other files? We added all entries...
164 return (`cat $WebDir/$DATE$Suffix`, "");
165 }
166 # Diff the files now...
167 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
168 my $Added = join "\n", grep /^</, @Diffs;
169 my $Removed = join "\n", grep /^>/, @Diffs;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000170 $Added =~ s/^< //gm;
171 $Removed =~ s/^> //gm;
Chris Lattner2f8cb572003-01-20 18:05:27 +0000172 return ($Added, $Removed);
173}
174
Chris Lattner196a14a2003-08-19 15:08:34 +0000175# FormatTime - Convert a time from 1m23.45 into 83.45
176sub FormatTime {
177 my $Time = shift;
178 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
179 $Time = sprintf("%7.4f", $1*60.0+$2);
180 }
181 return $Time;
182}
183
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000184sub GetRegexNum {
185 my ($Regex, $Num, $Regex2, $File) = @_;
186 my @Items = split "\n", `grep '$Regex' $File`;
187 return GetRegex $Regex2, $Items[$Num];
188}
189
Chris Lattner4d00fde2004-05-28 20:30:23 +0000190sub GetQMTestResults { # (filename)
191 my ($filename) = @_;
192 my @lines;
193 my $firstline;
194 $/ = "\n"; #Make sure we're going line at a time.
195 if (open SRCHFILE, $filename) {
Reid Spencer542e8592004-05-30 00:17:47 +0000196 # Skip stuff before ---TEST RESULTS
Chris Lattner4d00fde2004-05-28 20:30:23 +0000197 while ( <SRCHFILE> ) {
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000198 if ( m/^--- TEST RESULTS/ ) { last; }
Chris Lattner4d00fde2004-05-28 20:30:23 +0000199 }
Reid Spencer542e8592004-05-30 00:17:47 +0000200 # Process test results
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000201 push(@lines,"<h3>TEST RESULTS</h3><ol><li>\n");
202 my $first_list = 1;
203 my $should_break = 1;
Reid Spencerf5d0af32004-06-08 08:01:33 +0000204 my $nocopy = 0;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000205 while ( <SRCHFILE> ) {
206 if ( length($_) > 1 ) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000207 chomp($_);
208 if ( ! m/: PASS[ ]*$/ &&
209 ! m/^ qmtest.target:/ &&
210 ! m/^ local/ &&
211 ! m/^gmake:/ ) {
212 if ( m/: XFAIL/ ) {
213 $nocopy = 1;
214 } elsif ( m/: XPASS/ || m/: FAIL/ ) {
215 $nocopy = 0;
216 if ( $first_list ) {
217 $first_list = 0;
218 $should_break = 1;
219 push(@lines,"<b>$_</b><br/>\n");
220 } else {
221 push(@lines,"</li><li><b>$_</b><br/>\n");
222 }
223 } elsif ( m/^--- STATISTICS/ ) {
224 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
225 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
226 $should_break = 0;
227 $nocopy = 0;
228 } elsif ( m/^--- TESTS WITH/ ) {
229 $should_break = 1;
230 $first_list = 1;
231 $nocopy = 0;
232 push(@lines,"</pre><h3>TESTS WITH UNEXPECTED RESULTS</h3><ol><li>\n");
233 } elsif ( m/^real / ) {
234 last;
235 } elsif (!$nocopy) {
236 if ( $should_break ) {
237 push(@lines,"$_<br/>\n");
238 } else {
239 push(@lines,"$_\n");
240 }
241 }
242 }
Chris Lattner4d00fde2004-05-28 20:30:23 +0000243 }
244 }
245 close SRCHFILE;
246 }
247 my $content = join("",@lines);
Reid Spencerf5d0af32004-06-08 08:01:33 +0000248 return "$content</li></ol>\n";
249}
Chris Lattner4d00fde2004-05-28 20:30:23 +0000250
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000251
252#####################################################################
253## MAIN PROGRAM
254#####################################################################
255
256my $Template = "";
257my $PlotScriptFilename = "";
258
259# Parse arguments...
260while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
261 shift;
262 last if /^--$/; # Stop processing arguments on --
263
264 # List command line options here...
265 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000266 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000267 if (/^-nofeaturetests$/) { $NOFEATURES = 1; next; }
268 if (/^-noregressiontests$/){ $NOREGRESSIONS = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000269 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000270 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000271 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
272 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000273 if (/^-pedantic$/) {
274 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
275 next;
276 }
277 if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; }
Brian Gaeke047e6062004-08-05 19:54:59 +0000278 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
279 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
280 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
281 $CONFIGUREARGS .= " --disable-jit"; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000282 if (/^-verbose$/) { $VERBOSE = 1; next; }
283 if (/^-debug$/) { $DEBUG = 1; next; }
284 if (/^-nice$/) { $NICE = "nice "; next; }
285 if (/^-f2c$/) {
286 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
287 }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000288 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
Reid Spencerc5b67052004-06-23 14:07:12 +0000289 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000290 if (/^-gccpath/) {
291 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
292 }
Reid Spencer1d914632004-06-23 07:45:46 +0000293 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000294
295 print "Unknown option: $_ : ignoring!\n";
296}
297
298if ($ENV{'LLVMGCCDIR'}) {
299 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
300}
Brian Gaeke047e6062004-08-05 19:54:59 +0000301if ($CONFIGUREARGS !~ /--disable-jit/) {
302 $CONFIGUREARGS .= " --enable-jit";
303}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000304
305die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
306
307if (@ARGV == 3) {
308 $CVSRootDir = $ARGV[0];
309 $BuildDir = $ARGV[1];
310 $WebDir = $ARGV[2];
311}
312
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000313my $Prefix = "$WebDir/$DATE";
314
315#define the file names we'll use
316my $BuildLog = "$Prefix-Build-Log.txt";
317my $CVSLog = "$Prefix-CVS-Log.txt";
318my $FeatureTestsLog = "$Prefix-FeatureTests-Log.txt";
319my $RegressionTestsLog = "$Prefix-RegressionTests-Log.txt";
320my $OldenTestsLog = "$Prefix-Olden-tests.txt";
321my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
322my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
323my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
324
325if ($VERBOSE) {
326 print "INITIALIZED\n";
327 print "CVS Root = $CVSRootDir\n";
328 print "BuildDir = $BuildDir\n";
329 print "WebDir = $WebDir\n";
330 print "Prefix = $Prefix\n";
331 print "CVSLog = $CVSLog\n";
332 print "BuildLog = $BuildLog\n";
333}
334
Brian Gaeke90c82b92004-09-28 16:04:00 +0000335if (! -d $WebDir) {
336 mkdir $WebDir, 0777;
337 warn "Warning: $WebDir did not exist; creating it.\n";
338}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000339
340#
341# Create the CVS repository directory
342#
343if (!$NOCHECKOUT) {
344 if (-d $BuildDir) {
345 if (!$NOREMOVE) {
346 system "rm -rf $BuildDir";
347 } else {
348 die "CVS checkout directory $BuildDir already exists!";
349 }
350 }
351 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
352}
353
354ChangeDir( $BuildDir, "CVS checkout directory" );
355
356
357#
358# Check out the llvm tree, saving CVS messages to the cvs log...
359#
360$CVSOPT = "";
361$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
362if (!$NOCHECKOUT) {
363 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
Reid Spencer214c6d62004-09-05 20:57:22 +0000364 system "( time -p $NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm; cd llvm/projects ; " .
365 "$NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm-test ) > $CVSLog 2>&1";
Reid Spencer10ffe012004-09-05 07:58:10 +0000366 ChangeDir( $BuildDir , "CVS Checkout directory") ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000367}
368
369ChangeDir( "llvm" , "llvm source directory") ;
370
371if (!$NOCHECKOUT) {
372 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
Reid Spencer10ffe012004-09-05 07:58:10 +0000373 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000374}
375
Reid Spencerc5b67052004-06-23 14:07:12 +0000376if ( $Template eq "" ) {
377 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
378}
379die "Template file $Template is not readable" if ( ! -r "$Template" );
380
381if ( $PlotScriptFilename eq "" ) {
382 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
383}
384die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
385
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000386# Read in the HTML template file...
387if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
388my $TemplateContents = ReadFile $Template;
389
390#
391# Get some static statistics about the current state of CVS
392#
393my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
394my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
395my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
Reid Spencere993f462004-09-06 19:32:55 +0000396$LOC = `utils/countloc.sh`;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000397
398#
399# Build the entire tree, saving build messages to the build log
400#
401if (!$NOCHECKOUT) {
402 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
403 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
404
405 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
406 # Build the entire tree, capturing the output into $BuildLog
407 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
408}
409
410
411#
412# Get some statistics about the build...
413#
414my @Linked = split '\n', `grep Linking $BuildLog`;
415my $NumExecutables = scalar(grep(/executable/, @Linked));
416my $NumLibraries = scalar(grep(!/executable/, @Linked));
417my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0;
418
419my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
420my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
421my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
422my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
423
424my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
425my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
426my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
427my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
428
429my $BuildError = "";
430if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
431 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
432 $BuildError = "<h3><font color='red'>Build error: compilation " .
433 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
434 if ($VERBOSE) { print "BUILD ERROR\n"; }
435}
436
Brian Gaeke22800982004-06-25 07:25:28 +0000437if ($BuildError) { $NOFEATURES = 1; $NOREGRESSIONS = 1; }
438
Chris Lattner4d00fde2004-05-28 20:30:23 +0000439# Get results of feature tests.
440my $FeatureTestResults; # String containing the results of the feature tests
441my $FeatureTime; # System+CPU Time for feature tests
442my $FeatureWallTime; # Wall Clock Time for feature tests
443if (!$NOFEATURES) {
444 if ( $VERBOSE ) { print "FEATURE TEST STAGE\n"; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000445 my $feature_output = "$FeatureTestsLog";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000446
447 # Run the feature tests so we can summarize the results
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000448 system "(time -p gmake $MAKEOPTS -C test Feature.t) > $feature_output 2>&1";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000449
450 # Extract test results
451 $FeatureTestResults = GetQMTestResults("$feature_output");
452
453 # Extract time of feature tests
454 my $FeatureTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$feature_output";
455 my $FeatureTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$feature_output";
456 $FeatureTime = $FeatureTimeU+$FeatureTimeS; # FeatureTime = User+System
457 $FeatureWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$feature_output";
458 # Run the regression tests so we can summarize the results
459} else {
460 $FeatureTestResults = "Skipped by user choice.";
461 $FeatureTime = "0.0";
462 $FeatureWallTime = "0.0";
463}
464
465if (!$NOREGRESSIONS) {
466 if ( $VERBOSE ) { print "REGRESSION TEST STAGE\n"; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000467 my $regression_output = "$RegressionTestsLog";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000468
469 # Run the regression tests so we can summarize the results
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000470 system "(time -p gmake $MAKEOPTS -C test Regression.t) > $regression_output 2>&1";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000471
472 # Extract test results
473 $RegressionTestResults = GetQMTestResults("$regression_output");
474
475 # Extract time of regressions tests
476 my $RegressionTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$regression_output";
477 my $RegressionTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$regression_output";
478 $RegressionTime = $RegressionTimeU+$RegressionTimeS; # RegressionTime = User+System
479 $RegressionWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$regression_output";
480} else {
481 $RegressionTestResults = "Skipped by user choice.";
482 $RegressionTime = "0.0";
483 $RegressionWallTime = "0.0";
484}
485
486if ($DEBUG) {
487 print $FeatureTestResults;
488 print $RegressionTestResults;
489}
490
491if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerb3440302003-01-22 16:14:05 +0000492#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000493# Get warnings from the build
Chris Lattnerb3440302003-01-22 16:14:05 +0000494#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000495my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000496my @Warnings;
497my $CurDir = "";
498
499foreach $Warning (@Warn) {
500 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
501 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman8e9554a2003-08-14 15:26:28 +0000502 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner4c7e3032003-01-20 06:11:03 +0000503 $CurDir = $1;
504 }
505 } else {
506 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
507 }
508}
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000509my $WarningsFile = join "\n", @Warnings;
510my $WarningsList = AddPreTag $WarningsFile;
511$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000512
Chris Lattner2f8cb572003-01-20 18:05:27 +0000513# Emit the warnings file, so we can diff...
514WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
515my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000516
Chris Lattner9efd7f42003-10-18 19:31:39 +0000517# Output something to stdout if something has changed
518print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
519print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
520
Chris Lattnerbe197872003-10-19 16:54:00 +0000521$WarningsAdded = AddPreTag $WarningsAdded;
522$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattnerb3440302003-01-22 16:14:05 +0000523
524#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000525# Get some statistics about CVS commits over the current day...
Chris Lattnerb3440302003-01-22 16:14:05 +0000526#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000527if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000528@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
529#print join "\n", @CVSHistory; print "\n";
530
531# Extract some information from the CVS history... use a hash so no duplicate
532# stuff is stored.
Misha Brukman1b366892003-07-07 21:27:40 +0000533my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000534
Brian Gaeke43f38672004-06-10 07:44:28 +0000535my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000536
Chris Lattner4c7e3032003-01-20 06:11:03 +0000537# Loop over every record from the CVS history, filling in the hashes.
538foreach $File (@CVSHistory) {
539 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman8e9554a2003-08-14 15:26:28 +0000540 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000541 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattnerd56147d2004-01-12 16:55:30 +0000542 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
543 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman1b366892003-07-07 21:27:40 +0000544 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000545 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner4c7e3032003-01-20 06:11:03 +0000546 } else {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000547 print "UNMATCHABLE: $File\n";
Brian Gaeke43f38672004-06-10 07:44:28 +0000548 next;
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000549 }
550 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
551
552 if ($Filename =~ /^llvm/) {
553 if ($Type eq 'M') { # Modified
554 $ModifiedFiles{$Filename} = 1;
555 $UsersCommitted{$UID} = 1;
556 } elsif ($Type eq 'A') { # Added
557 $AddedFiles{$Filename} = 1;
558 $UsersCommitted{$UID} = 1;
559 } elsif ($Type eq 'R') { # Removed
560 $RemovedFiles{$Filename} = 1;
561 $UsersCommitted{$UID} = 1;
562 } else {
563 $UsersUpdated{$UID} = 1;
564 }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000565 }
566}
567
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000568my $UserCommitList = join "\n", keys %UsersCommitted;
569my $UserUpdateList = join "\n", keys %UsersUpdated;
Chris Lattnerc9cdadf2003-08-06 16:02:50 +0000570my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
571my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
572my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000573
Chris Lattnerec0e3742003-02-28 20:30:20 +0000574my $TestError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000575my $SingleSourceProgramsTable = "!";
576my $MultiSourceProgramsTable = "!";
577my $ExternalProgramsTable = "!";
Chris Lattnerb3440302003-01-22 16:14:05 +0000578
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000579
580sub TestDirectory {
581 my $SubDir = shift;
582
Reid Spencer10ffe012004-09-05 07:58:10 +0000583 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000584
585 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000586
587 # Run the programs tests... creating a report.nightly.html file
588 if (!$NOTEST) {
Chris Lattner20d13ea2004-06-03 03:29:39 +0000589 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000590 . "TEST=nightly > $ProgramTestLog 2>&1";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000591 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000592 system "gunzip ${ProgramTestLog}.gz";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000593 }
594
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000595 my $ProgramsTable;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000596 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
Chris Lattnerec0e3742003-02-28 20:30:20 +0000597 $TestError = 1;
Chris Lattner2e8be142003-05-10 21:40:10 +0000598 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000599 print "ERROR TESTING\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000600 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000601 $TestError = 1;
602 $ProgramsTable =
603 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000604 print "ERROR TESTING\n";
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000605 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000606 $TestError = 0;
607 $ProgramsTable = ReadFile "report.nightly.html";
608
609 #
610 # Create a list of the tests which were run...
611 #
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000612 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000613 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000614 }
615
616 # Compress the test output
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000617 system "gzip -f $ProgramTestLog";
618 ChangeDir( "../../..", "Programs Test Parent Directory" );
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000619 return $ProgramsTable;
620}
621
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000622# If we built the tree successfully, run the nightly programs tests...
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000623if ($BuildError eq "") {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000624 if ( $VERBOSE ) {
625 print "SingleSource TEST STAGE\n";
626 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000627 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattner4d00fde2004-05-28 20:30:23 +0000628 if ( $VERBOSE ) {
629 print "MultiSource TEST STAGE\n";
630 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000631 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Reid Spencer1d914632004-06-23 07:45:46 +0000632 if ( ! $NOEXTERNALS ) {
633 if ( $VERBOSE ) {
634 print "External TEST STAGE\n";
635 }
636 $ExternalProgramsTable = TestDirectory("External");
637 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000638 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Reid Spencer1d914632004-06-23 07:45:46 +0000639 } else {
640 if ( $VERBOSE ) {
641 print "External TEST STAGE SKIPPED\n";
642 }
643 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
644 " | sort > $Prefix-Tests.txt";
645 }
Chris Lattner5d6c4382003-01-23 19:31:28 +0000646}
Chris Lattnerb3440302003-01-22 16:14:05 +0000647
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000648if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000649my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
650
Chris Lattnerec0e3742003-02-28 20:30:20 +0000651if ($TestError) {
652 $TestsAdded = "<b>error testing</b><br>";
653 $TestsRemoved = "<b>error testing</b><br>";
654 $TestsFixed = "<b>error testing</b><br>";
655 $TestsBroken = "<b>error testing</b><br>";
656} else {
657 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
658
659 my @RawTestsAddedArray = split '\n', $RTestsAdded;
660 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
661
662 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
663 @RawTestsRemovedArray;
664 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
665 @RawTestsAddedArray;
666
667 foreach $Test (keys %NewTests) {
668 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
669 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000670 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000671 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
672 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
673 } else {
674 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
675 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000676 }
677 }
Chris Lattnerec0e3742003-02-28 20:30:20 +0000678 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
679 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
680 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000681
Chris Lattner91480ff2003-10-21 15:47:31 +0000682 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
683 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
684 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
685 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnerbe197872003-10-19 16:54:00 +0000686
Chris Lattnerec0e3742003-02-28 20:30:20 +0000687 $TestsAdded = AddPreTag $TestsAdded;
688 $TestsRemoved = AddPreTag $TestsRemoved;
689 $TestsFixed = AddPreTag $TestsFixed;
690 $TestsBroken = AddPreTag $TestsBroken;
691}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000692
Chris Lattner9efd7f42003-10-18 19:31:39 +0000693
Chris Lattner196a14a2003-08-19 15:08:34 +0000694# If we built the tree successfully, runs of the Olden suite with
695# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
696if ($BuildError eq "") {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000697 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
Chris Lattner08e24762003-08-19 18:35:03 +0000698 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattner196a14a2003-08-19 15:08:34 +0000699 $MachCodeSize) = ("","","","","","","");
Chris Lattner08e24762003-08-19 18:35:03 +0000700 if (!$NORUNNINGTESTS) {
Reid Spencer10ffe012004-09-05 07:58:10 +0000701 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000702 "Olden Test Directory");
Chris Lattner196a14a2003-08-19 15:08:34 +0000703
704 # Clean out previous results...
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000705 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
Chris Lattner196a14a2003-08-19 15:08:34 +0000706
Chris Lattner36dc5c72004-11-06 21:35:40 +0000707 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
708 # GET_STABLE_NUMBERS enabled!
Brian Gaeke85668542004-06-04 00:07:12 +0000709 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattner36dc5c72004-11-06 21:35:40 +0000710 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000711 system "cp report.nightly.raw.out $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000712 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000713 system "gunzip ${OldenTestsLog}.gz";
Chris Lattner196a14a2003-08-19 15:08:34 +0000714 }
715
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000716 # Now we know we have $OldenTestsLog as the raw output file. Split
Chris Lattner196a14a2003-08-19 15:08:34 +0000717 # it up into records and read the useful information.
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000718 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000719 shift @Records; # Delete the first (garbage) record
720
721 # Loop over all of the records, summarizing them into rows for the running
722 # totals file.
723 my $WallTimeRE = "[A-Za-z0-9.: ]+\\(([0-9.]+) wall clock";
724 foreach $Rec (@Records) {
Chris Lattner36dc5c72004-11-06 21:35:40 +0000725 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
726 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
727 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
728 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000729 my $rOptTime = GetRegex "TEST-RESULT-compile: $WallTimeRE", $Rec;
730 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
731 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
732
733 $NATTime .= " " . FormatTime($rNATTime);
734 $CBETime .= " " . FormatTime($rCBETime);
735 $LLCTime .= " " . FormatTime($rLLCTime);
736 $JITTime .= " " . FormatTime($rJITTime);
737 $OptTime .= " $rOptTime";
Chris Lattner08e24762003-08-19 18:35:03 +0000738 $BytecodeSize .= " $rBytecodeSize";
739 $MachCodeSize .= " $rMachCodeSize";
Chris Lattner196a14a2003-08-19 15:08:34 +0000740 }
741
742 # Now that we have all of the numbers we want, add them to the running totals
743 # files.
Chris Lattner08e24762003-08-19 18:35:03 +0000744 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattner196a14a2003-08-19 15:08:34 +0000745 AddRecord($CBETime, "running_Olden_cbe_time.txt");
746 AddRecord($LLCTime, "running_Olden_llc_time.txt");
747 AddRecord($JITTime, "running_Olden_jit_time.txt");
748 AddRecord($OptTime, "running_Olden_opt_time.txt");
749 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
750 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
Chris Lattner08e24762003-08-19 18:35:03 +0000751
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000752 system "gzip -f $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000753}
754
755
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000756#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000757# Get a list of the previous days that we can link to...
Chris Lattnerb3440302003-01-22 16:14:05 +0000758#
Chris Lattner2f8cb572003-01-20 18:05:27 +0000759my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000760
Brian Gaeke253231e2004-06-11 19:55:30 +0000761if ((scalar @PrevDays) > 20) {
762 splice @PrevDays, 20; # Trim down list to something reasonable...
763}
Chris Lattner4c7e3032003-01-20 06:11:03 +0000764
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000765# Format list for sidebar
766my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000767
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000768#
Brian Gaeke90c82b92004-09-28 16:04:00 +0000769# Start outputting files into the web directory
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000770#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000771ChangeDir( $WebDir, "Web Directory" );
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000772
Brian Gaeke90c82b92004-09-28 16:04:00 +0000773# Make sure we don't get errors running the nightly tester the first time
774# because of files that don't exist.
775Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
776 'running_loc.txt', 'running_Olden_machcode.txt',
777 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
778 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
779 'running_Olden_jit_time.txt');
780
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000781# Add information to the files which accumulate information for graphs...
782AddRecord($LOC, "running_loc.txt");
783AddRecord($BuildTime, "running_build_time.txt");
784
Chris Lattner4d00fde2004-05-28 20:30:23 +0000785if ( $VERBOSE ) {
786 print "GRAPH GENERATION STAGE\n";
787}
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000788#
789# Rebuild the graphs now...
790#
Chris Lattnerfe2597a2004-07-27 18:41:49 +0000791$GNUPLOT = "/usr/bin/gnuplot";
Brian Gaekeb3dab902003-10-11 05:34:00 +0000792$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000793system ("$GNUPLOT", $PlotScriptFilename);
Chris Lattnerb3440302003-01-22 16:14:05 +0000794
Chris Lattner4c7e3032003-01-20 06:11:03 +0000795#
796# Remove the cvs tree...
797#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000798system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000799
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";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000808 print "Feature Test Time: $FeatureTime seconds\n";
809 print "Regression Test Time: $RegressionTime seconds\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000810 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
811
812 print "WARNINGS:\n $WarningsList\n";
813
Chris Lattner4c7e3032003-01-20 06:11:03 +0000814 print "Users committed: $UserCommitList\n";
815 print "Added Files: \n $AddedFilesList\n";
816 print "Modified Files: \n $ModifiedFilesList\n";
817 print "Removed Files: \n $RemovedFilesList\n";
818
819 print "Previous Days =\n $PrevDaysList\n";
820}
821
Chris Lattnerb3440302003-01-22 16:14:05 +0000822
Chris Lattner2f8cb572003-01-20 18:05:27 +0000823#
824# Output the files...
825#
826
Chris Lattner4d00fde2004-05-28 20:30:23 +0000827if ( $VERBOSE ) {
828 print "OUTPUT STAGE\n";
829}
Chris Lattner2f8cb572003-01-20 18:05:27 +0000830# Main HTML file...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000831my $Output;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000832my $TestFinishTime = gmtime;
833my $TestPlatform = `uname -a`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000834eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000835WriteFile "$DATE.html", $Output;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000836system ( "ln -sf $DATE.html index.html" );
Chris Lattner4c7e3032003-01-20 06:11:03 +0000837
838# Change the index.html symlink...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000839
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000840# vim: sw=2 ai