2 use POSIX qw(strftime);
8 # Program: NewNightlyTest.pl
10 # Synopsis: Perform a series of tests which are designed to be run nightly.
11 # This is used to keep track of the status of the LLVM tree, tracking
12 # regressions and performance changes. Submits this information
13 # to llvm.org where it is placed into the nightlytestresults database.
15 # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR]
17 # OPTIONS may include one or more of the following:
20 # -config LLVMPATH If specified, use an existing LLVM build and only run and
21 # report the test information. The LLVMCONFIG argument should
22 # be the path to the llvm-config executable in the LLVM build.
23 # This should be the first argument if given. NOT YET
25 # -nickname NAME The NAME argument specifieds the nickname this script
26 # will submit to the nightlytest results repository.
27 # -submit-server Specifies a server to submit the test results too. If this
28 # option is not specified it defaults to
29 # llvm.org. This is basically just the address of the
31 # -submit-script Specifies which script to call on the submit server. If
32 # this option is not specified it defaults to
33 # /nightlytest/NightlyTestAccept.php. This is basically
34 # everything after the www.yourserver.org.
35 # -submit-aux If specified, an auxiliary script to run in addition to the
36 # normal submit script. The script will be passed the path to
37 # the "sentdata.txt" file as its sole argument.
38 # -nosubmit Do not report the test results back to a submit server.
41 # BUILD OPTIONS (not used with -config):
42 # -nocheckout Do not create, checkout, update, or configure
44 # -noremove Do not remove the BUILDDIR after it has been built.
45 # -noremoveresults Do not remove the WEBDIR after it has been built.
46 # -noclean Do not run 'make clean' before building.
47 # -nobuild Do not build llvm. If tests are enabled perform them
48 # on the llvm build specified in the build directory
49 # -release Build an LLVM Release version
50 # -release-asserts Build an LLVM ReleaseAsserts version
51 # -disable-bindings Disable building LLVM bindings.
52 # -with-clang Checkout Clang source into tools/clang.
53 # -compileflags Next argument specifies extra options passed to make when
55 # -use-gmake Use gmake instead of the default make command to build
57 # -llvmgccdir Next argument specifies the llvm-gcc install prefix.
60 # -notest Do not even attempt to run the test programs.
61 # -nodejagnu Do not run feature or regression tests
62 # -enable-llcbeta Enable testing of beta features in llc.
63 # -enable-lli Enable testing of lli (interpreter) features, default is off
64 # -disable-pic Disable building with Position Independent Code.
65 # -disable-llc Disable LLC tests in the nightly tester.
66 # -disable-jit Disable JIT tests in the nightly tester.
67 # -disable-cbe Disable C backend tests in the nightly tester.
68 # -disable-lto Disable link time optimization.
69 # -test-cflags Next argument specifies that C compilation options that
70 # override the default when running the testsuite.
71 # -test-cxxflags Next argument specifies that C++ compilation options that
72 # override the default when running the testsuite.
73 # -extraflags Next argument specifies extra options that are passed to
75 # -noexternals Do not run the external tests (for cases where povray
76 # or SPEC are not installed)
77 # -with-externals Specify a directory where the external tests are located.
80 # -parallel Run parallel jobs with GNU Make (see -parallel-jobs).
81 # -parallel-jobs The number of parallel Make jobs to use (default is two).
82 # -parallel-test Allow parallel execution of llvm-test
83 # -verbose Turn on some debug output
84 # -nice Checkout/Configure/Build with "nice" to reduce impact
86 # -f2c Next argument specifies path to F2C utility
87 # -gccpath Path to gcc/g++ used to build LLVM
88 # -target Specify the target triplet
89 # -cflags Next argument specifies that C compilation options that
90 # override the default.
91 # -cxxflags Next argument specifies that C++ compilation options that
92 # override the default.
93 # -ldflags Next argument specifies that linker options that override
96 # CVSROOT is ignored, it is passed for backwards compatibility.
97 # BUILDDIR is the directory where sources for this test run will be checked out
98 # AND objects for this test run will be built. This directory MUST NOT
99 # exist before the script is run; it will be created by the svn checkout
100 # process and erased (unless -noremove is specified; see above.)
101 # WEBDIR is the directory into which the test results web page will be written,
102 # AND in which the "index.html" is assumed to be a symlink to the most recent
103 # copy of the results. This directory will be created if it does not exist.
104 # LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
105 # to. This is the same as you would have for a normal LLVM build.
107 ##############################################################
109 # Getting environment variables
111 ##############################################################
112 my $HOME = $ENV{'HOME'};
113 my $SVNURL = $ENV{"SVNURL"};
114 $SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL;
115 my $TestSVNURL = $ENV{"TestSVNURL"};
116 $TestSVNURL = 'http://llvm.org/svn/llvm-project' unless $TestSVNURL;
117 my $BuildDir = $ENV{'BUILDDIR'};
118 my $WebDir = $ENV{'WEBDIR'};
120 ##############################################################
122 # Calculate the date prefix...
124 ##############################################################
127 my $DATE = strftime("%Y-%m-%d_%H-%M-%S", localtime());
129 ##############################################################
133 ##############################################################
139 $SUBMITSERVER = "llvm.org";
140 $SUBMITSCRIPT = "/nightlytest/NightlyTestAccept.php";
146 if ($ENV{'LLVMGCCDIR'}) {
147 $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'};
148 $LLVMGCCPATH = $ENV{'LLVMGCCDIR'} . '/bin';
154 while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
156 last if /^--$/; # Stop processing arguments on --
158 # List command line options here...
159 if (/^-config$/) { $CONFIG_PATH = "$ARGV[0]"; shift; next; }
160 if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; }
161 if (/^-noclean$/) { $NOCLEAN = 1; next; }
162 if (/^-noremove$/) { $NOREMOVE = 1; next; }
163 if (/^-noremoveatend$/) { $NOREMOVEATEND = 1; next; }
164 if (/^-noremoveresults$/){ $NOREMOVERESULTS = 1; next; }
165 if (/^-notest$/) { $NOTEST = 1; next; }
166 if (/^-norunningtests$/) { next; } # Backward compatibility, ignored.
167 if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;}
168 if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS"; next; }
169 if (/^-parallel-test$/) { $PROGTESTOPTS .= " ENABLE_PARALLEL_REPORT=1"; next; }
170 if (/^-with-clang$/) { $WITHCLANG = 1; next; }
171 if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
172 "OPTIMIZE_OPTION=-O2"; next;}
173 if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
174 "DISABLE_ASSERTIONS=1 ".
175 "OPTIMIZE_OPTION=-O2"; next;}
176 if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
177 if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; next; }
178 if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1";
179 $CONFIGUREARGS .= " --enable-lli"; next; }
180 if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
181 $CONFIGUREARGS .= " --disable-llc_diffs"; next; }
182 if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1";
183 $CONFIGUREARGS .= " --disable-jit"; next; }
184 if (/^-disable-bindings$/) { $CONFIGUREARGS .= " --disable-bindings"; next; }
185 if (/^-disable-cbe$/) { $PROGTESTOPTS .= " DISABLE_CBE=1"; next; }
186 if (/^-disable-lto$/) { $PROGTESTOPTS .= " DISABLE_LTO=1"; next; }
187 if (/^-test-opts$/) { $PROGTESTOPTS .= " $ARGV[0]"; shift; next; }
188 if (/^-verbose$/) { $VERBOSE = 1; next; }
189 if (/^-teelogs$/) { $TEELOGS = 1; next; }
190 if (/^-nice$/) { $NICE = "nice "; next; }
191 if (/^-f2c$/) { $CONFIGUREARGS .= " --with-f2c=$ARGV[0]";
193 if (/^-with-externals$/) { $CONFIGUREARGS .= " --with-externals=$ARGV[0]";
195 if (/^-configure-args$/) { $CONFIGUREARGS .= " $ARGV[0]";
197 if (/^-submit-server/) { $SUBMITSERVER = "$ARGV[0]"; shift; next; }
198 if (/^-submit-script/) { $SUBMITSCRIPT = "$ARGV[0]"; shift; next; }
199 if (/^-submit-aux/) { $SUBMITAUX = "$ARGV[0]"; shift; next; }
200 if (/^-nosubmit$/) { $SUBMIT = 0; next; }
201 if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; }
202 if (/^-gccpath/) { $CONFIGUREARGS .=
203 " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++";
204 $GCCPATH=$ARGV[0]; shift; next; }
205 else { $GCCPATH=""; }
206 if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]";
208 if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'";
210 if (/^-cxxflags/) { $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'";
212 if (/^-ldflags/) { $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'";
214 if (/^-test-cflags/) { $TESTFLAGS = "$TESTFLAGS CFLAGS=\'$ARGV[0]\'";
216 if (/^-test-cxxflags/) { $TESTFLAGS = "$TESTFLAGS CXXFLAGS=\'$ARGV[0]\'";
218 if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; }
219 if (/^-llvmgccdir/) { $CONFIGUREARGS .= " --with-llvmgccdir=\'$ARGV[0]\'";
220 $LLVMGCCPATH = $ARGV[0] . '/bin';
222 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
223 if (/^-use-gmake/) { $MAKECMD = "gmake"; shift; next; }
224 if (/^-extraflags/) { $CONFIGUREARGS .=
225 " --with-extra-options=\'$ARGV[0]\'"; shift; next;}
226 if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
227 if (/^-nodejagnu$/) { next; }
228 if (/^-nobuild$/) { $NOBUILD = 1; next; }
229 print "Unknown option: $_ : ignoring!\n";
232 if ($CONFIGUREARGS !~ /--disable-jit/) {
233 $CONFIGUREARGS .= " --enable-jit";
236 if (@ARGV != 0 and @ARGV != 3) {
237 die "error: must specify 0 or 3 options!";
241 if ($CONFIG_PATH ne "") {
242 die "error: arguments are unsupported in -config mode,";
245 # ARGV[0] used to be the CVS root, ignored for backward compatibility.
246 $BuildDir = $ARGV[1];
250 if ($CONFIG_PATH ne "") {
252 $SVNURL = $TestSVNURL = "";
254 die("please specify a web directory");
257 if ($BuildDir eq "" or
259 die("please specify a build directory, and a web directory");
263 if ($nickname eq "") {
264 die ("Please invoke NewNightlyTest.pl with command line option " .
265 "\"-nickname <nickname>\"");
268 my $LLVMSrcDir = $ENV{'LLVMSRCDIR'};
269 $LLVMSrcDir = "$BuildDir/llvm" unless $LLVMSrcDir;
270 my $LLVMObjDir = $ENV{'LLVMOBJDIR'};
271 $LLVMObjDir = "$BuildDir/llvm" unless $LLVMObjDir;
272 my $LLVMTestDir = $ENV{'LLVMTESTDIR'};
273 $LLVMTestDir = "$BuildDir/llvm/projects/llvm-test" unless $LLVMTestDir;
275 ##############################################################
277 # Define the file names we'll use
279 ##############################################################
281 my $Prefix = "$WebDir/$DATE";
282 my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz";
283 my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz";
284 my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz";
286 # These are only valid in non-config mode.
287 my $ConfigureLog = "", $BuildLog = "", $COLog = "";
288 my $DejagnuLog = "", $DejagnuSum = "", $DejagnuLog = "";
290 # Are we in config mode?
293 ##############################################################
297 ##############################################################
302 my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH;
307 sub RunLoggedCommand {
314 print "$Command 2>&1 | tee $Log\n";
316 system "$Command 2>&1 | tee $Log";
320 print "$Command 2>&1 > $Log\n";
322 system "$Command 2>&1 > $Log";
326 sub RunAppendingLoggedCommand {
333 print "$Command 2>&1 | tee -a $Log\n";
335 system "$Command 2>&1 | tee -a $Log";
339 print "$Command 2>&1 > $Log\n";
341 system "$Command 2>&1 >> $Log";
345 sub GetRegex { # (Regex with ()'s, value)
346 if ($_[1] =~ /$_[0]/m) {
352 sub ChangeDir { # directory, logical name
353 my ($dir,$name) = @_;
355 if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; }
356 $result = chdir($dir);
358 print "ERROR!!! Cannot change directory to: $name ($dir) because $!\n";
365 if (open (FILE, $_[0])) {
372 print "Could not open file '$_[0]' for reading!\n";
377 sub WriteFile { # (filename, contents)
378 open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!\n";
383 sub CopyFile { #filename, newfile
384 my ($file, $newfile) = @_;
386 if ($VERBOSE) { print "Copying $file to $newfile\n"; }
387 copy($file, $newfile);
390 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
392 # This function acts as a mini web browswer submitting data
393 # to our central server via the post method
395 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
401 # Write out the "...-sentdata.txt" file.
404 foreach $x (keys (%$variables)){
405 $value = $variables->{$x};
406 $sentdata.= "$x => $value\n";
408 WriteFile "$Prefix-sentdata.txt", $sentdata;
410 if (!($SUBMITAUX eq "")) {
411 system "$SUBMITAUX \"$Prefix-sentdata.txt\"";
415 return "Skipped standard submit.\n";
418 # Create the content to send to the server.
421 foreach $key (keys (%$variables)){
422 $value = $variables->{$key};
423 $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
424 $content .= "$key=$value&";
427 # Send the data to the server.
429 # FIXME: This code should be more robust?
432 $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n";
433 socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or
435 connect SOCK, $socketaddr or die "Bad connection\n";
436 select((select(SOCK), $| = 1)[0]);
438 $length = length($content);
440 my $send= "POST $file HTTP/1.0\n";
441 $send.= "Host: $host\n";
442 $send.= "Content-Type: application/x-www-form-urlencoded\n";
443 $send.= "Content-length: $length\n\n";
456 ##############################################################
458 # Individual Build & Test Functions
460 ##############################################################
462 # Create the source repository directory.
464 die "Invalid call!" unless $ConfigMode == 0;
468 print "Build directory exists! Removing it\n";
470 system "rm -rf $BuildDir";
471 mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
474 print "Build directory exists!\n";
478 mkdir $BuildDir or die "Could not create checkout directory $BuildDir!";
481 ChangeDir( $BuildDir, "checkout directory" );
482 my $SVNCMD = "$NICE svn co --non-interactive";
483 RunLoggedCommand("( time -p $SVNCMD $SVNURL/llvm/trunk llvm; cd llvm/projects ; " .
484 " $SVNCMD $TestSVNURL/test-suite/trunk llvm-test )", $COLog,
487 RunLoggedCommand("( cd llvm/tools ; " .
488 " $SVNCMD $SVNURL/cfe/trunk clang )", $COLog,
493 # Build the entire tree, saving build messages to the build log. Returns false
496 die "Invalid call!" unless $ConfigMode == 0;
497 my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
498 RunLoggedCommand("(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) ",
499 $ConfigureLog, "CONFIGURE");
500 # Build the entire tree, capturing the output into $BuildLog
502 RunAppendingLoggedCommand("($NICE $MAKECMD $MAKEOPTS clean)", $BuildLog, "BUILD CLEAN");
504 RunAppendingLoggedCommand("(time -p $NICE $MAKECMD $MAKEOPTS)", $BuildLog, "BUILD");
506 if (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
507 `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l` + 0) {
514 # Run the named tests (i.e. "SingleSource" "MultiSource" "External")
517 ChangeDir( "$LLVMTestDir/$SubDir",
518 "Programs Test Subdirectory" ) || return ("", "");
520 my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
522 # Make sure to clean the test results.
523 RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS clean $TESTFLAGS",
524 $ProgramTestLog, "TEST DIRECTORY $SubDir");
526 # Run the programs tests... creating a report.nightly.csv file.
527 my $LLCBetaOpts = "";
528 RunLoggedCommand("$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv ".
529 "$TESTFLAGS TEST=nightly",
530 $ProgramTestLog, "TEST DIRECTORY $SubDir");
531 $LLCBetaOpts = `$MAKECMD print-llcbeta-option`;
534 if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) {
535 $ProgramsTable="Error running test $SubDir\n";
536 print "ERROR TESTING\n";
537 } elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
538 $ProgramsTable="Makefile error running tests $SubDir!\n";
539 print "ERROR TESTING\n";
541 # Create a list of the tests which were run...
542 system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
543 "| sort > $Prefix-$SubDir-Tests.txt";
545 $ProgramsTable = ReadFile "report.nightly.csv";
547 ChangeDir( "../../..", "Programs Test Parent Directory" );
548 return ($ProgramsTable, $LLCBetaOpts);
551 # Run all the nightly tests and return the program tables and the list of tests,
552 # passes, fails, and xfails.
553 sub RunNightlyTest() {
554 ($SSProgs, $llcbeta_options) = TestDirectory("SingleSource");
555 WriteFile "$Prefix-SingleSource-Performance.txt", $SSProgs;
556 ($MSProgs, $llcbeta_options) = TestDirectory("MultiSource");
557 WriteFile "$Prefix-MultiSource-Performance.txt", $MSProgs;
558 if ( ! $NOEXTERNALS ) {
559 ($ExtProgs, $llcbeta_options) = TestDirectory("External");
560 WriteFile "$Prefix-External-Performance.txt", $ExtProgs;
561 system "cat $Prefix-SingleSource-Tests.txt " .
562 "$Prefix-MultiSource-Tests.txt ".
563 "$Prefix-External-Tests.txt | sort > $Prefix-Tests.txt";
564 system "cat $Prefix-SingleSource-Performance.txt " .
565 "$Prefix-MultiSource-Performance.txt ".
566 "$Prefix-External-Performance.txt | sort > $Prefix-Performance.txt";
568 $ExtProgs = "External TEST STAGE SKIPPED\n";
570 print "External TEST STAGE SKIPPED\n";
572 system "cat $Prefix-SingleSource-Tests.txt " .
573 "$Prefix-MultiSource-Tests.txt ".
574 " | sort > $Prefix-Tests.txt";
575 system "cat $Prefix-SingleSource-Performance.txt " .
576 "$Prefix-MultiSource-Performance.txt ".
577 " | sort > $Prefix-Performance.txt";
580 # Compile passes, fails, xfails.
581 my $All = (ReadFile "$Prefix-Tests.txt");
582 my @TestSuiteResultLines = split "\n", $All;
583 my ($Passes, $Fails, $XFails) = "";
585 for ($x=0; $x < @TestSuiteResultLines; $x++) {
586 if (@TestSuiteResultLines[$x] =~ m/^PASS:/) {
587 $Passes .= "$TestSuiteResultLines[$x]\n";
589 elsif (@TestSuiteResultLines[$x] =~ m/^FAIL:/) {
590 $Fails .= "$TestSuiteResultLines[$x]\n";
592 elsif (@TestSuiteResultLines[$x] =~ m/^XFAIL:/) {
593 $XFails .= "$TestSuiteResultLines[$x]\n";
597 return ($SSProgs, $MSProgs, $ExtProgs, $All, $Passes, $Fails, $XFails);
600 ##############################################################
602 # Initialize filenames
604 ##############################################################
607 mkdir $WebDir, 0777 or die "Unable to create web directory: '$WebDir'.";
609 warn "$WebDir did not exist; creating it.\n";
613 if ($CONFIG_PATH ne "") {
615 $LLVMSrcDir = GetRegex "^(.*)\\s+", `$CONFIG_PATH --src-root`;
616 $LLVMObjDir = GetRegex "^(.*)\\s+", `$CONFIG_PATH --obj-root`;
617 # FIXME: Add llvm-config hook for this?
618 $LLVMTestDir = $LLVMObjDir . "/projects/test-suite";
620 $ConfigureLog = "$Prefix-Configure-Log.txt";
621 $BuildLog = "$Prefix-Build-Log.txt";
622 $COLog = "$Prefix-CVS-Log.txt";
626 if ($CONFIG_PATH ne "") {
627 print "INITIALIZED (config mode)\n";
628 print "WebDir = $WebDir\n";
629 print "Prefix = $Prefix\n";
630 print "LLVM Src = $LLVMSrcDir\n";
631 print "LLVM Obj = $LLVMObjDir\n";
632 print "LLVM Test = $LLVMTestDir\n";
634 print "INITIALIZED\n";
635 print "SVN URL = $SVNURL\n";
636 print "COLog = $COLog\n";
637 print "BuildDir = $BuildDir\n";
638 print "WebDir = $WebDir\n";
639 print "Prefix = $Prefix\n";
640 print "BuildLog = $BuildLog\n";
644 ##############################################################
646 # The actual NewNightlyTest logic.
648 ##############################################################
650 $starttime = `date "+20%y-%m-%d %H:%M:%S"`;
652 my $BuildError = 0, $BuildStatus = "OK";
653 if ($ConfigMode == 0) {
659 ChangeDir( $LLVMSrcDir , "llvm source directory") ;
660 if ($NOCHECKOUT || $NOBUILD) {
661 $BuildStatus = "Skipped by user";
664 if( $VERBOSE) { print "\n***ERROR BUILDING TREE\n\n"; }
666 $BuildStatus = "Error: compilation aborted";
671 # Run the llvm-test tests.
672 my ($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable,
673 $all_tests, $passes, $fails, $xfails) = "";
674 if (!$NOTEST && !$BuildError) {
675 ($SingleSourceProgramsTable, $MultiSourceProgramsTable, $ExternalProgramsTable,
676 $all_tests, $passes, $fails, $xfails) = RunNightlyTest();
679 $endtime = `date "+20%y-%m-%d %H:%M:%S"`;
681 # The last bit of logic is to remove the build and web dirs, after sending data
684 ##############################################################
686 # Accumulate the information to send to the server.
688 ##############################################################
690 if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
692 $machine_data = "uname: ".`uname -a`.
693 "hardware: ".`uname -m`.
696 "date: ".`date \"+20%y-%m-%d\"`.
697 "time: ".`date +\"%H:%M:%S\"`;
700 my $gcc_version_long = "";
701 if ($GCCPATH ne "") {
702 $gcc_version_long = `$GCCPATH/gcc --version`;
703 } elsif ($ENV{"CC"}) {
704 $gcc_version_long = `$ENV{"CC"} --version`;
706 $gcc_version_long = `gcc --version`;
708 my $gcc_version = (split '\n', $gcc_version_long)[0];
710 # Get llvm-gcc target triple.
712 # FIXME: This shouldn't be hardwired to llvm-gcc.
713 my $llvmgcc_version_long = "";
714 if ($LLVMGCCPATH ne "") {
715 $llvmgcc_version_long = `$LLVMGCCPATH/llvm-gcc -v 2>&1`;
717 $llvmgcc_version_long = `llvm-gcc -v 2>&1`;
719 (split '\n', $llvmgcc_version_long)[1] =~ /Target: (.+)/;
720 my $targetTriple = $1;
723 my ($ConfigureLogData, $BuildLogData, $CheckoutLogData) = "";
724 if ($ConfigMode == 0) {
725 $ConfigureLogData = ReadFile $ConfigureLog;
726 $BuildLogData = ReadFile $BuildLog;
727 $CheckoutLogData = ReadFile $COLog;
731 my $CheckoutTime_Wall = GetRegex "^real ([0-9.]+)", $CheckoutLogData;
732 my $CheckoutTime_User = GetRegex "^user ([0-9.]+)", $CheckoutLogData;
733 my $CheckoutTime_Sys = GetRegex "^sys ([0-9.]+)", $CheckoutLogData;
734 my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
737 my $ConfigTimeU = GetRegex "^user ([0-9.]+)", $ConfigureLogData;
738 my $ConfigTimeS = GetRegex "^sys ([0-9.]+)", $ConfigureLogData;
739 my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System
740 my $ConfigWallTime = GetRegex "^real ([0-9.]+)",$ConfigureLogData;
741 $ConfigTime=-1 unless $ConfigTime;
742 $ConfigWallTime=-1 unless $ConfigWallTime;
745 my $BuildTimeU = GetRegex "^user ([0-9.]+)", $BuildLogData;
746 my $BuildTimeS = GetRegex "^sys ([0-9.]+)", $BuildLogData;
747 my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System
748 my $BuildWallTime = GetRegex "^real ([0-9.]+)", $BuildLogData;
749 $BuildTime=-1 unless $BuildTime;
750 $BuildWallTime=-1 unless $BuildWallTime;
752 if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
755 'machine_data' => $machine_data,
756 'build_data' => $ConfigureLogData . $BuildLogData,
757 'gcc_version' => $gcc_version,
758 'nickname' => $nickname,
759 'dejagnutime_wall' => "0.0",
760 'dejagnutime_cpu' => "0.0",
761 'cvscheckouttime_wall' => $CheckoutTime_Wall,
762 'cvscheckouttime_cpu' => $CheckoutTime_CPU,
763 'configtime_wall' => $ConfigWallTime,
764 'configtime_cpu'=> $ConfigTime,
765 'buildtime_wall' => $BuildWallTime,
766 'buildtime_cpu' => $BuildTime,
767 'buildstatus' => $BuildStatus,
768 'singlesource_programstable' => $SingleSourceProgramsTable,
769 'multisource_programstable' => $MultiSourceProgramsTable,
770 'externalsource_programstable' => $ExternalProgramsTable,
771 'llcbeta_options' => $llcbeta_options,
772 'passing_tests' => $passes,
773 'expfail_tests' => $xfails,
774 'unexpfail_tests' => $fails,
775 'all_tests' => $all_tests,
776 'dejagnutests_results' => "Dejagnu skipped by user choice.",
777 'dejagnutests_log' => "",
778 'starttime' => $starttime,
779 'endtime' => $endtime,
780 'target_triple' => $targetTriple,
782 # Unused, but left around for backwards compatability.
784 'cvsusercommitlist' => "",
785 'cvsuserupdatelist' => "",
786 'cvsaddedfiles' => "",
787 'cvsmodifiedfiles' => "",
788 'cvsremovedfiles' => "",
789 'lines_of_code' => "",
790 'cvs_file_count' => 0,
791 'cvs_dir_count' => 0,
792 'warnings_removed' => "",
793 'warnings_added' => "",
795 'removed_tests' => "",
796 'o_file_sizes' => "",
800 if ($SUBMIT || !($SUBMITAUX eq "")) {
801 my $response = SendData $SUBMITSERVER,$SUBMITSCRIPT,\%hash_of_data;
802 if( $VERBOSE) { print "============================\n$response"; }
804 print "============================\n";
805 foreach $x(keys %hash_of_data){
806 print "$x => $hash_of_data{$x}\n";
810 ##############################################################
812 # Remove the source tree...
814 ##############################################################
815 system ( "$NICE rm -rf $BuildDir")
816 if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVEATEND);
817 system ( "$NICE rm -rf $WebDir")
818 if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);