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