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-llcbeta Enable testing of beta features in llc.
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
37 # -cvstag Check out a specific CVS tag to build LLVM (useful for
38 # testing release branches)
39 # -target Specify the target triplet
41 # ---------------- Options to configure llvm-test ----------------------------
42 # -spec2000path Path to the benchspec directory in the SPEC 2000 distro
43 # -spec95path Path to the benchspec directory in the SPEC 95 distro.
44 # -povraypath Path to the povray sources
45 # -namdpath Path to the namd sources
47 # CVSROOT is the CVS repository from which the tree will be checked out,
48 # specified either in the full :method:user@host:/dir syntax, or
49 # just /dir if using a local repo.
50 # BUILDDIR is the directory where sources for this test run will be checked out
51 # AND objects for this test run will be built. This directory MUST NOT
52 # exist before the script is run; it will be created by the cvs checkout
53 # process and erased (unless -noremove is specified; see above.)
54 # WEBDIR is the directory into which the test results web page will be written,
55 # AND in which the "index.html" is assumed to be a symlink to the most recent
56 # copy of the results. This directory will be created if it does not exist.
57 # LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
58 # to. This is the same as you would have for a normal LLVM build.
60 use POSIX qw(strftime);
63 my $HOME = $ENV{'HOME'};
64 my $CVSRootDir = $ENV{'CVSROOT'};
65 $CVSRootDir = "/home/vadve/shared/PublicCVS"
67 my $BuildDir = $ENV{'BUILDDIR'};
68 $BuildDir = "$HOME/buildtest"
70 my $WebDir = $ENV{'WEBDIR'};
71 $WebDir = "$HOME/cvs/testresults-X86"
74 # Calculate the date prefix...
76 my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
77 my $DateString = strftime "%B %d, %Y", localtime;
78 my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
80 # Command line argument settings...
84 my $NORUNNINGTESTS = 0;
87 my $PROGTESTOPTS = "";
90 my $CONFIGUREARGS = "";
91 my $CVSCOOPT = "-APR";
95 my $LLVMTESTCONFIGARGS = "";
98 if (open (FILE, $_[0])) {
105 print "Could not open file '$_[0]' for reading!";
110 sub WriteFile { # (filename, contents)
111 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
116 sub GetRegex { # (Regex with ()'s, value)
127 foreach my $file (@files) {
129 open (FILE, ">$file") or warn "Could not create new file $file";
132 utime $now, $now, $file;
137 my ($Val, $Filename) = @_;
139 if (open FILE, "$WebDir/$Filename") {
140 @Records = grep !/$DATE/, split "\n", <FILE>;
143 push @Records, "$DATE: $Val";
144 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
147 sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
149 if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; }
152 sub ChangeDir { # directory, logical name
153 my ($dir,$name) = @_;
155 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
156 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
159 sub CopyFile { #filename, newfile
160 my ($file, $newfile) = @_;
162 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
163 copy($file, $newfile);
169 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
174 # DiffFiles - Diff the current version of the file against the last version of
175 # the file, reporting things added and removed. This is used to report, for
176 # example, added and removed warnings. This returns a pair (added, removed)
180 my @Others = GetDir $Suffix;
181 if (@Others == 0) { # No other files? We added all entries...
182 return (`cat $WebDir/$DATE$Suffix`, "");
184 # Diff the files now...
185 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
186 my $Added = join "\n", grep /^</, @Diffs;
187 my $Removed = join "\n", grep /^>/, @Diffs;
189 $Removed =~ s/^> //gm;
190 return ($Added, $Removed);
193 # FormatTime - Convert a time from 1m23.45 into 83.45
196 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
197 $Time = sprintf("%7.4f", $1*60.0+$2);
203 my ($Regex, $Num, $Regex2, $File) = @_;
204 my @Items = split "\n", `grep '$Regex' $File`;
205 return GetRegex $Regex2, $Items[$Num];
208 sub GetDejagnuTestResults { # (filename, log)
209 my ($filename, $DejagnuLog) = @_;
212 $/ = "\n"; #Make sure we're going line at a time.
214 print "DEJAGNU TEST RESULTS:\n";
216 if (open SRCHFILE, $filename) {
217 # Process test results
219 my $should_break = 1;
222 while ( <SRCHFILE> ) {
223 if ( length($_) > 1 ) {
225 if ( m/^XPASS:/ || m/^FAIL:/ ) {
228 push(@lines, "<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n");
231 push(@lines, "<b>$_</b><br/>\n");
234 push(@lines, "</li><li><b>$_</b><br/>\n");
237 } elsif ( m/Summary/ ) {
239 push(@lines, "<b>PERFECT!</b>");
242 push(@lines, "</li></ol>\n");
244 push(@lines, "<h3>STATISTICS</h3><pre>\n");
245 print "\nDEJAGNU STATISTICS:\n";
249 } elsif ( $readingsum ) {
256 push(@lines, "</pre>\n");
259 my $content = join("", @lines);
260 return "$content</li></ol>\n";
264 #####################################################################
266 #####################################################################
269 my $PlotScriptFilename = "";
272 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
274 last if /^--$/; # Stop processing arguments on --
276 # List command line options here...
277 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
278 if (/^-noremove$/) { $NOREMOVE = 1; next; }
279 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
280 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
281 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
282 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
284 $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'";
287 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
288 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
289 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
290 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
291 $CONFIGUREARGS .= " --disable-jit"; next; }
292 if (/^-verbose$/) { $VERBOSE = 1; next; }
293 if (/^-debug$/) { $DEBUG = 1; next; }
294 if (/^-nice$/) { $NICE = "nice "; next; }
296 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
298 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
299 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
301 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
303 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
305 $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next;
307 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
308 if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
309 if (/^-spec2000path$/) {
310 $LLVMTESTCONFIGARGS .= " --enable-spec2000=$ARGV[0]"; shift; next;
312 if (/^-spec95path$/) {
313 $LLVMTESTCONFIGARGS .= " --enable-spec95=$ARGV[0]"; shift; next;
315 if (/^-povraypath$/) {
316 $LLVMTESTCONFIGARGS .= " --enable-povray=$ARGV[0]"; shift; next;
319 $LLVMTESTCONFIGARGS .= " --enable-namd=$ARGV[0]"; shift; next;
321 print "Unknown option: $_ : ignoring!\n";
324 if ($ENV{'LLVMGCCDIR'}) {
325 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
327 if ($CONFIGUREARGS !~ /--disable-jit/) {
328 $CONFIGUREARGS .= " --enable-jit";
331 die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
334 $CVSRootDir = $ARGV[0];
335 $BuildDir = $ARGV[1];
339 my $Prefix = "$WebDir/$DATE";
341 #define the file names we'll use
342 my $BuildLog = "$Prefix-Build-Log.txt";
343 my $CVSLog = "$Prefix-CVS-Log.txt";
344 my $OldenTestsLog = "$Prefix-Olden-tests.txt";
345 my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
346 my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
347 my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
348 my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
349 my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
350 my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
353 print "INITIALIZED\n";
354 print "CVS Root = $CVSRootDir\n";
355 print "BuildDir = $BuildDir\n";
356 print "WebDir = $WebDir\n";
357 print "Prefix = $Prefix\n";
358 print "CVSLog = $CVSLog\n";
359 print "BuildLog = $BuildLog\n";
364 warn "Warning: $WebDir did not exist; creating it.\n";
368 # Create the CVS repository directory
373 system "rm -rf $BuildDir";
375 die "CVS checkout directory $BuildDir already exists!";
378 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
381 ChangeDir( $BuildDir, "CVS checkout directory" );
385 # Check out the llvm tree, saving CVS messages to the cvs log...
388 # Use compression if going over ssh.
389 $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
390 my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
392 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
393 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
394 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
395 ChangeDir( $BuildDir , "CVS Checkout directory") ;
398 ChangeDir( "llvm" , "llvm source directory") ;
401 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
402 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
405 if ( $Template eq "" ) {
406 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
408 die "Template file $Template is not readable" if ( ! -r "$Template" );
410 if ( $PlotScriptFilename eq "" ) {
411 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
413 die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
415 # Read in the HTML template file...
416 if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
417 my $TemplateContents = ReadFile $Template;
420 # Get some static statistics about the current state of CVS
422 my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
423 my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
424 my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
425 $LOC = `utils/countloc.sh`;
428 # Build the entire tree, saving build messages to the build log
431 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
432 my $EXTRAFLAGS = "--enable-spec --with-objroot=.$LLVMTESTCONFIGARGS";
433 system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
435 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
436 # Build the entire tree, capturing the output into $BuildLog
437 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
442 # Get some statistics about the build...
444 my @Linked = split '\n', `grep Linking $BuildLog`;
445 my $NumExecutables = scalar(grep(/executable/, @Linked));
446 my $NumLibraries = scalar(grep(!/executable/, @Linked));
447 my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
449 my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
450 my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
451 my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
452 my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
454 my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
455 my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
456 my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
457 my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
459 my $BuildError = 0, $BuildStatus = "OK";
460 if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
461 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
462 $BuildStatus = "<h3><font color='red'>error: compilation " .
463 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
465 print "\n***ERROR BUILDING TREE\n\n";
468 if ($BuildError) { $NODEJAGNU=1; }
470 my $DejangnuTestResults; # String containing the results of the dejagnu
472 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
474 my $dejagnu_output = "$DejagnuTestsLog";
476 #Run the feature and regression tests, results are put into testrun.sum
477 #Full log in testrun.log
478 system "(time -p gmake $MAKEOPTS check) > $dejagnu_output 2>&1";
480 #Extract time of dejagnu tests
481 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
482 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
483 $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
484 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
486 #Copy the testrun.log and testrun.sum to our webdir
487 CopyFile("test/testrun.log", $DejagnuLog);
488 CopyFile("test/testrun.sum", $DejagnuSum);
490 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
493 $DejagnuTestResults = "Skipped by user choice.";
494 $DejagnuTime = "0.0";
495 $DejagnuWallTime = "0.0";
499 print $DejagnuTestResults;
502 if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
504 # Get warnings from the build
506 my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
510 foreach $Warning (@Warn) {
511 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
512 $CurDir = $1; # Keep track of directory warning is in...
513 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
517 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
520 my $WarningsFile = join "\n", @Warnings;
521 my $WarningsList = AddPreTag $WarningsFile;
522 $WarningsFile =~ s/:[0-9]+:/::/g;
524 # Emit the warnings file, so we can diff...
525 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
526 my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
528 # Output something to stdout if something has changed
529 print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
530 print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
532 $WarningsAdded = AddPreTag $WarningsAdded;
533 $WarningsRemoved = AddPreTag $WarningsRemoved;
536 # Get some statistics about CVS commits over the current day...
538 if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
539 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
540 #print join "\n", @CVSHistory; print "\n";
542 # Extract some information from the CVS history... use a hash so no duplicate
544 my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
546 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
548 # Loop over every record from the CVS history, filling in the hashes.
549 foreach $File (@CVSHistory) {
550 my ($Type, $Date, $UID, $Rev, $Filename);
551 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
552 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
553 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
554 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
555 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
556 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
558 print "UNMATCHABLE: $File\n";
561 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
563 if ($Filename =~ /^llvm/) {
564 if ($Type eq 'M') { # Modified
565 $ModifiedFiles{$Filename} = 1;
566 $UsersCommitted{$UID} = 1;
567 } elsif ($Type eq 'A') { # Added
568 $AddedFiles{$Filename} = 1;
569 $UsersCommitted{$UID} = 1;
570 } elsif ($Type eq 'R') { # Removed
571 $RemovedFiles{$Filename} = 1;
572 $UsersCommitted{$UID} = 1;
574 $UsersUpdated{$UID} = 1;
579 my $UserCommitList = join "\n", sort keys %UsersCommitted;
580 my $UserUpdateList = join "\n", sort keys %UsersUpdated;
581 my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
582 my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
583 my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
586 my $SingleSourceProgramsTable = "!";
587 my $MultiSourceProgramsTable = "!";
588 my $ExternalProgramsTable = "!";
594 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
596 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
598 # Run the programs tests... creating a report.nightly.html file
600 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
601 . "TEST=nightly > $ProgramTestLog 2>&1";
603 system "gunzip ${ProgramTestLog}.gz";
607 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
609 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
610 print "ERROR TESTING\n";
611 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
614 "<font color=white><h2>Makefile error running tests!</h2></font>";
615 print "ERROR TESTING\n";
618 $ProgramsTable = ReadFile "report.nightly.html";
621 # Create a list of the tests which were run...
623 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
624 . "| sort > $Prefix-$SubDir-Tests.txt";
627 # Compress the test output
628 system "gzip -f $ProgramTestLog";
629 ChangeDir( "../../..", "Programs Test Parent Directory" );
630 return $ProgramsTable;
633 # If we built the tree successfully, run the nightly programs tests...
636 print "SingleSource TEST STAGE\n";
638 $SingleSourceProgramsTable = TestDirectory("SingleSource");
640 print "MultiSource TEST STAGE\n";
642 $MultiSourceProgramsTable = TestDirectory("MultiSource");
643 if ( ! $NOEXTERNALS ) {
645 print "External TEST STAGE\n";
647 $ExternalProgramsTable = TestDirectory("External");
648 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
649 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
651 $ExternalProgramsTable = '<tr><td>External TEST STAGE SKIPPED</td></tr>';
653 print "External TEST STAGE SKIPPED\n";
655 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
656 " | sort > $Prefix-Tests.txt";
660 if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
661 my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
664 $TestsAdded = "<b>error testing</b><br>";
665 $TestsRemoved = "<b>error testing</b><br>";
666 $TestsFixed = "<b>error testing</b><br>";
667 $TestsBroken = "<b>error testing</b><br>";
669 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
671 my @RawTestsAddedArray = split '\n', $RTestsAdded;
672 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
674 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
675 @RawTestsRemovedArray;
676 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
679 foreach $Test (keys %NewTests) {
680 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
681 $TestsAdded = "$TestsAdded$Test\n";
683 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
684 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
686 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
690 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
691 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
694 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
695 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
696 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
697 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
699 $TestsAdded = AddPreTag $TestsAdded;
700 $TestsRemoved = AddPreTag $TestsRemoved;
701 $TestsFixed = AddPreTag $TestsFixed;
702 $TestsBroken = AddPreTag $TestsBroken;
706 # If we built the tree successfully, runs of the Olden suite with
707 # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
709 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
710 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
711 $MachCodeSize) = ("","","","","","","");
712 if (!$NORUNNINGTESTS) {
713 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
714 "Olden Test Directory");
716 # Clean out previous results...
717 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
719 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
720 # GET_STABLE_NUMBERS enabled!
721 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
722 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
723 system "cp report.nightly.raw.out $OldenTestsLog";
725 system "gunzip ${OldenTestsLog}.gz";
728 # Now we know we have $OldenTestsLog as the raw output file. Split
729 # it up into records and read the useful information.
730 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
731 shift @Records; # Delete the first (garbage) record
733 # Loop over all of the records, summarizing them into rows for the running
735 my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
736 foreach $Rec (@Records) {
737 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
738 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
739 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
740 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
741 my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
742 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
744 $NATTime .= " " . FormatTime($rNATTime);
745 $CBETime .= " " . FormatTime($rCBETime);
746 $LLCTime .= " " . FormatTime($rLLCTime);
747 $JITTime .= " " . FormatTime($rJITTime);
748 $OptTime .= " $rOptTime";
749 $BytecodeSize .= " $rBytecodeSize";
752 # Now that we have all of the numbers we want, add them to the running totals
754 AddRecord($NATTime, "running_Olden_nat_time.txt");
755 AddRecord($CBETime, "running_Olden_cbe_time.txt");
756 AddRecord($LLCTime, "running_Olden_llc_time.txt");
757 AddRecord($JITTime, "running_Olden_jit_time.txt");
758 AddRecord($OptTime, "running_Olden_opt_time.txt");
759 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
761 system "gzip -f $OldenTestsLog";
766 # Get a list of the previous days that we can link to...
768 my @PrevDays = map {s/.html//; $_} GetDir ".html";
770 if ((scalar @PrevDays) > 20) {
771 splice @PrevDays, 20; # Trim down list to something reasonable...
774 # Format list for sidebar
775 my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
778 # Start outputting files into the web directory
780 ChangeDir( $WebDir, "Web Directory" );
782 # Make sure we don't get errors running the nightly tester the first time
783 # because of files that don't exist.
784 Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
786 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
787 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
788 'running_Olden_jit_time.txt');
790 # Add information to the files which accumulate information for graphs...
791 AddRecord($LOC, "running_loc.txt");
792 AddRecord($BuildTime, "running_build_time.txt");
795 print "GRAPH GENERATION STAGE\n";
798 # Rebuild the graphs now...
800 $GNUPLOT = "/usr/bin/gnuplot";
801 $GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
802 system ("$GNUPLOT", $PlotScriptFilename);
805 # Remove the cvs tree...
807 system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
809 print "\nUSERS WHO COMMITTED:\n " . (join "\n ", sort keys %UsersCommitted) . "\n"
810 if (scalar %UsersCommitted);
812 print "\nADDED FILES:\n " . (join "\n ", sort keys %AddedFiles) . "\n"
813 if (scalar %AddedFiles);
815 print "\nCHANGED FILES:\n " . (join "\n ", sort keys %ModifiedFiles) . "\n"
816 if (scalar %ModifiedFiles);
818 print "\nREMOVED FILES:\n " . (join "\n ", sort keys %RemovedFiles) . "\n"
819 if (scalar %RemovedFiles);
822 # Print out information...
825 print "DateString: $DateString\n";
826 print "CVS Checkout: $CVSCheckoutTime seconds\n";
827 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
828 print "Build Time: $BuildTime seconds\n";
829 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
831 print "WARNINGS:\n $WarningsList\n";
832 print "Previous Days =\n $PrevDaysList\n";
837 # Output the files...
841 print "OUTPUT STAGE\n";
845 my $TestFinishTime = gmtime() . " GMT<br>" . localtime() . " (local)";
847 my $TestPlatform = `uname -a`;
848 eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
849 WriteFile "$DATE.html", $Output;
850 system ( "ln -sf $DATE.html index.html" );
852 # Change the index.html symlink...