blob: 395c9adf02ada69da7e502d2427dee9699fd6159 [file] [log] [blame]
Patrick Jenkinsfe030d72006-07-06 21:19:32 +00001#!/usr/bin/perl
Patrick Jenkinsfe030d72006-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 Jenkinsa5c04d62006-07-07 17:31:38 +000022# -noremoveresults Do not remove the WEBDIR after it has been built.
Patrick Jenkinsfe030d72006-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 Jenkinsfe030d72006-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 Jenkins215b48f2006-07-07 18:50:51 +000053# -compileflags Next argument specifies extra options passed to make when
54# building LLVM.
Patrick Jenkinsfe030d72006-07-06 21:19:32 +000055#
56# ---------------- Options to configure llvm-test ----------------------------
Patrick Jenkins215b48f2006-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 Jenkinsfe030d72006-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 Jenkins49717a42006-07-21 01:39:42 +0000108$nickname="";
Patrick Jenkinsfe030d72006-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 Jenkinsa5c04d62006-07-07 17:31:38 +0000120 if (/^-noremoveresults$/) { $NOREMOVERESULTS = 1; next; }
Patrick Jenkinsfe030d72006-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 Jenkinsadea55e2006-07-17 16:41:19 +0000124 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
125 "OPTIMIZE_OPTION=-O2"; next; }
Patrick Jenkinsfe030d72006-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 Jenkinsadea55e2006-07-17 16:41:19 +0000141 if (/^-gccpath/) { $CONFIGUREARGS .=
142 " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++";
Patrick Jenkins79fbf7f2006-07-14 20:44:09 +0000143 $GCCPATH=$ARGV[0];
144 shift;
145 next;}
Patrick Jenkinsf2637042006-07-18 17:21:30 +0000146 else{ $GCCPATH=""; }
Patrick Jenkinsadea55e2006-07-17 16:41:19 +0000147 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
148 else{ $CVSCOOPT="";}
Patrick Jenkinsfe030d72006-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 Jenkinsfe030d72006-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 Jenkins514e2582006-07-20 22:28:43 +0000188if($nickname eq ""){
189 die ("Please invoke NewNightlyTest.pl with command line option \"-nickname <nickname>\"");
190}
191
Patrick Jenkinsfe030d72006-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";
Patrick Jenkins169357e2006-07-23 21:38:07 +0000203my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz"
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000204my $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"; }
Patrick Jenkins169357e2006-07-23 21:38:07 +0000281 chdir($dir) || (print "Cannot change directory to: $name ($dir) " && return -1);
282 return 0;
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000283}
284
285#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
286#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
287sub ReadFile {
288 if (open (FILE, $_[0])) {
289 undef $/;
290 my $Ret = <FILE>;
291 close FILE;
292 $/ = '\n';
293 return $Ret;
294 } else {
Patrick Jenkins7267bd62006-07-10 18:35:41 +0000295 print "Could not open file '$_[0]' for reading!\n";
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000296 return "";
297 }
298}
299
300#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
301#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
302sub WriteFile { # (filename, contents)
Patrick Jenkins7267bd62006-07-10 18:35:41 +0000303 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n";
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000304 print FILE $_[1];
305 close FILE;
306}
307
308#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
309#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310sub CopyFile { #filename, newfile
311 my ($file, $newfile) = @_;
312 chomp($file);
313 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
314 copy($file, $newfile);
315}
316
317#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
318#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
319sub AddRecord {
320 my ($Val, $Filename,$WebDir) = @_;
321 my @Records;
322 if (open FILE, "$WebDir/$Filename") {
323 @Records = grep !/$DATE/, split "\n", <FILE>;
324 close FILE;
325 }
326 push @Records, "$DATE: $Val";
327 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
328}
329
330#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331#
332# FormatTime - Convert a time from 1m23.45 into 83.45
333#
334#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
335sub FormatTime {
336 my $Time = shift;
337 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
338 $Time = sprintf("%7.4f", $1*60.0+$2);
339 }
340 return $Time;
341}
342
343#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
345sub GetDejagnuTestResults { # (filename, log)
346 my ($filename, $DejagnuLog) = @_;
347 my @lines;
348 my $firstline;
349 $/ = "\n"; #Make sure we're going line at a time.
350
351 print "DEJAGNU TEST RESULTS:\n";
352
353 if (open SRCHFILE, $filename) {
354 # Process test results
355 my $first_list = 1;
356 my $should_break = 1;
357 my $nocopy = 0;
358 my $readingsum = 0;
359 while ( <SRCHFILE> ) {
360 if ( length($_) > 1 ) {
361 chomp($_);
362 if ( m/^XPASS:/ || m/^FAIL:/ ) {
363 $nocopy = 0;
364 if ( $first_list ) {
365 push(@lines, "UNEXPECTED TEST RESULTS\n");
366 $first_list = 0;
367 $should_break = 1;
368 push(@lines, "$_\n");
369 print " $_\n";
370 } else {
371 push(@lines, "$_\n");
372 print " $_\n";
373 }
374 } #elsif ( m/Summary/ ) {
375 # if ( $first_list ) {
376 # push(@lines, "PERFECT!");
377 # print " PERFECT!\n";
378 # } else {
379 # push(@lines, "</li></ol>\n");
380 # }
381 # push(@lines, "STATISTICS\n");
382 # print "\nDEJAGNU STATISTICS:\n";
383 # $should_break = 0;
384 # $nocopy = 0;
385 # $readingsum = 1;
386 #}
387 elsif ( $readingsum ) {
388 push(@lines,"$_\n");
389 print " $_\n";
390 }
391
392 }
393 }
394 }
395 close SRCHFILE;
396
397 my $content = join("", @lines);
398 return $content;
399}
400
401
402#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
403#
404# This function acts as a mini web browswer submitting data
405# to our central server via the post method
406#
407#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
408sub SendData{
409 $host = $_[0];
410 $file = $_[1];
411 $variables=$_[2];
412
413 $port=80;
414 $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n";
Patrick Jenkinsadea55e2006-07-17 16:41:19 +0000415 socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or
416 die "Bad socket\n";
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000417 connect SOCK, $socketaddr or die "Bad connection\n";
418 select((select(SOCK), $| = 1)[0]);
419
420 #creating content here
421 my $content;
422 foreach $key (keys (%$variables)){
423 $value = $variables->{$key};
424 $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
425 $content .= "$key=$value&";
426 }
427
428 $length = length($content);
429
430 my $send= "POST $file HTTP/1.0\n";
431 $send.= "Content-Type: application/x-www-form-urlencoded\n";
432 $send.= "Content-length: $length\n\n";
433 $send.= "$content";
434
435 print SOCK $send;
436 my $result;
437 while(<SOCK>){
438 $result .= $_;
439 }
440 close(SOCK);
441
442 my $sentdata="";
Patrick Jenkins4c4e3562006-07-07 21:40:34 +0000443 foreach $x (keys (%$variables)){
Patrick Jenkins7267bd62006-07-10 18:35:41 +0000444 $value = $variables->{$x};
445 $sentdata.= "$x => $value\n";
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000446 }
447 WriteFile "$Prefix-sentdata.txt", $sentdata;
Patrick Jenkins4c4e3562006-07-07 21:40:34 +0000448
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000449
450 return $result;
451}
452
Patrick Jenkins215b48f2006-07-07 18:50:51 +0000453##############################################################
454#
455# Getting Start timestamp
456#
457##############################################################
Patrick Jenkinsb67e1182006-07-21 21:43:09 +0000458$starttime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000459
460##############################################################
461#
462# Create the CVS repository directory
463#
464##############################################################
465if (!$NOCHECKOUT) {
466 if (-d $BuildDir) {
467 if (!$NOREMOVE) {
Patrick Jenkins514e2582006-07-20 22:28:43 +0000468 if ( $VERBOSE ){
469 print "Build directory exists! Removing it\n";
470 }
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000471 system "rm -rf $BuildDir";
472 } else {
473 die "CVS checkout directory $BuildDir already exists!";
474 }
475 }
476 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
477}
478ChangeDir( $BuildDir, "CVS checkout directory" );
479
480
481##############################################################
482#
483# Check out the llvm tree, saving CVS messages to the cvs log...
484#
485##############################################################
486my $CVSOPT = "";
487# Use compression if going over ssh.
488$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
489my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
490if (!$NOCHECKOUT) {
491 if ( $VERBOSE )
492 {
493 print "CHECKOUT STAGE:\n";
494 print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) > $CVSLog 2>&1\n";
495 }
496 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
497 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
498 ChangeDir( $BuildDir , "CVS Checkout directory") ;
499}
500ChangeDir( "llvm" , "llvm source directory") ;
501if (!$NOCHECKOUT) {
502 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
503 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
504}
505
506##############################################################
507#
508# Get some static statistics about the current state of CVS
509#
510# This can probably be put on the server side
511#
512##############################################################
513my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
514my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`;
515my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`;
516my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
517
518my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
519my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
520my $LOC = `utils/countloc.sh`;
521
522##############################################################
523#
524# Extract some information from the CVS history... use a hash so no duplicate
525# stuff is stored. This gets the history from the previous days worth
526# of cvs activit and parses it.
527#
528##############################################################
529
530my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
531
532if(!$NOCVSSTATS){
533
534if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
535@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
536#print join "\n", @CVSHistory; print "\n";
537
538my $DateRE = '[-/:0-9 ]+\+[0-9]+';
539
540# Loop over every record from the CVS history, filling in the hashes.
541foreach $File (@CVSHistory) {
542 my ($Type, $Date, $UID, $Rev, $Filename);
543 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
544 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
545 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
546 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
547 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
548 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
549 } else {
550 print "UNMATCHABLE: $File\n";
551 next;
552 }
553 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
554
555 if ($Filename =~ /^llvm/) {
556 if ($Type eq 'M') { # Modified
557 $ModifiedFiles{$Filename} = 1;
558 $UsersCommitted{$UID} = 1;
559 } elsif ($Type eq 'A') { # Added
Patrick Jenkins4bde3bc2006-07-13 16:56:48 +0000560 $AddedFiles{$Filename} = 1;
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000561 $UsersCommitted{$UID} = 1;
562 } elsif ($Type eq 'R') { # Removed
563 $RemovedFiles{$Filename} = 1;
564 $UsersCommitted{$UID} = 1;
565 } else {
566 $UsersUpdated{$UID} = 1;
567 }
568 }
569}
570
571my $TestError = 1;
572
573}#!NOCVSSTATS
574
575my $CVSAddedFiles = join "\n", sort keys %AddedFiles;
576my $CVSModifiedFiles = join "\n", sort keys %ModifiedFiles;
577my $CVSRemovedFiles = join "\n", sort keys %RemovedFiles;
578my $UserCommitList = join "\n", sort keys %UsersCommitted;
579my $UserUpdateList = join "\n", sort keys %UsersUpdated;
580
581##############################################################
582#
583# Build the entire tree, saving build messages to the build log
584#
585##############################################################
586if (!$NOCHECKOUT && !$NOBUILD) {
Patrick Jenkins4bde3bc2006-07-13 16:56:48 +0000587 my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
Patrick Jenkinsfcf207b2006-07-22 00:00:08 +0000588 if ( $VERBOSE ){
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000589 print "CONFIGURE STAGE:\n";
590 print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1\n";
591 }
592 system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
593 if ( $VERBOSE )
594 {
595 print "BUILD STAGE:\n";
596 print "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1\n";
597 }
598 # Build the entire tree, capturing the output into $BuildLog
599 system "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1";
600}
601
602
603##############################################################
604#
605# Get some statistics about the build...
606#
607##############################################################
608#this can de done on server
609#my @Linked = split '\n', `grep Linking $BuildLog`;
610#my $NumExecutables = scalar(grep(/executable/, @Linked));
611#my $NumLibraries = scalar(grep(!/executable/, @Linked));
612#my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
613
614
615my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
616my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
617my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
618my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
619
620$ConfigTime=-1 unless $ConfigTime;
621$ConfigWallTime=-1 unless $ConfigWallTime;
622
623my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
624my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
625my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
626my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
627
628$BuildTime=-1 unless $BuildTime;
629$BuildWallTime=-1 unless $BuildWallTime;
630
631my $BuildError = 0, $BuildStatus = "OK";
632if($NOBUILD){
633 $BuildStatus = "Skipped by user";
634 $BuildError = 1;
635}
636elsif (`grep '^make[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
637 `grep '^make: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
638 $BuildStatus = "Error: compilation aborted";
639 $BuildError = 1;
640 print "\n***ERROR BUILDING TREE\n\n";
641}
642if ($BuildError) { $NODEJAGNU=1; }
643
Patrick Jenkins169357e2006-07-23 21:38:07 +0000644my $a_file_sizes="";
645my $o_file_sizes="";
646if(!$BuildError){
647 if ( $VERBOSE ){
648 print "Organizing size of .o and .a files\n";
649 }
650 ChangeDir( "$BuildDir/llvm", "Build Directory" );
651 $afiles = `find . -iname '*.a' -ls`;
652 $ofiles = `find . -iname '*.o' -ls`;
653 @AFILES = split "\n", $afiles;
654 $a_file_sizes="";
655 foreach $x (@AFILES){
656 $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
657 $a_file_sizes.="$1 $2\n";
658 }
659 @OFILES = split "\n", $ofiles;
660 $o_file_sizes="";
661 foreach $x (@OFILES){
662 $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
663 $o_file_sizes.="$1 $2\n";
664 }
665}
666else{
667 $a_file_sizes="No data due to a bad build.";
668 $o_file_sizes="No data due to a bad build.";
669}
670
671
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000672##############################################################
673#
674# Running dejagnu tests
675#
676##############################################################
677my $DejangnuTestResults; # String containing the results of the dejagnu
678my $dejagnu_output = "$DejagnuTestsLog";
679if(!$NODEJAGNU) {
680 if($VERBOSE)
681 {
682 print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n";
683 print "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1\n";
684 }
685
686 #Run the feature and regression tests, results are put into testrun.sum
687 #Full log in testrun.log
688 system "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1";
689
690 #Copy the testrun.log and testrun.sum to our webdir
691 CopyFile("test/testrun.log", $DejagnuLog);
692 CopyFile("test/testrun.sum", $DejagnuSum);
693 #can be done on server
694 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
695 $unexpfail_tests = $DejagnuTestResults;
696}
697#Extract time of dejagnu tests
698my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
699my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
700$DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
701$DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
702$DejagnuTestResults = "Dejagnu skipped by user choice." unless $DejagnuTestResults;
703$DejagnuTime = "0.0" unless $DejagnuTime;
704$DejagnuWallTime = "0.0" unless $DejagnuWallTime;
705
706if ($DEBUG) {
707 print $DejagnuTestResults;
708}
709
710##############################################################
711#
712# Get warnings from the build
713#
714##############################################################
715if(!$NODEJAGNU){
716
717if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
718my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
719my @Warnings;
720my $CurDir = "";
721
722foreach $Warning (@Warn) {
723 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
724 $CurDir = $1; # Keep track of directory warning is in...
725 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
726 $CurDir = $1;
727 }
728 } else {
729 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
730 }
731}
732my $WarningsFile = join "\n", @Warnings;
733$WarningsFile =~ s/:[0-9]+:/::/g;
734
735# Emit the warnings file, so we can diff...
736WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
Patrick Jenkinsc6d945f2006-07-06 22:32:15 +0000737my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000738
739# Output something to stdout if something has changed
740#print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
741#print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
742
743#my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade
744#my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade
745
746} #endif !NODEGAGNU
747
748##############################################################
749#
750# If we built the tree successfully, run the nightly programs tests...
751#
752# A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" "External")
753#
754##############################################################
755sub TestDirectory {
756 my $SubDir = shift;
757
Patrick Jenkins169357e2006-07-23 21:38:07 +0000758 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" ) || return ("", "");
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000759
760 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
761 #my $ProgramTestLog = "$Prefix-MultiSource-ProgramTest.txt"; #CHANGE ME!
762
763 # Run the programs tests... creating a report.nightly.csv file
764 if (!$NOTEST) {
765 print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
766 . "TEST=nightly > $ProgramTestLog 2>&1\n";
767 system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
768 . "TEST=nightly > $ProgramTestLog 2>&1";
769 $llcbeta_options=`make print-llcbeta-option`;
770 }
771
772 my $ProgramsTable;
773 if (`grep '^make[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
774 $TestError = 1;
775 $ProgramsTable="Error running test $SubDir\n";
776 print "ERROR TESTING\n";
777 } elsif (`grep '^make[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
778 $TestError = 1;
779 $ProgramsTable="Makefile error running tests $SubDir!\n";
780 print "ERROR TESTING\n";
781 } else {
782 $TestError = 0;
783
784 #
785 # Create a list of the tests which were run...
786 #
787 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
788 . "| sort > $Prefix-multisourceprogramstable.txt";
789 }
790 $ProgramsTable = ReadFile "report.nightly.csv";
791
792 ChangeDir( "../../..", "Programs Test Parent Directory" );
793 return ($ProgramsTable, $llcbeta_options);
794}
795
796$patrickjenkins=1;
797if(!$patrickjenkins){
798 if ( $VERBOSE ) {
799 print "Modified Multisource Olden test stage\n";
800 }
801 ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource/");
802 ChangeDir( "../../..", "Programs Test Parent Directory" );
803
804
805 WriteFile "$WebDir/multisourceprogramstable.txt", $MultiSourceProgramsTable;
806}
807if (!$BuildError && $patrickjenkins) {
808 if ( $VERBOSE ) {
809 print "SingleSource TEST STAGE\n";
810 }
Patrick Jenkins4bde3bc2006-07-13 16:56:48 +0000811 ($SingleSourceProgramsTable, $llcbeta_options) = TestDirectory("SingleSource");
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000812 WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
813 if ( $VERBOSE ) {
814 print "MultiSource TEST STAGE\n";
815 }
Patrick Jenkins4bde3bc2006-07-13 16:56:48 +0000816 ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource");
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000817 WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable;
818 if ( ! $NOEXTERNALS ) {
819 if ( $VERBOSE ) {
820 print "External TEST STAGE\n";
821 }
Patrick Jenkins0b7ae542006-07-13 16:58:42 +0000822 ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External");
Patrick Jenkins7b4bb602006-07-10 16:36:19 +0000823 WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000824 system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
825 " $Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt";
826 } else {
827 $ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
828 if ( $VERBOSE ) {
829 print "External TEST STAGE SKIPPED\n";
830 }
831 system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
832 " | sort > $Prefix-Tests.txt";
833 }
834 WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000835}
836
837##############################################################
838#
839#
840# gathering tests added removed broken information here
841#
842#
843##############################################################
Patrick Jenkins25c2a2f2006-07-21 21:58:06 +0000844my $dejagnu = ReadFile $DejagnuSum;
845my @DEJAGNU = split "\n", $dejagnu;
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000846
Patrick Jenkins65c7ea02006-07-19 17:52:51 +0000847my $passes="",
848my $fails="";
849my $xfails="";
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000850
Patrick Jenkins25c2a2f2006-07-21 21:58:06 +0000851if(!$NODEJAGNU) {
852 for($x=0; $x<@DEJAGNU; $x++){
853 if($DEJAGNU[$x] =~ m/^PASS:/){
854 $passes.="$DEJAGNU[$x]\n";
855 }
856 elsif($DEJAGNU[$x] =~ m/^FAIL:/){
857 $fails.="$DEJAGNU[$x]\n";
858 }
859 elsif($DEJAGNU[$x] =~ m/^XFAIL:/){
860 $xfails.="$DEJAGNU[$x]\n";
861 }
Patrick Jenkins65c7ea02006-07-19 17:52:51 +0000862 }
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000863}
864
Patrick Jenkins65c7ea02006-07-19 17:52:51 +0000865# my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
866#
867# if ($TestError) {
868# $TestsAdded = "<b>error testing</b><br>";
869# $TestsRemoved = "<b>error testing</b><br>";
870# $TestsFixed = "<b>error testing</b><br>";
871# $TestsBroken = "<b>error testing</b><br>";
872# } else {
873# my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
874#
875# my @RawTestsAddedArray = split '\n', $RTestsAdded;
876# my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
877#
878# my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
879# @RawTestsRemovedArray;
880# my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
881# @RawTestsAddedArray;
882#
883# foreach $Test (keys %NewTests) {
884# if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
885# $TestsAdded = "$TestsAdded$Test\n";
886# } else {
887# if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
888# $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
889# } else {
890# $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
891# }
892# }
893# }
894# foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
895# $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
896# }
897#
898# #print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
899# #print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
900# #print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
901# #print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
902#
903# #$TestsAdded = AddPreTag $TestsAdded;
904# #$TestsRemoved = AddPreTag $TestsRemoved;
905# #$TestsFixed = AddPreTag $TestsFixed;
906# #$TestsBroken = AddPreTag $TestsBroken;
907# }
908
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000909##############################################################
910#
911# If we built the tree successfully, runs of the Olden suite with
912# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
913#
914##############################################################
915if (!$BuildError) {
916 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
917 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
918 $MachCodeSize) = ("","","","","","","");
919 if (!$NORUNNINGTESTS) {
920 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
921 "Olden Test Directory");
922
923 # Clean out previous results...
924 system "$NICE make $MAKEOPTS clean > /dev/null 2>&1";
925
926 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
927 # GET_STABLE_NUMBERS enabled!
928 if( $VERBOSE ) { print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
929 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1\n"; }
930 system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
931 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
932 system "cp report.nightly.csv $OldenTestsLog";
933 } #else {
934 #system "gunzip ${OldenTestsLog}.gz";
935 #}
936
937 # Now we know we have $OldenTestsLog as the raw output file. Split
938 # it up into records and read the useful information.
939 #my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
940 #shift @Records; # Delete the first (garbage) record
941
942 # Loop over all of the records, summarizing them into rows for the running
943 # totals file.
944 #my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
945 #foreach $Rec (@Records) {
946 #my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
947 #my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
948 #my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
949 #my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
950 #my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
951 #my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
952
953 #$NATTime .= " " . FormatTime($rNATTime);
954 #$CBETime .= " " . FormatTime($rCBETime);
955 #$LLCTime .= " " . FormatTime($rLLCTime);
956 #$JITTime .= " " . FormatTime($rJITTime);
957 #$OptTime .= " $rOptTime";
958 #$BytecodeSize .= " $rBytecodeSize";
959 #}
960 #
961 # Now that we have all of the numbers we want, add them to the running totals
962 # files.
963 #AddRecord($NATTime, "running_Olden_nat_time.txt", $WebDir);
964 #AddRecord($CBETime, "running_Olden_cbe_time.txt", $WebDir);
965 #AddRecord($LLCTime, "running_Olden_llc_time.txt", $WebDir);
966 #AddRecord($JITTime, "running_Olden_jit_time.txt", $WebDir);
967 #AddRecord($OptTime, "running_Olden_opt_time.txt", $WebDir);
968 #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir);
969}
970
Patrick Jenkins215b48f2006-07-07 18:50:51 +0000971##############################################################
972#
973# Getting end timestamp
974#
975##############################################################
Patrick Jenkinsb67e1182006-07-21 21:43:09 +0000976$endtime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkins215b48f2006-07-07 18:50:51 +0000977
Patrick Jenkinsfe030d72006-07-06 21:19:32 +0000978
979##############################################################
980#
981# Place all the logs neatly into one humungous file
982#
983##############################################################
984
985if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
986
987$machine_data = "uname: ".`uname -a`.
988 "hardware: ".`uname -m`.
989 "os: ".`uname -sr`.
990 "name: ".`uname -n`.
991 "date: ".`date \"+20%y-%m-%d\"`.
992 "time: ".`date +\"%H:%M:%S\"`;
993
994my @CVS_DATA;
995my $cvs_data;
996@CVS_DATA = ReadFile "$CVSLog";
997$cvs_data = join("\n", @CVS_DATA);
998
999my @BUILD_DATA;
1000my $build_data;
1001@BUILD_DATA = ReadFile "$BuildLog";
1002$build_data = join("\n", @BUILD_DATA);
1003
1004my @DEJAGNU_LOG;
1005my @DEJAGNU_SUM;
1006my $dejagnutests_log;
1007my $dejagnutests_sum;
1008@DEJAGNU_LOG = ReadFile "$DejagnuLog";
1009@DEJAGNU_SUM = ReadFile "$DejagnuSum";
1010$dejagnutests_log = join("\n", @DEJAGNU_LOG);
1011$dejagnutests_sum = join("\n", @DEJAGNU_SUM);
1012
1013my @DEJAGNULOG_FULL;
1014my $dejagnulog_full;
1015@DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog";
1016$dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
1017
Patrick Jenkinsba204712006-07-20 16:54:43 +00001018my $gcc_version_long="";
Patrick Jenkinsf2637042006-07-18 17:21:30 +00001019if($GCCPATH ne ""){
Patrick Jenkins1b629442006-07-18 21:21:53 +00001020 $gcc_version_long = `$GCCPATH/gcc --version`;
Patrick Jenkinsf2637042006-07-18 17:21:30 +00001021 print "$GCCPATH/gcc --version\n";
Patrick Jenkins79fbf7f2006-07-14 20:44:09 +00001022}
1023else{
Patrick Jenkins1b629442006-07-18 21:21:53 +00001024 $gcc_version_long = `gcc --version`;
Patrick Jenkinsf2637042006-07-18 17:21:30 +00001025 print "gcc --version\n";
Patrick Jenkins79fbf7f2006-07-14 20:44:09 +00001026}
Patrick Jenkins1b629442006-07-18 21:21:53 +00001027@GCC_VERSION = split '\n', $gcc_version_long;
Patrick Jenkinsfe030d72006-07-06 21:19:32 +00001028my $gcc_version = $GCC_VERSION[0];
1029
Patrick Jenkins65c7ea02006-07-19 17:52:51 +00001030$all_tests = ReadFile, "$Prefix-Tests.txt";
1031
Patrick Jenkinsfe030d72006-07-06 21:19:32 +00001032##############################################################
1033#
1034# Send data via a post request
1035#
1036##############################################################
1037
1038if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
1039
1040
1041my $host = "llvm.org";
1042my $file = "/nightlytest/NightlyTestAccept.cgi";
1043my %hash_of_data = ('machine_data' => $machine_data,
Patrick Jenkins65c7ea02006-07-19 17:52:51 +00001044 'build_data' => $build_data,
1045 'gcc_version' => $gcc_version,
1046 'nickname' => $nickname,
1047 'dejagnutime_wall' => $DejagnuWallTime,
1048 'dejagnutime_cpu' => $DejagnuTime,
1049 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall,
1050 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU,
1051 'configtime_wall' => $ConfigWallTime,
1052 'configtime_cpu'=> $ConfigTime,
1053 'buildtime_wall' => $BuildWallTime,
1054 'buildtime_cpu' => $BuildTime,
1055 'warnings' => $WarningsFile,
1056 'cvsusercommitlist' => $UserCommitList,
1057 'cvsuserupdatelist' => $UserUpdateList,
1058 'cvsaddedfiles' => $CVSAddedFiles,
1059 'cvsmodifiedfiles' => $CVSModifiedFiles,
1060 'cvsremovedfiles' => $CVSRemovedFiles,
1061 'lines_of_code' => $LOC,
1062 'cvs_file_count' => $NumFilesInCVS,
1063 'cvs_dir_count' => $NumDirsInCVS,
1064 'buildstatus' => $BuildStatus,
1065 'singlesource_programstable' => $SingleSourceProgramsTable,
1066 'multisource_programstable' => $MultiSourceProgramsTable,
1067 'externalsource_programstable' => $ExternalProgramsTable,
1068 'llcbeta_options' => $multisource_llcbeta_options,
1069 'warnings_removed' => $WarningsRemoved,
1070 'warnings_added' => $WarningsAdded,
1071 'passing_tests' => $passes,
1072 'expfail_tests' => $xfails,
1073 'unexpfail_tests' => $fails,
1074 'all_tests' => $all_tests,
1075 'new_tests' => "",
1076 'removed_tests' => "",
1077 'dejagnutests_log' => $dejagnutests_log,
1078 'dejagnutests_sum' => $dejagnutests_sum,
1079 'starttime' => $starttime,
Patrick Jenkins6412f722006-07-21 19:51:40 +00001080 'endtime' => $endtime,
1081 'o_file_sizes' => $o_file_sizes,
1082 'a_file_sizes' => $a_file_sizes);
Patrick Jenkinsfe030d72006-07-06 21:19:32 +00001083
1084$TESTING = 0;
1085
1086if($TESTING){
1087 print "============================\n";
1088 foreach $x(keys %hash_of_data){
1089 print "$x => $hash_of_data{$x}\n";
1090 }
1091}
1092else{
1093 my $response = SendData $host,$file,\%hash_of_data;
1094 print "============================\n$response";
1095}
1096
1097##############################################################
1098#
1099# Remove the cvs tree...
1100#
1101##############################################################
1102system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Patrick Jenkins4bde3bc2006-07-13 16:56:48 +00001103system ( "$NICE rm -rf $WebDir") if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);
Patrick Jenkinsfe030d72006-07-06 21:19:32 +00001104
1105