NNT: Implement "config mode", use -config path/to/llvm-config

- This runs the nightly test and does all the submission logic, but using the
   LLVM build specified by the llvm-config.

 - Useful for, among other things, testing NNT itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84620 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-10-20 07:30:54 +00:00
parent f27413866a
commit 80dd453b74

View File

@ -246,51 +246,41 @@ if (@ARGV == 3) {
$WebDir = $ARGV[2]; $WebDir = $ARGV[2];
} }
if ($BuildDir eq "" or if ($CONFIG_PATH ne "") {
$WebDir eq "") { $BuildDir = "";
die("please specify a build directory, and a web directory"); $SVNURL = $TestSVNURL = "";
} if ($WebDir eq "") {
die("please specify a web directory");
}
} else {
if ($BuildDir eq "" or
$WebDir eq "") {
die("please specify a build directory, and a web directory");
}
}
if ($nickname eq "") { if ($nickname eq "") {
die ("Please invoke NewNightlyTest.pl with command line option " . die ("Please invoke NewNightlyTest.pl with command line option " .
"\"-nickname <nickname>\""); "\"-nickname <nickname>\"");
} }
if ($CONFIG_PATH ne "") {
die "error: -config mode is not yet implemented,";
}
############################################################## ##############################################################
# #
# Define the file names we'll use # Define the file names we'll use
# #
############################################################## ##############################################################
my $Prefix = "$WebDir/$DATE"; my $Prefix = "$WebDir/$DATE";
my $ConfigureLog = "$Prefix-Configure-Log.txt";
my $BuildLog = "$Prefix-Build-Log.txt";
my $COLog = "$Prefix-CVS-Log.txt";
my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz"; my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz"; my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz"; my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
my $DejagnuLog = "$Prefix-DejagnuTests-Log.txt";
if (! -d $WebDir) {
mkdir $WebDir, 0777 or die "Unable to create web directory: '$WebDir'.";
if($VERBOSE){
warn "$WebDir did not exist; creating it.\n";
}
}
if ($VERBOSE) { # These are only valid in non-config mode.
print "INITIALIZED\n"; my $ConfigureLog = "", $BuildLog = "", $COLog = "";
print "SVN URL = $SVNURL\n"; my $DejagnuLog = "", $DejagnuSum = "", $DejagnuLog = "";
print "COLog = $COLog\n";
print "BuildDir = $BuildDir\n"; # Are we in config mode?
print "WebDir = $WebDir\n"; my $ConfigMode = 0;
print "Prefix = $Prefix\n";
print "BuildLog = $BuildLog\n";
}
############################################################## ##############################################################
# #
@ -496,6 +486,7 @@ sub SendData {
# Create the source repository directory. # Create the source repository directory.
sub CheckoutSource { sub CheckoutSource {
die "Invalid call!" unless $ConfigMode == 0;
if (-d $BuildDir) { if (-d $BuildDir) {
if (!$NOREMOVE) { if (!$NOREMOVE) {
if ( $VERBOSE ) { if ( $VERBOSE ) {
@ -527,6 +518,7 @@ sub CheckoutSource {
# Build the entire tree, saving build messages to the build log. Returns false # Build the entire tree, saving build messages to the build log. Returns false
# on build failure. # on build failure.
sub BuildLLVM { sub BuildLLVM {
die "Invalid call!" unless $ConfigMode == 0;
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");
@ -544,6 +536,7 @@ sub BuildLLVM {
# Running dejagnu tests and save results to log. # Running dejagnu tests and save results to log.
sub RunDejaGNUTests { sub RunDejaGNUTests {
die "Invalid call!" unless $ConfigMode == 0;
# Run the feature and regression tests, results are put into testrun.sum and # Run the feature and regression tests, results are put into testrun.sum and
# the full log in testrun.log. # the full log in testrun.log.
system "rm -f test/testrun.log test/testrun.sum"; system "rm -f test/testrun.log test/testrun.sum";
@ -564,6 +557,12 @@ sub TestDirectory {
my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt"; my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
# Make sure to clean things if in non-config mode.
if ($ConfigMode == 1) {
RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS clean $TESTFLAGS",
$ProgramTestLog, "TEST DIRECTORY $SubDir");
}
# Run the programs tests... creating a report.nightly.csv file. # Run the programs tests... creating a report.nightly.csv file.
my $LLCBetaOpts = ""; my $LLCBetaOpts = "";
RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ". RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
@ -638,6 +637,53 @@ sub RunNightlyTest() {
return ($SSProgs, $MSProgs, $ExtProgs, $All, $Passes, $Fails, $XFails); return ($SSProgs, $MSProgs, $ExtProgs, $All, $Passes, $Fails, $XFails);
} }
##############################################################
#
# Initialize filenames
#
##############################################################
if (! -d $WebDir) {
mkdir $WebDir, 0777 or die "Unable to create web directory: '$WebDir'.";
if($VERBOSE){
warn "$WebDir did not exist; creating it.\n";
}
}
if ($CONFIG_PATH ne "") {
$ConfigMode = 1;
$LLVMSrcDir = GetRegex "^(.*)\\s+", `$CONFIG_PATH --src-root`;
$LLVMObjDir = GetRegex "^(.*)\\s+", `$CONFIG_PATH --obj-root`;
# FIXME: Add llvm-config hook for this?
$LLVMTestDir = $LLVMObjDir . "/projects/test-suite";
} else {
$ConfigureLog = "$Prefix-Configure-Log.txt";
$BuildLog = "$Prefix-Build-Log.txt";
$COLog = "$Prefix-CVS-Log.txt";
$DejagnuLog = "$Prefix-Dejagnu-testrun.log";
$DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
$DejagnuLog = "$Prefix-DejagnuTests-Log.txt";
}
if ($VERBOSE) {
if ($CONFIG_PATH ne "") {
print "INITIALIZED (config mode)\n";
print "WebDir = $WebDir\n";
print "Prefix = $Prefix\n";
print "LLVM Src = $LLVMSrcDir\n";
print "LLVM Obj = $LLVMObjDir\n";
print "LLVM Test = $LLVMTestDir\n";
} else {
print "INITIALIZED\n";
print "SVN URL = $SVNURL\n";
print "COLog = $COLog\n";
print "BuildDir = $BuildDir\n";
print "WebDir = $WebDir\n";
print "Prefix = $Prefix\n";
print "BuildLog = $BuildLog\n";
}
}
############################################################## ##############################################################
# #
# The actual NewNightlyTest logic. # The actual NewNightlyTest logic.
@ -646,28 +692,30 @@ sub RunNightlyTest() {
$starttime = `date "+20%y-%m-%d %H:%M:%S"`; $starttime = `date "+20%y-%m-%d %H:%M:%S"`;
if (!$NOCHECKOUT) {
CheckoutSource();
}
# Build LLVM.
my $BuildError = 0, $BuildStatus = "OK"; 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."; my $DejagnuTestResults = "Dejagnu skipped by user choice.";
if (!$NODEJAGNU && !$BuildError) { if ($ConfigMode == 0) {
$DejagnuTestResults = RunDejaGNUTests(); if (!$NOCHECKOUT) {
CheckoutSource();
}
# Build LLVM.
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.
if (!$NODEJAGNU && !$BuildError) {
$DejagnuTestResults = RunDejaGNUTests();
}
} }
# Run the llvm-test tests. # Run the llvm-test tests.
@ -720,10 +768,13 @@ if ($LLVMGCCPATH ne "") {
my $targetTriple = $1; my $targetTriple = $1;
# Logs. # Logs.
my $ConfigureLogData = ReadFile $ConfigureLog; my ($ConfigureLogData, $BuildLogData, $DejagnuLogData, $CheckoutLogData) = "";
my $BuildLogData = ReadFile $BuildLog; if ($ConfigMode == 0) {
my $DejagnuLogData = ReadFile $DejagnuLog; $ConfigureLogData = ReadFile $ConfigureLog;
my $CheckoutLogData = ReadFile $COLog; $BuildLogData = ReadFile $BuildLog;
$DejagnuLogData = ReadFile $DejagnuLog;
$CheckoutLogData = ReadFile $COLog;
}
# Checkout info. # Checkout info.
my $CheckoutTime_Wall = GetRegex "^real ([0-9.]+)", $CheckoutLogData; my $CheckoutTime_Wall = GetRegex "^real ([0-9.]+)", $CheckoutLogData;