X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FNewNightlyTest.pl;h=4287cc1da5436543f1d47fce016d02ecb44a48f8;hb=4de7368bf92897d3b943423934e0a95d5a99d2cd;hp=b29b6e735e0af359c15f6ee2b98be3175e791fbe;hpb=ad83e7f37109c00ee2f25a81718aa621f594e57d;p=oota-llvm.git diff --git a/utils/NewNightlyTest.pl b/utils/NewNightlyTest.pl index b29b6e735e0..4287cc1da54 100755 --- a/utils/NewNightlyTest.pl +++ b/utils/NewNightlyTest.pl @@ -24,6 +24,7 @@ use Socket; # 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 @@ -43,18 +44,18 @@ use Socket; # 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 # -disable-bindings Disable building LLVM bindings. -# -cvstag Check out a specific CVS tag to build LLVM (useful for -# testing release branches) # -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. @@ -79,6 +80,7 @@ use Socket; # OTHER OPTIONS: # -parallel Run parallel jobs with GNU Make (see -parallel-jobs). # -parallel-jobs The number of parallel Make jobs to use (default is two). +# -parallel-test Allow parallel execution of llvm-test # -verbose Turn on some debug output # -nice Checkout/Configure/Build with "nice" to reduce impact # on busy servers. @@ -92,12 +94,10 @@ use Socket; # -ldflags Next argument specifies that linker options that override # the default. # -# CVSROOT is the CVS repository from which the tree will be checked out, -# specified either in the full :method:user@host:/dir syntax, or -# just /dir if using a local repo. +# CVSROOT is ignored, it is passed for backwards compatibility. # BUILDDIR is the directory where sources for this test run will be checked out # AND objects for this test run will be built. This directory MUST NOT -# exist before the script is run; it will be created by the cvs checkout +# exist before the script is run; it will be created by the svn checkout # process and erased (unless -noremove is specified; see above.) # WEBDIR is the directory into which the test results web page will be written, # AND in which the "index.html" is assumed to be a symlink to the most recent @@ -115,27 +115,17 @@ my $SVNURL = $ENV{"SVNURL"}; $SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; my $TestSVNURL = $ENV{"TestSVNURL"}; $TestSVNURL = 'http://llvm.org/svn/llvm-project' unless $TestSVNURL; -my $CVSRootDir = $ENV{'CVSROOT'}; -$CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; my $BuildDir = $ENV{'BUILDDIR'}; -$BuildDir = "$HOME/buildtest" unless $BuildDir; my $WebDir = $ENV{'WEBDIR'}; -$WebDir = "$HOME/cvs/testresults-X86" unless $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()); ############################################################## # @@ -154,6 +144,14 @@ $SUBMIT = 1; $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 -- @@ -161,21 +159,21 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { # List command line options here... if (/^-config$/) { $CONFIG_PATH = "$ARGV[0]"; shift; next; } if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; } - if (/^-nocvsstats$/) { $NOCVSSTATS = 1; next; } + if (/^-noclean$/) { $NOCLEAN = 1; next; } if (/^-noremove$/) { $NOREMOVE = 1; next; } if (/^-noremoveatend$/) { $NOREMOVEATEND = 1; next; } if (/^-noremoveresults$/){ $NOREMOVERESULTS = 1; next; } if (/^-notest$/) { $NOTEST = 1; next; } if (/^-norunningtests$/) { next; } # Backward compatibility, ignored. if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;} - if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS -l3.0"; next; } + if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS"; next; } + if (/^-parallel-test$/) { $PROGTESTOPTS .= " ENABLE_PARALLEL_REPORT=1"; next; } if (/^-with-clang$/) { $WITHCLANG = 1; next; } if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". - "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;} + "OPTIMIZE_OPTION=-O2"; next;} if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". "DISABLE_ASSERTIONS=1 ". - "OPTIMIZE_OPTION=-O2"; - $BUILDTYPE="release-asserts"; next;} + "OPTIMIZE_OPTION=-O2"; next;} if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; next; } if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; @@ -206,8 +204,6 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; $GCCPATH=$ARGV[0]; shift; next; } else { $GCCPATH=""; } - if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; } - else { $CVSCOOPT="";} if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next; } if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; @@ -221,90 +217,80 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { 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 (!($CONFIG_PATH eq "")) { - die "error: -config mode is not yet implemented,"; -} - -if ($ENV{'LLVMGCCDIR'}) { - $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'}; - $LLVMGCCPATH = $ENV{'LLVMGCCDIR'} . '/bin'; -} -else { - $LLVMGCCPATH = ""; -} - if ($CONFIGUREARGS !~ /--disable-jit/) { $CONFIGUREARGS .= " --enable-jit"; } -if (@ARGV != 0 and @ARGV != 3 and $VERBOSE) { - foreach $x (@ARGV) { - print "$x\n"; - } - print "Must specify 0 or 3 options!"; +if (@ARGV != 0 and @ARGV != 3) { + die "error: must specify 0 or 3 options!"; } if (@ARGV == 3) { - $CVSRootDir = $ARGV[0]; + if ($CONFIG_PATH ne "") { + die "error: arguments are unsupported in -config mode,"; + } + + # ARGV[0] used to be the CVS root, ignored for backward compatibility. $BuildDir = $ARGV[1]; $WebDir = $ARGV[2]; } -if ($CVSRootDir eq "" or - $BuildDir eq "" or - $WebDir eq "") { - die("please specify a cvs root directory, 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 \""); } -if ($BUILDTYPE ne "release" && $BUILDTYPE ne "release-asserts") { - $BUILDTYPE = "debug"; -} +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 $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 $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt"; -if (! -d $WebDir) { - mkdir $WebDir, 0777; - 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; ############################################################## # @@ -333,9 +319,9 @@ sub RunLoggedCommand { } 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"; } } @@ -352,67 +338,31 @@ sub RunAppendingLoggedCommand { } 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"; } } -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# DiffFiles - Diff the current version of the file against the last version of -# the file, reporting things added and removed. This is used to report, for -# example, added and removed warnings. This returns a pair (added, removed) -# -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -sub DiffFiles { - my $Suffix = shift; - my @Others = GetDir $Suffix; - if (@Others == 0) { # No other files? We added all entries... - return (`cat $WebDir/$DATE$Suffix`, ""); - } -# Diff the files now... - my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`; - my $Added = join "\n", grep /^/, @Diffs; - $Added =~ s/^< //gm; - $Removed =~ s/^> //gm; - return ($Added, $Removed); -} - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub GetRegex { # (Regex with ()'s, value) - $_[1] =~ /$_[0]/m; - return $1 - if (defined($1)); + if ($_[1] =~ /$_[0]/m) { + return $1; + } return "0"; } -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -sub GetRegexNum { - my ($Regex, $Num, $Regex2, $File) = @_; - my @Items = split "\n", `grep '$Regex' $File`; - return GetRegex $Regex2, $Items[$Num]; -} - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub ChangeDir { # directory, logical name my ($dir,$name) = @_; chomp($dir); if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; } $result = chdir($dir); if (!$result) { - print "ERROR!!! Cannot change directory to: $name ($dir) because $!"; + print "ERROR!!! Cannot change directory to: $name ($dir) because $!\n"; return false; } return true; } -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub ReadFile { if (open (FILE, $_[0])) { undef $/; @@ -426,16 +376,12 @@ sub ReadFile { } } -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub WriteFile { # (filename, contents) open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n"; print FILE $_[1]; close FILE; } -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub CopyFile { #filename, newfile my ($file, $newfile) = @_; chomp($file); @@ -443,75 +389,14 @@ sub CopyFile { #filename, newfile copy($file, $newfile); } -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -sub AddRecord { - my ($Val, $Filename,$WebDir) = @_; - my @Records; - if (open FILE, "$WebDir/$Filename") { - @Records = grep !/$DATE/, split "\n", ; - close FILE; - } - push @Records, "$DATE: $Val"; - WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n"; -} - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# FormatTime - Convert a time from 1m23.45 into 83.45 -# -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -sub FormatTime { - my $Time = shift; - if ($Time =~ m/([0-9]+)m([0-9.]+)/) { - $Time = sprintf("%7.4f", $1*60.0+$2); - } - return $Time; -} - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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 ( ) { - 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. @@ -521,6 +406,12 @@ sub SendData { $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\""; @@ -570,17 +461,13 @@ sub SendData { ############################################################## # -# Getting Start timestamp +# Individual Build & Test Functions # ############################################################## -$starttime = `date "+20%y-%m-%d %H:%M:%S"`; -############################################################## -# -# Create the CVS repository directory -# -############################################################## -if (!$NOCHECKOUT) { +# Create the source repository directory. +sub CheckoutSource { + die "Invalid call!" unless $ConfigMode == 0; if (-d $BuildDir) { if (!$NOREMOVE) { if ( $VERBOSE ) { @@ -596,286 +483,41 @@ if (!$NOCHECKOUT) { } else { mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; } -} - -############################################################## -# -# Check out the llvm tree, using either SVN or CVS -# -############################################################## -if (!$NOCHECKOUT) { ChangeDir( $BuildDir, "checkout directory" ); - my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; - my $SVNCMD2 = "$NICE svn co --non-interactive $TestSVNURL"; - RunLoggedCommand("( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . - "$SVNCMD2/test-suite/trunk llvm-test )", $COLog, + my $SVNCMD = "$NICE svn co --non-interactive"; + RunLoggedCommand("( time -p $SVNCMD $SVNURL/llvm/trunk llvm; cd llvm/projects ; " . + " $SVNCMD $TestSVNURL/test-suite/trunk llvm-test )", $COLog, "CHECKOUT LLVM"); if ($WITHCLANG) { - my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/trunk"; - RunLoggedCommand("( time -p cd llvm/tools ; $SVNCMD clang )", $COLog, + RunLoggedCommand("( cd llvm/tools ; " . + " $SVNCMD $SVNURL/cfe/trunk clang )", $COLog, "CHECKOUT CLANG"); } } -ChangeDir( $LLVMSrcDir , "llvm source directory") ; - -############################################################## -# -# Get some static statistics about the current state of CVS -# -# This can probably be put on the server side -# -############################################################## -my $CheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $COLog`; -my $CheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $COLog`; -my $CheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $COLog`; -my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; - -my $NumFilesInCVS = 0; -my $NumDirsInCVS = 0; -$NumFilesInCVS = `egrep '^A' $COLog | wc -l` + 0; -$NumDirsInCVS = `sed -e 's#/[^/]*\$##' $COLog | sort | uniq | wc -l` + 0; - -############################################################## -# -# Extract some information from the CVS history... use a hash so no duplicate -# stuff is stored. This gets the history from the previous days worth -# of cvs activity and parses it. -# -############################################################## - -# 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 "CHANGE HISTORY ANALYSIS STAGE\n"; } - - @SVNHistory = split /(\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 = $1; - } - $UsersCommitted{$Author} = 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="(.)">([^<]*) $ProgramTestLog 2>&1\n"; - } - RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ". - "$TESTFLAGS TEST=nightly", - $ProgramTestLog, "TEST DIRECTORY $SubDir"); - $llcbeta_options=`$MAKECMD print-llcbeta-option`; - } + # 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 ". + "$TESTFLAGS TEST=nightly", + $ProgramTestLog, "TEST DIRECTORY $SubDir"); + $LLCBetaOpts = `$MAKECMD print-llcbeta-option`; my $ProgramsTable; - if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) { - $TestError = 1; + 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) { - $TestError = 1; + } 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 { - $TestError = 0; - # - # Create a list of the tests which were run... - # - system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ". - "| sort > $Prefix-$SubDir-Tests.txt"; + # Create a list of the tests which were run... + system "egrep -a 'TEST-(PASS|FAIL)' < $ProgramTestLog ". + "| sort > $Prefix-$SubDir-Tests.txt"; } $ProgramsTable = ReadFile "report.nightly.csv"; ChangeDir( "../../..", "Programs Test Parent Directory" ); - return ($ProgramsTable, $llcbeta_options); -} #end sub TestDirectory + return ($ProgramsTable, $LLCBetaOpts); +} -############################################################## -# -# Calling sub TestDirectory -# -############################################################## -if (!$BuildError) { - ($SingleSourceProgramsTable, $llcbeta_options) = - TestDirectory("SingleSource"); - WriteFile "$Prefix-SingleSource-Performance.txt", $SingleSourceProgramsTable; - ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource"); - WriteFile "$Prefix-MultiSource-Performance.txt", $MultiSourceProgramsTable; +# Run all the nightly tests and return the program tables and the list of tests, +# passes, fails, and xfails. +sub RunNightlyTest() { + ($SSProgs, $llcbeta_options) = TestDirectory("SingleSource"); + WriteFile "$Prefix-SingleSource-Performance.txt", $SSProgs; + ($MSProgs, $llcbeta_options) = TestDirectory("MultiSource"); + WriteFile "$Prefix-MultiSource-Performance.txt", $MSProgs; if ( ! $NOEXTERNALS ) { - ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External"); - WriteFile "$Prefix-External-Performance.txt", $ExternalProgramsTable; + ($ExtProgs, $llcbeta_options) = TestDirectory("External"); + WriteFile "$Prefix-External-Performance.txt", $ExtProgs; system "cat $Prefix-SingleSource-Tests.txt " . "$Prefix-MultiSource-Tests.txt ". "$Prefix-External-Tests.txt | sort > $Prefix-Tests.txt"; @@ -939,7 +571,7 @@ if (!$BuildError) { "$Prefix-MultiSource-Performance.txt ". "$Prefix-External-Performance.txt | sort > $Prefix-Performance.txt"; } else { - $ExternalProgramsTable = "External TEST STAGE SKIPPED\n"; + $ExtProgs = "External TEST STAGE SKIPPED\n"; if ( $VERBOSE ) { print "External TEST STAGE SKIPPED\n"; } @@ -951,153 +583,238 @@ if (!$BuildError) { " | sort > $Prefix-Performance.txt"; } - ############################################################## - # - # - # gathering tests added removed broken information here - # - # - ############################################################## - my $dejagnu_test_list = ReadFile "$Prefix-Tests.txt"; - my @DEJAGNU = split "\n", $dejagnu_test_list; - my ($passes, $fails, $xfails) = ""; - - if(!$NODEJAGNU) { - for ($x=0; $x<@DEJAGNU; $x++) { - if ($DEJAGNU[$x] =~ m/^PASS:/) { - $passes.="$DEJAGNU[$x]\n"; - } - elsif ($DEJAGNU[$x] =~ m/^FAIL:/) { - $fails.="$DEJAGNU[$x]\n"; - } - elsif ($DEJAGNU[$x] =~ m/^XFAIL:/) { - $xfails.="$DEJAGNU[$x]\n"; - } + # Compile passes, fails, xfails. + my $All = (ReadFile "$Prefix-Tests.txt"); + my @TestSuiteResultLines = split "\n", $All; + my ($Passes, $Fails, $XFails) = ""; + + for ($x=0; $x < @TestSuiteResultLines; $x++) { + if (@TestSuiteResultLines[$x] =~ m/^PASS:/) { + $Passes .= "$TestSuiteResultLines[$x]\n"; + } + elsif (@TestSuiteResultLines[$x] =~ m/^FAIL:/) { + $Fails .= "$TestSuiteResultLines[$x]\n"; + } + elsif (@TestSuiteResultLines[$x] =~ m/^XFAIL:/) { + $XFails .= "$TestSuiteResultLines[$x]\n"; } } -} #end if !$BuildError + return ($SSProgs, $MSProgs, $ExtProgs, $All, $Passes, $Fails, $XFails); +} ############################################################## # -# Getting end timestamp +# Initialize filenames # ############################################################## -$endtime = `date "+20%y-%m-%d %H:%M:%S"`; +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"; +} + +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"; + } +} ############################################################## # -# Place all the logs neatly into one humungous file +# The actual NewNightlyTest logic. # ############################################################## -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\"`; +$starttime = `date "+20%y-%m-%d %H:%M:%S"`; -my @CVS_DATA; -my $cvs_data; -@CVS_DATA = ReadFile "$COLog"; -$cvs_data = join("\n", @CVS_DATA); +my $BuildError = 0, $BuildStatus = "OK"; +if ($ConfigMode == 0) { + if (!$NOCHECKOUT) { + CheckoutSource(); + } -my @BUILD_DATA; -my $build_data; -@BUILD_DATA = ReadFile "$BuildLog"; -$build_data = join("\n", @BUILD_DATA); + # 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"; + } + } +} -my (@DEJAGNU_LOG, @DEJAGNU_SUM, @DEJAGNULOG_FULL, @GCC_VERSION); -my ($dejagnutests_log ,$dejagnutests_sum, $dejagnulog_full) = ""; -my ($gcc_version, $gcc_version_long) = ""; +# Run the llvm-test tests. +my ($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable, + $all_tests, $passes, $fails, $xfails) = ""; +if (!$NOTEST && !$BuildError) { + ($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable, + $all_tests, $passes, $fails, $xfails) = RunNightlyTest(); +} -$gcc_version_long=""; +$endtime = `date "+20%y-%m-%d %H:%M:%S"`; + +# The last bit of logic is to remove the build and web dirs, after sending data +# to the server. + +############################################################## +# +# Accumulate the information to send to the server. +# +############################################################## + +if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; } + +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 = ""; if ($GCCPATH ne "") { - $gcc_version_long = `$GCCPATH/gcc --version`; + $gcc_version_long = `$GCCPATH/gcc --version`; } elsif ($ENV{"CC"}) { - $gcc_version_long = `$ENV{"CC"} --version`; + $gcc_version_long = `$ENV{"CC"} --version`; } else { - $gcc_version_long = `gcc --version`; + $gcc_version_long = `gcc --version`; } -@GCC_VERSION = split '\n', $gcc_version_long; -$gcc_version = $GCC_VERSION[0]; +my $gcc_version = (split '\n', $gcc_version_long)[0]; -$llvmgcc_version_long=""; +# 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`; } 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"; - $dejagnutests_log = join("\n", @DEJAGNU_LOG); - $dejagnutests_sum = join("\n", @DEJAGNU_SUM); - - @DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog"; - $dejagnulog_full = join("\n", @DEJAGNULOG_FULL); +(split '\n', $llvmgcc_version_long)[1] =~ /Target: (.+)/; +my $targetTriple = $1; + +# Logs. +my ($ConfigureLogData, $BuildLogData, $CheckoutLogData) = ""; +if ($ConfigMode == 0) { + $ConfigureLogData = ReadFile $ConfigureLog; + $BuildLogData = ReadFile $BuildLog; + $CheckoutLogData = ReadFile $COLog; } -############################################################## -# -# Send data via a post request -# -############################################################## +# Checkout info. +my $CheckoutTime_Wall = GetRegex "^real ([0-9.]+)", $CheckoutLogData; +my $CheckoutTime_User = GetRegex "^user ([0-9.]+)", $CheckoutLogData; +my $CheckoutTime_Sys = GetRegex "^sys ([0-9.]+)", $CheckoutLogData; +my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; + +# Configure info. +my $ConfigTimeU = GetRegex "^user ([0-9.]+)", $ConfigureLogData; +my $ConfigTimeS = GetRegex "^sys ([0-9.]+)", $ConfigureLogData; +my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System +my $ConfigWallTime = GetRegex "^real ([0-9.]+)",$ConfigureLogData; +$ConfigTime=-1 unless $ConfigTime; +$ConfigWallTime=-1 unless $ConfigWallTime; + +# Build info. +my $BuildTimeU = GetRegex "^user ([0-9.]+)", $BuildLogData; +my $BuildTimeS = GetRegex "^sys ([0-9.]+)", $BuildLogData; +my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System +my $BuildWallTime = GetRegex "^real ([0-9.]+)", $BuildLogData; +$BuildTime=-1 unless $BuildTime; +$BuildWallTime=-1 unless $BuildWallTime; if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; } my %hash_of_data = ( 'machine_data' => $machine_data, - 'build_data' => $build_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, 'configtime_cpu'=> $ConfigTime, 'buildtime_wall' => $BuildWallTime, 'buildtime_cpu' => $BuildTime, - 'warnings' => $WarningsFile, - 'cvsusercommitlist' => $UserCommitList, - 'cvsuserupdatelist' => $UserUpdateList, - 'cvsaddedfiles' => $CVSAddedFiles, - 'cvsmodifiedfiles' => $CVSModifiedFiles, - 'cvsremovedfiles' => $CVSRemovedFiles, - 'lines_of_code' => $LOC, - 'cvs_file_count' => $NumFilesInCVS, - 'cvs_dir_count' => $NumDirsInCVS, 'buildstatus' => $BuildStatus, 'singlesource_programstable' => $SingleSourceProgramsTable, 'multisource_programstable' => $MultiSourceProgramsTable, 'externalsource_programstable' => $ExternalProgramsTable, - 'llcbeta_options' => $multisource_llcbeta_options, - 'warnings_removed' => $WarningsRemoved, - 'warnings_added' => $WarningsAdded, + 'llcbeta_options' => $llcbeta_options, 'passing_tests' => $passes, 'expfail_tests' => $xfails, 'unexpfail_tests' => $fails, - 'all_tests' => $dejagnu_test_list, - 'new_tests' => "", - 'removed_tests' => "", - 'dejagnutests_results' => $DejagnuTestResults, - 'dejagnutests_log' => $dejagnulog_full, + 'all_tests' => $all_tests, + 'dejagnutests_results' => "Dejagnu skipped by user choice.", + 'dejagnutests_log' => "", 'starttime' => $starttime, 'endtime' => $endtime, - 'o_file_sizes' => $o_file_sizes, - 'a_file_sizes' => $a_file_sizes, - 'target_triple' => $targetTriple + 'target_triple' => $targetTriple, + + # Unused, but left around for backwards compatability. + 'warnings' => "", + 'cvsusercommitlist' => "", + 'cvsuserupdatelist' => "", + 'cvsaddedfiles' => "", + 'cvsmodifiedfiles' => "", + 'cvsremovedfiles' => "", + 'lines_of_code' => "", + 'cvs_file_count' => 0, + 'cvs_dir_count' => 0, + 'warnings_removed' => "", + 'warnings_added' => "", + 'new_tests' => "", + 'removed_tests' => "", + 'o_file_sizes' => "", + '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"; } @@ -1110,7 +827,7 @@ if ($SUBMIT || !($SUBMITAUX eq "")) { ############################################################## # -# Remove the cvs tree... +# Remove the source tree... # ############################################################## system ( "$NICE rm -rf $BuildDir")