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