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.
49 use POSIX qw(strftime);
52 my $HOME = $ENV{'HOME'};
53 my $CVSRootDir = $ENV{'CVSROOT'};
54 $CVSRootDir = "/home/vadve/shared/PublicCVS"
56 my $BuildDir = $ENV{'BUILDDIR'};
57 $BuildDir = "$HOME/buildtest"
59 my $WebDir = $ENV{'WEBDIR'};
60 $WebDir = "$HOME/cvs/testresults-X86"
63 # Calculate the date prefix...
65 my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
66 my $DateString = strftime "%B %d, %Y", localtime;
67 my $TestStartTime = gmtime;
69 # Command line argument settings...
73 my $NORUNNINGTESTS = 0;
76 my $PROGTESTOPTS = "";
79 my $CONFIGUREARGS = "";
84 if (open (FILE, $_[0])) {
91 print "Could not open file '$_[0]' for reading!";
96 sub WriteFile { # (filename, contents)
97 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
102 sub GetRegex { # (Regex with ()'s, value)
113 foreach my $file (@files) {
115 open (FILE, ">$file") or warn "Could not create new file $file";
118 utime $now, $now, $file;
123 my ($Val, $Filename) = @_;
125 if (open FILE, "$WebDir/$Filename") {
126 @Records = grep !/$DATE/, split "\n", <FILE>;
129 push @Records, "$DATE: $Val";
130 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
133 sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
135 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
138 sub ChangeDir { # directory, logical name
139 my ($dir,$name) = @_;
141 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
142 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
145 sub CopyFile { #filename, newfile
146 my ($file, $newfile) = @_;
148 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
149 copy($file, $newfile);
155 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
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)
166 my @Others = GetDir $Suffix;
167 if (@Others == 0) { # No other files? We added all entries...
168 return (`cat $WebDir/$DATE$Suffix`, "");
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;
175 $Removed =~ s/^> //gm;
176 return ($Added, $Removed);
179 # FormatTime - Convert a time from 1m23.45 into 83.45
182 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
183 $Time = sprintf("%7.4f", $1*60.0+$2);
189 my ($Regex, $Num, $Regex2, $File) = @_;
190 my @Items = split "\n", `grep '$Regex' $File`;
191 return GetRegex $Regex2, $Items[$Num];
194 sub GetDejagnuTestResults { # (filename, log)
195 my ($filename, $DejagnuLog) = @_;
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");
203 my $should_break = 1;
206 while ( <SRCHFILE> ) {
207 if ( length($_) > 1 ) {
209 if ( m/^XPASS:/ || m/^FAIL:/ ) {
214 push(@lines,"<b>$_</b><br/>\n");
216 push(@lines,"</li><li><b>$_</b><br/>\n");
218 } elsif ( m/Summary/ ) {
219 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
220 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
224 } elsif ( $readingsum ) {
230 push(@lines, "</pre>\n");
233 my $content = join("",@lines);
234 return "$content</li></ol>\n";
238 #####################################################################
240 #####################################################################
243 my $PlotScriptFilename = "";
246 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
248 last if /^--$/; # Stop processing arguments on --
250 # List command line options here...
251 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
252 if (/^-noremove$/) { $NOREMOVE = 1; next; }
253 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
254 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
255 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
256 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
258 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
261 if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; }
262 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; }
266 if (/^-verbose$/) { $VERBOSE = 1; next; }
267 if (/^-debug$/) { $DEBUG = 1; next; }
268 if (/^-nice$/) { $NICE = "nice "; next; }
270 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
272 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
273 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
275 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
277 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
278 if(/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
280 print "Unknown option: $_ : ignoring!\n";
283 if ($CONFIGUREARGS !~ /--disable-jit/) {
284 $CONFIGUREARGS .= " --enable-jit";
287 die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
290 $CVSRootDir = $ARGV[0];
291 $BuildDir = $ARGV[1];
295 my $Prefix = "$WebDir/$DATE";
297 #define the file names we'll use
298 my $BuildLog = "$Prefix-Build-Log.txt";
299 my $CVSLog = "$Prefix-CVS-Log.txt";
300 my $OldenTestsLog = "$Prefix-Olden-tests.txt";
301 my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
302 my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
303 my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
304 my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
305 my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
306 my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
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";
320 warn "Warning: $WebDir did not exist; creating it.\n";
324 # Create the CVS repository directory
329 system "rm -rf $BuildDir";
331 die "CVS checkout directory $BuildDir already exists!";
334 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
337 ChangeDir( $BuildDir, "CVS checkout directory" );
341 # Check out the llvm tree, saving CVS messages to the cvs log...
344 $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
346 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
347 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";
349 ChangeDir( $BuildDir , "CVS Checkout directory") ;
352 ChangeDir( "llvm" , "llvm source directory") ;
355 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
356 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
359 if ( $Template eq "" ) {
360 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
362 die "Template file $Template is not readable" if ( ! -r "$Template" );
364 if ( $PlotScriptFilename eq "" ) {
365 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
367 die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
369 # Read in the HTML template file...
370 if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
371 my $TemplateContents = ReadFile $Template;
374 # Get some static statistics about the current state of CVS
376 my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
377 my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
378 my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
379 $LOC = `utils/countloc.sh`;
382 # Build the entire tree, saving build messages to the build log
385 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
386 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
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";
395 # Get some statistics about the build...
397 my @Linked = split '\n', `grep Linking $BuildLog`;
398 my $NumExecutables = scalar(grep(/executable/, @Linked));
399 my $NumLibraries = scalar(grep(!/executable/, @Linked));
400 my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0;
402 my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
403 my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
404 my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
405 my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
407 my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
408 my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
409 my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
410 my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
413 if (`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"; }
420 if ($BuildError) { $NODEJAGNU=1; }
422 my $DejangnuTestResults; # String containing the results of the dejagnu
424 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
426 my $dejagnu_output = "$DejagnuTestsLog";
428 #Run the feature and regression tests, results are put into testrun.sum
429 #Full log in testrun.log
430 system "(time -p gmake $MAKEOPTS check) > $dejagnu_output 2>&1";
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";
438 #Copy the testrun.log and testrun.sum to our webdir
439 CopyFile("test/testrun.log", $DejagnuLog);
440 CopyFile("test/testrun.sum", $DejagnuSum);
442 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
443 print $DejagnuTestResults;
446 $DejagnuTestResults = "Skipped by user choice.";
447 $DejagnuTime = "0.0";
448 $DejagnuWallTime = "0.0";
452 print $DejagnuTestResults;
455 if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
457 # Get warnings from the build
459 my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
463 foreach $Warning (@Warn) {
464 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
465 $CurDir = $1; # Keep track of directory warning is in...
466 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
470 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
473 my $WarningsFile = join "\n", @Warnings;
474 my $WarningsList = AddPreTag $WarningsFile;
475 $WarningsFile =~ s/:[0-9]+:/::/g;
477 # Emit the warnings file, so we can diff...
478 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
479 my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
481 # Output something to stdout if something has changed
482 print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
483 print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
485 $WarningsAdded = AddPreTag $WarningsAdded;
486 $WarningsRemoved = AddPreTag $WarningsRemoved;
489 # Get some statistics about CVS commits over the current day...
491 if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
492 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
493 #print join "\n", @CVSHistory; print "\n";
495 # Extract some information from the CVS history... use a hash so no duplicate
497 my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
499 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
501 # Loop over every record from the CVS history, filling in the hashes.
502 foreach $File (@CVSHistory) {
503 my ($Type, $Date, $UID, $Rev, $Filename);
504 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
505 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
506 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
507 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
508 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
509 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
511 print "UNMATCHABLE: $File\n";
514 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
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;
527 $UsersUpdated{$UID} = 1;
532 my $UserCommitList = join "\n", keys %UsersCommitted;
533 my $UserUpdateList = join "\n", keys %UsersUpdated;
534 my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
535 my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
536 my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
539 my $SingleSourceProgramsTable = "!";
540 my $MultiSourceProgramsTable = "!";
541 my $ExternalProgramsTable = "!";
547 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
549 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
551 # Run the programs tests... creating a report.nightly.html file
553 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
554 . "TEST=nightly > $ProgramTestLog 2>&1";
556 system "gunzip ${ProgramTestLog}.gz";
560 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
562 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
563 print "ERROR TESTING\n";
564 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
567 "<font color=white><h2>Makefile error running tests!</h2></font>";
568 print "ERROR TESTING\n";
571 $ProgramsTable = ReadFile "report.nightly.html";
574 # Create a list of the tests which were run...
576 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
577 . "| sort > $Prefix-$SubDir-Tests.txt";
580 # Compress the test output
581 system "gzip -f $ProgramTestLog";
582 ChangeDir( "../../..", "Programs Test Parent Directory" );
583 return $ProgramsTable;
586 # If we built the tree successfully, run the nightly programs tests...
587 if ($BuildError eq "") {
589 print "SingleSource TEST STAGE\n";
591 $SingleSourceProgramsTable = TestDirectory("SingleSource");
593 print "MultiSource TEST STAGE\n";
595 $MultiSourceProgramsTable = TestDirectory("MultiSource");
596 if ( ! $NOEXTERNALS ) {
598 print "External TEST STAGE\n";
600 $ExternalProgramsTable = TestDirectory("External");
601 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
602 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
604 $ExternalProgramsTable = '<tr><td>External TEST STAGE SKIPPED</td></tr>';
606 print "External TEST STAGE SKIPPED\n";
608 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
609 " | sort > $Prefix-Tests.txt";
613 if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
614 my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
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>";
622 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
624 my @RawTestsAddedArray = split '\n', $RTestsAdded;
625 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
627 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
628 @RawTestsRemovedArray;
629 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
632 foreach $Test (keys %NewTests) {
633 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
634 $TestsAdded = "$TestsAdded$Test\n";
636 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
637 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
639 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
643 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
644 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
647 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);
652 $TestsAdded = AddPreTag $TestsAdded;
653 $TestsRemoved = AddPreTag $TestsRemoved;
654 $TestsFixed = AddPreTag $TestsFixed;
655 $TestsBroken = AddPreTag $TestsBroken;
659 # 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.
661 if ($BuildError eq "") {
662 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
663 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
664 $MachCodeSize) = ("","","","","","","");
665 if (!$NORUNNINGTESTS) {
666 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
667 "Olden Test Directory");
669 # Clean out previous results...
670 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
672 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
673 # GET_STABLE_NUMBERS enabled!
674 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
675 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
676 system "cp report.nightly.raw.out $OldenTestsLog";
678 system "gunzip ${OldenTestsLog}.gz";
681 # Now we know we have $OldenTestsLog as the raw output file. Split
682 # it up into records and read the useful information.
683 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
684 shift @Records; # Delete the first (garbage) record
686 # Loop over all of the records, summarizing them into rows for the running
688 my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
689 foreach $Rec (@Records) {
690 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;
694 my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
695 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
696 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
698 $NATTime .= " " . FormatTime($rNATTime);
699 $CBETime .= " " . FormatTime($rCBETime);
700 $LLCTime .= " " . FormatTime($rLLCTime);
701 $JITTime .= " " . FormatTime($rJITTime);
702 $OptTime .= " $rOptTime";
703 $BytecodeSize .= " $rBytecodeSize";
704 $MachCodeSize .= " $rMachCodeSize";
707 # Now that we have all of the numbers we want, add them to the running totals
709 AddRecord($NATTime, "running_Olden_nat_time.txt");
710 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");
717 system "gzip -f $OldenTestsLog";
722 # Get a list of the previous days that we can link to...
724 my @PrevDays = map {s/.html//; $_} GetDir ".html";
726 if ((scalar @PrevDays) > 20) {
727 splice @PrevDays, 20; # Trim down list to something reasonable...
730 # Format list for sidebar
731 my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
734 # Start outputting files into the web directory
736 ChangeDir( $WebDir, "Web Directory" );
738 # Make sure we don't get errors running the nightly tester the first time
739 # because of files that don't exist.
740 Touch ('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');
746 # Add information to the files which accumulate information for graphs...
747 AddRecord($LOC, "running_loc.txt");
748 AddRecord($BuildTime, "running_build_time.txt");
751 print "GRAPH GENERATION STAGE\n";
754 # Rebuild the graphs now...
756 $GNUPLOT = "/usr/bin/gnuplot";
757 $GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
758 system ("$GNUPLOT", $PlotScriptFilename);
761 # Remove the cvs tree...
763 system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
766 # Print out information...
769 print "DateString: $DateString\n";
770 print "CVS Checkout: $CVSCheckoutTime seconds\n";
771 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
772 print "Build Time: $BuildTime seconds\n";
773 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
775 print "WARNINGS:\n $WarningsList\n";
777 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";
782 print "Previous Days =\n $PrevDaysList\n";
787 # Output the files...
791 print "OUTPUT STAGE\n";
795 my $TestFinishTime = gmtime;
796 my $TestPlatform = `uname -a`;
797 eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
798 WriteFile "$DATE.html", $Output;
799 system ( "ln -sf $DATE.html index.html" );
801 # Change the index.html symlink...