Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 2 | use POSIX qw(strftime); |
| 3 | use File::Copy; |
| 4 | use Socket; |
| 5 | |
| 6 | # |
| 7 | # Program: NewNightlyTest.pl |
| 8 | # |
| 9 | # Synopsis: Perform a series of tests which are designed to be run nightly. |
| 10 | # This is used to keep track of the status of the LLVM tree, tracking |
| 11 | # regressions and performance changes. Submits this information |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 12 | # to llvm.org where it is placed into the nightlytestresults database. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 13 | # |
| 14 | # Modified heavily by Patrick Jenkins, July 2006 |
| 15 | # |
| 16 | # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] |
| 17 | # where |
| 18 | # OPTIONS may include one or more of the following: |
| 19 | # -nocheckout Do not create, checkout, update, or configure |
| 20 | # the source tree. |
| 21 | # -noremove Do not remove the BUILDDIR after it has been built. |
Patrick Jenkins | a5c04d6 | 2006-07-07 17:31:38 +0000 | [diff] [blame] | 22 | # -noremoveresults Do not remove the WEBDIR after it has been built. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 23 | # -nobuild Do not build llvm. If tests are enabled perform them |
| 24 | # on the llvm build specified in the build directory |
| 25 | # -notest Do not even attempt to run the test programs. Implies |
| 26 | # -norunningtests. |
| 27 | # -norunningtests Do not run the Olden benchmark suite with |
| 28 | # LARGE_PROBLEM_SIZE enabled. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 29 | # -nodejagnu Do not run feature or regression tests |
| 30 | # -parallel Run two parallel jobs with GNU Make. |
| 31 | # -release Build an LLVM Release version |
Jim Laskey | 27b8ba0 | 2006-09-28 17:49:20 +0000 | [diff] [blame] | 32 | # -release-asserts Build an LLVM ReleaseAsserts version |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 33 | # -enable-llcbeta Enable testing of beta features in llc. |
Reid Spencer | 2bae1f5 | 2006-11-24 20:34:16 +0000 | [diff] [blame] | 34 | # -enable-lli Enable testing of lli (interpreter) features, default is off |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 35 | # -disable-llc Disable LLC tests in the nightly tester. |
| 36 | # -disable-jit Disable JIT tests in the nightly tester. |
| 37 | # -disable-cbe Disable C backend tests in the nightly tester. |
| 38 | # -verbose Turn on some debug output |
| 39 | # -debug Print information useful only to maintainers of this script. |
| 40 | # -nice Checkout/Configure/Build with "nice" to reduce impact |
| 41 | # on busy servers. |
| 42 | # -f2c Next argument specifies path to F2C utility |
| 43 | # -nickname The next argument specifieds the nickname this script |
| 44 | # will submit to the nightlytest results repository. |
| 45 | # -gccpath Path to gcc/g++ used to build LLVM |
| 46 | # -cvstag Check out a specific CVS tag to build LLVM (useful for |
| 47 | # testing release branches) |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 48 | # -usesvn Check code out from a subversion repository. With no |
| 49 | # argument, use the standard repository. An argument specifies |
| 50 | # the repository URL to use. |
| 51 | # -svnurl Specify the SVN URL where LLVM can be found |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 52 | # -target Specify the target triplet |
| 53 | # -cflags Next argument specifies that C compilation options that |
| 54 | # override the default. |
| 55 | # -cxxflags Next argument specifies that C++ compilation options that |
| 56 | # override the default. |
| 57 | # -ldflags Next argument specifies that linker options that override |
| 58 | # the default. |
Patrick Jenkins | 215b48f | 2006-07-07 18:50:51 +0000 | [diff] [blame] | 59 | # -compileflags Next argument specifies extra options passed to make when |
| 60 | # building LLVM. |
Patrick Jenkins | 0e9402f | 2006-08-11 23:02:09 +0000 | [diff] [blame] | 61 | # -use-gmake Use gmake instead of the default make command to build |
Patrick Jenkins | 1cd4691 | 2006-07-27 01:17:17 +0000 | [diff] [blame] | 62 | # llvm and run tests. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 63 | # |
| 64 | # ---------------- Options to configure llvm-test ---------------------------- |
Patrick Jenkins | 215b48f | 2006-07-07 18:50:51 +0000 | [diff] [blame] | 65 | # -extraflags Next argument specifies extra options that are passed to |
| 66 | # compile the tests. |
| 67 | # -noexternals Do not run the external tests (for cases where povray |
| 68 | # or SPEC are not installed) |
| 69 | # -with-externals Specify a directory where the external tests are located. |
Patrick Jenkins | 0e9402f | 2006-08-11 23:02:09 +0000 | [diff] [blame] | 70 | # -submit-server Specifies a server to submit the test results too. If this |
| 71 | # option is not specified it defaults to |
| 72 | # llvm.org. This is basically just the address of the |
| 73 | # webserver |
| 74 | # -submit-script Specifies which script to call on the submit server. If |
| 75 | # this option is not specified it defaults to |
Jim Laskey | 6d8a1b7 | 2006-09-15 17:03:36 +0000 | [diff] [blame] | 76 | # /nightlytest/NightlyTestAccept.php. This is basically |
Patrick Jenkins | 0e9402f | 2006-08-11 23:02:09 +0000 | [diff] [blame] | 77 | # everything after the www.yourserver.org. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 78 | # |
| 79 | # CVSROOT is the CVS repository from which the tree will be checked out, |
| 80 | # specified either in the full :method:user@host:/dir syntax, or |
| 81 | # just /dir if using a local repo. |
| 82 | # BUILDDIR is the directory where sources for this test run will be checked out |
| 83 | # AND objects for this test run will be built. This directory MUST NOT |
| 84 | # exist before the script is run; it will be created by the cvs checkout |
| 85 | # process and erased (unless -noremove is specified; see above.) |
| 86 | # WEBDIR is the directory into which the test results web page will be written, |
| 87 | # AND in which the "index.html" is assumed to be a symlink to the most recent |
| 88 | # copy of the results. This directory will be created if it does not exist. |
| 89 | # LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed |
| 90 | # to. This is the same as you would have for a normal LLVM build. |
| 91 | # |
| 92 | ############################################################## |
| 93 | # |
| 94 | # Getting environment variables |
| 95 | # |
| 96 | ############################################################## |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 97 | my $HOME = $ENV{'HOME'}; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 98 | my $SVNURL = $ENV{"SVNURL"}; |
| 99 | $SVNURL = 'svn://anon@hlvm.org:3691/llvm.svn' unless $SVNURL; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 100 | my $CVSRootDir = $ENV{'CVSROOT'}; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 101 | $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 102 | my $BuildDir = $ENV{'BUILDDIR'}; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 103 | $BuildDir = "$HOME/buildtest" unless $BuildDir; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 104 | my $WebDir = $ENV{'WEBDIR'}; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 105 | $WebDir = "$HOME/cvs/testresults-X86" unless $WebDir; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 106 | |
| 107 | ############################################################## |
| 108 | # |
| 109 | # Calculate the date prefix... |
| 110 | # |
| 111 | ############################################################## |
| 112 | @TIME = localtime; |
| 113 | my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3]; |
| 114 | my $DateString = strftime "%B %d, %Y", localtime; |
| 115 | my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)"; |
| 116 | |
| 117 | ############################################################## |
| 118 | # |
| 119 | # Parse arguments... |
| 120 | # |
| 121 | ############################################################## |
| 122 | $CONFIGUREARGS=""; |
Patrick Jenkins | 49717a4 | 2006-07-21 01:39:42 +0000 | [diff] [blame] | 123 | $nickname=""; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 124 | $NOTEST=0; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 125 | $USESVN=0; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 126 | $NORUNNINGTESTS=0; |
Patrick Jenkins | 1cd4691 | 2006-07-27 01:17:17 +0000 | [diff] [blame] | 127 | $MAKECMD="make"; |
Patrick Jenkins | 0e9402f | 2006-08-11 23:02:09 +0000 | [diff] [blame] | 128 | $SUBMITSERVER = "llvm.org"; |
Jim Laskey | 6d8a1b7 | 2006-09-15 17:03:36 +0000 | [diff] [blame] | 129 | $SUBMITSCRIPT = "/nightlytest/NightlyTestAccept.php"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 130 | |
| 131 | while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 132 | shift; |
| 133 | last if /^--$/; # Stop processing arguments on -- |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 134 | |
| 135 | # List command line options here... |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 136 | if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; } |
| 137 | if (/^-nocvsstats$/) { $NOCVSSTATS = 1; next; } |
| 138 | if (/^-noremove$/) { $NOREMOVE = 1; next; } |
| 139 | if (/^-noremoveresults$/){ $NOREMOVERESULTS = 1; next; } |
| 140 | if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; } |
| 141 | if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; } |
| 142 | if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; } |
| 143 | if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". |
| 144 | "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;} |
Jim Laskey | 27b8ba0 | 2006-09-28 17:49:20 +0000 | [diff] [blame] | 145 | if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". |
| 146 | "DISABLE-ASSERTIONS=1 ". |
Reid Spencer | 93c456c | 2006-10-19 15:24:04 +0000 | [diff] [blame] | 147 | "OPTIMIZE_OPTION=-O2"; |
| 148 | $BUILDTYPE="release-asserts"; next;} |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 149 | if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } |
Reid Spencer | 2bae1f5 | 2006-11-24 20:34:16 +0000 | [diff] [blame] | 150 | if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; |
| 151 | $CONFIGUREARGS .= " --enable-lli"; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 152 | if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; |
| 153 | $CONFIGUREARGS .= " --disable-llc_diffs"; next; } |
| 154 | if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1"; |
| 155 | $CONFIGUREARGS .= " --disable-jit"; next; } |
| 156 | if (/^-disable-cbe$/) { $PROGTESTOPTS .= " DISABLE_CBE=1"; next; } |
| 157 | if (/^-verbose$/) { $VERBOSE = 1; next; } |
| 158 | if (/^-debug$/) { $DEBUG = 1; next; } |
| 159 | if (/^-nice$/) { $NICE = "nice "; next; } |
| 160 | if (/^-f2c$/) { $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; |
| 161 | shift; next; } |
| 162 | if (/^-with-externals$/) { $CONFIGUREARGS .= " --with-externals=$ARGV[0]"; |
| 163 | shift; next; } |
| 164 | if (/^-submit-server/) { $SUBMITSERVER = "$ARGV[0]"; shift; next; } |
| 165 | if (/^-submit-script/) { $SUBMITSCRIPT = "$ARGV[0]"; shift; next; } |
| 166 | if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; } |
| 167 | if (/^-gccpath/) { $CONFIGUREARGS .= |
| 168 | " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; |
| 169 | $GCCPATH=$ARGV[0]; shift; next; } |
| 170 | else { $GCCPATH=""; } |
| 171 | if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; } |
| 172 | else { $CVSCOOPT="";} |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 173 | if (/^-usesvn/) { $USESVN = 1; } |
| 174 | if (/^-svnurl/) { $SVNURL = $ARGV[0]; shift; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 175 | if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]"; |
| 176 | shift; next; } |
| 177 | if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; |
| 178 | shift; next; } |
| 179 | if (/^-cxxflags/) { $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; |
| 180 | shift; next; } |
| 181 | if (/^-ldflags/) { $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; |
| 182 | shift; next; } |
| 183 | if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; } |
| 184 | if (/^-use-gmake/) { $MAKECMD = "gmake"; shift; next; } |
| 185 | if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; } |
| 186 | if (/^-extraflags/) { $CONFIGUREARGS .= |
| 187 | " --with-extra-options=\'$ARGV[0]\'"; shift; next;} |
| 188 | if (/^-noexternals$/) { $NOEXTERNALS = 1; next; } |
| 189 | if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; } |
| 190 | if (/^-nobuild$/) { $NOBUILD = 1; next; } |
| 191 | print "Unknown option: $_ : ignoring!\n"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | if ($ENV{'LLVMGCCDIR'}) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 195 | $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'}; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 196 | } |
| 197 | if ($CONFIGUREARGS !~ /--disable-jit/) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 198 | $CONFIGUREARGS .= " --enable-jit"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 199 | } |
| 200 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 201 | if (@ARGV != 0 and @ARGV != 3 and $VERBOSE) { |
| 202 | foreach $x (@ARGV) { |
| 203 | print "$x\n"; |
| 204 | } |
| 205 | print "Must specify 0 or 3 options!"; |
Patrick Jenkins | f58473f | 2006-07-27 01:03:46 +0000 | [diff] [blame] | 206 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 207 | |
| 208 | if (@ARGV == 3) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 209 | $CVSRootDir = $ARGV[0]; |
| 210 | $BuildDir = $ARGV[1]; |
| 211 | $WebDir = $ARGV[2]; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 214 | if ($CVSRootDir eq "" or |
| 215 | $BuildDir eq "" or |
| 216 | $WebDir eq "") { |
| 217 | die("please specify a cvs root directory, a build directory, and a ". |
Patrick Jenkins | f58473f | 2006-07-27 01:03:46 +0000 | [diff] [blame] | 218 | "web directory"); |
| 219 | } |
| 220 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 221 | if ($nickname eq "") { |
| 222 | die ("Please invoke NewNightlyTest.pl with command line option " . |
| 223 | "\"-nickname <nickname>\""); |
Patrick Jenkins | 514e258 | 2006-07-20 22:28:43 +0000 | [diff] [blame] | 224 | } |
Patrick Jenkins | 1cd4691 | 2006-07-27 01:17:17 +0000 | [diff] [blame] | 225 | |
Jim Laskey | 27b8ba0 | 2006-09-28 17:49:20 +0000 | [diff] [blame] | 226 | if ($BUILDTYPE ne "release" && $BUILDTYPE ne "release-asserts") { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 227 | $BUILDTYPE = "debug"; |
Patrick Jenkins | 26ba609 | 2006-07-23 22:57:28 +0000 | [diff] [blame] | 228 | } |
Patrick Jenkins | 514e258 | 2006-07-20 22:28:43 +0000 | [diff] [blame] | 229 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 230 | ############################################################## |
| 231 | # |
| 232 | #define the file names we'll use |
| 233 | # |
| 234 | ############################################################## |
| 235 | my $Prefix = "$WebDir/$DATE"; |
| 236 | my $BuildLog = "$Prefix-Build-Log.txt"; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 237 | my $COLog = "$Prefix-CVS-Log.txt"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 238 | my $OldenTestsLog = "$Prefix-Olden-tests.txt"; |
| 239 | my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz"; |
| 240 | my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz"; |
Patrick Jenkins | 26ba609 | 2006-07-23 22:57:28 +0000 | [diff] [blame] | 241 | my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 242 | my $DejagnuLog = "$Prefix-Dejagnu-testrun.log"; |
| 243 | my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum"; |
| 244 | my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt"; |
| 245 | if (! -d $WebDir) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 246 | mkdir $WebDir, 0777; |
Patrick Jenkins | 0313775 | 2006-08-21 20:45:57 +0000 | [diff] [blame] | 247 | if($VERBOSE){ |
| 248 | warn "$WebDir did not exist; creating it.\n"; |
| 249 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | if ($VERBOSE) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 253 | print "INITIALIZED\n"; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 254 | if ($USESVN) { |
| 255 | print "SVN URL = $SVNURL\n"; |
| 256 | } else { |
| 257 | print "CVS Root = $CVSRootDir\n"; |
| 258 | } |
| 259 | print "COLog = $COLog\n"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 260 | print "BuildDir = $BuildDir\n"; |
| 261 | print "WebDir = $WebDir\n"; |
| 262 | print "Prefix = $Prefix\n"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 263 | print "BuildLog = $BuildLog\n"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | ############################################################## |
| 267 | # |
| 268 | # Helper functions |
| 269 | # |
| 270 | ############################################################## |
| 271 | sub GetDir { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 272 | my $Suffix = shift; |
| 273 | opendir DH, $WebDir; |
| 274 | my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH; |
| 275 | closedir DH; |
| 276 | return @Result; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 280 | # |
| 281 | # DiffFiles - Diff the current version of the file against the last version of |
| 282 | # the file, reporting things added and removed. This is used to report, for |
| 283 | # example, added and removed warnings. This returns a pair (added, removed) |
| 284 | # |
| 285 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 286 | sub DiffFiles { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 287 | my $Suffix = shift; |
| 288 | my @Others = GetDir $Suffix; |
| 289 | if (@Others == 0) { # No other files? We added all entries... |
| 290 | return (`cat $WebDir/$DATE$Suffix`, ""); |
| 291 | } |
| 292 | # Diff the files now... |
| 293 | my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`; |
| 294 | my $Added = join "\n", grep /^</, @Diffs; |
| 295 | my $Removed = join "\n", grep /^>/, @Diffs; |
| 296 | $Added =~ s/^< //gm; |
| 297 | $Removed =~ s/^> //gm; |
| 298 | return ($Added, $Removed); |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 302 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 303 | sub GetRegex { # (Regex with ()'s, value) |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 304 | $_[1] =~ /$_[0]/m; |
| 305 | return $1 |
| 306 | if (defined($1)); |
| 307 | return "0"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 311 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 312 | sub GetRegexNum { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 313 | my ($Regex, $Num, $Regex2, $File) = @_; |
| 314 | my @Items = split "\n", `grep '$Regex' $File`; |
| 315 | return GetRegex $Regex2, $Items[$Num]; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 319 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 320 | sub ChangeDir { # directory, logical name |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 321 | my ($dir,$name) = @_; |
| 322 | chomp($dir); |
| 323 | if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; } |
| 324 | $result = chdir($dir); |
| 325 | if (!$result) { |
| 326 | print "ERROR!!! Cannot change directory to: $name ($dir) because $!"; |
| 327 | return false; |
| 328 | } |
| 329 | return true; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 333 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 334 | sub ReadFile { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 335 | if (open (FILE, $_[0])) { |
| 336 | undef $/; |
| 337 | my $Ret = <FILE>; |
| 338 | close FILE; |
| 339 | $/ = '\n'; |
| 340 | return $Ret; |
| 341 | } else { |
| 342 | print "Could not open file '$_[0]' for reading!\n"; |
| 343 | return ""; |
| 344 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 345 | } |
| 346 | |
| 347 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 348 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 349 | sub WriteFile { # (filename, contents) |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 350 | open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n"; |
| 351 | print FILE $_[1]; |
| 352 | close FILE; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 356 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 357 | sub CopyFile { #filename, newfile |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 358 | my ($file, $newfile) = @_; |
| 359 | chomp($file); |
| 360 | if ($VERBOSE) { print "Copying $file to $newfile\n"; } |
| 361 | copy($file, $newfile); |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 365 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 366 | sub AddRecord { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 367 | my ($Val, $Filename,$WebDir) = @_; |
| 368 | my @Records; |
| 369 | if (open FILE, "$WebDir/$Filename") { |
| 370 | @Records = grep !/$DATE/, split "\n", <FILE>; |
| 371 | close FILE; |
| 372 | } |
| 373 | push @Records, "$DATE: $Val"; |
| 374 | WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 375 | } |
| 376 | |
| 377 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 378 | # |
| 379 | # FormatTime - Convert a time from 1m23.45 into 83.45 |
| 380 | # |
| 381 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 382 | sub FormatTime { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 383 | my $Time = shift; |
| 384 | if ($Time =~ m/([0-9]+)m([0-9.]+)/) { |
| 385 | $Time = sprintf("%7.4f", $1*60.0+$2); |
| 386 | } |
| 387 | return $Time; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 391 | # |
| 392 | # This function is meant to read in the dejagnu sum file and |
| 393 | # return a string with only the results (i.e. PASS/FAIL/XPASS/ |
| 394 | # XFAIL). |
| 395 | # |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 396 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 397 | sub GetDejagnuTestResults { # (filename, log) |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 398 | my ($filename, $DejagnuLog) = @_; |
| 399 | my @lines; |
| 400 | $/ = "\n"; #Make sure we're going line at a time. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 401 | |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 402 | if( $VERBOSE) { print "DEJAGNU TEST RESULTS:\n"; } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 403 | |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 404 | if (open SRCHFILE, $filename) { |
| 405 | # Process test results |
| 406 | while ( <SRCHFILE> ) { |
| 407 | if ( length($_) > 1 ) { |
| 408 | chomp($_); |
Jim Laskey | 01d7bcf | 2006-09-20 09:20:22 +0000 | [diff] [blame] | 409 | if ( m/^(PASS|XPASS|FAIL|XFAIL): .*\/llvm\/test\/(.*)$/ ) { |
| 410 | push(@lines, "$1: test/$2"); |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 411 | } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 412 | } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 413 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 414 | } |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 415 | close SRCHFILE; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 416 | |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 417 | my $content = join("\n", @lines); |
| 418 | return $content; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 422 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 423 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 424 | # |
| 425 | # This function acts as a mini web browswer submitting data |
| 426 | # to our central server via the post method |
| 427 | # |
| 428 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 429 | sub SendData{ |
| 430 | $host = $_[0]; |
| 431 | $file = $_[1]; |
| 432 | $variables=$_[2]; |
| 433 | |
| 434 | $port=80; |
| 435 | $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n"; |
Patrick Jenkins | adea55e | 2006-07-17 16:41:19 +0000 | [diff] [blame] | 436 | socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 437 | die "Bad socket\n"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 438 | connect SOCK, $socketaddr or die "Bad connection\n"; |
| 439 | select((select(SOCK), $| = 1)[0]); |
| 440 | |
| 441 | #creating content here |
| 442 | my $content; |
| 443 | foreach $key (keys (%$variables)){ |
| 444 | $value = $variables->{$key}; |
| 445 | $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; |
| 446 | $content .= "$key=$value&"; |
| 447 | } |
| 448 | |
| 449 | $length = length($content); |
| 450 | |
| 451 | my $send= "POST $file HTTP/1.0\n"; |
| 452 | $send.= "Content-Type: application/x-www-form-urlencoded\n"; |
| 453 | $send.= "Content-length: $length\n\n"; |
| 454 | $send.= "$content"; |
| 455 | |
Patrick Jenkins | e8501eb | 2006-08-07 01:54:37 +0000 | [diff] [blame] | 456 | print SOCK $send; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 457 | my $result; |
| 458 | while(<SOCK>){ |
| 459 | $result .= $_; |
| 460 | } |
| 461 | close(SOCK); |
| 462 | |
| 463 | my $sentdata=""; |
Patrick Jenkins | 4c4e356 | 2006-07-07 21:40:34 +0000 | [diff] [blame] | 464 | foreach $x (keys (%$variables)){ |
Patrick Jenkins | 7267bd6 | 2006-07-10 18:35:41 +0000 | [diff] [blame] | 465 | $value = $variables->{$x}; |
| 466 | $sentdata.= "$x => $value\n"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 467 | } |
| 468 | WriteFile "$Prefix-sentdata.txt", $sentdata; |
Patrick Jenkins | 4c4e356 | 2006-07-07 21:40:34 +0000 | [diff] [blame] | 469 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 470 | |
| 471 | return $result; |
| 472 | } |
| 473 | |
Patrick Jenkins | 215b48f | 2006-07-07 18:50:51 +0000 | [diff] [blame] | 474 | ############################################################## |
| 475 | # |
| 476 | # Getting Start timestamp |
| 477 | # |
| 478 | ############################################################## |
Patrick Jenkins | b67e118 | 2006-07-21 21:43:09 +0000 | [diff] [blame] | 479 | $starttime = `date "+20%y-%m-%d %H:%M:%S"`; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 480 | |
| 481 | ############################################################## |
| 482 | # |
| 483 | # Create the CVS repository directory |
| 484 | # |
| 485 | ############################################################## |
| 486 | if (!$NOCHECKOUT) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 487 | if (-d $BuildDir) { |
| 488 | if (!$NOREMOVE) { |
| 489 | if ( $VERBOSE ) { |
| 490 | print "Build directory exists! Removing it\n"; |
| 491 | } |
| 492 | system "rm -rf $BuildDir"; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 493 | mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 494 | } else { |
Jim Laskey | 6d8a1b7 | 2006-09-15 17:03:36 +0000 | [diff] [blame] | 495 | if ( $VERBOSE ) { |
| 496 | print "Build directory exists!\n"; |
| 497 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 498 | } |
Jim Laskey | 6d8a1b7 | 2006-09-15 17:03:36 +0000 | [diff] [blame] | 499 | } else { |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 500 | mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 501 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 502 | } |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 503 | ChangeDir( $BuildDir, "checkout directory" ); |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 504 | |
| 505 | |
| 506 | ############################################################## |
| 507 | # |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 508 | # Check out the llvm tree, using either SVN or CVS |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 509 | # |
| 510 | ############################################################## |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 511 | if (!$NOCHECKOUT) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 512 | if ( $VERBOSE ) { |
| 513 | print "CHECKOUT STAGE:\n"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 514 | } |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 515 | if ($USESVN) { |
| 516 | my $SVNCMD = "$NICE svn co $SVNURL"; |
| 517 | if ($VERBOSE) { |
| 518 | print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . |
| 519 | "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n"; |
| 520 | system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . |
| 521 | "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n"; |
| 522 | } |
| 523 | } else { |
| 524 | my $CVSOPT = ""; |
| 525 | $CVSOPT = "-z3" # Use compression if going over ssh. |
| 526 | if $CVSRootDir =~ /^:ext:/; |
| 527 | my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT"; |
| 528 | print "( time -p $CVSCMD llvm; cd llvm/projects ; " . |
Reid Spencer | b5fda75 | 2007-04-07 05:20:07 +0000 | [diff] [blame^] | 529 | "$CVSCMD llvm-test ) > $COLog 2>&1\n"; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 530 | system "( time -p $CVSCMD llvm; cd llvm/projects ; " . |
Reid Spencer | b5fda75 | 2007-04-07 05:20:07 +0000 | [diff] [blame^] | 531 | "$CVSCMD llvm-test ) > $COLog 2>&1\n"; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 532 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 533 | } |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 534 | ChangeDir( $BuildDir , "Checkout directory") ; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 535 | ChangeDir( "llvm" , "llvm source directory") ; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 536 | |
| 537 | ############################################################## |
| 538 | # |
| 539 | # Get some static statistics about the current state of CVS |
| 540 | # |
| 541 | # This can probably be put on the server side |
| 542 | # |
| 543 | ############################################################## |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 544 | my $CheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $COLog`; |
| 545 | my $CheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $COLog`; |
| 546 | my $CheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $COLog`; |
| 547 | my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 548 | |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 549 | my $NumFilesInCVS = 0; |
| 550 | my $NumDirsInCVS = 0; |
| 551 | if ($USESVN) { |
| 552 | $NumFilesInCVS = `egrep '^A' $COLog | wc -l` + 0; |
| 553 | $NumDirsInCVS = `sed -e 's#/[^/]*$##' $COLog | sort | uniq | wc -l` + 0; |
| 554 | } else { |
| 555 | $NumFilesInCVS = `egrep '^U' $COLog | wc -l` + 0; |
| 556 | $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $COLog | wc -l` + 0; |
| 557 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 558 | |
| 559 | ############################################################## |
| 560 | # |
| 561 | # Extract some information from the CVS history... use a hash so no duplicate |
| 562 | # stuff is stored. This gets the history from the previous days worth |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 563 | # of cvs activity and parses it. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 564 | # |
| 565 | ############################################################## |
| 566 | |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 567 | # This just computes a reasonably accurate #of seconds since 2000. It doesn't |
| 568 | # have to be perfect as its only used for comparing date ranges within a couple |
| 569 | # of days. |
| 570 | sub ConvertToSeconds { |
| 571 | my ($sec, $min, $hour, $day, $mon, $yr) = @_; |
| 572 | my $Result = ($yr - 2000) * 12; |
| 573 | $Result += $mon; |
| 574 | $Result *= 31; |
| 575 | $Result += $day; |
| 576 | $Result *= 24; |
| 577 | $Result += $hour; |
| 578 | $Result *= 60; |
| 579 | $Result += $min; |
| 580 | $Result *= 60; |
| 581 | $Result += $sec; |
| 582 | return $Result; |
| 583 | } |
| 584 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 585 | my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated); |
| 586 | |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 587 | if (!$NOCVSSTATS) { |
| 588 | if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } |
Reid Spencer | 776964a | 2007-04-04 06:59:36 +0000 | [diff] [blame] | 589 | |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 590 | if ($USESVN) { |
| 591 | @SVNHistory = split /<logentry/, `svn log --xml --verbose -r{$DATE}:HEAD`; |
| 592 | # Skip very first entry because it is the XML header cruft |
| 593 | shift @SVNHistory; |
| 594 | my $Now = time(); |
| 595 | foreach $Record (@SVNHistory) { |
| 596 | my @Lines = split "\n", $Record; |
| 597 | my ($Author, $Date, $Revision); |
| 598 | # Get the date and see if its one we want to process. |
| 599 | my ($Year, $Month, $Day, $Hour, $Min, $Sec); |
| 600 | if ($Lines[3] =~ /<date>(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/){ |
| 601 | $Year = $1; $Month = $2; $Day = $3; $Hour = $4; $Min = $5; $Sec = $6; |
| 602 | } |
| 603 | my $Then = ConvertToSeconds($Sec, $Min, $Hour, $Day, $Month, $Year); |
| 604 | # Get the current date and compute when "yesterday" is. |
| 605 | my ($NSec, $NMin, $NHour, $NDay, $NMon, $NYear) = gmtime(); |
| 606 | my $Now = ConvertToSeconds( $NSec, $NMin, $NHour, $NDay, $NMon, $NYear); |
| 607 | if (($Now - 24*60*60) > $Then) { |
| 608 | next; |
| 609 | } |
| 610 | if ($Lines[1] =~ / revision="([0-9]*)">/) { |
| 611 | $Revision = $1; |
| 612 | } |
| 613 | if ($Lines[2] =~ /<author>([^<]*)<\/author>/) { |
| 614 | $Author = $1; |
| 615 | } |
| 616 | $UsersCommitted{$Author} = 1; |
| 617 | $Date = $Year . "-" . $Month . "-" . $Day; |
| 618 | $Time = $Hour . ":" . $Min . ":" . $Sec; |
| 619 | print "Rev: $Revision, Author: $Author, Date: $Date, Time: $Time\n"; |
| 620 | for ($i = 6; $i < $#Lines; $i += 2 ) { |
| 621 | if ($Lines[$i] =~ /^ action="(.)">([^<]*)</) { |
| 622 | if ($1 == "A") { |
| 623 | $AddedFiles{$2} = 1; |
| 624 | } elsif ($1 == 'D') { |
| 625 | $RemovedFiles{$2} = 1; |
| 626 | } elsif ($1 == 'M' || $1 == 'R' || $1 == 'C') { |
| 627 | $ModifiedFiles{$2} = 1; |
| 628 | } else { |
| 629 | print "UNMATCHABLE: $Lines[$i]\n"; |
| 630 | } |
| 631 | } |
| 632 | } |
| 633 | } |
| 634 | } else { |
| 635 | @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 636 | #print join "\n", @CVSHistory; print "\n"; |
| 637 | |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 638 | my $DateRE = '[-/:0-9 ]+\+[0-9]+'; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 639 | |
| 640 | # Loop over every record from the CVS history, filling in the hashes. |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 641 | foreach $File (@CVSHistory) { |
| 642 | my ($Type, $Date, $UID, $Rev, $Filename); |
| 643 | if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) { |
| 644 | ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5"); |
| 645 | } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) { |
| 646 | ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", ""); |
| 647 | } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) { |
| 648 | ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/"); |
| 649 | } else { |
| 650 | print "UNMATCHABLE: $File\n"; |
| 651 | next; |
| 652 | } |
| 653 | # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n"; |
| 654 | |
| 655 | if ($Filename =~ /^llvm/) { |
| 656 | if ($Type eq 'M') { # Modified |
| 657 | $ModifiedFiles{$Filename} = 1; |
| 658 | $UsersCommitted{$UID} = 1; |
| 659 | } elsif ($Type eq 'A') { # Added |
| 660 | $AddedFiles{$Filename} = 1; |
| 661 | $UsersCommitted{$UID} = 1; |
| 662 | } elsif ($Type eq 'R') { # Removed |
| 663 | $RemovedFiles{$Filename} = 1; |
| 664 | $UsersCommitted{$UID} = 1; |
| 665 | } else { |
| 666 | $UsersUpdated{$UID} = 1; |
| 667 | } |
| 668 | } |
| 669 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 670 | |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 671 | my $TestError = 1; |
| 672 | } #$USESVN |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 673 | }#!NOCVSSTATS |
| 674 | |
| 675 | my $CVSAddedFiles = join "\n", sort keys %AddedFiles; |
| 676 | my $CVSModifiedFiles = join "\n", sort keys %ModifiedFiles; |
| 677 | my $CVSRemovedFiles = join "\n", sort keys %RemovedFiles; |
| 678 | my $UserCommitList = join "\n", sort keys %UsersCommitted; |
| 679 | my $UserUpdateList = join "\n", sort keys %UsersUpdated; |
| 680 | |
| 681 | ############################################################## |
| 682 | # |
| 683 | # Build the entire tree, saving build messages to the build log |
| 684 | # |
| 685 | ############################################################## |
| 686 | if (!$NOCHECKOUT && !$NOBUILD) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 687 | my $EXTRAFLAGS = "--enable-spec --with-objroot=."; |
| 688 | if ( $VERBOSE ) { |
| 689 | print "CONFIGURE STAGE:\n"; |
| 690 | print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) " . |
| 691 | "> $BuildLog 2>&1\n"; |
| 692 | } |
| 693 | system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) " . |
| 694 | "> $BuildLog 2>&1"; |
| 695 | if ( $VERBOSE ) { |
| 696 | print "BUILD STAGE:\n"; |
| 697 | print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; |
| 698 | } |
| 699 | # Build the entire tree, capturing the output into $BuildLog |
| 700 | system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 701 | } |
| 702 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 703 | ############################################################## |
| 704 | # |
| 705 | # Get some statistics about the build... |
| 706 | # |
| 707 | ############################################################## |
| 708 | #this can de done on server |
| 709 | #my @Linked = split '\n', `grep Linking $BuildLog`; |
| 710 | #my $NumExecutables = scalar(grep(/executable/, @Linked)); |
| 711 | #my $NumLibraries = scalar(grep(!/executable/, @Linked)); |
| 712 | #my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0; |
| 713 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 714 | # Get the number of lines of source code. Must be here after the build is done |
| 715 | # because countloc.sh uses the llvm-config script which must be built. |
Patrick Jenkins | b993b0a | 2006-08-16 22:18:41 +0000 | [diff] [blame] | 716 | my $LOC = `utils/countloc.sh -topdir $BuildDir/llvm`; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 717 | |
| 718 | # Get the time taken by the configure script |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 719 | my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog"; |
| 720 | my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog"; |
| 721 | my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System |
| 722 | my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog"; |
| 723 | |
| 724 | $ConfigTime=-1 unless $ConfigTime; |
| 725 | $ConfigWallTime=-1 unless $ConfigWallTime; |
| 726 | |
| 727 | my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog"; |
| 728 | my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog"; |
| 729 | my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System |
| 730 | my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog"; |
| 731 | |
| 732 | $BuildTime=-1 unless $BuildTime; |
| 733 | $BuildWallTime=-1 unless $BuildWallTime; |
| 734 | |
| 735 | my $BuildError = 0, $BuildStatus = "OK"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 736 | if ($NOBUILD) { |
| 737 | $BuildStatus = "Skipped by user"; |
| 738 | $BuildError = 1; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 739 | } |
Patrick Jenkins | f58473f | 2006-07-27 01:03:46 +0000 | [diff] [blame] | 740 | elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 || |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 741 | `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l`+0) { |
| 742 | $BuildStatus = "Error: compilation aborted"; |
| 743 | $BuildError = 1; |
| 744 | if( $VERBOSE) { print "\n***ERROR BUILDING TREE\n\n"; } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 745 | } |
| 746 | if ($BuildError) { $NODEJAGNU=1; } |
| 747 | |
Patrick Jenkins | 169357e | 2006-07-23 21:38:07 +0000 | [diff] [blame] | 748 | my $a_file_sizes=""; |
| 749 | my $o_file_sizes=""; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 750 | if (!$BuildError) { |
| 751 | print "Organizing size of .o and .a files\n" |
| 752 | if ( $VERBOSE ); |
| 753 | ChangeDir( "$BuildDir/llvm", "Build Directory" ); |
| 754 | $afiles.= `find utils/ -iname '*.a' -ls`; |
| 755 | $afiles.= `find lib/ -iname '*.a' -ls`; |
| 756 | $afiles.= `find tools/ -iname '*.a' -ls`; |
| 757 | if($BUILDTYPE eq "release"){ |
Jim Laskey | 7a8efce | 2006-09-29 17:31:45 +0000 | [diff] [blame] | 758 | $afiles.= `find Release/ -iname '*.a' -ls`; |
Jim Laskey | 27b8ba0 | 2006-09-28 17:49:20 +0000 | [diff] [blame] | 759 | } elsif($BUILDTYPE eq "release-asserts") { |
| 760 | $afiles.= `find Release-Asserts/ -iname '*.a' -ls`; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 761 | } else { |
| 762 | $afiles.= `find Debug/ -iname '*.a' -ls`; |
| 763 | } |
| 764 | |
| 765 | $ofiles.= `find utils/ -iname '*.o' -ls`; |
| 766 | $ofiles.= `find lib/ -iname '*.o' -ls`; |
| 767 | $ofiles.= `find tools/ -iname '*.o' -ls`; |
| 768 | if($BUILDTYPE eq "release"){ |
Jim Laskey | 7a8efce | 2006-09-29 17:31:45 +0000 | [diff] [blame] | 769 | $ofiles.= `find Release/ -iname '*.o' -ls`; |
Jim Laskey | 27b8ba0 | 2006-09-28 17:49:20 +0000 | [diff] [blame] | 770 | } elsif($BUILDTYPE eq "release-asserts") { |
| 771 | $ofiles.= `find Release-Asserts/ -iname '*.o' -ls`; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 772 | } else { |
| 773 | $ofiles.= `find Debug/ -iname '*.o' -ls`; |
| 774 | } |
| 775 | |
| 776 | @AFILES = split "\n", $afiles; |
| 777 | $a_file_sizes=""; |
| 778 | foreach $x (@AFILES){ |
| 779 | $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/; |
| 780 | $a_file_sizes.="$1 $2 $BUILDTYPE\n"; |
| 781 | } |
| 782 | @OFILES = split "\n", $ofiles; |
| 783 | $o_file_sizes=""; |
| 784 | foreach $x (@OFILES){ |
| 785 | $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/; |
| 786 | $o_file_sizes.="$1 $2 $BUILDTYPE\n"; |
| 787 | } |
| 788 | } else { |
| 789 | $a_file_sizes="No data due to a bad build."; |
| 790 | $o_file_sizes="No data due to a bad build."; |
Patrick Jenkins | 169357e | 2006-07-23 21:38:07 +0000 | [diff] [blame] | 791 | } |
Patrick Jenkins | 169357e | 2006-07-23 21:38:07 +0000 | [diff] [blame] | 792 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 793 | ############################################################## |
| 794 | # |
| 795 | # Running dejagnu tests |
| 796 | # |
| 797 | ############################################################## |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 798 | my $DejangnuTestResults=""; # String containing the results of the dejagnu |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 799 | my $dejagnu_output = "$DejagnuTestsLog"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 800 | if (!$NODEJAGNU) { |
| 801 | if($VERBOSE) { |
| 802 | print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n"; |
| 803 | print "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1\n"; |
| 804 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 805 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 806 | #Run the feature and regression tests, results are put into testrun.sum |
| 807 | #Full log in testrun.log |
| 808 | system "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1"; |
| 809 | |
| 810 | #Copy the testrun.log and testrun.sum to our webdir |
| 811 | CopyFile("test/testrun.log", $DejagnuLog); |
| 812 | CopyFile("test/testrun.sum", $DejagnuSum); |
| 813 | #can be done on server |
| 814 | $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog); |
| 815 | $unexpfail_tests = $DejagnuTestResults; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 816 | } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 817 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 818 | #Extract time of dejagnu tests |
| 819 | my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output"; |
| 820 | my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output"; |
| 821 | $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System |
| 822 | $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 823 | $DejagnuTestResults = |
| 824 | "Dejagnu skipped by user choice." unless $DejagnuTestResults; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 825 | $DejagnuTime = "0.0" unless $DejagnuTime; |
| 826 | $DejagnuWallTime = "0.0" unless $DejagnuWallTime; |
| 827 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 828 | ############################################################## |
| 829 | # |
| 830 | # Get warnings from the build |
| 831 | # |
| 832 | ############################################################## |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 833 | if (!$NODEJAGNU) { |
| 834 | if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; } |
| 835 | my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`; |
| 836 | my @Warnings; |
| 837 | my $CurDir = ""; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 838 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 839 | foreach $Warning (@Warn) { |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 840 | if ($Warning =~ m/Entering directory \`([^\`]+)\'/) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 841 | $CurDir = $1; # Keep track of directory warning is in... |
| 842 | # Remove buildir prefix if included |
| 843 | if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { $CurDir = $1; } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 844 | } else { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 845 | push @Warnings, "$CurDir/$Warning"; # Add directory to warning... |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 846 | } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 847 | } |
| 848 | my $WarningsFile = join "\n", @Warnings; |
| 849 | $WarningsFile =~ s/:[0-9]+:/::/g; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 850 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 851 | # Emit the warnings file, so we can diff... |
| 852 | WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n"; |
| 853 | my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 854 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 855 | # Output something to stdout if something has changed |
| 856 | #print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded); |
| 857 | #print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved); |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 858 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 859 | #my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade |
| 860 | #my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 861 | |
| 862 | } #endif !NODEGAGNU |
| 863 | |
| 864 | ############################################################## |
| 865 | # |
| 866 | # If we built the tree successfully, run the nightly programs tests... |
| 867 | # |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 868 | # A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" |
| 869 | # "External") |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 870 | # |
| 871 | ############################################################## |
| 872 | sub TestDirectory { |
Patrick Jenkins | ad6f758 | 2006-08-22 18:11:19 +0000 | [diff] [blame] | 873 | my $SubDir = shift; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 874 | ChangeDir( "$BuildDir/llvm/projects/llvm-test/$SubDir", |
| 875 | "Programs Test Subdirectory" ) || return ("", ""); |
| 876 | |
| 877 | my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt"; |
| 878 | |
| 879 | # Run the programs tests... creating a report.nightly.csv file |
| 880 | if (!$NOTEST) { |
| 881 | if( $VERBOSE) { |
| 882 | print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ". |
| 883 | "TEST=nightly > $ProgramTestLog 2>&1\n"; |
| 884 | } |
| 885 | system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ". |
Patrick Jenkins | 59d1a66 | 2006-07-27 18:28:50 +0000 | [diff] [blame] | 886 | "TEST=nightly > $ProgramTestLog 2>&1"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 887 | $llcbeta_options=`$MAKECMD print-llcbeta-option`; |
| 888 | } |
| 889 | |
Patrick Jenkins | 59d1a66 | 2006-07-27 18:28:50 +0000 | [diff] [blame] | 890 | my $ProgramsTable; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 891 | if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) { |
Patrick Jenkins | 59d1a66 | 2006-07-27 18:28:50 +0000 | [diff] [blame] | 892 | $TestError = 1; |
| 893 | $ProgramsTable="Error running test $SubDir\n"; |
| 894 | print "ERROR TESTING\n"; |
| 895 | } elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) { |
| 896 | $TestError = 1; |
| 897 | $ProgramsTable="Makefile error running tests $SubDir!\n"; |
| 898 | print "ERROR TESTING\n"; |
| 899 | } else { |
| 900 | $TestError = 0; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 901 | # |
| 902 | # Create a list of the tests which were run... |
| 903 | # |
| 904 | system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ". |
Patrick Jenkins | 4b7f7aa | 2006-08-17 22:11:03 +0000 | [diff] [blame] | 905 | "| sort > $Prefix-$SubDir-Tests.txt"; |
Patrick Jenkins | 59d1a66 | 2006-07-27 18:28:50 +0000 | [diff] [blame] | 906 | } |
| 907 | $ProgramsTable = ReadFile "report.nightly.csv"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 908 | |
Patrick Jenkins | 59d1a66 | 2006-07-27 18:28:50 +0000 | [diff] [blame] | 909 | ChangeDir( "../../..", "Programs Test Parent Directory" ); |
| 910 | return ($ProgramsTable, $llcbeta_options); |
Patrick Jenkins | 9e384ab | 2006-08-14 16:07:14 +0000 | [diff] [blame] | 911 | } #end sub TestDirectory |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 912 | |
Patrick Jenkins | 4b7f7aa | 2006-08-17 22:11:03 +0000 | [diff] [blame] | 913 | ############################################################## |
| 914 | # |
| 915 | # Calling sub TestDirectory |
| 916 | # |
| 917 | ############################################################## |
Patrick Jenkins | c281b0d | 2006-07-27 19:00:01 +0000 | [diff] [blame] | 918 | if (!$BuildError) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 919 | if ( $VERBOSE ) { |
Patrick Jenkins | e631c4a | 2006-08-04 17:55:01 +0000 | [diff] [blame] | 920 | print "SingleSource TEST STAGE\n"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 921 | } |
| 922 | ($SingleSourceProgramsTable, $llcbeta_options) = |
| 923 | TestDirectory("SingleSource"); |
Patrick Jenkins | 4b7f7aa | 2006-08-17 22:11:03 +0000 | [diff] [blame] | 924 | WriteFile "$Prefix-SingleSource-Performance.txt", $SingleSourceProgramsTable; |
Patrick Jenkins | 4257ccb | 2006-08-08 02:03:53 +0000 | [diff] [blame] | 925 | if ( $VERBOSE ) { |
Patrick Jenkins | 4b7f7aa | 2006-08-17 22:11:03 +0000 | [diff] [blame] | 926 | print "MultiSource TEST STAGE\n"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 927 | } |
| 928 | ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource"); |
Patrick Jenkins | 4b7f7aa | 2006-08-17 22:11:03 +0000 | [diff] [blame] | 929 | WriteFile "$Prefix-MultiSource-Performance.txt", $MultiSourceProgramsTable; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 930 | if ( ! $NOEXTERNALS ) { |
| 931 | if ( $VERBOSE ) { |
| 932 | print "External TEST STAGE\n"; |
| 933 | } |
| 934 | ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External"); |
Patrick Jenkins | 4b7f7aa | 2006-08-17 22:11:03 +0000 | [diff] [blame] | 935 | WriteFile "$Prefix-External-Performance.txt", $ExternalProgramsTable; |
| 936 | system "cat $Prefix-SingleSource-Tests.txt " . |
| 937 | "$Prefix-MultiSource-Tests.txt ". |
| 938 | "$Prefix-External-Tests.txt | sort > $Prefix-Tests.txt"; |
| 939 | system "cat $Prefix-SingleSource-Performance.txt " . |
| 940 | "$Prefix-MultiSource-Performance.txt ". |
| 941 | "$Prefix-External-Performance.txt | sort > $Prefix-Performance.txt"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 942 | } else { |
| 943 | $ExternalProgramsTable = "External TEST STAGE SKIPPED\n"; |
| 944 | if ( $VERBOSE ) { |
| 945 | print "External TEST STAGE SKIPPED\n"; |
| 946 | } |
Patrick Jenkins | 4b7f7aa | 2006-08-17 22:11:03 +0000 | [diff] [blame] | 947 | system "cat $Prefix-SingleSource-Tests.txt " . |
| 948 | "$Prefix-MultiSource-Tests.txt ". |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 949 | " | sort > $Prefix-Tests.txt"; |
Patrick Jenkins | 4b7f7aa | 2006-08-17 22:11:03 +0000 | [diff] [blame] | 950 | system "cat $Prefix-SingleSource-Performance.txt " . |
| 951 | "$Prefix-MultiSource-Performance.txt ". |
| 952 | " | sort > $Prefix-Performance.txt"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 953 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 954 | |
Patrick Jenkins | ad6f758 | 2006-08-22 18:11:19 +0000 | [diff] [blame] | 955 | ############################################################## |
| 956 | # |
| 957 | # |
| 958 | # gathering tests added removed broken information here |
| 959 | # |
| 960 | # |
| 961 | ############################################################## |
| 962 | my $dejagnu_test_list = ReadFile "$Prefix-Tests.txt"; |
| 963 | my @DEJAGNU = split "\n", $dejagnu_test_list; |
| 964 | my ($passes, $fails, $xfails) = ""; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 965 | |
Patrick Jenkins | ad6f758 | 2006-08-22 18:11:19 +0000 | [diff] [blame] | 966 | if(!$NODEJAGNU) { |
| 967 | for ($x=0; $x<@DEJAGNU; $x++) { |
| 968 | if ($DEJAGNU[$x] =~ m/^PASS:/) { |
| 969 | $passes.="$DEJAGNU[$x]\n"; |
| 970 | } |
| 971 | elsif ($DEJAGNU[$x] =~ m/^FAIL:/) { |
| 972 | $fails.="$DEJAGNU[$x]\n"; |
| 973 | } |
| 974 | elsif ($DEJAGNU[$x] =~ m/^XFAIL:/) { |
| 975 | $xfails.="$DEJAGNU[$x]\n"; |
| 976 | } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 977 | } |
| 978 | } |
Patrick Jenkins | ad6f758 | 2006-08-22 18:11:19 +0000 | [diff] [blame] | 979 | |
| 980 | } #end if !$BuildError |
| 981 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 982 | |
| 983 | ############################################################## |
| 984 | # |
| 985 | # If we built the tree successfully, runs of the Olden suite with |
| 986 | # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics. |
| 987 | # |
| 988 | ############################################################## |
| 989 | if (!$BuildError) { |
Patrick Jenkins | d7210f9 | 2006-08-02 18:37:40 +0000 | [diff] [blame] | 990 | if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; } |
| 991 | my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize, |
| 992 | $MachCodeSize) = ("","","","","","",""); |
| 993 | if (!$NORUNNINGTESTS) { |
| 994 | ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden", |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 995 | "Olden Test Directory"); |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 996 | |
Patrick Jenkins | d7210f9 | 2006-08-02 18:37:40 +0000 | [diff] [blame] | 997 | # Clean out previous results... |
| 998 | system "$NICE $MAKECMD $MAKEOPTS clean > /dev/null 2>&1"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 999 | |
Patrick Jenkins | d7210f9 | 2006-08-02 18:37:40 +0000 | [diff] [blame] | 1000 | # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and |
| 1001 | # GET_STABLE_NUMBERS enabled! |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 1002 | if( $VERBOSE ) { |
| 1003 | print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out " . |
| 1004 | "TEST=nightly LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 " . |
| 1005 | "> /dev/null 2>&1\n"; |
| 1006 | } |
| 1007 | system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out " . |
| 1008 | "TEST=nightly LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 " . |
| 1009 | "> /dev/null 2>&1"; |
| 1010 | system "cp report.nightly.csv $OldenTestsLog"; |
Patrick Jenkins | d7210f9 | 2006-08-02 18:37:40 +0000 | [diff] [blame] | 1011 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1012 | } |
| 1013 | |
Patrick Jenkins | 215b48f | 2006-07-07 18:50:51 +0000 | [diff] [blame] | 1014 | ############################################################## |
| 1015 | # |
| 1016 | # Getting end timestamp |
| 1017 | # |
| 1018 | ############################################################## |
Patrick Jenkins | b67e118 | 2006-07-21 21:43:09 +0000 | [diff] [blame] | 1019 | $endtime = `date "+20%y-%m-%d %H:%M:%S"`; |
Patrick Jenkins | 215b48f | 2006-07-07 18:50:51 +0000 | [diff] [blame] | 1020 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1021 | |
| 1022 | ############################################################## |
| 1023 | # |
| 1024 | # Place all the logs neatly into one humungous file |
| 1025 | # |
| 1026 | ############################################################## |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1027 | if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; } |
| 1028 | |
| 1029 | $machine_data = "uname: ".`uname -a`. |
| 1030 | "hardware: ".`uname -m`. |
| 1031 | "os: ".`uname -sr`. |
| 1032 | "name: ".`uname -n`. |
| 1033 | "date: ".`date \"+20%y-%m-%d\"`. |
| 1034 | "time: ".`date +\"%H:%M:%S\"`; |
| 1035 | |
| 1036 | my @CVS_DATA; |
| 1037 | my $cvs_data; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 1038 | @CVS_DATA = ReadFile "$COLog"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1039 | $cvs_data = join("\n", @CVS_DATA); |
| 1040 | |
| 1041 | my @BUILD_DATA; |
| 1042 | my $build_data; |
| 1043 | @BUILD_DATA = ReadFile "$BuildLog"; |
| 1044 | $build_data = join("\n", @BUILD_DATA); |
| 1045 | |
Patrick Jenkins | 0313775 | 2006-08-21 20:45:57 +0000 | [diff] [blame] | 1046 | my (@DEJAGNU_LOG, @DEJAGNU_SUM, @DEJAGNULOG_FULL, @GCC_VERSION); |
| 1047 | my ($dejagnutests_log ,$dejagnutests_sum, $dejagnulog_full) = ""; |
| 1048 | my ($gcc_version, $gcc_version_long) = ""; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1049 | |
Patrick Jenkins | ad6f758 | 2006-08-22 18:11:19 +0000 | [diff] [blame] | 1050 | $gcc_version_long=""; |
| 1051 | if ($GCCPATH ne "") { |
| 1052 | $gcc_version_long = `$GCCPATH/gcc --version`; |
| 1053 | } else { |
| 1054 | $gcc_version_long = `gcc --version`; |
| 1055 | } |
| 1056 | @GCC_VERSION = split '\n', $gcc_version_long; |
| 1057 | $gcc_version = $GCC_VERSION[0]; |
| 1058 | |
Patrick Jenkins | 0313775 | 2006-08-21 20:45:57 +0000 | [diff] [blame] | 1059 | if(!$BuildError){ |
| 1060 | @DEJAGNU_LOG = ReadFile "$DejagnuLog"; |
| 1061 | @DEJAGNU_SUM = ReadFile "$DejagnuSum"; |
| 1062 | $dejagnutests_log = join("\n", @DEJAGNU_LOG); |
| 1063 | $dejagnutests_sum = join("\n", @DEJAGNU_SUM); |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1064 | |
Patrick Jenkins | 0313775 | 2006-08-21 20:45:57 +0000 | [diff] [blame] | 1065 | @DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog"; |
| 1066 | $dejagnulog_full = join("\n", @DEJAGNULOG_FULL); |
Patrick Jenkins | 79fbf7f | 2006-07-14 20:44:09 +0000 | [diff] [blame] | 1067 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1068 | |
| 1069 | ############################################################## |
| 1070 | # |
| 1071 | # Send data via a post request |
| 1072 | # |
| 1073 | ############################################################## |
| 1074 | |
| 1075 | if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; } |
| 1076 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 1077 | my %hash_of_data = ( |
| 1078 | 'machine_data' => $machine_data, |
| 1079 | 'build_data' => $build_data, |
| 1080 | 'gcc_version' => $gcc_version, |
| 1081 | 'nickname' => $nickname, |
| 1082 | 'dejagnutime_wall' => $DejagnuWallTime, |
| 1083 | 'dejagnutime_cpu' => $DejagnuTime, |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 1084 | 'cvscheckouttime_wall' => $CheckoutTime_Wall, |
| 1085 | 'cvscheckouttime_cpu' => $CheckoutTime_CPU, |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 1086 | 'configtime_wall' => $ConfigWallTime, |
| 1087 | 'configtime_cpu'=> $ConfigTime, |
| 1088 | 'buildtime_wall' => $BuildWallTime, |
| 1089 | 'buildtime_cpu' => $BuildTime, |
| 1090 | 'warnings' => $WarningsFile, |
| 1091 | 'cvsusercommitlist' => $UserCommitList, |
| 1092 | 'cvsuserupdatelist' => $UserUpdateList, |
| 1093 | 'cvsaddedfiles' => $CVSAddedFiles, |
| 1094 | 'cvsmodifiedfiles' => $CVSModifiedFiles, |
| 1095 | 'cvsremovedfiles' => $CVSRemovedFiles, |
| 1096 | 'lines_of_code' => $LOC, |
| 1097 | 'cvs_file_count' => $NumFilesInCVS, |
| 1098 | 'cvs_dir_count' => $NumDirsInCVS, |
| 1099 | 'buildstatus' => $BuildStatus, |
| 1100 | 'singlesource_programstable' => $SingleSourceProgramsTable, |
| 1101 | 'multisource_programstable' => $MultiSourceProgramsTable, |
| 1102 | 'externalsource_programstable' => $ExternalProgramsTable, |
| 1103 | 'llcbeta_options' => $multisource_llcbeta_options, |
| 1104 | 'warnings_removed' => $WarningsRemoved, |
| 1105 | 'warnings_added' => $WarningsAdded, |
| 1106 | 'passing_tests' => $passes, |
| 1107 | 'expfail_tests' => $xfails, |
| 1108 | 'unexpfail_tests' => $fails, |
| 1109 | 'all_tests' => $dejagnu_test_list, |
| 1110 | 'new_tests' => "", |
| 1111 | 'removed_tests' => "", |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 1112 | 'dejagnutests_results' => $DejagnuTestResults, |
| 1113 | 'dejagnutests_log' => $dejagnulog_full, |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 1114 | 'starttime' => $starttime, |
| 1115 | 'endtime' => $endtime, |
| 1116 | 'o_file_sizes' => $o_file_sizes, |
| 1117 | 'a_file_sizes' => $a_file_sizes |
| 1118 | ); |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1119 | |
| 1120 | $TESTING = 0; |
| 1121 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 1122 | if ($TESTING) { |
| 1123 | print "============================\n"; |
| 1124 | foreach $x(keys %hash_of_data){ |
| 1125 | print "$x => $hash_of_data{$x}\n"; |
| 1126 | } |
| 1127 | } else { |
| 1128 | my $response = SendData $SUBMITSERVER,$SUBMITSCRIPT,\%hash_of_data; |
| 1129 | if( $VERBOSE) { print "============================\n$response"; } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1130 | } |
| 1131 | |
| 1132 | ############################################################## |
| 1133 | # |
| 1134 | # Remove the cvs tree... |
| 1135 | # |
| 1136 | ############################################################## |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 1137 | system ( "$NICE rm -rf $BuildDir") |
| 1138 | if (!$NOCHECKOUT and !$NOREMOVE); |
| 1139 | system ( "$NICE rm -rf $WebDir") |
| 1140 | if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS); |