3 # Program: NightlyTest.pl
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.
10 # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR]
12 # OPTIONS may include one or more of the following:
13 # -nocheckout Do not create, checkout, update, or configure
15 # -noremove Do not remove the BUILDDIR after it has been built.
16 # -notest Do not even attempt to run the test programs. Implies
18 # -norunningtests Do not run the Olden benchmark suite with
19 # LARGE_PROBLEM_SIZE enabled.
20 # -noexternals Do not run the external tests (for cases where povray
21 # or SPEC are not installed)
22 # -nodejagnu Do not run feature or regression tests
23 # -parallel Run two parallel jobs with GNU Make.
24 # -release Build an LLVM Release version
25 # -pedantic Enable additional GCC warnings to detect possible errors.
26 # -enable-linscan Enable linearscan tests
27 # -disable-llc Disable LLC tests in the nightly tester.
28 # -disable-jit Disable JIT tests in the nightly tester.
29 # -verbose Turn on some debug output
30 # -debug Print information useful only to maintainers of this script.
31 # -nice Checkout/Configure/Build with "nice" to reduce impact
33 # -f2c Next argument specifies path to F2C utility
34 # -gnuplotscript Next argument specifies gnuplot script to use
35 # -templatefile Next argument specifies template file to use
36 # -gccpath Path to gcc/g++ used to build LLVM
38 # 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
47 # copy of the results. This directory will be created if it does not exist.
48 # 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.
51 use POSIX qw(strftime);
54 my $HOME = $ENV{'HOME'};
55 my $CVSRootDir = $ENV{'CVSROOT'};
56 $CVSRootDir = "/home/vadve/shared/PublicCVS"
58 my $BuildDir = $ENV{'BUILDDIR'};
59 $BuildDir = "$HOME/buildtest"
61 my $WebDir = $ENV{'WEBDIR'};
62 $WebDir = "$HOME/cvs/testresults-X86"
65 # Calculate the date prefix...
67 my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
68 my $DateString = strftime "%B %d, %Y", localtime;
69 my $TestStartTime = gmtime;
71 # Command line argument settings...
75 my $NORUNNINGTESTS = 0;
78 my $PROGTESTOPTS = "";
81 my $CONFIGUREARGS = "";
86 if (open (FILE, $_[0])) {
93 print "Could not open file '$_[0]' for reading!";
98 sub WriteFile { # (filename, contents)
99 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
104 sub GetRegex { # (Regex with ()'s, value)
115 foreach my $file (@files) {
117 open (FILE, ">$file") or warn "Could not create new file $file";
120 utime $now, $now, $file;
125 my ($Val, $Filename) = @_;
127 if (open FILE, "$WebDir/$Filename") {
128 @Records = grep !/$DATE/, split "\n", <FILE>;
131 push @Records, "$DATE: $Val";
132 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
135 sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
137 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
140 sub ChangeDir { # directory, logical name
141 my ($dir,$name) = @_;
143 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
144 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
147 sub CopyFile { #filename, newfile
148 my ($file, $newfile) = @_;
150 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
151 copy($file, $newfile);
157 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
162 # DiffFiles - Diff the current version of the file against the last version of
163 # the file, reporting things added and removed. This is used to report, for
164 # example, added and removed warnings. This returns a pair (added, removed)
168 my @Others = GetDir $Suffix;
169 if (@Others == 0) { # No other files? We added all entries...
170 return (`cat $WebDir/$DATE$Suffix`, "");
172 # Diff the files now...
173 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
174 my $Added = join "\n", grep /^</, @Diffs;
175 my $Removed = join "\n", grep /^>/, @Diffs;
177 $Removed =~ s/^> //gm;
178 return ($Added, $Removed);
181 # FormatTime - Convert a time from 1m23.45 into 83.45
184 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
185 $Time = sprintf("%7.4f", $1*60.0+$2);
191 my ($Regex, $Num, $Regex2, $File) = @_;
192 my @Items = split "\n", `grep '$Regex' $File`;
193 return GetRegex $Regex2, $Items[$Num];
196 sub GetDejagnuTestResults { # (filename, log)
197 my ($filename, $DejagnuLog) = @_;
200 $/ = "\n"; #Make sure we're going line at a time.
201 if (open SRCHFILE, $filename) {
202 # Process test results
203 push(@lines,"<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n");
205 my $should_break = 1;
208 while ( <SRCHFILE> ) {
209 if ( length($_) > 1 ) {
211 if ( m/^XPASS:/ || m/^FAIL:/ ) {
216 push(@lines,"<b>$_</b><br/>\n");
218 push(@lines,"</li><li><b>$_</b><br/>\n");
220 } elsif ( m/Summary/ ) {
221 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
222 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
226 } elsif ( $readingsum ) {
232 push(@lines, "</pre>\n");
235 my $content = join("",@lines);
236 return "$content</li></ol>\n";
240 #####################################################################
242 #####################################################################
245 my $PlotScriptFilename = "";
248 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
250 last if /^--$/; # Stop processing arguments on --
252 # List command line options here...
253 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
254 if (/^-noremove$/) { $NOREMOVE = 1; next; }
255 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
256 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
257 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
258 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
260 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
263 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
264 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
265 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
266 $CONFIGUREARGS .= " --disable-jit"; next; }
267 if (/^-verbose$/) { $VERBOSE = 1; next; }
268 if (/^-debug$/) { $DEBUG = 1; next; }
269 if (/^-nice$/) { $NICE = "nice "; next; }
271 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
273 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
274 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
276 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
278 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
279 if(/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
281 print "Unknown option: $_ : ignoring!\n";
284 if ($ENV{'LLVMGCCDIR'}) {
285 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
287 if ($CONFIGUREARGS !~ /--disable-jit/) {
288 $CONFIGUREARGS .= " --enable-jit";
291 die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
294 $CVSRootDir = $ARGV[0];
295 $BuildDir = $ARGV[1];
299 my $Prefix = "$WebDir/$DATE";
301 #define the file names we'll use
302 my $BuildLog = "$Prefix-Build-Log.txt";
303 my $CVSLog = "$Prefix-CVS-Log.txt";
304 my $OldenTestsLog = "$Prefix-Olden-tests.txt";
305 my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
306 my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
307 my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
308 my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
309 my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
310 my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
313 print "INITIALIZED\n";
314 print "CVS Root = $CVSRootDir\n";
315 print "BuildDir = $BuildDir\n";
316 print "WebDir = $WebDir\n";
317 print "Prefix = $Prefix\n";
318 print "CVSLog = $CVSLog\n";
319 print "BuildLog = $BuildLog\n";
324 warn "Warning: $WebDir did not exist; creating it.\n";
328 # Create the CVS repository directory
333 system "rm -rf $BuildDir";
335 die "CVS checkout directory $BuildDir already exists!";
338 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
341 ChangeDir( $BuildDir, "CVS checkout directory" );
345 # Check out the llvm tree, saving CVS messages to the cvs log...
348 $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
350 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
351 system "( time -p $NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm; cd llvm/projects ; " .
352 "$NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm-test ) > $CVSLog 2>&1";
353 ChangeDir( $BuildDir , "CVS Checkout directory") ;
356 ChangeDir( "llvm" , "llvm source directory") ;
359 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
360 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
363 if ( $Template eq "" ) {
364 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
366 die "Template file $Template is not readable" if ( ! -r "$Template" );
368 if ( $PlotScriptFilename eq "" ) {
369 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
371 die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
373 # Read in the HTML template file...
374 if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
375 my $TemplateContents = ReadFile $Template;
378 # Get some static statistics about the current state of CVS
380 my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
381 my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
382 my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
383 $LOC = `utils/countloc.sh`;
386 # Build the entire tree, saving build messages to the build log
389 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
390 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
392 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
393 # Build the entire tree, capturing the output into $BuildLog
394 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
399 # Get some statistics about the build...
401 my @Linked = split '\n', `grep Linking $BuildLog`;
402 my $NumExecutables = scalar(grep(/executable/, @Linked));
403 my $NumLibraries = scalar(grep(!/executable/, @Linked));
404 my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0;
406 my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
407 my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
408 my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
409 my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
411 my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
412 my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
413 my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
414 my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
417 if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
418 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
419 $BuildError = "<h3><font color='red'>Build error: compilation " .
420 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
421 if ($VERBOSE) { print "BUILD ERROR\n"; }
424 if ($BuildError) { $NODEJAGNU=1; }
426 my $DejangnuTestResults; # String containing the results of the dejagnu
428 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
430 my $dejagnu_output = "$DejagnuTestsLog";
432 #Run the feature and regression tests, results are put into testrun.sum
433 #Full log in testrun.log
434 system "(time -p gmake $MAKEOPTS check) > $dejagnu_output 2>&1";
436 #Extract time of dejagnu tests
437 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
438 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
439 $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
440 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
442 #Copy the testrun.log and testrun.sum to our webdir
443 CopyFile("test/testrun.log", $DejagnuLog);
444 CopyFile("test/testrun.sum", $DejagnuSum);
446 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
448 $DejagnuTestResults = "Skipped by user choice.";
449 $DejagnuTime = "0.0";
450 $DejagnuWallTime = "0.0";
454 print $DejagnuTestResults;
457 if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
459 # Get warnings from the build
461 my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
465 foreach $Warning (@Warn) {
466 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
467 $CurDir = $1; # Keep track of directory warning is in...
468 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
472 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
475 my $WarningsFile = join "\n", @Warnings;
476 my $WarningsList = AddPreTag $WarningsFile;
477 $WarningsFile =~ s/:[0-9]+:/::/g;
479 # Emit the warnings file, so we can diff...
480 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
481 my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
483 # Output something to stdout if something has changed
484 print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
485 print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
487 $WarningsAdded = AddPreTag $WarningsAdded;
488 $WarningsRemoved = AddPreTag $WarningsRemoved;
491 # Get some statistics about CVS commits over the current day...
493 if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
494 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
495 #print join "\n", @CVSHistory; print "\n";
497 # Extract some information from the CVS history... use a hash so no duplicate
499 my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
501 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
503 # Loop over every record from the CVS history, filling in the hashes.
504 foreach $File (@CVSHistory) {
505 my ($Type, $Date, $UID, $Rev, $Filename);
506 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
507 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
508 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
509 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
510 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
511 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
513 print "UNMATCHABLE: $File\n";
516 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
518 if ($Filename =~ /^llvm/) {
519 if ($Type eq 'M') { # Modified
520 $ModifiedFiles{$Filename} = 1;
521 $UsersCommitted{$UID} = 1;
522 } elsif ($Type eq 'A') { # Added
523 $AddedFiles{$Filename} = 1;
524 $UsersCommitted{$UID} = 1;
525 } elsif ($Type eq 'R') { # Removed
526 $RemovedFiles{$Filename} = 1;
527 $UsersCommitted{$UID} = 1;
529 $UsersUpdated{$UID} = 1;
534 my $UserCommitList = join "\n", keys %UsersCommitted;
535 my $UserUpdateList = join "\n", keys %UsersUpdated;
536 my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
537 my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
538 my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
541 my $SingleSourceProgramsTable = "!";
542 my $MultiSourceProgramsTable = "!";
543 my $ExternalProgramsTable = "!";
549 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
551 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
553 # Run the programs tests... creating a report.nightly.html file
555 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
556 . "TEST=nightly > $ProgramTestLog 2>&1";
558 system "gunzip ${ProgramTestLog}.gz";
562 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
564 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
565 print "ERROR TESTING\n";
566 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
569 "<font color=white><h2>Makefile error running tests!</h2></font>";
570 print "ERROR TESTING\n";
573 $ProgramsTable = ReadFile "report.nightly.html";
576 # Create a list of the tests which were run...
578 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
579 . "| sort > $Prefix-$SubDir-Tests.txt";
582 # Compress the test output
583 system "gzip -f $ProgramTestLog";
584 ChangeDir( "../../..", "Programs Test Parent Directory" );
585 return $ProgramsTable;
588 # If we built the tree successfully, run the nightly programs tests...
589 if ($BuildError eq "") {
591 print "SingleSource TEST STAGE\n";
593 $SingleSourceProgramsTable = TestDirectory("SingleSource");
595 print "MultiSource TEST STAGE\n";
597 $MultiSourceProgramsTable = TestDirectory("MultiSource");
598 if ( ! $NOEXTERNALS ) {
600 print "External TEST STAGE\n";
602 $ExternalProgramsTable = TestDirectory("External");
603 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
604 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
606 $ExternalProgramsTable = '<tr><td>External TEST STAGE SKIPPED</td></tr>';
608 print "External TEST STAGE SKIPPED\n";
610 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
611 " | sort > $Prefix-Tests.txt";
615 if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
616 my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
619 $TestsAdded = "<b>error testing</b><br>";
620 $TestsRemoved = "<b>error testing</b><br>";
621 $TestsFixed = "<b>error testing</b><br>";
622 $TestsBroken = "<b>error testing</b><br>";
624 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
626 my @RawTestsAddedArray = split '\n', $RTestsAdded;
627 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
629 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
630 @RawTestsRemovedArray;
631 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
634 foreach $Test (keys %NewTests) {
635 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
636 $TestsAdded = "$TestsAdded$Test\n";
638 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
639 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
641 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
645 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
646 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
649 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
650 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
651 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
652 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
654 $TestsAdded = AddPreTag $TestsAdded;
655 $TestsRemoved = AddPreTag $TestsRemoved;
656 $TestsFixed = AddPreTag $TestsFixed;
657 $TestsBroken = AddPreTag $TestsBroken;
661 # If we built the tree successfully, runs of the Olden suite with
662 # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
663 if ($BuildError eq "") {
664 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
665 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
666 $MachCodeSize) = ("","","","","","","");
667 if (!$NORUNNINGTESTS) {
668 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
669 "Olden Test Directory");
671 # Clean out previous results...
672 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
674 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
675 # GET_STABLE_NUMBERS enabled!
676 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
677 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
678 system "cp report.nightly.raw.out $OldenTestsLog";
680 system "gunzip ${OldenTestsLog}.gz";
683 # Now we know we have $OldenTestsLog as the raw output file. Split
684 # it up into records and read the useful information.
685 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
686 shift @Records; # Delete the first (garbage) record
688 # Loop over all of the records, summarizing them into rows for the running
690 my $WallTimeRE = "[A-Za-z0-9.: ]+\\(([0-9.]+) wall clock";
691 foreach $Rec (@Records) {
692 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
693 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
694 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
695 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
696 my $rOptTime = GetRegex "TEST-RESULT-compile: $WallTimeRE", $Rec;
697 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
698 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
700 $NATTime .= " " . FormatTime($rNATTime);
701 $CBETime .= " " . FormatTime($rCBETime);
702 $LLCTime .= " " . FormatTime($rLLCTime);
703 $JITTime .= " " . FormatTime($rJITTime);
704 $OptTime .= " $rOptTime";
705 $BytecodeSize .= " $rBytecodeSize";
706 $MachCodeSize .= " $rMachCodeSize";
709 # Now that we have all of the numbers we want, add them to the running totals
711 AddRecord($NATTime, "running_Olden_nat_time.txt");
712 AddRecord($CBETime, "running_Olden_cbe_time.txt");
713 AddRecord($LLCTime, "running_Olden_llc_time.txt");
714 AddRecord($JITTime, "running_Olden_jit_time.txt");
715 AddRecord($OptTime, "running_Olden_opt_time.txt");
716 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
717 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
719 system "gzip -f $OldenTestsLog";
724 # Get a list of the previous days that we can link to...
726 my @PrevDays = map {s/.html//; $_} GetDir ".html";
728 if ((scalar @PrevDays) > 20) {
729 splice @PrevDays, 20; # Trim down list to something reasonable...
732 # Format list for sidebar
733 my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
736 # Start outputting files into the web directory
738 ChangeDir( $WebDir, "Web Directory" );
740 # Make sure we don't get errors running the nightly tester the first time
741 # because of files that don't exist.
742 Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
743 'running_loc.txt', 'running_Olden_machcode.txt',
744 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
745 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
746 'running_Olden_jit_time.txt');
748 # Add information to the files which accumulate information for graphs...
749 AddRecord($LOC, "running_loc.txt");
750 AddRecord($BuildTime, "running_build_time.txt");
753 print "GRAPH GENERATION STAGE\n";
756 # Rebuild the graphs now...
758 $GNUPLOT = "/usr/bin/gnuplot";
759 $GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
760 system ("$GNUPLOT", $PlotScriptFilename);
763 # Remove the cvs tree...
765 system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
768 # Print out information...
771 print "DateString: $DateString\n";
772 print "CVS Checkout: $CVSCheckoutTime seconds\n";
773 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
774 print "Build Time: $BuildTime seconds\n";
775 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
777 print "WARNINGS:\n $WarningsList\n";
779 print "Users committed: $UserCommitList\n";
780 print "Added Files: \n $AddedFilesList\n";
781 print "Modified Files: \n $ModifiedFilesList\n";
782 print "Removed Files: \n $RemovedFilesList\n";
784 print "Previous Days =\n $PrevDaysList\n";
789 # Output the files...
793 print "OUTPUT STAGE\n";
797 my $TestFinishTime = gmtime;
798 my $TestPlatform = `uname -a`;
799 eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
800 WriteFile "$DATE.html", $Output;
801 system ( "ln -sf $DATE.html index.html" );
803 # Change the index.html symlink...