blob: c61bafacf9b260df97a1ffcf9111eefac288ef0b [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 ".
125 "OPTIMIZE_OPTION=-O2"; next; }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000126 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
127 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
128 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
129 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
130 $CONFIGUREARGS .= " --disable-jit"; next; }
131 if (/^-verbose$/) { $VERBOSE = 1; next; }
132 if (/^-debug$/) { $DEBUG = 1; next; }
133 if (/^-nice$/) { $NICE = "nice "; next; }
134 if (/^-f2c$/) {
135 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
136 }
137 if (/^-with-externals/) {
138 $CONFIGUREARGS .= "--with-externals=$ARGV[0]"; shift; next;
139 }
140 if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; }
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000141 if (/^-gccpath/) { $CONFIGUREARGS .=
142 " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++";
Patrick Jenkins9536ec72006-07-14 20:44:09 +0000143 $GCCPATH=$ARGV[0];
144 shift;
145 next;}
Patrick Jenkinsbe254602006-07-18 17:21:30 +0000146 else{ $GCCPATH=""; }
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000147 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
148 else{ $CVSCOOPT="";}
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000149 if (/^-target/) {
150 $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next;
151 }
152 if (/^-cflags/) {
153 $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; shift; next;
154 }
155 if (/^-cxxflags/) {
156 $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; shift; next;
157 }
158 if (/^-ldflags/) {
159 $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; shift; next;
160 }
161 if (/^-compileflags/) {
162 $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next;
163 }
164 if (/^-extraflags/) {
165 $PROGTESTOPTS .= " EXTRA_FLAGS=\'$ARGV[0]\'"; shift; next;
166 }
167 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
168 if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
169 if (/^-nobuild$/) { $NOBUILD = 1; next; }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000170 print "Unknown option: $_ : ignoring!\n";
171}
172
173if ($ENV{'LLVMGCCDIR'}) {
174 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
175}
176if ($CONFIGUREARGS !~ /--disable-jit/) {
177 $CONFIGUREARGS .= " --enable-jit";
178}
179
180die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3);
181
182if (@ARGV == 3) {
183 $CVSRootDir = $ARGV[0];
184 $BuildDir = $ARGV[1];
185 $WebDir = $ARGV[2];
186}
187
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000188if($nickname eq ""){
189 die ("Please invoke NewNightlyTest.pl with command line option \"-nickname <nickname>\"");
190}
191
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000192##############################################################
193#
194#define the file names we'll use
195#
196##############################################################
197my $Prefix = "$WebDir/$DATE";
198my $BuildLog = "$Prefix-Build-Log.txt";
199my $CVSLog = "$Prefix-CVS-Log.txt";
200my $OldenTestsLog = "$Prefix-Olden-tests.txt";
201my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
202my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
203my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
204my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
205my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
206my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
207if (! -d $WebDir) {
208 mkdir $WebDir, 0777;
209 warn "$WebDir did not exist; creating it.\n";
210}
211
212if ($VERBOSE) {
213 print "INITIALIZED\n";
214 print "CVS Root = $CVSRootDir\n";
215 print "BuildDir = $BuildDir\n";
216 print "WebDir = $WebDir\n";
217 print "Prefix = $Prefix\n";
218 print "CVSLog = $CVSLog\n";
219 print "BuildLog = $BuildLog\n";
220}
221
222##############################################################
223#
224# Helper functions
225#
226##############################################################
227sub GetDir {
228 my $Suffix = shift;
229 opendir DH, $WebDir;
230 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
231 closedir DH;
232 return @Result;
233}
234
235#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236#
237# DiffFiles - Diff the current version of the file against the last version of
238# the file, reporting things added and removed. This is used to report, for
239# example, added and removed warnings. This returns a pair (added, removed)
240#
241#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
242sub DiffFiles {
243 my $Suffix = shift;
244 my @Others = GetDir $Suffix;
245 if (@Others == 0) { # No other files? We added all entries...
246 return (`cat $WebDir/$DATE$Suffix`, "");
247 }
248 # Diff the files now...
249 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
250 my $Added = join "\n", grep /^</, @Diffs;
251 my $Removed = join "\n", grep /^>/, @Diffs;
252 $Added =~ s/^< //gm;
253 $Removed =~ s/^> //gm;
254 return ($Added, $Removed);
255}
256
257#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
258#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259sub GetRegex { # (Regex with ()'s, value)
260 $_[1] =~ /$_[0]/m;
261 if (defined($1)) {
262 return $1;
263 }
264 return "0";
265}
266
267#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
268#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269sub GetRegexNum {
270 my ($Regex, $Num, $Regex2, $File) = @_;
271 my @Items = split "\n", `grep '$Regex' $File`;
272 return GetRegex $Regex2, $Items[$Num];
273}
274
275#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
276#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
277sub ChangeDir { # directory, logical name
278 my ($dir,$name) = @_;
279 chomp($dir);
280 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
281 chdir($dir) || die "Cannot change directory to: $name ($dir) ";
282}
283
284#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
285#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
286sub ReadFile {
287 if (open (FILE, $_[0])) {
288 undef $/;
289 my $Ret = <FILE>;
290 close FILE;
291 $/ = '\n';
292 return $Ret;
293 } else {
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000294 print "Could not open file '$_[0]' for reading!\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000295 return "";
296 }
297}
298
299#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
301sub WriteFile { # (filename, contents)
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000302 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000303 print FILE $_[1];
304 close FILE;
305}
306
307#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
309sub CopyFile { #filename, newfile
310 my ($file, $newfile) = @_;
311 chomp($file);
312 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
313 copy($file, $newfile);
314}
315
316#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
318sub AddRecord {
319 my ($Val, $Filename,$WebDir) = @_;
320 my @Records;
321 if (open FILE, "$WebDir/$Filename") {
322 @Records = grep !/$DATE/, split "\n", <FILE>;
323 close FILE;
324 }
325 push @Records, "$DATE: $Val";
326 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
327}
328
329#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330#
331# FormatTime - Convert a time from 1m23.45 into 83.45
332#
333#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
334sub FormatTime {
335 my $Time = shift;
336 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
337 $Time = sprintf("%7.4f", $1*60.0+$2);
338 }
339 return $Time;
340}
341
342#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
343#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344sub GetDejagnuTestResults { # (filename, log)
345 my ($filename, $DejagnuLog) = @_;
346 my @lines;
347 my $firstline;
348 $/ = "\n"; #Make sure we're going line at a time.
349
350 print "DEJAGNU TEST RESULTS:\n";
351
352 if (open SRCHFILE, $filename) {
353 # Process test results
354 my $first_list = 1;
355 my $should_break = 1;
356 my $nocopy = 0;
357 my $readingsum = 0;
358 while ( <SRCHFILE> ) {
359 if ( length($_) > 1 ) {
360 chomp($_);
361 if ( m/^XPASS:/ || m/^FAIL:/ ) {
362 $nocopy = 0;
363 if ( $first_list ) {
364 push(@lines, "UNEXPECTED TEST RESULTS\n");
365 $first_list = 0;
366 $should_break = 1;
367 push(@lines, "$_\n");
368 print " $_\n";
369 } else {
370 push(@lines, "$_\n");
371 print " $_\n";
372 }
373 } #elsif ( m/Summary/ ) {
374 # if ( $first_list ) {
375 # push(@lines, "PERFECT!");
376 # print " PERFECT!\n";
377 # } else {
378 # push(@lines, "</li></ol>\n");
379 # }
380 # push(@lines, "STATISTICS\n");
381 # print "\nDEJAGNU STATISTICS:\n";
382 # $should_break = 0;
383 # $nocopy = 0;
384 # $readingsum = 1;
385 #}
386 elsif ( $readingsum ) {
387 push(@lines,"$_\n");
388 print " $_\n";
389 }
390
391 }
392 }
393 }
394 close SRCHFILE;
395
396 my $content = join("", @lines);
397 return $content;
398}
399
400
401#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
402#
403# This function acts as a mini web browswer submitting data
404# to our central server via the post method
405#
406#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
407sub SendData{
408 $host = $_[0];
409 $file = $_[1];
410 $variables=$_[2];
411
412 $port=80;
413 $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n";
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000414 socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or
415 die "Bad socket\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000416 connect SOCK, $socketaddr or die "Bad connection\n";
417 select((select(SOCK), $| = 1)[0]);
418
419 #creating content here
420 my $content;
421 foreach $key (keys (%$variables)){
422 $value = $variables->{$key};
423 $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
424 $content .= "$key=$value&";
425 }
426
427 $length = length($content);
428
429 my $send= "POST $file HTTP/1.0\n";
430 $send.= "Content-Type: application/x-www-form-urlencoded\n";
431 $send.= "Content-length: $length\n\n";
432 $send.= "$content";
433
434 print SOCK $send;
435 my $result;
436 while(<SOCK>){
437 $result .= $_;
438 }
439 close(SOCK);
440
441 my $sentdata="";
Patrick Jenkins19ecfb02006-07-07 21:40:34 +0000442 foreach $x (keys (%$variables)){
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000443 $value = $variables->{$x};
444 $sentdata.= "$x => $value\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000445 }
446 WriteFile "$Prefix-sentdata.txt", $sentdata;
Patrick Jenkins19ecfb02006-07-07 21:40:34 +0000447
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000448
449 return $result;
450}
451
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000452##############################################################
453#
454# Getting Start timestamp
455#
456##############################################################
Patrick Jenkins7ef934f2006-07-21 21:43:09 +0000457$starttime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000458
459##############################################################
460#
461# Create the CVS repository directory
462#
463##############################################################
464if (!$NOCHECKOUT) {
465 if (-d $BuildDir) {
466 if (!$NOREMOVE) {
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000467 if ( $VERBOSE ){
468 print "Build directory exists! Removing it\n";
469 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000470 system "rm -rf $BuildDir";
471 } else {
472 die "CVS checkout directory $BuildDir already exists!";
473 }
474 }
475 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
476}
477ChangeDir( $BuildDir, "CVS checkout directory" );
478
479
480##############################################################
481#
482# Check out the llvm tree, saving CVS messages to the cvs log...
483#
484##############################################################
485my $CVSOPT = "";
486# Use compression if going over ssh.
487$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
488my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
489if (!$NOCHECKOUT) {
490 if ( $VERBOSE )
491 {
492 print "CHECKOUT STAGE:\n";
493 print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) > $CVSLog 2>&1\n";
494 }
495 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
496 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
497 ChangeDir( $BuildDir , "CVS Checkout directory") ;
498}
499ChangeDir( "llvm" , "llvm source directory") ;
500if (!$NOCHECKOUT) {
501 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
502 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
503}
504
505##############################################################
506#
507# Get some static statistics about the current state of CVS
508#
509# This can probably be put on the server side
510#
511##############################################################
512my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
513my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`;
514my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`;
515my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
516
517my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
518my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
519my $LOC = `utils/countloc.sh`;
520
521##############################################################
522#
523# Extract some information from the CVS history... use a hash so no duplicate
524# stuff is stored. This gets the history from the previous days worth
525# of cvs activit and parses it.
526#
527##############################################################
528
529my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
530
531if(!$NOCVSSTATS){
532
533if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
534@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
535#print join "\n", @CVSHistory; print "\n";
536
537my $DateRE = '[-/:0-9 ]+\+[0-9]+';
538
539# Loop over every record from the CVS history, filling in the hashes.
540foreach $File (@CVSHistory) {
541 my ($Type, $Date, $UID, $Rev, $Filename);
542 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
543 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
544 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
545 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
546 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
547 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
548 } else {
549 print "UNMATCHABLE: $File\n";
550 next;
551 }
552 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
553
554 if ($Filename =~ /^llvm/) {
555 if ($Type eq 'M') { # Modified
556 $ModifiedFiles{$Filename} = 1;
557 $UsersCommitted{$UID} = 1;
558 } elsif ($Type eq 'A') { # Added
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000559 $AddedFiles{$Filename} = 1;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000560 $UsersCommitted{$UID} = 1;
561 } elsif ($Type eq 'R') { # Removed
562 $RemovedFiles{$Filename} = 1;
563 $UsersCommitted{$UID} = 1;
564 } else {
565 $UsersUpdated{$UID} = 1;
566 }
567 }
568}
569
570my $TestError = 1;
571
572}#!NOCVSSTATS
573
574my $CVSAddedFiles = join "\n", sort keys %AddedFiles;
575my $CVSModifiedFiles = join "\n", sort keys %ModifiedFiles;
576my $CVSRemovedFiles = join "\n", sort keys %RemovedFiles;
577my $UserCommitList = join "\n", sort keys %UsersCommitted;
578my $UserUpdateList = join "\n", sort keys %UsersUpdated;
579
580##############################################################
581#
582# Build the entire tree, saving build messages to the build log
583#
584##############################################################
585if (!$NOCHECKOUT && !$NOBUILD) {
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000586 my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
Patrick Jenkins1a61dc42006-07-22 00:00:08 +0000587 if ( $VERBOSE ){
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000588 print "CONFIGURE STAGE:\n";
589 print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1\n";
590 }
591 system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
592 if ( $VERBOSE )
593 {
594 print "BUILD STAGE:\n";
595 print "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1\n";
596 }
597 # Build the entire tree, capturing the output into $BuildLog
598 system "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1";
599}
600
601
602##############################################################
603#
604# Get some statistics about the build...
605#
606##############################################################
607#this can de done on server
608#my @Linked = split '\n', `grep Linking $BuildLog`;
609#my $NumExecutables = scalar(grep(/executable/, @Linked));
610#my $NumLibraries = scalar(grep(!/executable/, @Linked));
611#my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
612
Patrick Jenkins7ef934f2006-07-21 21:43:09 +0000613my $a_file_sizes="";
614my $o_file_sizes="";
Patrick Jenkinsc8b9c532006-07-21 19:51:40 +0000615if(!$BuildError){
Patrick Jenkins1a61dc42006-07-22 00:00:08 +0000616 if ( $VERBOSE ){
617 print "Organizing size of .o and .a files\n";
618 }
Patrick Jenkinsc8b9c532006-07-21 19:51:40 +0000619 ChangeDir( "$BuildDir", "Build Directory" );
620 $afiles = `find . -iname '*.a' -ls`;
621 $ofiles = `find . -iname '*.o' -ls`;
622 @AFILES = split "\n", $afiles;
623 $a_file_sizes="";
624 foreach $x (@AFILES){
625 $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
626 $a_file_sizes.="$1 $2\n";
Patrick Jenkins7ef934f2006-07-21 21:43:09 +0000627 }
628 @OFILES = split "\n", $ofiles;
Patrick Jenkinsc8b9c532006-07-21 19:51:40 +0000629 $o_file_sizes="";
630 foreach $x (@OFILES){
631 $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
632 $o_file_sizes.="$1 $2\n";
633 }
634}
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000635
636my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
637my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
638my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
639my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
640
641$ConfigTime=-1 unless $ConfigTime;
642$ConfigWallTime=-1 unless $ConfigWallTime;
643
644my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
645my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
646my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
647my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
648
649$BuildTime=-1 unless $BuildTime;
650$BuildWallTime=-1 unless $BuildWallTime;
651
652my $BuildError = 0, $BuildStatus = "OK";
653if($NOBUILD){
654 $BuildStatus = "Skipped by user";
655 $BuildError = 1;
656}
657elsif (`grep '^make[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
658 `grep '^make: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
659 $BuildStatus = "Error: compilation aborted";
660 $BuildError = 1;
661 print "\n***ERROR BUILDING TREE\n\n";
662}
663if ($BuildError) { $NODEJAGNU=1; }
664
665##############################################################
666#
667# Running dejagnu tests
668#
669##############################################################
670my $DejangnuTestResults; # String containing the results of the dejagnu
671my $dejagnu_output = "$DejagnuTestsLog";
672if(!$NODEJAGNU) {
673 if($VERBOSE)
674 {
675 print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n";
676 print "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1\n";
677 }
678
679 #Run the feature and regression tests, results are put into testrun.sum
680 #Full log in testrun.log
681 system "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1";
682
683 #Copy the testrun.log and testrun.sum to our webdir
684 CopyFile("test/testrun.log", $DejagnuLog);
685 CopyFile("test/testrun.sum", $DejagnuSum);
686 #can be done on server
687 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
688 $unexpfail_tests = $DejagnuTestResults;
689}
690#Extract time of dejagnu tests
691my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
692my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
693$DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
694$DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
695$DejagnuTestResults = "Dejagnu skipped by user choice." unless $DejagnuTestResults;
696$DejagnuTime = "0.0" unless $DejagnuTime;
697$DejagnuWallTime = "0.0" unless $DejagnuWallTime;
698
699if ($DEBUG) {
700 print $DejagnuTestResults;
701}
702
703##############################################################
704#
705# Get warnings from the build
706#
707##############################################################
708if(!$NODEJAGNU){
709
710if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
711my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
712my @Warnings;
713my $CurDir = "";
714
715foreach $Warning (@Warn) {
716 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
717 $CurDir = $1; # Keep track of directory warning is in...
718 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
719 $CurDir = $1;
720 }
721 } else {
722 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
723 }
724}
725my $WarningsFile = join "\n", @Warnings;
726$WarningsFile =~ s/:[0-9]+:/::/g;
727
728# Emit the warnings file, so we can diff...
729WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
Patrick Jenkinsd0a7c2b2006-07-06 22:32:15 +0000730my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000731
732# Output something to stdout if something has changed
733#print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
734#print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
735
736#my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade
737#my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade
738
739} #endif !NODEGAGNU
740
741##############################################################
742#
743# If we built the tree successfully, run the nightly programs tests...
744#
745# A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" "External")
746#
747##############################################################
748sub TestDirectory {
749 my $SubDir = shift;
750
751 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" );
752
753 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
754 #my $ProgramTestLog = "$Prefix-MultiSource-ProgramTest.txt"; #CHANGE ME!
755
756 # Run the programs tests... creating a report.nightly.csv file
757 if (!$NOTEST) {
758 print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
759 . "TEST=nightly > $ProgramTestLog 2>&1\n";
760 system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
761 . "TEST=nightly > $ProgramTestLog 2>&1";
762 $llcbeta_options=`make print-llcbeta-option`;
763 }
764
765 my $ProgramsTable;
766 if (`grep '^make[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
767 $TestError = 1;
768 $ProgramsTable="Error running test $SubDir\n";
769 print "ERROR TESTING\n";
770 } elsif (`grep '^make[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
771 $TestError = 1;
772 $ProgramsTable="Makefile error running tests $SubDir!\n";
773 print "ERROR TESTING\n";
774 } else {
775 $TestError = 0;
776
777 #
778 # Create a list of the tests which were run...
779 #
780 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
781 . "| sort > $Prefix-multisourceprogramstable.txt";
782 }
783 $ProgramsTable = ReadFile "report.nightly.csv";
784
785 ChangeDir( "../../..", "Programs Test Parent Directory" );
786 return ($ProgramsTable, $llcbeta_options);
787}
788
789$patrickjenkins=1;
790if(!$patrickjenkins){
791 if ( $VERBOSE ) {
792 print "Modified Multisource Olden test stage\n";
793 }
794 ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource/");
795 ChangeDir( "../../..", "Programs Test Parent Directory" );
796
797
798 WriteFile "$WebDir/multisourceprogramstable.txt", $MultiSourceProgramsTable;
799}
800if (!$BuildError && $patrickjenkins) {
801 if ( $VERBOSE ) {
802 print "SingleSource TEST STAGE\n";
803 }
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000804 ($SingleSourceProgramsTable, $llcbeta_options) = TestDirectory("SingleSource");
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000805 WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
806 if ( $VERBOSE ) {
807 print "MultiSource TEST STAGE\n";
808 }
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000809 ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource");
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000810 WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable;
811 if ( ! $NOEXTERNALS ) {
812 if ( $VERBOSE ) {
813 print "External TEST STAGE\n";
814 }
Patrick Jenkinsfd95b692006-07-13 16:58:42 +0000815 ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External");
Patrick Jenkins44ebd5a2006-07-10 16:36:19 +0000816 WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000817 system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
818 " $Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt";
819 } else {
820 $ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
821 if ( $VERBOSE ) {
822 print "External TEST STAGE SKIPPED\n";
823 }
824 system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
825 " | sort > $Prefix-Tests.txt";
826 }
827 WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000828}
829
830##############################################################
831#
832#
833# gathering tests added removed broken information here
834#
835#
836##############################################################
Patrick Jenkins3b606cc2006-07-21 21:58:06 +0000837my $dejagnu = ReadFile $DejagnuSum;
838my @DEJAGNU = split "\n", $dejagnu;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000839
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000840my $passes="",
841my $fails="";
842my $xfails="";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000843
Patrick Jenkins3b606cc2006-07-21 21:58:06 +0000844if(!$NODEJAGNU) {
845 for($x=0; $x<@DEJAGNU; $x++){
846 if($DEJAGNU[$x] =~ m/^PASS:/){
847 $passes.="$DEJAGNU[$x]\n";
848 }
849 elsif($DEJAGNU[$x] =~ m/^FAIL:/){
850 $fails.="$DEJAGNU[$x]\n";
851 }
852 elsif($DEJAGNU[$x] =~ m/^XFAIL:/){
853 $xfails.="$DEJAGNU[$x]\n";
854 }
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000855 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000856}
857
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000858# my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
859#
860# if ($TestError) {
861# $TestsAdded = "<b>error testing</b><br>";
862# $TestsRemoved = "<b>error testing</b><br>";
863# $TestsFixed = "<b>error testing</b><br>";
864# $TestsBroken = "<b>error testing</b><br>";
865# } else {
866# my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
867#
868# my @RawTestsAddedArray = split '\n', $RTestsAdded;
869# my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
870#
871# my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
872# @RawTestsRemovedArray;
873# my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
874# @RawTestsAddedArray;
875#
876# foreach $Test (keys %NewTests) {
877# if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
878# $TestsAdded = "$TestsAdded$Test\n";
879# } else {
880# if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
881# $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
882# } else {
883# $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
884# }
885# }
886# }
887# foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
888# $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
889# }
890#
891# #print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
892# #print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
893# #print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
894# #print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
895#
896# #$TestsAdded = AddPreTag $TestsAdded;
897# #$TestsRemoved = AddPreTag $TestsRemoved;
898# #$TestsFixed = AddPreTag $TestsFixed;
899# #$TestsBroken = AddPreTag $TestsBroken;
900# }
901
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000902##############################################################
903#
904# If we built the tree successfully, runs of the Olden suite with
905# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
906#
907##############################################################
908if (!$BuildError) {
909 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
910 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
911 $MachCodeSize) = ("","","","","","","");
912 if (!$NORUNNINGTESTS) {
913 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
914 "Olden Test Directory");
915
916 # Clean out previous results...
917 system "$NICE make $MAKEOPTS clean > /dev/null 2>&1";
918
919 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
920 # GET_STABLE_NUMBERS enabled!
921 if( $VERBOSE ) { print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
922 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1\n"; }
923 system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
924 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
925 system "cp report.nightly.csv $OldenTestsLog";
926 } #else {
927 #system "gunzip ${OldenTestsLog}.gz";
928 #}
929
930 # Now we know we have $OldenTestsLog as the raw output file. Split
931 # it up into records and read the useful information.
932 #my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
933 #shift @Records; # Delete the first (garbage) record
934
935 # Loop over all of the records, summarizing them into rows for the running
936 # totals file.
937 #my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
938 #foreach $Rec (@Records) {
939 #my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
940 #my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
941 #my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
942 #my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
943 #my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
944 #my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
945
946 #$NATTime .= " " . FormatTime($rNATTime);
947 #$CBETime .= " " . FormatTime($rCBETime);
948 #$LLCTime .= " " . FormatTime($rLLCTime);
949 #$JITTime .= " " . FormatTime($rJITTime);
950 #$OptTime .= " $rOptTime";
951 #$BytecodeSize .= " $rBytecodeSize";
952 #}
953 #
954 # Now that we have all of the numbers we want, add them to the running totals
955 # files.
956 #AddRecord($NATTime, "running_Olden_nat_time.txt", $WebDir);
957 #AddRecord($CBETime, "running_Olden_cbe_time.txt", $WebDir);
958 #AddRecord($LLCTime, "running_Olden_llc_time.txt", $WebDir);
959 #AddRecord($JITTime, "running_Olden_jit_time.txt", $WebDir);
960 #AddRecord($OptTime, "running_Olden_opt_time.txt", $WebDir);
961 #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir);
962}
963
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000964##############################################################
965#
966# Getting end timestamp
967#
968##############################################################
Patrick Jenkins7ef934f2006-07-21 21:43:09 +0000969$endtime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000970
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000971
972##############################################################
973#
974# Place all the logs neatly into one humungous file
975#
976##############################################################
977
978if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
979
980$machine_data = "uname: ".`uname -a`.
981 "hardware: ".`uname -m`.
982 "os: ".`uname -sr`.
983 "name: ".`uname -n`.
984 "date: ".`date \"+20%y-%m-%d\"`.
985 "time: ".`date +\"%H:%M:%S\"`;
986
987my @CVS_DATA;
988my $cvs_data;
989@CVS_DATA = ReadFile "$CVSLog";
990$cvs_data = join("\n", @CVS_DATA);
991
992my @BUILD_DATA;
993my $build_data;
994@BUILD_DATA = ReadFile "$BuildLog";
995$build_data = join("\n", @BUILD_DATA);
996
997my @DEJAGNU_LOG;
998my @DEJAGNU_SUM;
999my $dejagnutests_log;
1000my $dejagnutests_sum;
1001@DEJAGNU_LOG = ReadFile "$DejagnuLog";
1002@DEJAGNU_SUM = ReadFile "$DejagnuSum";
1003$dejagnutests_log = join("\n", @DEJAGNU_LOG);
1004$dejagnutests_sum = join("\n", @DEJAGNU_SUM);
1005
1006my @DEJAGNULOG_FULL;
1007my $dejagnulog_full;
1008@DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog";
1009$dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
1010
Patrick Jenkins7c1ea252006-07-20 16:54:43 +00001011my $gcc_version_long="";
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001012if($GCCPATH ne ""){
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001013 $gcc_version_long = `$GCCPATH/gcc --version`;
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001014 print "$GCCPATH/gcc --version\n";
Patrick Jenkins9536ec72006-07-14 20:44:09 +00001015}
1016else{
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001017 $gcc_version_long = `gcc --version`;
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001018 print "gcc --version\n";
Patrick Jenkins9536ec72006-07-14 20:44:09 +00001019}
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001020@GCC_VERSION = split '\n', $gcc_version_long;
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001021my $gcc_version = $GCC_VERSION[0];
1022
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +00001023$all_tests = ReadFile, "$Prefix-Tests.txt";
1024
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001025##############################################################
1026#
1027# Send data via a post request
1028#
1029##############################################################
1030
1031if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
1032
1033
1034my $host = "llvm.org";
1035my $file = "/nightlytest/NightlyTestAccept.cgi";
1036my %hash_of_data = ('machine_data' => $machine_data,
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +00001037 'build_data' => $build_data,
1038 'gcc_version' => $gcc_version,
1039 'nickname' => $nickname,
1040 'dejagnutime_wall' => $DejagnuWallTime,
1041 'dejagnutime_cpu' => $DejagnuTime,
1042 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall,
1043 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU,
1044 'configtime_wall' => $ConfigWallTime,
1045 'configtime_cpu'=> $ConfigTime,
1046 'buildtime_wall' => $BuildWallTime,
1047 'buildtime_cpu' => $BuildTime,
1048 'warnings' => $WarningsFile,
1049 'cvsusercommitlist' => $UserCommitList,
1050 'cvsuserupdatelist' => $UserUpdateList,
1051 'cvsaddedfiles' => $CVSAddedFiles,
1052 'cvsmodifiedfiles' => $CVSModifiedFiles,
1053 'cvsremovedfiles' => $CVSRemovedFiles,
1054 'lines_of_code' => $LOC,
1055 'cvs_file_count' => $NumFilesInCVS,
1056 'cvs_dir_count' => $NumDirsInCVS,
1057 'buildstatus' => $BuildStatus,
1058 'singlesource_programstable' => $SingleSourceProgramsTable,
1059 'multisource_programstable' => $MultiSourceProgramsTable,
1060 'externalsource_programstable' => $ExternalProgramsTable,
1061 'llcbeta_options' => $multisource_llcbeta_options,
1062 'warnings_removed' => $WarningsRemoved,
1063 'warnings_added' => $WarningsAdded,
1064 'passing_tests' => $passes,
1065 'expfail_tests' => $xfails,
1066 'unexpfail_tests' => $fails,
1067 'all_tests' => $all_tests,
1068 'new_tests' => "",
1069 'removed_tests' => "",
1070 'dejagnutests_log' => $dejagnutests_log,
1071 'dejagnutests_sum' => $dejagnutests_sum,
1072 'starttime' => $starttime,
Patrick Jenkinsc8b9c532006-07-21 19:51:40 +00001073 'endtime' => $endtime,
1074 'o_file_sizes' => $o_file_sizes,
1075 'a_file_sizes' => $a_file_sizes);
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001076
1077$TESTING = 0;
1078
1079if($TESTING){
1080 print "============================\n";
1081 foreach $x(keys %hash_of_data){
1082 print "$x => $hash_of_data{$x}\n";
1083 }
1084}
1085else{
1086 my $response = SendData $host,$file,\%hash_of_data;
1087 print "============================\n$response";
1088}
1089
1090##############################################################
1091#
1092# Remove the cvs tree...
1093#
1094##############################################################
1095system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Patrick Jenkins26d5bd52006-07-13 16:56:48 +00001096system ( "$NICE rm -rf $WebDir") if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001097
1098