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 # -enable-llcbeta Enable testing of beta features in llc.
26 # -disable-llc Disable LLC tests in the nightly tester.
27 # -disable-jit Disable JIT tests in the nightly tester.
28 # -verbose Turn on some debug output
29 # -debug Print information useful only to maintainers of this script.
30 # -nice Checkout/Configure/Build with "nice" to reduce impact
32 # -f2c Next argument specifies path to F2C utility
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
36 # -cvstag Check out a specific CVS tag to build LLVM (useful for
37 # testing release branches)
38 # -target Specify the target triplet
39 # -cflags Next argument specifies that C compilation options that
40 # override the default.
41 # -cxxflags Next argument specifies that C++ compilation options that
42 # override the default.
43 # -ldflags Next argument specifies that linker options that override
46 # ---------------- Options to configure llvm-test ----------------------------
47 # -spec2000path Path to the benchspec directory in the SPEC 2000 distro
48 # -spec95path Path to the benchspec directory in the SPEC 95 distro.
49 # -povraypath Path to the povray sources
50 # -namdpath Path to the namd sources
52 # CVSROOT is the CVS repository from which the tree will be checked out,
53 # specified either in the full :method:user@host:/dir syntax, or
54 # just /dir if using a local repo.
55 # BUILDDIR is the directory where sources for this test run will be checked out
56 # AND objects for this test run will be built. This directory MUST NOT
57 # exist before the script is run; it will be created by the cvs checkout
58 # process and erased (unless -noremove is specified; see above.)
59 # WEBDIR is the directory into which the test results web page will be written,
60 # AND in which the "index.html" is assumed to be a symlink to the most recent
61 # copy of the results. This directory will be created if it does not exist.
62 # LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
63 # to. This is the same as you would have for a normal LLVM build.
65 use POSIX qw(strftime);
68 my $HOME = $ENV{'HOME'};
69 my $CVSRootDir = $ENV{'CVSROOT'};
70 $CVSRootDir = "/home/vadve/shared/PublicCVS"
72 my $BuildDir = $ENV{'BUILDDIR'};
73 $BuildDir = "$HOME/buildtest"
75 my $WebDir = $ENV{'WEBDIR'};
76 $WebDir = "$HOME/cvs/testresults-X86"
79 # Calculate the date prefix...
81 my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
82 my $DateString = strftime "%B %d, %Y", localtime;
83 my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
85 # Command line argument settings...
89 my $NORUNNINGTESTS = 0;
92 my $PROGTESTOPTS = "";
95 my $CONFIGUREARGS = "";
96 my $CVSCOOPT = "-APR";
100 my $LLVMTESTCONFIGARGS = "";
103 if (open (FILE, $_[0])) {
110 print "Could not open file '$_[0]' for reading!";
115 sub WriteFile { # (filename, contents)
116 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!";
121 sub GetRegex { # (Regex with ()'s, value)
132 foreach my $file (@files) {
134 open (FILE, ">$file") or warn "Could not create new file $file";
137 utime $now, $now, $file;
142 my ($Val, $Filename) = @_;
144 if (open FILE, "$WebDir/$Filename") {
145 @Records = grep !/$DATE/, split "\n", <FILE>;
148 push @Records, "$DATE: $Val";
149 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
152 sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
154 if (length) { return "<ul><tt>$_</tt></ul>"; } else { "<b>none</b><br>"; }
157 sub ChangeDir { # directory, logical name
158 my ($dir,$name) = @_;
160 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
161 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
164 sub CopyFile { #filename, newfile
165 my ($file, $newfile) = @_;
167 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
168 copy($file, $newfile);
174 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
179 # DiffFiles - Diff the current version of the file against the last version of
180 # the file, reporting things added and removed. This is used to report, for
181 # example, added and removed warnings. This returns a pair (added, removed)
185 my @Others = GetDir $Suffix;
186 if (@Others == 0) { # No other files? We added all entries...
187 return (`cat $WebDir/$DATE$Suffix`, "");
189 # Diff the files now...
190 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
191 my $Added = join "\n", grep /^</, @Diffs;
192 my $Removed = join "\n", grep /^>/, @Diffs;
194 $Removed =~ s/^> //gm;
195 return ($Added, $Removed);
198 # FormatTime - Convert a time from 1m23.45 into 83.45
201 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
202 $Time = sprintf("%7.4f", $1*60.0+$2);
208 my ($Regex, $Num, $Regex2, $File) = @_;
209 my @Items = split "\n", `grep '$Regex' $File`;
210 return GetRegex $Regex2, $Items[$Num];
213 sub GetDejagnuTestResults { # (filename, log)
214 my ($filename, $DejagnuLog) = @_;
217 $/ = "\n"; #Make sure we're going line at a time.
219 print "DEJAGNU TEST RESULTS:\n";
221 if (open SRCHFILE, $filename) {
222 # Process test results
224 my $should_break = 1;
227 while ( <SRCHFILE> ) {
228 if ( length($_) > 1 ) {
230 if ( m/^XPASS:/ || m/^FAIL:/ ) {
233 push(@lines, "<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n");
236 push(@lines, "<b>$_</b><br/>\n");
239 push(@lines, "</li><li><b>$_</b><br/>\n");
242 } elsif ( m/Summary/ ) {
244 push(@lines, "<b>PERFECT!</b>");
247 push(@lines, "</li></ol>\n");
249 push(@lines, "<h3>STATISTICS</h3><pre>\n");
250 print "\nDEJAGNU STATISTICS:\n";
254 } elsif ( $readingsum ) {
261 push(@lines, "</pre>\n");
264 my $content = join("", @lines);
265 return "$content</li></ol>\n";
269 #####################################################################
271 #####################################################################
274 my $PlotScriptFilename = "";
277 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
279 last if /^--$/; # Stop processing arguments on --
281 # List command line options here...
282 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
283 if (/^-noremove$/) { $NOREMOVE = 1; next; }
284 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
285 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
286 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
287 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; }
288 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
289 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
290 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
291 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
292 $CONFIGUREARGS .= " --disable-jit"; next; }
293 if (/^-verbose$/) { $VERBOSE = 1; next; }
294 if (/^-debug$/) { $DEBUG = 1; next; }
295 if (/^-nice$/) { $NICE = "nice "; next; }
297 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
299 if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; }
300 if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; }
302 $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
304 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
306 $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next;
309 $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; shift; next;
312 $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; shift; next;
315 $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; shift; next;
317 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
318 if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
319 if (/^-spec2000path$/) {
320 $LLVMTESTCONFIGARGS .= " --enable-spec2000=$ARGV[0]"; shift; next;
322 if (/^-spec95path$/) {
323 $LLVMTESTCONFIGARGS .= " --enable-spec95=$ARGV[0]"; shift; next;
325 if (/^-povraypath$/) {
326 $LLVMTESTCONFIGARGS .= " --enable-povray=$ARGV[0]"; shift; next;
329 $LLVMTESTCONFIGARGS .= " --enable-namd=$ARGV[0]"; shift; next;
331 print "Unknown option: $_ : ignoring!\n";
334 if ($ENV{'LLVMGCCDIR'}) {
335 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
337 if ($CONFIGUREARGS !~ /--disable-jit/) {
338 $CONFIGUREARGS .= " --enable-jit";
341 die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
344 $CVSRootDir = $ARGV[0];
345 $BuildDir = $ARGV[1];
349 my $Prefix = "$WebDir/$DATE";
351 #define the file names we'll use
352 my $BuildLog = "$Prefix-Build-Log.txt";
353 my $CVSLog = "$Prefix-CVS-Log.txt";
354 my $OldenTestsLog = "$Prefix-Olden-tests.txt";
355 my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
356 my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
357 my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
358 my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
359 my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
360 my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
363 print "INITIALIZED\n";
364 print "CVS Root = $CVSRootDir\n";
365 print "BuildDir = $BuildDir\n";
366 print "WebDir = $WebDir\n";
367 print "Prefix = $Prefix\n";
368 print "CVSLog = $CVSLog\n";
369 print "BuildLog = $BuildLog\n";
374 warn "Warning: $WebDir did not exist; creating it.\n";
378 # Create the CVS repository directory
383 system "rm -rf $BuildDir";
385 die "CVS checkout directory $BuildDir already exists!";
388 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
391 ChangeDir( $BuildDir, "CVS checkout directory" );
395 # Check out the llvm tree, saving CVS messages to the cvs log...
398 # Use compression if going over ssh.
399 $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
400 my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
402 if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; }
403 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
404 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
405 ChangeDir( $BuildDir , "CVS Checkout directory") ;
408 ChangeDir( "llvm" , "llvm source directory") ;
411 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
412 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
415 if ( $Template eq "" ) {
416 $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html";
418 die "Template file $Template is not readable" if ( ! -r "$Template" );
420 if ( $PlotScriptFilename eq "" ) {
421 $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot";
423 die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" );
425 # Read in the HTML template file...
426 if ( $VERBOSE ) { print "READING TEMPLATE\n"; }
427 my $TemplateContents = ReadFile $Template;
430 # Get some static statistics about the current state of CVS
432 my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
433 my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
434 my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
435 $LOC = `utils/countloc.sh`;
438 # Build the entire tree, saving build messages to the build log
441 if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; }
442 my $EXTRAFLAGS = "--enable-spec --with-objroot=.$LLVMTESTCONFIGARGS";
443 system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
445 if ( $VERBOSE ) { print "BUILD STAGE\n"; }
446 # Build the entire tree, capturing the output into $BuildLog
447 system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1";
452 # Get some statistics about the build...
454 my @Linked = split '\n', `grep Linking $BuildLog`;
455 my $NumExecutables = scalar(grep(/executable/, @Linked));
456 my $NumLibraries = scalar(grep(!/executable/, @Linked));
457 my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
459 my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
460 my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
461 my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
462 my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
464 my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
465 my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
466 my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
467 my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
469 my $BuildError = 0, $BuildStatus = "OK";
470 if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
471 `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
472 $BuildStatus = "<h3><font color='red'>error: compilation " .
473 "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>";
475 print "\n***ERROR BUILDING TREE\n\n";
478 if ($BuildError) { $NODEJAGNU=1; }
480 my $DejangnuTestResults; # String containing the results of the dejagnu
482 if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
484 my $dejagnu_output = "$DejagnuTestsLog";
486 #Run the feature and regression tests, results are put into testrun.sum
487 #Full log in testrun.log
488 system "(time -p gmake $MAKEOPTS check) > $dejagnu_output 2>&1";
490 #Extract time of dejagnu tests
491 my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
492 my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
493 $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
494 $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
496 #Copy the testrun.log and testrun.sum to our webdir
497 CopyFile("test/testrun.log", $DejagnuLog);
498 CopyFile("test/testrun.sum", $DejagnuSum);
500 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
503 $DejagnuTestResults = "Skipped by user choice.";
504 $DejagnuTime = "0.0";
505 $DejagnuWallTime = "0.0";
509 print $DejagnuTestResults;
512 if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
514 # Get warnings from the build
516 my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
520 foreach $Warning (@Warn) {
521 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
522 $CurDir = $1; # Keep track of directory warning is in...
523 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
527 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
530 my $WarningsFile = join "\n", @Warnings;
531 my $WarningsList = AddPreTag $WarningsFile;
532 $WarningsFile =~ s/:[0-9]+:/::/g;
534 # Emit the warnings file, so we can diff...
535 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
536 my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
538 # Output something to stdout if something has changed
539 print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
540 print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
542 $WarningsAdded = AddPreTag $WarningsAdded;
543 $WarningsRemoved = AddPreTag $WarningsRemoved;
546 # Get some statistics about CVS commits over the current day...
548 if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
549 @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
550 #print join "\n", @CVSHistory; print "\n";
552 # Extract some information from the CVS history... use a hash so no duplicate
554 my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
556 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
558 # Loop over every record from the CVS history, filling in the hashes.
559 foreach $File (@CVSHistory) {
560 my ($Type, $Date, $UID, $Rev, $Filename);
561 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
562 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
563 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
564 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
565 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
566 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
568 print "UNMATCHABLE: $File\n";
571 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
573 if ($Filename =~ /^llvm/) {
574 if ($Type eq 'M') { # Modified
575 $ModifiedFiles{$Filename} = 1;
576 $UsersCommitted{$UID} = 1;
577 } elsif ($Type eq 'A') { # Added
578 $AddedFiles{$Filename} = 1;
579 $UsersCommitted{$UID} = 1;
580 } elsif ($Type eq 'R') { # Removed
581 $RemovedFiles{$Filename} = 1;
582 $UsersCommitted{$UID} = 1;
584 $UsersUpdated{$UID} = 1;
589 my $UserCommitList = join "\n", sort keys %UsersCommitted;
590 my $UserUpdateList = join "\n", sort keys %UsersUpdated;
591 my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles;
592 my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles;
593 my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles;
596 my $SingleSourceProgramsTable = "!";
597 my $MultiSourceProgramsTable = "!";
598 my $ExternalProgramsTable = "!";
604 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
606 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
608 # Run the programs tests... creating a report.nightly.html file
610 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html "
611 . "TEST=nightly > $ProgramTestLog 2>&1";
613 system "gunzip ${ProgramTestLog}.gz";
617 if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
619 $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>";
620 print "ERROR TESTING\n";
621 } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
624 "<font color=white><h2>Makefile error running tests!</h2></font>";
625 print "ERROR TESTING\n";
628 $ProgramsTable = ReadFile "report.nightly.html";
631 # Create a list of the tests which were run...
633 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
634 . "| sort > $Prefix-$SubDir-Tests.txt";
637 # Compress the test output
638 system "gzip -f $ProgramTestLog";
639 ChangeDir( "../../..", "Programs Test Parent Directory" );
640 return $ProgramsTable;
643 # If we built the tree successfully, run the nightly programs tests...
646 print "SingleSource TEST STAGE\n";
648 $SingleSourceProgramsTable = TestDirectory("SingleSource");
650 print "MultiSource TEST STAGE\n";
652 $MultiSourceProgramsTable = TestDirectory("MultiSource");
653 if ( ! $NOEXTERNALS ) {
655 print "External TEST STAGE\n";
657 $ExternalProgramsTable = TestDirectory("External");
658 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
659 " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
661 $ExternalProgramsTable = '<tr><td>External TEST STAGE SKIPPED</td></tr>';
663 print "External TEST STAGE SKIPPED\n";
665 system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ".
666 " | sort > $Prefix-Tests.txt";
670 if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; }
671 my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
674 $TestsAdded = "<b>error testing</b><br>";
675 $TestsRemoved = "<b>error testing</b><br>";
676 $TestsFixed = "<b>error testing</b><br>";
677 $TestsBroken = "<b>error testing</b><br>";
679 my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
681 my @RawTestsAddedArray = split '\n', $RTestsAdded;
682 my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
684 my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
685 @RawTestsRemovedArray;
686 my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
689 foreach $Test (keys %NewTests) {
690 if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
691 $TestsAdded = "$TestsAdded$Test\n";
693 if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
694 $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
696 $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
700 foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
701 $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
704 print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
705 print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
706 print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
707 print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
709 $TestsAdded = AddPreTag $TestsAdded;
710 $TestsRemoved = AddPreTag $TestsRemoved;
711 $TestsFixed = AddPreTag $TestsFixed;
712 $TestsBroken = AddPreTag $TestsBroken;
716 # If we built the tree successfully, runs of the Olden suite with
717 # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
719 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
720 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
721 $MachCodeSize) = ("","","","","","","");
722 if (!$NORUNNINGTESTS) {
723 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
724 "Olden Test Directory");
726 # Clean out previous results...
727 system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1";
729 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
730 # GET_STABLE_NUMBERS enabled!
731 system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " .
732 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
733 system "cp report.nightly.raw.out $OldenTestsLog";
735 system "gunzip ${OldenTestsLog}.gz";
738 # Now we know we have $OldenTestsLog as the raw output file. Split
739 # it up into records and read the useful information.
740 my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
741 shift @Records; # Delete the first (garbage) record
743 # Loop over all of the records, summarizing them into rows for the running
745 my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
746 foreach $Rec (@Records) {
747 my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
748 my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
749 my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
750 my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
751 my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
752 my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
754 $NATTime .= " " . FormatTime($rNATTime);
755 $CBETime .= " " . FormatTime($rCBETime);
756 $LLCTime .= " " . FormatTime($rLLCTime);
757 $JITTime .= " " . FormatTime($rJITTime);
758 $OptTime .= " $rOptTime";
759 $BytecodeSize .= " $rBytecodeSize";
762 # Now that we have all of the numbers we want, add them to the running totals
764 AddRecord($NATTime, "running_Olden_nat_time.txt");
765 AddRecord($CBETime, "running_Olden_cbe_time.txt");
766 AddRecord($LLCTime, "running_Olden_llc_time.txt");
767 AddRecord($JITTime, "running_Olden_jit_time.txt");
768 AddRecord($OptTime, "running_Olden_opt_time.txt");
769 AddRecord($BytecodeSize, "running_Olden_bytecode.txt");
771 system "gzip -f $OldenTestsLog";
776 # Get a list of the previous days that we can link to...
778 my @PrevDays = map {s/.html//; $_} GetDir ".html";
780 if ((scalar @PrevDays) > 20) {
781 splice @PrevDays, 20; # Trim down list to something reasonable...
784 # Format list for sidebar
785 my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
788 # Start outputting files into the web directory
790 ChangeDir( $WebDir, "Web Directory" );
792 # Make sure we don't get errors running the nightly tester the first time
793 # because of files that don't exist.
794 Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
796 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
797 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
798 'running_Olden_jit_time.txt');
800 # Add information to the files which accumulate information for graphs...
801 AddRecord($LOC, "running_loc.txt");
802 AddRecord($BuildTime, "running_build_time.txt");
805 print "GRAPH GENERATION STAGE\n";
808 # Rebuild the graphs now...
810 $GNUPLOT = "/usr/bin/gnuplot";
811 $GNUPLOT = "gnuplot" if ! -x $GNUPLOT;
812 system ("$GNUPLOT", $PlotScriptFilename);
815 # Remove the cvs tree...
817 system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
819 print "\nUSERS WHO COMMITTED:\n " . (join "\n ", sort keys %UsersCommitted) . "\n"
820 if (scalar %UsersCommitted);
822 print "\nADDED FILES:\n " . (join "\n ", sort keys %AddedFiles) . "\n"
823 if (scalar %AddedFiles);
825 print "\nCHANGED FILES:\n " . (join "\n ", sort keys %ModifiedFiles) . "\n"
826 if (scalar %ModifiedFiles);
828 print "\nREMOVED FILES:\n " . (join "\n ", sort keys %RemovedFiles) . "\n"
829 if (scalar %RemovedFiles);
832 # Print out information...
835 print "DateString: $DateString\n";
836 print "CVS Checkout: $CVSCheckoutTime seconds\n";
837 print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n";
838 print "Build Time: $BuildTime seconds\n";
839 print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n";
841 print "WARNINGS:\n $WarningsList\n";
842 print "Previous Days =\n $PrevDaysList\n";
847 # Output the files...
851 print "OUTPUT STAGE\n";
855 my $TestFinishTime = gmtime() . " GMT<br>" . localtime() . " (local)";
857 my $TestPlatform = `uname -a`;
858 eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n";
859 WriteFile "$DATE.html", $Output;
861 # Remove the symlink before creating it for systems that don't have "ln -sf".
862 system ("rm index.html");
863 system ("ln -s $DATE.html index.html");
865 # Change the index.html symlink...