mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-08 18:30:04 +00:00
NNT: Lift conditional logic out of test steps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84494 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5381eb72e6
commit
1409c131b6
@ -499,78 +499,63 @@ sub SendData {
|
|||||||
|
|
||||||
# Create the source repository directory.
|
# Create the source repository directory.
|
||||||
sub CheckoutSource {
|
sub CheckoutSource {
|
||||||
if (!$NOCHECKOUT) {
|
if (-d $BuildDir) {
|
||||||
if (-d $BuildDir) {
|
if (!$NOREMOVE) {
|
||||||
if (!$NOREMOVE) {
|
if ( $VERBOSE ) {
|
||||||
if ( $VERBOSE ) {
|
print "Build directory exists! Removing it\n";
|
||||||
print "Build directory exists! Removing it\n";
|
|
||||||
}
|
|
||||||
system "rm -rf $BuildDir";
|
|
||||||
mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
|
|
||||||
} else {
|
|
||||||
if ( $VERBOSE ) {
|
|
||||||
print "Build directory exists!\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
system "rm -rf $BuildDir";
|
||||||
mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
|
mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
|
||||||
|
} else {
|
||||||
|
if ( $VERBOSE ) {
|
||||||
|
print "Build directory exists!\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
|
||||||
|
}
|
||||||
|
|
||||||
ChangeDir( $BuildDir, "checkout directory" );
|
ChangeDir( $BuildDir, "checkout directory" );
|
||||||
my $SVNCMD = "$NICE svn co --non-interactive";
|
my $SVNCMD = "$NICE svn co --non-interactive";
|
||||||
RunLoggedCommand("( time -p $SVNCMD $SVNURL/llvm/trunk llvm; cd llvm/projects ; " .
|
RunLoggedCommand("( time -p $SVNCMD $SVNURL/llvm/trunk llvm; cd llvm/projects ; " .
|
||||||
" $SVNCMD $TestSVNURL/test-suite/trunk llvm-test )", $COLog,
|
" $SVNCMD $TestSVNURL/test-suite/trunk llvm-test )", $COLog,
|
||||||
"CHECKOUT LLVM");
|
"CHECKOUT LLVM");
|
||||||
if ($WITHCLANG) {
|
if ($WITHCLANG) {
|
||||||
RunLoggedCommand("( cd llvm/tools ; " .
|
RunLoggedCommand("( cd llvm/tools ; " .
|
||||||
" $SVNCMD $SVNURL/cfe/trunk clang )", $COLog,
|
" $SVNCMD $SVNURL/cfe/trunk clang )", $COLog,
|
||||||
"CHECKOUT CLANG");
|
"CHECKOUT CLANG");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build the entire tree, saving build messages to the build log.
|
# Build the entire tree, saving build messages to the build log. Returns false
|
||||||
|
# on build failure.
|
||||||
sub BuildLLVM {
|
sub BuildLLVM {
|
||||||
if (!$NOCHECKOUT && !$NOBUILD) {
|
my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
|
||||||
my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
|
RunLoggedCommand("(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) ",
|
||||||
RunLoggedCommand("(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) ",
|
$ConfigureLog, "CONFIGURE");
|
||||||
$ConfigureLog, "CONFIGURE");
|
# Build the entire tree, capturing the output into $BuildLog
|
||||||
# Build the entire tree, capturing the output into $BuildLog
|
RunAppendingLoggedCommand("($NICE $MAKECMD clean)", $BuildLog, "BUILD CLEAN");
|
||||||
RunAppendingLoggedCommand("($NICE $MAKECMD clean)", $BuildLog, "BUILD CLEAN");
|
RunAppendingLoggedCommand("(time -p $NICE $MAKECMD $MAKEOPTS)", $BuildLog, "BUILD");
|
||||||
RunAppendingLoggedCommand("(time -p $NICE $MAKECMD $MAKEOPTS)", $BuildLog, "BUILD");
|
|
||||||
|
if (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
|
||||||
|
`grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l` + 0) {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for build error.
|
return 1;
|
||||||
my $HadError = 0, $Status = "OK";
|
|
||||||
if ($NOBUILD) {
|
|
||||||
$Status = "Skipped by user";
|
|
||||||
}
|
|
||||||
elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
|
|
||||||
`grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
|
|
||||||
$Status = "Error: compilation aborted";
|
|
||||||
$HadError = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($HadError, $Status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Running dejagnu tests and save results to log.
|
# Running dejagnu tests and save results to log.
|
||||||
sub RunDejaGNUTests {
|
sub RunDejaGNUTests {
|
||||||
my $Res = "Dejagnu skipped by user choice.";
|
# Run the feature and regression tests, results are put into testrun.sum and
|
||||||
|
# the full log in testrun.log.
|
||||||
|
RunLoggedCommand("(time -p $MAKECMD $MAKEOPTS check)", $DejagnuLog, "DEJAGNU");
|
||||||
|
|
||||||
if (!$NODEJAGNU) {
|
# Copy the testrun.log and testrun.sum to our webdir.
|
||||||
#Run the feature and regression tests, results are put into testrun.sum
|
CopyFile("test/testrun.log", $DejagnuLog);
|
||||||
#Full log in testrun.log
|
CopyFile("test/testrun.sum", $DejagnuSum);
|
||||||
RunLoggedCommand("(time -p $MAKECMD $MAKEOPTS check)", $DejagnuLog, "DEJAGNU");
|
|
||||||
|
|
||||||
#Copy the testrun.log and testrun.sum to our webdir
|
return GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
|
||||||
CopyFile("test/testrun.log", $DejagnuLog);
|
|
||||||
CopyFile("test/testrun.sum", $DejagnuSum);
|
|
||||||
|
|
||||||
$Res = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $Res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run the named tests (i.e. "SingleSource" "MultiSource" "External")
|
# Run the named tests (i.e. "SingleSource" "MultiSource" "External")
|
||||||
@ -581,35 +566,28 @@ sub TestDirectory {
|
|||||||
|
|
||||||
my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
|
my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
|
||||||
|
|
||||||
# Run the programs tests... creating a report.nightly.csv file
|
# Run the programs tests... creating a report.nightly.csv file.
|
||||||
my $LLCBetaOpts = "";
|
my $LLCBetaOpts = "";
|
||||||
if (!$NOTEST) {
|
if( $VERBOSE) {
|
||||||
if( $VERBOSE) {
|
print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
|
||||||
print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
|
"$TESTFLAGS TEST=nightly > $ProgramTestLog 2>&1\n";
|
||||||
"$TESTFLAGS TEST=nightly > $ProgramTestLog 2>&1\n";
|
|
||||||
}
|
|
||||||
RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
|
|
||||||
"$TESTFLAGS TEST=nightly",
|
|
||||||
$ProgramTestLog, "TEST DIRECTORY $SubDir");
|
|
||||||
$LLCBetaOpts = `$MAKECMD print-llcbeta-option`;
|
|
||||||
}
|
}
|
||||||
|
RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
|
||||||
|
"$TESTFLAGS TEST=nightly",
|
||||||
|
$ProgramTestLog, "TEST DIRECTORY $SubDir");
|
||||||
|
$LLCBetaOpts = `$MAKECMD print-llcbeta-option`;
|
||||||
|
|
||||||
my $ProgramsTable;
|
my $ProgramsTable;
|
||||||
if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) {
|
if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) {
|
||||||
$TestError = 1;
|
|
||||||
$ProgramsTable="Error running test $SubDir\n";
|
$ProgramsTable="Error running test $SubDir\n";
|
||||||
print "ERROR TESTING\n";
|
print "ERROR TESTING\n";
|
||||||
} elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
|
} elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
|
||||||
$TestError = 1;
|
|
||||||
$ProgramsTable="Makefile error running tests $SubDir!\n";
|
$ProgramsTable="Makefile error running tests $SubDir!\n";
|
||||||
print "ERROR TESTING\n";
|
print "ERROR TESTING\n";
|
||||||
} else {
|
} else {
|
||||||
$TestError = 0;
|
# Create a list of the tests which were run...
|
||||||
#
|
system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
|
||||||
# Create a list of the tests which were run...
|
"| sort > $Prefix-$SubDir-Tests.txt";
|
||||||
#
|
|
||||||
system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
|
|
||||||
"| sort > $Prefix-$SubDir-Tests.txt";
|
|
||||||
}
|
}
|
||||||
$ProgramsTable = ReadFile "report.nightly.csv";
|
$ProgramsTable = ReadFile "report.nightly.csv";
|
||||||
|
|
||||||
@ -620,47 +598,45 @@ sub TestDirectory {
|
|||||||
# Run all the nightly tests and return the program tables and the number of
|
# Run all the nightly tests and return the program tables and the number of
|
||||||
# passes, fails, and xfails.
|
# passes, fails, and xfails.
|
||||||
sub RunNightlyTest() {
|
sub RunNightlyTest() {
|
||||||
if (!$BuildError) {
|
($SSProgs, $llcbeta_options) = TestDirectory("SingleSource");
|
||||||
($SSProgs, $llcbeta_options) = TestDirectory("SingleSource");
|
WriteFile "$Prefix-SingleSource-Performance.txt", $SSProgs;
|
||||||
WriteFile "$Prefix-SingleSource-Performance.txt", $SSProgs;
|
($MSProgs, $llcbeta_options) = TestDirectory("MultiSource");
|
||||||
($MSProgs, $llcbeta_options) = TestDirectory("MultiSource");
|
WriteFile "$Prefix-MultiSource-Performance.txt", $MSProgs;
|
||||||
WriteFile "$Prefix-MultiSource-Performance.txt", $MSProgs;
|
if ( ! $NOEXTERNALS ) {
|
||||||
if ( ! $NOEXTERNALS ) {
|
($ExtProgs, $llcbeta_options) = TestDirectory("External");
|
||||||
($ExtProgs, $llcbeta_options) = TestDirectory("External");
|
WriteFile "$Prefix-External-Performance.txt", $ExtProgs;
|
||||||
WriteFile "$Prefix-External-Performance.txt", $ExtProgs;
|
system "cat $Prefix-SingleSource-Tests.txt " .
|
||||||
system "cat $Prefix-SingleSource-Tests.txt " .
|
"$Prefix-MultiSource-Tests.txt ".
|
||||||
"$Prefix-MultiSource-Tests.txt ".
|
"$Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
|
||||||
"$Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
|
system "cat $Prefix-SingleSource-Performance.txt " .
|
||||||
system "cat $Prefix-SingleSource-Performance.txt " .
|
"$Prefix-MultiSource-Performance.txt ".
|
||||||
"$Prefix-MultiSource-Performance.txt ".
|
"$Prefix-External-Performance.txt | sort > $Prefix-Performance.txt";
|
||||||
"$Prefix-External-Performance.txt | sort > $Prefix-Performance.txt";
|
} else {
|
||||||
} else {
|
$ExtProgs = "External TEST STAGE SKIPPED\n";
|
||||||
$ExtProgs = "External TEST STAGE SKIPPED\n";
|
if ( $VERBOSE ) {
|
||||||
if ( $VERBOSE ) {
|
print "External TEST STAGE SKIPPED\n";
|
||||||
print "External TEST STAGE SKIPPED\n";
|
|
||||||
}
|
|
||||||
system "cat $Prefix-SingleSource-Tests.txt " .
|
|
||||||
"$Prefix-MultiSource-Tests.txt ".
|
|
||||||
" | sort > $Prefix-Tests.txt";
|
|
||||||
system "cat $Prefix-SingleSource-Performance.txt " .
|
|
||||||
"$Prefix-MultiSource-Performance.txt ".
|
|
||||||
" | sort > $Prefix-Performance.txt";
|
|
||||||
}
|
}
|
||||||
|
system "cat $Prefix-SingleSource-Tests.txt " .
|
||||||
|
"$Prefix-MultiSource-Tests.txt ".
|
||||||
|
" | sort > $Prefix-Tests.txt";
|
||||||
|
system "cat $Prefix-SingleSource-Performance.txt " .
|
||||||
|
"$Prefix-MultiSource-Performance.txt ".
|
||||||
|
" | sort > $Prefix-Performance.txt";
|
||||||
|
}
|
||||||
|
|
||||||
# Compile passes, fails, xfails.
|
# Compile passes, fails, xfails.
|
||||||
my @TestSuiteResultLines = split "\n", (ReadFile "$Prefix-Tests.txt");
|
my @TestSuiteResultLines = split "\n", (ReadFile "$Prefix-Tests.txt");
|
||||||
my ($Passes, $Fails, $XFails) = "";
|
my ($Passes, $Fails, $XFails) = "";
|
||||||
|
|
||||||
for ($x=0; $x < @TestSuiteResultLines; $x++) {
|
for ($x=0; $x < @TestSuiteResultLines; $x++) {
|
||||||
if (@TestSuiteResultLines[$x] =~ m/^PASS:/) {
|
if (@TestSuiteResultLines[$x] =~ m/^PASS:/) {
|
||||||
$Passes .= "$TestSuiteResultLines[$x]\n";
|
$Passes .= "$TestSuiteResultLines[$x]\n";
|
||||||
}
|
}
|
||||||
elsif (@TestSuiteResultLines[$x] =~ m/^FAIL:/) {
|
elsif (@TestSuiteResultLines[$x] =~ m/^FAIL:/) {
|
||||||
$Fails .= "$TestSuiteResultLines[$x]\n";
|
$Fails .= "$TestSuiteResultLines[$x]\n";
|
||||||
}
|
}
|
||||||
elsif (@TestSuiteResultLines[$x] =~ m/^XFAIL:/) {
|
elsif (@TestSuiteResultLines[$x] =~ m/^XFAIL:/) {
|
||||||
$XFails .= "$TestSuiteResultLines[$x]\n";
|
$XFails .= "$TestSuiteResultLines[$x]\n";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -675,16 +651,37 @@ sub RunNightlyTest() {
|
|||||||
|
|
||||||
$starttime = `date "+20%y-%m-%d %H:%M:%S"`;
|
$starttime = `date "+20%y-%m-%d %H:%M:%S"`;
|
||||||
|
|
||||||
CheckoutSource();
|
if (!$NOCHECKOUT) {
|
||||||
ChangeDir( $LLVMSrcDir , "llvm source directory") ;
|
CheckoutSource();
|
||||||
($BuildError, $BuildStatus) = BuildLLVM();
|
|
||||||
if ($BuildError) {
|
|
||||||
if( $VERBOSE) { print "\n***ERROR BUILDING TREE\n\n"; }
|
|
||||||
$NODEJAGNU=1;
|
|
||||||
}
|
}
|
||||||
my $DejagnuTestResults = RunDejaGNUTests();
|
|
||||||
|
# Build LLVM.
|
||||||
|
my $BuildError = 0, $BuildStatus = "OK";
|
||||||
|
ChangeDir( $LLVMSrcDir , "llvm source directory") ;
|
||||||
|
if ($NOCHECKOUT || $NOBUILD) {
|
||||||
|
$BuildStatus = "Skipped by user";
|
||||||
|
} else {
|
||||||
|
if (!BuildLLVM()) {
|
||||||
|
if( $VERBOSE) { print "\n***ERROR BUILDING TREE\n\n"; }
|
||||||
|
$BuildError = 1;
|
||||||
|
$BuildStatus = "Error: compilation aborted";
|
||||||
|
$NODEJAGNU=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run DejaGNU.
|
||||||
|
my $DejagnuTestResults = "Dejagnu skipped by user choice.";
|
||||||
|
if (!$NODEJAGNU && !$BuildError) {
|
||||||
|
$DejagnuTestResults = RunDejaGNUTests();
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run the llvm-test tests.
|
||||||
my ($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable,
|
my ($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable,
|
||||||
$passes, $fails, $xfails) = RunNightlyTest();
|
$passes, $fails, $xfails) = "";
|
||||||
|
if (!$NOTEST && !$BuildError) {
|
||||||
|
($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable,
|
||||||
|
$passes, $fails, $xfails) = RunNightlyTest();
|
||||||
|
}
|
||||||
|
|
||||||
$endtime = `date "+20%y-%m-%d %H:%M:%S"`;
|
$endtime = `date "+20%y-%m-%d %H:%M:%S"`;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user