blob: 1beca6ded7befbf3517d94c7cd7de234bb0b6e12 [file] [log] [blame]
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001#!/usr/bin/perl
Patrick Jenkins0e316b42006-07-06 21:19:32 +00002use POSIX qw(strftime);
3use File::Copy;
4use Socket;
5
6#
7# Program: NewNightlyTest.pl
8#
9# Synopsis: Perform a series of tests which are designed to be run nightly.
10# This is used to keep track of the status of the LLVM tree, tracking
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.
Patrick Jenkins5053e152006-07-07 17:31:38 +000022# -noremoveresults Do not remove the WEBDIR after it has been built.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000023# -nobuild Do not build llvm. If tests are enabled perform them
24# on the llvm build specified in the build directory
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.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000029# -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# -enable-llcbeta Enable testing of beta features in llc.
33# -disable-llc Disable LLC tests in the nightly tester.
34# -disable-jit Disable JIT tests in the nightly tester.
35# -disable-cbe Disable C backend tests in the nightly tester.
36# -verbose Turn on some debug output
37# -debug Print information useful only to maintainers of this script.
38# -nice Checkout/Configure/Build with "nice" to reduce impact
39# on busy servers.
40# -f2c Next argument specifies path to F2C utility
41# -nickname The next argument specifieds the nickname this script
42# will submit to the nightlytest results repository.
43# -gccpath Path to gcc/g++ used to build LLVM
44# -cvstag Check out a specific CVS tag to build LLVM (useful for
45# testing release branches)
46# -target Specify the target triplet
47# -cflags Next argument specifies that C compilation options that
48# override the default.
49# -cxxflags Next argument specifies that C++ compilation options that
50# override the default.
51# -ldflags Next argument specifies that linker options that override
52# the default.
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +000053# -compileflags Next argument specifies extra options passed to make when
54# building LLVM.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000055#
56# ---------------- Options to configure llvm-test ----------------------------
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +000057# -extraflags Next argument specifies extra options that are passed to
58# compile the tests.
59# -noexternals Do not run the external tests (for cases where povray
60# or SPEC are not installed)
61# -with-externals Specify a directory where the external tests are located.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000062#
63# CVSROOT is the CVS repository from which the tree will be checked out,
64# specified either in the full :method:user@host:/dir syntax, or
65# just /dir if using a local repo.
66# BUILDDIR is the directory where sources for this test run will be checked out
67# AND objects for this test run will be built. This directory MUST NOT
68# exist before the script is run; it will be created by the cvs checkout
69# process and erased (unless -noremove is specified; see above.)
70# WEBDIR is the directory into which the test results web page will be written,
71# AND in which the "index.html" is assumed to be a symlink to the most recent
72# copy of the results. This directory will be created if it does not exist.
73# LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
74# to. This is the same as you would have for a normal LLVM build.
75#
76##############################################################
77#
78# Getting environment variables
79#
80##############################################################
81my $HOME = $ENV{'HOME'};
82my $CVSRootDir = $ENV{'CVSROOT'};
83 $CVSRootDir = "/home/vadve/shared/PublicCVS"
84 unless $CVSRootDir;
85my $BuildDir = $ENV{'BUILDDIR'};
86 $BuildDir = "$HOME/buildtest"
87 unless $BuildDir;
88my $WebDir = $ENV{'WEBDIR'};
89 $WebDir = "$HOME/cvs/testresults-X86"
90 unless $WebDir;
91
92##############################################################
93#
94# Calculate the date prefix...
95#
96##############################################################
97@TIME = localtime;
98my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
99my $DateString = strftime "%B %d, %Y", localtime;
100my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
101
102##############################################################
103#
104# Parse arguments...
105#
106##############################################################
107$CONFIGUREARGS="";
Patrick Jenkinsa95958c2006-07-21 01:39:42 +0000108$nickname="";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000109$NOTEST=0;
110$NORUNNINGTESTS=0;
111
112while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
113 shift;
114 last if /^--$/; # Stop processing arguments on --
115
116 # List command line options here...
117 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
118 if (/^-nocvsstats$/) { $NOCVSSTATS = 1; next; }
119 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Patrick Jenkins5053e152006-07-07 17:31:38 +0000120 if (/^-noremoveresults$/) { $NOREMOVERESULTS = 1; next; }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000121 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
122 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
123 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000124 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000125 "OPTIMIZE_OPTION=-O2";
126 $BUILDTYPE="release"; next; }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000127 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
128 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
129 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
130 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
131 $CONFIGUREARGS .= " --disable-jit"; next; }
132 if (/^-verbose$/) { $VERBOSE = 1; next; }
133 if (/^-debug$/) { $DEBUG = 1; next; }
134 if (/^-nice$/) { $NICE = "nice "; next; }
135 if (/^-f2c$/) {
136 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
137 }
138 if (/^-with-externals/) {
139 $CONFIGUREARGS .= "--with-externals=$ARGV[0]"; shift; next;
140 }
141 if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; }
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000142 if (/^-gccpath/) { $CONFIGUREARGS .=
143 " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++";
Patrick Jenkins9536ec72006-07-14 20:44:09 +0000144 $GCCPATH=$ARGV[0];
145 shift;
146 next;}
Patrick Jenkinsbe254602006-07-18 17:21:30 +0000147 else{ $GCCPATH=""; }
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000148 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
149 else{ $CVSCOOPT="";}
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000150 if (/^-target/) {
151 $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next;
152 }
153 if (/^-cflags/) {
154 $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; shift; next;
155 }
156 if (/^-cxxflags/) {
157 $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; shift; next;
158 }
159 if (/^-ldflags/) {
160 $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; shift; next;
161 }
162 if (/^-compileflags/) {
163 $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next;
164 }
165 if (/^-extraflags/) {
166 $PROGTESTOPTS .= " EXTRA_FLAGS=\'$ARGV[0]\'"; shift; next;
167 }
168 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
169 if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
170 if (/^-nobuild$/) { $NOBUILD = 1; next; }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000171 print "Unknown option: $_ : ignoring!\n";
172}
173
174if ($ENV{'LLVMGCCDIR'}) {
175 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
176}
177if ($CONFIGUREARGS !~ /--disable-jit/) {
178 $CONFIGUREARGS .= " --enable-jit";
179}
180
181die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
182
183if (@ARGV == 3) {
184 $CVSRootDir = $ARGV[0];
185 $BuildDir = $ARGV[1];
186 $WebDir = $ARGV[2];
187}
188
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000189if($nickname eq ""){
190 die ("Please invoke NewNightlyTest.pl with command line option \"-nickname <nickname>\"");
191}
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000192if($BUILDTYPE ne "releaese"){
193 $BUILDTYPE = "debug";
194}
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000195
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000196##############################################################
197#
198#define the file names we'll use
199#
200##############################################################
201my $Prefix = "$WebDir/$DATE";
202my $BuildLog = "$Prefix-Build-Log.txt";
203my $CVSLog = "$Prefix-CVS-Log.txt";
204my $OldenTestsLog = "$Prefix-Olden-tests.txt";
205my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
206my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000207my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000208my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
209my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
210my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
211if (! -d $WebDir) {
212 mkdir $WebDir, 0777;
213 warn "$WebDir did not exist; creating it.\n";
214}
215
216if ($VERBOSE) {
217 print "INITIALIZED\n";
218 print "CVS Root = $CVSRootDir\n";
219 print "BuildDir = $BuildDir\n";
220 print "WebDir = $WebDir\n";
221 print "Prefix = $Prefix\n";
222 print "CVSLog = $CVSLog\n";
223 print "BuildLog = $BuildLog\n";
224}
225
226##############################################################
227#
228# Helper functions
229#
230##############################################################
231sub GetDir {
232 my $Suffix = shift;
233 opendir DH, $WebDir;
234 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
235 closedir DH;
236 return @Result;
237}
238
239#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
240#
241# DiffFiles - Diff the current version of the file against the last version of
242# the file, reporting things added and removed. This is used to report, for
243# example, added and removed warnings. This returns a pair (added, removed)
244#
245#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
246sub DiffFiles {
247 my $Suffix = shift;
248 my @Others = GetDir $Suffix;
249 if (@Others == 0) { # No other files? We added all entries...
250 return (`cat $WebDir/$DATE$Suffix`, "");
251 }
252 # Diff the files now...
253 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
254 my $Added = join "\n", grep /^</, @Diffs;
255 my $Removed = join "\n", grep /^>/, @Diffs;
256 $Added =~ s/^< //gm;
257 $Removed =~ s/^> //gm;
258 return ($Added, $Removed);
259}
260
261#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
263sub GetRegex { # (Regex with ()'s, value)
264 $_[1] =~ /$_[0]/m;
265 if (defined($1)) {
266 return $1;
267 }
268 return "0";
269}
270
271#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
273sub GetRegexNum {
274 my ($Regex, $Num, $Regex2, $File) = @_;
275 my @Items = split "\n", `grep '$Regex' $File`;
276 return GetRegex $Regex2, $Items[$Num];
277}
278
279#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
280#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281sub ChangeDir { # directory, logical name
282 my ($dir,$name) = @_;
283 chomp($dir);
284 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
Patrick Jenkins1049f402006-07-23 21:38:07 +0000285 chdir($dir) || (print "Cannot change directory to: $name ($dir) " && return -1);
286 return 0;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000287}
288
289#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
291sub ReadFile {
292 if (open (FILE, $_[0])) {
293 undef $/;
294 my $Ret = <FILE>;
295 close FILE;
296 $/ = '\n';
297 return $Ret;
298 } else {
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000299 print "Could not open file '$_[0]' for reading!\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000300 return "";
301 }
302}
303
304#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
305#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
306sub WriteFile { # (filename, contents)
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000307 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000308 print FILE $_[1];
309 close FILE;
310}
311
312#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
313#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314sub CopyFile { #filename, newfile
315 my ($file, $newfile) = @_;
316 chomp($file);
317 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
318 copy($file, $newfile);
319}
320
321#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
322#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
323sub AddRecord {
324 my ($Val, $Filename,$WebDir) = @_;
325 my @Records;
326 if (open FILE, "$WebDir/$Filename") {
327 @Records = grep !/$DATE/, split "\n", <FILE>;
328 close FILE;
329 }
330 push @Records, "$DATE: $Val";
331 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
332}
333
334#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
335#
336# FormatTime - Convert a time from 1m23.45 into 83.45
337#
338#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
339sub FormatTime {
340 my $Time = shift;
341 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
342 $Time = sprintf("%7.4f", $1*60.0+$2);
343 }
344 return $Time;
345}
346
347#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
348#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
349sub GetDejagnuTestResults { # (filename, log)
350 my ($filename, $DejagnuLog) = @_;
351 my @lines;
352 my $firstline;
353 $/ = "\n"; #Make sure we're going line at a time.
354
355 print "DEJAGNU TEST RESULTS:\n";
356
357 if (open SRCHFILE, $filename) {
358 # Process test results
359 my $first_list = 1;
360 my $should_break = 1;
361 my $nocopy = 0;
362 my $readingsum = 0;
363 while ( <SRCHFILE> ) {
364 if ( length($_) > 1 ) {
365 chomp($_);
366 if ( m/^XPASS:/ || m/^FAIL:/ ) {
367 $nocopy = 0;
368 if ( $first_list ) {
369 push(@lines, "UNEXPECTED TEST RESULTS\n");
370 $first_list = 0;
371 $should_break = 1;
372 push(@lines, "$_\n");
373 print " $_\n";
374 } else {
375 push(@lines, "$_\n");
376 print " $_\n";
377 }
378 } #elsif ( m/Summary/ ) {
379 # if ( $first_list ) {
380 # push(@lines, "PERFECT!");
381 # print " PERFECT!\n";
382 # } else {
383 # push(@lines, "</li></ol>\n");
384 # }
385 # push(@lines, "STATISTICS\n");
386 # print "\nDEJAGNU STATISTICS:\n";
387 # $should_break = 0;
388 # $nocopy = 0;
389 # $readingsum = 1;
390 #}
391 elsif ( $readingsum ) {
392 push(@lines,"$_\n");
393 print " $_\n";
394 }
395
396 }
397 }
398 }
399 close SRCHFILE;
400
401 my $content = join("", @lines);
402 return $content;
403}
404
405
406#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
407#
408# This function acts as a mini web browswer submitting data
409# to our central server via the post method
410#
411#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
412sub SendData{
413 $host = $_[0];
414 $file = $_[1];
415 $variables=$_[2];
416
417 $port=80;
418 $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n";
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000419 socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or
420 die "Bad socket\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000421 connect SOCK, $socketaddr or die "Bad connection\n";
422 select((select(SOCK), $| = 1)[0]);
423
424 #creating content here
425 my $content;
426 foreach $key (keys (%$variables)){
427 $value = $variables->{$key};
428 $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
429 $content .= "$key=$value&";
430 }
431
432 $length = length($content);
433
434 my $send= "POST $file HTTP/1.0\n";
435 $send.= "Content-Type: application/x-www-form-urlencoded\n";
436 $send.= "Content-length: $length\n\n";
437 $send.= "$content";
438
439 print SOCK $send;
440 my $result;
441 while(<SOCK>){
442 $result .= $_;
443 }
444 close(SOCK);
445
446 my $sentdata="";
Patrick Jenkins19ecfb02006-07-07 21:40:34 +0000447 foreach $x (keys (%$variables)){
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000448 $value = $variables->{$x};
449 $sentdata.= "$x => $value\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000450 }
451 WriteFile "$Prefix-sentdata.txt", $sentdata;
Patrick Jenkins19ecfb02006-07-07 21:40:34 +0000452
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000453
454 return $result;
455}
456
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000457##############################################################
458#
459# Getting Start timestamp
460#
461##############################################################
Patrick Jenkins7ef934f2006-07-21 21:43:09 +0000462$starttime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000463
464##############################################################
465#
466# Create the CVS repository directory
467#
468##############################################################
469if (!$NOCHECKOUT) {
470 if (-d $BuildDir) {
471 if (!$NOREMOVE) {
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000472 if ( $VERBOSE ){
473 print "Build directory exists! Removing it\n";
474 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000475 system "rm -rf $BuildDir";
476 } else {
477 die "CVS checkout directory $BuildDir already exists!";
478 }
479 }
480 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
481}
482ChangeDir( $BuildDir, "CVS checkout directory" );
483
484
485##############################################################
486#
487# Check out the llvm tree, saving CVS messages to the cvs log...
488#
489##############################################################
490my $CVSOPT = "";
491# Use compression if going over ssh.
492$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
493my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
494if (!$NOCHECKOUT) {
495 if ( $VERBOSE )
496 {
497 print "CHECKOUT STAGE:\n";
498 print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) > $CVSLog 2>&1\n";
499 }
500 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
501 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
502 ChangeDir( $BuildDir , "CVS Checkout directory") ;
503}
504ChangeDir( "llvm" , "llvm source directory") ;
505if (!$NOCHECKOUT) {
506 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
507 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
508}
509
510##############################################################
511#
512# Get some static statistics about the current state of CVS
513#
514# This can probably be put on the server side
515#
516##############################################################
517my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
518my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`;
519my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`;
520my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
521
522my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
523my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
524my $LOC = `utils/countloc.sh`;
525
526##############################################################
527#
528# Extract some information from the CVS history... use a hash so no duplicate
529# stuff is stored. This gets the history from the previous days worth
530# of cvs activit and parses it.
531#
532##############################################################
533
534my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
535
536if(!$NOCVSSTATS){
537
538if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
539@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
540#print join "\n", @CVSHistory; print "\n";
541
542my $DateRE = '[-/:0-9 ]+\+[0-9]+';
543
544# Loop over every record from the CVS history, filling in the hashes.
545foreach $File (@CVSHistory) {
546 my ($Type, $Date, $UID, $Rev, $Filename);
547 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
548 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
549 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
550 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
551 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
552 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
553 } else {
554 print "UNMATCHABLE: $File\n";
555 next;
556 }
557 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
558
559 if ($Filename =~ /^llvm/) {
560 if ($Type eq 'M') { # Modified
561 $ModifiedFiles{$Filename} = 1;
562 $UsersCommitted{$UID} = 1;
563 } elsif ($Type eq 'A') { # Added
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000564 $AddedFiles{$Filename} = 1;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000565 $UsersCommitted{$UID} = 1;
566 } elsif ($Type eq 'R') { # Removed
567 $RemovedFiles{$Filename} = 1;
568 $UsersCommitted{$UID} = 1;
569 } else {
570 $UsersUpdated{$UID} = 1;
571 }
572 }
573}
574
575my $TestError = 1;
576
577}#!NOCVSSTATS
578
579my $CVSAddedFiles = join "\n", sort keys %AddedFiles;
580my $CVSModifiedFiles = join "\n", sort keys %ModifiedFiles;
581my $CVSRemovedFiles = join "\n", sort keys %RemovedFiles;
582my $UserCommitList = join "\n", sort keys %UsersCommitted;
583my $UserUpdateList = join "\n", sort keys %UsersUpdated;
584
585##############################################################
586#
587# Build the entire tree, saving build messages to the build log
588#
589##############################################################
590if (!$NOCHECKOUT && !$NOBUILD) {
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000591 my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
Patrick Jenkins1a61dc42006-07-22 00:00:08 +0000592 if ( $VERBOSE ){
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000593 print "CONFIGURE STAGE:\n";
594 print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1\n";
595 }
596 system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
597 if ( $VERBOSE )
598 {
599 print "BUILD STAGE:\n";
600 print "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1\n";
601 }
602 # Build the entire tree, capturing the output into $BuildLog
603 system "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1";
604}
605
606
607##############################################################
608#
609# Get some statistics about the build...
610#
611##############################################################
612#this can de done on server
613#my @Linked = split '\n', `grep Linking $BuildLog`;
614#my $NumExecutables = scalar(grep(/executable/, @Linked));
615#my $NumLibraries = scalar(grep(!/executable/, @Linked));
616#my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
617
618
619my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
620my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
621my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
622my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
623
624$ConfigTime=-1 unless $ConfigTime;
625$ConfigWallTime=-1 unless $ConfigWallTime;
626
627my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
628my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
629my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
630my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
631
632$BuildTime=-1 unless $BuildTime;
633$BuildWallTime=-1 unless $BuildWallTime;
634
635my $BuildError = 0, $BuildStatus = "OK";
636if($NOBUILD){
637 $BuildStatus = "Skipped by user";
638 $BuildError = 1;
639}
640elsif (`grep '^make[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
641 `grep '^make: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
642 $BuildStatus = "Error: compilation aborted";
643 $BuildError = 1;
644 print "\n***ERROR BUILDING TREE\n\n";
645}
646if ($BuildError) { $NODEJAGNU=1; }
647
Patrick Jenkins1049f402006-07-23 21:38:07 +0000648my $a_file_sizes="";
649my $o_file_sizes="";
650if(!$BuildError){
651 if ( $VERBOSE ){
652 print "Organizing size of .o and .a files\n";
653 }
654 ChangeDir( "$BuildDir/llvm", "Build Directory" );
655 $afiles = `find . -iname '*.a' -ls`;
656 $ofiles = `find . -iname '*.o' -ls`;
657 @AFILES = split "\n", $afiles;
658 $a_file_sizes="";
659 foreach $x (@AFILES){
660 $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000661 $a_file_sizes.="$1 $2 $BUILDTYPE\n";
Patrick Jenkins1049f402006-07-23 21:38:07 +0000662 }
663 @OFILES = split "\n", $ofiles;
664 $o_file_sizes="";
665 foreach $x (@OFILES){
666 $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000667 $o_file_sizes.="$1 $2 $BUILDTYPE\n";
Patrick Jenkins1049f402006-07-23 21:38:07 +0000668 }
669}
670else{
671 $a_file_sizes="No data due to a bad build.";
672 $o_file_sizes="No data due to a bad build.";
673}
674
675
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000676##############################################################
677#
678# Running dejagnu tests
679#
680##############################################################
681my $DejangnuTestResults; # String containing the results of the dejagnu
682my $dejagnu_output = "$DejagnuTestsLog";
683if(!$NODEJAGNU) {
684 if($VERBOSE)
685 {
686 print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n";
687 print "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1\n";
688 }
689
690 #Run the feature and regression tests, results are put into testrun.sum
691 #Full log in testrun.log
692 system "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1";
693
694 #Copy the testrun.log and testrun.sum to our webdir
695 CopyFile("test/testrun.log", $DejagnuLog);
696 CopyFile("test/testrun.sum", $DejagnuSum);
697 #can be done on server
698 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
699 $unexpfail_tests = $DejagnuTestResults;
700}
701#Extract time of dejagnu tests
702my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
703my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
704$DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
705$DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
706$DejagnuTestResults = "Dejagnu skipped by user choice." unless $DejagnuTestResults;
707$DejagnuTime = "0.0" unless $DejagnuTime;
708$DejagnuWallTime = "0.0" unless $DejagnuWallTime;
709
710if ($DEBUG) {
711 print $DejagnuTestResults;
712}
713
714##############################################################
715#
716# Get warnings from the build
717#
718##############################################################
719if(!$NODEJAGNU){
720
721if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
722my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
723my @Warnings;
724my $CurDir = "";
725
726foreach $Warning (@Warn) {
727 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
728 $CurDir = $1; # Keep track of directory warning is in...
729 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
730 $CurDir = $1;
731 }
732 } else {
733 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
734 }
735}
736my $WarningsFile = join "\n", @Warnings;
737$WarningsFile =~ s/:[0-9]+:/::/g;
738
739# Emit the warnings file, so we can diff...
740WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
Patrick Jenkinsd0a7c2b2006-07-06 22:32:15 +0000741my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000742
743# Output something to stdout if something has changed
744#print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
745#print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
746
747#my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade
748#my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade
749
750} #endif !NODEGAGNU
751
752##############################################################
753#
754# If we built the tree successfully, run the nightly programs tests...
755#
756# A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" "External")
757#
758##############################################################
759sub TestDirectory {
760 my $SubDir = shift;
761
Patrick Jenkins1049f402006-07-23 21:38:07 +0000762 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" ) || return ("", "");
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000763
764 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
765 #my $ProgramTestLog = "$Prefix-MultiSource-ProgramTest.txt"; #CHANGE ME!
766
767 # Run the programs tests... creating a report.nightly.csv file
768 if (!$NOTEST) {
769 print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
770 . "TEST=nightly > $ProgramTestLog 2>&1\n";
771 system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
772 . "TEST=nightly > $ProgramTestLog 2>&1";
773 $llcbeta_options=`make print-llcbeta-option`;
774 }
775
776 my $ProgramsTable;
777 if (`grep '^make[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
778 $TestError = 1;
779 $ProgramsTable="Error running test $SubDir\n";
780 print "ERROR TESTING\n";
781 } elsif (`grep '^make[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
782 $TestError = 1;
783 $ProgramsTable="Makefile error running tests $SubDir!\n";
784 print "ERROR TESTING\n";
785 } else {
786 $TestError = 0;
787
788 #
789 # Create a list of the tests which were run...
790 #
791 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
792 . "| sort > $Prefix-multisourceprogramstable.txt";
793 }
794 $ProgramsTable = ReadFile "report.nightly.csv";
795
796 ChangeDir( "../../..", "Programs Test Parent Directory" );
797 return ($ProgramsTable, $llcbeta_options);
798}
799
800$patrickjenkins=1;
801if(!$patrickjenkins){
802 if ( $VERBOSE ) {
803 print "Modified Multisource Olden test stage\n";
804 }
805 ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource/");
806 ChangeDir( "../../..", "Programs Test Parent Directory" );
807
808
809 WriteFile "$WebDir/multisourceprogramstable.txt", $MultiSourceProgramsTable;
810}
811if (!$BuildError && $patrickjenkins) {
812 if ( $VERBOSE ) {
813 print "SingleSource TEST STAGE\n";
814 }
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000815 ($SingleSourceProgramsTable, $llcbeta_options) = TestDirectory("SingleSource");
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000816 WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
817 if ( $VERBOSE ) {
818 print "MultiSource TEST STAGE\n";
819 }
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000820 ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource");
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000821 WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable;
822 if ( ! $NOEXTERNALS ) {
823 if ( $VERBOSE ) {
824 print "External TEST STAGE\n";
825 }
Patrick Jenkinsfd95b692006-07-13 16:58:42 +0000826 ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External");
Patrick Jenkins44ebd5a2006-07-10 16:36:19 +0000827 WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000828 system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
829 " $Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt";
830 } else {
831 $ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
832 if ( $VERBOSE ) {
833 print "External TEST STAGE SKIPPED\n";
834 }
835 system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
836 " | sort > $Prefix-Tests.txt";
837 }
838 WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000839}
840
841##############################################################
842#
843#
844# gathering tests added removed broken information here
845#
846#
847##############################################################
Patrick Jenkins3b606cc2006-07-21 21:58:06 +0000848my $dejagnu = ReadFile $DejagnuSum;
849my @DEJAGNU = split "\n", $dejagnu;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000850
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000851my $passes="",
852my $fails="";
853my $xfails="";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000854
Patrick Jenkins3b606cc2006-07-21 21:58:06 +0000855if(!$NODEJAGNU) {
856 for($x=0; $x<@DEJAGNU; $x++){
857 if($DEJAGNU[$x] =~ m/^PASS:/){
858 $passes.="$DEJAGNU[$x]\n";
859 }
860 elsif($DEJAGNU[$x] =~ m/^FAIL:/){
861 $fails.="$DEJAGNU[$x]\n";
862 }
863 elsif($DEJAGNU[$x] =~ m/^XFAIL:/){
864 $xfails.="$DEJAGNU[$x]\n";
865 }
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000866 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000867}
868
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000869# my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
870#
871# if ($TestError) {
872# $TestsAdded = "<b>error testing</b><br>";
873# $TestsRemoved = "<b>error testing</b><br>";
874# $TestsFixed = "<b>error testing</b><br>";
875# $TestsBroken = "<b>error testing</b><br>";
876# } else {
877# my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
878#
879# my @RawTestsAddedArray = split '\n', $RTestsAdded;
880# my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
881#
882# my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
883# @RawTestsRemovedArray;
884# my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
885# @RawTestsAddedArray;
886#
887# foreach $Test (keys %NewTests) {
888# if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
889# $TestsAdded = "$TestsAdded$Test\n";
890# } else {
891# if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
892# $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
893# } else {
894# $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
895# }
896# }
897# }
898# foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
899# $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
900# }
901#
902# #print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
903# #print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
904# #print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
905# #print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
906#
907# #$TestsAdded = AddPreTag $TestsAdded;
908# #$TestsRemoved = AddPreTag $TestsRemoved;
909# #$TestsFixed = AddPreTag $TestsFixed;
910# #$TestsBroken = AddPreTag $TestsBroken;
911# }
912
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000913##############################################################
914#
915# If we built the tree successfully, runs of the Olden suite with
916# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
917#
918##############################################################
919if (!$BuildError) {
920 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
921 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
922 $MachCodeSize) = ("","","","","","","");
923 if (!$NORUNNINGTESTS) {
924 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
925 "Olden Test Directory");
926
927 # Clean out previous results...
928 system "$NICE make $MAKEOPTS clean > /dev/null 2>&1";
929
930 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
931 # GET_STABLE_NUMBERS enabled!
932 if( $VERBOSE ) { print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
933 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1\n"; }
934 system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
935 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
936 system "cp report.nightly.csv $OldenTestsLog";
937 } #else {
938 #system "gunzip ${OldenTestsLog}.gz";
939 #}
940
941 # Now we know we have $OldenTestsLog as the raw output file. Split
942 # it up into records and read the useful information.
943 #my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
944 #shift @Records; # Delete the first (garbage) record
945
946 # Loop over all of the records, summarizing them into rows for the running
947 # totals file.
948 #my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
949 #foreach $Rec (@Records) {
950 #my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
951 #my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
952 #my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
953 #my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
954 #my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
955 #my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
956
957 #$NATTime .= " " . FormatTime($rNATTime);
958 #$CBETime .= " " . FormatTime($rCBETime);
959 #$LLCTime .= " " . FormatTime($rLLCTime);
960 #$JITTime .= " " . FormatTime($rJITTime);
961 #$OptTime .= " $rOptTime";
962 #$BytecodeSize .= " $rBytecodeSize";
963 #}
964 #
965 # Now that we have all of the numbers we want, add them to the running totals
966 # files.
967 #AddRecord($NATTime, "running_Olden_nat_time.txt", $WebDir);
968 #AddRecord($CBETime, "running_Olden_cbe_time.txt", $WebDir);
969 #AddRecord($LLCTime, "running_Olden_llc_time.txt", $WebDir);
970 #AddRecord($JITTime, "running_Olden_jit_time.txt", $WebDir);
971 #AddRecord($OptTime, "running_Olden_opt_time.txt", $WebDir);
972 #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir);
973}
974
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000975##############################################################
976#
977# Getting end timestamp
978#
979##############################################################
Patrick Jenkins7ef934f2006-07-21 21:43:09 +0000980$endtime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000981
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000982
983##############################################################
984#
985# Place all the logs neatly into one humungous file
986#
987##############################################################
988
989if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
990
991$machine_data = "uname: ".`uname -a`.
992 "hardware: ".`uname -m`.
993 "os: ".`uname -sr`.
994 "name: ".`uname -n`.
995 "date: ".`date \"+20%y-%m-%d\"`.
996 "time: ".`date +\"%H:%M:%S\"`;
997
998my @CVS_DATA;
999my $cvs_data;
1000@CVS_DATA = ReadFile "$CVSLog";
1001$cvs_data = join("\n", @CVS_DATA);
1002
1003my @BUILD_DATA;
1004my $build_data;
1005@BUILD_DATA = ReadFile "$BuildLog";
1006$build_data = join("\n", @BUILD_DATA);
1007
1008my @DEJAGNU_LOG;
1009my @DEJAGNU_SUM;
1010my $dejagnutests_log;
1011my $dejagnutests_sum;
1012@DEJAGNU_LOG = ReadFile "$DejagnuLog";
1013@DEJAGNU_SUM = ReadFile "$DejagnuSum";
1014$dejagnutests_log = join("\n", @DEJAGNU_LOG);
1015$dejagnutests_sum = join("\n", @DEJAGNU_SUM);
1016
1017my @DEJAGNULOG_FULL;
1018my $dejagnulog_full;
1019@DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog";
1020$dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
1021
Patrick Jenkins7c1ea252006-07-20 16:54:43 +00001022my $gcc_version_long="";
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001023if($GCCPATH ne ""){
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001024 $gcc_version_long = `$GCCPATH/gcc --version`;
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001025 print "$GCCPATH/gcc --version\n";
Patrick Jenkins9536ec72006-07-14 20:44:09 +00001026}
1027else{
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001028 $gcc_version_long = `gcc --version`;
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001029 print "gcc --version\n";
Patrick Jenkins9536ec72006-07-14 20:44:09 +00001030}
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001031@GCC_VERSION = split '\n', $gcc_version_long;
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001032my $gcc_version = $GCC_VERSION[0];
1033
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +00001034$all_tests = ReadFile, "$Prefix-Tests.txt";
1035
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001036##############################################################
1037#
1038# Send data via a post request
1039#
1040##############################################################
1041
1042if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
1043
1044
1045my $host = "llvm.org";
1046my $file = "/nightlytest/NightlyTestAccept.cgi";
1047my %hash_of_data = ('machine_data' => $machine_data,
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +00001048 'build_data' => $build_data,
1049 'gcc_version' => $gcc_version,
1050 'nickname' => $nickname,
1051 'dejagnutime_wall' => $DejagnuWallTime,
1052 'dejagnutime_cpu' => $DejagnuTime,
1053 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall,
1054 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU,
1055 'configtime_wall' => $ConfigWallTime,
1056 'configtime_cpu'=> $ConfigTime,
1057 'buildtime_wall' => $BuildWallTime,
1058 'buildtime_cpu' => $BuildTime,
1059 'warnings' => $WarningsFile,
1060 'cvsusercommitlist' => $UserCommitList,
1061 'cvsuserupdatelist' => $UserUpdateList,
1062 'cvsaddedfiles' => $CVSAddedFiles,
1063 'cvsmodifiedfiles' => $CVSModifiedFiles,
1064 'cvsremovedfiles' => $CVSRemovedFiles,
1065 'lines_of_code' => $LOC,
1066 'cvs_file_count' => $NumFilesInCVS,
1067 'cvs_dir_count' => $NumDirsInCVS,
1068 'buildstatus' => $BuildStatus,
1069 'singlesource_programstable' => $SingleSourceProgramsTable,
1070 'multisource_programstable' => $MultiSourceProgramsTable,
1071 'externalsource_programstable' => $ExternalProgramsTable,
1072 'llcbeta_options' => $multisource_llcbeta_options,
1073 'warnings_removed' => $WarningsRemoved,
1074 'warnings_added' => $WarningsAdded,
1075 'passing_tests' => $passes,
1076 'expfail_tests' => $xfails,
1077 'unexpfail_tests' => $fails,
1078 'all_tests' => $all_tests,
1079 'new_tests' => "",
1080 'removed_tests' => "",
1081 'dejagnutests_log' => $dejagnutests_log,
1082 'dejagnutests_sum' => $dejagnutests_sum,
1083 'starttime' => $starttime,
Patrick Jenkinsc8b9c532006-07-21 19:51:40 +00001084 'endtime' => $endtime,
1085 'o_file_sizes' => $o_file_sizes,
1086 'a_file_sizes' => $a_file_sizes);
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001087
1088$TESTING = 0;
1089
1090if($TESTING){
1091 print "============================\n";
1092 foreach $x(keys %hash_of_data){
1093 print "$x => $hash_of_data{$x}\n";
1094 }
1095}
1096else{
1097 my $response = SendData $host,$file,\%hash_of_data;
1098 print "============================\n$response";
1099}
1100
1101##############################################################
1102#
1103# Remove the cvs tree...
1104#
1105##############################################################
1106system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Patrick Jenkins26d5bd52006-07-13 16:56:48 +00001107system ( "$NICE rm -rf $WebDir") if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001108
1109