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