1999-04-28 01:32:19 +04:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
require 5.000;
|
|
|
|
|
2000-02-07 05:34:30 +03:00
|
|
|
# This script has split some functions off into a util
|
|
|
|
# script so they can be re-used by other scripts.
|
|
|
|
require "build-seamonkey-util.pl";
|
|
|
|
|
1999-04-28 01:32:19 +04:00
|
|
|
use Sys::Hostname;
|
2000-02-16 05:27:35 +03:00
|
|
|
use POSIX qw(sys_wait_h strftime);
|
1999-04-28 01:32:19 +04:00
|
|
|
use Cwd;
|
|
|
|
|
2000-02-22 05:14:47 +03:00
|
|
|
$Version = '$Revision: 1.60 $ ';
|
1999-04-28 01:32:19 +04:00
|
|
|
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
sub PrintUsage {
|
1999-10-23 00:31:56 +04:00
|
|
|
die <<END_USAGE
|
|
|
|
usage: $0 [options]
|
|
|
|
Options:
|
|
|
|
--depend Build depend (must have this option or clobber).
|
|
|
|
--clobber Build clobber.
|
|
|
|
--once Do not loop.
|
|
|
|
--compress Use '-z3' for cvs.
|
|
|
|
--example-config Print an example 'tinderconfig.pl'.
|
|
|
|
--noreport Do not report status to tinderbox server.
|
2000-02-02 08:20:44 +03:00
|
|
|
--nofinalreport Do not report final status, only start status.
|
1999-11-25 03:07:55 +03:00
|
|
|
--notest Do not run smoke tests.
|
1999-10-23 00:31:56 +04:00
|
|
|
--timestamp Pull by date.
|
|
|
|
-tag TREETAG Pull by tag (-r TREETAG).
|
|
|
|
-t TREENAME The name of the tree
|
|
|
|
--mozconfig FILENAME Provide a mozconfig file for client.mk to use.
|
|
|
|
--version Print the version number (same as cvs revision).
|
1999-11-25 03:07:55 +03:00
|
|
|
--testonly Only run the smoke tests (do not pull or build).
|
1999-10-23 00:31:56 +04:00
|
|
|
--help
|
|
|
|
More details:
|
|
|
|
To get started, run '$0 --example-config'.
|
|
|
|
END_USAGE
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
&InitVars;
|
1999-08-21 05:11:39 +04:00
|
|
|
&ParseArgs;
|
1999-08-21 03:52:18 +04:00
|
|
|
&ConditionalArgs;
|
|
|
|
&GetSystemInfo;
|
1999-08-24 04:23:31 +04:00
|
|
|
&LoadConfig;
|
1999-08-21 03:52:18 +04:00
|
|
|
&SetupEnv;
|
|
|
|
&SetupPath;
|
|
|
|
&BuildIt;
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
1;
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
# End of main
|
|
|
|
# ------------------------------------------------------
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
sub ParseArgs {
|
|
|
|
|
|
|
|
&PrintUsage if $#ARGV == -1;
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 04:49:25 +04:00
|
|
|
while ($arg = shift @ARGV) {
|
1999-08-21 05:06:07 +04:00
|
|
|
$BuildDepend = 0 , next if $arg eq '--clobber';
|
|
|
|
$BuildDepend = 1 , next if $arg eq '--depend';
|
1999-08-21 03:52:18 +04:00
|
|
|
$CVS = 'cvs -q -z3', next if $arg eq '--compress';
|
|
|
|
&PrintExampleConfig, exit if $arg eq '--example-config';
|
|
|
|
&PrintUsage , exit if $arg eq '--help' or $arg eq '-h';
|
|
|
|
$ReportStatus = 0 , next if $arg eq '--noreport';
|
2000-02-02 08:20:44 +03:00
|
|
|
$ReportFinalStatus = 0 , next if $arg eq '--nofinalreport';
|
1999-08-21 03:52:18 +04:00
|
|
|
$RunTest = 0 , next if $arg eq '--notest';
|
|
|
|
$BuildOnce = 1 , next if $arg eq '--once';
|
|
|
|
$UseTimeStamp = 1 , next if $arg eq '--timestamp';
|
1999-10-21 09:16:54 +04:00
|
|
|
$TestOnly = 1 , next if $arg eq '--testonly';
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 05:06:07 +04:00
|
|
|
if ($arg eq '-tag') {
|
1999-08-21 03:52:18 +04:00
|
|
|
$BuildTag = shift @ARGV;
|
|
|
|
&PrintUsage if $BuildTag eq '' or $BuildTag eq '-t';
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
1999-08-21 03:52:18 +04:00
|
|
|
elsif ($arg eq '-t') {
|
|
|
|
$BuildTree = shift @ARGV;
|
|
|
|
&PrintUsage if $BuildTree eq '';
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
1999-10-23 00:31:56 +04:00
|
|
|
elsif ($arg eq '--mozconfig' or $arg eq '--configfile') {
|
|
|
|
# File generated by the build configurator,
|
|
|
|
# http://cvs-mirror.mozilla.org/webtools/build/config.cgi
|
|
|
|
$MozConfigFileName = shift @ARGV;
|
|
|
|
&PrintUsage if $MozConfigFileName eq '';
|
1999-08-21 03:52:18 +04:00
|
|
|
}
|
|
|
|
elsif ($arg eq '--version' or $arg eq '-v') {
|
|
|
|
die "$0: version" . substr($Version,9,6) . "\n";
|
|
|
|
} else {
|
|
|
|
&PrintUsage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&PrintUsage if $BuildTree =~ /^\s+$/i;
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
sub PrintExampleConfig {
|
|
|
|
print "#- tinder-config.pl - Tinderbox configuration file.\n";
|
|
|
|
print "#- Uncomment the variables you need to set.\n";
|
|
|
|
print "#- The default values are the same as the commented variables\n\n";
|
|
|
|
|
|
|
|
while (<DATA>) {
|
|
|
|
s/^\$/\#\$/;
|
|
|
|
print;
|
|
|
|
}
|
|
|
|
}
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
sub ConditionalArgs {
|
2000-02-08 11:55:14 +03:00
|
|
|
my $cvsuser = $ENV{USER};
|
|
|
|
|
2000-02-11 10:45:40 +03:00
|
|
|
$mozillaBinary = 'mozilla-bin';
|
|
|
|
$RelBinaryName = "dist/bin/$mozillaBinary";
|
1999-11-13 05:43:55 +03:00
|
|
|
#$FullBinaryName = "$BaseDir/$DirName/$TopLevel/$Topsrcdir/$RelBinaryName";
|
2000-02-10 20:27:52 +03:00
|
|
|
$ENV{CVSROOT} = ":pserver:$cvsuser%netscape.com\@cvs.mozilla.org:/cvsroot";
|
1999-08-21 03:52:18 +04:00
|
|
|
$CVSCO .= " -r $BuildTag" unless $BuildTag eq '';
|
|
|
|
}
|
1999-04-28 01:32:19 +04:00
|
|
|
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
sub BuildIt {
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-10-23 00:31:56 +04:00
|
|
|
die "\$BuildName is the empty string ('')\n" if $BuildName eq '';
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
mkdir $DirName, 0777;
|
1999-10-23 00:31:56 +04:00
|
|
|
chdir $DirName or die "Couldn't enter $DirName";
|
1999-08-21 03:52:18 +04:00
|
|
|
|
2000-02-16 05:21:44 +03:00
|
|
|
my ($StartDir) = getcwd();
|
|
|
|
my ($LastStartTime) = 0;
|
|
|
|
my ($EarlyExit) = 0;
|
|
|
|
my ($SaveCVSCO) = $CVSCO;
|
1999-08-21 03:52:18 +04:00
|
|
|
|
2000-02-07 05:34:30 +03:00
|
|
|
# Bypass profile at startup.
|
2000-02-16 05:21:44 +03:00
|
|
|
$ENV{MOZ_BYPASS_PROFILE_AT_STARTUP} = 1;
|
2000-02-07 05:34:30 +03:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
print "Starting dir is : $StartDir\n";
|
|
|
|
|
|
|
|
while (not $EarlyExit) {
|
|
|
|
chdir $StartDir;
|
|
|
|
|
2000-02-16 05:21:44 +03:00
|
|
|
if (not $TestOnly and (time - $LastStartTime < (60 * $BuildSleep))) {
|
|
|
|
my ($SleepTime) = (60 * $BuildSleep) - (time - $LastStartTime);
|
1999-08-21 03:52:18 +04:00
|
|
|
print "\n\nSleeping $SleepTime seconds ...\n";
|
|
|
|
sleep $SleepTime;
|
|
|
|
}
|
|
|
|
|
2000-02-16 05:21:44 +03:00
|
|
|
$StartTime = time();
|
|
|
|
$LastStartTime = $StartTime;
|
|
|
|
|
2000-02-18 01:00:03 +03:00
|
|
|
if ($UseTimeStamp) {
|
|
|
|
# Round tinderbox pull times to 1 minute intervals.
|
|
|
|
$cycle = 1 * 60; # Updates every 1 minutes.
|
2000-02-17 04:18:27 +03:00
|
|
|
$begin = 0 * 60; # Starts 0 minutes after the hour.
|
2000-02-18 01:00:03 +03:00
|
|
|
$lag = 0 * 60; # Takes 0 minute to update.
|
2000-02-17 04:44:12 +03:00
|
|
|
$StartTime = int(($StartTime - $begin - $lag) / $cycle) * $cycle + $begin;
|
2000-02-16 05:21:44 +03:00
|
|
|
$BuildStart = strftime("%m/%d/%Y %H:%M", localtime($StartTime));
|
|
|
|
$CVSCO = "$SaveCVSCO -D '$BuildStart'";
|
|
|
|
} else {
|
|
|
|
$CVSCO = "$SaveCVSCO -A";
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
&MailStartBuildMessage if $ReportStatus;
|
|
|
|
|
|
|
|
$CurrentDir = getcwd();
|
|
|
|
if ($CurrentDir ne $StartDir) {
|
|
|
|
print "startdir: $StartDir, curdir $CurrentDir\n";
|
|
|
|
die "curdir != startdir";
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
$BuildDir = $CurrentDir;
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
unlink $logfile;
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
print "Opening $logfile\n";
|
|
|
|
|
1999-10-23 00:31:56 +04:00
|
|
|
open LOG, ">$logfile" or print "can't open $?\n";
|
1999-08-21 03:52:18 +04:00
|
|
|
print LOG "current dir is -- " . $ENV{HOST} . ":$CurrentDir\n";
|
|
|
|
print LOG "Build Administrator is $BuildAdministrator\n";
|
|
|
|
&PrintEnv;
|
|
|
|
if ($Compiler ne '') {
|
|
|
|
print LOG "===============================\n";
|
|
|
|
if ($Compiler eq 'gcc' or $Compiler eq 'egcc') {
|
2000-02-16 05:21:44 +03:00
|
|
|
my $comptmp = `$Compiler --version`;
|
1999-08-21 03:52:18 +04:00
|
|
|
chomp($comptmp);
|
2000-02-16 05:21:44 +03:00
|
|
|
print LOG "Compiler is -- $Compiler ($comptmp)\n";
|
1999-08-21 03:52:18 +04:00
|
|
|
} else {
|
|
|
|
print LOG "Compiler is -- $Compiler\n";
|
|
|
|
}
|
|
|
|
print LOG "===============================\n";
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
1999-08-21 03:52:18 +04:00
|
|
|
|
|
|
|
$BuildStatus = 0;
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
mkdir $TopLevel, 0777;
|
1999-10-23 00:31:56 +04:00
|
|
|
chdir $TopLevel or die "chdir($TopLevel): $!\n";
|
|
|
|
|
|
|
|
unless ($TestOnly) {
|
1999-10-21 09:16:54 +04:00
|
|
|
print "$CVS $CVSCO mozilla/client.mk\n";
|
|
|
|
print LOG "$CVS $CVSCO mozilla/client.mk\n";
|
1999-10-23 00:31:56 +04:00
|
|
|
open PULL, "$CVS $CVSCO mozilla/client.mk 2>&1 |" or die "open: $!\n";
|
1999-10-21 09:16:54 +04:00
|
|
|
while (<PULL>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close PULL;
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
|
|
|
|
1999-10-23 00:31:56 +04:00
|
|
|
chdir $Topsrcdir or die "chdir $Topsrcdir: $!\n";
|
1999-08-21 03:52:18 +04:00
|
|
|
|
1999-10-21 09:16:54 +04:00
|
|
|
|
2000-02-17 10:33:01 +03:00
|
|
|
# Delete the binary before rebuilding
|
|
|
|
if (&BinaryExists($mozillaBinary)) {
|
|
|
|
# Don't delete binary if we're only running tests.
|
|
|
|
unless ($TestOnly) {
|
2000-02-11 10:45:40 +03:00
|
|
|
print LOG "deleting existing binary: $mozillaBinary\n";
|
|
|
|
&DeleteBinary($mozillaBinary);
|
1999-11-13 05:43:55 +03:00
|
|
|
}
|
2000-02-17 10:33:01 +03:00
|
|
|
} else {
|
|
|
|
print LOG "no binary detected, can't delete.\n";
|
|
|
|
}
|
1999-11-13 05:43:55 +03:00
|
|
|
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
$ENV{MOZ_CO_DATE} = "$BuildStart" if $UseTimeStamp;
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-11-13 05:43:55 +03:00
|
|
|
# Don't build if testing smoke tests.
|
1999-10-23 00:31:56 +04:00
|
|
|
unless ($TestOnly) {
|
1999-11-13 05:43:55 +03:00
|
|
|
|
|
|
|
# If we are building depend, don't clobber.
|
1999-10-23 00:31:56 +04:00
|
|
|
if ($BuildDepend) {
|
|
|
|
print LOG "$Make -f client.mk\n";
|
|
|
|
open MAKEDEPEND, "$Make -f client.mk 2>&1 |";
|
|
|
|
while (<MAKEDEPEND>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close MAKEDEPEND;
|
|
|
|
} else {
|
|
|
|
# Building clobber
|
1999-11-10 23:15:32 +03:00
|
|
|
print LOG "$Make -f client.mk checkout realclean build 2>&1 |\n";
|
|
|
|
open MAKECLOBBER, "$Make -f client.mk checkout realclean build 2>&1 |";
|
1999-10-21 09:16:54 +04:00
|
|
|
while (<MAKECLOBBER>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close MAKECLOBBER;
|
1999-08-21 03:52:18 +04:00
|
|
|
}
|
1999-11-13 05:43:55 +03:00
|
|
|
|
|
|
|
} # unless ($TestOnly)
|
|
|
|
|
2000-02-11 10:45:40 +03:00
|
|
|
if (&BinaryExists($mozillaBinary)) {
|
1999-12-06 23:02:37 +03:00
|
|
|
if ($RunTest) {
|
2000-02-11 10:45:40 +03:00
|
|
|
print LOG "$mozillaBinary binary exists, build successful.\n";
|
2000-02-02 08:20:44 +03:00
|
|
|
|
2000-02-02 12:29:56 +03:00
|
|
|
# Mozilla AliveTest.
|
2000-02-02 08:20:44 +03:00
|
|
|
print LOG "Running AliveTest ...\n";
|
|
|
|
print "Running AliveTest ...\n";
|
2000-02-11 10:45:40 +03:00
|
|
|
$BuildStatus = &RunAliveTest($mozillaBinary, 60);
|
2000-02-02 08:20:44 +03:00
|
|
|
|
2000-02-02 12:29:56 +03:00
|
|
|
# ViewerTest.
|
|
|
|
if ($BuildStatus == 0 and $ViewerTest) {
|
|
|
|
print LOG "Running ViewerTest ...\n";
|
|
|
|
print "Running ViewerTest ...\n";
|
2000-02-11 08:20:53 +03:00
|
|
|
$BuildStatus = &RunAliveTest("viewer", 60);
|
2000-02-02 12:29:56 +03:00
|
|
|
}
|
|
|
|
|
2000-02-02 08:20:44 +03:00
|
|
|
# BloatTest.
|
2000-02-11 08:20:53 +03:00
|
|
|
if ($BuildStatus == 0 and ($BloatStats or $BloatTest)) {
|
1999-12-06 23:02:37 +03:00
|
|
|
$BuildStatusStr = 'success';
|
2000-02-02 08:20:44 +03:00
|
|
|
print LOG "Running BloatTest ...\n";
|
|
|
|
print "Running BloatTest ...\n";
|
2000-02-11 10:45:40 +03:00
|
|
|
$BuildStatus = &RunBloatTest;
|
1999-11-13 05:43:55 +03:00
|
|
|
}
|
2000-02-02 08:20:44 +03:00
|
|
|
|
2000-02-11 08:20:53 +03:00
|
|
|
# Run MailNews test.
|
2000-02-11 09:41:22 +03:00
|
|
|
#
|
|
|
|
# This test needs the following security pref set
|
|
|
|
# user_pref("signed.applets.codebase_principal_support", true);
|
|
|
|
# first time around, you get two dialogs, which sets this pref:
|
|
|
|
# user_pref("security.principal.X0", "[Codebase http://www.mozilla.org/quality/mailnews/APITest.html] UniversalBrowserRead=1 UniversalXPConnect=1");
|
|
|
|
#
|
|
|
|
|
2000-02-11 08:20:53 +03:00
|
|
|
if ($BuildStatus == 0 and $MailNewsTest) {
|
|
|
|
$BuildStatusStr = 'success';
|
|
|
|
print LOG "Running MailNewsTest ...\n";
|
|
|
|
print "Running MailNewsTest ...\n";
|
|
|
|
$BuildStatus =
|
|
|
|
&RunFileBasedTest("MailNewsTest",
|
|
|
|
"mozilla-bin http://www.mozilla.org/quality/mailnews/APITest.html",
|
2000-02-18 23:33:09 +03:00
|
|
|
90, "MAILNEWS TEST: Passed", 1); # Hack: testing some partial success string for now.
|
2000-02-11 08:20:53 +03:00
|
|
|
}
|
|
|
|
|
2000-02-02 08:20:44 +03:00
|
|
|
# Run Editor test.
|
2000-02-15 00:12:37 +03:00
|
|
|
if ($BuildStatus == 0 and ($EditorTest or $DomToTextConversionTest)) {
|
2000-02-02 08:20:44 +03:00
|
|
|
$BuildStatusStr = 'success';
|
2000-02-15 00:12:37 +03:00
|
|
|
print LOG "Running DomToTextConversionTest ...\n";
|
|
|
|
print "Running DomToTextConversionTest ...\n";
|
2000-02-17 10:33:01 +03:00
|
|
|
$BuildStatus = &RunFileBasedTest("DomToTextConversionTest", "TestOutSinks", 15, "FAILED", 0);
|
2000-02-02 08:20:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-13 05:43:55 +03:00
|
|
|
} else {
|
2000-02-11 10:45:40 +03:00
|
|
|
print LOG "$mozillaBinary binary exists, build successful. Skipping test.\n";
|
1999-12-06 23:02:37 +03:00
|
|
|
$BuildStatus = 0;
|
|
|
|
}
|
|
|
|
} else {
|
2000-02-11 10:45:40 +03:00
|
|
|
print LOG "Error: $mozillaBinary binary missing, build FAILED\n";
|
2000-02-18 04:30:46 +03:00
|
|
|
|
|
|
|
# If we're only running tests and have no binary, bail.
|
|
|
|
if ($TestOnly) {
|
|
|
|
$EarlyExit++;
|
|
|
|
}
|
|
|
|
|
1999-12-06 23:02:37 +03:00
|
|
|
$BuildStatus = 666;
|
2000-02-11 10:45:40 +03:00
|
|
|
} # if (&BinaryExists($mozillaBinary))
|
1999-11-13 05:43:55 +03:00
|
|
|
|
|
|
|
|
|
|
|
if ($BuildStatus == 0) {
|
|
|
|
$BuildStatusStr = 'success';
|
|
|
|
}
|
|
|
|
elsif ($BuildStatus == 333) {
|
|
|
|
$BuildStatusStr = 'testfailed';
|
|
|
|
} else {
|
|
|
|
$BuildStatusStr = 'busted';
|
|
|
|
}
|
1999-08-21 03:52:18 +04:00
|
|
|
|
|
|
|
close LOG;
|
|
|
|
chdir $StartDir;
|
|
|
|
|
|
|
|
# This fun line added on 2/5/98. do not remove. Translated to english,
|
|
|
|
# that's "take any line longer than 1000 characters, and split it into less
|
|
|
|
# than 1000 char lines. If any of the resulting lines is
|
|
|
|
# a dot on a line by itself, replace that with a blank line."
|
|
|
|
# This is to prevent cases where a <cr>.<cr> occurs in the log file.
|
|
|
|
# Sendmail interprets that as the end of the mail, and truncates the
|
|
|
|
# log before it gets to Tinderbox. (terry weismann, chris yeh)
|
|
|
|
#
|
|
|
|
# This was replaced by a perl 'port' of the above, writen by
|
|
|
|
# preed@netscape.com; good things: no need for system() call, and now it's
|
|
|
|
# all in perl, so we don't have to do OS checking like before.
|
|
|
|
#
|
2000-01-27 04:28:04 +03:00
|
|
|
|
|
|
|
# Rewrite LOG to OUTLOG, shortening lines.
|
1999-10-23 00:31:56 +04:00
|
|
|
open LOG, "$logfile" or die "Couldn't open logfile: $!\n";
|
|
|
|
open OUTLOG, ">${logfile}.last" or die "Couldn't open logfile: $!\n";
|
1999-08-21 03:52:18 +04:00
|
|
|
|
2000-01-27 04:28:04 +03:00
|
|
|
# Stuff the status at the top of the new file, so
|
|
|
|
# we don't need to parse the whole file to get to the
|
|
|
|
# status part on the server-side.
|
|
|
|
print OUTLOG "tinderbox: tree: $BuildTree\n";
|
|
|
|
print OUTLOG "tinderbox: builddate: $StartTime\n";
|
|
|
|
print OUTLOG "tinderbox: status: $BuildStatusStr\n";
|
|
|
|
print OUTLOG "tinderbox: build: $BuildName\n";
|
|
|
|
print OUTLOG "tinderbox: errorparser: unix\n";
|
|
|
|
print OUTLOG "tinderbox: buildfamily: unix\n";
|
|
|
|
print OUTLOG "tinderbox: version: $Version\n";
|
|
|
|
print OUTLOG "tinderbox: END\n";
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
while (<LOG>) {
|
|
|
|
for ($q = 0; ; $q++) {
|
|
|
|
$val = $q * 1000;
|
|
|
|
$Output = substr $_, $val, 1000;
|
|
|
|
|
|
|
|
last if $Output eq undef;
|
|
|
|
|
|
|
|
$Output =~ s/^\.$//g;
|
|
|
|
$Output =~ s/\n//g;
|
|
|
|
print OUTLOG "$Output\n";
|
|
|
|
}
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
1999-08-21 03:52:18 +04:00
|
|
|
|
|
|
|
close OUTLOG;
|
2000-02-15 00:12:37 +03:00
|
|
|
close LOG;
|
|
|
|
|
2000-02-02 08:20:44 +03:00
|
|
|
if ($ReportStatus and $ReportFinalStatus) {
|
|
|
|
system("$mail $Tinderbox_server < ${logfile}.last");
|
|
|
|
}
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
unlink("$logfile");
|
|
|
|
|
|
|
|
# If this is a test run, set early_exit to 0.
|
|
|
|
# This mean one loop of execution
|
|
|
|
$EarlyExit++ if $BuildOnce;
|
|
|
|
}
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
sub MailStartBuildMessage {
|
|
|
|
|
|
|
|
open LOG, "|$mail $Tinderbox_server";
|
1999-11-13 05:43:55 +03:00
|
|
|
|
|
|
|
print LOG "\n";
|
|
|
|
print LOG "tinderbox: tree: $BuildTree\n";
|
|
|
|
print LOG "tinderbox: builddate: $StartTime\n";
|
|
|
|
print LOG "tinderbox: status: building\n";
|
|
|
|
print LOG "tinderbox: build: $BuildName\n";
|
|
|
|
print LOG "tinderbox: errorparser: unix\n";
|
|
|
|
print LOG "tinderbox: buildfamily: unix\n";
|
|
|
|
print LOG "tinderbox: version: $Version\n";
|
|
|
|
print LOG "tinderbox: END\n";
|
|
|
|
print LOG "\n";
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
close LOG;
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# check for the existence of the binary
|
|
|
|
sub BinaryExists {
|
2000-02-11 10:45:40 +03:00
|
|
|
my ($bin) = @_;
|
1999-08-21 03:52:18 +04:00
|
|
|
my $BinName;
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-11-13 05:43:55 +03:00
|
|
|
$BinName = "$BuildDir/$TopLevel/$Topsrcdir/$RelBinaryName";
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
if (-e $BinName and -x _ and -s _) {
|
|
|
|
print LOG "$BinName exists, is nonzero, and executable.\n";
|
1999-04-28 01:32:19 +04:00
|
|
|
1;
|
|
|
|
}
|
|
|
|
else {
|
1999-08-21 03:52:18 +04:00
|
|
|
print LOG "$BinName doesn't exist, is zero-size, or not executable.\n";
|
1999-04-28 01:32:19 +04:00
|
|
|
0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub DeleteBinary {
|
2000-02-11 10:45:40 +03:00
|
|
|
my ($bin) = @_;
|
1999-08-21 03:52:18 +04:00
|
|
|
my $BinName;
|
1999-11-13 05:43:55 +03:00
|
|
|
|
2000-02-11 10:45:40 +03:00
|
|
|
print LOG "DeleteBinary: fe = $bin\n";
|
1999-08-21 03:52:18 +04:00
|
|
|
|
1999-11-13 05:43:55 +03:00
|
|
|
$BinName = "$BuildDir/$TopLevel/${Topsrcdir}/$RelBinaryName";
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
print LOG "unlinking $BinName\n";
|
1999-11-13 05:43:55 +03:00
|
|
|
unlink $BinName or print LOG "ERROR: Unlinking $BinName failed\n";
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
sub PrintEnv {
|
1999-08-21 03:52:18 +04:00
|
|
|
my($key);
|
|
|
|
foreach $key (sort keys %ENV) {
|
|
|
|
print LOG "$key=$ENV{$key}\n";
|
|
|
|
print "$key=$ENV{$key}\n";
|
|
|
|
}
|
1999-08-28 03:37:22 +04:00
|
|
|
if (-e $ENV{MOZCONFIG}) {
|
1999-08-28 04:32:47 +04:00
|
|
|
print LOG "-->mozconfig<----------------------------------------\n";
|
|
|
|
print "-->mozconfig<----------------------------------------\n";
|
1999-08-28 03:37:22 +04:00
|
|
|
open CONFIG, "$ENV{MOZCONFIG}";
|
|
|
|
while (<CONFIG>) {
|
|
|
|
print LOG "$_";
|
|
|
|
print "$_";
|
|
|
|
}
|
|
|
|
close CONFIG;
|
1999-08-28 04:32:47 +04:00
|
|
|
print LOG "-->end mozconfig<----------------------------------------\n";
|
|
|
|
print "-->end mozconfig<----------------------------------------\n";
|
1999-08-28 03:37:22 +04:00
|
|
|
}
|
1999-04-28 01:32:19 +04:00
|
|
|
}
|
|
|
|
|
2000-02-02 08:20:44 +03:00
|
|
|
# Parse a file for $token, given a file handle.
|
|
|
|
# Return 1 if found, 0 otherwise.
|
|
|
|
sub parse_file_for_token {
|
|
|
|
my ($filehandle, $token) = @_;
|
|
|
|
my $foundStatus = 0;
|
|
|
|
local $_;
|
|
|
|
|
|
|
|
while (<$filehandle>) {
|
|
|
|
chomp;
|
|
|
|
if (/$token/) {
|
|
|
|
print "Found a \"$token\"!\n";
|
|
|
|
$foundStatus = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $foundStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-10-26 08:07:03 +04:00
|
|
|
sub killer {
|
|
|
|
&killproc($pid);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub killproc {
|
|
|
|
my ($local_pid) = @_;
|
|
|
|
my $status;
|
|
|
|
|
|
|
|
# try to kill 3 times, then try a kill -9
|
|
|
|
for ($i=0; $i < 3; $i++) {
|
|
|
|
kill('TERM',$local_pid);
|
|
|
|
# give it 3 seconds to actually die
|
|
|
|
sleep 3;
|
|
|
|
$status = waitpid($local_pid, WNOHANG());
|
|
|
|
last if $status != 0;
|
|
|
|
}
|
|
|
|
return $status;
|
|
|
|
}
|
|
|
|
|
2000-02-02 08:20:44 +03:00
|
|
|
#
|
|
|
|
# Start up Mozilla, test passes if Mozilla is still alive
|
|
|
|
# after $waittime (seconds).
|
|
|
|
#
|
1999-11-25 03:07:55 +03:00
|
|
|
sub RunAliveTest {
|
2000-02-11 08:20:53 +03:00
|
|
|
my ($binaryName, $testTimeoutSec) = @_;
|
1999-08-21 03:52:18 +04:00
|
|
|
my $Binary;
|
|
|
|
my $status = 0;
|
2000-02-11 08:20:53 +03:00
|
|
|
$binaryName = 'x' unless defined $binaryName;
|
1999-08-21 03:52:18 +04:00
|
|
|
|
|
|
|
$ENV{LD_LIBRARY_PATH} = "$BuildDir/$TopLevel/$Topsrcdir/dist/bin";
|
|
|
|
$ENV{MOZILLA_FIVE_HOME} = $ENV{LD_LIBRARY_PATH};
|
1999-11-13 05:43:55 +03:00
|
|
|
$Binary = "$BuildDir/$TopLevel/$Topsrcdir/$RelBinaryName";
|
1999-08-21 03:52:18 +04:00
|
|
|
|
|
|
|
print LOG "$Binary\n";
|
|
|
|
$BinaryDir = "$BuildDir/$TopLevel/$Topsrcdir/dist/bin";
|
2000-02-11 08:20:53 +03:00
|
|
|
$Binary = "$BuildDir/$TopLevel/$Topsrcdir/dist/bin/$binaryName";
|
1999-08-21 03:52:18 +04:00
|
|
|
$BinaryLog = $BuildDir . '/runlog';
|
|
|
|
|
1999-10-26 08:07:03 +04:00
|
|
|
# Fork off a child process.
|
|
|
|
$pid = fork;
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
unless ($pid) { # child
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
chdir $BinaryDir;
|
|
|
|
unlink $BinaryLog;
|
|
|
|
$SaveHome = $ENV{HOME};
|
|
|
|
$ENV{HOME} = $BinaryDir;
|
|
|
|
open STDOUT, ">$BinaryLog";
|
|
|
|
select STDOUT; $| = 1; # make STDOUT unbuffered
|
|
|
|
open STDERR,">&STDOUT";
|
|
|
|
select STDERR; $| = 1; # make STDERR unbuffered
|
|
|
|
exec $Binary;
|
|
|
|
close STDOUT;
|
|
|
|
close STDERR;
|
|
|
|
$ENV{HOME} = $SaveHome;
|
|
|
|
die "Couldn't exec()";
|
|
|
|
}
|
|
|
|
|
2000-02-11 08:20:53 +03:00
|
|
|
# parent - wait $testTimeoutSec seconds then check on child
|
|
|
|
sleep $testTimeoutSec;
|
1999-08-21 03:52:18 +04:00
|
|
|
$status = waitpid($pid, WNOHANG());
|
1999-10-21 09:16:54 +04:00
|
|
|
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "$binaryName quit AliveTest with status $status\n";
|
1999-08-21 03:52:18 +04:00
|
|
|
if ($status != 0) {
|
2000-02-12 01:53:58 +03:00
|
|
|
print LOG "Error: $binaryName has crashed or quit on the AliveTest. Turn the tree orange now.\n";
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "----------- failure output from $binaryName for alive test --------------- \n";
|
1999-08-21 03:52:18 +04:00
|
|
|
open READRUNLOG, "$BinaryLog";
|
1999-04-28 01:32:19 +04:00
|
|
|
while (<READRUNLOG>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
1999-08-21 03:52:18 +04:00
|
|
|
close READRUNLOG;
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "--------------- End of AliveTest($binaryName) Output -------------------- \n";
|
1999-08-21 03:52:18 +04:00
|
|
|
return 333;
|
|
|
|
}
|
|
|
|
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "Success! $binaryName is still running.\n";
|
1999-04-28 01:32:19 +04:00
|
|
|
|
1999-10-27 03:10:35 +04:00
|
|
|
&killproc($pid);
|
1999-10-26 08:07:03 +04:00
|
|
|
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "----------- success output from $binaryName for alive test --------------- \n";
|
1999-10-21 09:16:54 +04:00
|
|
|
open READRUNLOG, "$BinaryLog";
|
|
|
|
while (<READRUNLOG>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close READRUNLOG;
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "--------------- End of AliveTest ($binaryName) Output -------------------- \n";
|
1999-10-21 09:16:54 +04:00
|
|
|
return 0;
|
2000-02-02 08:20:44 +03:00
|
|
|
|
|
|
|
} # RunAliveTest
|
|
|
|
|
|
|
|
# Run a generic test that writes output
|
|
|
|
# to stdout, save that output to a file,
|
|
|
|
# parse the file looking for failure token and
|
|
|
|
# report status based on that. A hack, but should
|
|
|
|
# be useful for many tests.
|
|
|
|
#
|
2000-02-11 08:20:53 +03:00
|
|
|
# testName = Name of test we're gonna run, in dist/bin.
|
|
|
|
# testExecString = How to run the test
|
2000-02-02 08:20:44 +03:00
|
|
|
# testTimeoutSec = Timeout for hung tests, minimum test time.
|
2000-02-17 10:33:01 +03:00
|
|
|
# statusToken = What string to look for in test output to
|
|
|
|
# determine test status.
|
|
|
|
#
|
|
|
|
# statusTokenMeansPass = Default use of status token is to look for failure string.
|
|
|
|
# If this is set to 1, then invert logic to look for success
|
|
|
|
# string.
|
2000-02-02 08:20:44 +03:00
|
|
|
#
|
|
|
|
# Note: I tried to merge this function with RunAliveTest(),
|
|
|
|
# the process flow control got too confusing :( -mcafee
|
|
|
|
#
|
|
|
|
sub RunFileBasedTest {
|
2000-02-17 10:33:01 +03:00
|
|
|
my ($testName, $testExecString, $testTimeoutSec, $statusToken, $statusTokenMeansPass) = @_;
|
2000-02-02 08:20:44 +03:00
|
|
|
my $Binary;
|
|
|
|
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "testExecString = ", $testExecString, "\n";
|
2000-02-02 08:20:44 +03:00
|
|
|
|
|
|
|
$ENV{LD_LIBRARY_PATH} = "$BuildDir/$TopLevel/$Topsrcdir/dist/bin";
|
|
|
|
$ENV{MOZILLA_FIVE_HOME} = $ENV{LD_LIBRARY_PATH};
|
|
|
|
|
|
|
|
$BinaryDir = "$BuildDir/$TopLevel/$Topsrcdir/dist/bin";
|
2000-02-11 08:20:53 +03:00
|
|
|
|
|
|
|
# Assume the app is the first argument in the execString.
|
|
|
|
@parseExecString = split ' ', $testExecString;
|
|
|
|
$Binary = $BinaryDir . '/' . $parseExecString[0];
|
|
|
|
|
|
|
|
$BinaryLog = $BuildDir . '/' .$testName . '.log';
|
2000-02-02 08:20:44 +03:00
|
|
|
|
|
|
|
# If we care about log files, clear the old log, if there is one.
|
|
|
|
unlink($BinaryLog);
|
|
|
|
|
|
|
|
print LOG "Binary = ", $Binary, "\n";
|
|
|
|
print "Binary = ", $Binary, "\n";
|
|
|
|
|
|
|
|
print LOG "BinaryLog = ", $BinaryLog, "\n";
|
|
|
|
print "BinaryLog = ", $BinaryLog, "\n";
|
|
|
|
|
|
|
|
# Fork off a child process.
|
|
|
|
$pid = fork;
|
|
|
|
|
|
|
|
unless ($pid) { # child
|
|
|
|
print "child\n";
|
|
|
|
print LOG "child\n";
|
|
|
|
|
|
|
|
print LOG "2:Binary = ", $Binary, "\n";
|
|
|
|
print "2:Binary = ", $Binary, "\n";
|
|
|
|
|
|
|
|
|
|
|
|
# The following set of lines makes stdout/stderr show up
|
|
|
|
# in the tinderbox logs.
|
|
|
|
$SaveHome = $ENV{HOME};
|
|
|
|
$ENV{HOME} = $BinaryDir;
|
|
|
|
open STDOUT, ">$BinaryLog";
|
|
|
|
select STDOUT; $| = 1; # make STDOUT unbuffered
|
|
|
|
open STDERR,">&STDOUT";
|
|
|
|
select STDERR; $| = 1; # make STDERR unbuffered
|
|
|
|
|
|
|
|
|
|
|
|
# Timestamp when we're running the test.
|
|
|
|
print LOG `date`, "\n";
|
|
|
|
print `date`, "\n";
|
|
|
|
|
|
|
|
if (-e $Binary) {
|
2000-02-11 08:20:53 +03:00
|
|
|
$cmd = "$testExecString";
|
2000-02-02 08:20:44 +03:00
|
|
|
print LOG $cmd, "\n";
|
|
|
|
print $cmd, "\n";
|
|
|
|
print LOG $cmd;
|
|
|
|
chdir($BinaryDir);
|
|
|
|
exec ($cmd);
|
|
|
|
} else {
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "ERROR: cannot run ", $testName, ".\n";
|
|
|
|
print "ERROR: cannot run ", $testName, ".\n";
|
2000-02-02 08:20:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
close STDOUT;
|
|
|
|
close STDERR;
|
|
|
|
$ENV{HOME} = $SaveHome;
|
|
|
|
die "Couldn't exec()";
|
|
|
|
} else {
|
|
|
|
print "parent\n";
|
|
|
|
print LOG "parent\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
# Set up a timer with a signal handler.
|
|
|
|
$SIG{ALRM} = \&killer;
|
|
|
|
|
|
|
|
# Wait $testTimeoutSec seconds, then kill the process if it's still alive.
|
|
|
|
alarm $testTimeoutSec;
|
2000-02-11 08:20:53 +03:00
|
|
|
print "testTimeoutSec = $testTimeoutSec\n";
|
|
|
|
print LOG "testTimeoutSec = $testTimeoutSec\n";
|
2000-02-02 08:20:44 +03:00
|
|
|
|
|
|
|
$status = waitpid($pid, 0);
|
|
|
|
|
|
|
|
# Back to parent.
|
|
|
|
|
|
|
|
# Clear the alarm so we don't kill the next test!
|
|
|
|
alarm 0;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Determine proper status, look in log file for failure token.
|
2000-02-11 08:20:53 +03:00
|
|
|
# XXX: What if test is supposed to exit, but crashes? -mcafee
|
|
|
|
|
|
|
|
print LOG "$testName exited with status $status\n";
|
|
|
|
|
|
|
|
if ($status < 0) {
|
|
|
|
print LOG "$testName timed out and needed to be killed.\n";
|
|
|
|
} else {
|
|
|
|
print LOG "$testName completed on its own, before the timeout.\n";
|
|
|
|
}
|
2000-02-02 08:20:44 +03:00
|
|
|
|
|
|
|
open TESTLOG, "<$BinaryLog" or die "Can't open $!";
|
2000-02-17 10:33:01 +03:00
|
|
|
# Return 1 if we find statusToken in output.
|
|
|
|
$status = parse_file_for_token(*TESTLOG, $statusToken);
|
|
|
|
|
|
|
|
if($status) {
|
|
|
|
print LOG "found statusToken $statusToken!\n";
|
|
|
|
} else {
|
|
|
|
print LOG "statusToken $statusToken not found\n";
|
|
|
|
}
|
|
|
|
|
2000-02-02 08:20:44 +03:00
|
|
|
close TESTLOG;
|
|
|
|
|
2000-02-17 10:33:01 +03:00
|
|
|
# If we're using success string, invert status logic.
|
|
|
|
if($statusTokenMeansPass == 1) {
|
|
|
|
# Invert $status. This is probably sloppy perl, help me!
|
|
|
|
if($status == 0) {
|
|
|
|
$status = 1;
|
|
|
|
} else {
|
|
|
|
$status = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-02-02 08:20:44 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# Write test output to log.
|
|
|
|
#
|
|
|
|
if ($status != 0) {
|
2000-02-12 01:53:58 +03:00
|
|
|
print LOG "Error: $testName has failed. Turn the tree orange now.\n";
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "----------- failure output from ", $testName, " test --------------- \n";
|
2000-02-02 08:20:44 +03:00
|
|
|
} else {
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "----------- success output from ", $testName, " test --------------- \n";
|
2000-02-02 08:20:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
# Parse the test log, dumping lines into tinderbox log.
|
|
|
|
open READRUNLOG, "$BinaryLog";
|
|
|
|
while (<READRUNLOG>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close READRUNLOG;
|
2000-02-11 08:20:53 +03:00
|
|
|
print LOG "--------------- End of ", $testName, " Output -------------------- \n";
|
2000-02-02 08:20:44 +03:00
|
|
|
|
|
|
|
# 0 = success, 333 = orange.
|
|
|
|
if ($status != 0) {
|
|
|
|
return 333;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
} # RunFileBasedTest
|
|
|
|
|
1999-10-21 09:16:54 +04:00
|
|
|
|
|
|
|
sub RunBloatTest {
|
|
|
|
my $Binary;
|
|
|
|
my $status = 0;
|
2000-02-11 10:45:40 +03:00
|
|
|
$bin = 'x' unless defined $bin;
|
1999-10-21 09:16:54 +04:00
|
|
|
|
1999-12-06 03:47:33 +03:00
|
|
|
print LOG "in runBloatTest\n";
|
1999-10-21 09:16:54 +04:00
|
|
|
|
|
|
|
$ENV{LD_LIBRARY_PATH} = "$BuildDir/$TopLevel/$Topsrcdir/dist/bin";
|
|
|
|
$ENV{MOZILLA_FIVE_HOME} = $ENV{LD_LIBRARY_PATH};
|
|
|
|
|
|
|
|
# Turn on ref counting to track leaks (bloaty tool).
|
1999-10-25 02:37:34 +04:00
|
|
|
$ENV{XPCOM_MEM_BLOAT_LOG} = "1";
|
|
|
|
|
1999-12-06 03:47:33 +03:00
|
|
|
$Binary = "$BuildDir/$TopLevel/$Topsrcdir/$RelBinaryName";
|
1999-10-21 09:16:54 +04:00
|
|
|
$BinaryDir = "$BuildDir/$TopLevel/$Topsrcdir/dist/bin";
|
1999-10-29 03:02:10 +04:00
|
|
|
$BinaryLog = $BuildDir . '/bloat-cur.log';
|
1999-10-21 09:16:54 +04:00
|
|
|
|
1999-10-29 03:02:10 +04:00
|
|
|
rename ($BinaryLog, "$BuildDir/bloat-prev.log");
|
1999-10-21 09:16:54 +04:00
|
|
|
|
1999-10-26 08:07:03 +04:00
|
|
|
# Fork off a child process.
|
|
|
|
$pid = fork;
|
|
|
|
|
1999-10-21 09:16:54 +04:00
|
|
|
unless ($pid) { # child
|
|
|
|
chdir $BinaryDir;
|
1999-10-29 03:02:10 +04:00
|
|
|
|
1999-10-21 09:16:54 +04:00
|
|
|
$SaveHome = $ENV{HOME};
|
|
|
|
$ENV{HOME} = $BinaryDir;
|
|
|
|
open STDOUT, ">$BinaryLog";
|
|
|
|
select STDOUT; $| = 1; # make STDOUT unbuffered
|
|
|
|
open STDERR,">&STDOUT";
|
|
|
|
select STDERR; $| = 1; # make STDERR unbuffered
|
|
|
|
|
1999-12-06 03:47:33 +03:00
|
|
|
if (-e "bloaturls.txt") {
|
|
|
|
$cmd = "$Binary -f bloaturls.txt";
|
|
|
|
print LOG $cmd;
|
|
|
|
exec ($cmd);
|
|
|
|
} else {
|
1999-12-10 10:59:11 +03:00
|
|
|
print LOG "ERROR: bloaturls.txt does not exist.\n";
|
1999-12-06 03:47:33 +03:00
|
|
|
}
|
1999-10-21 09:16:54 +04:00
|
|
|
|
|
|
|
close STDOUT;
|
|
|
|
close STDERR;
|
|
|
|
$ENV{HOME} = $SaveHome;
|
|
|
|
die "Couldn't exec()";
|
|
|
|
}
|
|
|
|
|
1999-10-26 08:07:03 +04:00
|
|
|
# Set up a timer with a signal handler.
|
|
|
|
$SIG{ALRM} = \&killer;
|
|
|
|
|
2000-01-10 11:19:12 +03:00
|
|
|
# Wait 120 seconds, then kill the process if it's still alive.
|
|
|
|
alarm 120;
|
1999-10-26 08:07:03 +04:00
|
|
|
|
1999-10-21 09:16:54 +04:00
|
|
|
$status = waitpid($pid, 0);
|
1999-10-27 03:10:35 +04:00
|
|
|
|
|
|
|
# Clear the alarm so we don't kill the next test!
|
|
|
|
alarm 0;
|
|
|
|
|
2000-02-22 05:14:47 +03:00
|
|
|
print LOG "$mozillaBinary quit Bloat Test with status $status\n";
|
2000-01-09 09:12:02 +03:00
|
|
|
if ($status <= 0) {
|
2000-02-22 05:14:47 +03:00
|
|
|
print LOG "Error: $mozillaBinary has crashed or quit on the BloatTest. Turn the tree orange now.\n";
|
|
|
|
print LOG "----------- failure Output from $mozillaBinary for BloatTest --------------- \n";
|
1999-10-21 09:16:54 +04:00
|
|
|
open READRUNLOG, "$BinaryLog";
|
|
|
|
while (<READRUNLOG>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close READRUNLOG;
|
1999-12-06 03:47:33 +03:00
|
|
|
print LOG "--------------- End of BloatTest Output -------------------- \n";
|
2000-01-10 11:27:21 +03:00
|
|
|
|
|
|
|
# HACK. Clobber isn't reporting bloat status properly,
|
|
|
|
# only turn tree orange for depend build. This has
|
|
|
|
# been filed as bug 22052. -mcafee
|
|
|
|
if ($BuildDepend == 1) {
|
|
|
|
return 333;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
1999-10-21 09:16:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
print LOG "<a href=#bloat>\n######################## BLOAT STATISTICS\n";
|
1999-10-26 08:07:03 +04:00
|
|
|
|
|
|
|
|
1999-12-06 03:47:33 +03:00
|
|
|
open DIFF, "$BuildDir/../bloatdiff.pl $BuildDir/bloat-prev.log $BinaryLog |" or
|
|
|
|
die "Unable to run bloatdiff.pl";
|
1999-10-26 08:07:03 +04:00
|
|
|
|
1999-10-21 09:16:54 +04:00
|
|
|
while (my $line = <DIFF>) {
|
|
|
|
print LOG $line;
|
|
|
|
}
|
|
|
|
close(DIFF);
|
|
|
|
print LOG "######################## END BLOAT STATISTICS\n</a>\n";
|
|
|
|
|
2000-02-22 05:14:47 +03:00
|
|
|
print LOG "----------- success output from $mozillaBinary for BloatTest --------------- \n";
|
1999-08-21 03:52:18 +04:00
|
|
|
open READRUNLOG, "$BinaryLog";
|
|
|
|
while (<READRUNLOG>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close READRUNLOG;
|
1999-12-06 03:47:33 +03:00
|
|
|
print LOG "--------------- End of BloatTest Output -------------------- \n";
|
1999-08-21 03:52:18 +04:00
|
|
|
return 0;
|
1999-10-21 09:16:54 +04:00
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
}
|
1999-04-28 01:32:19 +04:00
|
|
|
|
2000-02-02 08:20:44 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
1999-08-21 03:52:18 +04:00
|
|
|
__END__
|
|
|
|
#- PLEASE FILL THIS IN WITH YOUR PROPER EMAIL ADDRESS
|
|
|
|
$BuildAdministrator = "$ENV{USER}\@$ENV{HOST}";
|
|
|
|
|
|
|
|
#- You'll need to change these to suit your machine's needs
|
|
|
|
$BaseDir = '/builds/tinderbox/SeaMonkey';
|
1999-11-25 03:07:55 +03:00
|
|
|
$DisplayServer = ':0.0';
|
1999-08-21 03:52:18 +04:00
|
|
|
|
|
|
|
#- Default values of command-line opts
|
|
|
|
#-
|
2000-02-02 08:20:44 +03:00
|
|
|
$BuildDepend = 1; # Depend or Clobber
|
|
|
|
$ReportStatus = 1; # Send results to server, or not
|
|
|
|
$ReportFinalStatus = 1; # Finer control over $ReportStatus.
|
|
|
|
$BuildOnce = 0; # Build once, don't send results to server
|
|
|
|
$RunTest = 1; # Run the smoke tests on successful build, or not
|
|
|
|
$UseTimeStamp = 1; # Use the CVS 'pull-by-timestamp' option, or not
|
|
|
|
$TestOnly = 0; # Only run tests, don't pull/build
|
1999-08-21 03:52:18 +04:00
|
|
|
|
|
|
|
#- Set these to what makes sense for your system
|
|
|
|
$Make = 'gmake'; # Must be GNU make
|
|
|
|
$MakeOverrides = '';
|
|
|
|
$mail = '/bin/mail';
|
|
|
|
$CVS = 'cvs -q';
|
|
|
|
$CVSCO = 'checkout -P';
|
|
|
|
|
|
|
|
#- Set these proper values for your tinderbox server
|
2000-01-31 11:00:22 +03:00
|
|
|
$Tinderbox_server = 'tinderbox-daemon@tinderbox.mozilla.org';
|
1999-08-21 03:52:18 +04:00
|
|
|
|
|
|
|
#-
|
|
|
|
#- The rest should not need to be changed
|
|
|
|
#-
|
|
|
|
|
|
|
|
#- Minimum wait period from start of build to start of next build in minutes.
|
|
|
|
$BuildSleep = 10;
|
|
|
|
|
|
|
|
#- Until you get the script working. When it works,
|
|
|
|
#- change to the tree you're actually building
|
|
|
|
$BuildTree = 'MozillaTest';
|
|
|
|
|
|
|
|
$BuildName = '';
|
|
|
|
$BuildTag = '';
|
|
|
|
$BuildObjName = '';
|
|
|
|
$BuildConfigDir = 'mozilla/config';
|
|
|
|
$BuildStart = '';
|
|
|
|
$TopLevel = '.';
|
|
|
|
$Topsrcdir = 'mozilla';
|
|
|
|
$ClobberStr = 'realclean';
|
|
|
|
$ConfigureEnvArgs = '';
|
|
|
|
$ConfigureArgs = ' --cache-file=/dev/null ';
|
|
|
|
$ConfigGuess = './build/autoconf/config.guess';
|
|
|
|
$Logfile = '${BuildDir}.log';
|
|
|
|
$Compiler = 'gcc';
|
|
|
|
$ShellOverride = ''; # Only used if the default shell is too stupid
|
1999-10-23 00:31:56 +04:00
|
|
|
|
|
|
|
# Need to end with a true value, (since we're using "require").
|
|
|
|
1;
|