blob: 67c96def3ac414a9a9a535855c2b8068ea41a04c [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 Spencer51e615f2004-12-06 20:14:45 +000026# -enable-linscan Enable linearscan tests
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
Chris Lattnerbb0aca52003-12-19 03:47:31 +000037#
Brian Gaekeb3dab902003-10-11 05:34:00 +000038# CVSROOT is the CVS repository from which the tree will be checked out,
39# specified either in the full :method:user@host:/dir syntax, or
40# just /dir if using a local repo.
41# BUILDDIR is the directory where sources for this test run will be checked out
42# AND objects for this test run will be built. This directory MUST NOT
43# exist before the script is run; it will be created by the cvs checkout
44# process and erased (unless -noremove is specified; see above.)
45# WEBDIR is the directory into which the test results web page will be written,
46# AND in which the "index.html" is assumed to be a symlink to the most recent
Brian Gaeke90c82b92004-09-28 16:04:00 +000047# copy of the results. This directory will be created if it does not exist.
Chris Lattner4c7e3032003-01-20 06:11:03 +000048#
49use POSIX qw(strftime);
Tanya Lattner5debe8c2004-11-21 00:02:40 +000050use File::Copy;
Chris Lattner4c7e3032003-01-20 06:11:03 +000051
Brian Gaekeb3dab902003-10-11 05:34:00 +000052my $HOME = $ENV{'HOME'};
53my $CVSRootDir = $ENV{'CVSROOT'};
Chris Lattner9d13efa2003-10-14 01:22:08 +000054 $CVSRootDir = "/home/vadve/shared/PublicCVS"
Chris Lattner4d00fde2004-05-28 20:30:23 +000055 unless $CVSRootDir;
56my $BuildDir = $ENV{'BUILDDIR'};
57 $BuildDir = "$HOME/buildtest"
58 unless $BuildDir;
59my $WebDir = $ENV{'WEBDIR'};
60 $WebDir = "$HOME/cvs/testresults-X86"
61 unless $WebDir;
Chris Lattner2f8cb572003-01-20 18:05:27 +000062
63# Calculate the date prefix...
64@TIME = localtime;
65my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
66my $DateString = strftime "%B %d, %Y", localtime;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000067my $TestStartTime = gmtime;
68
69# Command line argument settings...
70my $NOCHECKOUT = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000071my $NOREMOVE = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000072my $NOTEST = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000073my $NORUNNINGTESTS = 0;
Reid Spencer1d914632004-06-23 07:45:46 +000074my $NOEXTERNALS = 0;
Misha Brukman2e9ac692004-11-08 03:28:27 +000075my $MAKEOPTS = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000076my $PROGTESTOPTS = "";
Misha Brukman2e9ac692004-11-08 03:28:27 +000077my $VERBOSE = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000078my $DEBUG = 0;
Brian Gaeke047e6062004-08-05 19:54:59 +000079my $CONFIGUREARGS = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000080my $NICE = "";
Tanya Lattner056ec062004-12-04 06:25:50 +000081my $NODEJAGNU = 0;
Chris Lattner2f8cb572003-01-20 18:05:27 +000082
Chris Lattnerb3440302003-01-22 16:14:05 +000083sub ReadFile {
84 if (open (FILE, $_[0])) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +000085 undef $/;
Chris Lattnerb3440302003-01-22 16:14:05 +000086 my $Ret = <FILE>;
87 close FILE;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000088 $/ = '\n';
Chris Lattnerb3440302003-01-22 16:14:05 +000089 return $Ret;
90 } else {
91 print "Could not open file '$_[0]' for reading!";
92 return "";
93 }
94}
95
Chris Lattner2f8cb572003-01-20 18:05:27 +000096sub WriteFile { # (filename, contents)
97 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
98 print FILE $_[1];
99 close FILE;
100}
101
102sub GetRegex { # (Regex with ()'s, value)
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000103 $_[1] =~ /$_[0]/m;
Chris Lattner08e24762003-08-19 18:35:03 +0000104 if (defined($1)) {
105 return $1;
106 }
Reid Spencera337f0c2004-06-23 06:36:34 +0000107 return "0";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000108}
109
Brian Gaeke90c82b92004-09-28 16:04:00 +0000110sub Touch {
111 my @files = @_;
112 my $now = time;
113 foreach my $file (@files) {
114 if (! -f $file) {
115 open (FILE, ">$file") or warn "Could not create new file $file";
116 close FILE;
117 }
118 utime $now, $now, $file;
119 }
120}
121
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000122sub AddRecord {
123 my ($Val, $Filename) = @_;
124 my @Records;
125 if (open FILE, "$WebDir/$Filename") {
126 @Records = grep !/$DATE/, split "\n", <FILE>;
127 close FILE;
128 }
129 push @Records, "$DATE: $Val";
130 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000131}
132
Chris Lattner2f8cb572003-01-20 18:05:27 +0000133sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
134 $_ = shift;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000135 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner2f8cb572003-01-20 18:05:27 +0000136}
137
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000138sub ChangeDir { # directory, logical name
139 my ($dir,$name) = @_;
140 chomp($dir);
141 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
142 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
143}
144
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000145sub CopyFile { #filename, newfile
146 my ($file, $newfile) = @_;
147 chomp($file);
148 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
149 copy($file, $newfile);
150}
151
Chris Lattner2f8cb572003-01-20 18:05:27 +0000152sub GetDir {
153 my $Suffix = shift;
154 opendir DH, $WebDir;
155 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
156 closedir DH;
157 return @Result;
158}
159
160# DiffFiles - Diff the current version of the file against the last version of
161# the file, reporting things added and removed. This is used to report, for
162# example, added and removed warnings. This returns a pair (added, removed)
163#
164sub DiffFiles {
165 my $Suffix = shift;
166 my @Others = GetDir $Suffix;
167 if (@Others == 0) { # No other files? We added all entries...
168 return (`cat $WebDir/$DATE$Suffix`, "");
169 }
170 # Diff the files now...
171 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
172 my $Added = join "\n", grep /^</, @Diffs;
173 my $Removed = join "\n", grep /^>/, @Diffs;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000174 $Added =~ s/^< //gm;
175 $Removed =~ s/^> //gm;
Chris Lattner2f8cb572003-01-20 18:05:27 +0000176 return ($Added, $Removed);
177}
178
Chris Lattner196a14a2003-08-19 15:08:34 +0000179# FormatTime - Convert a time from 1m23.45 into 83.45
180sub FormatTime {
181 my $Time = shift;
182 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
183 $Time = sprintf("%7.4f", $1*60.0+$2);
184 }
185 return $Time;
186}
187
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000188sub GetRegexNum {
189 my ($Regex, $Num, $Regex2, $File) = @_;
190 my @Items = split "\n", `grep '$Regex' $File`;
191 return GetRegex $Regex2, $Items[$Num];
192}
193
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000194sub GetDejagnuTestResults { # (filename, log)
195 my ($filename, $DejagnuLog) = @_;
196 my @lines;
197 my $firstline;
198 $/ = "\n"; #Make sure we're going line at a time.
199 if (open SRCHFILE, $filename) {
200 # Process test results
201 push(@lines,"<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n");
202 my $first_list = 1;
203 my $should_break = 1;
204 my $nocopy = 0;
205 my $readingsum = 0;
206 while ( <SRCHFILE> ) {
207 if ( length($_) > 1 ) {
208 chomp($_);
209 if ( m/^XPASS:/ || m/^FAIL:/ ) {
210 $nocopy = 0;
211 if ( $first_list ) {
212 $first_list = 0;
213 $should_break = 1;
214 push(@lines,"<b>$_</b><br/>\n");
215 } else {
216 push(@lines,"</li><li><b>$_</b><br/>\n");
217 }
218 } elsif ( m/Summary/ ) {
219 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
220 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
221 $should_break = 0;
222 $nocopy = 0;
223 $readingsum = 1;
224 } elsif ( $readingsum ) {
225 push(@lines,"$_\n");
226 }
227 }
228 }
229 }
230 push(@lines, "</pre>\n");
231 close SRCHFILE;
232
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000233 my $content = join("",@lines);
234 return "$content</li></ol>\n";
235}
236
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000237
238#####################################################################
239## MAIN PROGRAM
240#####################################################################
241
242my $Template = "";
243my $PlotScriptFilename = "";
244
245# Parse arguments...
246while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
247 shift;
248 last if /^--$/; # Stop processing arguments on --
249
250 # List command line options here...
251 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000252 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000253 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000254 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000255 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
256 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000257 if (/^-pedantic$/) {
258 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
259 next;
260 }
Reid Spencer51e615f2004-12-06 20:14:45 +0000261 if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; }
Brian Gaeke047e6062004-08-05 19:54:59 +0000262 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
263 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
264 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
265 $CONFIGUREARGS .= " --disable-jit"; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000266 if (/^-verbose$/) { $VERBOSE = 1; next; }
267 if (/^-debug$/) { $DEBUG = 1; next; }
268 if (/^-nice$/) { $NICE = "nice "; next; }
269 if (/^-f2c$/) {
270 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
271 }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000272 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
Reid Spencerc5b67052004-06-23 14:07:12 +0000273 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
Misha Brukman2e9ac692004-11-08 03:28:27 +0000274 if (/^-gccpath/) {
275 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
276 }
Reid Spencer1d914632004-06-23 07:45:46 +0000277 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
Tanya Lattner056ec062004-12-04 06:25:50 +0000278 if(/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000279
280 print "Unknown option: $_ : ignoring!\n";
281}
282
Brian Gaeke047e6062004-08-05 19:54:59 +0000283if ($CONFIGUREARGS !~ /--disable-jit/) {
284 $CONFIGUREARGS .= " --enable-jit";
285}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000286
287die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
288
289if (@ARGV == 3) {
290 $CVSRootDir = $ARGV[0];
291 $BuildDir = $ARGV[1];
292 $WebDir = $ARGV[2];
293}
294
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000295my $Prefix = "$WebDir/$DATE";
296
297#define the file names we'll use
298my $BuildLog = "$Prefix-Build-Log.txt";
299my $CVSLog = "$Prefix-CVS-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000300my $OldenTestsLog = "$Prefix-Olden-tests.txt";
301my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
302my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
303my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000304my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
305my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
306my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000307
308if ($VERBOSE) {
309 print "INITIALIZED\n";
310 print "CVS Root = $CVSRootDir\n";
311 print "BuildDir = $BuildDir\n";
312 print "WebDir = $WebDir\n";
313 print "Prefix = $Prefix\n";
314 print "CVSLog = $CVSLog\n";
315 print "BuildLog = $BuildLog\n";
316}
317
Brian Gaeke90c82b92004-09-28 16:04:00 +0000318if (! -d $WebDir) {
319 mkdir $WebDir, 0777;
320 warn "Warning: $WebDir did not exist; creating it.\n";
321}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000322
323#
324# Create the CVS repository directory
325#
326if (!$NOCHECKOUT) {
327 if (-d $BuildDir) {
328 if (!$NOREMOVE) {
329 system "rm -rf $BuildDir";
330 } else {
331 die "CVS checkout directory $BuildDir already exists!";
332 }
333 }
334 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
335}
336
337ChangeDir( $BuildDir, "CVS checkout directory" );
338
339
340#
341# Check out the llvm tree, saving CVS messages to the cvs log...
342#
343$CVSOPT = "";
344$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
345if (!$NOCHECKOUT) {
346 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
Reid Spencer214c6d62004-09-05 20:57:22 +0000347 system "( time -p $NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm; cd llvm/projects ; " .
348 "$NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm-test ) > $CVSLog 2>&1";
Reid Spencer10ffe012004-09-05 07:58:10 +0000349 ChangeDir( $BuildDir , "CVS Checkout directory") ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000350}
351
352ChangeDir( "llvm" , "llvm source directory") ;
353
354if (!$NOCHECKOUT) {
355 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
Reid Spencer10ffe012004-09-05 07:58:10 +0000356 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000357}
358
Reid Spencerc5b67052004-06-23 14:07:12 +0000359if ( $Template eq "" ) {
360 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
361}
362die "Template file $Template is not readable" if ( ! -r "$Template" );
363
364if ( $PlotScriptFilename eq "" ) {
365 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
366}
367die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
368
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000369# Read in the HTML template file...
370if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
371my $TemplateContents = ReadFile $Template;
372
373#
374# Get some static statistics about the current state of CVS
375#
376my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
377my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
378my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
Reid Spencere993f462004-09-06 19:32:55 +0000379$LOC = `utils/countloc.sh`;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000380
381#
382# Build the entire tree, saving build messages to the build log
383#
384if (!$NOCHECKOUT) {
385 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
386 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
387
388 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
389 # Build the entire tree, capturing the output into $BuildLog
390 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
391}
392
393
394#
395# Get some statistics about the build...
396#
397my @Linked = split '\n', `grep Linking $BuildLog`;
398my $NumExecutables = scalar(grep(/executable/, @Linked));
399my $NumLibraries = scalar(grep(!/executable/, @Linked));
400my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0;
401
402my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
403my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
404my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
405my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
406
407my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
408my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
409my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
410my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
411
412my $BuildError = "";
413if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
414 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
415 $BuildError = "<h3><font color='red'>Build error: compilation " .
416 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
417 if ($VERBOSE) { print "BUILD ERROR\n"; }
418}
419
Tanya Lattner056ec062004-12-04 06:25:50 +0000420if ($BuildError) { $NODEJAGNU=1; }
Brian Gaeke22800982004-06-25 07:25:28 +0000421
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000422my $DejangnuTestResults; # String containing the results of the dejagnu
Tanya Lattner59a86552004-12-04 06:35:14 +0000423if(!$NODEJAGNU) {
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000424 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
425
426 my $dejagnu_output = "$DejagnuTestsLog";
427
428 #Run the feature and regression tests, results are put into testrun.sum
429 #Full log in testrun.log
Tanya Lattner056ec062004-12-04 06:25:50 +0000430 system "(time -p gmake $MAKEOPTS check) > $dejagnu_output 2>&1";
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000431
432 #Extract time of dejagnu tests
433 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
434 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
435 $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
436 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
437
438 #Copy the testrun.log and testrun.sum to our webdir
439 CopyFile("test/testrun.log", $DejagnuLog);
440 CopyFile("test/testrun.sum", $DejagnuSum);
441
442 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
Tanya Lattnera2dfbf92004-12-17 20:58:34 +0000443 print $DejagnuTestResults;
444
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000445} else {
446 $DejagnuTestResults = "Skipped by user choice.";
447 $DejagnuTime = "0.0";
448 $DejagnuWallTime = "0.0";
449}
450
Chris Lattner4d00fde2004-05-28 20:30:23 +0000451if ($DEBUG) {
Tanya Lattner5debe8c2004-11-21 00:02:40 +0000452 print $DejagnuTestResults;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000453}
454
455if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerb3440302003-01-22 16:14:05 +0000456#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000457# Get warnings from the build
Chris Lattnerb3440302003-01-22 16:14:05 +0000458#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000459my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000460my @Warnings;
461my $CurDir = "";
462
463foreach $Warning (@Warn) {
464 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
465 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman8e9554a2003-08-14 15:26:28 +0000466 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner4c7e3032003-01-20 06:11:03 +0000467 $CurDir = $1;
468 }
469 } else {
470 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
471 }
472}
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000473my $WarningsFile = join "\n", @Warnings;
474my $WarningsList = AddPreTag $WarningsFile;
475$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000476
Chris Lattner2f8cb572003-01-20 18:05:27 +0000477# Emit the warnings file, so we can diff...
478WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
479my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000480
Chris Lattner9efd7f42003-10-18 19:31:39 +0000481# Output something to stdout if something has changed
482print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
483print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
484
Chris Lattnerbe197872003-10-19 16:54:00 +0000485$WarningsAdded = AddPreTag $WarningsAdded;
486$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattnerb3440302003-01-22 16:14:05 +0000487
488#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000489# Get some statistics about CVS commits over the current day...
Chris Lattnerb3440302003-01-22 16:14:05 +0000490#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000491if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000492@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
493#print join "\n", @CVSHistory; print "\n";
494
495# Extract some information from the CVS history... use a hash so no duplicate
496# stuff is stored.
Misha Brukman1b366892003-07-07 21:27:40 +0000497my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000498
Brian Gaeke43f38672004-06-10 07:44:28 +0000499my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000500
Chris Lattner4c7e3032003-01-20 06:11:03 +0000501# Loop over every record from the CVS history, filling in the hashes.
502foreach $File (@CVSHistory) {
503 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman8e9554a2003-08-14 15:26:28 +0000504 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000505 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattnerd56147d2004-01-12 16:55:30 +0000506 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
507 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman1b366892003-07-07 21:27:40 +0000508 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000509 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner4c7e3032003-01-20 06:11:03 +0000510 } else {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000511 print "UNMATCHABLE: $File\n";
Brian Gaeke43f38672004-06-10 07:44:28 +0000512 next;
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000513 }
514 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
515
516 if ($Filename =~ /^llvm/) {
517 if ($Type eq 'M') { # Modified
518 $ModifiedFiles{$Filename} = 1;
519 $UsersCommitted{$UID} = 1;
520 } elsif ($Type eq 'A') { # Added
521 $AddedFiles{$Filename} = 1;
522 $UsersCommitted{$UID} = 1;
523 } elsif ($Type eq 'R') { # Removed
524 $RemovedFiles{$Filename} = 1;
525 $UsersCommitted{$UID} = 1;
526 } else {
527 $UsersUpdated{$UID} = 1;
528 }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000529 }
530}
531
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000532my $UserCommitList = join "\n", keys %UsersCommitted;
533my $UserUpdateList = join "\n", keys %UsersUpdated;
Chris Lattnerc9cdadf2003-08-06 16:02:50 +0000534my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
535my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
536my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000537
Chris Lattnerec0e3742003-02-28 20:30:20 +0000538my $TestError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000539my $SingleSourceProgramsTable = "!";
540my $MultiSourceProgramsTable = "!";
541my $ExternalProgramsTable = "!";
Chris Lattnerb3440302003-01-22 16:14:05 +0000542
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000543
544sub TestDirectory {
545 my $SubDir = shift;
546
Reid Spencer10ffe012004-09-05 07:58:10 +0000547 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000548
549 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000550
551 # Run the programs tests... creating a report.nightly.html file
552 if (!$NOTEST) {
Chris Lattner20d13ea2004-06-03 03:29:39 +0000553 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000554 . "TEST=nightly > $ProgramTestLog 2>&1";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000555 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000556 system "gunzip ${ProgramTestLog}.gz";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000557 }
558
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000559 my $ProgramsTable;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000560 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
Chris Lattnerec0e3742003-02-28 20:30:20 +0000561 $TestError = 1;
Chris Lattner2e8be142003-05-10 21:40:10 +0000562 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000563 print "ERROR TESTING\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000564 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000565 $TestError = 1;
566 $ProgramsTable =
567 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000568 print "ERROR TESTING\n";
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000569 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000570 $TestError = 0;
571 $ProgramsTable = ReadFile "report.nightly.html";
572
573 #
574 # Create a list of the tests which were run...
575 #
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000576 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000577 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000578 }
579
580 # Compress the test output
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000581 system "gzip -f $ProgramTestLog";
582 ChangeDir( "../../..", "Programs Test Parent Directory" );
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000583 return $ProgramsTable;
584}
585
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000586# If we built the tree successfully, run the nightly programs tests...
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000587if ($BuildError eq "") {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000588 if ( $VERBOSE ) {
589 print "SingleSource TEST STAGE\n";
590 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000591 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattner4d00fde2004-05-28 20:30:23 +0000592 if ( $VERBOSE ) {
593 print "MultiSource TEST STAGE\n";
594 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000595 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Reid Spencer1d914632004-06-23 07:45:46 +0000596 if ( ! $NOEXTERNALS ) {
597 if ( $VERBOSE ) {
598 print "External TEST STAGE\n";
599 }
600 $ExternalProgramsTable = TestDirectory("External");
601 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000602 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Reid Spencer1d914632004-06-23 07:45:46 +0000603 } else {
Reid Spencerb8e825b2004-12-04 22:18:28 +0000604 $ExternalProgramsTable = '<tr><td>External TEST STAGE SKIPPED</td></tr>';
Reid Spencer1d914632004-06-23 07:45:46 +0000605 if ( $VERBOSE ) {
606 print "External TEST STAGE SKIPPED\n";
607 }
608 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
609 " | sort > $Prefix-Tests.txt";
610 }
Chris Lattner5d6c4382003-01-23 19:31:28 +0000611}
Chris Lattnerb3440302003-01-22 16:14:05 +0000612
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000613if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000614my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
615
Chris Lattnerec0e3742003-02-28 20:30:20 +0000616if ($TestError) {
617 $TestsAdded = "<b>error testing</b><br>";
618 $TestsRemoved = "<b>error testing</b><br>";
619 $TestsFixed = "<b>error testing</b><br>";
620 $TestsBroken = "<b>error testing</b><br>";
621} else {
622 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
623
624 my @RawTestsAddedArray = split '\n', $RTestsAdded;
625 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
626
627 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
628 @RawTestsRemovedArray;
629 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
630 @RawTestsAddedArray;
631
632 foreach $Test (keys %NewTests) {
633 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
634 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000635 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000636 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
637 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
638 } else {
639 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
640 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000641 }
642 }
Chris Lattnerec0e3742003-02-28 20:30:20 +0000643 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
644 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
645 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000646
Chris Lattner91480ff2003-10-21 15:47:31 +0000647 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
648 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
649 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
650 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnerbe197872003-10-19 16:54:00 +0000651
Chris Lattnerec0e3742003-02-28 20:30:20 +0000652 $TestsAdded = AddPreTag $TestsAdded;
653 $TestsRemoved = AddPreTag $TestsRemoved;
654 $TestsFixed = AddPreTag $TestsFixed;
655 $TestsBroken = AddPreTag $TestsBroken;
656}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000657
Chris Lattner9efd7f42003-10-18 19:31:39 +0000658
Chris Lattner196a14a2003-08-19 15:08:34 +0000659# If we built the tree successfully, runs of the Olden suite with
660# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
661if ($BuildError eq "") {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000662 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
Chris Lattner08e24762003-08-19 18:35:03 +0000663 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattner196a14a2003-08-19 15:08:34 +0000664 $MachCodeSize) = ("","","","","","","");
Chris Lattner08e24762003-08-19 18:35:03 +0000665 if (!$NORUNNINGTESTS) {
Reid Spencer10ffe012004-09-05 07:58:10 +0000666 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000667 "Olden Test Directory");
Chris Lattner196a14a2003-08-19 15:08:34 +0000668
669 # Clean out previous results...
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000670 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
Chris Lattner196a14a2003-08-19 15:08:34 +0000671
Chris Lattner36dc5c72004-11-06 21:35:40 +0000672 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
673 # GET_STABLE_NUMBERS enabled!
Brian Gaeke85668542004-06-04 00:07:12 +0000674 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattner36dc5c72004-11-06 21:35:40 +0000675 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000676 system "cp report.nightly.raw.out $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000677 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000678 system "gunzip ${OldenTestsLog}.gz";
Chris Lattner196a14a2003-08-19 15:08:34 +0000679 }
680
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000681 # Now we know we have $OldenTestsLog as the raw output file. Split
Chris Lattner196a14a2003-08-19 15:08:34 +0000682 # it up into records and read the useful information.
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000683 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000684 shift @Records; # Delete the first (garbage) record
685
686 # Loop over all of the records, summarizing them into rows for the running
687 # totals file.
Chris Lattnerfed8a142004-12-14 22:42:59 +0000688 my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
Chris Lattner196a14a2003-08-19 15:08:34 +0000689 foreach $Rec (@Records) {
Chris Lattner36dc5c72004-11-06 21:35:40 +0000690 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
691 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
692 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
693 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
Chris Lattnerfed8a142004-12-14 22:42:59 +0000694 my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000695 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
696 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
697
698 $NATTime .= " " . FormatTime($rNATTime);
699 $CBETime .= " " . FormatTime($rCBETime);
700 $LLCTime .= " " . FormatTime($rLLCTime);
701 $JITTime .= " " . FormatTime($rJITTime);
702 $OptTime .= " $rOptTime";
Chris Lattner08e24762003-08-19 18:35:03 +0000703 $BytecodeSize .= " $rBytecodeSize";
704 $MachCodeSize .= " $rMachCodeSize";
Chris Lattner196a14a2003-08-19 15:08:34 +0000705 }
706
707 # Now that we have all of the numbers we want, add them to the running totals
708 # files.
Chris Lattner08e24762003-08-19 18:35:03 +0000709 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattner196a14a2003-08-19 15:08:34 +0000710 AddRecord($CBETime, "running_Olden_cbe_time.txt");
711 AddRecord($LLCTime, "running_Olden_llc_time.txt");
712 AddRecord($JITTime, "running_Olden_jit_time.txt");
713 AddRecord($OptTime, "running_Olden_opt_time.txt");
714 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
715 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
Chris Lattner08e24762003-08-19 18:35:03 +0000716
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000717 system "gzip -f $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000718}
719
720
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000721#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000722# Get a list of the previous days that we can link to...
Chris Lattnerb3440302003-01-22 16:14:05 +0000723#
Chris Lattner2f8cb572003-01-20 18:05:27 +0000724my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000725
Brian Gaeke253231e2004-06-11 19:55:30 +0000726if ((scalar @PrevDays) > 20) {
727 splice @PrevDays, 20; # Trim down list to something reasonable...
728}
Chris Lattner4c7e3032003-01-20 06:11:03 +0000729
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000730# Format list for sidebar
731my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000732
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000733#
Brian Gaeke90c82b92004-09-28 16:04:00 +0000734# Start outputting files into the web directory
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000735#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000736ChangeDir( $WebDir, "Web Directory" );
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000737
Brian Gaeke90c82b92004-09-28 16:04:00 +0000738# Make sure we don't get errors running the nightly tester the first time
739# because of files that don't exist.
740Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
741 'running_loc.txt', 'running_Olden_machcode.txt',
742 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
743 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
744 'running_Olden_jit_time.txt');
745
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000746# Add information to the files which accumulate information for graphs...
747AddRecord($LOC, "running_loc.txt");
748AddRecord($BuildTime, "running_build_time.txt");
749
Chris Lattner4d00fde2004-05-28 20:30:23 +0000750if ( $VERBOSE ) {
751 print "GRAPH GENERATION STAGE\n";
752}
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000753#
754# Rebuild the graphs now...
755#
Chris Lattnerfe2597a2004-07-27 18:41:49 +0000756$GNUPLOT = "/usr/bin/gnuplot";
Brian Gaekeb3dab902003-10-11 05:34:00 +0000757$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000758system ("$GNUPLOT", $PlotScriptFilename);
Chris Lattnerb3440302003-01-22 16:14:05 +0000759
Chris Lattner4c7e3032003-01-20 06:11:03 +0000760#
761# Remove the cvs tree...
762#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000763system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000764
Chris Lattnerb3440302003-01-22 16:14:05 +0000765#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000766# Print out information...
Chris Lattnerb3440302003-01-22 16:14:05 +0000767#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000768if ($VERBOSE) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000769 print "DateString: $DateString\n";
770 print "CVS Checkout: $CVSCheckoutTime seconds\n";
771 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000772 print "Build Time: $BuildTime seconds\n";
773 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
774
775 print "WARNINGS:\n $WarningsList\n";
776
Chris Lattner4c7e3032003-01-20 06:11:03 +0000777 print "Users committed: $UserCommitList\n";
778 print "Added Files: \n $AddedFilesList\n";
779 print "Modified Files: \n $ModifiedFilesList\n";
780 print "Removed Files: \n $RemovedFilesList\n";
781
782 print "Previous Days =\n $PrevDaysList\n";
783}
784
Chris Lattnerb3440302003-01-22 16:14:05 +0000785
Chris Lattner2f8cb572003-01-20 18:05:27 +0000786#
787# Output the files...
788#
789
Chris Lattner4d00fde2004-05-28 20:30:23 +0000790if ( $VERBOSE ) {
791 print "OUTPUT STAGE\n";
792}
Chris Lattner2f8cb572003-01-20 18:05:27 +0000793# Main HTML file...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000794my $Output;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000795my $TestFinishTime = gmtime;
796my $TestPlatform = `uname -a`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000797eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000798WriteFile "$DATE.html", $Output;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000799system ( "ln -sf $DATE.html index.html" );
Chris Lattner4c7e3032003-01-20 06:11:03 +0000800
801# Change the index.html symlink...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000802
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000803# vim: sw=2 ai