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-llc Disable LLC tests in the nightly tester.
29 # -disable-jit Disable JIT tests in the nightly tester.
30 # -verbose Turn on some debug output
31 # -debug Print information useful only to maintainers of this script.
32 # -nice Checkout/Configure/Build with "nice" to reduce impact
34 # -f2c Next argument specifies path to F2C utility
35 # -gnuplotscript Next argument specifies gnuplot script to use
36 # -templatefile Next argument specifies template file to use
37 # -gccpath Path to gcc/g++ used to build LLVM
39 # CVSROOT is the CVS repository from which the tree will be checked out,
40 # specified either in the full :method:user@host:/dir syntax, or
41 # just /dir if using a local repo.
42 # BUILDDIR is the directory where sources for this test run will be checked out
43 # AND objects for this test run will be built. This directory MUST NOT
44 # exist before the script is run; it will be created by the cvs checkout
45 # process and erased (unless -noremove is specified; see above.)
46 # WEBDIR is the directory into which the test results web page will be written,
47 # AND in which the "index.html" is assumed to be a symlink to the most recent
48 # copy of the results. This directory will be created if it does not exist.
49 # LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
50 # to. This is the same as you would have for a normal LLVM build.
52 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 $NOREGRESSIONS = 0;
77 my $NORUNNINGTESTS = 0;
80 my $PROGTESTOPTS = "";
83 my $CONFIGUREARGS = "";
87 if (open (FILE, $_[0])) {
94 print "Could not open file '$_[0]' for reading!";
99 sub WriteFile { # (filename, contents)
100 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
105 sub GetRegex { # (Regex with ()'s, value)
116 foreach my $file (@files) {
118 open (FILE, ">$file") or warn "Could not create new file $file";
121 utime $now, $now, $file;
126 my ($Val, $Filename) = @_;
128 if (open FILE, "$WebDir/$Filename") {
129 @Records = grep !/$DATE/, split "\n", <FILE>;
132 push @Records, "$DATE: $Val";
133 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
136 sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
138 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
141 sub ChangeDir { # directory, logical name
142 my ($dir,$name) = @_;
144 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
145 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
151 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
156 # DiffFiles - Diff the current version of the file against the last version of
157 # the file, reporting things added and removed. This is used to report, for
158 # example, added and removed warnings. This returns a pair (added, removed)
162 my @Others = GetDir $Suffix;
163 if (@Others == 0) { # No other files? We added all entries...
164 return (`cat $WebDir/$DATE$Suffix`, "");
166 # Diff the files now...
167 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
168 my $Added = join "\n", grep /^</, @Diffs;
169 my $Removed = join "\n", grep /^>/, @Diffs;
171 $Removed =~ s/^> //gm;
172 return ($Added, $Removed);
175 # FormatTime - Convert a time from 1m23.45 into 83.45
178 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
179 $Time = sprintf("%7.4f", $1*60.0+$2);
185 my ($Regex, $Num, $Regex2, $File) = @_;
186 my @Items = split "\n", `grep '$Regex' $File`;
187 return GetRegex $Regex2, $Items[$Num];
190 sub GetQMTestResults { # (filename)
194 $/ = "\n"; #Make sure we're going line at a time.
195 if (open SRCHFILE, $filename) {
196 # Skip stuff before ---TEST RESULTS
197 while ( <SRCHFILE> ) {
198 if ( m/^--- TEST RESULTS/ ) { last; }
200 # Process test results
201 push(@lines,"<h3>TEST RESULTS</h3><ol><li>\n");
203 my $should_break = 1;
205 while ( <SRCHFILE> ) {
206 if ( length($_) > 1 ) {
208 if ( ! m/: PASS[ ]*$/ &&
209 ! m/^ qmtest.target:/ &&
214 } elsif ( m/: XPASS/ || m/: FAIL/ ) {
219 push(@lines,"<b>$_</b><br/>\n");
221 push(@lines,"</li><li><b>$_</b><br/>\n");
223 } elsif ( m/^--- STATISTICS/ ) {
224 if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
225 push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
228 } elsif ( m/^--- TESTS WITH/ ) {
232 push(@lines,"</pre><h3>TESTS WITH UNEXPECTED RESULTS</h3><ol><li>\n");
233 } elsif ( m/^real / ) {
236 if ( $should_break ) {
237 push(@lines,"$_<br/>\n");
247 my $content = join("",@lines);
248 return "$content</li></ol>\n";
252 #####################################################################
254 #####################################################################
257 my $PlotScriptFilename = "";
260 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
262 last if /^--$/; # Stop processing arguments on --
264 # List command line options here...
265 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
266 if (/^-noremove$/) { $NOREMOVE = 1; next; }
267 if (/^-nofeaturetests$/) { $NOFEATURES = 1; next; }
268 if (/^-noregressiontests$/){ $NOREGRESSIONS = 1; next; }
269 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
270 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
271 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
272 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
274 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
277 if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; }
278 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
279 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
280 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
281 $CONFIGUREARGS .= " --disable-jit"; next; }
282 if (/^-verbose$/) { $VERBOSE = 1; next; }
283 if (/^-debug$/) { $DEBUG = 1; next; }
284 if (/^-nice$/) { $NICE = "nice "; next; }
286 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
288 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
289 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
291 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
293 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
295 print "Unknown option: $_ : ignoring!\n";
298 if ($ENV{'LLVMGCCDIR'}) {
299 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
301 if ($CONFIGUREARGS !~ /--disable-jit/) {
302 $CONFIGUREARGS .= " --enable-jit";
305 die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
308 $CVSRootDir = $ARGV[0];
309 $BuildDir = $ARGV[1];
313 my $Prefix = "$WebDir/$DATE";
315 #define the file names we'll use
316 my $BuildLog = "$Prefix-Build-Log.txt";
317 my $CVSLog = "$Prefix-CVS-Log.txt";
318 my $FeatureTestsLog = "$Prefix-FeatureTests-Log.txt";
319 my $RegressionTestsLog = "$Prefix-RegressionTests-Log.txt";
320 my $OldenTestsLog = "$Prefix-Olden-tests.txt";
321 my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
322 my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
323 my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
326 print "INITIALIZED\n";
327 print "CVS Root = $CVSRootDir\n";
328 print "BuildDir = $BuildDir\n";
329 print "WebDir = $WebDir\n";
330 print "Prefix = $Prefix\n";
331 print "CVSLog = $CVSLog\n";
332 print "BuildLog = $BuildLog\n";
337 warn "Warning: $WebDir did not exist; creating it.\n";
341 # Create the CVS repository directory
346 system "rm -rf $BuildDir";
348 die "CVS checkout directory $BuildDir already exists!";
351 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
354 ChangeDir( $BuildDir, "CVS checkout directory" );
358 # Check out the llvm tree, saving CVS messages to the cvs log...
361 $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh.
363 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
364 system "( time -p $NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm; cd llvm/projects ; " .
365 "$NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm-test ) > $CVSLog 2>&1";
366 ChangeDir( $BuildDir , "CVS Checkout directory") ;
369 ChangeDir( "llvm" , "llvm source directory") ;
372 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
373 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
376 if ( $Template eq "" ) {
377 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
379 die "Template file $Template is not readable" if ( ! -r "$Template" );
381 if ( $PlotScriptFilename eq "" ) {
382 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
384 die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
386 # Read in the HTML template file...
387 if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
388 my $TemplateContents = ReadFile $Template;
391 # Get some static statistics about the current state of CVS
393 my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
394 my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
395 my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
396 $LOC = `utils/countloc.sh`;
399 # Build the entire tree, saving build messages to the build log
402 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
403 system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1";
405 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
406 # Build the entire tree, capturing the output into $BuildLog
407 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
412 # Get some statistics about the build...
414 my @Linked = split '\n', `grep Linking $BuildLog`;
415 my $NumExecutables = scalar(grep(/executable/, @Linked));
416 my $NumLibraries = scalar(grep(!/executable/, @Linked));
417 my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0;
419 my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
420 my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
421 my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
422 my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
424 my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
425 my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
426 my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
427 my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
430 if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
431 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
432 $BuildError = "<h3><font color='red'>Build error: compilation " .
433 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
434 if ($VERBOSE) { print "BUILD ERROR\n"; }
437 if ($BuildError) { $NOFEATURES = 1; $NOREGRESSIONS = 1; }
439 # Get results of feature tests.
440 my $FeatureTestResults; # String containing the results of the feature tests
441 my $FeatureTime; # System+CPU Time for feature tests
442 my $FeatureWallTime; # Wall Clock Time for feature tests
444 if ( $VERBOSE ) { print "FEATURE TEST STAGE\n"; }
445 my $feature_output = "$FeatureTestsLog";
447 # Run the feature tests so we can summarize the results
448 system "(time -p gmake $MAKEOPTS -C test Feature.t) > $feature_output 2>&1";
450 # Extract test results
451 $FeatureTestResults = GetQMTestResults("$feature_output");
453 # Extract time of feature tests
454 my $FeatureTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$feature_output";
455 my $FeatureTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$feature_output";
456 $FeatureTime = $FeatureTimeU+$FeatureTimeS; # FeatureTime = User+System
457 $FeatureWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$feature_output";
458 # Run the regression tests so we can summarize the results
460 $FeatureTestResults = "Skipped by user choice.";
461 $FeatureTime = "0.0";
462 $FeatureWallTime = "0.0";
465 if (!$NOREGRESSIONS) {
466 if ( $VERBOSE ) { print "REGRESSION TEST STAGE\n"; }
467 my $regression_output = "$RegressionTestsLog";
469 # Run the regression tests so we can summarize the results
470 system "(time -p gmake $MAKEOPTS -C test Regression.t) > $regression_output 2>&1";
472 # Extract test results
473 $RegressionTestResults = GetQMTestResults("$regression_output");
475 # Extract time of regressions tests
476 my $RegressionTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$regression_output";
477 my $RegressionTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$regression_output";
478 $RegressionTime = $RegressionTimeU+$RegressionTimeS; # RegressionTime = User+System
479 $RegressionWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$regression_output";
481 $RegressionTestResults = "Skipped by user choice.";
482 $RegressionTime = "0.0";
483 $RegressionWallTime = "0.0";
487 print $FeatureTestResults;
488 print $RegressionTestResults;
491 if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
493 # Get warnings from the build
495 my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
499 foreach $Warning (@Warn) {
500 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
501 $CurDir = $1; # Keep track of directory warning is in...
502 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
506 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
509 my $WarningsFile = join "\n", @Warnings;
510 my $WarningsList = AddPreTag $WarningsFile;
511 $WarningsFile =~ s/:[0-9]+:/::/g;
513 # Emit the warnings file, so we can diff...
514 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
515 my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
517 # Output something to stdout if something has changed
518 print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
519 print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
521 $WarningsAdded = AddPreTag $WarningsAdded;
522 $WarningsRemoved = AddPreTag $WarningsRemoved;
525 # Get some statistics about CVS commits over the current day...
527 if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
528 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
529 #print join "\n", @CVSHistory; print "\n";
531 # Extract some information from the CVS history... use a hash so no duplicate
533 my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
535 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
537 # Loop over every record from the CVS history, filling in the hashes.
538 foreach $File (@CVSHistory) {
539 my ($Type, $Date, $UID, $Rev, $Filename);
540 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
541 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
542 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
543 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
544 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
545 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
547 print "UNMATCHABLE: $File\n";
550 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
552 if ($Filename =~ /^llvm/) {
553 if ($Type eq 'M') { # Modified
554 $ModifiedFiles{$Filename} = 1;
555 $UsersCommitted{$UID} = 1;
556 } elsif ($Type eq 'A') { # Added
557 $AddedFiles{$Filename} = 1;
558 $UsersCommitted{$UID} = 1;
559 } elsif ($Type eq 'R') { # Removed
560 $RemovedFiles{$Filename} = 1;
561 $UsersCommitted{$UID} = 1;
563 $UsersUpdated{$UID} = 1;
568 my $UserCommitList = join "\n", keys %UsersCommitted;
569 my $UserUpdateList = join "\n", keys %UsersUpdated;
570 my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
571 my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
572 my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
575 my $SingleSourceProgramsTable = "!";
576 my $MultiSourceProgramsTable = "!";
577 my $ExternalProgramsTable = "!";
583 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
585 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
587 # Run the programs tests... creating a report.nightly.html file
589 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
590 . "TEST=nightly > $ProgramTestLog 2>&1";
592 system "gunzip ${ProgramTestLog}.gz";
596 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
598 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
599 print "ERROR TESTING\n";
600 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
603 "<font color=white><h2>Makefile error running tests!</h2></font>";
604 print "ERROR TESTING\n";
607 $ProgramsTable = ReadFile "report.nightly.html";
610 # Create a list of the tests which were run...
612 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
613 . "| sort > $Prefix-$SubDir-Tests.txt";
616 # Compress the test output
617 system "gzip -f $ProgramTestLog";
618 ChangeDir( "../../..", "Programs Test Parent Directory" );
619 return $ProgramsTable;
622 # If we built the tree successfully, run the nightly programs tests...
623 if ($BuildError eq "") {
625 print "SingleSource TEST STAGE\n";
627 $SingleSourceProgramsTable = TestDirectory("SingleSource");
629 print "MultiSource TEST STAGE\n";
631 $MultiSourceProgramsTable = TestDirectory("MultiSource");
632 if ( ! $NOEXTERNALS ) {
634 print "External TEST STAGE\n";
636 $ExternalProgramsTable = TestDirectory("External");
637 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
638 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
641 print "External TEST STAGE SKIPPED\n";
643 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
644 " | sort > $Prefix-Tests.txt";
648 if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
649 my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
652 $TestsAdded = "<b>error testing</b><br>";
653 $TestsRemoved = "<b>error testing</b><br>";
654 $TestsFixed = "<b>error testing</b><br>";
655 $TestsBroken = "<b>error testing</b><br>";
657 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
659 my @RawTestsAddedArray = split '\n', $RTestsAdded;
660 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
662 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
663 @RawTestsRemovedArray;
664 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
667 foreach $Test (keys %NewTests) {
668 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
669 $TestsAdded = "$TestsAdded$Test\n";
671 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
672 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
674 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
678 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
679 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
682 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
683 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
684 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
685 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
687 $TestsAdded = AddPreTag $TestsAdded;
688 $TestsRemoved = AddPreTag $TestsRemoved;
689 $TestsFixed = AddPreTag $TestsFixed;
690 $TestsBroken = AddPreTag $TestsBroken;
694 # If we built the tree successfully, runs of the Olden suite with
695 # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
696 if ($BuildError eq "") {
697 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
698 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
699 $MachCodeSize) = ("","","","","","","");
700 if (!$NORUNNINGTESTS) {
701 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
702 "Olden Test Directory");
704 # Clean out previous results...
705 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
707 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
708 # GET_STABLE_NUMBERS enabled!
709 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
710 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
711 system "cp report.nightly.raw.out $OldenTestsLog";
713 system "gunzip ${OldenTestsLog}.gz";
716 # Now we know we have $OldenTestsLog as the raw output file. Split
717 # it up into records and read the useful information.
718 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
719 shift @Records; # Delete the first (garbage) record
721 # Loop over all of the records, summarizing them into rows for the running
723 my $WallTimeRE = "[A-Za-z0-9.: ]+\\(([0-9.]+) wall clock";
724 foreach $Rec (@Records) {
725 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
726 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
727 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
728 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
729 my $rOptTime = GetRegex "TEST-RESULT-compile: $WallTimeRE", $Rec;
730 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
731 my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec;
733 $NATTime .= " " . FormatTime($rNATTime);
734 $CBETime .= " " . FormatTime($rCBETime);
735 $LLCTime .= " " . FormatTime($rLLCTime);
736 $JITTime .= " " . FormatTime($rJITTime);
737 $OptTime .= " $rOptTime";
738 $BytecodeSize .= " $rBytecodeSize";
739 $MachCodeSize .= " $rMachCodeSize";
742 # Now that we have all of the numbers we want, add them to the running totals
744 AddRecord($NATTime, "running_Olden_nat_time.txt");
745 AddRecord($CBETime, "running_Olden_cbe_time.txt");
746 AddRecord($LLCTime, "running_Olden_llc_time.txt");
747 AddRecord($JITTime, "running_Olden_jit_time.txt");
748 AddRecord($OptTime, "running_Olden_opt_time.txt");
749 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
750 AddRecord($MachCodeSize, "running_Olden_machcode.txt");
752 system "gzip -f $OldenTestsLog";
757 # Get a list of the previous days that we can link to...
759 my @PrevDays = map {s/.html//; $_} GetDir ".html";
761 if ((scalar @PrevDays) > 20) {
762 splice @PrevDays, 20; # Trim down list to something reasonable...
765 # Format list for sidebar
766 my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
769 # Start outputting files into the web directory
771 ChangeDir( $WebDir, "Web Directory" );
773 # Make sure we don't get errors running the nightly tester the first time
774 # because of files that don't exist.
775 Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
776 'running_loc.txt', 'running_Olden_machcode.txt',
777 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
778 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
779 'running_Olden_jit_time.txt');
781 # Add information to the files which accumulate information for graphs...
782 AddRecord($LOC, "running_loc.txt");
783 AddRecord($BuildTime, "running_build_time.txt");
786 print "GRAPH GENERATION STAGE\n";
789 # Rebuild the graphs now...
791 $GNUPLOT = "/usr/bin/gnuplot";
792 $GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
793 system ("$GNUPLOT", $PlotScriptFilename);
796 # Remove the cvs tree...
798 system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
801 # Print out information...
804 print "DateString: $DateString\n";
805 print "CVS Checkout: $CVSCheckoutTime seconds\n";
806 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
807 print "Build Time: $BuildTime seconds\n";
808 print "Feature Test Time: $FeatureTime seconds\n";
809 print "Regression Test Time: $RegressionTime seconds\n";
810 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
812 print "WARNINGS:\n $WarningsList\n";
814 print "Users committed: $UserCommitList\n";
815 print "Added Files: \n $AddedFilesList\n";
816 print "Modified Files: \n $ModifiedFilesList\n";
817 print "Removed Files: \n $RemovedFilesList\n";
819 print "Previous Days =\n $PrevDaysList\n";
824 # Output the files...
828 print "OUTPUT STAGE\n";
832 my $TestFinishTime = gmtime;
833 my $TestPlatform = `uname -a`;
834 eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
835 WriteFile "$DATE.html", $Output;
836 system ( "ln -sf $DATE.html index.html" );
838 # Change the index.html symlink...