1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Added the ability to run Dejagnu tests.

llvm-svn: 18074
This commit is contained in:
Tanya Lattner 2004-11-21 00:02:40 +00:00
parent 6d1fb33657
commit 9ee9ff4ea2
2 changed files with 100 additions and 1 deletions

View File

@ -21,6 +21,7 @@
# LARGE_PROBLEM_SIZE enabled.
# -noexternals Do not run the external tests (for cases where povray
# or SPEC are not installed)
# -rundejagnu Runs features and regressions using Dejagnu
# -parallel Run two parallel jobs with GNU Make.
# -release Build an LLVM Release version
# -pedantic Enable additional GCC warnings to detect possible errors.
@ -50,6 +51,7 @@
# to. This is the same as you would have for a normal LLVM build.
#
use POSIX qw(strftime);
use File::Copy;
my $HOME = $ENV{'HOME'};
my $CVSRootDir = $ENV{'CVSROOT'};
@ -82,6 +84,7 @@ my $VERBOSE = 0;
my $DEBUG = 0;
my $CONFIGUREARGS = "";
my $NICE = "";
my $RUNDEJAGNU = 0;
sub ReadFile {
if (open (FILE, $_[0])) {
@ -145,6 +148,13 @@ sub ChangeDir { # directory, logical name
chdir($dir) || die "Cannot change directory to: $name ($dir) ";
}
sub CopyFile { #filename, newfile
my ($file, $newfile) = @_;
chomp($file);
if ($VERBOSE) { print "Copying $file to $newfile\n"; }
copy($file, $newfile);
}
sub GetDir {
my $Suffix = shift;
opendir DH, $WebDir;
@ -248,6 +258,52 @@ sub GetQMTestResults { # (filename)
return "$content</li></ol>\n";
}
sub GetDejagnuTestResults { # (filename, log)
my ($filename, $DejagnuLog) = @_;
my @lines;
my $firstline;
$/ = "\n"; #Make sure we're going line at a time.
if (open SRCHFILE, $filename) {
# Process test results
push(@lines,"<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n");
my $first_list = 1;
my $should_break = 1;
my $nocopy = 0;
my $readingsum = 0;
while ( <SRCHFILE> ) {
if ( length($_) > 1 ) {
chomp($_);
if ( m/^XPASS:/ || m/^FAIL:/ ) {
$nocopy = 0;
if ( $first_list ) {
$first_list = 0;
$should_break = 1;
push(@lines,"<b>$_</b><br/>\n");
} else {
push(@lines,"</li><li><b>$_</b><br/>\n");
}
} elsif ( m/Summary/ ) {
if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); }
push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n");
$should_break = 0;
$nocopy = 0;
$readingsum = 1;
} elsif ( $readingsum ) {
push(@lines,"$_\n");
}
}
}
}
push(@lines, "</pre>\n");
close SRCHFILE;
#add link to complete testing log
push(@lines, "<p>A complete log of testing <a href=\"$DejagnuLog\">Feature and Regression</a> is available for further analysis.</p>\n");
my $content = join("",@lines);
return "$content</li></ol>\n";
}
#####################################################################
## MAIN PROGRAM
@ -291,6 +347,7 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
$CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;
}
if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
if(/^-runDejagnu$/) { $RUNDEJAGNU = 1; next; }
print "Unknown option: $_ : ignoring!\n";
}
@ -321,6 +378,9 @@ my $OldenTestsLog = "$Prefix-Olden-tests.txt";
my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
if ($VERBOSE) {
print "INITIALIZED\n";
@ -434,7 +494,7 @@ if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
if ($VERBOSE) { print "BUILD ERROR\n"; }
}
if ($BuildError) { $NOFEATURES = 1; $NOREGRESSIONS = 1; }
if ($BuildError) { $NOFEATURES = 1; $NOREGRESSIONS = 1; $RUNDEJAGNU=0; }
# Get results of feature tests.
my $FeatureTestResults; # String containing the results of the feature tests
@ -483,9 +543,37 @@ if (!$NOREGRESSIONS) {
$RegressionWallTime = "0.0";
}
my $DejangnuTestResults; # String containing the results of the dejagnu
if($RUNDEJAGNU) {
if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; }
my $dejagnu_output = "$DejagnuTestsLog";
#Run the feature and regression tests, results are put into testrun.sum
#Full log in testrun.log
system "time -p gmake $MAKEOPTS check-dejagnu >& $dejagnu_output";
#Extract time of dejagnu tests
my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
$DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
$DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
#Copy the testrun.log and testrun.sum to our webdir
CopyFile("test/testrun.log", $DejagnuLog);
CopyFile("test/testrun.sum", $DejagnuSum);
$DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
} else {
$DejagnuTestResults = "Skipped by user choice.";
$DejagnuTime = "0.0";
$DejagnuWallTime = "0.0";
}
if ($DEBUG) {
print $FeatureTestResults;
print $RegressionTestResults;
print $DejagnuTestResults;
}
if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }

View File

@ -18,6 +18,7 @@
<a href="#Programs">Programs</a><br>
<a href="#Feature">Feature</a><br>
<a href="#Regression">Regression</a><br>
<a href="#Dejagnu">Dejagnu Tests</a><br>
</td></tr></table></td></tr></table>
<p>
@ -71,6 +72,7 @@
<tr><td>Build CVS Tree</td><td>$BuildTime</td><td>$BuildWallTime</td></tr>
<tr><td>Run Feature Tests</td><td>$FeatureTime</td><td>$FeatureWallTime</td></tr>
<tr><td>Run Regression Tests</td><td>$RegressionTime</td><td>$RegressionWallTime</td></tr>
<tr><td>Run Dejagnu Tests</td><td>$DejagnuTime</td><td>$DejagnuWallTime</td></tr>
</table></li>
<li>Number of object files compiled: <b>$NumObjects</b></li>
<li>Number of libraries linked: <b>$NumLibraries</b></li>
@ -256,4 +258,13 @@ $FeatureTestResults
<br/>
$RegressionTestResults
<br/><br/><center>
<table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#000000">
<table border="0" cellpadding="10" cellspacing="0"><tr><td bgcolor="#DDAA77"
<font size=+2 face=Verdana><b><a name="Dejagnu">Dejagnu Test Results</font></b>
</td></tr></table></td></tr></table></center>
<br/>
$DejagnuTestResults
</td></tr></html>