blob: 0a604d3f2ca7f8e2be9c2050dc0b19504c51dcbf [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 Jenkins40cc1922006-07-27 18:28:50 +0000305 $result = chdir($dir);
306 if(!$result){
307 print "ERROR!!! Cannot change directory to: $name ($dir) because $!";
308 return -1;
309 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000310}
311
312#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
313#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314sub ReadFile {
315 if (open (FILE, $_[0])) {
316 undef $/;
317 my $Ret = <FILE>;
318 close FILE;
319 $/ = '\n';
320 return $Ret;
321 } else {
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000322 print "Could not open file '$_[0]' for reading!\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000323 return "";
324 }
325}
326
327#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
328#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329sub WriteFile { # (filename, contents)
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000330 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000331 print FILE $_[1];
332 close FILE;
333}
334
335#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
336#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
337sub CopyFile { #filename, newfile
338 my ($file, $newfile) = @_;
339 chomp($file);
340 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
341 copy($file, $newfile);
342}
343
344#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
345#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
346sub AddRecord {
347 my ($Val, $Filename,$WebDir) = @_;
348 my @Records;
349 if (open FILE, "$WebDir/$Filename") {
350 @Records = grep !/$DATE/, split "\n", <FILE>;
351 close FILE;
352 }
353 push @Records, "$DATE: $Val";
354 WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
355}
356
357#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
358#
359# FormatTime - Convert a time from 1m23.45 into 83.45
360#
361#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
362sub FormatTime {
363 my $Time = shift;
364 if ($Time =~ m/([0-9]+)m([0-9.]+)/) {
365 $Time = sprintf("%7.4f", $1*60.0+$2);
366 }
367 return $Time;
368}
369
370#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
371#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
372sub GetDejagnuTestResults { # (filename, log)
373 my ($filename, $DejagnuLog) = @_;
374 my @lines;
375 my $firstline;
376 $/ = "\n"; #Make sure we're going line at a time.
377
378 print "DEJAGNU TEST RESULTS:\n";
379
380 if (open SRCHFILE, $filename) {
381 # Process test results
382 my $first_list = 1;
383 my $should_break = 1;
384 my $nocopy = 0;
385 my $readingsum = 0;
386 while ( <SRCHFILE> ) {
387 if ( length($_) > 1 ) {
388 chomp($_);
389 if ( m/^XPASS:/ || m/^FAIL:/ ) {
390 $nocopy = 0;
391 if ( $first_list ) {
392 push(@lines, "UNEXPECTED TEST RESULTS\n");
393 $first_list = 0;
394 $should_break = 1;
395 push(@lines, "$_\n");
396 print " $_\n";
397 } else {
398 push(@lines, "$_\n");
399 print " $_\n";
400 }
401 } #elsif ( m/Summary/ ) {
402 # if ( $first_list ) {
403 # push(@lines, "PERFECT!");
404 # print " PERFECT!\n";
405 # } else {
406 # push(@lines, "</li></ol>\n");
407 # }
408 # push(@lines, "STATISTICS\n");
409 # print "\nDEJAGNU STATISTICS:\n";
410 # $should_break = 0;
411 # $nocopy = 0;
412 # $readingsum = 1;
413 #}
414 elsif ( $readingsum ) {
415 push(@lines,"$_\n");
416 print " $_\n";
417 }
418
419 }
420 }
421 }
422 close SRCHFILE;
423
424 my $content = join("", @lines);
425 return $content;
426}
427
428
429#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
430#
431# This function acts as a mini web browswer submitting data
432# to our central server via the post method
433#
434#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
435sub SendData{
436 $host = $_[0];
437 $file = $_[1];
438 $variables=$_[2];
439
440 $port=80;
441 $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n";
Patrick Jenkinsa72f84e2006-07-17 16:41:19 +0000442 socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or
443 die "Bad socket\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000444 connect SOCK, $socketaddr or die "Bad connection\n";
445 select((select(SOCK), $| = 1)[0]);
446
447 #creating content here
448 my $content;
449 foreach $key (keys (%$variables)){
450 $value = $variables->{$key};
451 $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
452 $content .= "$key=$value&";
453 }
454
455 $length = length($content);
456
457 my $send= "POST $file HTTP/1.0\n";
458 $send.= "Content-Type: application/x-www-form-urlencoded\n";
459 $send.= "Content-length: $length\n\n";
460 $send.= "$content";
461
462 print SOCK $send;
463 my $result;
464 while(<SOCK>){
465 $result .= $_;
466 }
467 close(SOCK);
468
469 my $sentdata="";
Patrick Jenkins19ecfb02006-07-07 21:40:34 +0000470 foreach $x (keys (%$variables)){
Patrick Jenkins7ac78b92006-07-10 18:35:41 +0000471 $value = $variables->{$x};
472 $sentdata.= "$x => $value\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000473 }
474 WriteFile "$Prefix-sentdata.txt", $sentdata;
Patrick Jenkins19ecfb02006-07-07 21:40:34 +0000475
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000476
477 return $result;
478}
479
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000480##############################################################
481#
482# Getting Start timestamp
483#
484##############################################################
Patrick Jenkins7ef934f2006-07-21 21:43:09 +0000485$starttime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000486
487##############################################################
488#
489# Create the CVS repository directory
490#
491##############################################################
492if (!$NOCHECKOUT) {
493 if (-d $BuildDir) {
494 if (!$NOREMOVE) {
Patrick Jenkinsdb3c5202006-07-20 22:28:43 +0000495 if ( $VERBOSE ){
496 print "Build directory exists! Removing it\n";
497 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000498 system "rm -rf $BuildDir";
499 } else {
500 die "CVS checkout directory $BuildDir already exists!";
501 }
502 }
503 mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!";
504}
505ChangeDir( $BuildDir, "CVS checkout directory" );
506
507
508##############################################################
509#
510# Check out the llvm tree, saving CVS messages to the cvs log...
511#
512##############################################################
513my $CVSOPT = "";
514# Use compression if going over ssh.
515$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
516my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
517if (!$NOCHECKOUT) {
518 if ( $VERBOSE )
519 {
520 print "CHECKOUT STAGE:\n";
521 print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) > $CVSLog 2>&1\n";
522 }
523 system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
524 "$CVSCMD llvm-test ) > $CVSLog 2>&1";
525 ChangeDir( $BuildDir , "CVS Checkout directory") ;
526}
527ChangeDir( "llvm" , "llvm source directory") ;
528if (!$NOCHECKOUT) {
529 if ( $VERBOSE ) { print "UPDATE STAGE\n"; }
530 system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ;
531}
532
533##############################################################
534#
535# Get some static statistics about the current state of CVS
536#
537# This can probably be put on the server side
538#
539##############################################################
540my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`;
541my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`;
542my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`;
543my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
544
545my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
546my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
547my $LOC = `utils/countloc.sh`;
548
549##############################################################
550#
551# Extract some information from the CVS history... use a hash so no duplicate
552# stuff is stored. This gets the history from the previous days worth
553# of cvs activit and parses it.
554#
555##############################################################
556
557my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated);
558
559if(!$NOCVSSTATS){
560
561if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; }
562@CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`;
563#print join "\n", @CVSHistory; print "\n";
564
565my $DateRE = '[-/:0-9 ]+\+[0-9]+';
566
567# Loop over every record from the CVS history, filling in the hashes.
568foreach $File (@CVSHistory) {
569 my ($Type, $Date, $UID, $Rev, $Filename);
570 if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) {
571 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5");
572 } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) {
573 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "");
574 } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) {
575 ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/");
576 } else {
577 print "UNMATCHABLE: $File\n";
578 next;
579 }
580 # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n";
581
582 if ($Filename =~ /^llvm/) {
583 if ($Type eq 'M') { # Modified
584 $ModifiedFiles{$Filename} = 1;
585 $UsersCommitted{$UID} = 1;
586 } elsif ($Type eq 'A') { # Added
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000587 $AddedFiles{$Filename} = 1;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000588 $UsersCommitted{$UID} = 1;
589 } elsif ($Type eq 'R') { # Removed
590 $RemovedFiles{$Filename} = 1;
591 $UsersCommitted{$UID} = 1;
592 } else {
593 $UsersUpdated{$UID} = 1;
594 }
595 }
596}
597
598my $TestError = 1;
599
600}#!NOCVSSTATS
601
602my $CVSAddedFiles = join "\n", sort keys %AddedFiles;
603my $CVSModifiedFiles = join "\n", sort keys %ModifiedFiles;
604my $CVSRemovedFiles = join "\n", sort keys %RemovedFiles;
605my $UserCommitList = join "\n", sort keys %UsersCommitted;
606my $UserUpdateList = join "\n", sort keys %UsersUpdated;
607
608##############################################################
609#
610# Build the entire tree, saving build messages to the build log
611#
612##############################################################
613if (!$NOCHECKOUT && !$NOBUILD) {
Patrick Jenkins26d5bd52006-07-13 16:56:48 +0000614 my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
Patrick Jenkins1a61dc42006-07-22 00:00:08 +0000615 if ( $VERBOSE ){
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000616 print "CONFIGURE STAGE:\n";
617 print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1\n";
618 }
619 system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
620 if ( $VERBOSE )
621 {
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000622 print "BUILD STAGE:\n";
623 print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000624 }
625 # Build the entire tree, capturing the output into $BuildLog
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000626 system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000627}
628
629
630##############################################################
631#
632# Get some statistics about the build...
633#
634##############################################################
635#this can de done on server
636#my @Linked = split '\n', `grep Linking $BuildLog`;
637#my $NumExecutables = scalar(grep(/executable/, @Linked));
638#my $NumLibraries = scalar(grep(!/executable/, @Linked));
639#my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
640
641
642my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog";
643my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog";
644my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
645my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog";
646
647$ConfigTime=-1 unless $ConfigTime;
648$ConfigWallTime=-1 unless $ConfigWallTime;
649
650my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog";
651my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog";
652my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
653my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog";
654
655$BuildTime=-1 unless $BuildTime;
656$BuildWallTime=-1 unless $BuildWallTime;
657
658my $BuildError = 0, $BuildStatus = "OK";
659if($NOBUILD){
660 $BuildStatus = "Skipped by user";
661 $BuildError = 1;
662}
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000663elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
664 `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l`+0) {
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000665 $BuildStatus = "Error: compilation aborted";
666 $BuildError = 1;
667 print "\n***ERROR BUILDING TREE\n\n";
668}
669if ($BuildError) { $NODEJAGNU=1; }
670
Patrick Jenkins1049f402006-07-23 21:38:07 +0000671my $a_file_sizes="";
672my $o_file_sizes="";
673if(!$BuildError){
674 if ( $VERBOSE ){
675 print "Organizing size of .o and .a files\n";
676 }
677 ChangeDir( "$BuildDir/llvm", "Build Directory" );
678 $afiles = `find . -iname '*.a' -ls`;
679 $ofiles = `find . -iname '*.o' -ls`;
680 @AFILES = split "\n", $afiles;
681 $a_file_sizes="";
682 foreach $x (@AFILES){
683 $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000684 $a_file_sizes.="$1 $2 $BUILDTYPE\n";
Patrick Jenkins1049f402006-07-23 21:38:07 +0000685 }
686 @OFILES = split "\n", $ofiles;
687 $o_file_sizes="";
688 foreach $x (@OFILES){
689 $x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
Patrick Jenkins6e884eb2006-07-23 22:57:28 +0000690 $o_file_sizes.="$1 $2 $BUILDTYPE\n";
Patrick Jenkins1049f402006-07-23 21:38:07 +0000691 }
692}
693else{
694 $a_file_sizes="No data due to a bad build.";
695 $o_file_sizes="No data due to a bad build.";
696}
697
698
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000699##############################################################
700#
701# Running dejagnu tests
702#
703##############################################################
704my $DejangnuTestResults; # String containing the results of the dejagnu
705my $dejagnu_output = "$DejagnuTestsLog";
706if(!$NODEJAGNU) {
707 if($VERBOSE)
708 {
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000709 print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n";
710 print "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000711 }
712
713 #Run the feature and regression tests, results are put into testrun.sum
714 #Full log in testrun.log
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000715 system "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000716
717 #Copy the testrun.log and testrun.sum to our webdir
718 CopyFile("test/testrun.log", $DejagnuLog);
719 CopyFile("test/testrun.sum", $DejagnuSum);
720 #can be done on server
721 $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
722 $unexpfail_tests = $DejagnuTestResults;
723}
724#Extract time of dejagnu tests
725my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
726my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
727$DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
728$DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
729$DejagnuTestResults = "Dejagnu skipped by user choice." unless $DejagnuTestResults;
730$DejagnuTime = "0.0" unless $DejagnuTime;
731$DejagnuWallTime = "0.0" unless $DejagnuWallTime;
732
733if ($DEBUG) {
734 print $DejagnuTestResults;
735}
736
737##############################################################
738#
739# Get warnings from the build
740#
741##############################################################
742if(!$NODEJAGNU){
743
744if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
745my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
746my @Warnings;
747my $CurDir = "";
748
749foreach $Warning (@Warn) {
750 if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
751 $CurDir = $1; # Keep track of directory warning is in...
752 if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
753 $CurDir = $1;
754 }
755 } else {
756 push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
757 }
758}
759my $WarningsFile = join "\n", @Warnings;
760$WarningsFile =~ s/:[0-9]+:/::/g;
761
762# Emit the warnings file, so we can diff...
763WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n";
Patrick Jenkinsd0a7c2b2006-07-06 22:32:15 +0000764my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000765
766# Output something to stdout if something has changed
767#print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded);
768#print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved);
769
770#my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade
771#my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade
772
773} #endif !NODEGAGNU
774
775##############################################################
776#
777# If we built the tree successfully, run the nightly programs tests...
778#
779# A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" "External")
780#
781##############################################################
782sub TestDirectory {
Patrick Jenkins40cc1922006-07-27 18:28:50 +0000783 my $SubDir = shift;
784
Patrick Jenkins2cac74f2006-07-27 19:22:06 +0000785 ChangeDir( "$BuildDir/llvm/projects/llvm-test/$SubDir", "Programs Test Subdirectory" ) || return ("", "");
Patrick Jenkins40cc1922006-07-27 18:28:50 +0000786
787 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
788
789 # Run the programs tests... creating a report.nightly.csv file
790 if (!$NOTEST) {
791 print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
792 "TEST=nightly > $ProgramTestLog 2>&1\n";
793 system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
794 "TEST=nightly > $ProgramTestLog 2>&1";
795 $llcbeta_options=`$MAKECMD print-llcbeta-option`;
796 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000797
Patrick Jenkins40cc1922006-07-27 18:28:50 +0000798 my $ProgramsTable;
799 if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0){
800 $TestError = 1;
801 $ProgramsTable="Error running test $SubDir\n";
802 print "ERROR TESTING\n";
803 } elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
804 $TestError = 1;
805 $ProgramsTable="Makefile error running tests $SubDir!\n";
806 print "ERROR TESTING\n";
807 } else {
808 $TestError = 0;
809 #
810 # Create a list of the tests which were run...
811 #
812 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
813 "| sort > $Prefix-multisourceprogramstable.txt";
814 }
815 $ProgramsTable = ReadFile "report.nightly.csv";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000816
Patrick Jenkins40cc1922006-07-27 18:28:50 +0000817 ChangeDir( "../../..", "Programs Test Parent Directory" );
818 return ($ProgramsTable, $llcbeta_options);
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000819}
820
Patrick Jenkins80ae7ab2006-07-27 19:00:01 +0000821if (!$BuildError) {
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000822 if ( $VERBOSE ) {
Patrick Jenkins80ae7ab2006-07-27 19:00:01 +0000823 print "SingleSource TEST STAGE\n";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000824 }
Patrick Jenkins80ae7ab2006-07-27 19:00:01 +0000825 ($SingleSourceProgramsTable, $llcbeta_options) = TestDirectory("SingleSource");
826 if ( $VERBOSE ) {
827 print "SingleSource returned $SingleSourceProgramsTable\n";
828 }
829 WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
830 if ( $VERBOSE ) {
831 print "MultiSource TEST STAGE\n";
832 }
833 ($MultiSourceProgramsTable, $llcbeta_options) = TestDirectory("MultiSource");
834 WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable;
835 if ( $VERBOSE ) {
836 print "MultiSource returned $MultiSourceProgramsTable\n";
837 }
838 if ( ! $NOEXTERNALS ) {
839 if ( $VERBOSE ) {
840 print "External TEST STAGE\n";
841 }
842 ($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External");
843 WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
844 system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
845 " $Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt";
846 } else {
847 $ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
848 if ( $VERBOSE ) {
849 print "External TEST STAGE SKIPPED\n";
850 }
851 system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
852 " | sort > $Prefix-Tests.txt";
853 }
Patrick Jenkins44ebd5a2006-07-10 16:36:19 +0000854 WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000855}
856
857##############################################################
858#
859#
860# gathering tests added removed broken information here
861#
862#
863##############################################################
Patrick Jenkins3b606cc2006-07-21 21:58:06 +0000864my $dejagnu = ReadFile $DejagnuSum;
865my @DEJAGNU = split "\n", $dejagnu;
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000866
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000867my $passes="",
868my $fails="";
869my $xfails="";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000870
Patrick Jenkins3b606cc2006-07-21 21:58:06 +0000871if(!$NODEJAGNU) {
872 for($x=0; $x<@DEJAGNU; $x++){
873 if($DEJAGNU[$x] =~ m/^PASS:/){
874 $passes.="$DEJAGNU[$x]\n";
875 }
876 elsif($DEJAGNU[$x] =~ m/^FAIL:/){
877 $fails.="$DEJAGNU[$x]\n";
878 }
879 elsif($DEJAGNU[$x] =~ m/^XFAIL:/){
880 $xfails.="$DEJAGNU[$x]\n";
881 }
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000882 }
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000883}
884
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +0000885# my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","","");
886#
887# if ($TestError) {
888# $TestsAdded = "<b>error testing</b><br>";
889# $TestsRemoved = "<b>error testing</b><br>";
890# $TestsFixed = "<b>error testing</b><br>";
891# $TestsBroken = "<b>error testing</b><br>";
892# } else {
893# my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt";
894#
895# my @RawTestsAddedArray = split '\n', $RTestsAdded;
896# my @RawTestsRemovedArray = split '\n', $RTestsRemoved;
897#
898# my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
899# @RawTestsRemovedArray;
900# my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_}
901# @RawTestsAddedArray;
902#
903# foreach $Test (keys %NewTests) {
904# if (!exists $OldTests{$Test}) { # TestAdded if in New but not old
905# $TestsAdded = "$TestsAdded$Test\n";
906# } else {
907# if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass?
908# $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure
909# } else {
910# $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass.
911# }
912# }
913# }
914# foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New
915# $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test});
916# }
917#
918# #print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded);
919# #print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved);
920# #print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed);
921# #print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken);
922#
923# #$TestsAdded = AddPreTag $TestsAdded;
924# #$TestsRemoved = AddPreTag $TestsRemoved;
925# #$TestsFixed = AddPreTag $TestsFixed;
926# #$TestsBroken = AddPreTag $TestsBroken;
927# }
928
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000929##############################################################
930#
931# If we built the tree successfully, runs of the Olden suite with
932# LARGE_PROBLEM_SIZE on so that we can get some "running" statistics.
933#
934##############################################################
935if (!$BuildError) {
936 if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; }
937 my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize,
938 $MachCodeSize) = ("","","","","","","");
939 if (!$NORUNNINGTESTS) {
940 ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden",
941 "Olden Test Directory");
942
943 # Clean out previous results...
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000944 system "$NICE $MAKECMD $MAKEOPTS clean > /dev/null 2>&1";
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000945
946 # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
947 # GET_STABLE_NUMBERS enabled!
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000948 if( $VERBOSE ) { print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000949 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1\n"; }
Patrick Jenkins0f3e0b02006-07-27 01:03:46 +0000950 system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000951 " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
952 system "cp report.nightly.csv $OldenTestsLog";
953 } #else {
954 #system "gunzip ${OldenTestsLog}.gz";
955 #}
956
957 # Now we know we have $OldenTestsLog as the raw output file. Split
958 # it up into records and read the useful information.
959 #my @Records = split />>> ========= /, ReadFile "$OldenTestsLog";
960 #shift @Records; # Delete the first (garbage) record
961
962 # Loop over all of the records, summarizing them into rows for the running
963 # totals file.
964 #my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock";
965 #foreach $Rec (@Records) {
966 #my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec;
967 #my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec;
968 #my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec;
969 #my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec;
970 #my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec;
971 #my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec;
972
973 #$NATTime .= " " . FormatTime($rNATTime);
974 #$CBETime .= " " . FormatTime($rCBETime);
975 #$LLCTime .= " " . FormatTime($rLLCTime);
976 #$JITTime .= " " . FormatTime($rJITTime);
977 #$OptTime .= " $rOptTime";
978 #$BytecodeSize .= " $rBytecodeSize";
979 #}
980 #
981 # Now that we have all of the numbers we want, add them to the running totals
982 # files.
983 #AddRecord($NATTime, "running_Olden_nat_time.txt", $WebDir);
984 #AddRecord($CBETime, "running_Olden_cbe_time.txt", $WebDir);
985 #AddRecord($LLCTime, "running_Olden_llc_time.txt", $WebDir);
986 #AddRecord($JITTime, "running_Olden_jit_time.txt", $WebDir);
987 #AddRecord($OptTime, "running_Olden_opt_time.txt", $WebDir);
988 #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir);
989}
990
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000991##############################################################
992#
993# Getting end timestamp
994#
995##############################################################
Patrick Jenkins7ef934f2006-07-21 21:43:09 +0000996$endtime = `date "+20%y-%m-%d %H:%M:%S"`;
Patrick Jenkinsf976a5c2006-07-07 18:50:51 +0000997
Patrick Jenkins0e316b42006-07-06 21:19:32 +0000998
999##############################################################
1000#
1001# Place all the logs neatly into one humungous file
1002#
1003##############################################################
1004
1005if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
1006
1007$machine_data = "uname: ".`uname -a`.
1008 "hardware: ".`uname -m`.
1009 "os: ".`uname -sr`.
1010 "name: ".`uname -n`.
1011 "date: ".`date \"+20%y-%m-%d\"`.
1012 "time: ".`date +\"%H:%M:%S\"`;
1013
1014my @CVS_DATA;
1015my $cvs_data;
1016@CVS_DATA = ReadFile "$CVSLog";
1017$cvs_data = join("\n", @CVS_DATA);
1018
1019my @BUILD_DATA;
1020my $build_data;
1021@BUILD_DATA = ReadFile "$BuildLog";
1022$build_data = join("\n", @BUILD_DATA);
1023
1024my @DEJAGNU_LOG;
1025my @DEJAGNU_SUM;
1026my $dejagnutests_log;
1027my $dejagnutests_sum;
1028@DEJAGNU_LOG = ReadFile "$DejagnuLog";
1029@DEJAGNU_SUM = ReadFile "$DejagnuSum";
1030$dejagnutests_log = join("\n", @DEJAGNU_LOG);
1031$dejagnutests_sum = join("\n", @DEJAGNU_SUM);
1032
1033my @DEJAGNULOG_FULL;
1034my $dejagnulog_full;
1035@DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog";
1036$dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
1037
Patrick Jenkins7c1ea252006-07-20 16:54:43 +00001038my $gcc_version_long="";
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001039if($GCCPATH ne ""){
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001040 $gcc_version_long = `$GCCPATH/gcc --version`;
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001041 print "$GCCPATH/gcc --version\n";
Patrick Jenkins9536ec72006-07-14 20:44:09 +00001042}
1043else{
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001044 $gcc_version_long = `gcc --version`;
Patrick Jenkinsbe254602006-07-18 17:21:30 +00001045 print "gcc --version\n";
Patrick Jenkins9536ec72006-07-14 20:44:09 +00001046}
Patrick Jenkinsf9bafae2006-07-18 21:21:53 +00001047@GCC_VERSION = split '\n', $gcc_version_long;
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001048my $gcc_version = $GCC_VERSION[0];
1049
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +00001050$all_tests = ReadFile, "$Prefix-Tests.txt";
1051
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001052##############################################################
1053#
1054# Send data via a post request
1055#
1056##############################################################
1057
1058if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
1059
1060
1061my $host = "llvm.org";
1062my $file = "/nightlytest/NightlyTestAccept.cgi";
1063my %hash_of_data = ('machine_data' => $machine_data,
Patrick Jenkins23b8b2d2006-07-19 17:52:51 +00001064 'build_data' => $build_data,
1065 'gcc_version' => $gcc_version,
1066 'nickname' => $nickname,
1067 'dejagnutime_wall' => $DejagnuWallTime,
1068 'dejagnutime_cpu' => $DejagnuTime,
1069 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall,
1070 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU,
1071 'configtime_wall' => $ConfigWallTime,
1072 'configtime_cpu'=> $ConfigTime,
1073 'buildtime_wall' => $BuildWallTime,
1074 'buildtime_cpu' => $BuildTime,
1075 'warnings' => $WarningsFile,
1076 'cvsusercommitlist' => $UserCommitList,
1077 'cvsuserupdatelist' => $UserUpdateList,
1078 'cvsaddedfiles' => $CVSAddedFiles,
1079 'cvsmodifiedfiles' => $CVSModifiedFiles,
1080 'cvsremovedfiles' => $CVSRemovedFiles,
1081 'lines_of_code' => $LOC,
1082 'cvs_file_count' => $NumFilesInCVS,
1083 'cvs_dir_count' => $NumDirsInCVS,
1084 'buildstatus' => $BuildStatus,
1085 'singlesource_programstable' => $SingleSourceProgramsTable,
1086 'multisource_programstable' => $MultiSourceProgramsTable,
1087 'externalsource_programstable' => $ExternalProgramsTable,
1088 'llcbeta_options' => $multisource_llcbeta_options,
1089 'warnings_removed' => $WarningsRemoved,
1090 'warnings_added' => $WarningsAdded,
1091 'passing_tests' => $passes,
1092 'expfail_tests' => $xfails,
1093 'unexpfail_tests' => $fails,
1094 'all_tests' => $all_tests,
1095 'new_tests' => "",
1096 'removed_tests' => "",
1097 'dejagnutests_log' => $dejagnutests_log,
1098 'dejagnutests_sum' => $dejagnutests_sum,
1099 'starttime' => $starttime,
Patrick Jenkinsc8b9c532006-07-21 19:51:40 +00001100 'endtime' => $endtime,
1101 'o_file_sizes' => $o_file_sizes,
1102 'a_file_sizes' => $a_file_sizes);
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001103
1104$TESTING = 0;
1105
1106if($TESTING){
1107 print "============================\n";
1108 foreach $x(keys %hash_of_data){
1109 print "$x => $hash_of_data{$x}\n";
1110 }
1111}
1112else{
1113 my $response = SendData $host,$file,\%hash_of_data;
1114 print "============================\n$response";
1115}
1116
1117##############################################################
1118#
1119# Remove the cvs tree...
1120#
1121##############################################################
1122system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
Patrick Jenkins26d5bd52006-07-13 16:56:48 +00001123system ( "$NICE rm -rf $WebDir") if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);
Patrick Jenkins0e316b42006-07-06 21:19:32 +00001124
1125