blob: 03c8554ded5eeb61e3a02c99b90dd6990633ea0e [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.
34# -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.
Reid Spencercb6a3aa2004-06-22 15:38:37 +000048# LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
49# to. This is the same as you would have for a normal LLVM build.
Chris Lattner4c7e3032003-01-20 06:11:03 +000050#
51use POSIX qw(strftime);
52
Brian Gaekeb3dab902003-10-11 05:34:00 +000053my $HOME = $ENV{'HOME'};
54my $CVSRootDir = $ENV{'CVSROOT'};
Chris Lattner9d13efa2003-10-14 01:22:08 +000055 $CVSRootDir = "/home/vadve/shared/PublicCVS"
Chris Lattner4d00fde2004-05-28 20:30:23 +000056 unless $CVSRootDir;
57my $BuildDir = $ENV{'BUILDDIR'};
58 $BuildDir = "$HOME/buildtest"
59 unless $BuildDir;
60my $WebDir = $ENV{'WEBDIR'};
61 $WebDir = "$HOME/cvs/testresults-X86"
62 unless $WebDir;
Chris Lattner2f8cb572003-01-20 18:05:27 +000063
64# Calculate the date prefix...
65@TIME = localtime;
66my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
67my $DateString = strftime "%B %d, %Y", localtime;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000068my $TestStartTime = gmtime;
69
70# Command line argument settings...
71my $NOCHECKOUT = 0;
72my $NOREMOVE = 0;
73my $NOFEATURES = 0;
74my $NOREGRESSIONS = 0;
75my $NOTEST = 0;
76my $NORUNNINGTESTS = 0;
Reid Spencer1d914632004-06-23 07:45:46 +000077my $NOEXTERNALS = 0;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000078my $MAKEOPTS = "";
79my $PROGTESTOPTS = "";
80my $VERBOSE = 0;
81my $DEBUG = 0;
Brian Gaeke047e6062004-08-05 19:54:59 +000082my $CONFIGUREARGS = "";
Reid Spencercb6a3aa2004-06-22 15:38:37 +000083my $NICE = "";
Chris Lattner2f8cb572003-01-20 18:05:27 +000084
Chris Lattnerb3440302003-01-22 16:14:05 +000085sub ReadFile {
86 if (open (FILE, $_[0])) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +000087 undef $/;
Chris Lattnerb3440302003-01-22 16:14:05 +000088 my $Ret = <FILE>;
89 close FILE;
Reid Spencercb6a3aa2004-06-22 15:38:37 +000090 $/ = '\n';
Chris Lattnerb3440302003-01-22 16:14:05 +000091 return $Ret;
92 } else {
93 print "Could not open file '$_[0]' for reading!";
94 return "";
95 }
96}
97
Chris Lattner2f8cb572003-01-20 18:05:27 +000098sub WriteFile { # (filename, contents)
99 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
100 print FILE $_[1];
101 close FILE;
102}
103
104sub GetRegex { # (Regex with ()'s, value)
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000105 $_[1] =~ /$_[0]/m;
Chris Lattner08e24762003-08-19 18:35:03 +0000106 if (defined($1)) {
107 return $1;
108 }
Reid Spencera337f0c2004-06-23 06:36:34 +0000109 return "0";
Chris Lattner2f8cb572003-01-20 18:05:27 +0000110}
111
Brian Gaeke90c82b92004-09-28 16:04:00 +0000112sub Touch {
113 my @files = @_;
114 my $now = time;
115 foreach my $file (@files) {
116 if (! -f $file) {
117 open (FILE, ">$file") or warn "Could not create new file $file";
118 close FILE;
119 }
120 utime $now, $now, $file;
121 }
122}
123
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000124sub AddRecord {
125 my ($Val, $Filename) = @_;
126 my @Records;
127 if (open FILE, "$WebDir/$Filename") {
128 @Records = grep !/$DATE/, split "\n", <FILE>;
129 close FILE;
130 }
131 push @Records, "$DATE: $Val";
132 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000133}
134
Chris Lattner2f8cb572003-01-20 18:05:27 +0000135sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
136 $_ = shift;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000137 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
Chris Lattner2f8cb572003-01-20 18:05:27 +0000138}
139
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000140sub ChangeDir { # directory, logical name
141 my ($dir,$name) = @_;
142 chomp($dir);
143 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
144 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
145}
146
Chris Lattner2f8cb572003-01-20 18:05:27 +0000147sub GetDir {
148 my $Suffix = shift;
149 opendir DH, $WebDir;
150 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
151 closedir DH;
152 return @Result;
153}
154
155# DiffFiles - Diff the current version of the file against the last version of
156# the file, reporting things added and removed. This is used to report, for
157# example, added and removed warnings. This returns a pair (added, removed)
158#
159sub DiffFiles {
160 my $Suffix = shift;
161 my @Others = GetDir $Suffix;
162 if (@Others == 0) { # No other files? We added all entries...
163 return (`cat $WebDir/$DATE$Suffix`, "");
164 }
165 # Diff the files now...
166 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
167 my $Added = join "\n", grep /^</, @Diffs;
168 my $Removed = join "\n", grep /^>/, @Diffs;
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000169 $Added =~ s/^< //gm;
170 $Removed =~ s/^> //gm;
Chris Lattner2f8cb572003-01-20 18:05:27 +0000171 return ($Added, $Removed);
172}
173
Chris Lattner196a14a2003-08-19 15:08:34 +0000174# FormatTime - Convert a time from 1m23.45 into 83.45
175sub FormatTime {
176 my $Time = shift;
177 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
178 $Time = sprintf("%7.4f", $1*60.0+$2);
179 }
180 return $Time;
181}
182
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000183sub GetRegexNum {
184 my ($Regex, $Num, $Regex2, $File) = @_;
185 my @Items = split "\n", `grep '$Regex' $File`;
186 return GetRegex $Regex2, $Items[$Num];
187}
188
Chris Lattner4d00fde2004-05-28 20:30:23 +0000189sub GetQMTestResults { # (filename)
190 my ($filename) = @_;
191 my @lines;
192 my $firstline;
193 $/ = "\n"; #Make sure we're going line at a time.
194 if (open SRCHFILE, $filename) {
Reid Spencer542e8592004-05-30 00:17:47 +0000195 # Skip stuff before ---TEST RESULTS
Chris Lattner4d00fde2004-05-28 20:30:23 +0000196 while ( <SRCHFILE> ) {
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000197 if ( m/^--- TEST RESULTS/ ) { last; }
Chris Lattner4d00fde2004-05-28 20:30:23 +0000198 }
Reid Spencer542e8592004-05-30 00:17:47 +0000199 # Process test results
Reid Spenceraa0bfbe2004-05-31 20:59:55 +0000200 push(@lines,"<h3>TEST RESULTS</h3><ol><li>\n");
201 my $first_list = 1;
202 my $should_break = 1;
Reid Spencerf5d0af32004-06-08 08:01:33 +0000203 my $nocopy = 0;
Chris Lattner4d00fde2004-05-28 20:30:23 +0000204 while ( <SRCHFILE> ) {
205 if ( length($_) > 1 ) {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000206 chomp($_);
207 if ( ! m/: PASS[ ]*$/ &&
208 ! m/^ qmtest.target:/ &&
209 ! m/^ local/ &&
210 ! m/^gmake:/ ) {
211 if ( m/: XFAIL/ ) {
212 $nocopy = 1;
213 } elsif ( m/: XPASS/ || m/: FAIL/ ) {
214 $nocopy = 0;
215 if ( $first_list ) {
216 $first_list = 0;
217 $should_break = 1;
218 push(@lines,"<b>$_</b><br/>\n");
219 } else {
220 push(@lines,"</li><li><b>$_</b><br/>\n");
221 }
222 } elsif ( m/^--- STATISTICS/ ) {
223 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
224 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
225 $should_break = 0;
226 $nocopy = 0;
227 } elsif ( m/^--- TESTS WITH/ ) {
228 $should_break = 1;
229 $first_list = 1;
230 $nocopy = 0;
231 push(@lines,"</pre><h3>TESTS WITH UNEXPECTED RESULTS</h3><ol><li>\n");
232 } elsif ( m/^real / ) {
233 last;
234 } elsif (!$nocopy) {
235 if ( $should_break ) {
236 push(@lines,"$_<br/>\n");
237 } else {
238 push(@lines,"$_\n");
239 }
240 }
241 }
Chris Lattner4d00fde2004-05-28 20:30:23 +0000242 }
243 }
244 close SRCHFILE;
245 }
246 my $content = join("",@lines);
Reid Spencerf5d0af32004-06-08 08:01:33 +0000247 return "$content</li></ol>\n";
248}
Chris Lattner4d00fde2004-05-28 20:30:23 +0000249
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000250
251#####################################################################
252## MAIN PROGRAM
253#####################################################################
254
255my $Template = "";
256my $PlotScriptFilename = "";
257
258# Parse arguments...
259while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
260 shift;
261 last if /^--$/; # Stop processing arguments on --
262
263 # List command line options here...
264 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
265 if (/^-noremove$/) { $NOREMOVE = 1; next; }
266 if (/^-nofeaturetests$/) { $NOFEATURES = 1; next; }
267 if (/^-noregressiontests$/){ $NOREGRESSIONS = 1; next; }
268 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
269 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
270 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
271 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
272 if (/^-pedantic$/) {
273 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
274 next;
275 }
276 if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; }
Brian Gaeke047e6062004-08-05 19:54:59 +0000277 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
278 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
279 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
280 $CONFIGUREARGS .= " --disable-jit"; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000281 if (/^-verbose$/) { $VERBOSE = 1; next; }
282 if (/^-debug$/) { $DEBUG = 1; next; }
283 if (/^-nice$/) { $NICE = "nice "; next; }
284 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
Reid Spencerc5b67052004-06-23 14:07:12 +0000285 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
Chris Lattner892cdb32004-07-27 08:29:06 +0000286 if (/^-gccpath/) { $CONFIGUREARGS=" CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next; }
Reid Spencer1d914632004-06-23 07:45:46 +0000287 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000288
289 print "Unknown option: $_ : ignoring!\n";
290}
291
292if ($ENV{'LLVMGCCDIR'}) {
293 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
294}
Brian Gaeke047e6062004-08-05 19:54:59 +0000295if ($CONFIGUREARGS !~ /--disable-jit/) {
296 $CONFIGUREARGS .= " --enable-jit";
297}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000298
299die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
300
301if (@ARGV == 3) {
302 $CVSRootDir = $ARGV[0];
303 $BuildDir = $ARGV[1];
304 $WebDir = $ARGV[2];
305}
306
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000307my $Prefix = "$WebDir/$DATE";
308
309#define the file names we'll use
310my $BuildLog = "$Prefix-Build-Log.txt";
311my $CVSLog = "$Prefix-CVS-Log.txt";
312my $FeatureTestsLog = "$Prefix-FeatureTests-Log.txt";
313my $RegressionTestsLog = "$Prefix-RegressionTests-Log.txt";
314my $OldenTestsLog = "$Prefix-Olden-tests.txt";
315my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
316my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
317my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
318
319if ($VERBOSE) {
320 print "INITIALIZED\n";
321 print "CVS Root = $CVSRootDir\n";
322 print "BuildDir = $BuildDir\n";
323 print "WebDir = $WebDir\n";
324 print "Prefix = $Prefix\n";
325 print "CVSLog = $CVSLog\n";
326 print "BuildLog = $BuildLog\n";
327}
328
Brian Gaeke90c82b92004-09-28 16:04:00 +0000329if (! -d $WebDir) {
330 mkdir $WebDir, 0777;
331 warn "Warning: $WebDir did not exist; creating it.\n";
332}
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000333
334#
335# Create the CVS repository directory
336#
337if (!$NOCHECKOUT) {
338 if (-d $BuildDir) {
339 if (!$NOREMOVE) {
340 system "rm -rf $BuildDir";
341 } else {
342 die "CVS checkout directory $BuildDir already exists!";
343 }
344 }
345 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
346}
347
348ChangeDir( $BuildDir, "CVS checkout directory" );
349
350
351#
352# Check out the llvm tree, saving CVS messages to the cvs log...
353#
354$CVSOPT = "";
355$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
356if (!$NOCHECKOUT) {
357 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
Reid Spencer214c6d62004-09-05 20:57:22 +0000358 system "( time -p $NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm; cd llvm/projects ; " .
359 "$NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm-test ) > $CVSLog 2>&1";
Reid Spencer10ffe012004-09-05 07:58:10 +0000360 ChangeDir( $BuildDir , "CVS Checkout directory") ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000361}
362
363ChangeDir( "llvm" , "llvm source directory") ;
364
365if (!$NOCHECKOUT) {
366 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
Reid Spencer10ffe012004-09-05 07:58:10 +0000367 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000368}
369
Reid Spencerc5b67052004-06-23 14:07:12 +0000370if ( $Template eq "" ) {
371 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
372}
373die "Template file $Template is not readable" if ( ! -r "$Template" );
374
375if ( $PlotScriptFilename eq "" ) {
376 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
377}
378die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
379
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000380# Read in the HTML template file...
381if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
382my $TemplateContents = ReadFile $Template;
383
384#
385# Get some static statistics about the current state of CVS
386#
387my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
388my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
389my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
Reid Spencere993f462004-09-06 19:32:55 +0000390$LOC = `utils/countloc.sh`;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000391
392#
393# Build the entire tree, saving build messages to the build log
394#
395if (!$NOCHECKOUT) {
396 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
397 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
398
399 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
400 # Build the entire tree, capturing the output into $BuildLog
401 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
402}
403
404
405#
406# Get some statistics about the build...
407#
408my @Linked = split '\n', `grep Linking $BuildLog`;
409my $NumExecutables = scalar(grep(/executable/, @Linked));
410my $NumLibraries = scalar(grep(!/executable/, @Linked));
411my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0;
412
413my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
414my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
415my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
416my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
417
418my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
419my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
420my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
421my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
422
423my $BuildError = "";
424if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
425 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
426 $BuildError = "<h3><font color='red'>Build error: compilation " .
427 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
428 if ($VERBOSE) { print "BUILD ERROR\n"; }
429}
430
Brian Gaeke22800982004-06-25 07:25:28 +0000431if ($BuildError) { $NOFEATURES = 1; $NOREGRESSIONS = 1; }
432
Chris Lattner4d00fde2004-05-28 20:30:23 +0000433# Get results of feature tests.
434my $FeatureTestResults; # String containing the results of the feature tests
435my $FeatureTime; # System+CPU Time for feature tests
436my $FeatureWallTime; # Wall Clock Time for feature tests
437if (!$NOFEATURES) {
438 if ( $VERBOSE ) { print "FEATURE TEST STAGE\n"; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000439 my $feature_output = "$FeatureTestsLog";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000440
441 # Run the feature tests so we can summarize the results
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000442 system "(time -p gmake $MAKEOPTS -C test Feature.t) > $feature_output 2>&1";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000443
444 # Extract test results
445 $FeatureTestResults = GetQMTestResults("$feature_output");
446
447 # Extract time of feature tests
448 my $FeatureTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$feature_output";
449 my $FeatureTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$feature_output";
450 $FeatureTime = $FeatureTimeU+$FeatureTimeS; # FeatureTime = User+System
451 $FeatureWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$feature_output";
452 # Run the regression tests so we can summarize the results
453} else {
454 $FeatureTestResults = "Skipped by user choice.";
455 $FeatureTime = "0.0";
456 $FeatureWallTime = "0.0";
457}
458
459if (!$NOREGRESSIONS) {
460 if ( $VERBOSE ) { print "REGRESSION TEST STAGE\n"; }
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000461 my $regression_output = "$RegressionTestsLog";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000462
463 # Run the regression tests so we can summarize the results
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000464 system "(time -p gmake $MAKEOPTS -C test Regression.t) > $regression_output 2>&1";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000465
466 # Extract test results
467 $RegressionTestResults = GetQMTestResults("$regression_output");
468
469 # Extract time of regressions tests
470 my $RegressionTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$regression_output";
471 my $RegressionTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$regression_output";
472 $RegressionTime = $RegressionTimeU+$RegressionTimeS; # RegressionTime = User+System
473 $RegressionWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$regression_output";
474} else {
475 $RegressionTestResults = "Skipped by user choice.";
476 $RegressionTime = "0.0";
477 $RegressionWallTime = "0.0";
478}
479
480if ($DEBUG) {
481 print $FeatureTestResults;
482 print $RegressionTestResults;
483}
484
485if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerb3440302003-01-22 16:14:05 +0000486#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000487# Get warnings from the build
Chris Lattnerb3440302003-01-22 16:14:05 +0000488#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000489my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000490my @Warnings;
491my $CurDir = "";
492
493foreach $Warning (@Warn) {
494 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
495 $CurDir = $1; # Keep track of directory warning is in...
Misha Brukman8e9554a2003-08-14 15:26:28 +0000496 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
Chris Lattner4c7e3032003-01-20 06:11:03 +0000497 $CurDir = $1;
498 }
499 } else {
500 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
501 }
502}
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000503my $WarningsFile = join "\n", @Warnings;
504my $WarningsList = AddPreTag $WarningsFile;
505$WarningsFile =~ s/:[0-9]+:/::/g;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000506
Chris Lattner2f8cb572003-01-20 18:05:27 +0000507# Emit the warnings file, so we can diff...
508WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
509my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000510
Chris Lattner9efd7f42003-10-18 19:31:39 +0000511# Output something to stdout if something has changed
512print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
513print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
514
Chris Lattnerbe197872003-10-19 16:54:00 +0000515$WarningsAdded = AddPreTag $WarningsAdded;
516$WarningsRemoved = AddPreTag $WarningsRemoved;
Chris Lattnerb3440302003-01-22 16:14:05 +0000517
518#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000519# Get some statistics about CVS commits over the current day...
Chris Lattnerb3440302003-01-22 16:14:05 +0000520#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000521if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000522@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
523#print join "\n", @CVSHistory; print "\n";
524
525# Extract some information from the CVS history... use a hash so no duplicate
526# stuff is stored.
Misha Brukman1b366892003-07-07 21:27:40 +0000527my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000528
Brian Gaeke43f38672004-06-10 07:44:28 +0000529my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000530
Chris Lattner4c7e3032003-01-20 06:11:03 +0000531# Loop over every record from the CVS history, filling in the hashes.
532foreach $File (@CVSHistory) {
533 my ($Type, $Date, $UID, $Rev, $Filename);
Misha Brukman8e9554a2003-08-14 15:26:28 +0000534 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000535 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
Chris Lattnerd56147d2004-01-12 16:55:30 +0000536 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
537 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
Misha Brukman1b366892003-07-07 21:27:40 +0000538 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000539 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
Chris Lattner4c7e3032003-01-20 06:11:03 +0000540 } else {
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000541 print "UNMATCHABLE: $File\n";
Brian Gaeke43f38672004-06-10 07:44:28 +0000542 next;
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000543 }
544 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
545
546 if ($Filename =~ /^llvm/) {
547 if ($Type eq 'M') { # Modified
548 $ModifiedFiles{$Filename} = 1;
549 $UsersCommitted{$UID} = 1;
550 } elsif ($Type eq 'A') { # Added
551 $AddedFiles{$Filename} = 1;
552 $UsersCommitted{$UID} = 1;
553 } elsif ($Type eq 'R') { # Removed
554 $RemovedFiles{$Filename} = 1;
555 $UsersCommitted{$UID} = 1;
556 } else {
557 $UsersUpdated{$UID} = 1;
558 }
Chris Lattner4c7e3032003-01-20 06:11:03 +0000559 }
560}
561
Chris Lattner1cbc0a62003-01-20 19:18:44 +0000562my $UserCommitList = join "\n", keys %UsersCommitted;
563my $UserUpdateList = join "\n", keys %UsersUpdated;
Chris Lattnerc9cdadf2003-08-06 16:02:50 +0000564my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
565my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
566my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000567
Chris Lattnerec0e3742003-02-28 20:30:20 +0000568my $TestError = 1;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000569my $SingleSourceProgramsTable = "!";
570my $MultiSourceProgramsTable = "!";
571my $ExternalProgramsTable = "!";
Chris Lattnerb3440302003-01-22 16:14:05 +0000572
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000573
574sub TestDirectory {
575 my $SubDir = shift;
576
Reid Spencer10ffe012004-09-05 07:58:10 +0000577 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000578
579 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000580
581 # Run the programs tests... creating a report.nightly.html file
582 if (!$NOTEST) {
Chris Lattner20d13ea2004-06-03 03:29:39 +0000583 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000584 . "TEST=nightly > $ProgramTestLog 2>&1";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000585 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000586 system "gunzip ${ProgramTestLog}.gz";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000587 }
588
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000589 my $ProgramsTable;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000590 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
Chris Lattnerec0e3742003-02-28 20:30:20 +0000591 $TestError = 1;
Chris Lattner2e8be142003-05-10 21:40:10 +0000592 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000593 print "ERROR TESTING\n";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000594 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000595 $TestError = 1;
596 $ProgramsTable =
597 "<font color=white><h2>Makefile error running tests!</h2></font>";
Chris Lattnerbe197872003-10-19 16:54:00 +0000598 print "ERROR TESTING\n";
Chris Lattner6e51bfa2003-05-11 15:23:10 +0000599 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000600 $TestError = 0;
601 $ProgramsTable = ReadFile "report.nightly.html";
602
603 #
604 # Create a list of the tests which were run...
605 #
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000606 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000607 . "| sort > $Prefix-$SubDir-Tests.txt";
Chris Lattnerec0e3742003-02-28 20:30:20 +0000608 }
609
610 # Compress the test output
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000611 system "gzip -f $ProgramTestLog";
612 ChangeDir( "../../..", "Programs Test Parent Directory" );
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000613 return $ProgramsTable;
614}
615
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000616# If we built the tree successfully, run the nightly programs tests...
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000617if ($BuildError eq "") {
Chris Lattner4d00fde2004-05-28 20:30:23 +0000618 if ( $VERBOSE ) {
619 print "SingleSource TEST STAGE\n";
620 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000621 $SingleSourceProgramsTable = TestDirectory("SingleSource");
Chris Lattner4d00fde2004-05-28 20:30:23 +0000622 if ( $VERBOSE ) {
623 print "MultiSource TEST STAGE\n";
624 }
Chris Lattnerbf6a4dc2003-08-18 06:05:21 +0000625 $MultiSourceProgramsTable = TestDirectory("MultiSource");
Reid Spencer1d914632004-06-23 07:45:46 +0000626 if ( ! $NOEXTERNALS ) {
627 if ( $VERBOSE ) {
628 print "External TEST STAGE\n";
629 }
630 $ExternalProgramsTable = TestDirectory("External");
631 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
Chris Lattnereac3cdc2003-08-21 15:55:26 +0000632 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Reid Spencer1d914632004-06-23 07:45:46 +0000633 } else {
634 if ( $VERBOSE ) {
635 print "External TEST STAGE SKIPPED\n";
636 }
637 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
638 " | sort > $Prefix-Tests.txt";
639 }
Chris Lattner5d6c4382003-01-23 19:31:28 +0000640}
Chris Lattnerb3440302003-01-22 16:14:05 +0000641
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000642if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000643my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
644
Chris Lattnerec0e3742003-02-28 20:30:20 +0000645if ($TestError) {
646 $TestsAdded = "<b>error testing</b><br>";
647 $TestsRemoved = "<b>error testing</b><br>";
648 $TestsFixed = "<b>error testing</b><br>";
649 $TestsBroken = "<b>error testing</b><br>";
650} else {
651 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
652
653 my @RawTestsAddedArray = split '\n', $RTestsAdded;
654 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
655
656 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
657 @RawTestsRemovedArray;
658 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
659 @RawTestsAddedArray;
660
661 foreach $Test (keys %NewTests) {
662 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
663 $TestsAdded = "$TestsAdded$Test\n";
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000664 } else {
Chris Lattnerec0e3742003-02-28 20:30:20 +0000665 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
666 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
667 } else {
668 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
669 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000670 }
671 }
Chris Lattnerec0e3742003-02-28 20:30:20 +0000672 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
673 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
674 }
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000675
Chris Lattner91480ff2003-10-21 15:47:31 +0000676 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
677 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
678 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
679 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
Chris Lattnerbe197872003-10-19 16:54:00 +0000680
Chris Lattnerec0e3742003-02-28 20:30:20 +0000681 $TestsAdded = AddPreTag $TestsAdded;
682 $TestsRemoved = AddPreTag $TestsRemoved;
683 $TestsFixed = AddPreTag $TestsFixed;
684 $TestsBroken = AddPreTag $TestsBroken;
685}
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000686
Chris Lattner9efd7f42003-10-18 19:31:39 +0000687
Chris Lattner196a14a2003-08-19 15:08:34 +0000688# If we built the tree successfully, runs of the Olden suite with
689# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
690if ($BuildError eq "") {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000691 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
Chris Lattner08e24762003-08-19 18:35:03 +0000692 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
Chris Lattner196a14a2003-08-19 15:08:34 +0000693 $MachCodeSize) = ("","","","","","","");
Chris Lattner08e24762003-08-19 18:35:03 +0000694 if (!$NORUNNINGTESTS) {
Reid Spencer10ffe012004-09-05 07:58:10 +0000695 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000696 "Olden Test Directory");
Chris Lattner196a14a2003-08-19 15:08:34 +0000697
698 # Clean out previous results...
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000699 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
Chris Lattner196a14a2003-08-19 15:08:34 +0000700
701 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE enabled!
Brian Gaeke85668542004-06-04 00:07:12 +0000702 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
Chris Lattner196a14a2003-08-19 15:08:34 +0000703 " LARGE_PROBLEM_SIZE=1 > /dev/null 2>&1";
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000704 system "cp report.nightly.raw.out $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000705 } else {
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000706 system "gunzip ${OldenTestsLog}.gz";
Chris Lattner196a14a2003-08-19 15:08:34 +0000707 }
708
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000709 # Now we know we have $OldenTestsLog as the raw output file. Split
Chris Lattner196a14a2003-08-19 15:08:34 +0000710 # it up into records and read the useful information.
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000711 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000712 shift @Records; # Delete the first (garbage) record
713
714 # Loop over all of the records, summarizing them into rows for the running
715 # totals file.
716 my $WallTimeRE = "[A-Za-z0-9.: ]+\\(([0-9.]+) wall clock";
717 foreach $Rec (@Records) {
Chris Lattner08e24762003-08-19 18:35:03 +0000718 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: real\s*([.0-9m]+)', $Rec;
719 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: real\s*([.0-9m]+)', $Rec;
720 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: real\s*([.0-9m]+)', $Rec;
721 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: real\s*([.0-9m]+)', $Rec;
Chris Lattner196a14a2003-08-19 15:08:34 +0000722 my $rOptTime = GetRegex "TEST-RESULT-compile: $WallTimeRE", $Rec;
723 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
724 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
725
726 $NATTime .= " " . FormatTime($rNATTime);
727 $CBETime .= " " . FormatTime($rCBETime);
728 $LLCTime .= " " . FormatTime($rLLCTime);
729 $JITTime .= " " . FormatTime($rJITTime);
730 $OptTime .= " $rOptTime";
Chris Lattner08e24762003-08-19 18:35:03 +0000731 $BytecodeSize .= " $rBytecodeSize";
732 $MachCodeSize .= " $rMachCodeSize";
Chris Lattner196a14a2003-08-19 15:08:34 +0000733 }
734
735 # Now that we have all of the numbers we want, add them to the running totals
736 # files.
Chris Lattner08e24762003-08-19 18:35:03 +0000737 AddRecord($NATTime, "running_Olden_nat_time.txt");
Chris Lattner196a14a2003-08-19 15:08:34 +0000738 AddRecord($CBETime, "running_Olden_cbe_time.txt");
739 AddRecord($LLCTime, "running_Olden_llc_time.txt");
740 AddRecord($JITTime, "running_Olden_jit_time.txt");
741 AddRecord($OptTime, "running_Olden_opt_time.txt");
742 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
743 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
Chris Lattner08e24762003-08-19 18:35:03 +0000744
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000745 system "gzip -f $OldenTestsLog";
Chris Lattner196a14a2003-08-19 15:08:34 +0000746}
747
748
Chris Lattnerd9bdbaa2003-01-22 20:35:59 +0000749#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000750# Get a list of the previous days that we can link to...
Chris Lattnerb3440302003-01-22 16:14:05 +0000751#
Chris Lattner2f8cb572003-01-20 18:05:27 +0000752my @PrevDays = map {s/.html//; $_} GetDir ".html";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000753
Brian Gaeke253231e2004-06-11 19:55:30 +0000754if ((scalar @PrevDays) > 20) {
755 splice @PrevDays, 20; # Trim down list to something reasonable...
756}
Chris Lattner4c7e3032003-01-20 06:11:03 +0000757
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000758# Format list for sidebar
759my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
Chris Lattner4c7e3032003-01-20 06:11:03 +0000760
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000761#
Brian Gaeke90c82b92004-09-28 16:04:00 +0000762# Start outputting files into the web directory
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000763#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000764ChangeDir( $WebDir, "Web Directory" );
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000765
Brian Gaeke90c82b92004-09-28 16:04:00 +0000766# Make sure we don't get errors running the nightly tester the first time
767# because of files that don't exist.
768Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
769 'running_loc.txt', 'running_Olden_machcode.txt',
770 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
771 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
772 'running_Olden_jit_time.txt');
773
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000774# Add information to the files which accumulate information for graphs...
775AddRecord($LOC, "running_loc.txt");
776AddRecord($BuildTime, "running_build_time.txt");
777
Chris Lattner4d00fde2004-05-28 20:30:23 +0000778if ( $VERBOSE ) {
779 print "GRAPH GENERATION STAGE\n";
780}
Chris Lattnerc75b14e2003-08-18 20:07:54 +0000781#
782# Rebuild the graphs now...
783#
Chris Lattnerfe2597a2004-07-27 18:41:49 +0000784$GNUPLOT = "/usr/bin/gnuplot";
Brian Gaekeb3dab902003-10-11 05:34:00 +0000785$GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000786system ("$GNUPLOT", $PlotScriptFilename);
Chris Lattnerb3440302003-01-22 16:14:05 +0000787
Chris Lattner4c7e3032003-01-20 06:11:03 +0000788#
789# Remove the cvs tree...
790#
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000791system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Chris Lattner4c7e3032003-01-20 06:11:03 +0000792
Chris Lattnerb3440302003-01-22 16:14:05 +0000793#
Chris Lattner4c7e3032003-01-20 06:11:03 +0000794# Print out information...
Chris Lattnerb3440302003-01-22 16:14:05 +0000795#
Chris Lattner4d00fde2004-05-28 20:30:23 +0000796if ($VERBOSE) {
Chris Lattner4c7e3032003-01-20 06:11:03 +0000797 print "DateString: $DateString\n";
798 print "CVS Checkout: $CVSCheckoutTime seconds\n";
799 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000800 print "Build Time: $BuildTime seconds\n";
Chris Lattner4d00fde2004-05-28 20:30:23 +0000801 print "Feature Test Time: $FeatureTime seconds\n";
802 print "Regression Test Time: $RegressionTime seconds\n";
Chris Lattner4c7e3032003-01-20 06:11:03 +0000803 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
804
805 print "WARNINGS:\n $WarningsList\n";
806
Chris Lattner4c7e3032003-01-20 06:11:03 +0000807 print "Users committed: $UserCommitList\n";
808 print "Added Files: \n $AddedFilesList\n";
809 print "Modified Files: \n $ModifiedFilesList\n";
810 print "Removed Files: \n $RemovedFilesList\n";
811
812 print "Previous Days =\n $PrevDaysList\n";
813}
814
Chris Lattnerb3440302003-01-22 16:14:05 +0000815
Chris Lattner2f8cb572003-01-20 18:05:27 +0000816#
817# Output the files...
818#
819
Chris Lattner4d00fde2004-05-28 20:30:23 +0000820if ( $VERBOSE ) {
821 print "OUTPUT STAGE\n";
822}
Chris Lattner2f8cb572003-01-20 18:05:27 +0000823# Main HTML file...
Chris Lattner4c7e3032003-01-20 06:11:03 +0000824my $Output;
Reid Spencercb6a3aa2004-06-22 15:38:37 +0000825my $TestFinishTime = gmtime;
826my $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