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