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 # -nofeaturetests Do not run the feature tests.
17 # -noregressiontests Do not run the regression tests.
18 # -notest Do not even attempt to run the test programs. Implies
20 # -norunningtests Do not run the Olden benchmark suite with
21 # LARGE_PROBLEM_SIZE enabled.
22 # -noexternals Do not run the external tests (for cases where povray
23 # or SPEC are not installed)
24 # -parallel Run two parallel jobs with GNU Make.
25 # -release Build an LLVM Release version
26 # -pedantic Enable additional GCC warnings to detect possible errors.
27 # -enable-linscan Enable linearscan tests
28 # -disable-codegen Disable LLC and 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 # -gnuplotscript Next argument specifies gnuplot script to use
34 # -templatefile Next argument specifies template file to use
35 # -gccpath Path to gcc/g++ used to build LLVM
37 # CVSROOT is the CVS repository from which the tree will be checked out,
38 # specified either in the full :method:user@host:/dir syntax, or
39 # just /dir if using a local repo.
40 # BUILDDIR is the directory where sources for this test run will be checked out
41 # AND objects for this test run will be built. This directory MUST NOT
42 # exist before the script is run; it will be created by the cvs checkout
43 # process and erased (unless -noremove is specified; see above.)
44 # WEBDIR is the directory into which the test results web page will be written,
45 # AND in which the "index.html" is assumed to be a symlink to the most recent
46 # copy of the results. This directory MUST exist before the script is run.
47 # LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
48 # to. This is the same as you would have for a normal LLVM build.
50 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 $NOREGRESSIONS = 0;
75 my $NORUNNINGTESTS = 0;
78 my $PROGTESTOPTS = "";
81 my $CONFIGUREARGS = "--enable-jit";
85 if (open (FILE, $_[0])) {
92 print "Could not open file '$_[0]' for reading!";
97 sub WriteFile { # (filename, contents)
98 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
103 sub GetRegex { # (Regex with ()'s, value)
112 my ($Val, $Filename) = @_;
114 if (open FILE, "$WebDir/$Filename") {
115 @Records = grep !/$DATE/, split "\n", <FILE>;
118 push @Records, "$DATE: $Val";
119 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
123 sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
125 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
128 sub ChangeDir { # directory, logical name
129 my ($dir,$name) = @_;
131 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
132 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
138 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
143 # DiffFiles - Diff the current version of the file against the last version of
144 # the file, reporting things added and removed. This is used to report, for
145 # example, added and removed warnings. This returns a pair (added, removed)
149 my @Others = GetDir $Suffix;
150 if (@Others == 0) { # No other files? We added all entries...
151 return (`cat $WebDir/$DATE$Suffix`, "");
153 # Diff the files now...
154 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
155 my $Added = join "\n", grep /^</, @Diffs;
156 my $Removed = join "\n", grep /^>/, @Diffs;
158 $Removed =~ s/^> //gm;
159 return ($Added, $Removed);
162 # FormatTime - Convert a time from 1m23.45 into 83.45
165 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
166 $Time = sprintf("%7.4f", $1*60.0+$2);
172 my ($Regex, $Num, $Regex2, $File) = @_;
173 my @Items = split "\n", `grep '$Regex' $File`;
174 return GetRegex $Regex2, $Items[$Num];
177 sub GetQMTestResults { # (filename)
181 $/ = "\n"; #Make sure we're going line at a time.
182 if (open SRCHFILE, $filename) {
183 # Skip stuff before ---TEST RESULTS
184 while ( <SRCHFILE> ) {
185 if ( m/^--- TEST RESULTS/ ) { last; }
187 # Process test results
188 push(@lines,"<h3>TEST RESULTS</h3><ol><li>\n");
190 my $should_break = 1;
192 while ( <SRCHFILE> ) {
193 if ( length($_) > 1 ) {
195 if ( ! m/: PASS[ ]*$/ &&
196 ! m/^ qmtest.target:/ &&
201 } elsif ( m/: XPASS/ || m/: FAIL/ ) {
206 push(@lines,"<b>$_</b><br/>\n");
208 push(@lines,"</li><li><b>$_</b><br/>\n");
210 } elsif ( m/^--- STATISTICS/ ) {
211 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
212 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
215 } elsif ( m/^--- TESTS WITH/ ) {
219 push(@lines,"</pre><h3>TESTS WITH UNEXPECTED RESULTS</h3><ol><li>\n");
220 } elsif ( m/^real / ) {
223 if ( $should_break ) {
224 push(@lines,"$_<br/>\n");
234 my $content = join("",@lines);
235 return "$content</li></ol>\n";
239 #####################################################################
241 #####################################################################
244 my $PlotScriptFilename = "";
247 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
249 last if /^--$/; # Stop processing arguments on --
251 # List command line options here...
252 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
253 if (/^-noremove$/) { $NOREMOVE = 1; next; }
254 if (/^-nofeaturetests$/) { $NOFEATURES = 1; next; }
255 if (/^-noregressiontests$/){ $NOREGRESSIONS = 1; next; }
256 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
257 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
258 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
259 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
261 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
264 if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; }
265 if (/^-disable-codegen$/){ $PROGTESTOPTS .= " DISABLE_JIT=1 DISABLE_LLC=1";
266 $CONFIGUREARGS="--disable-jit --disable-llc_diffs";
268 if (/^-verbose$/) { $VERBOSE = 1; next; }
269 if (/^-debug$/) { $DEBUG = 1; next; }
270 if (/^-nice$/) { $NICE = "nice "; next; }
271 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
272 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
273 if (/^-gccpath/) { $CONFIGUREARGS=" CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next; }
274 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
276 print "Unknown option: $_ : ignoring!\n";
279 if ($ENV{'LLVMGCCDIR'}) {
280 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
283 die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
286 $CVSRootDir = $ARGV[0];
287 $BuildDir = $ARGV[1];
291 my $Prefix = "$WebDir/$DATE";
293 #define the file names we'll use
294 my $BuildLog = "$Prefix-Build-Log.txt";
295 my $CVSLog = "$Prefix-CVS-Log.txt";
296 my $FeatureTestsLog = "$Prefix-FeatureTests-Log.txt";
297 my $RegressionTestsLog = "$Prefix-RegressionTests-Log.txt";
298 my $OldenTestsLog = "$Prefix-Olden-tests.txt";
299 my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
300 my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
301 my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
304 print "INITIALIZED\n";
305 print "CVS Root = $CVSRootDir\n";
306 print "BuildDir = $BuildDir\n";
307 print "WebDir = $WebDir\n";
308 print "Prefix = $Prefix\n";
309 print "CVSLog = $CVSLog\n";
310 print "BuildLog = $BuildLog\n";
315 # Create the CVS repository directory
320 system "rm -rf $BuildDir";
322 die "CVS checkout directory $BuildDir already exists!";
325 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
328 ChangeDir( $BuildDir, "CVS checkout directory" );
332 # Check out the llvm tree, saving CVS messages to the cvs log...
335 $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
337 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
338 system "(time -p $NICE cvs $CVSOPT -d $CVSRootDir co llvm) > $CVSLog 2>&1";
341 ChangeDir( "llvm" , "llvm source directory") ;
344 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
345 system "$NICE cvs update -P -d >> $CVSLog 2>&1" ;
348 if ( $Template eq "" ) {
349 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
351 die "Template file $Template is not readable" if ( ! -r "$Template" );
353 if ( $PlotScriptFilename eq "" ) {
354 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
356 die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
358 # Read in the HTML template file...
359 if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
360 my $TemplateContents = ReadFile $Template;
363 # Get some static statistics about the current state of CVS
365 my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
366 my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
367 my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
368 $LOC = GetRegex "([0-9]+) +total", `wc -l \`utils/getsrcs.sh\` | grep total`;
371 # Build the entire tree, saving build messages to the build log
374 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
375 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
377 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
378 # Build the entire tree, capturing the output into $BuildLog
379 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
384 # Get some statistics about the build...
386 my @Linked = split '\n', `grep Linking $BuildLog`;
387 my $NumExecutables = scalar(grep(/executable/, @Linked));
388 my $NumLibraries = scalar(grep(!/executable/, @Linked));
389 my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0;
391 my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
392 my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
393 my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
394 my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
396 my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
397 my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
398 my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
399 my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
402 if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
403 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
404 $BuildError = "<h3><font color='red'>Build error: compilation " .
405 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
406 if ($VERBOSE) { print "BUILD ERROR\n"; }
409 if ($BuildError) { $NOFEATURES = 1; $NOREGRESSIONS = 1; }
411 # Get results of feature tests.
412 my $FeatureTestResults; # String containing the results of the feature tests
413 my $FeatureTime; # System+CPU Time for feature tests
414 my $FeatureWallTime; # Wall Clock Time for feature tests
416 if ( $VERBOSE ) { print "FEATURE TEST STAGE\n"; }
417 my $feature_output = "$FeatureTestsLog";
419 # Run the feature tests so we can summarize the results
420 system "(time -p gmake $MAKEOPTS -C test Feature.t) > $feature_output 2>&1";
422 # Extract test results
423 $FeatureTestResults = GetQMTestResults("$feature_output");
425 # Extract time of feature tests
426 my $FeatureTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$feature_output";
427 my $FeatureTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$feature_output";
428 $FeatureTime = $FeatureTimeU+$FeatureTimeS; # FeatureTime = User+System
429 $FeatureWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$feature_output";
430 # Run the regression tests so we can summarize the results
432 $FeatureTestResults = "Skipped by user choice.";
433 $FeatureTime = "0.0";
434 $FeatureWallTime = "0.0";
437 if (!$NOREGRESSIONS) {
438 if ( $VERBOSE ) { print "REGRESSION TEST STAGE\n"; }
439 my $regression_output = "$RegressionTestsLog";
441 # Run the regression tests so we can summarize the results
442 system "(time -p gmake $MAKEOPTS -C test Regression.t) > $regression_output 2>&1";
444 # Extract test results
445 $RegressionTestResults = GetQMTestResults("$regression_output");
447 # Extract time of regressions tests
448 my $RegressionTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$regression_output";
449 my $RegressionTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$regression_output";
450 $RegressionTime = $RegressionTimeU+$RegressionTimeS; # RegressionTime = User+System
451 $RegressionWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$regression_output";
453 $RegressionTestResults = "Skipped by user choice.";
454 $RegressionTime = "0.0";
455 $RegressionWallTime = "0.0";
459 print $FeatureTestResults;
460 print $RegressionTestResults;
463 if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
465 # Get warnings from the build
467 my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
471 foreach $Warning (@Warn) {
472 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
473 $CurDir = $1; # Keep track of directory warning is in...
474 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
478 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
481 my $WarningsFile = join "\n", @Warnings;
482 my $WarningsList = AddPreTag $WarningsFile;
483 $WarningsFile =~ s/:[0-9]+:/::/g;
485 # Emit the warnings file, so we can diff...
486 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
487 my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
489 # Output something to stdout if something has changed
490 print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
491 print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
493 $WarningsAdded = AddPreTag $WarningsAdded;
494 $WarningsRemoved = AddPreTag $WarningsRemoved;
497 # Get some statistics about CVS commits over the current day...
499 if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
500 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
501 #print join "\n", @CVSHistory; print "\n";
503 # Extract some information from the CVS history... use a hash so no duplicate
505 my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
507 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
509 # Loop over every record from the CVS history, filling in the hashes.
510 foreach $File (@CVSHistory) {
511 my ($Type, $Date, $UID, $Rev, $Filename);
512 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
513 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
514 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
515 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
516 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
517 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
519 print "UNMATCHABLE: $File\n";
522 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
524 if ($Filename =~ /^llvm/) {
525 if ($Type eq 'M') { # Modified
526 $ModifiedFiles{$Filename} = 1;
527 $UsersCommitted{$UID} = 1;
528 } elsif ($Type eq 'A') { # Added
529 $AddedFiles{$Filename} = 1;
530 $UsersCommitted{$UID} = 1;
531 } elsif ($Type eq 'R') { # Removed
532 $RemovedFiles{$Filename} = 1;
533 $UsersCommitted{$UID} = 1;
535 $UsersUpdated{$UID} = 1;
540 my $UserCommitList = join "\n", keys %UsersCommitted;
541 my $UserUpdateList = join "\n", keys %UsersUpdated;
542 my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
543 my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
544 my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
547 my $SingleSourceProgramsTable = "!";
548 my $MultiSourceProgramsTable = "!";
549 my $ExternalProgramsTable = "!";
555 ChangeDir( "test/Programs/$SubDir", "Programs Test Subdirectory" );
557 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
559 # Run the programs tests... creating a report.nightly.html file
561 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
562 . "TEST=nightly > $ProgramTestLog 2>&1";
564 system "gunzip ${ProgramTestLog}.gz";
568 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
570 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
571 print "ERROR TESTING\n";
572 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
575 "<font color=white><h2>Makefile error running tests!</h2></font>";
576 print "ERROR TESTING\n";
579 $ProgramsTable = ReadFile "report.nightly.html";
582 # Create a list of the tests which were run...
584 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
585 . "| sort > $Prefix-$SubDir-Tests.txt";
588 # Compress the test output
589 system "gzip -f $ProgramTestLog";
590 ChangeDir( "../../..", "Programs Test Parent Directory" );
591 return $ProgramsTable;
594 # If we built the tree successfully, run the nightly programs tests...
595 if ($BuildError eq "") {
597 print "SingleSource TEST STAGE\n";
599 $SingleSourceProgramsTable = TestDirectory("SingleSource");
601 print "MultiSource TEST STAGE\n";
603 $MultiSourceProgramsTable = TestDirectory("MultiSource");
604 if ( ! $NOEXTERNALS ) {
606 print "External TEST STAGE\n";
608 $ExternalProgramsTable = TestDirectory("External");
609 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
610 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
613 print "External TEST STAGE SKIPPED\n";
615 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
616 " | sort > $Prefix-Tests.txt";
620 if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
621 my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
624 $TestsAdded = "<b>error testing</b><br>";
625 $TestsRemoved = "<b>error testing</b><br>";
626 $TestsFixed = "<b>error testing</b><br>";
627 $TestsBroken = "<b>error testing</b><br>";
629 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
631 my @RawTestsAddedArray = split '\n', $RTestsAdded;
632 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
634 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
635 @RawTestsRemovedArray;
636 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
639 foreach $Test (keys %NewTests) {
640 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
641 $TestsAdded = "$TestsAdded$Test\n";
643 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
644 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
646 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
650 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
651 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
654 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
655 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
656 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
657 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
659 $TestsAdded = AddPreTag $TestsAdded;
660 $TestsRemoved = AddPreTag $TestsRemoved;
661 $TestsFixed = AddPreTag $TestsFixed;
662 $TestsBroken = AddPreTag $TestsBroken;
666 # If we built the tree successfully, runs of the Olden suite with
667 # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
668 if ($BuildError eq "") {
669 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
670 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
671 $MachCodeSize) = ("","","","","","","");
672 if (!$NORUNNINGTESTS) {
673 ChangeDir( "$BuildDir/llvm/test/Programs/MultiSource/Benchmarks/Olden",
674 "Olden Test Directory");
676 # Clean out previous results...
677 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
679 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE enabled!
680 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
681 " LARGE_PROBLEM_SIZE=1 > /dev/null 2>&1";
682 system "cp report.nightly.raw.out $OldenTestsLog";
684 system "gunzip ${OldenTestsLog}.gz";
687 # Now we know we have $OldenTestsLog as the raw output file. Split
688 # it up into records and read the useful information.
689 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
690 shift @Records; # Delete the first (garbage) record
692 # Loop over all of the records, summarizing them into rows for the running
694 my $WallTimeRE = "[A-Za-z0-9.: ]+\\(([0-9.]+) wall clock";
695 foreach $Rec (@Records) {
696 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: real\s*([.0-9m]+)', $Rec;
697 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: real\s*([.0-9m]+)', $Rec;
698 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: real\s*([.0-9m]+)', $Rec;
699 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: real\s*([.0-9m]+)', $Rec;
700 my $rOptTime = GetRegex "TEST-RESULT-compile: $WallTimeRE", $Rec;
701 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
702 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
704 $NATTime .= " " . FormatTime($rNATTime);
705 $CBETime .= " " . FormatTime($rCBETime);
706 $LLCTime .= " " . FormatTime($rLLCTime);
707 $JITTime .= " " . FormatTime($rJITTime);
708 $OptTime .= " $rOptTime";
709 $BytecodeSize .= " $rBytecodeSize";
710 $MachCodeSize .= " $rMachCodeSize";
713 # Now that we have all of the numbers we want, add them to the running totals
715 AddRecord($NATTime, "running_Olden_nat_time.txt");
716 AddRecord($CBETime, "running_Olden_cbe_time.txt");
717 AddRecord($LLCTime, "running_Olden_llc_time.txt");
718 AddRecord($JITTime, "running_Olden_jit_time.txt");
719 AddRecord($OptTime, "running_Olden_opt_time.txt");
720 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
721 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
723 system "gzip -f $OldenTestsLog";
728 # Get a list of the previous days that we can link to...
730 my @PrevDays = map {s/.html//; $_} GetDir ".html";
732 if ((scalar @PrevDays) > 20) {
733 splice @PrevDays, 20; # Trim down list to something reasonable...
736 # Format list for sidebar
737 my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
740 # Start outputing files into the web directory
742 ChangeDir( $WebDir, "Web Directory" );
744 # Add information to the files which accumulate information for graphs...
745 AddRecord($LOC, "running_loc.txt");
746 AddRecord($BuildTime, "running_build_time.txt");
749 print "GRAPH GENERATION STAGE\n";
752 # Rebuild the graphs now...
754 $GNUPLOT = "/usr/bin/gnuplot";
755 $GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
756 system ("$GNUPLOT", $PlotScriptFilename);
759 # Remove the cvs tree...
761 system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
764 # Print out information...
767 print "DateString: $DateString\n";
768 print "CVS Checkout: $CVSCheckoutTime seconds\n";
769 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
770 print "Build Time: $BuildTime seconds\n";
771 print "Feature Test Time: $FeatureTime seconds\n";
772 print "Regression Test Time: $RegressionTime 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...