blob: a40b3f11a2b4e60266d7d1f0cfeafec2d0fe790e [file] [log] [blame]
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001#!/usr/bin/perl
Patrick Jenkins0e316b42006-07-06 21:19:32 +00002use POSIX qw(strftime);
3use File::Copy;
4use 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 Brukmancc211512009-01-02 16:28:18 +000011# regressions and performance changes. Submits this information
Reid Spencer558269c2006-08-13 09:53:02 +000012# to llvm.org where it is placed into the nightlytestresults database.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000013#
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 Jenkins5053e152006-07-07 17:31:38 +000022# -noremoveresults Do not remove the WEBDIR after it has been built.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000023# -nobuild Do not build llvm. If tests are enabled perform them
24# on the llvm build specified in the build directory
Daniel Dunbar6cbe9782009-06-02 21:14:15 +000025# -notest Do not even attempt to run the test programs.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000026# -nodejagnu Do not run feature or regression tests
Daniel Dunbare88a7d52009-05-28 22:45:24 +000027# -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 Jenkins0e316b42006-07-06 21:19:32 +000029# -release Build an LLVM Release version
Jim Laskey68722b72006-09-28 17:49:20 +000030# -release-asserts Build an LLVM ReleaseAsserts version
Patrick Jenkins0e316b42006-07-06 21:19:32 +000031# -enable-llcbeta Enable testing of beta features in llc.
Reid Spencer17782032006-11-24 20:34:16 +000032# -enable-lli Enable testing of lli (interpreter) features, default is off
Patrick Jenkins0e316b42006-07-06 21:19:32 +000033# -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 Cheng0395fd72008-01-12 04:27:18 +000036# -disable-lto Disable link time optimization.
Daniel Dunbare2c9def2009-03-10 19:33:13 +000037# -disable-bindings Disable building LLVM bindings.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000038# -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 Spencerdf2e2032007-07-02 06:19:57 +000048# -usecvs Check code out from the (old) CVS Repository instead of from
49# the standard Subversion repository.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000050# -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 Jenkinsf976a5c2006-07-07 18:50:51 +000057# -compileflags Next argument specifies extra options passed to make when
58# building LLVM.
Patrick Jenkinse97e6072006-08-11 23:02:09 +000059# -use-gmake Use gmake instead of the default make command to build
Patrick Jenkins10d0e342006-07-27 01:17:17 +000060# llvm and run tests.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000061#
62# ---------------- Options to configure llvm-test ----------------------------
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +000063# -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 Jenkinse97e6072006-08-11 23:02:09 +000068# -submit-server Specifies a server to submit the test results too. If this
Misha Brukmancc211512009-01-02 16:28:18 +000069# option is not specified it defaults to
70# llvm.org. This is basically just the address of the
Patrick Jenkinse97e6072006-08-11 23:02:09 +000071# webserver
72# -submit-script Specifies which script to call on the submit server. If
73# this option is not specified it defaults to
Misha Brukmancc211512009-01-02 16:28:18 +000074# /nightlytest/NightlyTestAccept.php. This is basically
Patrick Jenkinse97e6072006-08-11 23:02:09 +000075# everything after the www.yourserver.org.
Daniel Dunbar20686472009-05-18 23:24:26 +000076# -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 Lattnerf7c52a12008-03-10 07:28:08 +000079# -nosubmit Do not report the test results back to a submit server.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000080#
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 Spencer558269c2006-08-13 09:53:02 +000099my $HOME = $ENV{'HOME'};
Reid Spencer203524f2007-04-07 04:41:16 +0000100my $SVNURL = $ENV{"SVNURL"};
Reid Spencerab137212007-06-26 17:08:16 +0000101$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000102my $CVSRootDir = $ENV{'CVSROOT'};
Reid Spencer558269c2006-08-13 09:53:02 +0000103$CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000104my $BuildDir = $ENV{'BUILDDIR'};
Reid Spencer558269c2006-08-13 09:53:02 +0000105$BuildDir = "$HOME/buildtest" unless $BuildDir;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000106my $WebDir = $ENV{'WEBDIR'};
Reid Spencer558269c2006-08-13 09:53:02 +0000107$WebDir = "$HOME/cvs/testresults-X86" unless $WebDir;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000108
109##############################################################
110#
111# Calculate the date prefix...
112#
113##############################################################
114@TIME = localtime;
115my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
116my $DateString = strftime "%B %d, %Y", localtime;
117my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
118
119##############################################################
120#
121# Parse arguments...
122#
123##############################################################
124$CONFIGUREARGS="";
Patrick Jenkinsa95958c2006-07-21 01:39:42 +0000125$nickname="";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000126$NOTEST=0;
John Criswell98674c12007-06-29 19:12:50 +0000127$USESVN=1;
Patrick Jenkins10d0e342006-07-27 01:17:17 +0000128$MAKECMD="make";
Patrick Jenkinse97e6072006-08-11 23:02:09 +0000129$SUBMITSERVER = "llvm.org";
Jim Laskeyee7929d2006-09-15 17:03:36 +0000130$SUBMITSCRIPT = "/nightlytest/NightlyTestAccept.php";
Daniel Dunbar20686472009-05-18 23:24:26 +0000131$SUBMITAUX="";
Tanya Lattnerf7c52a12008-03-10 07:28:08 +0000132$SUBMIT = 1;
Daniel Dunbare88a7d52009-05-28 22:45:24 +0000133$PARALLELJOBS = "2";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000134
135while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
Reid Spencer558269c2006-08-13 09:53:02 +0000136 shift;
137 last if /^--$/; # Stop processing arguments on --
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000138
139 # List command line options here...
Reid Spencer558269c2006-08-13 09:53:02 +0000140 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
141 if (/^-nocvsstats$/) { $NOCVSSTATS = 1; next; }
142 if (/^-noremove$/) { $NOREMOVE = 1; next; }
143 if (/^-noremoveresults$/){ $NOREMOVERESULTS = 1; next; }
Daniel Dunbar6cbe9782009-06-02 21:14:15 +0000144 if (/^-notest$/) { $NOTEST = 1; next; }
145 if (/^-norunningtests$/) { next; } # Backward compatibility, ignored.
Daniel Dunbare88a7d52009-05-28 22:45:24 +0000146 if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;}
147 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS -l3.0"; next; }
Reid Spencer558269c2006-08-13 09:53:02 +0000148 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
149 "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;}
Jim Laskey68722b72006-09-28 17:49:20 +0000150 if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
Dan Gohman97acad12008-10-30 01:08:03 +0000151 "DISABLE_ASSERTIONS=1 ".
Misha Brukmancc211512009-01-02 16:28:18 +0000152 "OPTIMIZE_OPTION=-O2";
Reid Spencerebd21a42006-10-19 15:24:04 +0000153 $BUILDTYPE="release-asserts"; next;}
Reid Spencer558269c2006-08-13 09:53:02 +0000154 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
Reid Spencer17782032006-11-24 20:34:16 +0000155 if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1";
Misha Brukmancc211512009-01-02 16:28:18 +0000156 $CONFIGUREARGS .= " --enable-lli"; next; }
Reid Spencer558269c2006-08-13 09:53:02 +0000157 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
Misha Brukmancc211512009-01-02 16:28:18 +0000158 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
Reid Spencer558269c2006-08-13 09:53:02 +0000159 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
160 $CONFIGUREARGS .= " --disable-jit"; next; }
Daniel Dunbare2c9def2009-03-10 19:33:13 +0000161 if (/^-disable-bindings$/) { $CONFIGUREARGS .= " --disable-bindings"; next; }
Reid Spencer558269c2006-08-13 09:53:02 +0000162 if (/^-disable-cbe$/) { $PROGTESTOPTS .= " DISABLE_CBE=1"; next; }
Evan Cheng0395fd72008-01-12 04:27:18 +0000163 if (/^-disable-lto$/) { $PROGTESTOPTS .= " DISABLE_LTO=1"; next; }
Evan Chengc8dc2f72008-01-14 17:58:03 +0000164 if (/^-test-opts$/) { $PROGTESTOPTS .= " $ARGV[0]"; shift; next; }
Reid Spencer558269c2006-08-13 09:53:02 +0000165 if (/^-verbose$/) { $VERBOSE = 1; next; }
166 if (/^-debug$/) { $DEBUG = 1; next; }
167 if (/^-nice$/) { $NICE = "nice "; next; }
Misha Brukmancc211512009-01-02 16:28:18 +0000168 if (/^-f2c$/) { $CONFIGUREARGS .= " --with-f2c=$ARGV[0]";
Reid Spencer558269c2006-08-13 09:53:02 +0000169 shift; next; }
Misha Brukmancc211512009-01-02 16:28:18 +0000170 if (/^-with-externals$/) { $CONFIGUREARGS .= " --with-externals=$ARGV[0]";
Reid Spencer558269c2006-08-13 09:53:02 +0000171 shift; next; }
172 if (/^-submit-server/) { $SUBMITSERVER = "$ARGV[0]"; shift; next; }
173 if (/^-submit-script/) { $SUBMITSCRIPT = "$ARGV[0]"; shift; next; }
Daniel Dunbar20686472009-05-18 23:24:26 +0000174 if (/^-submit-aux/) { $SUBMITAUX = "$ARGV[0]"; shift; next; }
Tanya Lattnerf7c52a12008-03-10 07:28:08 +0000175 if (/^-nosubmit$/) { $SUBMIT = 0; next; }
Misha Brukmancc211512009-01-02 16:28:18 +0000176 if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; }
177 if (/^-gccpath/) { $CONFIGUREARGS .=
178 " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++";
Reid Spencer558269c2006-08-13 09:53:02 +0000179 $GCCPATH=$ARGV[0]; shift; next; }
180 else { $GCCPATH=""; }
Misha Brukmancc211512009-01-02 16:28:18 +0000181 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
Reid Spencer558269c2006-08-13 09:53:02 +0000182 else { $CVSCOOPT="";}
Reid Spencerdf2e2032007-07-02 06:19:57 +0000183 if (/^-usecvs/) { $USESVN = 0; }
Misha Brukmancc211512009-01-02 16:28:18 +0000184 if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]";
Reid Spencer558269c2006-08-13 09:53:02 +0000185 shift; next; }
Misha Brukmancc211512009-01-02 16:28:18 +0000186 if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'";
Reid Spencer558269c2006-08-13 09:53:02 +0000187 shift; next; }
Misha Brukmancc211512009-01-02 16:28:18 +0000188 if (/^-cxxflags/) { $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'";
Reid Spencer558269c2006-08-13 09:53:02 +0000189 shift; next; }
Misha Brukmancc211512009-01-02 16:28:18 +0000190 if (/^-ldflags/) { $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'";
Reid Spencer558269c2006-08-13 09:53:02 +0000191 shift; next; }
192 if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; }
193 if (/^-use-gmake/) { $MAKECMD = "gmake"; shift; next; }
Misha Brukmancc211512009-01-02 16:28:18 +0000194 if (/^-extraflags/) { $CONFIGUREARGS .=
Reid Spencer558269c2006-08-13 09:53:02 +0000195 " --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 Jenkins0e316b42006-07-06 21:19:32 +0000200}
201
202if ($ENV{'LLVMGCCDIR'}) {
Reid Spencer558269c2006-08-13 09:53:02 +0000203 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
Bob Wilsone4467e42009-03-12 19:47:24 +0000204 $LLVMGCCPATH = $ENV{'LLVMGCCDIR'} . '/bin';
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000205}
Tanya Lattnerc821a9a2007-04-13 04:36:48 +0000206else {
207 $LLVMGCCPATH = "";
208}
209
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000210if ($CONFIGUREARGS !~ /--disable-jit/) {
Reid Spencer558269c2006-08-13 09:53:02 +0000211 $CONFIGUREARGS .= " --enable-jit";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000212}
213
Reid Spencer558269c2006-08-13 09:53:02 +0000214if (@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 Jenkins0f3e0b02006-07-27 01:03:46 +0000219}
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000220
221if (@ARGV == 3) {
Reid Spencer558269c2006-08-13 09:53:02 +0000222 $CVSRootDir = $ARGV[0];
223 $BuildDir = $ARGV[1];
224 $WebDir = $ARGV[2];
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000225}
226
Reid Spencer558269c2006-08-13 09:53:02 +0000227if ($CVSRootDir eq "" or
228 $BuildDir eq "" or
229 $WebDir eq "") {
230 die("please specify a cvs root directory, a build directory, and a ".
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000231 "web directory");
232 }
Misha Brukmancc211512009-01-02 16:28:18 +0000233
Reid Spencer558269c2006-08-13 09:53:02 +0000234if ($nickname eq "") {
Misha Brukmancc211512009-01-02 16:28:18 +0000235 die ("Please invoke NewNightlyTest.pl with command line option " .
Reid Spencer558269c2006-08-13 09:53:02 +0000236 "\"-nickname <nickname>\"");
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000237}
Patrick Jenkins10d0e342006-07-27 01:17:17 +0000238
Jim Laskey68722b72006-09-28 17:49:20 +0000239if ($BUILDTYPE ne "release" && $BUILDTYPE ne "release-asserts") {
Reid Spencer558269c2006-08-13 09:53:02 +0000240 $BUILDTYPE = "debug";
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000241}
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000242
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000243##############################################################
244#
245#define the file names we'll use
246#
247##############################################################
248my $Prefix = "$WebDir/$DATE";
249my $BuildLog = "$Prefix-Build-Log.txt";
Reid Spencer203524f2007-04-07 04:41:16 +0000250my $COLog = "$Prefix-CVS-Log.txt";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000251my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
252my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000253my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000254my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
255my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
256my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
257if (! -d $WebDir) {
Reid Spencer558269c2006-08-13 09:53:02 +0000258 mkdir $WebDir, 0777;
Patrick Jenkins235abe42006-08-21 20:45:57 +0000259 if($VERBOSE){
260 warn "$WebDir did not exist; creating it.\n";
261 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000262}
263
264if ($VERBOSE) {
Reid Spencer558269c2006-08-13 09:53:02 +0000265 print "INITIALIZED\n";
Reid Spencer203524f2007-04-07 04:41:16 +0000266 if ($USESVN) {
267 print "SVN URL = $SVNURL\n";
268 } else {
269 print "CVS Root = $CVSRootDir\n";
270 }
271 print "COLog = $COLog\n";
Reid Spencer558269c2006-08-13 09:53:02 +0000272 print "BuildDir = $BuildDir\n";
273 print "WebDir = $WebDir\n";
274 print "Prefix = $Prefix\n";
Reid Spencer558269c2006-08-13 09:53:02 +0000275 print "BuildLog = $BuildLog\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000276}
277
278##############################################################
279#
280# Helper functions
281#
282##############################################################
283sub GetDir {
Reid Spencer558269c2006-08-13 09:53:02 +0000284 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 Jenkins0e316b42006-07-06 21:19:32 +0000289}
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#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
298sub DiffFiles {
Reid Spencer558269c2006-08-13 09:53:02 +0000299 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 Jenkins0e316b42006-07-06 21:19:32 +0000311}
312
313#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
315sub GetRegex { # (Regex with ()'s, value)
Reid Spencer558269c2006-08-13 09:53:02 +0000316 $_[1] =~ /$_[0]/m;
Misha Brukmancc211512009-01-02 16:28:18 +0000317 return $1
Reid Spencer558269c2006-08-13 09:53:02 +0000318 if (defined($1));
319 return "0";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000320}
321
322#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
323#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
324sub GetRegexNum {
Reid Spencer558269c2006-08-13 09:53:02 +0000325 my ($Regex, $Num, $Regex2, $File) = @_;
326 my @Items = split "\n", `grep '$Regex' $File`;
327 return GetRegex $Regex2, $Items[$Num];
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000328}
329
330#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
332sub ChangeDir { # directory, logical name
Reid Spencer558269c2006-08-13 09:53:02 +0000333 my ($dir,$name) = @_;
334 chomp($dir);
335 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
336 $result = chdir($dir);
337 if (!$result) {
Misha Brukmancc211512009-01-02 16:28:18 +0000338 print "ERROR!!! Cannot change directory to: $name ($dir) because $!";
Reid Spencer558269c2006-08-13 09:53:02 +0000339 return false;
340 }
341 return true;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000342}
343
344#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
345#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
346sub ReadFile {
Reid Spencer558269c2006-08-13 09:53:02 +0000347 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 Jenkins0e316b42006-07-06 21:19:32 +0000357}
358
359#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
360#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
361sub WriteFile { # (filename, contents)
Reid Spencer558269c2006-08-13 09:53:02 +0000362 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n";
363 print FILE $_[1];
364 close FILE;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000365}
366
367#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
368#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
369sub CopyFile { #filename, newfile
Reid Spencer558269c2006-08-13 09:53:02 +0000370 my ($file, $newfile) = @_;
371 chomp($file);
372 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
373 copy($file, $newfile);
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000374}
375
376#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
377#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
378sub AddRecord {
Reid Spencer558269c2006-08-13 09:53:02 +0000379 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 Jenkins0e316b42006-07-06 21:19:32 +0000387}
388
389#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
390#
391# FormatTime - Convert a time from 1m23.45 into 83.45
392#
393#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
394sub FormatTime {
Reid Spencer558269c2006-08-13 09:53:02 +0000395 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 Jenkins0e316b42006-07-06 21:19:32 +0000400}
401
402#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patrick Jenkinsdeb77ee2006-08-18 18:00:21 +0000403#
Misha Brukmancc211512009-01-02 16:28:18 +0000404# This function is meant to read in the dejagnu sum file and
Patrick Jenkinsdeb77ee2006-08-18 18:00:21 +0000405# return a string with only the results (i.e. PASS/FAIL/XPASS/
406# XFAIL).
407#
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000408#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
409sub GetDejagnuTestResults { # (filename, log)
Patrick Jenkinsdeb77ee2006-08-18 18:00:21 +0000410 my ($filename, $DejagnuLog) = @_;
411 my @lines;
412 $/ = "\n"; #Make sure we're going line at a time.
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000413
Patrick Jenkinsdeb77ee2006-08-18 18:00:21 +0000414 if( $VERBOSE) { print "DEJAGNU TEST RESULTS:\n"; }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000415
Patrick Jenkinsdeb77ee2006-08-18 18:00:21 +0000416 if (open SRCHFILE, $filename) {
417 # Process test results
418 while ( <SRCHFILE> ) {
419 if ( length($_) > 1 ) {
420 chomp($_);
Jim Laskeyfbeab722006-09-20 09:20:22 +0000421 if ( m/^(PASS|XPASS|FAIL|XFAIL): .*\/llvm\/test\/(.*)$/ ) {
422 push(@lines, "$1: test/$2");
Reid Spencer558269c2006-08-13 09:53:02 +0000423 }
Reid Spencer558269c2006-08-13 09:53:02 +0000424 }
Reid Spencer558269c2006-08-13 09:53:02 +0000425 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000426 }
Patrick Jenkinsdeb77ee2006-08-18 18:00:21 +0000427 close SRCHFILE;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000428
Patrick Jenkinsdeb77ee2006-08-18 18:00:21 +0000429 my $content = join("\n", @lines);
430 return $content;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000431}
432
433
Patrick Jenkinsdeb77ee2006-08-18 18:00:21 +0000434
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000435#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
436#
437# This function acts as a mini web browswer submitting data
438# to our central server via the post method
439#
440#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
441sub SendData{
442 $host = $_[0];
443 $file = $_[1];
444 $variables=$_[2];
445
Daniel Dunbare6986d82009-05-28 18:31:40 +0000446 # Write out the "...-sentdata.txt" file.
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000447
Daniel Dunbare6986d82009-05-28 18:31:40 +0000448 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 Jenkins0e316b42006-07-06 21:19:32 +0000461 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 Dunbare6986d82009-05-28 18:31:40 +0000468 # 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 Jenkins0e316b42006-07-06 21:19:32 +0000479 $length = length($content);
480
481 my $send= "POST $file HTTP/1.0\n";
Lauro Ramos Venancio0974db92007-05-03 14:05:07 +0000482 $send.= "Host: $host\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000483 $send.= "Content-Type: application/x-www-form-urlencoded\n";
484 $send.= "Content-length: $length\n\n";
485 $send.= "$content";
486
Patrick Jenkins814928f2006-08-07 01:54:37 +0000487 print SOCK $send;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000488 my $result;
489 while(<SOCK>){
490 $result .= $_;
491 }
492 close(SOCK);
493
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000494 return $result;
495}
496
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000497##############################################################
498#
499# Getting Start timestamp
500#
501##############################################################
Patrick Jenkins7ef934f2006-07-21 21:43:09 +0000502$starttime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000503
504##############################################################
505#
506# Create the CVS repository directory
507#
508##############################################################
509if (!$NOCHECKOUT) {
Reid Spencer558269c2006-08-13 09:53:02 +0000510 if (-d $BuildDir) {
511 if (!$NOREMOVE) {
512 if ( $VERBOSE ) {
513 print "Build directory exists! Removing it\n";
514 }
515 system "rm -rf $BuildDir";
Reid Spencer203524f2007-04-07 04:41:16 +0000516 mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
Reid Spencer558269c2006-08-13 09:53:02 +0000517 } else {
Jim Laskeyee7929d2006-09-15 17:03:36 +0000518 if ( $VERBOSE ) {
519 print "Build directory exists!\n";
520 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000521 }
Jim Laskeyee7929d2006-09-15 17:03:36 +0000522 } else {
Reid Spencer203524f2007-04-07 04:41:16 +0000523 mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
Reid Spencer558269c2006-08-13 09:53:02 +0000524 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000525}
Reid Spencer203524f2007-04-07 04:41:16 +0000526ChangeDir( $BuildDir, "checkout directory" );
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000527
528
529##############################################################
530#
Misha Brukmancc211512009-01-02 16:28:18 +0000531# Check out the llvm tree, using either SVN or CVS
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000532#
533##############################################################
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000534if (!$NOCHECKOUT) {
Reid Spencer4bc33762007-07-02 06:16:32 +0000535 if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; }
Reid Spencer203524f2007-04-07 04:41:16 +0000536 if ($USESVN) {
537 my $SVNCMD = "$NICE svn co $SVNURL";
538 if ($VERBOSE) {
Reid Spencer943cc0c2007-06-29 03:12:42 +0000539 print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " .
540 "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n";
Reid Spencer203524f2007-04-07 04:41:16 +0000541 }
Reid Spencer4bc33762007-07-02 06:16:32 +0000542 system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " .
543 "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n";
Reid Spencer203524f2007-04-07 04:41:16 +0000544 } 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 Spencer4bc33762007-07-02 06:16:32 +0000549 if ($VERBOSE) {
550 print "( time -p $CVSCMD llvm; cd llvm/projects ; " .
551 "$CVSCMD llvm-test ) > $COLog 2>&1\n";
552 }
Reid Spencer203524f2007-04-07 04:41:16 +0000553 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
Reid Spencerbeeeeb12007-04-07 05:20:07 +0000554 "$CVSCMD llvm-test ) > $COLog 2>&1\n";
Reid Spencer203524f2007-04-07 04:41:16 +0000555 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000556}
Reid Spencer203524f2007-04-07 04:41:16 +0000557ChangeDir( $BuildDir , "Checkout directory") ;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000558ChangeDir( "llvm" , "llvm source directory") ;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000559
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 Spencer203524f2007-04-07 04:41:16 +0000567my $CheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $COLog`;
568my $CheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $COLog`;
569my $CheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $COLog`;
570my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000571
Reid Spencer203524f2007-04-07 04:41:16 +0000572my $NumFilesInCVS = 0;
573my $NumDirsInCVS = 0;
574if ($USESVN) {
575 $NumFilesInCVS = `egrep '^A' $COLog | wc -l` + 0;
Nick Lewycky0702adc2008-06-05 12:54:44 +0000576 $NumDirsInCVS = `sed -e 's#/[^/]*\$##' $COLog | sort | uniq | wc -l` + 0;
Reid Spencer203524f2007-04-07 04:41:16 +0000577} else {
578 $NumFilesInCVS = `egrep '^U' $COLog | wc -l` + 0;
579 $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $COLog | wc -l` + 0;
580}
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000581
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 Spencer558269c2006-08-13 09:53:02 +0000586# of cvs activity and parses it.
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000587#
588##############################################################
589
Reid Spencer203524f2007-04-07 04:41:16 +0000590# 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.
593sub 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 Jenkins0e316b42006-07-06 21:19:32 +0000608my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
609
Reid Spencer203524f2007-04-07 04:41:16 +0000610if (!$NOCVSSTATS) {
611 if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; }
Reid Spencer12e28432007-04-04 06:59:36 +0000612
Reid Spencer203524f2007-04-07 04:41:16 +0000613 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 Jenkins0e316b42006-07-06 21:19:32 +0000659#print join "\n", @CVSHistory; print "\n";
660
Reid Spencer203524f2007-04-07 04:41:16 +0000661 my $DateRE = '[-/:0-9 ]+\+[0-9]+';
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000662
663# Loop over every record from the CVS history, filling in the hashes.
Reid Spencer203524f2007-04-07 04:41:16 +0000664 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 Brukmancc211512009-01-02 16:28:18 +0000677
Reid Spencer203524f2007-04-07 04:41:16 +0000678 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 Jenkins0e316b42006-07-06 21:19:32 +0000693
Reid Spencer203524f2007-04-07 04:41:16 +0000694 my $TestError = 1;
695 } #$USESVN
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000696}#!NOCVSSTATS
697
698my $CVSAddedFiles = join "\n", sort keys %AddedFiles;
699my $CVSModifiedFiles = join "\n", sort keys %ModifiedFiles;
700my $CVSRemovedFiles = join "\n", sort keys %RemovedFiles;
701my $UserCommitList = join "\n", sort keys %UsersCommitted;
702my $UserUpdateList = join "\n", sort keys %UsersUpdated;
703
704##############################################################
705#
706# Build the entire tree, saving build messages to the build log
707#
708##############################################################
709if (!$NOCHECKOUT && !$NOBUILD) {
Reid Spencer558269c2006-08-13 09:53:02 +0000710 my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
711 if ( $VERBOSE ) {
712 print "CONFIGURE STAGE:\n";
Misha Brukmancc211512009-01-02 16:28:18 +0000713 print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) " .
Reid Spencer558269c2006-08-13 09:53:02 +0000714 "> $BuildLog 2>&1\n";
715 }
Misha Brukmancc211512009-01-02 16:28:18 +0000716 system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) " .
Reid Spencer558269c2006-08-13 09:53:02 +0000717 "> $BuildLog 2>&1";
Misha Brukmancc211512009-01-02 16:28:18 +0000718 if ( $VERBOSE ) {
Reid Spencer558269c2006-08-13 09:53:02 +0000719 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 Jenkins0e316b42006-07-06 21:19:32 +0000724}
725
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000726##############################################################
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 Spencer558269c2006-08-13 09:53:02 +0000737# 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 Jenkins2bc19342006-08-16 22:18:41 +0000739my $LOC = `utils/countloc.sh -topdir $BuildDir/llvm`;
Reid Spencer558269c2006-08-13 09:53:02 +0000740
741# Get the time taken by the configure script
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000742my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
743my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
744my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
745my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
746
747$ConfigTime=-1 unless $ConfigTime;
748$ConfigWallTime=-1 unless $ConfigWallTime;
749
750my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
751my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
752my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
753my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
754
755$BuildTime=-1 unless $BuildTime;
756$BuildWallTime=-1 unless $BuildWallTime;
757
758my $BuildError = 0, $BuildStatus = "OK";
Reid Spencer558269c2006-08-13 09:53:02 +0000759if ($NOBUILD) {
760 $BuildStatus = "Skipped by user";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000761}
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000762elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
Reid Spencer558269c2006-08-13 09:53:02 +0000763 `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 Jenkins0e316b42006-07-06 21:19:32 +0000767}
768if ($BuildError) { $NODEJAGNU=1; }
769
Patrick Jenkins1049f402006-07-23 21:38:07 +0000770my $a_file_sizes="";
771my $o_file_sizes="";
Reid Spencer558269c2006-08-13 09:53:02 +0000772if (!$BuildError) {
Misha Brukmancc211512009-01-02 16:28:18 +0000773 print "Organizing size of .o and .a files\n"
Reid Spencer558269c2006-08-13 09:53:02 +0000774 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 Laskey05a19472006-09-29 17:31:45 +0000780 $afiles.= `find Release/ -iname '*.a' -ls`;
Jim Laskey68722b72006-09-28 17:49:20 +0000781 } elsif($BUILDTYPE eq "release-asserts") {
782 $afiles.= `find Release-Asserts/ -iname '*.a' -ls`;
Reid Spencer558269c2006-08-13 09:53:02 +0000783 } else {
784 $afiles.= `find Debug/ -iname '*.a' -ls`;
785 }
Misha Brukmancc211512009-01-02 16:28:18 +0000786
Reid Spencer558269c2006-08-13 09:53:02 +0000787 $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 Laskey05a19472006-09-29 17:31:45 +0000791 $ofiles.= `find Release/ -iname '*.o' -ls`;
Jim Laskey68722b72006-09-28 17:49:20 +0000792 } elsif($BUILDTYPE eq "release-asserts") {
793 $ofiles.= `find Release-Asserts/ -iname '*.o' -ls`;
Reid Spencer558269c2006-08-13 09:53:02 +0000794 } else {
795 $ofiles.= `find Debug/ -iname '*.o' -ls`;
796 }
Misha Brukmancc211512009-01-02 16:28:18 +0000797
Reid Spencer558269c2006-08-13 09:53:02 +0000798 @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 Jenkins1049f402006-07-23 21:38:07 +0000813}
Patrick Jenkins1049f402006-07-23 21:38:07 +0000814
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000815##############################################################
816#
817# Running dejagnu tests
818#
819##############################################################
Patrick Jenkinsdeb77ee2006-08-18 18:00:21 +0000820my $DejangnuTestResults=""; # String containing the results of the dejagnu
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000821my $dejagnu_output = "$DejagnuTestsLog";
Reid Spencer558269c2006-08-13 09:53:02 +0000822if (!$NODEJAGNU) {
Misha Brukmancc211512009-01-02 16:28:18 +0000823 if($VERBOSE) {
824 print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n";
Reid Spencer558269c2006-08-13 09:53:02 +0000825 print "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1\n";
826 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000827
Reid Spencer558269c2006-08-13 09:53:02 +0000828 #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 Brukmancc211512009-01-02 16:28:18 +0000831
Reid Spencer558269c2006-08-13 09:53:02 +0000832 #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 Jenkins0e316b42006-07-06 21:19:32 +0000838}
Reid Spencer558269c2006-08-13 09:53:02 +0000839
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000840#Extract time of dejagnu tests
841my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
842my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
843$DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
Misha Brukmancc211512009-01-02 16:28:18 +0000844$DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
845$DejagnuTestResults =
Reid Spencer558269c2006-08-13 09:53:02 +0000846 "Dejagnu skipped by user choice." unless $DejagnuTestResults;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000847$DejagnuTime = "0.0" unless $DejagnuTime;
848$DejagnuWallTime = "0.0" unless $DejagnuWallTime;
849
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000850##############################################################
851#
852# Get warnings from the build
853#
854##############################################################
Reid Spencer558269c2006-08-13 09:53:02 +0000855if (!$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 Jenkins0e316b42006-07-06 21:19:32 +0000860
Reid Spencer558269c2006-08-13 09:53:02 +0000861 foreach $Warning (@Warn) {
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000862 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
Reid Spencer558269c2006-08-13 09:53:02 +0000863 $CurDir = $1; # Keep track of directory warning is in...
864 # Remove buildir prefix if included
865 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { $CurDir = $1; }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000866 } else {
Reid Spencer558269c2006-08-13 09:53:02 +0000867 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000868 }
Reid Spencer558269c2006-08-13 09:53:02 +0000869 }
870 my $WarningsFile = join "\n", @Warnings;
871 $WarningsFile =~ s/:[0-9]+:/::/g;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000872
Reid Spencer558269c2006-08-13 09:53:02 +0000873 # Emit the warnings file, so we can diff...
874 WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
875 my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000876
Reid Spencer558269c2006-08-13 09:53:02 +0000877 # 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 Jenkins0e316b42006-07-06 21:19:32 +0000880
Reid Spencer558269c2006-08-13 09:53:02 +0000881 #my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade
882 #my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000883
884} #endif !NODEGAGNU
885
886##############################################################
887#
888# If we built the tree successfully, run the nightly programs tests...
889#
Misha Brukmancc211512009-01-02 16:28:18 +0000890# A set of tests to run is passed in (i.e. "SingleSource" "MultiSource"
Reid Spencer558269c2006-08-13 09:53:02 +0000891# "External")
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000892#
893##############################################################
894sub TestDirectory {
Misha Brukmancc211512009-01-02 16:28:18 +0000895 my $SubDir = shift;
896 ChangeDir( "$BuildDir/llvm/projects/llvm-test/$SubDir",
Reid Spencer558269c2006-08-13 09:53:02 +0000897 "Programs Test Subdirectory" ) || return ("", "");
Misha Brukmancc211512009-01-02 16:28:18 +0000898
Reid Spencer558269c2006-08-13 09:53:02 +0000899 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
Misha Brukmancc211512009-01-02 16:28:18 +0000900
Reid Spencer558269c2006-08-13 09:53:02 +0000901 # Run the programs tests... creating a report.nightly.csv file
902 if (!$NOTEST) {
Misha Brukmancc211512009-01-02 16:28:18 +0000903 if( $VERBOSE) {
Reid Spencer558269c2006-08-13 09:53:02 +0000904 print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
Misha Brukmancc211512009-01-02 16:28:18 +0000905 "TEST=nightly > $ProgramTestLog 2>&1\n";
Reid Spencer558269c2006-08-13 09:53:02 +0000906 }
907 system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
Patrick Jenkins40cc1922006-07-27 18:28:50 +0000908 "TEST=nightly > $ProgramTestLog 2>&1";
Reid Spencer558269c2006-08-13 09:53:02 +0000909 $llcbeta_options=`$MAKECMD print-llcbeta-option`;
Misha Brukmancc211512009-01-02 16:28:18 +0000910 }
Reid Spencer558269c2006-08-13 09:53:02 +0000911
Patrick Jenkins40cc1922006-07-27 18:28:50 +0000912 my $ProgramsTable;
Reid Spencer558269c2006-08-13 09:53:02 +0000913 if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) {
Patrick Jenkins40cc1922006-07-27 18:28:50 +0000914 $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 Spencer558269c2006-08-13 09:53:02 +0000923 #
924 # Create a list of the tests which were run...
925 #
926 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
Patrick Jenkinsd5150162006-08-17 22:11:03 +0000927 "| sort > $Prefix-$SubDir-Tests.txt";
Patrick Jenkins40cc1922006-07-27 18:28:50 +0000928 }
929 $ProgramsTable = ReadFile "report.nightly.csv";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000930
Patrick Jenkins40cc1922006-07-27 18:28:50 +0000931 ChangeDir( "../../..", "Programs Test Parent Directory" );
932 return ($ProgramsTable, $llcbeta_options);
Patrick Jenkinsd531b502006-08-14 16:07:14 +0000933} #end sub TestDirectory
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000934
Patrick Jenkinsd5150162006-08-17 22:11:03 +0000935##############################################################
936#
937# Calling sub TestDirectory
938#
939##############################################################
Patrick Jenkins80ae7ab2006-07-27 19:00:01 +0000940if (!$BuildError) {
Reid Spencer558269c2006-08-13 09:53:02 +0000941 if ( $VERBOSE ) {
Patrick Jenkins681f7f82006-08-04 17:55:01 +0000942 print "SingleSource TEST STAGE\n";
Reid Spencer558269c2006-08-13 09:53:02 +0000943 }
Misha Brukmancc211512009-01-02 16:28:18 +0000944 ($SingleSourceProgramsTable, $llcbeta_options) =
Reid Spencer558269c2006-08-13 09:53:02 +0000945 TestDirectory("SingleSource");
Patrick Jenkinsd5150162006-08-17 22:11:03 +0000946 WriteFile "$Prefix-SingleSource-Performance.txt", $SingleSourceProgramsTable;
Patrick Jenkinsda2ace72006-08-08 02:03:53 +0000947 if ( $VERBOSE ) {
Patrick Jenkinsd5150162006-08-17 22:11:03 +0000948 print "MultiSource TEST STAGE\n";
Reid Spencer558269c2006-08-13 09:53:02 +0000949 }
950 ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource");
Patrick Jenkinsd5150162006-08-17 22:11:03 +0000951 WriteFile "$Prefix-MultiSource-Performance.txt", $MultiSourceProgramsTable;
Reid Spencer558269c2006-08-13 09:53:02 +0000952 if ( ! $NOEXTERNALS ) {
953 if ( $VERBOSE ) {
954 print "External TEST STAGE\n";
955 }
956 ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External");
Patrick Jenkinsd5150162006-08-17 22:11:03 +0000957 WriteFile "$Prefix-External-Performance.txt", $ExternalProgramsTable;
Misha Brukmancc211512009-01-02 16:28:18 +0000958 system "cat $Prefix-SingleSource-Tests.txt " .
Patrick Jenkinsd5150162006-08-17 22:11:03 +0000959 "$Prefix-MultiSource-Tests.txt ".
960 "$Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
Misha Brukmancc211512009-01-02 16:28:18 +0000961 system "cat $Prefix-SingleSource-Performance.txt " .
Patrick Jenkinsd5150162006-08-17 22:11:03 +0000962 "$Prefix-MultiSource-Performance.txt ".
963 "$Prefix-External-Performance.txt | sort > $Prefix-Performance.txt";
Reid Spencer558269c2006-08-13 09:53:02 +0000964 } else {
965 $ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
966 if ( $VERBOSE ) {
967 print "External TEST STAGE SKIPPED\n";
968 }
Misha Brukmancc211512009-01-02 16:28:18 +0000969 system "cat $Prefix-SingleSource-Tests.txt " .
Patrick Jenkinsd5150162006-08-17 22:11:03 +0000970 "$Prefix-MultiSource-Tests.txt ".
Reid Spencer558269c2006-08-13 09:53:02 +0000971 " | sort > $Prefix-Tests.txt";
Misha Brukmancc211512009-01-02 16:28:18 +0000972 system "cat $Prefix-SingleSource-Performance.txt " .
Patrick Jenkinsd5150162006-08-17 22:11:03 +0000973 "$Prefix-MultiSource-Performance.txt ".
974 " | sort > $Prefix-Performance.txt";
Reid Spencer558269c2006-08-13 09:53:02 +0000975 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000976
Patrick Jenkins06725192006-08-22 18:11:19 +0000977 ##############################################################
978 #
Misha Brukmancc211512009-01-02 16:28:18 +0000979 #
980 # gathering tests added removed broken information here
Patrick Jenkins06725192006-08-22 18:11:19 +0000981 #
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 Jenkins0e316b42006-07-06 21:19:32 +0000987
Patrick Jenkins06725192006-08-22 18:11:19 +0000988 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 Spencer558269c2006-08-13 09:53:02 +0000999 }
1000 }
Misha Brukmancc211512009-01-02 16:28:18 +00001001
Patrick Jenkins06725192006-08-22 18:11:19 +00001002} #end if !$BuildError
1003
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +00001004##############################################################
1005#
1006# Getting end timestamp
1007#
1008##############################################################
Patrick Jenkins7ef934f2006-07-21 21:43:09 +00001009$endtime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +00001010
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001011
1012##############################################################
1013#
1014# Place all the logs neatly into one humungous file
1015#
1016##############################################################
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001017if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
1018
Misha Brukmancc211512009-01-02 16:28:18 +00001019$machine_data = "uname: ".`uname -a`.
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001020 "hardware: ".`uname -m`.
1021 "os: ".`uname -sr`.
1022 "name: ".`uname -n`.
1023 "date: ".`date \"+20%y-%m-%d\"`.
Misha Brukmancc211512009-01-02 16:28:18 +00001024 "time: ".`date +\"%H:%M:%S\"`;
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001025
1026my @CVS_DATA;
1027my $cvs_data;
Reid Spencer203524f2007-04-07 04:41:16 +00001028@CVS_DATA = ReadFile "$COLog";
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001029$cvs_data = join("\n", @CVS_DATA);
1030
1031my @BUILD_DATA;
1032my $build_data;
1033@BUILD_DATA = ReadFile "$BuildLog";
1034$build_data = join("\n", @BUILD_DATA);
1035
Patrick Jenkins235abe42006-08-21 20:45:57 +00001036my (@DEJAGNU_LOG, @DEJAGNU_SUM, @DEJAGNULOG_FULL, @GCC_VERSION);
1037my ($dejagnutests_log ,$dejagnutests_sum, $dejagnulog_full) = "";
1038my ($gcc_version, $gcc_version_long) = "";
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001039
Patrick Jenkins06725192006-08-22 18:11:19 +00001040$gcc_version_long="";
1041if ($GCCPATH ne "") {
1042 $gcc_version_long = `$GCCPATH/gcc --version`;
Jeff Cohenba1c0cd2007-04-10 19:13:43 +00001043} elsif ($ENV{"CC"}) {
1044 $gcc_version_long = `$ENV{"CC"} --version`;
Patrick Jenkins06725192006-08-22 18:11:19 +00001045} else {
1046 $gcc_version_long = `gcc --version`;
1047}
1048@GCC_VERSION = split '\n', $gcc_version_long;
1049$gcc_version = $GCC_VERSION[0];
1050
Tanya Lattnerc821a9a2007-04-13 04:36:48 +00001051$llvmgcc_version_long="";
1052if ($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 Jenkins235abe42006-08-21 20:45:57 +00001062if(!$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 Jenkins0e316b42006-07-06 21:19:32 +00001067
Patrick Jenkins235abe42006-08-21 20:45:57 +00001068 @DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog";
1069 $dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
Patrick Jenkins9536ec72006-07-14 20:44:09 +00001070}
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001071
1072##############################################################
1073#
1074# Send data via a post request
1075#
1076##############################################################
1077
1078if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
1079
Reid Spencer558269c2006-08-13 09:53:02 +00001080my %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 Spencer203524f2007-04-07 04:41:16 +00001087 'cvscheckouttime_wall' => $CheckoutTime_Wall,
1088 'cvscheckouttime_cpu' => $CheckoutTime_CPU,
Reid Spencer558269c2006-08-13 09:53:02 +00001089 '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 Jenkinsdeb77ee2006-08-18 18:00:21 +00001115 'dejagnutests_results' => $DejagnuTestResults,
1116 'dejagnutests_log' => $dejagnulog_full,
Reid Spencer558269c2006-08-13 09:53:02 +00001117 'starttime' => $starttime,
1118 'endtime' => $endtime,
1119 'o_file_sizes' => $o_file_sizes,
Tanya Lattnerc821a9a2007-04-13 04:36:48 +00001120 'a_file_sizes' => $a_file_sizes,
1121 'target_triple' => $targetTriple
Reid Spencer558269c2006-08-13 09:53:02 +00001122);
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001123
Tanya Lattnerf7c52a12008-03-10 07:28:08 +00001124if ($SUBMIT) {
1125 my $response = SendData $SUBMITSERVER,$SUBMITSCRIPT,\%hash_of_data;
1126 if( $VERBOSE) { print "============================\n$response"; }
1127} else {
Reid Spencer558269c2006-08-13 09:53:02 +00001128 print "============================\n";
1129 foreach $x(keys %hash_of_data){
1130 print "$x => $hash_of_data{$x}\n";
1131 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001132}
1133
1134##############################################################
1135#
1136# Remove the cvs tree...
1137#
1138##############################################################
Misha Brukmancc211512009-01-02 16:28:18 +00001139system ( "$NICE rm -rf $BuildDir")
Reid Spencer558269c2006-08-13 09:53:02 +00001140 if (!$NOCHECKOUT and !$NOREMOVE);
Misha Brukmancc211512009-01-02 16:28:18 +00001141system ( "$NICE rm -rf $WebDir")
Reid Spencer558269c2006-08-13 09:53:02 +00001142 if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);