X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FNewNightlyTest.pl;h=e433ac05fcac0167a149509597c3363f7a687a2d;hb=86737665b81550fdb575f7d8cc5decc801a7813d;hp=36942c297ef13cab0644e3e334b9e7dd02adc4e8;hpb=fe030d786991293f5956ab4d730b735755272843;p=oota-llvm.git diff --git a/utils/NewNightlyTest.pl b/utils/NewNightlyTest.pl index 36942c297ef..e433ac05fca 100755 --- a/utils/NewNightlyTest.pl +++ b/utils/NewNightlyTest.pl @@ -1,5 +1,4 @@ #!/usr/bin/perl - use POSIX qw(strftime); use File::Copy; use Socket; @@ -10,7 +9,7 @@ use Socket; # Synopsis: Perform a series of tests which are designed to be run nightly. # This is used to keep track of the status of the LLVM tree, tracking # regressions and performance changes. Submits this information -# to llvm.org where it is placed into the nightlytestresults database. +# to llvm.org where it is placed into the nightlytestresults database. # # Modified heavily by Patrick Jenkins, July 2006 # @@ -20,19 +19,19 @@ use Socket; # -nocheckout Do not create, checkout, update, or configure # 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. # -nobuild Do not build llvm. If tests are enabled perform them # on the llvm build specified in the build directory # -notest Do not even attempt to run the test programs. Implies # -norunningtests. # -norunningtests Do not run the Olden benchmark suite with # LARGE_PROBLEM_SIZE enabled. -# -noexternals Do not run the external tests (for cases where povray -# or SPEC are not installed) -# -with-externals Specify a directory where the external tests are located. # -nodejagnu Do not run feature or regression tests # -parallel Run two parallel jobs with GNU Make. # -release Build an LLVM Release version +# -release-asserts Build an LLVM ReleaseAsserts version # -enable-llcbeta Enable testing of beta features in llc. +# -enable-lli Enable testing of lli (interpreter) features, default is off # -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. @@ -46,6 +45,8 @@ use Socket; # -gccpath Path to gcc/g++ used to build LLVM # -cvstag Check out a specific CVS tag to build LLVM (useful for # testing release branches) +# -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. @@ -53,14 +54,25 @@ use Socket; # override the default. # -ldflags Next argument specifies that linker options that override # the default. -# -extraflags Next argument specifies extra options that are passed to -# compile the tests. +# -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. # # ---------------- Options to configure llvm-test ---------------------------- -# -spec2000path Path to the benchspec directory in the SPEC 2000 distro -# -spec95path Path to the benchspec directory in the SPEC 95 distro. -# -povraypath Path to the povray sources -# -namdpath Path to the namd sources +# -extraflags Next argument specifies extra options that are passed to +# compile the tests. +# -noexternals Do not run the external tests (for cases where povray +# or SPEC are not installed) +# -with-externals Specify a directory where the external tests are located. +# -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 +# webserver +# -submit-script Specifies which script to call on the submit server. If +# this option is not specified it defaults to +# /nightlytest/NightlyTestAccept.php. This is basically +# everything after the www.yourserver.org. # # CVSROOT is the CVS repository from which the tree will be checked out, # specified either in the full :method:user@host:/dir syntax, or @@ -80,16 +92,15 @@ use Socket; # Getting environment variables # ############################################################## -my $HOME = $ENV{'HOME'}; +my $HOME = $ENV{'HOME'}; +my $SVNURL = $ENV{"SVNURL"}; +$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL; my $CVSRootDir = $ENV{'CVSROOT'}; - $CVSRootDir = "/home/vadve/shared/PublicCVS" - unless $CVSRootDir; +$CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; my $BuildDir = $ENV{'BUILDDIR'}; - $BuildDir = "$HOME/buildtest" - unless $BuildDir; +$BuildDir = "$HOME/buildtest" unless $BuildDir; my $WebDir = $ENV{'WEBDIR'}; - $WebDir = "$HOME/cvs/testresults-X86" - unless $WebDir; +$WebDir = "$HOME/cvs/testresults-X86" unless $WebDir; ############################################################## # @@ -107,88 +118,115 @@ my $TestStartTime = gmtime() . "GMT
" . localtime() . " (local)"; # ############################################################## $CONFIGUREARGS=""; - +$nickname=""; $NOTEST=0; +$USESVN=1; $NORUNNINGTESTS=0; +$MAKECMD="make"; +$SUBMITSERVER = "llvm.org"; +$SUBMITSCRIPT = "/nightlytest/NightlyTestAccept.php"; while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { - shift; - last if /^--$/; # Stop processing arguments on -- + shift; + last if /^--$/; # Stop processing arguments on -- # List command line options here... - if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; } - if (/^-nocvsstats$/) { $NOCVSSTATS = 1; next; } - if (/^-noremove$/) { $NOREMOVE = 1; next; } - if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; } - if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; } - if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; } - if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2"; next; } - if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } - if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; - $CONFIGUREARGS .= " --disable-llc_diffs"; next; } - if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1"; - $CONFIGUREARGS .= " --disable-jit"; next; } - if (/^-verbose$/) { $VERBOSE = 1; next; } - if (/^-debug$/) { $DEBUG = 1; next; } - if (/^-nice$/) { $NICE = "nice "; next; } - if (/^-f2c$/) { - $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next; - } - if (/^-with-externals/) { - $CONFIGUREARGS .= "--with-externals=$ARGV[0]"; shift; next; - } - if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; } - if (/^-gccpath/) { $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;} - 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]\'"; shift; next; - } - if (/^-cxxflags/) { - $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; shift; next; - } - if (/^-ldflags/) { - $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; shift; next; - } - if (/^-compileflags/) { - $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; - } - if (/^-extraflags/) { - $PROGTESTOPTS .= " EXTRA_FLAGS=\'$ARGV[0]\'"; shift; next; - } - if (/^-noexternals$/) { $NOEXTERNALS = 1; next; } - if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; } - if (/^-nobuild$/) { $NOBUILD = 1; next; } - if (/^-spec2000path$/) { - $LLVMTESTCONFIGARGS .= " --enable-spec2000=$ARGV[0]"; shift; next; - } else{ $LLVMTESTCONFIGARGS=""; } - if (/^-spec95path$/) { - $LLVMTESTCONFIGARGS .= " --enable-spec95=$ARGV[0]"; shift; next; - } - if (/^-povraypath$/) { - $LLVMTESTCONFIGARGS .= " --enable-povray=$ARGV[0]"; shift; next; - } - if (/^-namdpath$/) { - $LLVMTESTCONFIGARGS .= " --enable-namd=$ARGV[0]"; shift; next; - } - print "Unknown option: $_ : ignoring!\n"; + if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; } + if (/^-nocvsstats$/) { $NOCVSSTATS = 1; next; } + if (/^-noremove$/) { $NOREMOVE = 1; next; } + if (/^-noremoveresults$/){ $NOREMOVERESULTS = 1; next; } + if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; } + if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; } + if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; } + if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". + "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;} + if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". + "DISABLE-ASSERTIONS=1 ". + "OPTIMIZE_OPTION=-O2"; + $BUILDTYPE="release-asserts"; next;} + if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } + if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; + $CONFIGUREARGS .= " --enable-lli"; next; } + if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; + $CONFIGUREARGS .= " --disable-llc_diffs"; next; } + if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1"; + $CONFIGUREARGS .= " --disable-jit"; next; } + if (/^-disable-cbe$/) { $PROGTESTOPTS .= " DISABLE_CBE=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; } + if (/^-f2c$/) { $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; + shift; next; } + if (/^-with-externals$/) { $CONFIGUREARGS .= " --with-externals=$ARGV[0]"; + shift; next; } + if (/^-submit-server/) { $SUBMITSERVER = "$ARGV[0]"; shift; next; } + if (/^-submit-script/) { $SUBMITSCRIPT = "$ARGV[0]"; shift; next; } + if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; } + if (/^-gccpath/) { $CONFIGUREARGS .= + " 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 (/^-usecvs/) { $USESVN = 0; } + if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]"; + shift; next; } + if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; + shift; next; } + if (/^-cxxflags/) { $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; + shift; next; } + if (/^-ldflags/) { $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; + shift; next; } + if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; 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 (/^-nobuild$/) { $NOBUILD = 1; next; } + print "Unknown option: $_ : ignoring!\n"; } if ($ENV{'LLVMGCCDIR'}) { - $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'}; + $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'}; + $LLVMGCCPATH = $ENV{'LLVMGCCDIR'}; +} +else { + $LLVMGCCPATH = ""; } + if ($CONFIGUREARGS !~ /--disable-jit/) { - $CONFIGUREARGS .= " --enable-jit"; + $CONFIGUREARGS .= " --enable-jit"; } -die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3); +if (@ARGV != 0 and @ARGV != 3 and $VERBOSE) { + foreach $x (@ARGV) { + print "$x\n"; + } + print "Must specify 0 or 3 options!"; +} if (@ARGV == 3) { - $CVSRootDir = $ARGV[0]; - $BuildDir = $ARGV[1]; - $WebDir = $ARGV[2]; + $CVSRootDir = $ARGV[0]; + $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 ($nickname eq "") { + die ("Please invoke NewNightlyTest.pl with command line option " . + "\"-nickname \""); +} + +if ($BUILDTYPE ne "release" && $BUILDTYPE ne "release-asserts") { + $BUILDTYPE = "debug"; } ############################################################## @@ -198,7 +236,7 @@ if (@ARGV == 3) { ############################################################## my $Prefix = "$WebDir/$DATE"; my $BuildLog = "$Prefix-Build-Log.txt"; -my $CVSLog = "$Prefix-CVS-Log.txt"; +my $COLog = "$Prefix-CVS-Log.txt"; my $OldenTestsLog = "$Prefix-Olden-tests.txt"; my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz"; my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz"; @@ -207,18 +245,24 @@ my $DejagnuLog = "$Prefix-Dejagnu-testrun.log"; my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum"; my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt"; if (! -d $WebDir) { - mkdir $WebDir, 0777; + mkdir $WebDir, 0777; + if($VERBOSE){ warn "$WebDir did not exist; creating it.\n"; + } } if ($VERBOSE) { - print "INITIALIZED\n"; + print "INITIALIZED\n"; + if ($USESVN) { + print "SVN URL = $SVNURL\n"; + } else { print "CVS Root = $CVSRootDir\n"; - print "BuildDir = $BuildDir\n"; - print "WebDir = $WebDir\n"; - print "Prefix = $Prefix\n"; - print "CVSLog = $CVSLog\n"; - print "BuildLog = $BuildLog\n"; + } + print "COLog = $COLog\n"; + print "BuildDir = $BuildDir\n"; + print "WebDir = $WebDir\n"; + print "Prefix = $Prefix\n"; + print "BuildLog = $BuildLog\n"; } ############################################################## @@ -227,11 +271,11 @@ if ($VERBOSE) { # ############################################################## sub GetDir { - my $Suffix = shift; - opendir DH, $WebDir; - my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH; - closedir DH; - return @Result; + my $Suffix = shift; + opendir DH, $WebDir; + my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH; + closedir DH; + return @Result; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -242,90 +286,94 @@ sub GetDir { # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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); + 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; - if (defined($1)) { - return $1; - } - return "0"; + $_[1] =~ /$_[0]/m; + return $1 + if (defined($1)); + return "0"; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub GetRegexNum { - my ($Regex, $Num, $Regex2, $File) = @_; - my @Items = split "\n", `grep '$Regex' $File`; - return GetRegex $Regex2, $Items[$Num]; + 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"; } - chdir($dir) || die "Cannot change directory to: $name ($dir) "; + 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 $!"; + return false; + } + return true; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub ReadFile { - if (open (FILE, $_[0])) { - undef $/; - my $Ret = ; - close FILE; - $/ = '\n'; - return $Ret; - } else { - print "Could not open file '$_[0]' for reading!"; - return ""; - } + if (open (FILE, $_[0])) { + undef $/; + my $Ret = ; + close FILE; + $/ = '\n'; + return $Ret; + } else { + print "Could not open file '$_[0]' for reading!\n"; + return ""; + } } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub WriteFile { # (filename, contents) - open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!"; - print FILE $_[1]; - close FILE; + 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); - if ($VERBOSE) { print "Copying $file to $newfile\n"; } - copy($file, $newfile); + my ($file, $newfile) = @_; + chomp($file); + if ($VERBOSE) { print "Copying $file to $newfile\n"; } + 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"; + 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"; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -334,72 +382,46 @@ sub AddRecord { # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FormatTime { - my $Time = shift; - if ($Time =~ m/([0-9]+)m([0-9.]+)/) { - $Time = sprintf("%7.4f", $1*60.0+$2); - } - return $Time; + 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; - my $firstline; $/ = "\n"; #Make sure we're going line at a time. - print "DEJAGNU TEST RESULTS:\n"; + if( $VERBOSE) { print "DEJAGNU TEST RESULTS:\n"; } if (open SRCHFILE, $filename) { - # Process test results - my $first_list = 1; - my $should_break = 1; - my $nocopy = 0; - my $readingsum = 0; - while ( ) { - if ( length($_) > 1 ) { - chomp($_); - if ( m/^XPASS:/ || m/^FAIL:/ ) { - $nocopy = 0; - if ( $first_list ) { - push(@lines, "UNEXPECTED TEST RESULTS\n"); - $first_list = 0; - $should_break = 1; - push(@lines, "$_\n"); - print " $_\n"; - } else { - push(@lines, "$_\n"); - print " $_\n"; - } - } #elsif ( m/Summary/ ) { - # if ( $first_list ) { - # push(@lines, "PERFECT!"); - # print " PERFECT!\n"; - # } else { - # push(@lines, "\n"); - # } - # push(@lines, "STATISTICS\n"); - # print "\nDEJAGNU STATISTICS:\n"; - # $should_break = 0; - # $nocopy = 0; - # $readingsum = 1; - #} - elsif ( $readingsum ) { - push(@lines,"$_\n"); - print " $_\n"; - } - - } - } + # 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("", @lines); + my $content = join("\n", @lines); return $content; } + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # This function acts as a mini web browswer submitting data @@ -413,7 +435,8 @@ sub SendData{ $port=80; $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n"; - socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or die "Bad socket\n"; + socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or + die "Bad socket\n"; connect SOCK, $socketaddr or die "Bad connection\n"; select((select(SOCK), $| = 1)[0]); @@ -428,6 +451,7 @@ sub SendData{ $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"; @@ -440,15 +464,22 @@ sub SendData{ close(SOCK); my $sentdata=""; - foreach $x(keys(%hash_of_data)){ - $senddata.= "$x => $hash_of_data{$x}\n"; + foreach $x (keys (%$variables)){ + $value = $variables->{$x}; + $sentdata.= "$x => $value\n"; } WriteFile "$Prefix-sentdata.txt", $sentdata; - + return $result; } +############################################################## +# +# Getting Start timestamp +# +############################################################## +$starttime = `date "+20%y-%m-%d %H:%M:%S"`; ############################################################## # @@ -456,42 +487,55 @@ sub SendData{ # ############################################################## if (!$NOCHECKOUT) { - if (-d $BuildDir) { - if (!$NOREMOVE) { - system "rm -rf $BuildDir"; - } else { - die "CVS checkout directory $BuildDir already exists!"; - } + if (-d $BuildDir) { + if (!$NOREMOVE) { + if ( $VERBOSE ) { + 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"; + } } - mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!"; + } else { + mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; + } } -ChangeDir( $BuildDir, "CVS checkout directory" ); +ChangeDir( $BuildDir, "checkout directory" ); ############################################################## # -# Check out the llvm tree, saving CVS messages to the cvs log... +# Check out the llvm tree, using either SVN or CVS # ############################################################## -my $CVSOPT = ""; -# Use compression if going over ssh. -$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; -my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT"; if (!$NOCHECKOUT) { - if ( $VERBOSE ) - { - print "CHECKOUT STAGE:\n"; - print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) > $CVSLog 2>&1\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/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"; + 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 ) > $CVSLog 2>&1"; - ChangeDir( $BuildDir , "CVS Checkout directory") ; + "$CVSCMD llvm-test ) > $COLog 2>&1\n"; + } } +ChangeDir( $BuildDir , "Checkout directory") ; ChangeDir( "llvm" , "llvm source directory") ; -if (!$NOCHECKOUT) { - if ( $VERBOSE ) { print "UPDATE STAGE\n"; } - system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ; -} ############################################################## # @@ -500,66 +544,135 @@ if (!$NOCHECKOUT) { # This can probably be put on the server side # ############################################################## -my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`; -my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`; -my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`; -my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; - -my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0; -my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0; -my $LOC = `utils/countloc.sh`; +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; +if ($USESVN) { + $NumFilesInCVS = `egrep '^A' $COLog | 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; +} ############################################################## # # 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 activit and parses it. +# of cvs activity and parses it. # ############################################################## -my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated); +# 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; +} -if(!$NOCVSSTATS){ +my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated); -if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; } -@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`; +if (!$NOCVSSTATS) { + if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } + + if ($USESVN) { + @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="(.)">([^<]*) $BuildLog 2>&1\n"; - } - system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1"; - if ( $VERBOSE ) - { - print "BUILD STAGE:\n"; - print "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1\n"; - } - # Build the entire tree, capturing the output into $BuildLog - system "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1"; + my $EXTRAFLAGS = "--enable-spec --with-objroot=."; + if ( $VERBOSE ) { + print "CONFIGURE STAGE:\n"; + print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) " . + "> $BuildLog 2>&1\n"; + } + system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) " . + "> $BuildLog 2>&1"; + if ( $VERBOSE ) { + print "BUILD STAGE:\n"; + print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; + } + # Build the entire tree, capturing the output into $BuildLog + system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; } - ############################################################## # # Get some statistics about the build... @@ -602,7 +714,11 @@ if (!$NOCHECKOUT && !$NOBUILD) { #my $NumLibraries = scalar(grep(!/executable/, @Linked)); #my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0; +# Get the number of lines of source code. Must be here after the build is done +# because countloc.sh uses the llvm-config script which must be built. +my $LOC = `utils/countloc.sh -topdir $BuildDir/llvm`; +# Get the time taken by the configure script my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog"; my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog"; my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System @@ -620,91 +736,130 @@ $BuildTime=-1 unless $BuildTime; $BuildWallTime=-1 unless $BuildWallTime; my $BuildError = 0, $BuildStatus = "OK"; -if($NOBUILD){ - $BuildStatus = "Skipped by user"; - $BuildError = 1; +if ($NOBUILD) { + $BuildStatus = "Skipped by user"; } -elsif (`grep '^make[^:]*: .*Error' $BuildLog | wc -l` + 0 || - `grep '^make: \*\*\*.*Stop.' $BuildLog | wc -l`+0) { - $BuildStatus = "Error: compilation aborted"; - $BuildError = 1; - print "\n***ERROR BUILDING TREE\n\n"; +elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 || + `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l`+0) { + $BuildStatus = "Error: compilation aborted"; + $BuildError = 1; + if( $VERBOSE) { print "\n***ERROR BUILDING TREE\n\n"; } } if ($BuildError) { $NODEJAGNU=1; } +my $a_file_sizes=""; +my $o_file_sizes=""; +if (!$BuildError) { + print "Organizing size of .o and .a files\n" + if ( $VERBOSE ); + ChangeDir( "$BuildDir/llvm", "Build Directory" ); + $afiles.= `find utils/ -iname '*.a' -ls`; + $afiles.= `find lib/ -iname '*.a' -ls`; + $afiles.= `find tools/ -iname '*.a' -ls`; + if($BUILDTYPE eq "release"){ + $afiles.= `find Release/ -iname '*.a' -ls`; + } elsif($BUILDTYPE eq "release-asserts") { + $afiles.= `find Release-Asserts/ -iname '*.a' -ls`; + } else { + $afiles.= `find Debug/ -iname '*.a' -ls`; + } + + $ofiles.= `find utils/ -iname '*.o' -ls`; + $ofiles.= `find lib/ -iname '*.o' -ls`; + $ofiles.= `find tools/ -iname '*.o' -ls`; + if($BUILDTYPE eq "release"){ + $ofiles.= `find Release/ -iname '*.o' -ls`; + } elsif($BUILDTYPE eq "release-asserts") { + $ofiles.= `find Release-Asserts/ -iname '*.o' -ls`; + } else { + $ofiles.= `find Debug/ -iname '*.o' -ls`; + } + + @AFILES = split "\n", $afiles; + $a_file_sizes=""; + foreach $x (@AFILES){ + $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/; + $a_file_sizes.="$1 $2 $BUILDTYPE\n"; + } + @OFILES = split "\n", $ofiles; + $o_file_sizes=""; + foreach $x (@OFILES){ + $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/; + $o_file_sizes.="$1 $2 $BUILDTYPE\n"; + } +} else { + $a_file_sizes="No data due to a bad build."; + $o_file_sizes="No data due to a bad build."; +} + ############################################################## # # Running dejagnu tests # ############################################################## -my $DejangnuTestResults; # String containing the results of the dejagnu +my $DejangnuTestResults=""; # String containing the results of the dejagnu my $dejagnu_output = "$DejagnuTestsLog"; -if(!$NODEJAGNU) { - if($VERBOSE) - { - print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n"; - print "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1\n"; - } - - #Run the feature and regression tests, results are put into testrun.sum - #Full log in testrun.log - system "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1"; - - #Copy the testrun.log and testrun.sum to our webdir - CopyFile("test/testrun.log", $DejagnuLog); - CopyFile("test/testrun.sum", $DejagnuSum); - #can be done on server - $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog); - $unexpfail_tests = $DejagnuTestResults; +if (!$NODEJAGNU) { + if($VERBOSE) { + print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n"; + print "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1\n"; + } + + #Run the feature and regression tests, results are put into testrun.sum + #Full log in testrun.log + system "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1"; + + #Copy the testrun.log and testrun.sum to our webdir + CopyFile("test/testrun.log", $DejagnuLog); + CopyFile("test/testrun.sum", $DejagnuSum); + #can be done on server + $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog); + $unexpfail_tests = $DejagnuTestResults; } + #Extract time of dejagnu tests my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output"; my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output"; $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output"; -$DejagnuTestResults = "Dejagnu skipped by user choice." unless $DejagnuTestResults; +$DejagnuTestResults = + "Dejagnu skipped by user choice." unless $DejagnuTestResults; $DejagnuTime = "0.0" unless $DejagnuTime; $DejagnuWallTime = "0.0" unless $DejagnuWallTime; -if ($DEBUG) { - print $DejagnuTestResults; -} - ############################################################## # # Get warnings from the build # ############################################################## -if(!$NODEJAGNU){ - -if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; } -my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`; -my @Warnings; -my $CurDir = ""; +if (!$NODEJAGNU) { + if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; } + my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`; + my @Warnings; + my $CurDir = ""; -foreach $Warning (@Warn) { + foreach $Warning (@Warn) { if ($Warning =~ m/Entering directory \`([^\`]+)\'/) { - $CurDir = $1; # Keep track of directory warning is in... - if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included - $CurDir = $1; - } + $CurDir = $1; # Keep track of directory warning is in... + # Remove buildir prefix if included + if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { $CurDir = $1; } } else { - push @Warnings, "$CurDir/$Warning"; # Add directory to warning... + push @Warnings, "$CurDir/$Warning"; # Add directory to warning... } -} -my $WarningsFile = join "\n", @Warnings; -$WarningsFile =~ s/:[0-9]+:/::/g; + } + my $WarningsFile = join "\n", @Warnings; + $WarningsFile =~ s/:[0-9]+:/::/g; -# Emit the warnings file, so we can diff... -WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n"; -my ($WarningsAdded, $WarningsRemoved) = DiffFiles "$Prefix-Warnings.txt"; + # Emit the warnings file, so we can diff... + WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n"; + my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt"; -# Output something to stdout if something has changed -#print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded); -#print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved); + # Output something to stdout if something has changed + #print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded); + #print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved); -#my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade -#my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade + #my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade + #my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade } #endif !NODEGAGNU @@ -712,203 +867,158 @@ my ($WarningsAdded, $WarningsRemoved) = DiffFiles "$Prefix-Warnings.txt"; # # If we built the tree successfully, run the nightly programs tests... # -# A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" "External") +# A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" +# "External") # ############################################################## sub TestDirectory { - my $SubDir = shift; - - ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" ); - - my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt"; - #my $ProgramTestLog = "$Prefix-MultiSource-ProgramTest.txt"; #CHANGE ME! - - # Run the programs tests... creating a report.nightly.csv file - if (!$NOTEST) { - print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv " - . "TEST=nightly > $ProgramTestLog 2>&1\n"; - system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv " - . "TEST=nightly > $ProgramTestLog 2>&1"; - $llcbeta_options=`make print-llcbeta-option`; - } - - my $ProgramsTable; - if (`grep '^make[^:]: .*Error' $ProgramTestLog | wc -l` + 0){ - $TestError = 1; - $ProgramsTable="Error running test $SubDir\n"; - print "ERROR TESTING\n"; - } elsif (`grep '^make[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) { - $TestError = 1; - $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-multisourceprogramstable.txt"; + my $SubDir = shift; + ChangeDir( "$BuildDir/llvm/projects/llvm-test/$SubDir", + "Programs Test Subdirectory" ) || return ("", ""); + + my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt"; + + # Run the programs tests... creating a report.nightly.csv file + if (!$NOTEST) { + if( $VERBOSE) { + print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ". + "TEST=nightly > $ProgramTestLog 2>&1\n"; } - $ProgramsTable = ReadFile "report.nightly.csv"; - - ChangeDir( "../../..", "Programs Test Parent Directory" ); - return ($ProgramsTable, $llcbeta_options); -} + system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ". + "TEST=nightly > $ProgramTestLog 2>&1"; + $llcbeta_options=`$MAKECMD print-llcbeta-option`; + } + + my $ProgramsTable; + if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) { + $TestError = 1; + $ProgramsTable="Error running test $SubDir\n"; + print "ERROR TESTING\n"; + } elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) { + $TestError = 1; + $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"; + } + $ProgramsTable = ReadFile "report.nightly.csv"; + + ChangeDir( "../../..", "Programs Test Parent Directory" ); + return ($ProgramsTable, $llcbeta_options); +} #end sub TestDirectory -$patrickjenkins=1; -if(!$patrickjenkins){ - if ( $VERBOSE ) { - print "Modified Multisource Olden test stage\n"; - } - ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource/"); - ChangeDir( "../../..", "Programs Test Parent Directory" ); - - - WriteFile "$WebDir/multisourceprogramstable.txt", $MultiSourceProgramsTable; -} -if (!$BuildError && $patrickjenkins) { +############################################################## +# +# Calling sub TestDirectory +# +############################################################## +if (!$BuildError) { + if ( $VERBOSE ) { + print "SingleSource TEST STAGE\n"; + } + ($SingleSourceProgramsTable, $llcbeta_options) = + TestDirectory("SingleSource"); + WriteFile "$Prefix-SingleSource-Performance.txt", $SingleSourceProgramsTable; + if ( $VERBOSE ) { + print "MultiSource TEST STAGE\n"; + } + ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource"); + WriteFile "$Prefix-MultiSource-Performance.txt", $MultiSourceProgramsTable; + if ( ! $NOEXTERNALS ) { if ( $VERBOSE ) { - print "SingleSource TEST STAGE\n"; + print "External TEST STAGE\n"; } - ($SingleSourceProgramsTable, $singlesource_llcbeta_options) = TestDirectory("SingleSource"); - WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable; + ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External"); + WriteFile "$Prefix-External-Performance.txt", $ExternalProgramsTable; + system "cat $Prefix-SingleSource-Tests.txt " . + "$Prefix-MultiSource-Tests.txt ". + "$Prefix-External-Tests.txt | sort > $Prefix-Tests.txt"; + system "cat $Prefix-SingleSource-Performance.txt " . + "$Prefix-MultiSource-Performance.txt ". + "$Prefix-External-Performance.txt | sort > $Prefix-Performance.txt"; + } else { + $ExternalProgramsTable = "External TEST STAGE SKIPPED\n"; if ( $VERBOSE ) { - print "MultiSource TEST STAGE\n"; + print "External TEST STAGE SKIPPED\n"; } - ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource"); - WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable; - if ( ! $NOEXTERNALS ) { - if ( $VERBOSE ) { - print "External TEST STAGE\n"; - } - ($ExternalProgramsTable, $externalsource_llcbeta_options) = TestDirectory("External"); - system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ". - " $Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt"; - } else { - $ExternalProgramsTable = "External TEST STAGE SKIPPED\n"; - if ( $VERBOSE ) { - print "External TEST STAGE SKIPPED\n"; - } - system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ". - " | sort > $Prefix-Tests.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"; + } + + ############################################################## + # + # + # 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"; + } } - WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable; + } + +} #end if !$BuildError -} ############################################################## # -# -# gathering tests added removed broken information here -# +# If we built the tree successfully, runs of the Olden suite with +# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics. # ############################################################## -my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","",""); - -if ($TestError) { - $TestsAdded = "error testing
"; - $TestsRemoved = "error testing
"; - $TestsFixed = "error testing
"; - $TestsBroken = "error testing
"; -} else { - my ($RTestsAdded, $RTestsRemoved) = DiffFiles "$Prefix-Tests.txt"; - - my @RawTestsAddedArray = split '\n', $RTestsAdded; - my @RawTestsRemovedArray = split '\n', $RTestsRemoved; - - my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_} - @RawTestsRemovedArray; - my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_} - @RawTestsAddedArray; - - foreach $Test (keys %NewTests) { - if (!exists $OldTests{$Test}) { # TestAdded if in New but not old - $TestsAdded = "$TestsAdded$Test\n"; - } else { - if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass? - $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure - } else { - $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass. - } - } - } - foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New - $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test}); +if (!$BuildError) { + if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; } + my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize, + $MachCodeSize) = ("","","","","","",""); + if (!$NORUNNINGTESTS) { + ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden", + "Olden Test Directory"); + + # Clean out previous results... + system "$NICE $MAKECMD $MAKEOPTS clean > /dev/null 2>&1"; + + # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and + # GET_STABLE_NUMBERS enabled! + if( $VERBOSE ) { + print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out " . + "TEST=nightly LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 " . + "> /dev/null 2>&1\n"; } - - #print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded); - #print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved); - #print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed); - #print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken); - - #$TestsAdded = AddPreTag $TestsAdded; - #$TestsRemoved = AddPreTag $TestsRemoved; - #$TestsFixed = AddPreTag $TestsFixed; - #$TestsBroken = AddPreTag $TestsBroken; + system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out " . + "TEST=nightly LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 " . + "> /dev/null 2>&1"; + system "cp report.nightly.csv $OldenTestsLog"; + } } ############################################################## # -# If we built the tree successfully, runs of the Olden suite with -# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics. +# Getting end timestamp # ############################################################## -if (!$BuildError) { - if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; } - my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize, - $MachCodeSize) = ("","","","","","",""); - if (!$NORUNNINGTESTS) { - ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden", - "Olden Test Directory"); - - # Clean out previous results... - system "$NICE make $MAKEOPTS clean > /dev/null 2>&1"; - - # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and - # GET_STABLE_NUMBERS enabled! - if( $VERBOSE ) { print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " . - " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1\n"; } - system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " . - " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1"; - system "cp report.nightly.csv $OldenTestsLog"; - } #else { - #system "gunzip ${OldenTestsLog}.gz"; - #} - - # Now we know we have $OldenTestsLog as the raw output file. Split - # it up into records and read the useful information. - #my @Records = split />>> ========= /, ReadFile "$OldenTestsLog"; - #shift @Records; # Delete the first (garbage) record - - # Loop over all of the records, summarizing them into rows for the running - # totals file. - #my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock"; - #foreach $Rec (@Records) { - #my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec; - #my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec; - #my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec; - #my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec; - #my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec; - #my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec; - - #$NATTime .= " " . FormatTime($rNATTime); - #$CBETime .= " " . FormatTime($rCBETime); - #$LLCTime .= " " . FormatTime($rLLCTime); - #$JITTime .= " " . FormatTime($rJITTime); - #$OptTime .= " $rOptTime"; - #$BytecodeSize .= " $rBytecodeSize"; - #} - # - # Now that we have all of the numbers we want, add them to the running totals - # files. - #AddRecord($NATTime, "running_Olden_nat_time.txt", $WebDir); - #AddRecord($CBETime, "running_Olden_cbe_time.txt", $WebDir); - #AddRecord($LLCTime, "running_Olden_llc_time.txt", $WebDir); - #AddRecord($JITTime, "running_Olden_jit_time.txt", $WebDir); - #AddRecord($OptTime, "running_Olden_opt_time.txt", $WebDir); - #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir); -} +$endtime = `date "+20%y-%m-%d %H:%M:%S"`; ############################################################## @@ -916,7 +1026,6 @@ if (!$BuildError) { # Place all the logs neatly into one humungous file # ############################################################## - if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; } $machine_data = "uname: ".`uname -a`. @@ -928,7 +1037,7 @@ $machine_data = "uname: ".`uname -a`. my @CVS_DATA; my $cvs_data; -@CVS_DATA = ReadFile "$CVSLog"; +@CVS_DATA = ReadFile "$COLog"; $cvs_data = join("\n", @CVS_DATA); my @BUILD_DATA; @@ -936,23 +1045,41 @@ my $build_data; @BUILD_DATA = ReadFile "$BuildLog"; $build_data = join("\n", @BUILD_DATA); -my @DEJAGNU_LOG; -my @DEJAGNU_SUM; -my $dejagnutests_log; -my $dejagnutests_sum; -@DEJAGNU_LOG = ReadFile "$DejagnuLog"; -@DEJAGNU_SUM = ReadFile "$DejagnuSum"; -$dejagnutests_log = join("\n", @DEJAGNU_LOG); -$dejagnutests_sum = join("\n", @DEJAGNU_SUM); +my (@DEJAGNU_LOG, @DEJAGNU_SUM, @DEJAGNULOG_FULL, @GCC_VERSION); +my ($dejagnutests_log ,$dejagnutests_sum, $dejagnulog_full) = ""; +my ($gcc_version, $gcc_version_long) = ""; -my @DEJAGNULOG_FULL; -my $dejagnulog_full; -@DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog"; -$dejagnulog_full = join("\n", @DEJAGNULOG_FULL); +$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]; -my $gcc_version_long = `gcc --version`; -@GCC_VERSION = split "\n", $gcc_version_long; -my $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"; + $dejagnutests_log = join("\n", @DEJAGNU_LOG); + $dejagnutests_sum = join("\n", @DEJAGNU_SUM); + + @DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog"; + $dejagnulog_full = join("\n", @DEJAGNULOG_FULL); +} ############################################################## # @@ -962,56 +1089,60 @@ my $gcc_version = $GCC_VERSION[0]; if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; } - -my $host = "llvm.org"; -my $file = "/nightlytest/NightlyTestAccept.cgi"; -my %hash_of_data = ('machine_data' => $machine_data, - 'build_data' => $build_data, - 'gcc_version' => $gcc_version, - 'nickname' => $nickname, - 'dejagnutime_wall' => $DejagnuWallTime, - 'dejagnutime_cpu' => $DejagnuTime, - 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall, - 'cvscheckouttime_cpu' => $CVSCheckoutTime_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' => $ExternalSourceProgramsTable, - 'llcbeta_options' => $multisource_llcbeta_options, - 'warnings_removed' => $WarningsRemoved, - 'warnings_added' => $WarningsAdded, - 'newly_passing_tests' => $TestsFixed, - 'newly_failing_tests' => $TestsBroken, - 'new_tests' => $TestsAdded, - 'removed_tests' => $TestsRemoved, - 'unexpfail_tests' => $unexpfail_tests, - 'dejagnutests_log' => $dejagnutests_log, - 'dejagnutests_sum' => $dejagnutests_sum); +my %hash_of_data = ( + 'machine_data' => $machine_data, + 'build_data' => $build_data, + 'gcc_version' => $gcc_version, + 'nickname' => $nickname, + 'dejagnutime_wall' => $DejagnuWallTime, + 'dejagnutime_cpu' => $DejagnuTime, + '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, + '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, + 'starttime' => $starttime, + 'endtime' => $endtime, + 'o_file_sizes' => $o_file_sizes, + 'a_file_sizes' => $a_file_sizes, + 'target_triple' => $targetTriple +); $TESTING = 0; -if($TESTING){ - print "============================\n"; - foreach $x(keys %hash_of_data){ - print "$x => $hash_of_data{$x}\n"; - } -} -else{ - my $response = SendData $host,$file,\%hash_of_data; - print "============================\n$response"; +if ($TESTING) { + 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"; } } ############################################################## @@ -1019,6 +1150,7 @@ else{ # Remove the cvs tree... # ############################################################## -system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE); - - +system ( "$NICE rm -rf $BuildDir") + if (!$NOCHECKOUT and !$NOREMOVE); +system ( "$NICE rm -rf $WebDir") + if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);