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