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