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