Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 2 | use POSIX qw(strftime); |
| 3 | use File::Copy; |
Bob Wilson | 6dc11b4 | 2009-06-19 17:19:38 +0000 | [diff] [blame] | 4 | use File::Find; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +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 | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 12 | # regressions and performance changes. Submits this information |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 13 | # to llvm.org where it is placed into the nightlytestresults database. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 14 | # |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 15 | # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] |
| 16 | # where |
| 17 | # OPTIONS may include one or more of the following: |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 18 | # |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 19 | # MAIN OPTIONS: |
| 20 | # -config LLVMPATH If specified, use an existing LLVM build and only run and |
| 21 | # report the test information. The LLVMCONFIG argument should |
| 22 | # be the path to the llvm-config executable in the LLVM build. |
| 23 | # This should be the first argument if given. NOT YET |
| 24 | # IMPLEMENTED. |
| 25 | # -nickname NAME The NAME argument specifieds the nickname this script |
| 26 | # will submit to the nightlytest results repository. |
Patrick Jenkins | 0e9402f | 2006-08-11 23:02:09 +0000 | [diff] [blame] | 27 | # -submit-server Specifies a server to submit the test results too. If this |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 28 | # option is not specified it defaults to |
| 29 | # llvm.org. This is basically just the address of the |
Patrick Jenkins | 0e9402f | 2006-08-11 23:02:09 +0000 | [diff] [blame] | 30 | # webserver |
| 31 | # -submit-script Specifies which script to call on the submit server. If |
| 32 | # this option is not specified it defaults to |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 33 | # /nightlytest/NightlyTestAccept.php. This is basically |
Patrick Jenkins | 0e9402f | 2006-08-11 23:02:09 +0000 | [diff] [blame] | 34 | # everything after the www.yourserver.org. |
Daniel Dunbar | cd3f999 | 2009-05-18 23:24:26 +0000 | [diff] [blame] | 35 | # -submit-aux If specified, an auxiliary script to run in addition to the |
| 36 | # normal submit script. The script will be passed the path to |
| 37 | # the "sentdata.txt" file as its sole argument. |
Tanya Lattner | c161188 | 2008-03-10 07:28:08 +0000 | [diff] [blame] | 38 | # -nosubmit Do not report the test results back to a submit server. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 39 | # |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 40 | # |
| 41 | # BUILD OPTIONS (not used with -config): |
| 42 | # -nocheckout Do not create, checkout, update, or configure |
| 43 | # the source tree. |
| 44 | # -noremove Do not remove the BUILDDIR after it has been built. |
| 45 | # -noremoveresults Do not remove the WEBDIR after it has been built. |
| 46 | # -nobuild Do not build llvm. If tests are enabled perform them |
| 47 | # on the llvm build specified in the build directory |
| 48 | # -release Build an LLVM Release version |
| 49 | # -release-asserts Build an LLVM ReleaseAsserts version |
| 50 | # -disable-bindings Disable building LLVM bindings. |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 51 | # -with-clang Checkout Clang source into tools/clang. |
| 52 | # -compileflags Next argument specifies extra options passed to make when |
| 53 | # building LLVM. |
| 54 | # -use-gmake Use gmake instead of the default make command to build |
| 55 | # llvm and run tests. |
| 56 | # |
| 57 | # TESTING OPTIONS: |
| 58 | # -notest Do not even attempt to run the test programs. |
| 59 | # -nodejagnu Do not run feature or regression tests |
| 60 | # -enable-llcbeta Enable testing of beta features in llc. |
| 61 | # -enable-lli Enable testing of lli (interpreter) features, default is off |
| 62 | # -disable-pic Disable building with Position Independent Code. |
| 63 | # -disable-llc Disable LLC tests in the nightly tester. |
| 64 | # -disable-jit Disable JIT tests in the nightly tester. |
| 65 | # -disable-cbe Disable C backend tests in the nightly tester. |
| 66 | # -disable-lto Disable link time optimization. |
| 67 | # -test-cflags Next argument specifies that C compilation options that |
| 68 | # override the default when running the testsuite. |
| 69 | # -test-cxxflags Next argument specifies that C++ compilation options that |
| 70 | # override the default when running the testsuite. |
| 71 | # -extraflags Next argument specifies extra options that are passed to |
| 72 | # compile the tests. |
| 73 | # -noexternals Do not run the external tests (for cases where povray |
| 74 | # or SPEC are not installed) |
| 75 | # -with-externals Specify a directory where the external tests are located. |
| 76 | # |
| 77 | # OTHER OPTIONS: |
| 78 | # -parallel Run parallel jobs with GNU Make (see -parallel-jobs). |
| 79 | # -parallel-jobs The number of parallel Make jobs to use (default is two). |
Daniel Dunbar | ddef095 | 2009-10-19 13:20:56 +0000 | [diff] [blame] | 80 | # -parallel-test Allow parallel execution of llvm-test |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 81 | # -verbose Turn on some debug output |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 82 | # -nice Checkout/Configure/Build with "nice" to reduce impact |
| 83 | # on busy servers. |
| 84 | # -f2c Next argument specifies path to F2C utility |
| 85 | # -gccpath Path to gcc/g++ used to build LLVM |
| 86 | # -target Specify the target triplet |
| 87 | # -cflags Next argument specifies that C compilation options that |
| 88 | # override the default. |
| 89 | # -cxxflags Next argument specifies that C++ compilation options that |
| 90 | # override the default. |
| 91 | # -ldflags Next argument specifies that linker options that override |
| 92 | # the default. |
| 93 | # |
Daniel Dunbar | 2e10794 | 2009-10-19 09:18:54 +0000 | [diff] [blame] | 94 | # CVSROOT is ignored, it is passed for backwards compatibility. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 95 | # BUILDDIR is the directory where sources for this test run will be checked out |
| 96 | # AND objects for this test run will be built. This directory MUST NOT |
Daniel Dunbar | 2e10794 | 2009-10-19 09:18:54 +0000 | [diff] [blame] | 97 | # exist before the script is run; it will be created by the svn checkout |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 98 | # process and erased (unless -noremove is specified; see above.) |
| 99 | # WEBDIR is the directory into which the test results web page will be written, |
| 100 | # AND in which the "index.html" is assumed to be a symlink to the most recent |
| 101 | # copy of the results. This directory will be created if it does not exist. |
| 102 | # LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed |
| 103 | # to. This is the same as you would have for a normal LLVM build. |
| 104 | # |
| 105 | ############################################################## |
| 106 | # |
| 107 | # Getting environment variables |
| 108 | # |
| 109 | ############################################################## |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 110 | my $HOME = $ENV{'HOME'}; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 111 | my $SVNURL = $ENV{"SVNURL"}; |
Duncan Sands | 45db29c | 2009-06-12 13:02:52 +0000 | [diff] [blame] | 112 | $SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; |
Evan Cheng | 53df0a2 | 2009-06-18 21:39:50 +0000 | [diff] [blame] | 113 | my $TestSVNURL = $ENV{"TestSVNURL"}; |
Evan Cheng | e11c4db | 2009-07-14 06:23:41 +0000 | [diff] [blame] | 114 | $TestSVNURL = 'http://llvm.org/svn/llvm-project' unless $TestSVNURL; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 115 | my $BuildDir = $ENV{'BUILDDIR'}; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 116 | my $WebDir = $ENV{'WEBDIR'}; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 117 | |
Daniel Dunbar | 2f90daf | 2009-06-26 01:53:05 +0000 | [diff] [blame] | 118 | my $LLVMSrcDir = $ENV{'LLVMSRCDIR'}; |
| 119 | $LLVMSrcDir = "$BuildDir/llvm" unless $LLVMSrcDir; |
| 120 | my $LLVMObjDir = $ENV{'LLVMOBJDIR'}; |
| 121 | $LLVMObjDir = "$BuildDir/llvm" unless $LLVMObjDir; |
| 122 | my $LLVMTestDir = $ENV{'LLVMTESTDIR'}; |
| 123 | $LLVMTestDir = "$BuildDir/llvm/projects/llvm-test" unless $LLVMTestDir; |
| 124 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 125 | ############################################################## |
| 126 | # |
| 127 | # Calculate the date prefix... |
| 128 | # |
| 129 | ############################################################## |
| 130 | @TIME = localtime; |
Daniel Dunbar | 42cdc38 | 2009-07-01 14:52:59 +0000 | [diff] [blame] | 131 | my $DATE = sprintf "%4d-%02d-%02d_%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3], $TIME[1], $TIME[0]; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 132 | |
| 133 | ############################################################## |
| 134 | # |
| 135 | # Parse arguments... |
| 136 | # |
| 137 | ############################################################## |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 138 | $CONFIG_PATH=""; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 139 | $CONFIGUREARGS=""; |
Patrick Jenkins | 49717a4 | 2006-07-21 01:39:42 +0000 | [diff] [blame] | 140 | $nickname=""; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 141 | $NOTEST=0; |
Patrick Jenkins | 1cd4691 | 2006-07-27 01:17:17 +0000 | [diff] [blame] | 142 | $MAKECMD="make"; |
Patrick Jenkins | 0e9402f | 2006-08-11 23:02:09 +0000 | [diff] [blame] | 143 | $SUBMITSERVER = "llvm.org"; |
Jim Laskey | 6d8a1b7 | 2006-09-15 17:03:36 +0000 | [diff] [blame] | 144 | $SUBMITSCRIPT = "/nightlytest/NightlyTestAccept.php"; |
Daniel Dunbar | cd3f999 | 2009-05-18 23:24:26 +0000 | [diff] [blame] | 145 | $SUBMITAUX=""; |
Tanya Lattner | c161188 | 2008-03-10 07:28:08 +0000 | [diff] [blame] | 146 | $SUBMIT = 1; |
Daniel Dunbar | 056dbd0 | 2009-05-28 22:45:24 +0000 | [diff] [blame] | 147 | $PARALLELJOBS = "2"; |
Bill Wendling | 49e3182 | 2009-07-16 22:59:17 +0000 | [diff] [blame] | 148 | my $TESTFLAGS=""; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 149 | |
| 150 | while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 151 | shift; |
| 152 | last if /^--$/; # Stop processing arguments on -- |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 153 | |
| 154 | # List command line options here... |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 155 | if (/^-config$/) { $CONFIG_PATH = "$ARGV[0]"; shift; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 156 | if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 157 | if (/^-noremove$/) { $NOREMOVE = 1; next; } |
Daniel Dunbar | 0c39e38 | 2009-07-13 22:17:49 +0000 | [diff] [blame] | 158 | if (/^-noremoveatend$/) { $NOREMOVEATEND = 1; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 159 | if (/^-noremoveresults$/){ $NOREMOVERESULTS = 1; next; } |
Daniel Dunbar | f5a5950 | 2009-06-02 21:14:15 +0000 | [diff] [blame] | 160 | if (/^-notest$/) { $NOTEST = 1; next; } |
| 161 | if (/^-norunningtests$/) { next; } # Backward compatibility, ignored. |
Daniel Dunbar | 056dbd0 | 2009-05-28 22:45:24 +0000 | [diff] [blame] | 162 | if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;} |
Daniel Dunbar | 2bb4c53 | 2009-10-19 13:20:50 +0000 | [diff] [blame] | 163 | if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS"; next; } |
Daniel Dunbar | ddef095 | 2009-10-19 13:20:56 +0000 | [diff] [blame] | 164 | if (/^-parallel-test$/) { $PROGTESTOPTS .= " ENABLE_PARALLEL_REPORT=1"; next; } |
Duncan Sands | 45db29c | 2009-06-12 13:02:52 +0000 | [diff] [blame] | 165 | if (/^-with-clang$/) { $WITHCLANG = 1; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 166 | if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". |
Daniel Dunbar | f274138 | 2009-10-20 07:30:46 +0000 | [diff] [blame^] | 167 | "OPTIMIZE_OPTION=-O2"; next;} |
Jim Laskey | 27b8ba0 | 2006-09-28 17:49:20 +0000 | [diff] [blame] | 168 | if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". |
Dan Gohman | c6e2241 | 2008-10-30 01:08:03 +0000 | [diff] [blame] | 169 | "DISABLE_ASSERTIONS=1 ". |
Daniel Dunbar | f274138 | 2009-10-20 07:30:46 +0000 | [diff] [blame^] | 170 | "OPTIMIZE_OPTION=-O2"; next;} |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 171 | if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } |
Duncan Sands | 45db29c | 2009-06-12 13:02:52 +0000 | [diff] [blame] | 172 | if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; next; } |
Reid Spencer | 2bae1f5 | 2006-11-24 20:34:16 +0000 | [diff] [blame] | 173 | if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 174 | $CONFIGUREARGS .= " --enable-lli"; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 175 | if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 176 | $CONFIGUREARGS .= " --disable-llc_diffs"; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 177 | if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1"; |
| 178 | $CONFIGUREARGS .= " --disable-jit"; next; } |
Daniel Dunbar | 111def8 | 2009-03-10 19:33:13 +0000 | [diff] [blame] | 179 | if (/^-disable-bindings$/) { $CONFIGUREARGS .= " --disable-bindings"; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 180 | if (/^-disable-cbe$/) { $PROGTESTOPTS .= " DISABLE_CBE=1"; next; } |
Evan Cheng | e04c90b | 2008-01-12 04:27:18 +0000 | [diff] [blame] | 181 | if (/^-disable-lto$/) { $PROGTESTOPTS .= " DISABLE_LTO=1"; next; } |
Evan Cheng | 3d64f1c | 2008-01-14 17:58:03 +0000 | [diff] [blame] | 182 | if (/^-test-opts$/) { $PROGTESTOPTS .= " $ARGV[0]"; shift; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 183 | if (/^-verbose$/) { $VERBOSE = 1; next; } |
Daniel Dunbar | 2f90daf | 2009-06-26 01:53:05 +0000 | [diff] [blame] | 184 | if (/^-teelogs$/) { $TEELOGS = 1; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 185 | if (/^-nice$/) { $NICE = "nice "; next; } |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 186 | if (/^-f2c$/) { $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 187 | shift; next; } |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 188 | if (/^-with-externals$/) { $CONFIGUREARGS .= " --with-externals=$ARGV[0]"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 189 | shift; next; } |
Daniel Dunbar | ff79ef4 | 2009-07-13 22:31:58 +0000 | [diff] [blame] | 190 | if (/^-configure-args$/) { $CONFIGUREARGS .= " $ARGV[0]"; |
| 191 | shift; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 192 | if (/^-submit-server/) { $SUBMITSERVER = "$ARGV[0]"; shift; next; } |
| 193 | if (/^-submit-script/) { $SUBMITSCRIPT = "$ARGV[0]"; shift; next; } |
Daniel Dunbar | cd3f999 | 2009-05-18 23:24:26 +0000 | [diff] [blame] | 194 | if (/^-submit-aux/) { $SUBMITAUX = "$ARGV[0]"; shift; next; } |
Tanya Lattner | c161188 | 2008-03-10 07:28:08 +0000 | [diff] [blame] | 195 | if (/^-nosubmit$/) { $SUBMIT = 0; next; } |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 196 | if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; } |
| 197 | if (/^-gccpath/) { $CONFIGUREARGS .= |
| 198 | " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 199 | $GCCPATH=$ARGV[0]; shift; next; } |
| 200 | else { $GCCPATH=""; } |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 201 | if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 202 | shift; next; } |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 203 | if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 204 | shift; next; } |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 205 | if (/^-cxxflags/) { $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 206 | shift; next; } |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 207 | if (/^-ldflags/) { $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 208 | shift; next; } |
Bill Wendling | 49e3182 | 2009-07-16 22:59:17 +0000 | [diff] [blame] | 209 | if (/^-test-cflags/) { $TESTFLAGS = "$TESTFLAGS CFLAGS=\'$ARGV[0]\'"; |
| 210 | shift; next; } |
| 211 | if (/^-test-cxxflags/) { $TESTFLAGS = "$TESTFLAGS CXXFLAGS=\'$ARGV[0]\'"; |
| 212 | shift; next; } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 213 | if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; } |
| 214 | if (/^-use-gmake/) { $MAKECMD = "gmake"; shift; next; } |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 215 | if (/^-extraflags/) { $CONFIGUREARGS .= |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 216 | " --with-extra-options=\'$ARGV[0]\'"; shift; next;} |
| 217 | if (/^-noexternals$/) { $NOEXTERNALS = 1; next; } |
| 218 | if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; } |
| 219 | if (/^-nobuild$/) { $NOBUILD = 1; next; } |
| 220 | print "Unknown option: $_ : ignoring!\n"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | if ($ENV{'LLVMGCCDIR'}) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 224 | $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'}; |
Bob Wilson | 85cdfad | 2009-03-12 19:47:24 +0000 | [diff] [blame] | 225 | $LLVMGCCPATH = $ENV{'LLVMGCCDIR'} . '/bin'; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 226 | } |
Tanya Lattner | 849c9a2 | 2007-04-13 04:36:48 +0000 | [diff] [blame] | 227 | else { |
| 228 | $LLVMGCCPATH = ""; |
| 229 | } |
| 230 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 231 | if ($CONFIGUREARGS !~ /--disable-jit/) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 232 | $CONFIGUREARGS .= " --enable-jit"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 233 | } |
| 234 | |
Daniel Dunbar | 0e9fe69 | 2009-10-19 09:19:19 +0000 | [diff] [blame] | 235 | if (@ARGV != 0 and @ARGV != 3) { |
| 236 | die "error: must specify 0 or 3 options!"; |
Patrick Jenkins | f58473f | 2006-07-27 01:03:46 +0000 | [diff] [blame] | 237 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 238 | |
| 239 | if (@ARGV == 3) { |
Daniel Dunbar | 0e9fe69 | 2009-10-19 09:19:19 +0000 | [diff] [blame] | 240 | if ($CONFIG_PATH ne "") { |
| 241 | die "error: arguments are unsupported in -config mode,"; |
| 242 | } |
| 243 | |
Daniel Dunbar | 2e10794 | 2009-10-19 09:18:54 +0000 | [diff] [blame] | 244 | # ARGV[0] used to be the CVS root, ignored for backward compatibility. |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 245 | $BuildDir = $ARGV[1]; |
| 246 | $WebDir = $ARGV[2]; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 247 | } |
| 248 | |
Daniel Dunbar | 2e10794 | 2009-10-19 09:18:54 +0000 | [diff] [blame] | 249 | if ($BuildDir eq "" or |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 250 | $WebDir eq "") { |
Daniel Dunbar | 2e10794 | 2009-10-19 09:18:54 +0000 | [diff] [blame] | 251 | die("please specify a build directory, and a web directory"); |
Patrick Jenkins | f58473f | 2006-07-27 01:03:46 +0000 | [diff] [blame] | 252 | } |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 253 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 254 | if ($nickname eq "") { |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 255 | die ("Please invoke NewNightlyTest.pl with command line option " . |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 256 | "\"-nickname <nickname>\""); |
Patrick Jenkins | 514e258 | 2006-07-20 22:28:43 +0000 | [diff] [blame] | 257 | } |
Patrick Jenkins | 1cd4691 | 2006-07-27 01:17:17 +0000 | [diff] [blame] | 258 | |
Daniel Dunbar | 0e9fe69 | 2009-10-19 09:19:19 +0000 | [diff] [blame] | 259 | if ($CONFIG_PATH ne "") { |
| 260 | die "error: -config mode is not yet implemented,"; |
| 261 | } |
| 262 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 263 | ############################################################## |
| 264 | # |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 265 | # Define the file names we'll use |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 266 | # |
| 267 | ############################################################## |
| 268 | my $Prefix = "$WebDir/$DATE"; |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 269 | my $ConfigureLog = "$Prefix-Configure-Log.txt"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 270 | my $BuildLog = "$Prefix-Build-Log.txt"; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 271 | my $COLog = "$Prefix-CVS-Log.txt"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 272 | my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz"; |
| 273 | my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz"; |
Patrick Jenkins | 26ba609 | 2006-07-23 22:57:28 +0000 | [diff] [blame] | 274 | my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 275 | my $DejagnuLog = "$Prefix-Dejagnu-testrun.log"; |
| 276 | my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum"; |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 277 | my $DejagnuLog = "$Prefix-DejagnuTests-Log.txt"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 278 | if (! -d $WebDir) { |
Daniel Dunbar | 7a1e60a | 2009-10-19 13:19:53 +0000 | [diff] [blame] | 279 | mkdir $WebDir, 0777 or die "Unable to create web directory: '$WebDir'."; |
Patrick Jenkins | 0313775 | 2006-08-21 20:45:57 +0000 | [diff] [blame] | 280 | if($VERBOSE){ |
| 281 | warn "$WebDir did not exist; creating it.\n"; |
| 282 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | if ($VERBOSE) { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 286 | print "INITIALIZED\n"; |
Daniel Dunbar | ad83e7f | 2009-10-19 09:18:46 +0000 | [diff] [blame] | 287 | print "SVN URL = $SVNURL\n"; |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 288 | print "COLog = $COLog\n"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 289 | print "BuildDir = $BuildDir\n"; |
| 290 | print "WebDir = $WebDir\n"; |
| 291 | print "Prefix = $Prefix\n"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 292 | print "BuildLog = $BuildLog\n"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | ############################################################## |
| 296 | # |
| 297 | # Helper functions |
| 298 | # |
| 299 | ############################################################## |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 300 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 301 | sub GetDir { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 302 | my $Suffix = shift; |
| 303 | opendir DH, $WebDir; |
| 304 | my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH; |
| 305 | closedir DH; |
| 306 | return @Result; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 307 | } |
| 308 | |
Daniel Dunbar | 2f90daf | 2009-06-26 01:53:05 +0000 | [diff] [blame] | 309 | sub RunLoggedCommand { |
| 310 | my $Command = shift; |
| 311 | my $Log = shift; |
Daniel Dunbar | fc0fc3a | 2009-06-26 02:30:49 +0000 | [diff] [blame] | 312 | my $Title = shift; |
Daniel Dunbar | 2f90daf | 2009-06-26 01:53:05 +0000 | [diff] [blame] | 313 | if ($TEELOGS) { |
Daniel Dunbar | fc0fc3a | 2009-06-26 02:30:49 +0000 | [diff] [blame] | 314 | if ($VERBOSE) { |
| 315 | print "$Title\n"; |
| 316 | print "$Command 2>&1 | tee $Log\n"; |
| 317 | } |
Daniel Dunbar | 2f90daf | 2009-06-26 01:53:05 +0000 | [diff] [blame] | 318 | system "$Command 2>&1 | tee $Log"; |
| 319 | } else { |
Daniel Dunbar | fc0fc3a | 2009-06-26 02:30:49 +0000 | [diff] [blame] | 320 | if ($VERBOSE) { |
| 321 | print "$Title\n"; |
| 322 | print "$Command 2>&1 > $Log\n"; |
| 323 | } |
Daniel Dunbar | 2f90daf | 2009-06-26 01:53:05 +0000 | [diff] [blame] | 324 | system "$Command 2>&1 > $Log"; |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | sub RunAppendingLoggedCommand { |
| 329 | my $Command = shift; |
| 330 | my $Log = shift; |
Daniel Dunbar | fc0fc3a | 2009-06-26 02:30:49 +0000 | [diff] [blame] | 331 | my $Title = shift; |
Daniel Dunbar | 2f90daf | 2009-06-26 01:53:05 +0000 | [diff] [blame] | 332 | if ($TEELOGS) { |
Daniel Dunbar | fc0fc3a | 2009-06-26 02:30:49 +0000 | [diff] [blame] | 333 | if ($VERBOSE) { |
| 334 | print "$Title\n"; |
| 335 | print "$Command 2>&1 | tee -a $Log\n"; |
| 336 | } |
Daniel Dunbar | 2f90daf | 2009-06-26 01:53:05 +0000 | [diff] [blame] | 337 | system "$Command 2>&1 | tee -a $Log"; |
| 338 | } else { |
Daniel Dunbar | fc0fc3a | 2009-06-26 02:30:49 +0000 | [diff] [blame] | 339 | if ($VERBOSE) { |
| 340 | print "$Title\n"; |
| 341 | print "$Command 2>&1 > $Log\n"; |
| 342 | } |
| 343 | system "$Command 2>&1 >> $Log"; |
Daniel Dunbar | 2f90daf | 2009-06-26 01:53:05 +0000 | [diff] [blame] | 344 | } |
| 345 | } |
| 346 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 347 | sub GetRegex { # (Regex with ()'s, value) |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 348 | if ($_[1] =~ /$_[0]/m) { |
| 349 | return $1; |
| 350 | } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 351 | return "0"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 352 | } |
| 353 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 354 | sub ChangeDir { # directory, logical name |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 355 | my ($dir,$name) = @_; |
| 356 | chomp($dir); |
| 357 | if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; } |
| 358 | $result = chdir($dir); |
| 359 | if (!$result) { |
Daniel Dunbar | 2bb4c53 | 2009-10-19 13:20:50 +0000 | [diff] [blame] | 360 | print "ERROR!!! Cannot change directory to: $name ($dir) because $!\n"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 361 | return false; |
| 362 | } |
| 363 | return true; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 364 | } |
| 365 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 366 | sub ReadFile { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 367 | if (open (FILE, $_[0])) { |
| 368 | undef $/; |
| 369 | my $Ret = <FILE>; |
| 370 | close FILE; |
| 371 | $/ = '\n'; |
| 372 | return $Ret; |
| 373 | } else { |
| 374 | print "Could not open file '$_[0]' for reading!\n"; |
| 375 | return ""; |
| 376 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 377 | } |
| 378 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 379 | sub WriteFile { # (filename, contents) |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 380 | open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n"; |
| 381 | print FILE $_[1]; |
| 382 | close FILE; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 383 | } |
| 384 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 385 | sub CopyFile { #filename, newfile |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 386 | my ($file, $newfile) = @_; |
| 387 | chomp($file); |
| 388 | if ($VERBOSE) { print "Copying $file to $newfile\n"; } |
| 389 | copy($file, $newfile); |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 390 | } |
| 391 | |
| 392 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 393 | # |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 394 | # This function is meant to read in the dejagnu sum file and |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 395 | # return a string with only the results (i.e. PASS/FAIL/XPASS/ |
| 396 | # XFAIL). |
| 397 | # |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 398 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 399 | sub GetDejagnuTestResults { # (filename, log) |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 400 | my ($filename, $DejagnuLog) = @_; |
| 401 | my @lines; |
| 402 | $/ = "\n"; #Make sure we're going line at a time. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 403 | |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 404 | if( $VERBOSE) { print "DEJAGNU TEST RESULTS:\n"; } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 405 | |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 406 | if (open SRCHFILE, $filename) { |
| 407 | # Process test results |
| 408 | while ( <SRCHFILE> ) { |
| 409 | if ( length($_) > 1 ) { |
| 410 | chomp($_); |
Jim Laskey | 01d7bcf | 2006-09-20 09:20:22 +0000 | [diff] [blame] | 411 | if ( m/^(PASS|XPASS|FAIL|XFAIL): .*\/llvm\/test\/(.*)$/ ) { |
| 412 | push(@lines, "$1: test/$2"); |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 413 | } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 414 | } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 415 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 416 | } |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 417 | close SRCHFILE; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 418 | |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 419 | my $content = join("\n", @lines); |
| 420 | return $content; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | |
Patrick Jenkins | b9c65eb | 2006-08-18 18:00:21 +0000 | [diff] [blame] | 424 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 425 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 426 | # |
| 427 | # This function acts as a mini web browswer submitting data |
| 428 | # to our central server via the post method |
| 429 | # |
| 430 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 431 | sub SendData { |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 432 | $host = $_[0]; |
| 433 | $file = $_[1]; |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 434 | $variables = $_[2]; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 435 | |
Daniel Dunbar | 94a37a4 | 2009-05-28 18:31:40 +0000 | [diff] [blame] | 436 | # Write out the "...-sentdata.txt" file. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 437 | |
Daniel Dunbar | 94a37a4 | 2009-05-28 18:31:40 +0000 | [diff] [blame] | 438 | my $sentdata=""; |
| 439 | foreach $x (keys (%$variables)){ |
| 440 | $value = $variables->{$x}; |
| 441 | $sentdata.= "$x => $value\n"; |
| 442 | } |
| 443 | WriteFile "$Prefix-sentdata.txt", $sentdata; |
| 444 | |
| 445 | if (!($SUBMITAUX eq "")) { |
Daniel Dunbar | f7f02a9 | 2009-06-26 22:33:28 +0000 | [diff] [blame] | 446 | system "$SUBMITAUX \"$Prefix-sentdata.txt\""; |
| 447 | } |
| 448 | |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 449 | if (!$SUBMIT) { |
Daniel Dunbar | f7f02a9 | 2009-06-26 22:33:28 +0000 | [diff] [blame] | 450 | return "Skipped standard submit.\n"; |
Daniel Dunbar | 94a37a4 | 2009-05-28 18:31:40 +0000 | [diff] [blame] | 451 | } |
| 452 | |
| 453 | # Create the content to send to the server. |
| 454 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 455 | my $content; |
| 456 | foreach $key (keys (%$variables)){ |
| 457 | $value = $variables->{$key}; |
| 458 | $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; |
| 459 | $content .= "$key=$value&"; |
| 460 | } |
| 461 | |
Daniel Dunbar | 94a37a4 | 2009-05-28 18:31:40 +0000 | [diff] [blame] | 462 | # Send the data to the server. |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 463 | # |
Daniel Dunbar | 94a37a4 | 2009-05-28 18:31:40 +0000 | [diff] [blame] | 464 | # FIXME: This code should be more robust? |
Daniel Dunbar | 4628e5e | 2009-10-19 09:18:24 +0000 | [diff] [blame] | 465 | |
Daniel Dunbar | 94a37a4 | 2009-05-28 18:31:40 +0000 | [diff] [blame] | 466 | $port=80; |
| 467 | $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n"; |
| 468 | socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or |
| 469 | die "Bad socket\n"; |
| 470 | connect SOCK, $socketaddr or die "Bad connection\n"; |
| 471 | select((select(SOCK), $| = 1)[0]); |
| 472 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 473 | $length = length($content); |
| 474 | |
| 475 | my $send= "POST $file HTTP/1.0\n"; |
Lauro Ramos Venancio | 4604023 | 2007-05-03 14:05:07 +0000 | [diff] [blame] | 476 | $send.= "Host: $host\n"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 477 | $send.= "Content-Type: application/x-www-form-urlencoded\n"; |
| 478 | $send.= "Content-length: $length\n\n"; |
| 479 | $send.= "$content"; |
| 480 | |
Patrick Jenkins | e8501eb | 2006-08-07 01:54:37 +0000 | [diff] [blame] | 481 | print SOCK $send; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 482 | my $result; |
| 483 | while(<SOCK>){ |
| 484 | $result .= $_; |
| 485 | } |
| 486 | close(SOCK); |
| 487 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 488 | return $result; |
| 489 | } |
| 490 | |
Patrick Jenkins | 215b48f | 2006-07-07 18:50:51 +0000 | [diff] [blame] | 491 | ############################################################## |
| 492 | # |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 493 | # Individual Build & Test Functions |
Patrick Jenkins | 215b48f | 2006-07-07 18:50:51 +0000 | [diff] [blame] | 494 | # |
| 495 | ############################################################## |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 496 | |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 497 | # Create the source repository directory. |
Daniel Dunbar | 8df92e8 | 2009-10-19 13:20:06 +0000 | [diff] [blame] | 498 | sub CheckoutSource { |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 499 | if (-d $BuildDir) { |
| 500 | if (!$NOREMOVE) { |
| 501 | if ( $VERBOSE ) { |
| 502 | print "Build directory exists! Removing it\n"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 503 | } |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 504 | system "rm -rf $BuildDir"; |
Daniel Dunbar | 8df92e8 | 2009-10-19 13:20:06 +0000 | [diff] [blame] | 505 | mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 506 | } else { |
| 507 | if ( $VERBOSE ) { |
| 508 | print "Build directory exists!\n"; |
| 509 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 510 | } |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 511 | } else { |
| 512 | mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; |
| 513 | } |
Daniel Dunbar | 8df92e8 | 2009-10-19 13:20:06 +0000 | [diff] [blame] | 514 | |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 515 | ChangeDir( $BuildDir, "checkout directory" ); |
| 516 | my $SVNCMD = "$NICE svn co --non-interactive"; |
| 517 | RunLoggedCommand("( time -p $SVNCMD $SVNURL/llvm/trunk llvm; cd llvm/projects ; " . |
| 518 | " $SVNCMD $TestSVNURL/test-suite/trunk llvm-test )", $COLog, |
| 519 | "CHECKOUT LLVM"); |
| 520 | if ($WITHCLANG) { |
| 521 | RunLoggedCommand("( cd llvm/tools ; " . |
| 522 | " $SVNCMD $SVNURL/cfe/trunk clang )", $COLog, |
| 523 | "CHECKOUT CLANG"); |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 524 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 525 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 526 | |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 527 | # Build the entire tree, saving build messages to the build log. Returns false |
| 528 | # on build failure. |
Daniel Dunbar | 439801e | 2009-10-19 13:20:13 +0000 | [diff] [blame] | 529 | sub BuildLLVM { |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 530 | my $EXTRAFLAGS = "--enable-spec --with-objroot=."; |
| 531 | RunLoggedCommand("(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) ", |
| 532 | $ConfigureLog, "CONFIGURE"); |
| 533 | # Build the entire tree, capturing the output into $BuildLog |
Daniel Dunbar | 2bb4c53 | 2009-10-19 13:20:50 +0000 | [diff] [blame] | 534 | RunAppendingLoggedCommand("($NICE $MAKECMD $MAKEOPTS clean)", $BuildLog, "BUILD CLEAN"); |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 535 | RunAppendingLoggedCommand("(time -p $NICE $MAKECMD $MAKEOPTS)", $BuildLog, "BUILD"); |
| 536 | |
| 537 | if (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 || |
| 538 | `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l` + 0) { |
| 539 | return 0; |
Daniel Dunbar | 439801e | 2009-10-19 13:20:13 +0000 | [diff] [blame] | 540 | } |
| 541 | |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 542 | return 1; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 543 | } |
| 544 | |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 545 | # Running dejagnu tests and save results to log. |
| 546 | sub RunDejaGNUTests { |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 547 | # Run the feature and regression tests, results are put into testrun.sum and |
| 548 | # the full log in testrun.log. |
Daniel Dunbar | 2bb4c53 | 2009-10-19 13:20:50 +0000 | [diff] [blame] | 549 | system "rm -f test/testrun.log test/testrun.sum"; |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 550 | RunLoggedCommand("(time -p $MAKECMD $MAKEOPTS check)", $DejagnuLog, "DEJAGNU"); |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 551 | |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 552 | # Copy the testrun.log and testrun.sum to our webdir. |
| 553 | CopyFile("test/testrun.log", $DejagnuLog); |
| 554 | CopyFile("test/testrun.sum", $DejagnuSum); |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 555 | |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 556 | return GetDejagnuTestResults($DejagnuSum, $DejagnuLog); |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 557 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 558 | |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 559 | # Run the named tests (i.e. "SingleSource" "MultiSource" "External") |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 560 | sub TestDirectory { |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 561 | my $SubDir = shift; |
Daniel Dunbar | 2f90daf | 2009-06-26 01:53:05 +0000 | [diff] [blame] | 562 | ChangeDir( "$LLVMTestDir/$SubDir", |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 563 | "Programs Test Subdirectory" ) || return ("", ""); |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 564 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 565 | my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt"; |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 566 | |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 567 | # Run the programs tests... creating a report.nightly.csv file. |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 568 | my $LLCBetaOpts = ""; |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 569 | RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ". |
| 570 | "$TESTFLAGS TEST=nightly", |
| 571 | $ProgramTestLog, "TEST DIRECTORY $SubDir"); |
| 572 | $LLCBetaOpts = `$MAKECMD print-llcbeta-option`; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 573 | |
Patrick Jenkins | 59d1a66 | 2006-07-27 18:28:50 +0000 | [diff] [blame] | 574 | my $ProgramsTable; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 575 | if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) { |
Patrick Jenkins | 59d1a66 | 2006-07-27 18:28:50 +0000 | [diff] [blame] | 576 | $ProgramsTable="Error running test $SubDir\n"; |
| 577 | print "ERROR TESTING\n"; |
| 578 | } elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) { |
Patrick Jenkins | 59d1a66 | 2006-07-27 18:28:50 +0000 | [diff] [blame] | 579 | $ProgramsTable="Makefile error running tests $SubDir!\n"; |
| 580 | print "ERROR TESTING\n"; |
| 581 | } else { |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 582 | # Create a list of the tests which were run... |
| 583 | system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ". |
| 584 | "| sort > $Prefix-$SubDir-Tests.txt"; |
Patrick Jenkins | 59d1a66 | 2006-07-27 18:28:50 +0000 | [diff] [blame] | 585 | } |
| 586 | $ProgramsTable = ReadFile "report.nightly.csv"; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 587 | |
Patrick Jenkins | 59d1a66 | 2006-07-27 18:28:50 +0000 | [diff] [blame] | 588 | ChangeDir( "../../..", "Programs Test Parent Directory" ); |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 589 | return ($ProgramsTable, $LLCBetaOpts); |
| 590 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 591 | |
Daniel Dunbar | ac0c064 | 2009-10-19 13:20:44 +0000 | [diff] [blame] | 592 | # Run all the nightly tests and return the program tables and the list of tests, |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 593 | # passes, fails, and xfails. |
Daniel Dunbar | 4a338bf | 2009-10-19 13:20:25 +0000 | [diff] [blame] | 594 | sub RunNightlyTest() { |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 595 | ($SSProgs, $llcbeta_options) = TestDirectory("SingleSource"); |
| 596 | WriteFile "$Prefix-SingleSource-Performance.txt", $SSProgs; |
| 597 | ($MSProgs, $llcbeta_options) = TestDirectory("MultiSource"); |
| 598 | WriteFile "$Prefix-MultiSource-Performance.txt", $MSProgs; |
| 599 | if ( ! $NOEXTERNALS ) { |
| 600 | ($ExtProgs, $llcbeta_options) = TestDirectory("External"); |
| 601 | WriteFile "$Prefix-External-Performance.txt", $ExtProgs; |
| 602 | system "cat $Prefix-SingleSource-Tests.txt " . |
| 603 | "$Prefix-MultiSource-Tests.txt ". |
| 604 | "$Prefix-External-Tests.txt | sort > $Prefix-Tests.txt"; |
| 605 | system "cat $Prefix-SingleSource-Performance.txt " . |
| 606 | "$Prefix-MultiSource-Performance.txt ". |
| 607 | "$Prefix-External-Performance.txt | sort > $Prefix-Performance.txt"; |
| 608 | } else { |
| 609 | $ExtProgs = "External TEST STAGE SKIPPED\n"; |
| 610 | if ( $VERBOSE ) { |
| 611 | print "External TEST STAGE SKIPPED\n"; |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 612 | } |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 613 | system "cat $Prefix-SingleSource-Tests.txt " . |
| 614 | "$Prefix-MultiSource-Tests.txt ". |
| 615 | " | sort > $Prefix-Tests.txt"; |
| 616 | system "cat $Prefix-SingleSource-Performance.txt " . |
| 617 | "$Prefix-MultiSource-Performance.txt ". |
| 618 | " | sort > $Prefix-Performance.txt"; |
| 619 | } |
Daniel Dunbar | 4a338bf | 2009-10-19 13:20:25 +0000 | [diff] [blame] | 620 | |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 621 | # Compile passes, fails, xfails. |
Daniel Dunbar | ac0c064 | 2009-10-19 13:20:44 +0000 | [diff] [blame] | 622 | my $All = (ReadFile "$Prefix-Tests.txt"); |
| 623 | my @TestSuiteResultLines = split "\n", $All; |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 624 | my ($Passes, $Fails, $XFails) = ""; |
Daniel Dunbar | 4a338bf | 2009-10-19 13:20:25 +0000 | [diff] [blame] | 625 | |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 626 | for ($x=0; $x < @TestSuiteResultLines; $x++) { |
| 627 | if (@TestSuiteResultLines[$x] =~ m/^PASS:/) { |
| 628 | $Passes .= "$TestSuiteResultLines[$x]\n"; |
| 629 | } |
| 630 | elsif (@TestSuiteResultLines[$x] =~ m/^FAIL:/) { |
| 631 | $Fails .= "$TestSuiteResultLines[$x]\n"; |
| 632 | } |
| 633 | elsif (@TestSuiteResultLines[$x] =~ m/^XFAIL:/) { |
| 634 | $XFails .= "$TestSuiteResultLines[$x]\n"; |
Daniel Dunbar | 4a338bf | 2009-10-19 13:20:25 +0000 | [diff] [blame] | 635 | } |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 636 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 637 | |
Daniel Dunbar | ac0c064 | 2009-10-19 13:20:44 +0000 | [diff] [blame] | 638 | return ($SSProgs, $MSProgs, $ExtProgs, $All, $Passes, $Fails, $XFails); |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 639 | } |
Patrick Jenkins | ad6f758 | 2006-08-22 18:11:19 +0000 | [diff] [blame] | 640 | |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 641 | ############################################################## |
| 642 | # |
| 643 | # The actual NewNightlyTest logic. |
| 644 | # |
| 645 | ############################################################## |
| 646 | |
| 647 | $starttime = `date "+20%y-%m-%d %H:%M:%S"`; |
| 648 | |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 649 | if (!$NOCHECKOUT) { |
| 650 | CheckoutSource(); |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 651 | } |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 652 | |
| 653 | # Build LLVM. |
| 654 | my $BuildError = 0, $BuildStatus = "OK"; |
| 655 | ChangeDir( $LLVMSrcDir , "llvm source directory") ; |
| 656 | if ($NOCHECKOUT || $NOBUILD) { |
| 657 | $BuildStatus = "Skipped by user"; |
| 658 | } else { |
| 659 | if (!BuildLLVM()) { |
| 660 | if( $VERBOSE) { print "\n***ERROR BUILDING TREE\n\n"; } |
| 661 | $BuildError = 1; |
| 662 | $BuildStatus = "Error: compilation aborted"; |
| 663 | $NODEJAGNU=1; |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | # Run DejaGNU. |
| 668 | my $DejagnuTestResults = "Dejagnu skipped by user choice."; |
| 669 | if (!$NODEJAGNU && !$BuildError) { |
| 670 | $DejagnuTestResults = RunDejaGNUTests(); |
| 671 | } |
| 672 | |
| 673 | # Run the llvm-test tests. |
Daniel Dunbar | 4a338bf | 2009-10-19 13:20:25 +0000 | [diff] [blame] | 674 | my ($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable, |
Daniel Dunbar | ac0c064 | 2009-10-19 13:20:44 +0000 | [diff] [blame] | 675 | $all_tests, $passes, $fails, $xfails) = ""; |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 676 | if (!$NOTEST && !$BuildError) { |
| 677 | ($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable, |
Daniel Dunbar | ac0c064 | 2009-10-19 13:20:44 +0000 | [diff] [blame] | 678 | $all_tests, $passes, $fails, $xfails) = RunNightlyTest(); |
Daniel Dunbar | 1409c13 | 2009-10-19 13:20:38 +0000 | [diff] [blame] | 679 | } |
Daniel Dunbar | 4a338bf | 2009-10-19 13:20:25 +0000 | [diff] [blame] | 680 | |
Patrick Jenkins | b67e118 | 2006-07-21 21:43:09 +0000 | [diff] [blame] | 681 | $endtime = `date "+20%y-%m-%d %H:%M:%S"`; |
Patrick Jenkins | 215b48f | 2006-07-07 18:50:51 +0000 | [diff] [blame] | 682 | |
Daniel Dunbar | 2bb4c53 | 2009-10-19 13:20:50 +0000 | [diff] [blame] | 683 | # The last bit of logic is to remove the build and web dirs, after sending data |
| 684 | # to the server. |
| 685 | |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 686 | ############################################################## |
| 687 | # |
| 688 | # Accumulate the information to send to the server. |
| 689 | # |
| 690 | ############################################################## |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 691 | |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 692 | if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; } |
| 693 | |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 694 | $machine_data = "uname: ".`uname -a`. |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 695 | "hardware: ".`uname -m`. |
| 696 | "os: ".`uname -sr`. |
| 697 | "name: ".`uname -n`. |
| 698 | "date: ".`date \"+20%y-%m-%d\"`. |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 699 | "time: ".`date +\"%H:%M:%S\"`; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 700 | |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 701 | # Get gcc version. |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 702 | my $gcc_version_long = ""; |
Patrick Jenkins | ad6f758 | 2006-08-22 18:11:19 +0000 | [diff] [blame] | 703 | if ($GCCPATH ne "") { |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 704 | $gcc_version_long = `$GCCPATH/gcc --version`; |
Jeff Cohen | 7545422 | 2007-04-10 19:13:43 +0000 | [diff] [blame] | 705 | } elsif ($ENV{"CC"}) { |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 706 | $gcc_version_long = `$ENV{"CC"} --version`; |
Patrick Jenkins | ad6f758 | 2006-08-22 18:11:19 +0000 | [diff] [blame] | 707 | } else { |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 708 | $gcc_version_long = `gcc --version`; |
Patrick Jenkins | ad6f758 | 2006-08-22 18:11:19 +0000 | [diff] [blame] | 709 | } |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 710 | my $gcc_version = (split '\n', $gcc_version_long)[0]; |
Patrick Jenkins | ad6f758 | 2006-08-22 18:11:19 +0000 | [diff] [blame] | 711 | |
Daniel Dunbar | 5381eb7 | 2009-10-19 13:20:31 +0000 | [diff] [blame] | 712 | # Get llvm-gcc target triple. |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 713 | my $llvmgcc_version_long = ""; |
Tanya Lattner | 849c9a2 | 2007-04-13 04:36:48 +0000 | [diff] [blame] | 714 | if ($LLVMGCCPATH ne "") { |
| 715 | $llvmgcc_version_long = `$LLVMGCCPATH/llvm-gcc -v 2>&1`; |
| 716 | } else { |
| 717 | $llvmgcc_version_long = `llvm-gcc -v 2>&1`; |
| 718 | } |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 719 | (split '\n', $llvmgcc_version_long)[1] =~ /Target: (.+)/; |
| 720 | my $targetTriple = $1; |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 721 | |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 722 | # Logs. |
| 723 | my $ConfigureLogData = ReadFile $ConfigureLog; |
| 724 | my $BuildLogData = ReadFile $BuildLog; |
| 725 | my $DejagnuLogData = ReadFile $DejagnuLog; |
| 726 | my $CheckoutLogData = ReadFile $COLog; |
| 727 | |
Daniel Dunbar | 439801e | 2009-10-19 13:20:13 +0000 | [diff] [blame] | 728 | # Checkout info. |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 729 | my $CheckoutTime_Wall = GetRegex "^real ([0-9.]+)", $CheckoutLogData; |
| 730 | my $CheckoutTime_User = GetRegex "^user ([0-9.]+)", $CheckoutLogData; |
| 731 | my $CheckoutTime_Sys = GetRegex "^sys ([0-9.]+)", $CheckoutLogData; |
Daniel Dunbar | 8df92e8 | 2009-10-19 13:20:06 +0000 | [diff] [blame] | 732 | my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; |
| 733 | |
Daniel Dunbar | 439801e | 2009-10-19 13:20:13 +0000 | [diff] [blame] | 734 | # Configure info. |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 735 | my $ConfigTimeU = GetRegex "^user ([0-9.]+)", $ConfigureLogData; |
| 736 | my $ConfigTimeS = GetRegex "^sys ([0-9.]+)", $ConfigureLogData; |
Daniel Dunbar | 439801e | 2009-10-19 13:20:13 +0000 | [diff] [blame] | 737 | my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 738 | my $ConfigWallTime = GetRegex "^real ([0-9.]+)",$ConfigureLogData; |
Daniel Dunbar | 439801e | 2009-10-19 13:20:13 +0000 | [diff] [blame] | 739 | $ConfigTime=-1 unless $ConfigTime; |
| 740 | $ConfigWallTime=-1 unless $ConfigWallTime; |
| 741 | |
| 742 | # Build info. |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 743 | my $BuildTimeU = GetRegex "^user ([0-9.]+)", $BuildLogData; |
| 744 | my $BuildTimeS = GetRegex "^sys ([0-9.]+)", $BuildLogData; |
Daniel Dunbar | 439801e | 2009-10-19 13:20:13 +0000 | [diff] [blame] | 745 | my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 746 | my $BuildWallTime = GetRegex "^real ([0-9.]+)", $BuildLogData; |
Daniel Dunbar | 439801e | 2009-10-19 13:20:13 +0000 | [diff] [blame] | 747 | $BuildTime=-1 unless $BuildTime; |
| 748 | $BuildWallTime=-1 unless $BuildWallTime; |
| 749 | |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 750 | # DejaGNU info. |
| 751 | my $DejagnuTimeU = GetRegex "^user ([0-9.]+)", $DejagnuLogData; |
| 752 | my $DejagnuTimeS = GetRegex "^sys ([0-9.]+)", $DejagnuLogData; |
| 753 | $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System |
| 754 | $DejagnuWallTime = GetRegex "^real ([0-9.]+)", $DejagnuLogData; |
| 755 | $DejagnuTime = "0.0" unless $DejagnuTime; |
| 756 | $DejagnuWallTime = "0.0" unless $DejagnuWallTime; |
Daniel Dunbar | 439801e | 2009-10-19 13:20:13 +0000 | [diff] [blame] | 757 | |
Daniel Dunbar | 2bb4c53 | 2009-10-19 13:20:50 +0000 | [diff] [blame] | 758 | if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; } |
| 759 | |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 760 | my %hash_of_data = ( |
| 761 | 'machine_data' => $machine_data, |
Daniel Dunbar | 3431123 | 2009-10-19 13:20:19 +0000 | [diff] [blame] | 762 | 'build_data' => $ConfigureLogData . $BuildLogData, |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 763 | 'gcc_version' => $gcc_version, |
| 764 | 'nickname' => $nickname, |
| 765 | 'dejagnutime_wall' => $DejagnuWallTime, |
| 766 | 'dejagnutime_cpu' => $DejagnuTime, |
Reid Spencer | 99e865a | 2007-04-07 04:41:16 +0000 | [diff] [blame] | 767 | 'cvscheckouttime_wall' => $CheckoutTime_Wall, |
| 768 | 'cvscheckouttime_cpu' => $CheckoutTime_CPU, |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 769 | 'configtime_wall' => $ConfigWallTime, |
| 770 | 'configtime_cpu'=> $ConfigTime, |
| 771 | 'buildtime_wall' => $BuildWallTime, |
| 772 | 'buildtime_cpu' => $BuildTime, |
Daniel Dunbar | 2bb4c53 | 2009-10-19 13:20:50 +0000 | [diff] [blame] | 773 | 'buildstatus' => $BuildStatus, |
| 774 | 'singlesource_programstable' => $SingleSourceProgramsTable, |
| 775 | 'multisource_programstable' => $MultiSourceProgramsTable, |
| 776 | 'externalsource_programstable' => $ExternalProgramsTable, |
| 777 | 'llcbeta_options' => $llcbeta_options, |
| 778 | 'passing_tests' => $passes, |
| 779 | 'expfail_tests' => $xfails, |
| 780 | 'unexpfail_tests' => $fails, |
| 781 | 'all_tests' => $all_tests, |
| 782 | 'dejagnutests_results' => $DejagnuTestResults, |
| 783 | 'dejagnutests_log' => $DejagnuLogData, |
| 784 | 'starttime' => $starttime, |
| 785 | 'endtime' => $endtime, |
| 786 | 'target_triple' => $targetTriple, |
| 787 | |
| 788 | # Unused, but left around for backwards compatability. |
Daniel Dunbar | 7a1e60a | 2009-10-19 13:19:53 +0000 | [diff] [blame] | 789 | 'warnings' => "", |
Daniel Dunbar | 7c9eb9e | 2009-10-19 09:19:09 +0000 | [diff] [blame] | 790 | 'cvsusercommitlist' => "", |
| 791 | 'cvsuserupdatelist' => "", |
| 792 | 'cvsaddedfiles' => "", |
| 793 | 'cvsmodifiedfiles' => "", |
| 794 | 'cvsremovedfiles' => "", |
| 795 | 'lines_of_code' => "", |
| 796 | 'cvs_file_count' => 0, |
| 797 | 'cvs_dir_count' => 0, |
Daniel Dunbar | 7a1e60a | 2009-10-19 13:19:53 +0000 | [diff] [blame] | 798 | 'warnings_removed' => "", |
| 799 | 'warnings_added' => "", |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 800 | 'new_tests' => "", |
| 801 | 'removed_tests' => "", |
Daniel Dunbar | 7f0e81f | 2009-10-19 13:20:00 +0000 | [diff] [blame] | 802 | 'o_file_sizes' => "", |
Daniel Dunbar | 2bb4c53 | 2009-10-19 13:20:50 +0000 | [diff] [blame] | 803 | 'a_file_sizes' => "" |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 804 | ); |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 805 | |
Daniel Dunbar | f7f02a9 | 2009-06-26 22:33:28 +0000 | [diff] [blame] | 806 | if ($SUBMIT || !($SUBMITAUX eq "")) { |
Tanya Lattner | c161188 | 2008-03-10 07:28:08 +0000 | [diff] [blame] | 807 | my $response = SendData $SUBMITSERVER,$SUBMITSCRIPT,\%hash_of_data; |
| 808 | if( $VERBOSE) { print "============================\n$response"; } |
| 809 | } else { |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 810 | print "============================\n"; |
| 811 | foreach $x(keys %hash_of_data){ |
| 812 | print "$x => $hash_of_data{$x}\n"; |
| 813 | } |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 814 | } |
| 815 | |
| 816 | ############################################################## |
| 817 | # |
Daniel Dunbar | 2e10794 | 2009-10-19 09:18:54 +0000 | [diff] [blame] | 818 | # Remove the source tree... |
Patrick Jenkins | fe030d7 | 2006-07-06 21:19:32 +0000 | [diff] [blame] | 819 | # |
| 820 | ############################################################## |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 821 | system ( "$NICE rm -rf $BuildDir") |
Daniel Dunbar | 0c39e38 | 2009-07-13 22:17:49 +0000 | [diff] [blame] | 822 | if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVEATEND); |
Misha Brukman | 12c8d1b | 2009-01-02 16:28:18 +0000 | [diff] [blame] | 823 | system ( "$NICE rm -rf $WebDir") |
Reid Spencer | fa34d7b | 2006-08-13 09:53:02 +0000 | [diff] [blame] | 824 | if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS); |