# IMPLEMENTED.
# -nickname NAME The NAME argument specifieds the nickname this script
# will submit to the nightlytest results repository.
+# -nouname Don't include uname data (machine will be identified by nickname only).
# -submit-server Specifies a server to submit the test results too. If this
# option is not specified it defaults to
# llvm.org. This is basically just the address of the
# the source tree.
# -noremove Do not remove the BUILDDIR after it has been built.
# -noremoveresults Do not remove the WEBDIR after it has been built.
+# -noclean Do not run 'make clean' before building.
# -nobuild Do not build llvm. If tests are enabled perform them
# on the llvm build specified in the build directory
-# -release Build an LLVM Release version
-# -release-asserts Build an LLVM ReleaseAsserts version
+# -release Build an LLVM Release+Asserts version
+# -release-asserts Build an LLVM Release version
# -disable-bindings Disable building LLVM bindings.
# -with-clang Checkout Clang source into tools/clang.
# -compileflags Next argument specifies extra options passed to make when
# building LLVM.
# -use-gmake Use gmake instead of the default make command to build
# llvm and run tests.
+# -llvmgccdir Next argument specifies the llvm-gcc install prefix.
#
# TESTING OPTIONS:
# -notest Do not even attempt to run the test programs.
my $BuildDir = $ENV{'BUILDDIR'};
my $WebDir = $ENV{'WEBDIR'};
-my $LLVMSrcDir = $ENV{'LLVMSRCDIR'};
-$LLVMSrcDir = "$BuildDir/llvm" unless $LLVMSrcDir;
-my $LLVMObjDir = $ENV{'LLVMOBJDIR'};
-$LLVMObjDir = "$BuildDir/llvm" unless $LLVMObjDir;
-my $LLVMTestDir = $ENV{'LLVMTESTDIR'};
-$LLVMTestDir = "$BuildDir/llvm/projects/llvm-test" unless $LLVMTestDir;
-
##############################################################
#
# Calculate the date prefix...
#
##############################################################
+use POSIX;
@TIME = localtime;
-my $DATE = sprintf "%4d-%02d-%02d_%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3], $TIME[1], $TIME[0];
+my $DATE = strftime("%Y-%m-%d_%H-%M-%S", localtime());
##############################################################
#
$PARALLELJOBS = "2";
my $TESTFLAGS="";
+if ($ENV{'LLVMGCCDIR'}) {
+ $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
+ $LLVMGCCPATH = $ENV{'LLVMGCCDIR'} . '/bin';
+}
+else {
+ $LLVMGCCPATH = "";
+}
+
while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
shift;
last if /^--$/; # Stop processing arguments on --
# List command line options here...
if (/^-config$/) { $CONFIG_PATH = "$ARGV[0]"; shift; next; }
if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
+ if (/^-noclean$/) { $NOCLEAN = 1; next; }
if (/^-noremove$/) { $NOREMOVE = 1; next; }
if (/^-noremoveatend$/) { $NOREMOVEATEND = 1; next; }
if (/^-noremoveresults$/){ $NOREMOVERESULTS = 1; next; }
if (/^-test-cxxflags/) { $TESTFLAGS = "$TESTFLAGS CXXFLAGS=\'$ARGV[0]\'";
shift; next; }
if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; }
+ if (/^-llvmgccdir/) { $CONFIGUREARGS .= " --with-llvmgccdir=\'$ARGV[0]\'";
+ $LLVMGCCPATH = $ARGV[0] . '/bin';
+ shift; next;}
+ if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
+ if (/^-nouname$/) { $NOUNAME = 1; next; }
if (/^-use-gmake/) { $MAKECMD = "gmake"; shift; next; }
if (/^-extraflags/) { $CONFIGUREARGS .=
" --with-extra-options=\'$ARGV[0]\'"; shift; next;}
if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
- if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
+ if (/^-nodejagnu$/) { next; }
if (/^-nobuild$/) { $NOBUILD = 1; next; }
print "Unknown option: $_ : ignoring!\n";
}
-if ($ENV{'LLVMGCCDIR'}) {
- $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
- $LLVMGCCPATH = $ENV{'LLVMGCCDIR'} . '/bin';
-}
-else {
- $LLVMGCCPATH = "";
-}
-
if ($CONFIGUREARGS !~ /--disable-jit/) {
$CONFIGUREARGS .= " --enable-jit";
}
$WebDir = $ARGV[2];
}
-if ($BuildDir eq "" or
- $WebDir eq "") {
- die("please specify a build directory, and a web directory");
- }
+if ($CONFIG_PATH ne "") {
+ $BuildDir = "";
+ $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 "") {
die ("Please invoke NewNightlyTest.pl with command line option " .
"\"-nickname <nickname>\"");
}
-if ($CONFIG_PATH ne "") {
- die "error: -config mode is not yet implemented,";
-}
+my $LLVMSrcDir = $ENV{'LLVMSRCDIR'};
+$LLVMSrcDir = "$BuildDir/llvm" unless $LLVMSrcDir;
+my $LLVMObjDir = $ENV{'LLVMOBJDIR'};
+$LLVMObjDir = "$BuildDir/llvm" unless $LLVMObjDir;
+my $LLVMTestDir = $ENV{'LLVMTESTDIR'};
+$LLVMTestDir = "$BuildDir/llvm/projects/llvm-test" unless $LLVMTestDir;
##############################################################
#
# Define the file names we'll use
#
##############################################################
+
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 $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 $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) {
- 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";
-}
+# These are only valid in non-config mode.
+my $ConfigureLog = "", $BuildLog = "", $COLog = "";
+my $DejagnuLog = "", $DejagnuSum = "", $DejagnuLog = "";
+
+# Are we in config mode?
+my $ConfigMode = 0;
##############################################################
#
} else {
if ($VERBOSE) {
print "$Title\n";
- print "$Command 2>&1 > $Log\n";
+ print "$Command > $Log 2>&1\n";
}
- system "$Command 2>&1 > $Log";
+ system "$Command > $Log 2>&1";
}
}
} else {
if ($VERBOSE) {
print "$Title\n";
- print "$Command 2>&1 > $Log\n";
+ print "$Command >> $Log 2>&1\n";
}
- system "$Command 2>&1 >> $Log";
+ system "$Command >> $Log 2>&1";
}
}
copy($file, $newfile);
}
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-# This function is meant to read in the dejagnu sum file and
-# return a string with only the results (i.e. PASS/FAIL/XPASS/
-# XFAIL).
-#
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-sub GetDejagnuTestResults { # (filename, log)
- my ($filename, $DejagnuLog) = @_;
- my @lines;
- $/ = "\n"; #Make sure we're going line at a time.
-
- if( $VERBOSE) { print "DEJAGNU TEST RESULTS:\n"; }
-
- if (open SRCHFILE, $filename) {
- # Process test results
- while ( <SRCHFILE> ) {
- if ( length($_) > 1 ) {
- chomp($_);
- if ( m/^(PASS|XPASS|FAIL|XFAIL): .*\/llvm\/test\/(.*)$/ ) {
- push(@lines, "$1: test/$2");
- }
- }
- }
- }
- close SRCHFILE;
-
- my $content = join("\n", @lines);
- return $content;
-}
-
-
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# This function acts as a mini web browswer submitting data
# to our central server via the post method
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-sub SendData {
- $host = $_[0];
- $file = $_[1];
- $variables = $_[2];
+sub WriteSentData {
+ $variables = $_[0];
# Write out the "...-sentdata.txt" file.
$sentdata.= "$x => $value\n";
}
WriteFile "$Prefix-sentdata.txt", $sentdata;
+}
+
+sub SendData {
+ $host = $_[0];
+ $file = $_[1];
+ $variables = $_[2];
if (!($SUBMITAUX eq "")) {
system "$SUBMITAUX \"$Prefix-sentdata.txt\"";
# Create the source repository directory.
sub CheckoutSource {
+ die "Invalid call!" unless $ConfigMode == 0;
if (-d $BuildDir) {
if (!$NOREMOVE) {
if ( $VERBOSE ) {
# Build the entire tree, saving build messages to the build log. Returns false
# on build failure.
sub BuildLLVM {
+ die "Invalid call!" unless $ConfigMode == 0;
my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
RunLoggedCommand("(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) ",
$ConfigureLog, "CONFIGURE");
# Build the entire tree, capturing the output into $BuildLog
- RunAppendingLoggedCommand("($NICE $MAKECMD $MAKEOPTS clean)", $BuildLog, "BUILD CLEAN");
+ if (!$NOCLEAN) {
+ RunAppendingLoggedCommand("($NICE $MAKECMD $MAKEOPTS clean)", $BuildLog, "BUILD CLEAN");
+ }
RunAppendingLoggedCommand("(time -p $NICE $MAKECMD $MAKEOPTS)", $BuildLog, "BUILD");
- if (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
- `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l` + 0) {
+ if (`grep -a '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
+ `grep -a '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l` + 0) {
return 0;
}
return 1;
}
-# Running dejagnu tests and save results to log.
-sub RunDejaGNUTests {
- # Run the feature and regression tests, results are put into testrun.sum and
- # the full log in testrun.log.
- system "rm -f test/testrun.log test/testrun.sum";
- RunLoggedCommand("(time -p $MAKECMD $MAKEOPTS check)", $DejagnuLog, "DEJAGNU");
-
- # Copy the testrun.log and testrun.sum to our webdir.
- CopyFile("test/testrun.log", $DejagnuLog);
- CopyFile("test/testrun.sum", $DejagnuSum);
-
- return GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
-}
-
# Run the named tests (i.e. "SingleSource" "MultiSource" "External")
sub TestDirectory {
my $SubDir = shift;
my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
+ # Make sure to clean the test results.
+ RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS clean $TESTFLAGS",
+ $ProgramTestLog, "TEST DIRECTORY $SubDir");
+
# Run the programs tests... creating a report.nightly.csv file.
my $LLCBetaOpts = "";
RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
$LLCBetaOpts = `$MAKECMD print-llcbeta-option`;
my $ProgramsTable;
- if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) {
+ if (`grep -a '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) {
$ProgramsTable="Error running test $SubDir\n";
print "ERROR TESTING\n";
- } elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
+ } elsif (`grep -a '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
$ProgramsTable="Makefile error running tests $SubDir!\n";
print "ERROR TESTING\n";
} else {
# Create a list of the tests which were run...
- system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
+ system "egrep -a 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
"| sort > $Prefix-$SubDir-Tests.txt";
}
$ProgramsTable = ReadFile "report.nightly.csv";
##############################################################
#
-# The actual NewNightlyTest logic.
+# Initialize filenames
#
##############################################################
-$starttime = `date "+20%y-%m-%d %H:%M:%S"`;
-
-if (!$NOCHECKOUT) {
- CheckoutSource();
+if (! -d $WebDir) {
+ mkdir $WebDir, 0777 or die "Unable to create web directory: '$WebDir'.";
+ if($VERBOSE){
+ warn "$WebDir did not exist; creating it.\n";
+ }
}
-# Build LLVM.
-my $BuildError = 0, $BuildStatus = "OK";
-ChangeDir( $LLVMSrcDir , "llvm source directory") ;
-if ($NOCHECKOUT || $NOBUILD) {
- $BuildStatus = "Skipped by user";
+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 {
- if (!BuildLLVM()) {
- if( $VERBOSE) { print "\n***ERROR BUILDING TREE\n\n"; }
- $BuildError = 1;
- $BuildStatus = "Error: compilation aborted";
- $NODEJAGNU=1;
+ $ConfigureLog = "$Prefix-Configure-Log.txt";
+ $BuildLog = "$Prefix-Build-Log.txt";
+ $COLog = "$Prefix-CVS-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";
}
}
-# Run DejaGNU.
-my $DejagnuTestResults = "Dejagnu skipped by user choice.";
-if (!$NODEJAGNU && !$BuildError) {
- $DejagnuTestResults = RunDejaGNUTests();
+##############################################################
+#
+# The actual NewNightlyTest logic.
+#
+##############################################################
+
+$starttime = `date "+20%y-%m-%d %H:%M:%S"`;
+
+my $BuildError = 0, $BuildStatus = "OK";
+if ($ConfigMode == 0) {
+ 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";
+ }
+ }
}
# Run the llvm-test tests.
if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
-$machine_data = "uname: ".`uname -a`.
- "hardware: ".`uname -m`.
- "os: ".`uname -sr`.
- "name: ".`uname -n`.
- "date: ".`date \"+20%y-%m-%d\"`.
- "time: ".`date +\"%H:%M:%S\"`;
+if ( ! $NOUNAME ) {
+ $machine_data = "uname: ".`uname -a`.
+ "hardware: ".`uname -m`.
+ "os: ".`uname -sr`.
+ "name: ".`uname -n`.
+ "date: ".`date \"+20%y-%m-%d\"`.
+ "time: ".`date +\"%H:%M:%S\"`;
+} else {
+ $machine_data = "uname: (excluded)\n".
+ "hardware: ".`uname -m`.
+ "os: ".`uname -sr`.
+ "name: $nickname\n".
+ "date: ".`date \"+20%y-%m-%d\"`.
+ "time: ".`date +\"%H:%M:%S\"`;
+}
# Get gcc version.
my $gcc_version_long = "";
my $gcc_version = (split '\n', $gcc_version_long)[0];
# Get llvm-gcc target triple.
+#
+# FIXME: This shouldn't be hardwired to llvm-gcc.
my $llvmgcc_version_long = "";
if ($LLVMGCCPATH ne "") {
$llvmgcc_version_long = `$LLVMGCCPATH/llvm-gcc -v 2>&1`;
my $targetTriple = $1;
# Logs.
-my $ConfigureLogData = ReadFile $ConfigureLog;
-my $BuildLogData = ReadFile $BuildLog;
-my $DejagnuLogData = ReadFile $DejagnuLog;
-my $CheckoutLogData = ReadFile $COLog;
+my ($ConfigureLogData, $BuildLogData, $CheckoutLogData) = "";
+if ($ConfigMode == 0) {
+ $ConfigureLogData = ReadFile $ConfigureLog;
+ $BuildLogData = ReadFile $BuildLog;
+ $CheckoutLogData = ReadFile $COLog;
+}
# Checkout info.
my $CheckoutTime_Wall = GetRegex "^real ([0-9.]+)", $CheckoutLogData;
$BuildTime=-1 unless $BuildTime;
$BuildWallTime=-1 unless $BuildWallTime;
-# DejaGNU info.
-my $DejagnuTimeU = GetRegex "^user ([0-9.]+)", $DejagnuLogData;
-my $DejagnuTimeS = GetRegex "^sys ([0-9.]+)", $DejagnuLogData;
-$DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
-$DejagnuWallTime = GetRegex "^real ([0-9.]+)", $DejagnuLogData;
-$DejagnuTime = "0.0" unless $DejagnuTime;
-$DejagnuWallTime = "0.0" unless $DejagnuWallTime;
-
if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
my %hash_of_data = (
'build_data' => $ConfigureLogData . $BuildLogData,
'gcc_version' => $gcc_version,
'nickname' => $nickname,
- 'dejagnutime_wall' => $DejagnuWallTime,
- 'dejagnutime_cpu' => $DejagnuTime,
+ 'dejagnutime_wall' => "0.0",
+ 'dejagnutime_cpu' => "0.0",
'cvscheckouttime_wall' => $CheckoutTime_Wall,
'cvscheckouttime_cpu' => $CheckoutTime_CPU,
'configtime_wall' => $ConfigWallTime,
'expfail_tests' => $xfails,
'unexpfail_tests' => $fails,
'all_tests' => $all_tests,
- 'dejagnutests_results' => $DejagnuTestResults,
- 'dejagnutests_log' => $DejagnuLogData,
+ 'dejagnutests_results' => "Dejagnu skipped by user choice.",
+ 'dejagnutests_log' => "",
'starttime' => $starttime,
'endtime' => $endtime,
'target_triple' => $targetTriple,
'a_file_sizes' => ""
);
+# Write out the "...-sentdata.txt" file.
+WriteSentData \%hash_of_data;
+
if ($SUBMIT || !($SUBMITAUX eq "")) {
my $response = SendData $SUBMITSERVER,$SUBMITSCRIPT,\%hash_of_data;
if( $VERBOSE) { print "============================\n$response"; }