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