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