blob: 59b460bdf62c7928d9f92cc6044f7ce82ac6e5cc [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 Jenkins10d0e342006-07-27 01:17:17 +000055# -use-gmake Use gmake instead of the default make command to build
56# llvm and run tests.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000057#
58# ---------------- Options to configure llvm-test ----------------------------
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +000059# -extraflags Next argument specifies extra options that are passed to
60# compile the tests.
61# -noexternals Do not run the external tests (for cases where povray
62# or SPEC are not installed)
63# -with-externals Specify a directory where the external tests are located.
Patrick Jenkins0e316b42006-07-06 21:19:32 +000064#
65# CVSROOT is the CVS repository from which the tree will be checked out,
66# specified either in the full :method:user@host:/dir syntax, or
67# just /dir if using a local repo.
68# BUILDDIR is the directory where sources for this test run will be checked out
69# AND objects for this test run will be built. This directory MUST NOT
70# exist before the script is run; it will be created by the cvs checkout
71# process and erased (unless -noremove is specified; see above.)
72# WEBDIR is the directory into which the test results web page will be written,
73# AND in which the "index.html" is assumed to be a symlink to the most recent
74# copy of the results. This directory will be created if it does not exist.
75# LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
76# to. This is the same as you would have for a normal LLVM build.
77#
78##############################################################
79#
80# Getting environment variables
81#
82##############################################################
83my $HOME = $ENV{'HOME'};
84my $CVSRootDir = $ENV{'CVSROOT'};
85 $CVSRootDir = "/home/vadve/shared/PublicCVS"
86 unless $CVSRootDir;
87my $BuildDir = $ENV{'BUILDDIR'};
88 $BuildDir = "$HOME/buildtest"
89 unless $BuildDir;
90my $WebDir = $ENV{'WEBDIR'};
91 $WebDir = "$HOME/cvs/testresults-X86"
92 unless $WebDir;
93
94##############################################################
95#
96# Calculate the date prefix...
97#
98##############################################################
99@TIME = localtime;
100my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3];
101my $DateString = strftime "%B %d, %Y", localtime;
102my $TestStartTime = gmtime() . "GMT<br>" . localtime() . " (local)";
103
104##############################################################
105#
106# Parse arguments...
107#
108##############################################################
109$CONFIGUREARGS="";
Patrick Jenkinsa95958c2006-07-21 01:39:42 +0000110$nickname="";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000111$NOTEST=0;
112$NORUNNINGTESTS=0;
Patrick Jenkins10d0e342006-07-27 01:17:17 +0000113$MAKECMD="make";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000114
115while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
116 shift;
117 last if /^--$/; # Stop processing arguments on --
118
119 # List command line options here...
120 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
121 if (/^-nocvsstats$/) { $NOCVSSTATS = 1; next; }
122 if (/^-noremove$/) { $NOREMOVE = 1; next; }
Patrick Jenkins5053e152006-07-07 17:31:38 +0000123 if (/^-noremoveresults$/) { $NOREMOVERESULTS = 1; next; }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000124 if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; }
125 if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
126 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000127 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
Patrick Jenkins10d0e342006-07-27 01:17:17 +0000128 "OPTIMIZE_OPTION=-O2";
129 $BUILDTYPE="release"; next; }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000130 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
131 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
132 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
133 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
134 $CONFIGUREARGS .= " --disable-jit"; next; }
135 if (/^-verbose$/) { $VERBOSE = 1; next; }
136 if (/^-debug$/) { $DEBUG = 1; next; }
137 if (/^-nice$/) { $NICE = "nice "; next; }
138 if (/^-f2c$/) {
139 $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
140 }
141 if (/^-with-externals/) {
142 $CONFIGUREARGS .= "--with-externals=$ARGV[0]"; shift; next;
143 }
144 if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; }
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000145 if (/^-gccpath/) { $CONFIGUREARGS .=
146 " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++";
Patrick Jenkins9536ec72006-07-14 20:44:09 +0000147 $GCCPATH=$ARGV[0];
148 shift;
149 next;}
Patrick Jenkinsbe254602006-07-18 17:21:30 +0000150 else{ $GCCPATH=""; }
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000151 if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
152 else{ $CVSCOOPT="";}
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000153 if (/^-target/) {
154 $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next;
155 }
156 if (/^-cflags/) {
157 $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; shift; next;
158 }
159 if (/^-cxxflags/) {
160 $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; shift; next;
161 }
162 if (/^-ldflags/) {
163 $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; shift; next;
164 }
165 if (/^-compileflags/) {
166 $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next;
167 }
Patrick Jenkins10d0e342006-07-27 01:17:17 +0000168 if (/^-use-gmake/) {
Patrick Jenkins9f5ea5d2006-07-27 01:24:35 +0000169 $MAKECMD = "gmake"; shift; next;
Patrick Jenkins10d0e342006-07-27 01:17:17 +0000170 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000171 if (/^-extraflags/) {
172 $PROGTESTOPTS .= " EXTRA_FLAGS=\'$ARGV[0]\'"; shift; next;
173 }
174 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
175 if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
176 if (/^-nobuild$/) { $NOBUILD = 1; next; }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000177 print "Unknown option: $_ : ignoring!\n";
178}
179
180if ($ENV{'LLVMGCCDIR'}) {
181 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
182}
183if ($CONFIGUREARGS !~ /--disable-jit/) {
184 $CONFIGUREARGS .= " --enable-jit";
185}
186
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000187
188if (@ARGV != 0 and @ARGV != 3){
189 foreach $x (@ARGV){
190 print "$x\n";
191 }
192 print "Must specify 0 or 3 options!";
193}
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000194
195if (@ARGV == 3) {
196 $CVSRootDir = $ARGV[0];
197 $BuildDir = $ARGV[1];
198 $WebDir = $ARGV[2];
199}
200
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000201if($CVSRootDir eq "" or
202 $BuildDir eq "" or
203 $WebDir eq ""){
204 die("please specify a cvs root directory, a build directory, and a ".
205 "web directory");
206 }
207
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000208if($nickname eq ""){
209 die ("Please invoke NewNightlyTest.pl with command line option \"-nickname <nickname>\"");
210}
Patrick Jenkins10d0e342006-07-27 01:17:17 +0000211
212if($BUILDTYPE ne "release"){
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000213 $BUILDTYPE = "debug";
214}
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000215
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000216##############################################################
217#
218#define the file names we'll use
219#
220##############################################################
221my $Prefix = "$WebDir/$DATE";
222my $BuildLog = "$Prefix-Build-Log.txt";
223my $CVSLog = "$Prefix-CVS-Log.txt";
224my $OldenTestsLog = "$Prefix-Olden-tests.txt";
225my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
226my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000227my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000228my $DejagnuLog = "$Prefix-Dejagnu-testrun.log";
229my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum";
230my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt";
231if (! -d $WebDir) {
232 mkdir $WebDir, 0777;
233 warn "$WebDir did not exist; creating it.\n";
234}
235
236if ($VERBOSE) {
237 print "INITIALIZED\n";
238 print "CVS Root = $CVSRootDir\n";
239 print "BuildDir = $BuildDir\n";
240 print "WebDir = $WebDir\n";
241 print "Prefix = $Prefix\n";
242 print "CVSLog = $CVSLog\n";
243 print "BuildLog = $BuildLog\n";
244}
245
246##############################################################
247#
248# Helper functions
249#
250##############################################################
251sub GetDir {
252 my $Suffix = shift;
253 opendir DH, $WebDir;
254 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
255 closedir DH;
256 return @Result;
257}
258
259#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
260#
261# DiffFiles - Diff the current version of the file against the last version of
262# the file, reporting things added and removed. This is used to report, for
263# example, added and removed warnings. This returns a pair (added, removed)
264#
265#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
266sub DiffFiles {
267 my $Suffix = shift;
268 my @Others = GetDir $Suffix;
269 if (@Others == 0) { # No other files? We added all entries...
270 return (`cat $WebDir/$DATE$Suffix`, "");
271 }
272 # Diff the files now...
273 my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`;
274 my $Added = join "\n", grep /^</, @Diffs;
275 my $Removed = join "\n", grep /^>/, @Diffs;
276 $Added =~ s/^< //gm;
277 $Removed =~ s/^> //gm;
278 return ($Added, $Removed);
279}
280
281#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
282#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
283sub GetRegex { # (Regex with ()'s, value)
284 $_[1] =~ /$_[0]/m;
285 if (defined($1)) {
286 return $1;
287 }
288 return "0";
289}
290
291#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
293sub GetRegexNum {
294 my ($Regex, $Num, $Regex2, $File) = @_;
295 my @Items = split "\n", `grep '$Regex' $File`;
296 return GetRegex $Regex2, $Items[$Num];
297}
298
299#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
301sub ChangeDir { # directory, logical name
302 my ($dir,$name) = @_;
303 chomp($dir);
304 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
Patrick Jenkins1049f402006-07-23 21:38:07 +0000305 chdir($dir) || (print "Cannot change directory to: $name ($dir) " && return -1);
306 return 0;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000307}
308
309#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
311sub ReadFile {
312 if (open (FILE, $_[0])) {
313 undef $/;
314 my $Ret = <FILE>;
315 close FILE;
316 $/ = '\n';
317 return $Ret;
318 } else {
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000319 print "Could not open file '$_[0]' for reading!\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000320 return "";
321 }
322}
323
324#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
325#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
326sub WriteFile { # (filename, contents)
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000327 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000328 print FILE $_[1];
329 close FILE;
330}
331
332#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
334sub CopyFile { #filename, newfile
335 my ($file, $newfile) = @_;
336 chomp($file);
337 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
338 copy($file, $newfile);
339}
340
341#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
342#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
343sub AddRecord {
344 my ($Val, $Filename,$WebDir) = @_;
345 my @Records;
346 if (open FILE, "$WebDir/$Filename") {
347 @Records = grep !/$DATE/, split "\n", <FILE>;
348 close FILE;
349 }
350 push @Records, "$DATE: $Val";
351 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
352}
353
354#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
355#
356# FormatTime - Convert a time from 1m23.45 into 83.45
357#
358#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
359sub FormatTime {
360 my $Time = shift;
361 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
362 $Time = sprintf("%7.4f", $1*60.0+$2);
363 }
364 return $Time;
365}
366
367#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
368#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
369sub GetDejagnuTestResults { # (filename, log)
370 my ($filename, $DejagnuLog) = @_;
371 my @lines;
372 my $firstline;
373 $/ = "\n"; #Make sure we're going line at a time.
374
375 print "DEJAGNU TEST RESULTS:\n";
376
377 if (open SRCHFILE, $filename) {
378 # Process test results
379 my $first_list = 1;
380 my $should_break = 1;
381 my $nocopy = 0;
382 my $readingsum = 0;
383 while ( <SRCHFILE> ) {
384 if ( length($_) > 1 ) {
385 chomp($_);
386 if ( m/^XPASS:/ || m/^FAIL:/ ) {
387 $nocopy = 0;
388 if ( $first_list ) {
389 push(@lines, "UNEXPECTED TEST RESULTS\n");
390 $first_list = 0;
391 $should_break = 1;
392 push(@lines, "$_\n");
393 print " $_\n";
394 } else {
395 push(@lines, "$_\n");
396 print " $_\n";
397 }
398 } #elsif ( m/Summary/ ) {
399 # if ( $first_list ) {
400 # push(@lines, "PERFECT!");
401 # print " PERFECT!\n";
402 # } else {
403 # push(@lines, "</li></ol>\n");
404 # }
405 # push(@lines, "STATISTICS\n");
406 # print "\nDEJAGNU STATISTICS:\n";
407 # $should_break = 0;
408 # $nocopy = 0;
409 # $readingsum = 1;
410 #}
411 elsif ( $readingsum ) {
412 push(@lines,"$_\n");
413 print " $_\n";
414 }
415
416 }
417 }
418 }
419 close SRCHFILE;
420
421 my $content = join("", @lines);
422 return $content;
423}
424
425
426#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
427#
428# This function acts as a mini web browswer submitting data
429# to our central server via the post method
430#
431#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
432sub SendData{
433 $host = $_[0];
434 $file = $_[1];
435 $variables=$_[2];
436
437 $port=80;
438 $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n";
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000439 socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or
440 die "Bad socket\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000441 connect SOCK, $socketaddr or die "Bad connection\n";
442 select((select(SOCK), $| = 1)[0]);
443
444 #creating content here
445 my $content;
446 foreach $key (keys (%$variables)){
447 $value = $variables->{$key};
448 $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
449 $content .= "$key=$value&";
450 }
451
452 $length = length($content);
453
454 my $send= "POST $file HTTP/1.0\n";
455 $send.= "Content-Type: application/x-www-form-urlencoded\n";
456 $send.= "Content-length: $length\n\n";
457 $send.= "$content";
458
459 print SOCK $send;
460 my $result;
461 while(<SOCK>){
462 $result .= $_;
463 }
464 close(SOCK);
465
466 my $sentdata="";
Patrick Jenkins19ecfb02006-07-07 21:40:34 +0000467 foreach $x (keys (%$variables)){
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000468 $value = $variables->{$x};
469 $sentdata.= "$x => $value\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000470 }
471 WriteFile "$Prefix-sentdata.txt", $sentdata;
Patrick Jenkins19ecfb02006-07-07 21:40:34 +0000472
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000473
474 return $result;
475}
476
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000477##############################################################
478#
479# Getting Start timestamp
480#
481##############################################################
Patrick Jenkins7ef934f2006-07-21 21:43:09 +0000482$starttime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000483
484##############################################################
485#
486# Create the CVS repository directory
487#
488##############################################################
489if (!$NOCHECKOUT) {
490 if (-d $BuildDir) {
491 if (!$NOREMOVE) {
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000492 if ( $VERBOSE ){
493 print "Build directory exists! Removing it\n";
494 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000495 system "rm -rf $BuildDir";
496 } else {
497 die "CVS checkout directory $BuildDir already exists!";
498 }
499 }
500 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
501}
502ChangeDir( $BuildDir, "CVS checkout directory" );
503
504
505##############################################################
506#
507# Check out the llvm tree, saving CVS messages to the cvs log...
508#
509##############################################################
510my $CVSOPT = "";
511# Use compression if going over ssh.
512$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
513my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
514if (!$NOCHECKOUT) {
515 if ( $VERBOSE )
516 {
517 print "CHECKOUT STAGE:\n";
518 print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) > $CVSLog 2>&1\n";
519 }
520 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
521 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
522 ChangeDir( $BuildDir , "CVS Checkout directory") ;
523}
524ChangeDir( "llvm" , "llvm source directory") ;
525if (!$NOCHECKOUT) {
526 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
527 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
528}
529
530##############################################################
531#
532# Get some static statistics about the current state of CVS
533#
534# This can probably be put on the server side
535#
536##############################################################
537my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
538my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`;
539my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`;
540my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
541
542my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
543my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
544my $LOC = `utils/countloc.sh`;
545
546##############################################################
547#
548# Extract some information from the CVS history... use a hash so no duplicate
549# stuff is stored. This gets the history from the previous days worth
550# of cvs activit and parses it.
551#
552##############################################################
553
554my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
555
556if(!$NOCVSSTATS){
557
558if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
559@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
560#print join "\n", @CVSHistory; print "\n";
561
562my $DateRE = '[-/:0-9 ]+\+[0-9]+';
563
564# Loop over every record from the CVS history, filling in the hashes.
565foreach $File (@CVSHistory) {
566 my ($Type, $Date, $UID, $Rev, $Filename);
567 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
568 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
569 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
570 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
571 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
572 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
573 } else {
574 print "UNMATCHABLE: $File\n";
575 next;
576 }
577 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
578
579 if ($Filename =~ /^llvm/) {
580 if ($Type eq 'M') { # Modified
581 $ModifiedFiles{$Filename} = 1;
582 $UsersCommitted{$UID} = 1;
583 } elsif ($Type eq 'A') { # Added
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000584 $AddedFiles{$Filename} = 1;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000585 $UsersCommitted{$UID} = 1;
586 } elsif ($Type eq 'R') { # Removed
587 $RemovedFiles{$Filename} = 1;
588 $UsersCommitted{$UID} = 1;
589 } else {
590 $UsersUpdated{$UID} = 1;
591 }
592 }
593}
594
595my $TestError = 1;
596
597}#!NOCVSSTATS
598
599my $CVSAddedFiles = join "\n", sort keys %AddedFiles;
600my $CVSModifiedFiles = join "\n", sort keys %ModifiedFiles;
601my $CVSRemovedFiles = join "\n", sort keys %RemovedFiles;
602my $UserCommitList = join "\n", sort keys %UsersCommitted;
603my $UserUpdateList = join "\n", sort keys %UsersUpdated;
604
605##############################################################
606#
607# Build the entire tree, saving build messages to the build log
608#
609##############################################################
610if (!$NOCHECKOUT && !$NOBUILD) {
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000611 my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
Patrick Jenkins1a61dc42006-07-22 00:00:08 +0000612 if ( $VERBOSE ){
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000613 print "CONFIGURE STAGE:\n";
614 print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1\n";
615 }
616 system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
617 if ( $VERBOSE )
618 {
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000619 print "BUILD STAGE:\n";
620 print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000621 }
622 # Build the entire tree, capturing the output into $BuildLog
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000623 system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000624}
625
626
627##############################################################
628#
629# Get some statistics about the build...
630#
631##############################################################
632#this can de done on server
633#my @Linked = split '\n', `grep Linking $BuildLog`;
634#my $NumExecutables = scalar(grep(/executable/, @Linked));
635#my $NumLibraries = scalar(grep(!/executable/, @Linked));
636#my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
637
638
639my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
640my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
641my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
642my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
643
644$ConfigTime=-1 unless $ConfigTime;
645$ConfigWallTime=-1 unless $ConfigWallTime;
646
647my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
648my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
649my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
650my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
651
652$BuildTime=-1 unless $BuildTime;
653$BuildWallTime=-1 unless $BuildWallTime;
654
655my $BuildError = 0, $BuildStatus = "OK";
656if($NOBUILD){
657 $BuildStatus = "Skipped by user";
658 $BuildError = 1;
659}
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000660elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
661 `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000662 $BuildStatus = "Error: compilation aborted";
663 $BuildError = 1;
664 print "\n***ERROR BUILDING TREE\n\n";
665}
666if ($BuildError) { $NODEJAGNU=1; }
667
Patrick Jenkins1049f402006-07-23 21:38:07 +0000668my $a_file_sizes="";
669my $o_file_sizes="";
670if(!$BuildError){
671 if ( $VERBOSE ){
672 print "Organizing size of .o and .a files\n";
673 }
674 ChangeDir( "$BuildDir/llvm", "Build Directory" );
675 $afiles = `find . -iname '*.a' -ls`;
676 $ofiles = `find . -iname '*.o' -ls`;
677 @AFILES = split "\n", $afiles;
678 $a_file_sizes="";
679 foreach $x (@AFILES){
680 $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000681 $a_file_sizes.="$1 $2 $BUILDTYPE\n";
Patrick Jenkins1049f402006-07-23 21:38:07 +0000682 }
683 @OFILES = split "\n", $ofiles;
684 $o_file_sizes="";
685 foreach $x (@OFILES){
686 $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000687 $o_file_sizes.="$1 $2 $BUILDTYPE\n";
Patrick Jenkins1049f402006-07-23 21:38:07 +0000688 }
689}
690else{
691 $a_file_sizes="No data due to a bad build.";
692 $o_file_sizes="No data due to a bad build.";
693}
694
695
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000696##############################################################
697#
698# Running dejagnu tests
699#
700##############################################################
701my $DejangnuTestResults; # String containing the results of the dejagnu
702my $dejagnu_output = "$DejagnuTestsLog";
703if(!$NODEJAGNU) {
704 if($VERBOSE)
705 {
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000706 print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n";
707 print "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000708 }
709
710 #Run the feature and regression tests, results are put into testrun.sum
711 #Full log in testrun.log
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000712 system "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000713
714 #Copy the testrun.log and testrun.sum to our webdir
715 CopyFile("test/testrun.log", $DejagnuLog);
716 CopyFile("test/testrun.sum", $DejagnuSum);
717 #can be done on server
718 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
719 $unexpfail_tests = $DejagnuTestResults;
720}
721#Extract time of dejagnu tests
722my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
723my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
724$DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
725$DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
726$DejagnuTestResults = "Dejagnu skipped by user choice." unless $DejagnuTestResults;
727$DejagnuTime = "0.0" unless $DejagnuTime;
728$DejagnuWallTime = "0.0" unless $DejagnuWallTime;
729
730if ($DEBUG) {
731 print $DejagnuTestResults;
732}
733
734##############################################################
735#
736# Get warnings from the build
737#
738##############################################################
739if(!$NODEJAGNU){
740
741if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
742my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
743my @Warnings;
744my $CurDir = "";
745
746foreach $Warning (@Warn) {
747 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
748 $CurDir = $1; # Keep track of directory warning is in...
749 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
750 $CurDir = $1;
751 }
752 } else {
753 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
754 }
755}
756my $WarningsFile = join "\n", @Warnings;
757$WarningsFile =~ s/:[0-9]+:/::/g;
758
759# Emit the warnings file, so we can diff...
760WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
Patrick Jenkinsd0a7c2b2006-07-06 22:32:15 +0000761my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000762
763# Output something to stdout if something has changed
764#print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
765#print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
766
767#my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade
768#my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade
769
770} #endif !NODEGAGNU
771
772##############################################################
773#
774# If we built the tree successfully, run the nightly programs tests...
775#
776# A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" "External")
777#
778##############################################################
779sub TestDirectory {
780 my $SubDir = shift;
781
Patrick Jenkins1049f402006-07-23 21:38:07 +0000782 ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" ) || return ("", "");
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000783
784 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
785 #my $ProgramTestLog = "$Prefix-MultiSource-ProgramTest.txt"; #CHANGE ME!
786
787 # Run the programs tests... creating a report.nightly.csv file
788 if (!$NOTEST) {
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000789 print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000790 . "TEST=nightly > $ProgramTestLog 2>&1\n";
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000791 system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv "
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000792 . "TEST=nightly > $ProgramTestLog 2>&1";
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000793 $llcbeta_options=`$MAKECMD print-llcbeta-option`;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000794 }
795
796 my $ProgramsTable;
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000797 if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000798 $TestError = 1;
799 $ProgramsTable="Error running test $SubDir\n";
800 print "ERROR TESTING\n";
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000801 } elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000802 $TestError = 1;
803 $ProgramsTable="Makefile error running tests $SubDir!\n";
804 print "ERROR TESTING\n";
805 } else {
806 $TestError = 0;
807
808 #
809 # Create a list of the tests which were run...
810 #
811 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog "
812 . "| sort > $Prefix-multisourceprogramstable.txt";
813 }
814 $ProgramsTable = ReadFile "report.nightly.csv";
815
816 ChangeDir( "../../..", "Programs Test Parent Directory" );
817 return ($ProgramsTable, $llcbeta_options);
818}
819
820$patrickjenkins=1;
821if(!$patrickjenkins){
822 if ( $VERBOSE ) {
823 print "Modified Multisource Olden test stage\n";
824 }
825 ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource/");
826 ChangeDir( "../../..", "Programs Test Parent Directory" );
827
828
829 WriteFile "$WebDir/multisourceprogramstable.txt", $MultiSourceProgramsTable;
830}
831if (!$BuildError && $patrickjenkins) {
832 if ( $VERBOSE ) {
833 print "SingleSource TEST STAGE\n";
834 }
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000835 ($SingleSourceProgramsTable, $llcbeta_options) = TestDirectory("SingleSource");
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000836 WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
837 if ( $VERBOSE ) {
838 print "MultiSource TEST STAGE\n";
839 }
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000840 ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource");
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000841 WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable;
842 if ( ! $NOEXTERNALS ) {
843 if ( $VERBOSE ) {
844 print "External TEST STAGE\n";
845 }
Patrick Jenkinsfd95b692006-07-13 16:58:42 +0000846 ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External");
Patrick Jenkins44ebd5a2006-07-10 16:36:19 +0000847 WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000848 system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
849 " $Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt";
850 } else {
851 $ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
852 if ( $VERBOSE ) {
853 print "External TEST STAGE SKIPPED\n";
854 }
855 system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
856 " | sort > $Prefix-Tests.txt";
857 }
858 WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000859}
860
861##############################################################
862#
863#
864# gathering tests added removed broken information here
865#
866#
867##############################################################
Patrick Jenkins3b606cc2006-07-21 21:58:06 +0000868my $dejagnu = ReadFile $DejagnuSum;
869my @DEJAGNU = split "\n", $dejagnu;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000870
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000871my $passes="",
872my $fails="";
873my $xfails="";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000874
Patrick Jenkins3b606cc2006-07-21 21:58:06 +0000875if(!$NODEJAGNU) {
876 for($x=0; $x<@DEJAGNU; $x++){
877 if($DEJAGNU[$x] =~ m/^PASS:/){
878 $passes.="$DEJAGNU[$x]\n";
879 }
880 elsif($DEJAGNU[$x] =~ m/^FAIL:/){
881 $fails.="$DEJAGNU[$x]\n";
882 }
883 elsif($DEJAGNU[$x] =~ m/^XFAIL:/){
884 $xfails.="$DEJAGNU[$x]\n";
885 }
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000886 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000887}
888
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000889# my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
890#
891# if ($TestError) {
892# $TestsAdded = "<b>error testing</b><br>";
893# $TestsRemoved = "<b>error testing</b><br>";
894# $TestsFixed = "<b>error testing</b><br>";
895# $TestsBroken = "<b>error testing</b><br>";
896# } else {
897# my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
898#
899# my @RawTestsAddedArray = split '\n', $RTestsAdded;
900# my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
901#
902# my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
903# @RawTestsRemovedArray;
904# my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
905# @RawTestsAddedArray;
906#
907# foreach $Test (keys %NewTests) {
908# if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
909# $TestsAdded = "$TestsAdded$Test\n";
910# } else {
911# if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
912# $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
913# } else {
914# $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
915# }
916# }
917# }
918# foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
919# $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
920# }
921#
922# #print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
923# #print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
924# #print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
925# #print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
926#
927# #$TestsAdded = AddPreTag $TestsAdded;
928# #$TestsRemoved = AddPreTag $TestsRemoved;
929# #$TestsFixed = AddPreTag $TestsFixed;
930# #$TestsBroken = AddPreTag $TestsBroken;
931# }
932
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000933##############################################################
934#
935# If we built the tree successfully, runs of the Olden suite with
936# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
937#
938##############################################################
939if (!$BuildError) {
940 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
941 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
942 $MachCodeSize) = ("","","","","","","");
943 if (!$NORUNNINGTESTS) {
944 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
945 "Olden Test Directory");
946
947 # Clean out previous results...
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000948 system "$NICE $MAKECMD $MAKEOPTS clean > /dev/null 2>&1";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000949
950 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
951 # GET_STABLE_NUMBERS enabled!
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000952 if( $VERBOSE ) { print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000953 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1\n"; }
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000954 system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000955 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
956 system "cp report.nightly.csv $OldenTestsLog";
957 } #else {
958 #system "gunzip ${OldenTestsLog}.gz";
959 #}
960
961 # Now we know we have $OldenTestsLog as the raw output file. Split
962 # it up into records and read the useful information.
963 #my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
964 #shift @Records; # Delete the first (garbage) record
965
966 # Loop over all of the records, summarizing them into rows for the running
967 # totals file.
968 #my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
969 #foreach $Rec (@Records) {
970 #my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
971 #my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
972 #my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
973 #my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
974 #my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
975 #my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
976
977 #$NATTime .= " " . FormatTime($rNATTime);
978 #$CBETime .= " " . FormatTime($rCBETime);
979 #$LLCTime .= " " . FormatTime($rLLCTime);
980 #$JITTime .= " " . FormatTime($rJITTime);
981 #$OptTime .= " $rOptTime";
982 #$BytecodeSize .= " $rBytecodeSize";
983 #}
984 #
985 # Now that we have all of the numbers we want, add them to the running totals
986 # files.
987 #AddRecord($NATTime, "running_Olden_nat_time.txt", $WebDir);
988 #AddRecord($CBETime, "running_Olden_cbe_time.txt", $WebDir);
989 #AddRecord($LLCTime, "running_Olden_llc_time.txt", $WebDir);
990 #AddRecord($JITTime, "running_Olden_jit_time.txt", $WebDir);
991 #AddRecord($OptTime, "running_Olden_opt_time.txt", $WebDir);
992 #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir);
993}
994
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000995##############################################################
996#
997# Getting end timestamp
998#
999##############################################################
Patrick Jenkins7ef934f2006-07-21 21:43:09 +00001000$endtime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +00001001
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001002
1003##############################################################
1004#
1005# Place all the logs neatly into one humungous file
1006#
1007##############################################################
1008
1009if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
1010
1011$machine_data = "uname: ".`uname -a`.
1012 "hardware: ".`uname -m`.
1013 "os: ".`uname -sr`.
1014 "name: ".`uname -n`.
1015 "date: ".`date \"+20%y-%m-%d\"`.
1016 "time: ".`date +\"%H:%M:%S\"`;
1017
1018my @CVS_DATA;
1019my $cvs_data;
1020@CVS_DATA = ReadFile "$CVSLog";
1021$cvs_data = join("\n", @CVS_DATA);
1022
1023my @BUILD_DATA;
1024my $build_data;
1025@BUILD_DATA = ReadFile "$BuildLog";
1026$build_data = join("\n", @BUILD_DATA);
1027
1028my @DEJAGNU_LOG;
1029my @DEJAGNU_SUM;
1030my $dejagnutests_log;
1031my $dejagnutests_sum;
1032@DEJAGNU_LOG = ReadFile "$DejagnuLog";
1033@DEJAGNU_SUM = ReadFile "$DejagnuSum";
1034$dejagnutests_log = join("\n", @DEJAGNU_LOG);
1035$dejagnutests_sum = join("\n", @DEJAGNU_SUM);
1036
1037my @DEJAGNULOG_FULL;
1038my $dejagnulog_full;
1039@DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog";
1040$dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
1041
Patrick Jenkins7c1ea252006-07-20 16:54:43 +00001042my $gcc_version_long="";
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001043if($GCCPATH ne ""){
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001044 $gcc_version_long = `$GCCPATH/gcc --version`;
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001045 print "$GCCPATH/gcc --version\n";
Patrick Jenkins9536ec72006-07-14 20:44:09 +00001046}
1047else{
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001048 $gcc_version_long = `gcc --version`;
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001049 print "gcc --version\n";
Patrick Jenkins9536ec72006-07-14 20:44:09 +00001050}
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001051@GCC_VERSION = split '\n', $gcc_version_long;
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001052my $gcc_version = $GCC_VERSION[0];
1053
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +00001054$all_tests = ReadFile, "$Prefix-Tests.txt";
1055
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001056##############################################################
1057#
1058# Send data via a post request
1059#
1060##############################################################
1061
1062if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
1063
1064
1065my $host = "llvm.org";
1066my $file = "/nightlytest/NightlyTestAccept.cgi";
1067my %hash_of_data = ('machine_data' => $machine_data,
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +00001068 'build_data' => $build_data,
1069 'gcc_version' => $gcc_version,
1070 'nickname' => $nickname,
1071 'dejagnutime_wall' => $DejagnuWallTime,
1072 'dejagnutime_cpu' => $DejagnuTime,
1073 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall,
1074 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU,
1075 'configtime_wall' => $ConfigWallTime,
1076 'configtime_cpu'=> $ConfigTime,
1077 'buildtime_wall' => $BuildWallTime,
1078 'buildtime_cpu' => $BuildTime,
1079 'warnings' => $WarningsFile,
1080 'cvsusercommitlist' => $UserCommitList,
1081 'cvsuserupdatelist' => $UserUpdateList,
1082 'cvsaddedfiles' => $CVSAddedFiles,
1083 'cvsmodifiedfiles' => $CVSModifiedFiles,
1084 'cvsremovedfiles' => $CVSRemovedFiles,
1085 'lines_of_code' => $LOC,
1086 'cvs_file_count' => $NumFilesInCVS,
1087 'cvs_dir_count' => $NumDirsInCVS,
1088 'buildstatus' => $BuildStatus,
1089 'singlesource_programstable' => $SingleSourceProgramsTable,
1090 'multisource_programstable' => $MultiSourceProgramsTable,
1091 'externalsource_programstable' => $ExternalProgramsTable,
1092 'llcbeta_options' => $multisource_llcbeta_options,
1093 'warnings_removed' => $WarningsRemoved,
1094 'warnings_added' => $WarningsAdded,
1095 'passing_tests' => $passes,
1096 'expfail_tests' => $xfails,
1097 'unexpfail_tests' => $fails,
1098 'all_tests' => $all_tests,
1099 'new_tests' => "",
1100 'removed_tests' => "",
1101 'dejagnutests_log' => $dejagnutests_log,
1102 'dejagnutests_sum' => $dejagnutests_sum,
1103 'starttime' => $starttime,
Patrick Jenkinsc8b9c532006-07-21 19:51:40 +00001104 'endtime' => $endtime,
1105 'o_file_sizes' => $o_file_sizes,
1106 'a_file_sizes' => $a_file_sizes);
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001107
1108$TESTING = 0;
1109
1110if($TESTING){
1111 print "============================\n";
1112 foreach $x(keys %hash_of_data){
1113 print "$x => $hash_of_data{$x}\n";
1114 }
1115}
1116else{
1117 my $response = SendData $host,$file,\%hash_of_data;
1118 print "============================\n$response";
1119}
1120
1121##############################################################
1122#
1123# Remove the cvs tree...
1124#
1125##############################################################
1126system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Patrick Jenkins26d5bd52006-07-13 16:56:48 +00001127system ( "$NICE rm -rf $WebDir") if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001128
1129