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