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