#!/usr/bin/perl
use POSIX qw(strftime);
use File::Copy;
-use Date::Parse;
use Socket;
#
# -disable-llc Disable LLC tests in the nightly tester.
# -disable-jit Disable JIT tests in the nightly tester.
# -disable-cbe Disable C backend tests in the nightly tester.
+# -disable-lto Disable link time optimization.
# -verbose Turn on some debug output
# -debug Print information useful only to maintainers of this script.
# -nice Checkout/Configure/Build with "nice" to reduce impact
# -gccpath Path to gcc/g++ used to build LLVM
# -cvstag Check out a specific CVS tag to build LLVM (useful for
# testing release branches)
-# -usesvn Check code out from a subversion repository. With no
-# argument, use the standard repository. An argument specifies
-# the repository URL to use.
-# -svnurl Specify the SVN URL where LLVM can be found
+# -usecvs Check code out from the (old) CVS Repository instead of from
+# the standard Subversion repository.
# -target Specify the target triplet
# -cflags Next argument specifies that C compilation options that
# override the default.
# this option is not specified it defaults to
# /nightlytest/NightlyTestAccept.php. This is basically
# everything after the www.yourserver.org.
+# -nosubmit Do not report the test results back to a submit server.
#
# CVSROOT is the CVS repository from which the tree will be checked out,
# specified either in the full :method:user@host:/dir syntax, or
##############################################################
my $HOME = $ENV{'HOME'};
my $SVNURL = $ENV{"SVNURL"};
-$SVNURL = 'svn://anon@hlvm.org:3691/llvm.svn' unless $SVNURL;
+$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL;
my $CVSRootDir = $ENV{'CVSROOT'};
$CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir;
my $BuildDir = $ENV{'BUILDDIR'};
$CONFIGUREARGS="";
$nickname="";
$NOTEST=0;
-$USESVN=0;
+$USESVN=1;
$NORUNNINGTESTS=0;
$MAKECMD="make";
$SUBMITSERVER = "llvm.org";
$SUBMITSCRIPT = "/nightlytest/NightlyTestAccept.php";
+$SUBMIT = 1;
while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
shift;
if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
$CONFIGUREARGS .= " --disable-jit"; next; }
if (/^-disable-cbe$/) { $PROGTESTOPTS .= " DISABLE_CBE=1"; next; }
+ if (/^-disable-lto$/) { $PROGTESTOPTS .= " DISABLE_LTO=1"; next; }
+ if (/^-test-opts$/) { $PROGTESTOPTS .= " $ARGV[0]"; shift; next; }
if (/^-verbose$/) { $VERBOSE = 1; next; }
if (/^-debug$/) { $DEBUG = 1; next; }
if (/^-nice$/) { $NICE = "nice "; next; }
shift; next; }
if (/^-submit-server/) { $SUBMITSERVER = "$ARGV[0]"; shift; next; }
if (/^-submit-script/) { $SUBMITSCRIPT = "$ARGV[0]"; shift; next; }
+ if (/^-nosubmit$/) { $SUBMIT = 0; next; }
if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; }
if (/^-gccpath/) { $CONFIGUREARGS .=
" CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++";
else { $GCCPATH=""; }
if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
else { $CVSCOOPT="";}
- if (/^-usesvn/) { $USESVN = 1; }
- if (/^-svnurl/) { $SVNURL = $ARGV[0]; shift; next; }
+ if (/^-usecvs/) { $USESVN = 0; }
if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]";
shift; next; }
if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'";
shift; next; }
if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; }
if (/^-use-gmake/) { $MAKECMD = "gmake"; shift; next; }
- if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; }
if (/^-extraflags/) { $CONFIGUREARGS .=
" --with-extra-options=\'$ARGV[0]\'"; shift; next;}
if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
if ($ENV{'LLVMGCCDIR'}) {
$CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
+ $LLVMGCCPATH = $ENV{'LLVMGCCDIR'};
+}
+else {
+ $LLVMGCCPATH = "";
}
+
if ($CONFIGUREARGS !~ /--disable-jit/) {
$CONFIGUREARGS .= " --enable-jit";
}
$length = length($content);
my $send= "POST $file HTTP/1.0\n";
+ $send.= "Host: $host\n";
$send.= "Content-Type: application/x-www-form-urlencoded\n";
$send.= "Content-length: $length\n\n";
$send.= "$content";
#
##############################################################
if (!$NOCHECKOUT) {
- if ( $VERBOSE ) {
- print "CHECKOUT STAGE:\n";
- }
+ if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; }
if ($USESVN) {
my $SVNCMD = "$NICE svn co $SVNURL";
if ($VERBOSE) {
print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " .
- "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n";
- system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " .
- "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n";
+ "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n";
}
+ system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " .
+ "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n";
} else {
my $CVSOPT = "";
$CVSOPT = "-z3" # Use compression if going over ssh.
if $CVSRootDir =~ /^:ext:/;
my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT";
- print "( time -p $CVSCMD llvm; cd llvm/projects ; " .
- "$CVSCMD llvm-test ) > $COLog 2>&1";
+ if ($VERBOSE) {
+ print "( time -p $CVSCMD llvm; cd llvm/projects ; " .
+ "$CVSCMD llvm-test ) > $COLog 2>&1\n";
+ }
system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
- "$CVSCMD llvm-test ) > $COLog 2>&1";
+ "$CVSCMD llvm-test ) > $COLog 2>&1\n";
}
}
ChangeDir( $BuildDir , "Checkout directory") ;
my $NumDirsInCVS = 0;
if ($USESVN) {
$NumFilesInCVS = `egrep '^A' $COLog | wc -l` + 0;
- $NumDirsInCVS = `sed -e 's#/[^/]*$##' $COLog | sort | uniq | wc -l` + 0;
+ $NumDirsInCVS = `sed -e 's#/[^/]*\$##' $COLog | sort | uniq | wc -l` + 0;
} else {
$NumFilesInCVS = `egrep '^U' $COLog | wc -l` + 0;
$NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $COLog | wc -l` + 0;
#
##############################################################
+# This just computes a reasonably accurate #of seconds since 2000. It doesn't
+# have to be perfect as its only used for comparing date ranges within a couple
+# of days.
+sub ConvertToSeconds {
+ my ($sec, $min, $hour, $day, $mon, $yr) = @_;
+ my $Result = ($yr - 2000) * 12;
+ $Result += $mon;
+ $Result *= 31;
+ $Result += $day;
+ $Result *= 24;
+ $Result += $hour;
+ $Result *= 60;
+ $Result += $min;
+ $Result *= 60;
+ $Result += $sec;
+ return $Result;
+}
+
my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
if (!$NOCVSSTATS) {
- if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
+ if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; }
if ($USESVN) {
- my $delimiter = "----------------------------------------------------" .
- "--------------------\n";
- @SVNHistory = split $delimiter, `svn log --verbose -r{$DATE}:HEAD`;
-
-# Skip very first entry.
+ @SVNHistory = split /<logentry/, `svn log --xml --verbose -r{$DATE}:HEAD`;
+ # Skip very first entry because it is the XML header cruft
shift @SVNHistory;
+ my $Now = time();
foreach $Record (@SVNHistory) {
- my (@Lines, @Fields);
- my ($Rev, $Author, $StrTime, $LogLines, $Time);
- @Lines = split "\n", $Record;
-# print join"\n", @Lines;
-
- ($Rev, $Author, $StrTime, $LogLines) = split ' \| ', $Lines[0];
- $Time = str2time($StrTime);
- if (time() - $Time > 24*3600) {
+ my @Lines = split "\n", $Record;
+ my ($Author, $Date, $Revision);
+ # Get the date and see if its one we want to process.
+ my ($Year, $Month, $Day, $Hour, $Min, $Sec);
+ if ($Lines[3] =~ /<date>(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/){
+ $Year = $1; $Month = $2; $Day = $3; $Hour = $4; $Min = $5; $Sec = $6;
+ }
+ my $Then = ConvertToSeconds($Sec, $Min, $Hour, $Day, $Month, $Year);
+ # Get the current date and compute when "yesterday" is.
+ my ($NSec, $NMin, $NHour, $NDay, $NMon, $NYear) = gmtime();
+ my $Now = ConvertToSeconds( $NSec, $NMin, $NHour, $NDay, $NMon, $NYear);
+ if (($Now - 24*60*60) > $Then) {
next;
}
-
+ if ($Lines[1] =~ / revision="([0-9]*)">/) {
+ $Revision = $1;
+ }
+ if ($Lines[2] =~ /<author>([^<]*)<\/author>/) {
+ $Author = $1;
+ }
$UsersCommitted{$Author} = 1;
-
- #print $Rev, $Author, $Time, $LogLines, "\n";
-
- my $i = 2;
- while ($Lines[$i] ne '') {
- my ($Type, $Filename, $FromFile, $FromRev);
- #print $Lines[$i], "\n";
-
- if ($Lines[$i] =~ / ([MAD]) ([^ ]+) \(from ([^ ]+):([^ ]+)\)/) {
- ($Type, $Filename, $FromFile, $FromRev) = ($1, $2, $3, $4);
- } elsif ($Lines[$i] =~ / ([MAD]) ([^ ]+)/) {
- ($Type, $Filename, $FromFile, $FromRev) = ($1, $2, "", "");
- } else {
- print "UNMATCHABLE: $Lines[$i]\n";
- }
-
- if ($Type eq 'M') { # Modified
- $ModifiedFiles{$Filename} = 1;
- } elsif ($Type eq 'A') { # Added
- if ($FromFile eq "") { # File was added
- $AddedFiles{$Filename} = 1;
- } else { #File was added from another file - moved or copied.
- $MovedFiles{$Filename} = 1;
+ $Date = $Year . "-" . $Month . "-" . $Day;
+ $Time = $Hour . ":" . $Min . ":" . $Sec;
+ print "Rev: $Revision, Author: $Author, Date: $Date, Time: $Time\n";
+ for ($i = 6; $i < $#Lines; $i += 2 ) {
+ if ($Lines[$i] =~ /^ action="(.)">([^<]*)</) {
+ if ($1 == "A") {
+ $AddedFiles{$2} = 1;
+ } elsif ($1 == 'D') {
+ $RemovedFiles{$2} = 1;
+ } elsif ($1 == 'M' || $1 == 'R' || $1 == 'C') {
+ $ModifiedFiles{$2} = 1;
+ } else {
+ print "UNMATCHABLE: $Lines[$i]\n";
}
- } elsif ($Type eq 'D') { # Removed
- $RemovedFiles{$Filename} = 1;
- } else {
- print "INVALID TYPE: $Type";
}
-
- #print $Filename, "\n";
- #print $Type, $File, $FromFile, $FromRev, "\n";
- ++$i;
}
}
} else {
my $BuildError = 0, $BuildStatus = "OK";
if ($NOBUILD) {
$BuildStatus = "Skipped by user";
- $BuildError = 1;
}
elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
`grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
$gcc_version_long="";
if ($GCCPATH ne "") {
$gcc_version_long = `$GCCPATH/gcc --version`;
+} elsif ($ENV{"CC"}) {
+ $gcc_version_long = `$ENV{"CC"} --version`;
} else {
$gcc_version_long = `gcc --version`;
}
@GCC_VERSION = split '\n', $gcc_version_long;
$gcc_version = $GCC_VERSION[0];
+$llvmgcc_version_long="";
+if ($LLVMGCCPATH ne "") {
+ $llvmgcc_version_long = `$LLVMGCCPATH/llvm-gcc -v 2>&1`;
+} else {
+ $llvmgcc_version_long = `llvm-gcc -v 2>&1`;
+}
+@LLVMGCC_VERSION = split '\n', $llvmgcc_version_long;
+$llvmgcc_versionTarget = $LLVMGCC_VERSION[1];
+$llvmgcc_versionTarget =~ /Target: (.+)/;
+$targetTriple = $1;
+
if(!$BuildError){
@DEJAGNU_LOG = ReadFile "$DejagnuLog";
@DEJAGNU_SUM = ReadFile "$DejagnuSum";
'starttime' => $starttime,
'endtime' => $endtime,
'o_file_sizes' => $o_file_sizes,
- 'a_file_sizes' => $a_file_sizes
+ 'a_file_sizes' => $a_file_sizes,
+ 'target_triple' => $targetTriple
);
-$TESTING = 0;
-
-if ($TESTING) {
+if ($SUBMIT) {
+ my $response = SendData $SUBMITSERVER,$SUBMITSCRIPT,\%hash_of_data;
+ if( $VERBOSE) { print "============================\n$response"; }
+} else {
print "============================\n";
foreach $x(keys %hash_of_data){
print "$x => $hash_of_data{$x}\n";
}
-} else {
- my $response = SendData $SUBMITSERVER,$SUBMITSCRIPT,\%hash_of_data;
- if( $VERBOSE) { print "============================\n$response"; }
}
##############################################################