Alkis Evlogimenos | 2e142f5 | 2004-01-07 01:48:26 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl -w |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 2 | # |
| 3 | # Program: NightlyTest.pl |
| 4 | # |
| 5 | # Synopsis: Perform a series of tests which are designed to be run nightly. |
| 6 | # This is used to keep track of the status of the LLVM tree, tracking |
| 7 | # regressions and performance changes. This generates one web page a |
| 8 | # day which can be used to access this information. |
| 9 | # |
Brian Gaeke | b3dab90 | 2003-10-11 05:34:00 +0000 | [diff] [blame] | 10 | # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] |
| 11 | # where |
| 12 | # OPTIONS may include one or more of the following: |
| 13 | # -nocheckout Do not create, checkout, update, or configure |
| 14 | # the source tree. |
| 15 | # -noremove Do not remove the BUILDDIR after it has been built. |
| 16 | # -notest Do not even attempt to run the test programs. Implies |
| 17 | # -norunningtests. |
| 18 | # -norunningtests Do not run the Olden benchmark suite with |
| 19 | # LARGE_PROBLEM_SIZE enabled. |
Reid Spencer | 1d91463 | 2004-06-23 07:45:46 +0000 | [diff] [blame] | 20 | # -noexternals Do not run the external tests (for cases where povray |
| 21 | # or SPEC are not installed) |
Tanya Lattner | 056ec06 | 2004-12-04 06:25:50 +0000 | [diff] [blame] | 22 | # -nodejagnu Do not run feature or regression tests |
Brian Gaeke | b3dab90 | 2003-10-11 05:34:00 +0000 | [diff] [blame] | 23 | # -parallel Run two parallel jobs with GNU Make. |
Reid Spencer | f6d0233 | 2004-06-11 07:06:22 +0000 | [diff] [blame] | 24 | # -release Build an LLVM Release version |
| 25 | # -pedantic Enable additional GCC warnings to detect possible errors. |
Reid Spencer | 51e615f | 2004-12-06 20:14:45 +0000 | [diff] [blame] | 26 | # -enable-linscan Enable linearscan tests |
Brian Gaeke | 047e606 | 2004-08-05 19:54:59 +0000 | [diff] [blame] | 27 | # -disable-llc Disable LLC tests in the nightly tester. |
| 28 | # -disable-jit Disable JIT tests in the nightly tester. |
Chris Lattner | 4d00fde | 2004-05-28 20:30:23 +0000 | [diff] [blame] | 29 | # -verbose Turn on some debug output |
| 30 | # -debug Print information useful only to maintainers of this script. |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 31 | # -nice Checkout/Configure/Build with "nice" to reduce impact |
| 32 | # on busy servers. |
Misha Brukman | 2e9ac69 | 2004-11-08 03:28:27 +0000 | [diff] [blame] | 33 | # -f2c Next argument specifies path to F2C utility |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 34 | # -gnuplotscript Next argument specifies gnuplot script to use |
| 35 | # -templatefile Next argument specifies template file to use |
Chris Lattner | 892cdb3 | 2004-07-27 08:29:06 +0000 | [diff] [blame] | 36 | # -gccpath Path to gcc/g++ used to build LLVM |
Chris Lattner | bb0aca5 | 2003-12-19 03:47:31 +0000 | [diff] [blame] | 37 | # |
Brian Gaeke | b3dab90 | 2003-10-11 05:34:00 +0000 | [diff] [blame] | 38 | # CVSROOT is the CVS repository from which the tree will be checked out, |
| 39 | # specified either in the full :method:user@host:/dir syntax, or |
| 40 | # just /dir if using a local repo. |
| 41 | # BUILDDIR is the directory where sources for this test run will be checked out |
| 42 | # AND objects for this test run will be built. This directory MUST NOT |
| 43 | # exist before the script is run; it will be created by the cvs checkout |
| 44 | # process and erased (unless -noremove is specified; see above.) |
| 45 | # WEBDIR is the directory into which the test results web page will be written, |
| 46 | # AND in which the "index.html" is assumed to be a symlink to the most recent |
Brian Gaeke | 90c82b9 | 2004-09-28 16:04:00 +0000 | [diff] [blame] | 47 | # copy of the results. This directory will be created if it does not exist. |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 48 | # LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed |
| 49 | # to. This is the same as you would have for a normal LLVM build. |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 50 | # |
| 51 | use POSIX qw(strftime); |
Tanya Lattner | 5debe8c | 2004-11-21 00:02:40 +0000 | [diff] [blame] | 52 | use File::Copy; |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 53 | |
Brian Gaeke | b3dab90 | 2003-10-11 05:34:00 +0000 | [diff] [blame] | 54 | my $HOME = $ENV{'HOME'}; |
| 55 | my $CVSRootDir = $ENV{'CVSROOT'}; |
Chris Lattner | 9d13efa | 2003-10-14 01:22:08 +0000 | [diff] [blame] | 56 | $CVSRootDir = "/home/vadve/shared/PublicCVS" |
Chris Lattner | 4d00fde | 2004-05-28 20:30:23 +0000 | [diff] [blame] | 57 | unless $CVSRootDir; |
| 58 | my $BuildDir = $ENV{'BUILDDIR'}; |
| 59 | $BuildDir = "$HOME/buildtest" |
| 60 | unless $BuildDir; |
| 61 | my $WebDir = $ENV{'WEBDIR'}; |
| 62 | $WebDir = "$HOME/cvs/testresults-X86" |
| 63 | unless $WebDir; |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 64 | |
| 65 | # Calculate the date prefix... |
| 66 | @TIME = localtime; |
| 67 | my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3]; |
| 68 | my $DateString = strftime "%B %d, %Y", localtime; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 69 | my $TestStartTime = gmtime; |
| 70 | |
| 71 | # Command line argument settings... |
| 72 | my $NOCHECKOUT = 0; |
Misha Brukman | 2e9ac69 | 2004-11-08 03:28:27 +0000 | [diff] [blame] | 73 | my $NOREMOVE = 0; |
Misha Brukman | 2e9ac69 | 2004-11-08 03:28:27 +0000 | [diff] [blame] | 74 | my $NOTEST = 0; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 75 | my $NORUNNINGTESTS = 0; |
Reid Spencer | 1d91463 | 2004-06-23 07:45:46 +0000 | [diff] [blame] | 76 | my $NOEXTERNALS = 0; |
Misha Brukman | 2e9ac69 | 2004-11-08 03:28:27 +0000 | [diff] [blame] | 77 | my $MAKEOPTS = ""; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 78 | my $PROGTESTOPTS = ""; |
Misha Brukman | 2e9ac69 | 2004-11-08 03:28:27 +0000 | [diff] [blame] | 79 | my $VERBOSE = 0; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 80 | my $DEBUG = 0; |
Brian Gaeke | 047e606 | 2004-08-05 19:54:59 +0000 | [diff] [blame] | 81 | my $CONFIGUREARGS = ""; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 82 | my $NICE = ""; |
Tanya Lattner | 056ec06 | 2004-12-04 06:25:50 +0000 | [diff] [blame] | 83 | my $NODEJAGNU = 0; |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 84 | |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 85 | sub ReadFile { |
| 86 | if (open (FILE, $_[0])) { |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 87 | undef $/; |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 88 | my $Ret = <FILE>; |
| 89 | close FILE; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 90 | $/ = '\n'; |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 91 | return $Ret; |
| 92 | } else { |
| 93 | print "Could not open file '$_[0]' for reading!"; |
| 94 | return ""; |
| 95 | } |
| 96 | } |
| 97 | |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 98 | sub WriteFile { # (filename, contents) |
| 99 | open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!"; |
| 100 | print FILE $_[1]; |
| 101 | close FILE; |
| 102 | } |
| 103 | |
| 104 | sub GetRegex { # (Regex with ()'s, value) |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 105 | $_[1] =~ /$_[0]/m; |
Chris Lattner | 08e2476 | 2003-08-19 18:35:03 +0000 | [diff] [blame] | 106 | if (defined($1)) { |
| 107 | return $1; |
| 108 | } |
Reid Spencer | a337f0c | 2004-06-23 06:36:34 +0000 | [diff] [blame] | 109 | return "0"; |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Brian Gaeke | 90c82b9 | 2004-09-28 16:04:00 +0000 | [diff] [blame] | 112 | sub Touch { |
| 113 | my @files = @_; |
| 114 | my $now = time; |
| 115 | foreach my $file (@files) { |
| 116 | if (! -f $file) { |
| 117 | open (FILE, ">$file") or warn "Could not create new file $file"; |
| 118 | close FILE; |
| 119 | } |
| 120 | utime $now, $now, $file; |
| 121 | } |
| 122 | } |
| 123 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 124 | sub AddRecord { |
| 125 | my ($Val, $Filename) = @_; |
| 126 | my @Records; |
| 127 | if (open FILE, "$WebDir/$Filename") { |
| 128 | @Records = grep !/$DATE/, split "\n", <FILE>; |
| 129 | close FILE; |
| 130 | } |
| 131 | push @Records, "$DATE: $Val"; |
| 132 | WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n"; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 133 | } |
| 134 | |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 135 | sub AddPreTag { # Add pre tags around nonempty list, or convert to "none" |
| 136 | $_ = shift; |
Chris Lattner | 1cbc0a6 | 2003-01-20 19:18:44 +0000 | [diff] [blame] | 137 | if (length) { return "<ul><pre>$_</pre></ul>"; } else { "<b>none</b><br>"; } |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 138 | } |
| 139 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 140 | sub ChangeDir { # directory, logical name |
| 141 | my ($dir,$name) = @_; |
| 142 | chomp($dir); |
| 143 | if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; } |
| 144 | chdir($dir) || die "Cannot change directory to: $name ($dir) "; |
| 145 | } |
| 146 | |
Tanya Lattner | 5debe8c | 2004-11-21 00:02:40 +0000 | [diff] [blame] | 147 | sub CopyFile { #filename, newfile |
| 148 | my ($file, $newfile) = @_; |
| 149 | chomp($file); |
| 150 | if ($VERBOSE) { print "Copying $file to $newfile\n"; } |
| 151 | copy($file, $newfile); |
| 152 | } |
| 153 | |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 154 | sub GetDir { |
| 155 | my $Suffix = shift; |
| 156 | opendir DH, $WebDir; |
| 157 | my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH; |
| 158 | closedir DH; |
| 159 | return @Result; |
| 160 | } |
| 161 | |
| 162 | # DiffFiles - Diff the current version of the file against the last version of |
| 163 | # the file, reporting things added and removed. This is used to report, for |
| 164 | # example, added and removed warnings. This returns a pair (added, removed) |
| 165 | # |
| 166 | sub DiffFiles { |
| 167 | my $Suffix = shift; |
| 168 | my @Others = GetDir $Suffix; |
| 169 | if (@Others == 0) { # No other files? We added all entries... |
| 170 | return (`cat $WebDir/$DATE$Suffix`, ""); |
| 171 | } |
| 172 | # Diff the files now... |
| 173 | my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`; |
| 174 | my $Added = join "\n", grep /^</, @Diffs; |
| 175 | my $Removed = join "\n", grep /^>/, @Diffs; |
Chris Lattner | 1cbc0a6 | 2003-01-20 19:18:44 +0000 | [diff] [blame] | 176 | $Added =~ s/^< //gm; |
| 177 | $Removed =~ s/^> //gm; |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 178 | return ($Added, $Removed); |
| 179 | } |
| 180 | |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 181 | # FormatTime - Convert a time from 1m23.45 into 83.45 |
| 182 | sub FormatTime { |
| 183 | my $Time = shift; |
| 184 | if ($Time =~ m/([0-9]+)m([0-9.]+)/) { |
| 185 | $Time = sprintf("%7.4f", $1*60.0+$2); |
| 186 | } |
| 187 | return $Time; |
| 188 | } |
| 189 | |
Chris Lattner | bf6a4dc | 2003-08-18 06:05:21 +0000 | [diff] [blame] | 190 | sub GetRegexNum { |
| 191 | my ($Regex, $Num, $Regex2, $File) = @_; |
| 192 | my @Items = split "\n", `grep '$Regex' $File`; |
| 193 | return GetRegex $Regex2, $Items[$Num]; |
| 194 | } |
| 195 | |
Tanya Lattner | 5debe8c | 2004-11-21 00:02:40 +0000 | [diff] [blame] | 196 | sub GetDejagnuTestResults { # (filename, log) |
| 197 | my ($filename, $DejagnuLog) = @_; |
| 198 | my @lines; |
| 199 | my $firstline; |
| 200 | $/ = "\n"; #Make sure we're going line at a time. |
| 201 | if (open SRCHFILE, $filename) { |
| 202 | # Process test results |
| 203 | push(@lines,"<h3>UNEXPECTED TEST RESULTS</h3><ol><li>\n"); |
| 204 | my $first_list = 1; |
| 205 | my $should_break = 1; |
| 206 | my $nocopy = 0; |
| 207 | my $readingsum = 0; |
| 208 | while ( <SRCHFILE> ) { |
| 209 | if ( length($_) > 1 ) { |
| 210 | chomp($_); |
| 211 | if ( m/^XPASS:/ || m/^FAIL:/ ) { |
| 212 | $nocopy = 0; |
| 213 | if ( $first_list ) { |
| 214 | $first_list = 0; |
| 215 | $should_break = 1; |
| 216 | push(@lines,"<b>$_</b><br/>\n"); |
| 217 | } else { |
| 218 | push(@lines,"</li><li><b>$_</b><br/>\n"); |
| 219 | } |
| 220 | } elsif ( m/Summary/ ) { |
| 221 | if ( $first_list ) { push(@lines,"<b>PERFECT!</b>"); } |
| 222 | push(@lines,"</li></ol><h3>STATISTICS</h3><pre>\n"); |
| 223 | $should_break = 0; |
| 224 | $nocopy = 0; |
| 225 | $readingsum = 1; |
| 226 | } elsif ( $readingsum ) { |
| 227 | push(@lines,"$_\n"); |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | } |
| 232 | push(@lines, "</pre>\n"); |
| 233 | close SRCHFILE; |
| 234 | |
Tanya Lattner | 5debe8c | 2004-11-21 00:02:40 +0000 | [diff] [blame] | 235 | my $content = join("",@lines); |
| 236 | return "$content</li></ol>\n"; |
| 237 | } |
| 238 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 239 | |
| 240 | ##################################################################### |
| 241 | ## MAIN PROGRAM |
| 242 | ##################################################################### |
| 243 | |
| 244 | my $Template = ""; |
| 245 | my $PlotScriptFilename = ""; |
| 246 | |
| 247 | # Parse arguments... |
| 248 | while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { |
| 249 | shift; |
| 250 | last if /^--$/; # Stop processing arguments on -- |
| 251 | |
| 252 | # List command line options here... |
| 253 | if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; } |
Misha Brukman | 2e9ac69 | 2004-11-08 03:28:27 +0000 | [diff] [blame] | 254 | if (/^-noremove$/) { $NOREMOVE = 1; next; } |
Misha Brukman | 2e9ac69 | 2004-11-08 03:28:27 +0000 | [diff] [blame] | 255 | if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; } |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 256 | if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; } |
Misha Brukman | 2e9ac69 | 2004-11-08 03:28:27 +0000 | [diff] [blame] | 257 | if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; } |
| 258 | if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1"; next; } |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 259 | if (/^-pedantic$/) { |
| 260 | $MAKEOPTS = "$MAKEOPTS CompileOptimizeOpts='-O3 -DNDEBUG -finline-functions -Wpointer-arith -Wcast-align -Wno-deprecated -Wold-style-cast -Wabi -Woverloaded-virtual -ffor-scope'"; |
| 261 | next; |
| 262 | } |
Reid Spencer | 51e615f | 2004-12-06 20:14:45 +0000 | [diff] [blame] | 263 | if (/^-enable-linscan$/) { $PROGTESTOPTS .= " ENABLE_LINEARSCAN=1"; next; } |
Brian Gaeke | 047e606 | 2004-08-05 19:54:59 +0000 | [diff] [blame] | 264 | if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; |
| 265 | $CONFIGUREARGS .= " --disable-llc_diffs"; next; } |
| 266 | if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1"; |
| 267 | $CONFIGUREARGS .= " --disable-jit"; next; } |
Misha Brukman | 2e9ac69 | 2004-11-08 03:28:27 +0000 | [diff] [blame] | 268 | if (/^-verbose$/) { $VERBOSE = 1; next; } |
| 269 | if (/^-debug$/) { $DEBUG = 1; next; } |
| 270 | if (/^-nice$/) { $NICE = "nice "; next; } |
| 271 | if (/^-f2c$/) { |
| 272 | $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next; |
| 273 | } |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 274 | if (/^-gnuplotscript$/) { $PlotScriptFilename = $ARGV[0]; shift; next; } |
Reid Spencer | c5b6705 | 2004-06-23 14:07:12 +0000 | [diff] [blame] | 275 | if (/^-templatefile$/) { $Template = $ARGV[0]; shift; next; } |
Misha Brukman | 2e9ac69 | 2004-11-08 03:28:27 +0000 | [diff] [blame] | 276 | if (/^-gccpath/) { |
| 277 | $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next; |
| 278 | } |
Reid Spencer | 1d91463 | 2004-06-23 07:45:46 +0000 | [diff] [blame] | 279 | if (/^-noexternals$/) { $NOEXTERNALS = 1; next; } |
Tanya Lattner | 056ec06 | 2004-12-04 06:25:50 +0000 | [diff] [blame] | 280 | if(/^-nodejagnu$/) { $NODEJAGNU = 1; next; } |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 281 | |
| 282 | print "Unknown option: $_ : ignoring!\n"; |
| 283 | } |
| 284 | |
| 285 | if ($ENV{'LLVMGCCDIR'}) { |
| 286 | $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'}; |
| 287 | } |
Brian Gaeke | 047e606 | 2004-08-05 19:54:59 +0000 | [diff] [blame] | 288 | if ($CONFIGUREARGS !~ /--disable-jit/) { |
| 289 | $CONFIGUREARGS .= " --enable-jit"; |
| 290 | } |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 291 | |
| 292 | die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3); |
| 293 | |
| 294 | if (@ARGV == 3) { |
| 295 | $CVSRootDir = $ARGV[0]; |
| 296 | $BuildDir = $ARGV[1]; |
| 297 | $WebDir = $ARGV[2]; |
| 298 | } |
| 299 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 300 | my $Prefix = "$WebDir/$DATE"; |
| 301 | |
| 302 | #define the file names we'll use |
| 303 | my $BuildLog = "$Prefix-Build-Log.txt"; |
| 304 | my $CVSLog = "$Prefix-CVS-Log.txt"; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 305 | my $OldenTestsLog = "$Prefix-Olden-tests.txt"; |
| 306 | my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz"; |
| 307 | my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz"; |
| 308 | my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz"; |
Tanya Lattner | 5debe8c | 2004-11-21 00:02:40 +0000 | [diff] [blame] | 309 | my $DejagnuLog = "$Prefix-Dejagnu-testrun.log"; |
| 310 | my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum"; |
| 311 | my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt"; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 312 | |
| 313 | if ($VERBOSE) { |
| 314 | print "INITIALIZED\n"; |
| 315 | print "CVS Root = $CVSRootDir\n"; |
| 316 | print "BuildDir = $BuildDir\n"; |
| 317 | print "WebDir = $WebDir\n"; |
| 318 | print "Prefix = $Prefix\n"; |
| 319 | print "CVSLog = $CVSLog\n"; |
| 320 | print "BuildLog = $BuildLog\n"; |
| 321 | } |
| 322 | |
Brian Gaeke | 90c82b9 | 2004-09-28 16:04:00 +0000 | [diff] [blame] | 323 | if (! -d $WebDir) { |
| 324 | mkdir $WebDir, 0777; |
| 325 | warn "Warning: $WebDir did not exist; creating it.\n"; |
| 326 | } |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 327 | |
| 328 | # |
| 329 | # Create the CVS repository directory |
| 330 | # |
| 331 | if (!$NOCHECKOUT) { |
| 332 | if (-d $BuildDir) { |
| 333 | if (!$NOREMOVE) { |
| 334 | system "rm -rf $BuildDir"; |
| 335 | } else { |
| 336 | die "CVS checkout directory $BuildDir already exists!"; |
| 337 | } |
| 338 | } |
| 339 | mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!"; |
| 340 | } |
| 341 | |
| 342 | ChangeDir( $BuildDir, "CVS checkout directory" ); |
| 343 | |
| 344 | |
| 345 | # |
| 346 | # Check out the llvm tree, saving CVS messages to the cvs log... |
| 347 | # |
| 348 | $CVSOPT = ""; |
| 349 | $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; # Use compression if going over ssh. |
| 350 | if (!$NOCHECKOUT) { |
| 351 | if ( $VERBOSE ) { print "CHECKOUT STAGE\n"; } |
Reid Spencer | 214c6d6 | 2004-09-05 20:57:22 +0000 | [diff] [blame] | 352 | system "( time -p $NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm; cd llvm/projects ; " . |
| 353 | "$NICE cvs $CVSOPT -d $CVSRootDir co -APR llvm-test ) > $CVSLog 2>&1"; |
Reid Spencer | 10ffe01 | 2004-09-05 07:58:10 +0000 | [diff] [blame] | 354 | ChangeDir( $BuildDir , "CVS Checkout directory") ; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 355 | } |
| 356 | |
| 357 | ChangeDir( "llvm" , "llvm source directory") ; |
| 358 | |
| 359 | if (!$NOCHECKOUT) { |
| 360 | if ( $VERBOSE ) { print "UPDATE STAGE\n"; } |
Reid Spencer | 10ffe01 | 2004-09-05 07:58:10 +0000 | [diff] [blame] | 361 | system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 362 | } |
| 363 | |
Reid Spencer | c5b6705 | 2004-06-23 14:07:12 +0000 | [diff] [blame] | 364 | if ( $Template eq "" ) { |
| 365 | $Template = "$BuildDir/llvm/utils/NightlyTestTemplate.html"; |
| 366 | } |
| 367 | die "Template file $Template is not readable" if ( ! -r "$Template" ); |
| 368 | |
| 369 | if ( $PlotScriptFilename eq "" ) { |
| 370 | $PlotScriptFilename = "$BuildDir/llvm/utils/NightlyTest.gnuplot"; |
| 371 | } |
| 372 | die "GNUPlot Script $PlotScriptFilename is not readable" if ( ! -r "$PlotScriptFilename" ); |
| 373 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 374 | # Read in the HTML template file... |
| 375 | if ( $VERBOSE ) { print "READING TEMPLATE\n"; } |
| 376 | my $TemplateContents = ReadFile $Template; |
| 377 | |
| 378 | # |
| 379 | # Get some static statistics about the current state of CVS |
| 380 | # |
| 381 | my $CVSCheckoutTime = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`; |
| 382 | my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0; |
| 383 | my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0; |
Reid Spencer | e993f46 | 2004-09-06 19:32:55 +0000 | [diff] [blame] | 384 | $LOC = `utils/countloc.sh`; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 385 | |
| 386 | # |
| 387 | # Build the entire tree, saving build messages to the build log |
| 388 | # |
| 389 | if (!$NOCHECKOUT) { |
| 390 | if ( $VERBOSE ) { print "CONFIGURE STAGE\n"; } |
| 391 | system "(time -p $NICE ./configure $CONFIGUREARGS --enable-spec --with-objroot=.) > $BuildLog 2>&1"; |
| 392 | |
| 393 | if ( $VERBOSE ) { print "BUILD STAGE\n"; } |
| 394 | # Build the entire tree, capturing the output into $BuildLog |
| 395 | system "(time -p $NICE gmake $MAKEOPTS) >> $BuildLog 2>&1"; |
| 396 | } |
| 397 | |
| 398 | |
| 399 | # |
| 400 | # Get some statistics about the build... |
| 401 | # |
| 402 | my @Linked = split '\n', `grep Linking $BuildLog`; |
| 403 | my $NumExecutables = scalar(grep(/executable/, @Linked)); |
| 404 | my $NumLibraries = scalar(grep(!/executable/, @Linked)); |
| 405 | my $NumObjects = `grep '^Compiling' $BuildLog | wc -l` + 0; |
| 406 | |
| 407 | my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog"; |
| 408 | my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog"; |
| 409 | my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System |
| 410 | my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog"; |
| 411 | |
| 412 | my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog"; |
| 413 | my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog"; |
| 414 | my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System |
| 415 | my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog"; |
| 416 | |
| 417 | my $BuildError = ""; |
| 418 | if (`grep '^gmake[^:]*: .*Error' $BuildLog | wc -l` + 0 || |
| 419 | `grep '^gmake: \*\*\*.*Stop.' $BuildLog | wc -l`+0) { |
| 420 | $BuildError = "<h3><font color='red'>Build error: compilation " . |
| 421 | "<a href=\"$DATE-Build-Log.txt\">aborted</a></font></h3>"; |
| 422 | if ($VERBOSE) { print "BUILD ERROR\n"; } |
| 423 | } |
| 424 | |
Tanya Lattner | 056ec06 | 2004-12-04 06:25:50 +0000 | [diff] [blame] | 425 | if ($BuildError) { $NODEJAGNU=1; } |
Brian Gaeke | 2280098 | 2004-06-25 07:25:28 +0000 | [diff] [blame] | 426 | |
Tanya Lattner | 5debe8c | 2004-11-21 00:02:40 +0000 | [diff] [blame] | 427 | my $DejangnuTestResults; # String containing the results of the dejagnu |
Tanya Lattner | 59a8655 | 2004-12-04 06:35:14 +0000 | [diff] [blame] | 428 | if(!$NODEJAGNU) { |
Tanya Lattner | 5debe8c | 2004-11-21 00:02:40 +0000 | [diff] [blame] | 429 | if($VERBOSE) { print "DEJAGNU FEATURE/REGRESSION TEST STAGE\n"; } |
| 430 | |
| 431 | my $dejagnu_output = "$DejagnuTestsLog"; |
| 432 | |
| 433 | #Run the feature and regression tests, results are put into testrun.sum |
| 434 | #Full log in testrun.log |
Tanya Lattner | 056ec06 | 2004-12-04 06:25:50 +0000 | [diff] [blame] | 435 | system "(time -p gmake $MAKEOPTS check) > $dejagnu_output 2>&1"; |
Tanya Lattner | 5debe8c | 2004-11-21 00:02:40 +0000 | [diff] [blame] | 436 | |
| 437 | #Extract time of dejagnu tests |
| 438 | my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output"; |
| 439 | my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output"; |
| 440 | $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System |
| 441 | $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output"; |
| 442 | |
| 443 | #Copy the testrun.log and testrun.sum to our webdir |
| 444 | CopyFile("test/testrun.log", $DejagnuLog); |
| 445 | CopyFile("test/testrun.sum", $DejagnuSum); |
| 446 | |
| 447 | $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog); |
| 448 | } else { |
| 449 | $DejagnuTestResults = "Skipped by user choice."; |
| 450 | $DejagnuTime = "0.0"; |
| 451 | $DejagnuWallTime = "0.0"; |
| 452 | } |
| 453 | |
Chris Lattner | 4d00fde | 2004-05-28 20:30:23 +0000 | [diff] [blame] | 454 | if ($DEBUG) { |
Tanya Lattner | 5debe8c | 2004-11-21 00:02:40 +0000 | [diff] [blame] | 455 | print $DejagnuTestResults; |
Chris Lattner | 4d00fde | 2004-05-28 20:30:23 +0000 | [diff] [blame] | 456 | } |
| 457 | |
| 458 | if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; } |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 459 | # |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 460 | # Get warnings from the build |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 461 | # |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 462 | my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`; |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 463 | my @Warnings; |
| 464 | my $CurDir = ""; |
| 465 | |
| 466 | foreach $Warning (@Warn) { |
| 467 | if ($Warning =~ m/Entering directory \`([^\`]+)\'/) { |
| 468 | $CurDir = $1; # Keep track of directory warning is in... |
Misha Brukman | 8e9554a | 2003-08-14 15:26:28 +0000 | [diff] [blame] | 469 | if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 470 | $CurDir = $1; |
| 471 | } |
| 472 | } else { |
| 473 | push @Warnings, "$CurDir/$Warning"; # Add directory to warning... |
| 474 | } |
| 475 | } |
Chris Lattner | 1cbc0a6 | 2003-01-20 19:18:44 +0000 | [diff] [blame] | 476 | my $WarningsFile = join "\n", @Warnings; |
| 477 | my $WarningsList = AddPreTag $WarningsFile; |
| 478 | $WarningsFile =~ s/:[0-9]+:/::/g; |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 479 | |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 480 | # Emit the warnings file, so we can diff... |
| 481 | WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n"; |
| 482 | my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt"; |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 483 | |
Chris Lattner | 9efd7f4 | 2003-10-18 19:31:39 +0000 | [diff] [blame] | 484 | # Output something to stdout if something has changed |
| 485 | print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded); |
| 486 | print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved); |
| 487 | |
Chris Lattner | be19787 | 2003-10-19 16:54:00 +0000 | [diff] [blame] | 488 | $WarningsAdded = AddPreTag $WarningsAdded; |
| 489 | $WarningsRemoved = AddPreTag $WarningsRemoved; |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 490 | |
| 491 | # |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 492 | # Get some statistics about CVS commits over the current day... |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 493 | # |
Chris Lattner | 4d00fde | 2004-05-28 20:30:23 +0000 | [diff] [blame] | 494 | if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; } |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 495 | @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`; |
| 496 | #print join "\n", @CVSHistory; print "\n"; |
| 497 | |
| 498 | # Extract some information from the CVS history... use a hash so no duplicate |
| 499 | # stuff is stored. |
Misha Brukman | 1b36689 | 2003-07-07 21:27:40 +0000 | [diff] [blame] | 500 | my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated); |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 501 | |
Brian Gaeke | 43f3867 | 2004-06-10 07:44:28 +0000 | [diff] [blame] | 502 | my $DateRE = '[-/:0-9 ]+\+[0-9]+'; |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 503 | |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 504 | # Loop over every record from the CVS history, filling in the hashes. |
| 505 | foreach $File (@CVSHistory) { |
| 506 | my ($Type, $Date, $UID, $Rev, $Filename); |
Misha Brukman | 8e9554a | 2003-08-14 15:26:28 +0000 | [diff] [blame] | 507 | if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) { |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 508 | ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5"); |
Chris Lattner | d56147d | 2004-01-12 16:55:30 +0000 | [diff] [blame] | 509 | } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) { |
| 510 | ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", ""); |
Misha Brukman | 1b36689 | 2003-07-07 21:27:40 +0000 | [diff] [blame] | 511 | } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) { |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 512 | ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/"); |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 513 | } else { |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 514 | print "UNMATCHABLE: $File\n"; |
Brian Gaeke | 43f3867 | 2004-06-10 07:44:28 +0000 | [diff] [blame] | 515 | next; |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 516 | } |
| 517 | # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n"; |
| 518 | |
| 519 | if ($Filename =~ /^llvm/) { |
| 520 | if ($Type eq 'M') { # Modified |
| 521 | $ModifiedFiles{$Filename} = 1; |
| 522 | $UsersCommitted{$UID} = 1; |
| 523 | } elsif ($Type eq 'A') { # Added |
| 524 | $AddedFiles{$Filename} = 1; |
| 525 | $UsersCommitted{$UID} = 1; |
| 526 | } elsif ($Type eq 'R') { # Removed |
| 527 | $RemovedFiles{$Filename} = 1; |
| 528 | $UsersCommitted{$UID} = 1; |
| 529 | } else { |
| 530 | $UsersUpdated{$UID} = 1; |
| 531 | } |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 532 | } |
| 533 | } |
| 534 | |
Chris Lattner | 1cbc0a6 | 2003-01-20 19:18:44 +0000 | [diff] [blame] | 535 | my $UserCommitList = join "\n", keys %UsersCommitted; |
| 536 | my $UserUpdateList = join "\n", keys %UsersUpdated; |
Chris Lattner | c9cdadf | 2003-08-06 16:02:50 +0000 | [diff] [blame] | 537 | my $AddedFilesList = AddPreTag join "\n", sort keys %AddedFiles; |
| 538 | my $ModifiedFilesList = AddPreTag join "\n", sort keys %ModifiedFiles; |
| 539 | my $RemovedFilesList = AddPreTag join "\n", sort keys %RemovedFiles; |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 540 | |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 541 | my $TestError = 1; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 542 | my $SingleSourceProgramsTable = "!"; |
| 543 | my $MultiSourceProgramsTable = "!"; |
| 544 | my $ExternalProgramsTable = "!"; |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 545 | |
Chris Lattner | bf6a4dc | 2003-08-18 06:05:21 +0000 | [diff] [blame] | 546 | |
| 547 | sub TestDirectory { |
| 548 | my $SubDir = shift; |
| 549 | |
Reid Spencer | 10ffe01 | 2004-09-05 07:58:10 +0000 | [diff] [blame] | 550 | ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" ); |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 551 | |
| 552 | my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt"; |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 553 | |
| 554 | # Run the programs tests... creating a report.nightly.html file |
| 555 | if (!$NOTEST) { |
Chris Lattner | 20d13ea | 2004-06-03 03:29:39 +0000 | [diff] [blame] | 556 | system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.html " |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 557 | . "TEST=nightly > $ProgramTestLog 2>&1"; |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 558 | } else { |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 559 | system "gunzip ${ProgramTestLog}.gz"; |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 560 | } |
| 561 | |
Chris Lattner | bf6a4dc | 2003-08-18 06:05:21 +0000 | [diff] [blame] | 562 | my $ProgramsTable; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 563 | if (`grep '^gmake[^:]: .*Error' $ProgramTestLog | wc -l` + 0){ |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 564 | $TestError = 1; |
Chris Lattner | 2e8be14 | 2003-05-10 21:40:10 +0000 | [diff] [blame] | 565 | $ProgramsTable = "<font color=white><h2>Error running tests!</h2></font>"; |
Chris Lattner | be19787 | 2003-10-19 16:54:00 +0000 | [diff] [blame] | 566 | print "ERROR TESTING\n"; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 567 | } elsif (`grep '^gmake[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) { |
Chris Lattner | 6e51bfa | 2003-05-11 15:23:10 +0000 | [diff] [blame] | 568 | $TestError = 1; |
| 569 | $ProgramsTable = |
| 570 | "<font color=white><h2>Makefile error running tests!</h2></font>"; |
Chris Lattner | be19787 | 2003-10-19 16:54:00 +0000 | [diff] [blame] | 571 | print "ERROR TESTING\n"; |
Chris Lattner | 6e51bfa | 2003-05-11 15:23:10 +0000 | [diff] [blame] | 572 | } else { |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 573 | $TestError = 0; |
| 574 | $ProgramsTable = ReadFile "report.nightly.html"; |
| 575 | |
| 576 | # |
| 577 | # Create a list of the tests which were run... |
| 578 | # |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 579 | system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog " |
Chris Lattner | bf6a4dc | 2003-08-18 06:05:21 +0000 | [diff] [blame] | 580 | . "| sort > $Prefix-$SubDir-Tests.txt"; |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 581 | } |
| 582 | |
| 583 | # Compress the test output |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 584 | system "gzip -f $ProgramTestLog"; |
| 585 | ChangeDir( "../../..", "Programs Test Parent Directory" ); |
Chris Lattner | bf6a4dc | 2003-08-18 06:05:21 +0000 | [diff] [blame] | 586 | return $ProgramsTable; |
| 587 | } |
| 588 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 589 | # If we built the tree successfully, run the nightly programs tests... |
Chris Lattner | bf6a4dc | 2003-08-18 06:05:21 +0000 | [diff] [blame] | 590 | if ($BuildError eq "") { |
Chris Lattner | 4d00fde | 2004-05-28 20:30:23 +0000 | [diff] [blame] | 591 | if ( $VERBOSE ) { |
| 592 | print "SingleSource TEST STAGE\n"; |
| 593 | } |
Chris Lattner | bf6a4dc | 2003-08-18 06:05:21 +0000 | [diff] [blame] | 594 | $SingleSourceProgramsTable = TestDirectory("SingleSource"); |
Chris Lattner | 4d00fde | 2004-05-28 20:30:23 +0000 | [diff] [blame] | 595 | if ( $VERBOSE ) { |
| 596 | print "MultiSource TEST STAGE\n"; |
| 597 | } |
Chris Lattner | bf6a4dc | 2003-08-18 06:05:21 +0000 | [diff] [blame] | 598 | $MultiSourceProgramsTable = TestDirectory("MultiSource"); |
Reid Spencer | 1d91463 | 2004-06-23 07:45:46 +0000 | [diff] [blame] | 599 | if ( ! $NOEXTERNALS ) { |
| 600 | if ( $VERBOSE ) { |
| 601 | print "External TEST STAGE\n"; |
| 602 | } |
| 603 | $ExternalProgramsTable = TestDirectory("External"); |
| 604 | system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ". |
Chris Lattner | eac3cdc | 2003-08-21 15:55:26 +0000 | [diff] [blame] | 605 | " $Prefix-External-Tests.txt | sort > $Prefix-Tests.txt"; |
Reid Spencer | 1d91463 | 2004-06-23 07:45:46 +0000 | [diff] [blame] | 606 | } else { |
Reid Spencer | b8e825b | 2004-12-04 22:18:28 +0000 | [diff] [blame] | 607 | $ExternalProgramsTable = '<tr><td>External TEST STAGE SKIPPED</td></tr>'; |
Reid Spencer | 1d91463 | 2004-06-23 07:45:46 +0000 | [diff] [blame] | 608 | if ( $VERBOSE ) { |
| 609 | print "External TEST STAGE SKIPPED\n"; |
| 610 | } |
| 611 | system "cat $Prefix-SingleSource-Tests.txt $Prefix-MultiSource-Tests.txt ". |
| 612 | " | sort > $Prefix-Tests.txt"; |
| 613 | } |
Chris Lattner | 5d6c438 | 2003-01-23 19:31:28 +0000 | [diff] [blame] | 614 | } |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 615 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 616 | if ( $VERBOSE ) { print "TEST INFORMATION COLLECTION STAGE\n"; } |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 617 | my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","",""); |
| 618 | |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 619 | if ($TestError) { |
| 620 | $TestsAdded = "<b>error testing</b><br>"; |
| 621 | $TestsRemoved = "<b>error testing</b><br>"; |
| 622 | $TestsFixed = "<b>error testing</b><br>"; |
| 623 | $TestsBroken = "<b>error testing</b><br>"; |
| 624 | } else { |
| 625 | my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt"; |
| 626 | |
| 627 | my @RawTestsAddedArray = split '\n', $RTestsAdded; |
| 628 | my @RawTestsRemovedArray = split '\n', $RTestsRemoved; |
| 629 | |
| 630 | my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_} |
| 631 | @RawTestsRemovedArray; |
| 632 | my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_} |
| 633 | @RawTestsAddedArray; |
| 634 | |
| 635 | foreach $Test (keys %NewTests) { |
| 636 | if (!exists $OldTests{$Test}) { # TestAdded if in New but not old |
| 637 | $TestsAdded = "$TestsAdded$Test\n"; |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 638 | } else { |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 639 | if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass? |
| 640 | $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure |
| 641 | } else { |
| 642 | $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass. |
| 643 | } |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 644 | } |
| 645 | } |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 646 | foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New |
| 647 | $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test}); |
| 648 | } |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 649 | |
Chris Lattner | 91480ff | 2003-10-21 15:47:31 +0000 | [diff] [blame] | 650 | print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded); |
| 651 | print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved); |
| 652 | print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed); |
| 653 | print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken); |
Chris Lattner | be19787 | 2003-10-19 16:54:00 +0000 | [diff] [blame] | 654 | |
Chris Lattner | ec0e374 | 2003-02-28 20:30:20 +0000 | [diff] [blame] | 655 | $TestsAdded = AddPreTag $TestsAdded; |
| 656 | $TestsRemoved = AddPreTag $TestsRemoved; |
| 657 | $TestsFixed = AddPreTag $TestsFixed; |
| 658 | $TestsBroken = AddPreTag $TestsBroken; |
| 659 | } |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 660 | |
Chris Lattner | 9efd7f4 | 2003-10-18 19:31:39 +0000 | [diff] [blame] | 661 | |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 662 | # If we built the tree successfully, runs of the Olden suite with |
| 663 | # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics. |
| 664 | if ($BuildError eq "") { |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 665 | if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; } |
Chris Lattner | 08e2476 | 2003-08-19 18:35:03 +0000 | [diff] [blame] | 666 | my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize, |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 667 | $MachCodeSize) = ("","","","","","",""); |
Chris Lattner | 08e2476 | 2003-08-19 18:35:03 +0000 | [diff] [blame] | 668 | if (!$NORUNNINGTESTS) { |
Reid Spencer | 10ffe01 | 2004-09-05 07:58:10 +0000 | [diff] [blame] | 669 | ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden", |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 670 | "Olden Test Directory"); |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 671 | |
| 672 | # Clean out previous results... |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 673 | system "$NICE gmake $MAKEOPTS clean > /dev/null 2>&1"; |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 674 | |
Chris Lattner | 36dc5c7 | 2004-11-06 21:35:40 +0000 | [diff] [blame] | 675 | # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and |
| 676 | # GET_STABLE_NUMBERS enabled! |
Brian Gaeke | 8566854 | 2004-06-04 00:07:12 +0000 | [diff] [blame] | 677 | system "gmake -k $MAKEOPTS $PROGTESTOPTS report.nightly.raw.out TEST=nightly " . |
Chris Lattner | 36dc5c7 | 2004-11-06 21:35:40 +0000 | [diff] [blame] | 678 | " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1"; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 679 | system "cp report.nightly.raw.out $OldenTestsLog"; |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 680 | } else { |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 681 | system "gunzip ${OldenTestsLog}.gz"; |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 682 | } |
| 683 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 684 | # Now we know we have $OldenTestsLog as the raw output file. Split |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 685 | # it up into records and read the useful information. |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 686 | my @Records = split />>> ========= /, ReadFile "$OldenTestsLog"; |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 687 | shift @Records; # Delete the first (garbage) record |
| 688 | |
| 689 | # Loop over all of the records, summarizing them into rows for the running |
| 690 | # totals file. |
Chris Lattner | fed8a14 | 2004-12-14 22:42:59 +0000 | [diff] [blame^] | 691 | my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock"; |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 692 | foreach $Rec (@Records) { |
Chris Lattner | 36dc5c7 | 2004-11-06 21:35:40 +0000 | [diff] [blame] | 693 | my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec; |
| 694 | my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec; |
| 695 | my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec; |
| 696 | my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec; |
Chris Lattner | fed8a14 | 2004-12-14 22:42:59 +0000 | [diff] [blame^] | 697 | my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec; |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 698 | my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec; |
| 699 | my $rMachCodeSize = GetRegex 'TEST-RESULT-jit-machcode: *([0-9]+).*bytes of machine code', $Rec; |
| 700 | |
| 701 | $NATTime .= " " . FormatTime($rNATTime); |
| 702 | $CBETime .= " " . FormatTime($rCBETime); |
| 703 | $LLCTime .= " " . FormatTime($rLLCTime); |
| 704 | $JITTime .= " " . FormatTime($rJITTime); |
| 705 | $OptTime .= " $rOptTime"; |
Chris Lattner | 08e2476 | 2003-08-19 18:35:03 +0000 | [diff] [blame] | 706 | $BytecodeSize .= " $rBytecodeSize"; |
| 707 | $MachCodeSize .= " $rMachCodeSize"; |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 708 | } |
| 709 | |
| 710 | # Now that we have all of the numbers we want, add them to the running totals |
| 711 | # files. |
Chris Lattner | 08e2476 | 2003-08-19 18:35:03 +0000 | [diff] [blame] | 712 | AddRecord($NATTime, "running_Olden_nat_time.txt"); |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 713 | AddRecord($CBETime, "running_Olden_cbe_time.txt"); |
| 714 | AddRecord($LLCTime, "running_Olden_llc_time.txt"); |
| 715 | AddRecord($JITTime, "running_Olden_jit_time.txt"); |
| 716 | AddRecord($OptTime, "running_Olden_opt_time.txt"); |
| 717 | AddRecord($BytecodeSize, "running_Olden_bytecode.txt"); |
| 718 | AddRecord($MachCodeSize, "running_Olden_machcode.txt"); |
Chris Lattner | 08e2476 | 2003-08-19 18:35:03 +0000 | [diff] [blame] | 719 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 720 | system "gzip -f $OldenTestsLog"; |
Chris Lattner | 196a14a | 2003-08-19 15:08:34 +0000 | [diff] [blame] | 721 | } |
| 722 | |
| 723 | |
Chris Lattner | d9bdbaa | 2003-01-22 20:35:59 +0000 | [diff] [blame] | 724 | # |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 725 | # Get a list of the previous days that we can link to... |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 726 | # |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 727 | my @PrevDays = map {s/.html//; $_} GetDir ".html"; |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 728 | |
Brian Gaeke | 253231e | 2004-06-11 19:55:30 +0000 | [diff] [blame] | 729 | if ((scalar @PrevDays) > 20) { |
| 730 | splice @PrevDays, 20; # Trim down list to something reasonable... |
| 731 | } |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 732 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 733 | # Format list for sidebar |
| 734 | my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays; |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 735 | |
Chris Lattner | c75b14e | 2003-08-18 20:07:54 +0000 | [diff] [blame] | 736 | # |
Brian Gaeke | 90c82b9 | 2004-09-28 16:04:00 +0000 | [diff] [blame] | 737 | # Start outputting files into the web directory |
Chris Lattner | c75b14e | 2003-08-18 20:07:54 +0000 | [diff] [blame] | 738 | # |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 739 | ChangeDir( $WebDir, "Web Directory" ); |
Chris Lattner | c75b14e | 2003-08-18 20:07:54 +0000 | [diff] [blame] | 740 | |
Brian Gaeke | 90c82b9 | 2004-09-28 16:04:00 +0000 | [diff] [blame] | 741 | # Make sure we don't get errors running the nightly tester the first time |
| 742 | # because of files that don't exist. |
| 743 | Touch ('running_build_time.txt', 'running_Olden_llc_time.txt', |
| 744 | 'running_loc.txt', 'running_Olden_machcode.txt', |
| 745 | 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt', |
| 746 | 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt', |
| 747 | 'running_Olden_jit_time.txt'); |
| 748 | |
Chris Lattner | c75b14e | 2003-08-18 20:07:54 +0000 | [diff] [blame] | 749 | # Add information to the files which accumulate information for graphs... |
| 750 | AddRecord($LOC, "running_loc.txt"); |
| 751 | AddRecord($BuildTime, "running_build_time.txt"); |
| 752 | |
Chris Lattner | 4d00fde | 2004-05-28 20:30:23 +0000 | [diff] [blame] | 753 | if ( $VERBOSE ) { |
| 754 | print "GRAPH GENERATION STAGE\n"; |
| 755 | } |
Chris Lattner | c75b14e | 2003-08-18 20:07:54 +0000 | [diff] [blame] | 756 | # |
| 757 | # Rebuild the graphs now... |
| 758 | # |
Chris Lattner | fe2597a | 2004-07-27 18:41:49 +0000 | [diff] [blame] | 759 | $GNUPLOT = "/usr/bin/gnuplot"; |
Brian Gaeke | b3dab90 | 2003-10-11 05:34:00 +0000 | [diff] [blame] | 760 | $GNUPLOT = "gnuplot" if ! -x $GNUPLOT; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 761 | system ("$GNUPLOT", $PlotScriptFilename); |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 762 | |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 763 | # |
| 764 | # Remove the cvs tree... |
| 765 | # |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 766 | system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE); |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 767 | |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 768 | # |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 769 | # Print out information... |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 770 | # |
Chris Lattner | 4d00fde | 2004-05-28 20:30:23 +0000 | [diff] [blame] | 771 | if ($VERBOSE) { |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 772 | print "DateString: $DateString\n"; |
| 773 | print "CVS Checkout: $CVSCheckoutTime seconds\n"; |
| 774 | print "Files/Dirs/LOC in CVS: $NumFilesInCVS/$NumDirsInCVS/$LOC\n"; |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 775 | print "Build Time: $BuildTime seconds\n"; |
| 776 | print "Libraries/Executables/Objects built: $NumLibraries/$NumExecutables/$NumObjects\n"; |
| 777 | |
| 778 | print "WARNINGS:\n $WarningsList\n"; |
| 779 | |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 780 | print "Users committed: $UserCommitList\n"; |
| 781 | print "Added Files: \n $AddedFilesList\n"; |
| 782 | print "Modified Files: \n $ModifiedFilesList\n"; |
| 783 | print "Removed Files: \n $RemovedFilesList\n"; |
| 784 | |
| 785 | print "Previous Days =\n $PrevDaysList\n"; |
| 786 | } |
| 787 | |
Chris Lattner | b344030 | 2003-01-22 16:14:05 +0000 | [diff] [blame] | 788 | |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 789 | # |
| 790 | # Output the files... |
| 791 | # |
| 792 | |
Chris Lattner | 4d00fde | 2004-05-28 20:30:23 +0000 | [diff] [blame] | 793 | if ( $VERBOSE ) { |
| 794 | print "OUTPUT STAGE\n"; |
| 795 | } |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 796 | # Main HTML file... |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 797 | my $Output; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 798 | my $TestFinishTime = gmtime; |
| 799 | my $TestPlatform = `uname -a`; |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 800 | eval "\$Output = <<ENDOFFILE;$TemplateContents\nENDOFFILE\n"; |
Chris Lattner | 2f8cb57 | 2003-01-20 18:05:27 +0000 | [diff] [blame] | 801 | WriteFile "$DATE.html", $Output; |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 802 | system ( "ln -sf $DATE.html index.html" ); |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 803 | |
| 804 | # Change the index.html symlink... |
Chris Lattner | 4c7e303 | 2003-01-20 06:11:03 +0000 | [diff] [blame] | 805 | |
Reid Spencer | cb6a3aa | 2004-06-22 15:38:37 +0000 | [diff] [blame] | 806 | # vim: sw=2 ai |