mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 11:27:49 +00:00
add tinderbox standalone tests, b=343899 r=davel
This commit is contained in:
parent
3ed60e4aa8
commit
6ef51c6250
92
testing/tinderbox-standalone-tests/Tests.pm
Normal file
92
testing/tinderbox-standalone-tests/Tests.pm
Normal file
@ -0,0 +1,92 @@
|
||||
package Tests;
|
||||
|
||||
use Util;
|
||||
use strict;
|
||||
|
||||
my $objdir = '';
|
||||
|
||||
sub global_prefs {
|
||||
my ($binary, $embed_binary, $build_dir) = @_;
|
||||
|
||||
my $binary_basename = File::Basename::basename($binary);
|
||||
my $binary_dir = File::Basename::dirname($binary);
|
||||
my $embed_binary_basename = File::Basename::basename($embed_binary);
|
||||
my $embed_binary_dir = File::Basename::dirname($embed_binary);
|
||||
|
||||
my $test_result = 'success';
|
||||
|
||||
# Windows needs this for file: urls.
|
||||
my $win32_build_dir = $build_dir;
|
||||
if ($Settings::OS =~ /^WIN/ && $win32_build_dir !~ m/^.:\//) {
|
||||
chomp($win32_build_dir = `cygpath -w $win32_build_dir`);
|
||||
$win32_build_dir =~ s/\\/\//g;
|
||||
}
|
||||
|
||||
#
|
||||
# Set prefs to run tests properly.
|
||||
#
|
||||
# Chances are we will be timing these tests. Bring gettime() into memory
|
||||
# by calling it once, before any tests run.
|
||||
Time::PossiblyHiRes::getTime();
|
||||
|
||||
my $pref_file = 'prefs.js';
|
||||
|
||||
# Some tests need browser.dom.window.dump.enabled set to true, so
|
||||
# that JS dump() will work in optimized builds.
|
||||
Prefs::set_pref($pref_file, 'browser.dom.window.dump.enabled', 'true');
|
||||
|
||||
# Set security prefs to allow us to close our own window,
|
||||
# pageloader test (and possibly other tests) needs this on.
|
||||
Prefs::set_pref($pref_file, 'dom.allow_scripts_to_close_windows', 'true');
|
||||
|
||||
# Set security prefs to allow us to resize our windows.
|
||||
# DHTML and Tgfx perf tests (and possibly other tests) need this off.
|
||||
Prefs::set_pref($pref_file, 'dom.disable_window_flip', 'false');
|
||||
|
||||
# Set prefs to allow us to move, resize, and raise/lower the
|
||||
# current window. Tgfx needs this.
|
||||
Prefs::set_pref($pref_file, 'dom.disable_window_flip', 'false');
|
||||
Prefs::set_pref($pref_file, 'dom.disable_window_move_resize', 'false');
|
||||
|
||||
# Suppress firefox's popup blocking
|
||||
if ($Settings::BinaryName =~ /^firefox/) {
|
||||
Prefs::set_pref($pref_file, 'privacy.popups.firstTime', 'false');
|
||||
Prefs::set_pref($pref_file, 'dom.disable_open_during_load', 'false');
|
||||
|
||||
# Suppress default browser dialog
|
||||
Prefs::set_pref($pref_file, 'browser.shell.checkDefaultBrowser', 'false');
|
||||
|
||||
# Suppress session restore dialog
|
||||
Prefs::set_pref($pref_file, 'browser.sessionstore.resume_from_crash', 'false');
|
||||
}
|
||||
elsif ($Settings::BinaryName eq 'Camino') {
|
||||
Prefs::set_pref($pref_file, 'camino.check_default_browser', 'false');
|
||||
}
|
||||
|
||||
# Suppress security warnings for QA test.
|
||||
if ($Settings::QATest) {
|
||||
Prefs::set_pref($pref_file, 'security.warn_submit_insecure', 'true');
|
||||
}
|
||||
|
||||
#
|
||||
# Assume that we want to test modern skin for all tests.
|
||||
#
|
||||
if (system("\\grep -s general.skins.selectedSkin \"$pref_file\" > /dev/null")) {
|
||||
Util::print_log("Setting general.skins.selectedSkin to modern/1.0\n");
|
||||
open PREFS, ">>$pref_file" or die "can't open $pref_file ($?)\n";
|
||||
print PREFS "user_pref(\"general.skins.selectedSkin\", \"modern/1.0\");\n";
|
||||
close PREFS;
|
||||
} else {
|
||||
Util::print_log("Modern skin already set.\n");
|
||||
}
|
||||
|
||||
if ($Settings::BinaryName eq 'Camino') {
|
||||
# stdout will be block-buffered and will not be flushed when the test
|
||||
# timeout expires and the process is killed, this would make tests
|
||||
# appear to fail.
|
||||
$ENV{'MOZ_UNBUFFERED_STDIO'} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
39
testing/tinderbox-standalone-tests/Tests/AliveTest.pm
Normal file
39
testing/tinderbox-standalone-tests/Tests/AliveTest.pm
Normal file
@ -0,0 +1,39 @@
|
||||
# Start up Mozilla, test passes if Mozilla is still alive
|
||||
# after $Settings::AliveTestTimeout (seconds).
|
||||
#
|
||||
sub AliveTest {
|
||||
my ($build_dir, $binary) = @_;
|
||||
my $binary_basename = File::Basename::basename($binary);
|
||||
my $binary_dir = File::Basename::dirname($binary);
|
||||
my $binary_log = "$build_dir/MozillaAliveTest.log";
|
||||
my $args = [$binary];
|
||||
local $_;
|
||||
|
||||
# Print out testname
|
||||
Util::print_log("\n\nRunning AliveTest test ...\n");
|
||||
|
||||
# Debug
|
||||
Util::print_log("build_dir = $build_dir ...\n");
|
||||
Util::print_log("binary_dir = $binary_dir ...\n");
|
||||
Util::print_log("binary = $binary ...\n");
|
||||
|
||||
# Print out timeout.
|
||||
Util::print_log("Timeout = $Settings::AliveTestTimeout seconds.\n");
|
||||
|
||||
my $result = Util::run_cmd($build_dir, $binary_dir, $args,
|
||||
$Settings::AliveTestTimeout);
|
||||
|
||||
Util::print_logfile($binary_log, "AliveTest");
|
||||
|
||||
if ($result->{timed_out}) {
|
||||
Util::print_log("AliveTest: $binary_basename successfully stayed up".
|
||||
" for $Settings::AliveTestTimeout seconds.\n");
|
||||
return 'success';
|
||||
} else {
|
||||
Util::print_test_errors($result, $binary_basename);
|
||||
Util::print_log("AliveTest: did not time out\n");
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
@ -0,0 +1,29 @@
|
||||
# Same as AliveTest, but look for a token in the log and return
|
||||
# the value. (used for startup iteration test).
|
||||
sub AliveTestReturnToken {
|
||||
my ($test_name, $build_dir, $args, $timeout_secs, $token, $delimiter) = @_;
|
||||
my $status;
|
||||
my $rv = 0;
|
||||
|
||||
# Same as in AliveTest, needs to match in order to find the log file.
|
||||
my $binary = @$args[0];
|
||||
my $binary_basename = File::Basename::basename($binary);
|
||||
my $binary_dir = File::Basename::dirname($binary);
|
||||
my $binary_log = "$build_dir/$test_name.log";
|
||||
|
||||
$status = AliveTest($test_name, $build_dir, $args, $timeout_secs);
|
||||
|
||||
# Look for and return token
|
||||
if ($status) {
|
||||
$rv = Util::extract_token_from_file($binary_log, $token, $delimiter);
|
||||
chomp($rv);
|
||||
chop($rv) if ($rv =~ /\r$/); # cygwin perl doesn't chomp dos-newlinesproperly so use chop.
|
||||
if ($rv) {
|
||||
print "AliveTestReturnToken: token value = $rv\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $rv;
|
||||
}
|
||||
|
||||
return 1;
|
135
testing/tinderbox-standalone-tests/Tests/BloatTest.pm
Normal file
135
testing/tinderbox-standalone-tests/Tests/BloatTest.pm
Normal file
@ -0,0 +1,135 @@
|
||||
# Page loader/cycling mechanism (mozilla -f option):
|
||||
# If you are building optimized, you need to add
|
||||
# --enable-logrefcnt
|
||||
# to turn the pageloader code on. These are on by default for debug.
|
||||
#
|
||||
sub BloatTest {
|
||||
my ($binary, $build_dir, $bloat_args, $bloatdiff_label, $timeout_secs) = @_;
|
||||
my $binary_basename = File::Basename::basename($binary);
|
||||
my $binary_dir = File::Basename::dirname($binary);
|
||||
my $binary_log = "$build_dir/bloat-cur.log";
|
||||
my $old_binary_log = "$build_dir/bloat-prev.log";
|
||||
local $_;
|
||||
|
||||
rename($binary_log, $old_binary_log);
|
||||
|
||||
unless (-e "$binary_dir/bloaturls.txt") {
|
||||
Util::print_log("Error: bloaturls.txt does not exist.\n");
|
||||
return 'testfailed';
|
||||
}
|
||||
|
||||
my $platform = $Settings::OS =~ /^WIN/ ? 'windows' : 'unix';
|
||||
# If on Windows, make sure the urls file has dos lineendings, or
|
||||
# mozilla won't parse the file correctly
|
||||
if ($platform eq 'windows') {
|
||||
my $bu = "$binary_dir/bloaturls.txt";
|
||||
open(IN,"$bu") || die ("$bu: $!\n");
|
||||
open(OUT,">$bu.new") || die ("$bu.new: $!\n");
|
||||
while (<IN>) {
|
||||
if (! m/\r\n$/) {
|
||||
s/\n$/\r\n/;
|
||||
}
|
||||
print OUT "$_";
|
||||
}
|
||||
close(IN);
|
||||
close(OUT);
|
||||
File::Copy::move("$bu.new", "$bu") or die("move: $!\n");
|
||||
}
|
||||
|
||||
$ENV{XPCOM_MEM_BLOAT_LOG} = 1; # Turn on ref counting to track leaks.
|
||||
|
||||
# Build up binary command, look for profile.
|
||||
my @args = ($binary_basename);
|
||||
unless (($Settings::MozProfileName eq "") or
|
||||
($Settings::BinaryName eq "TestGtkEmbed")) {
|
||||
@args = (@args, "-P", $Settings::MozProfileName);
|
||||
}
|
||||
@args = (@args, @$bloat_args);
|
||||
|
||||
my $result = Util::run_cmd($build_dir, $binary_dir, \@args, $timeout_secs);
|
||||
$ENV{XPCOM_MEM_BLOAT_LOG} = 0;
|
||||
delete $ENV{XPCOM_MEM_BLOAT_LOG};
|
||||
|
||||
Util::print_logfile($binary_log, "$bloatdiff_label bloat test");
|
||||
|
||||
if ($result->{timed_out}) {
|
||||
Util::print_log("Error: bloat test timed out after"
|
||||
." $timeout_secs seconds.\n");
|
||||
return 'testfailed';
|
||||
} elsif ($result->{exit_value}) {
|
||||
Util::print_test_errors($result, $binary_basename);
|
||||
Util::print_log("Error: bloat test failed.\n");
|
||||
return 'testfailed';
|
||||
}
|
||||
|
||||
# Print out bloatdiff stats, also look for TOTAL line for leak/bloat #s.
|
||||
Util::print_log("<a href=#bloat>\n######################## BLOAT STATISTICS\n");
|
||||
my $found_total_line = 0;
|
||||
my @total_line_array;
|
||||
open DIFF, "perl $build_dir/../bloatdiff.pl $build_dir/bloat-prev.log $binary_log $bloatdiff_label|"
|
||||
or die "Unable to run bloatdiff.pl";
|
||||
while (<DIFF>) {
|
||||
Util::print_log($_);
|
||||
|
||||
# Look for fist TOTAL line
|
||||
unless ($found_total_line) {
|
||||
if (/TOTAL/) {
|
||||
@total_line_array = split(" ", $_);
|
||||
$found_total_line = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
close DIFF;
|
||||
Util::print_log("######################## END BLOAT STATISTICS\n</a>\n");
|
||||
|
||||
|
||||
# Scrape for leak/bloat totals from TOTAL line
|
||||
# TOTAL 23 0% 876224
|
||||
my $leaks = $total_line_array[1];
|
||||
my $bloat = $total_line_array[3];
|
||||
|
||||
Util::print_log("leaks = $leaks\n");
|
||||
Util::print_log("bloat = $bloat\n");
|
||||
|
||||
# Figure out what the label prefix is.
|
||||
my $label_prefix = "";
|
||||
my $testname_prefix = "";
|
||||
unless($bloatdiff_label eq "") {
|
||||
$label_prefix = "$bloatdiff_label ";
|
||||
$testname_prefix = "$bloatdiff_label" . "_";
|
||||
}
|
||||
|
||||
# Figure out testnames to send to server
|
||||
my $leaks_testname = "refcnt_leaks";
|
||||
my $bloat_testname = "refcnt_bloat";
|
||||
unless($bloatdiff_label eq "") {
|
||||
$leaks_testname = $testname_prefix . "refcnt_leaks";
|
||||
$bloat_testname = $testname_prefix . "refcnt_bloat";
|
||||
}
|
||||
|
||||
# Figure out testname labels
|
||||
my $leaks_testname_label = "refcnt Leaks";
|
||||
my $bloat_testname_label = "refcnt Bloat";
|
||||
unless($bloatdiff_label eq "") {
|
||||
$leaks_testname_label = $label_prefix . $leaks_testname_label;
|
||||
$bloat_testname_label = $label_prefix . $bloat_testname_label;
|
||||
}
|
||||
|
||||
my $embed_prefix = "";
|
||||
if($Settings::BinaryName eq "TestGtkEmbed") {
|
||||
$embed_prefix = "m";
|
||||
}
|
||||
|
||||
Util::print_log_test_result_bytes($leaks_testname, $leaks_testname_label,
|
||||
$leaks,
|
||||
$label_prefix . $embed_prefix . 'RLk', 3);
|
||||
|
||||
if($Settings::TestsPhoneHome) {
|
||||
# Report numbers to server.
|
||||
Util::send_results_to_server($leaks, "--", $leaks_testname);
|
||||
}
|
||||
|
||||
return 'success';
|
||||
}
|
||||
|
||||
1;
|
135
testing/tinderbox-standalone-tests/Tests/BloatTest2.pm
Normal file
135
testing/tinderbox-standalone-tests/Tests/BloatTest2.pm
Normal file
@ -0,0 +1,135 @@
|
||||
sub BloatTest2 {
|
||||
my ($binary, $build_dir, $timeout_secs) = @_;
|
||||
my $binary_basename = File::Basename::basename($binary);
|
||||
my $binary_dir = File::Basename::dirname($binary);
|
||||
my $PERL = $^X;
|
||||
if ($Settings::OS =~ /^WIN/ && $build_dir !~ m/^.:\//) {
|
||||
chomp($build_dir = `cygpath -w $build_dir`);
|
||||
$build_dir =~ s/\\/\//g;
|
||||
$PERL = "perl";
|
||||
}
|
||||
my $binary_log = "$build_dir/bloattest2.log";
|
||||
my $malloc_log = "$build_dir/malloc.log";
|
||||
my $sdleak_log = "$build_dir/sdleak.log";
|
||||
my $old_sdleak_log = "$build_dir/sdleak.log.old";
|
||||
my $leakstats_log = "$build_dir/leakstats.log";
|
||||
my $old_leakstats_log = "$build_dir/leakstats.log.old";
|
||||
my $sdleak_diff_log = "$build_dir/sdleak.diff.log";
|
||||
local $_;
|
||||
|
||||
unless (-e "$binary_dir/bloaturls.txt") {
|
||||
Util::print_log("Error: bloaturls.txt does not exist.\n");
|
||||
return 'testfailed';
|
||||
}
|
||||
|
||||
my $platform = $Settings::OS =~ /^WIN/ ? 'windows' : 'unix';
|
||||
# If on Windows, make sure the urls file has dos lineendings, or
|
||||
# mozilla won't parse the file correctly
|
||||
if ($platform eq 'windows') {
|
||||
my $bu = "$binary_dir/bloaturls.txt";
|
||||
open(IN,"$bu") || die ("$bu: $!\n");
|
||||
open(OUT,">$bu.new") || die ("$bu.new: $!\n");
|
||||
while (<IN>) {
|
||||
if (! m/\r\n$/) {
|
||||
s/\n$/\r\n/;
|
||||
}
|
||||
print OUT "$_";
|
||||
}
|
||||
close(IN);
|
||||
close(OUT);
|
||||
File::Copy::move("$bu.new", "$bu") or die("move: $!\n");
|
||||
}
|
||||
|
||||
rename($sdleak_log, $old_sdleak_log);
|
||||
|
||||
my @args;
|
||||
if($Settings::BinaryName eq "TestGtkEmbed" ||
|
||||
$Settings::BinaryName =~ /^firefox/) {
|
||||
@args = ($binary_basename, "-P", $Settings::MozProfileName,
|
||||
"resource:///res/bloatcycle.html",
|
||||
"--trace-malloc", $malloc_log);
|
||||
} else {
|
||||
@args = ($binary_basename, "-P", $Settings::MozProfileName,
|
||||
"-f", "bloaturls.txt",
|
||||
"--trace-malloc", $malloc_log);
|
||||
}
|
||||
|
||||
# win32 builds crash on multiple runs when --shutdown-leaks is used
|
||||
@args = (@args, "--shutdown-leaks", $sdleak_log) unless $Settings::OS =~ /^WIN/;
|
||||
my $result = Util::run_cmd($build_dir, $binary_dir, \@args, $timeout_secs);
|
||||
|
||||
Util::print_logfile($binary_log, "trace-malloc bloat test");
|
||||
|
||||
if ($result->{timed_out}) {
|
||||
Util::print_log("Error: bloat test timed out after"
|
||||
." $timeout_secs seconds.\n");
|
||||
return 'testfailed';
|
||||
} elsif ($result->{exit_value}) {
|
||||
Util::print_test_errors($result, $binary_basename);
|
||||
Util::print_log("Error: bloat test failed.\n");
|
||||
return 'testfailed';
|
||||
}
|
||||
|
||||
rename($leakstats_log, $old_leakstats_log);
|
||||
|
||||
if ($Settings::OS =~ /^WIN/) {
|
||||
@args = ("leakstats", $malloc_log);
|
||||
} else {
|
||||
@args = ("run-mozilla.sh", "./leakstats", $malloc_log);
|
||||
}
|
||||
$result = Util::run_cmd($build_dir, $binary_dir, \@args, $timeout_secs);
|
||||
Util::print_logfile($leakstats_log, "trace-malloc bloat test: leakstats");
|
||||
|
||||
my $newstats = ReadLeakstatsLog($leakstats_log);
|
||||
my $oldstats;
|
||||
if (-e $old_leakstats_log) {
|
||||
$oldstats = ReadLeakstatsLog($old_leakstats_log);
|
||||
} else {
|
||||
$oldstats = $newstats;
|
||||
}
|
||||
my $leakchange = PercentChange($oldstats->{'leaks'}, $newstats->{'leaks'});
|
||||
my $mhschange = PercentChange($oldstats->{'mhs'}, $newstats->{'mhs'});
|
||||
|
||||
my $leaks_testname_label = "Leaks: total bytes 'malloc'ed and not 'free'd";
|
||||
my $maxheap_testname_label = "Maximum Heap: max (bytes 'malloc'ed - bytes 'free'd) over run";
|
||||
my $allocs_testname_label = "Allocations: number of calls to 'malloc' and friends";
|
||||
|
||||
my $embed_prefix = "";
|
||||
if($Settings::BinaryName eq "TestGtkEmbed") {
|
||||
$embed_prefix = "m";
|
||||
}
|
||||
|
||||
my $leaks_testname = "trace_malloc_leaks";
|
||||
Util::print_log_test_result_bytes($leaks_testname, $leaks_testname_label,
|
||||
$newstats->{'leaks'},
|
||||
$embed_prefix . 'Lk', 3);
|
||||
|
||||
my $maxheap_testname = "trace_malloc_maxheap";
|
||||
Util::print_log_test_result_bytes($maxheap_testname,
|
||||
$maxheap_testname_label,
|
||||
$newstats->{'mhs'},
|
||||
$embed_prefix . 'MH', 3);
|
||||
|
||||
my $allocs_testname = "trace_malloc_allocs";
|
||||
Util::print_log_test_result_count($allocs_testname, $allocs_testname_label,
|
||||
$newstats->{'allocs'},
|
||||
$embed_prefix . 'A', 3);
|
||||
|
||||
if ($Settings::TestsPhoneHome) {
|
||||
# Send results to server.
|
||||
Util::send_results_to_server($newstats->{'leaks'}, "--", $leaks_testname);
|
||||
Util::send_results_to_server($newstats->{'mhs'}, "--", $maxheap_testname);
|
||||
Util::send_results_to_server($newstats->{'allocs'}, "--", $allocs_testname);
|
||||
}
|
||||
|
||||
if (-e $old_sdleak_log && -e $sdleak_log) {
|
||||
Util::print_logfile($old_leakstats_log, "previous run of trace-malloc bloat test leakstats");
|
||||
@args = ($PERL, "$build_dir/mozilla/tools/trace-malloc/diffbloatdump.pl", "--depth=15", $old_sdleak_log, $sdleak_log);
|
||||
$result = Util::run_cmd($build_dir, $binary_dir, \@args, $timeout_secs);
|
||||
Util::print_logfile($sdleak_diff_log, "trace-malloc leak stats differences");
|
||||
}
|
||||
|
||||
return 'success';
|
||||
}
|
||||
|
||||
1;
|
127
testing/tinderbox-standalone-tests/Tests/CodesizeTest.pm
Normal file
127
testing/tinderbox-standalone-tests/Tests/CodesizeTest.pm
Normal file
@ -0,0 +1,127 @@
|
||||
#
|
||||
# Codesize test. Needs: cvs checkout mozilla/tools/codesighs
|
||||
#
|
||||
# This test can be run in two modes. One for the whole SeaMonkey
|
||||
# tree, the other for just the embedding stuff.
|
||||
#
|
||||
sub CodesizeTest {
|
||||
my ($test_name, $build_dir, $isEmbedTest) = @_;
|
||||
|
||||
my $topsrcdir = "$build_dir/mozilla";
|
||||
|
||||
# test needs this set
|
||||
$ENV{MOZ_MAPINFO} = "1";
|
||||
$ENV{TINDERBOX_OUTPUT} = "1";
|
||||
|
||||
#chdir(".."); # up one level.
|
||||
|
||||
my $cwd = get_system_cwd();
|
||||
Util::print_log("cwd = $cwd\n");
|
||||
|
||||
my $type; # "auto" or "base"
|
||||
my $zee; # Letter that shows up on tbox.
|
||||
my $testNameString;
|
||||
my $graphName;
|
||||
|
||||
if($isEmbedTest) {
|
||||
$testNameString = "Embed";
|
||||
$type = "base"; # Embed test.
|
||||
$zee = "mZ";
|
||||
$graphName = "codesize_embed";
|
||||
} else {
|
||||
if ($Settings::ProductName eq 'Mozilla') {
|
||||
$testNameString = "SeaMonkey";
|
||||
} else {
|
||||
$testNameString = $Settings::ProductName;
|
||||
}
|
||||
$type = "auto"; # SeaMonkey test.
|
||||
$zee = "Z";
|
||||
$graphName = "codesize";
|
||||
}
|
||||
|
||||
my $new_log = "Codesize-" . $type . "-new.log";
|
||||
my $old_log = "Codesize-" . $type . "-old.log";
|
||||
my $diff_log = "Codesize-" . $type . "-diff.log";
|
||||
my $test_log = "$test_name.log";
|
||||
|
||||
Util::print_log("\$build_dir = $build_dir\n");
|
||||
|
||||
# Clear the logs from the last run, so we can properly test for success.
|
||||
unlink("$build_dir/$new_log");
|
||||
unlink("$build_dir/$diff_log");
|
||||
unlink("$build_dir/$test_log");
|
||||
|
||||
my $bash_cmd = "$topsrcdir/tools/codesighs/";
|
||||
if ($Settings::CodesizeManifest ne '') {
|
||||
$type = '';
|
||||
}
|
||||
if ($Settings::OS =~ /^WIN/ && $Settings::Compiler ne "gcc") {
|
||||
$bash_cmd .= $type . "summary.win.bash";
|
||||
} else {
|
||||
# Assume Linux for non-windows for now.
|
||||
$bash_cmd .= $type . "summary.unix.bash";
|
||||
}
|
||||
|
||||
my $cmd = ["bash", $bash_cmd];
|
||||
push(@{$cmd}, "-o", "$objdir") if ($Settings::ObjDir ne "");
|
||||
if ($Settings::CodesizeManifest ne '') {
|
||||
push(@{$cmd}, "mozilla/$Settings::CodesizeManifest");
|
||||
}
|
||||
push(@{$cmd}, $new_log, $old_log, $diff_log);
|
||||
|
||||
my $test_result =
|
||||
FileBasedTest($test_name,
|
||||
"$build_dir",
|
||||
"$build_dir", # run top of tree, not in dist.
|
||||
$cmd,
|
||||
$Settings::CodesizeTestTimeout,
|
||||
"FAILED", # Fake out failure mode, test file instead.
|
||||
0, 0); # Timeout means failure.
|
||||
|
||||
# Set status based on file creation.
|
||||
if (-e "$build_dir/$new_log") {
|
||||
Util::print_log("found $build_dir/$new_log\n");
|
||||
$test_result = 'success';
|
||||
|
||||
# Print diff data to tbox log.
|
||||
if (-e "$build_dir/$diff_log") {
|
||||
Util::print_logfile("$build_dir/$diff_log", "codesize diff log");
|
||||
}
|
||||
|
||||
#
|
||||
# Extract data.
|
||||
#
|
||||
my $z_data = Util::extract_token_from_file("$build_dir/$test_log", "__codesize", ":");
|
||||
chomp($z_data);
|
||||
Util::print_log_test_result_bytes($graphName,
|
||||
"$testNameString: Code + data size of all shared libs & executables",
|
||||
$z_data, $zee, 4);
|
||||
|
||||
if($Settings::TestsPhoneHome) {
|
||||
Util::send_results_to_server($z_data, "--", $graphName);
|
||||
}
|
||||
|
||||
my $zdiff_data = Util::extract_token_from_file("$build_dir/$test_log", "__codesizeDiff", ":");
|
||||
chomp($zdiff_data);
|
||||
|
||||
# Print out Zdiff if not zero. Testing "zero" by looking for "+0 ".
|
||||
my $zdiff_sample = substr($zdiff_data,0,3);
|
||||
if (not ($zdiff_sample eq "+0 ")) {
|
||||
Util::print_log("<a title=\"Change from last $zee value (+added/-subtracted)\" TinderboxPrint:" . $zee . "diff:$zdiff_data</a>\n");
|
||||
}
|
||||
|
||||
# Testing only! Moves the old log to some unique name for testing.
|
||||
# my $time = POSIX::strftime "%d%H%M%S", localtime;
|
||||
# rename("$build_dir/$old_log", "$build_dir/$old_log.$time");
|
||||
|
||||
# Get ready for next cycle.
|
||||
rename("$build_dir/$new_log", "$build_dir/$old_log");
|
||||
|
||||
|
||||
} else {
|
||||
Util::print_log("Error: $build_dir/$new_log not found.\n");
|
||||
$test_result = 'buildfailed';
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
@ -0,0 +1,38 @@
|
||||
sub DHTMLPerformanceTest {
|
||||
my ($build_dir, $binary) = @_;
|
||||
my $dhtml_test_result;
|
||||
my $binary_basename = File::Basename::basename($binary);
|
||||
my $binary_dir = File::Basename::dirname($binary);
|
||||
my $binary_log = "$build_dir/DHTMLPerformanceTest.log";
|
||||
my $url = "http://www.mozilla.org/performance/test-cases/dhtml/runTests.html";
|
||||
my $timeout_secs = 3;
|
||||
my $args = [$binary, $url];
|
||||
|
||||
# Settle OS.
|
||||
system('/bin/sh -c "sync; sleep 5"');
|
||||
|
||||
my $result = Util::run_cmd($build_dir, $binary_dir, $args, $timeout_secs);
|
||||
|
||||
my $dhtml_time = Util::extract_token($result->{output},
|
||||
"_x_x_mozilla_dhtml",
|
||||
",");
|
||||
|
||||
if($dhtml_time) {
|
||||
$dhtml_test_result = 'success';
|
||||
} else {
|
||||
$dhtml_test_result = 'testfailed';
|
||||
Util::print_log("DHTMLTest: test failed\n");
|
||||
}
|
||||
|
||||
if($dhtml_test_result eq 'success') {
|
||||
Util::print_log_test_result_ms('dhtml', 'DHTML time',
|
||||
$dhtml_time, 'Tdhtml');
|
||||
if ($Settings::TestsPhoneHome) {
|
||||
Util::send_results_to_server($dhtml_time, "--", "dhtml");
|
||||
}
|
||||
}
|
||||
|
||||
return $dhtml_test_result;
|
||||
}
|
||||
|
||||
1;
|
64
testing/tinderbox-standalone-tests/Tests/FileBasedTest.pm
Normal file
64
testing/tinderbox-standalone-tests/Tests/FileBasedTest.pm
Normal file
@ -0,0 +1,64 @@
|
||||
# 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.
|
||||
#
|
||||
# test_name = Name of test we're gonna run, in $Settings::DistBin.
|
||||
# testExecString = How to run the test
|
||||
# testTimeoutSec = Timeout for hung tests, minimum test time.
|
||||
# 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.
|
||||
#
|
||||
# timeout_is_ok = Don't report test failure if test times out.
|
||||
#
|
||||
# Note: I tried to merge this function with AliveTest(),
|
||||
# the process flow control got too confusing :( -mcafee
|
||||
#
|
||||
sub FileBasedTest {
|
||||
my ($test_name, $build_dir, $binary_dir, $test_args, $timeout_secs,
|
||||
$status_token, $status_token_means_pass, $timeout_is_ok) = @_;
|
||||
local $_;
|
||||
|
||||
# Assume the app is the first argument in the array.
|
||||
my ($binary_basename) = @$test_args[0];
|
||||
my $binary_log = "$build_dir/$test_name.log";
|
||||
|
||||
# Print out test name
|
||||
Util::print_log("\n\nRunning $test_name ...\n");
|
||||
|
||||
my $result = Util::run_cmd($build_dir, $binary_dir, $test_args,
|
||||
$timeout_secs);
|
||||
|
||||
Util::print_logfile($binary_log, $result->{output});
|
||||
Util::print_logfile($binary_log, $test_name);
|
||||
|
||||
if (($result->{timed_out}) and (!$timeout_is_ok)) {
|
||||
Util::print_log("Error: $test_name timed out after $timeout_secs seconds.\n");
|
||||
return 'testfailed';
|
||||
} elsif ($result->{exit_value} != 0) {
|
||||
Util::print_log("Error: $test_name exited with status $result->{exit_value}\n");
|
||||
Util::print_test_errors($result, $test_name);
|
||||
return 'testfailed';
|
||||
} else {
|
||||
Util::print_log("$test_name exited normally\n");
|
||||
}
|
||||
|
||||
my $found_token = file_has_token($binary_log, $status_token);
|
||||
if ($found_token) {
|
||||
Util::print_log("Found status token in log file: $status_token\n");
|
||||
} else {
|
||||
Util::print_log("Status token, $status_token, not found\n");
|
||||
}
|
||||
|
||||
if (($status_token_means_pass and $found_token) or
|
||||
(not $status_token_means_pass and not $found_token)) {
|
||||
return 'success';
|
||||
} else {
|
||||
Util::print_log("Error: $test_name has failed.\n");
|
||||
return 'testfailed';
|
||||
}
|
||||
} # FileBasedTest
|
||||
|
||||
1;
|
@ -0,0 +1,66 @@
|
||||
sub LayoutPerformanceTest {
|
||||
my ($build_dir, $binary) = @_;
|
||||
|
||||
my $layout_test_result;
|
||||
my $layout_time_details;
|
||||
my $binary_basename = File::Basename::basename($binary);
|
||||
my $binary_dir = File::Basename::dirname($binary);
|
||||
#my $url = "http://$Settings::pageload_server/page-loader/loader.pl?delay=1000&nocache=0&maxcyc=4&timeout=$Settings::LayoutPerformanceTestPageTimeout&auto=1";
|
||||
my $timeout_secs = 4500;
|
||||
my $url = 'file:///home/rhelmer/src/mozilla/tools/performance/pageload/cycler.html';
|
||||
$args = [$binary, $url];
|
||||
|
||||
# Settle OS.
|
||||
system('/bin/sh -c "sync; sleep 5"');
|
||||
|
||||
|
||||
my $result = Util::run_cmd($build_dir, $binary_dir, $args, $timeout_secs);
|
||||
|
||||
my $layout_time = Util::extract_token(
|
||||
$result->{output},
|
||||
"_x_x_mozilla_page_load",
|
||||
",");
|
||||
|
||||
if($layout_time) {
|
||||
chomp($layout_time);
|
||||
my @times = split(',', $layout_time);
|
||||
$layout_time = $times[0]; # Set layout time to first number.
|
||||
print("Layout time: $layout_time");
|
||||
} else {
|
||||
Util::print_log("TinderboxPrint:Tp:[CRASH]\n");
|
||||
}
|
||||
|
||||
# Set test status.
|
||||
if($layout_time) {
|
||||
$layout_test_result = 'success';
|
||||
Util::print_log("LayoutPerformanceTest: test succeeded\n");
|
||||
} else {
|
||||
$layout_test_result = 'testfailed';
|
||||
Util::print_log("LayoutPerformanceTest: test failed\n");
|
||||
}
|
||||
|
||||
if($layout_test_result eq 'success') {
|
||||
my $tp_prefix = "";
|
||||
if($Settings::BinaryName eq "TestGtkEmbed") {
|
||||
$tp_prefix = "m";
|
||||
}
|
||||
|
||||
Util::print_log_test_result_ms('pageload',
|
||||
'Avg of the median per url pageload time',
|
||||
$layout_time, 'Tp');
|
||||
|
||||
# Pull out detail data from log.
|
||||
my $raw_data = Util::extract_token($result->{output},
|
||||
"_x_x_mozilla_page_load_details",
|
||||
",");
|
||||
chomp($raw_data);
|
||||
|
||||
if($Settings::TestsPhoneHome) {
|
||||
Util::send_results_to_server($layout_time, $raw_data, "pageload");
|
||||
}
|
||||
}
|
||||
|
||||
return $layout_test_result;
|
||||
}
|
||||
|
||||
1;
|
50
testing/tinderbox-standalone-tests/Tests/QATest.pm
Normal file
50
testing/tinderbox-standalone-tests/Tests/QATest.pm
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
# Client-side JavaScript, DOM Core/HTML/Views, and Form Submission tests.
|
||||
# Currently only available inside netscape firewall.
|
||||
sub QATest {
|
||||
my ($test_name, $build_dir, $binary_dir, $args) = @_;
|
||||
my $binary_log = "$build_dir/$test_name.log";
|
||||
my $url = "http://geckoqa.mcom.com/ngdriver/cgi-bin/ngdriver.cgi?findsuites=suites&tbox=1";
|
||||
|
||||
# Settle OS.
|
||||
system('/bin/sh -c "sync; sleep 5"');
|
||||
|
||||
my $rv;
|
||||
|
||||
$rv = AliveTest("QATest_raw", $build_dir,
|
||||
[@$args, $url],
|
||||
$Settings::QATestTimeout);
|
||||
|
||||
# XXXX testing. -mcafee
|
||||
$rv = 'success';
|
||||
|
||||
|
||||
# Post-process log of test output.
|
||||
my $mode = "express";
|
||||
open QATEST, "perl $build_dir/../qatest.pl $build_dir/QATest_raw.log $mode |"
|
||||
or die "Unable to run qatest.pl";
|
||||
my $qatest_html = "";
|
||||
while (<QATEST>) {
|
||||
chomp;
|
||||
#$_ =~ s/\"/"/g; #### it doesn't like this line
|
||||
# $_ =~ s/\012//g;
|
||||
### $_ =~ s/\s+\S/ /g; # compress whitespace.
|
||||
$qatest_html .= $_;
|
||||
}
|
||||
close QATEST;
|
||||
Util::print_log("\n");
|
||||
|
||||
# This works.
|
||||
#$qatest_html = "<table border=2 cellspacing=0><tr%20valign=top><td> </td><td>Passed</td><td>Failed</td><td>Total</td><td>Died</td><td>% Passed</td><td>% Failed</td></tr><tr%20valign=top><td>DHTML</a></td><td>9</td><td>0</td><td>9</td><td>0</td><td>100</td><td>0</td></tr><tr%20valign=top><td>DOM VIEWS</a></td><td>2</td><td>0</td><td>2</td><td>0</td><td>100</td><td>0</td></tr><tr%20valign=top><td>Total:</td><td>11</td><td>0</td><td>11</td><td>0</td><td>100</td><td>0</td></tr></table>";
|
||||
|
||||
# Testing output
|
||||
open TEST_OUTPUT, ">qatest_out.log";
|
||||
print TEST_OUTPUT $qatest_html;
|
||||
close TEST_OUTPUT;
|
||||
|
||||
Util::print_log("TinderboxPrint:<a href=\"javascript:var newwin;newwin=window.open("","","menubar=no,resizable=yes,height=150,width=500");var newdoc=newwin.document;newdoc.write('$qatest_html');newdoc.close();\">QA</a>\n");
|
||||
|
||||
return $rv; # Hard-coded for now.
|
||||
}
|
||||
|
||||
1;
|
42
testing/tinderbox-standalone-tests/Tests/ReadLeakstatsLog.pm
Normal file
42
testing/tinderbox-standalone-tests/Tests/ReadLeakstatsLog.pm
Normal file
@ -0,0 +1,42 @@
|
||||
# Page loader (-f option):
|
||||
# If you are building optimized, you need to add
|
||||
# --enable-trace-malloc --enable-perf-metrics
|
||||
# to turn the pageloader code on. If you are building debug you only
|
||||
# need
|
||||
# --enable-trace-malloc
|
||||
#
|
||||
|
||||
sub ReadLeakstatsLog($) {
|
||||
my ($filename) = @_;
|
||||
my $leaks = 0;
|
||||
my $leaked_allocs = 0;
|
||||
my $mhs = 0;
|
||||
my $bytes = 0;
|
||||
my $allocs = 0;
|
||||
|
||||
open LEAKSTATS, "$filename"
|
||||
or die "unable to open $filename";
|
||||
while (<LEAKSTATS>) {
|
||||
chop;
|
||||
my $line = $_;
|
||||
if ($line =~ /Leaks: (\d+) bytes, (\d+) allocations/) {
|
||||
$leaks = $1;
|
||||
$leaked_allocs = $2;
|
||||
} elsif ($line =~ /Maximum Heap Size: (\d+) bytes/) {
|
||||
$mhs = $1;
|
||||
} elsif ($line =~ /(\d+) bytes were allocated in (\d+) allocations./) {
|
||||
$bytes = $1;
|
||||
$allocs = $2;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'leaks' => $leaks,
|
||||
'leaked_allocs' => $leaked_allocs,
|
||||
'mhs' => $mhs,
|
||||
'bytes' => $bytes,
|
||||
'allocs' => $allocs
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
19
testing/tinderbox-standalone-tests/Tests/Regxpcom.pm
Normal file
19
testing/tinderbox-standalone-tests/Tests/Regxpcom.pm
Normal file
@ -0,0 +1,19 @@
|
||||
sub Regxpcom {
|
||||
#
|
||||
# Before running tests, run regxpcom so that we don't crash when
|
||||
# people change contractids on us (since we don't autoreg opt builds)
|
||||
#
|
||||
unlink("$binary_dir/components/compreg.dat") or warn "$binary_dir/components/compreg.dat not removed\n";
|
||||
if($Settings::RegxpcomTest) {
|
||||
my $args;
|
||||
if ($Settings::BinaryName =~ /^(firefox|thunderbird)/) {
|
||||
$args = [$binary, "-register"];
|
||||
} else {
|
||||
$args = ["$binary_dir/regxpcom"];
|
||||
}
|
||||
AliveTest("regxpcom", $binary_dir, $args,
|
||||
$Settings::RegxpcomTestTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
@ -0,0 +1,87 @@
|
||||
|
||||
#
|
||||
# Trender test
|
||||
#
|
||||
|
||||
sub RenderPerformanceTest {
|
||||
my ($test_name, $build_dir, $binary_dir, $args) = @_;
|
||||
my $render_test_result;
|
||||
my $render_time;
|
||||
my $render_gfx_time;
|
||||
my $render_details;
|
||||
my $binary_log = "$build_dir/$test_name.log";
|
||||
my $url;
|
||||
|
||||
# Find Trender.xml
|
||||
if (-f "/cygdrive/c/builds/tinderbox/Trender/Trender.xml") {
|
||||
$url = "file:///C:/builds/tinderbox/Trender/Trender.xml#tinderbox=1";
|
||||
} elsif (-f "/builds/tinderbox/Trender/Trender.xml") {
|
||||
$url = "file:///builds/tinderbox/Trender/Trender.xml#tinderbox=1";
|
||||
} else {
|
||||
Util::print_log("TinderboxPrint:Trender:[NOTFOUND]\n");
|
||||
return 'testfailed';
|
||||
}
|
||||
|
||||
# Settle OS.
|
||||
system('/bin/sh -c "sync; sleep 5"');
|
||||
|
||||
$render_test_result = FileBasedTest($test_name, $build_dir, $binary_dir,
|
||||
[@$args, $url],
|
||||
$Settings::RenderTestTimeout,
|
||||
"_x_x_mozilla_trender", 1, 1);
|
||||
|
||||
# double check to make sure the test didn't really succeed
|
||||
# even though the scripts think it failed. Prevents various breakage
|
||||
# (e.g. when a timeout happens on the mac, killing the process returns
|
||||
# a bogus result code). FileBasedTest checks the status code
|
||||
# before the token
|
||||
my $found_token = file_has_token($binary_log, "_x_x_mozilla_trender");
|
||||
if ($found_token) {
|
||||
$render_test_result = 'success';
|
||||
}
|
||||
|
||||
if ($render_test_result eq 'testfailed') {
|
||||
Util::print_log("TinderboxPrint:Trender:[FAILED]\n");
|
||||
return 'testfailed';
|
||||
}
|
||||
|
||||
$render_time = Util::extract_token_from_file($binary_log, "_x_x_mozilla_trender", ",");
|
||||
if ($render_time) {
|
||||
chomp($render_time);
|
||||
my @times = split(',', $render_time);
|
||||
$render_time = $times[0];
|
||||
}
|
||||
$render_time =~ s/[\r\n]//g;
|
||||
|
||||
$render_gfx_time = Util::extract_token_from_file($binary_log, "_x_x_mozilla_trender_gfx", ",");
|
||||
if ($render_gfx_time) {
|
||||
chomp($render_gfx_time);
|
||||
my @times = split(',', $render_gfx_time);
|
||||
$render_gfx_time = $times[0];
|
||||
}
|
||||
$render_gfx_time =~ s/[\r\n]//g;
|
||||
|
||||
if (!$render_time || !$render_gfx_time) {
|
||||
Util::print_log("TinderboxPrint:Trender:[FAILED]\n");
|
||||
return 'testfailed';
|
||||
}
|
||||
|
||||
Util::print_log_test_result_ms('render', 'Avg page render time in ms',
|
||||
$render_time, 'Tr');
|
||||
|
||||
Util::print_log_test_result_ms('rendergfx', 'Avg gfx render time in ms',
|
||||
$render_gfx_time, 'Tgfx');
|
||||
|
||||
if($Settings::TestsPhoneHome) {
|
||||
# Pull out detail data from log; this includes results for all sets
|
||||
my $raw_data = Util::extract_token_from_file($binary_log, "_x_x_mozilla_trender_details", ",");
|
||||
chomp($raw_data);
|
||||
|
||||
Util::send_results_to_server($render_time, $raw_data, "render");
|
||||
Util::send_results_to_server($render_gfx_time, $raw_data, "rendergfx");
|
||||
}
|
||||
|
||||
return 'success';
|
||||
}
|
||||
|
||||
1;
|
@ -0,0 +1,107 @@
|
||||
# Startup performance test. Time how fast it takes the browser
|
||||
# to start up. Some help from John Morrison to get this going.
|
||||
#
|
||||
# Needs user_pref("browser.dom.window.dump.enabled", 1);
|
||||
# (or CPPFLAGS=-DMOZ_ENABLE_JS_DUMP in mozconfig since we
|
||||
# don't have profiles for tbox right now.)
|
||||
#
|
||||
# $startup_url needs ?begin=<time> dynamically inserted.
|
||||
#
|
||||
sub StartupPerformanceTest {
|
||||
my ($test_name, $binary, $build_dir, $startup_test_args, $startup_url) = @_;
|
||||
|
||||
my $i;
|
||||
my $startuptime; # Startup time in ms.
|
||||
my $agg_startuptime = 0; # Aggregate startup time.
|
||||
my $startup_count = 0; # Number of successful runs.
|
||||
my $avg_startuptime = 0; # Average startup time.
|
||||
my @times;
|
||||
my $startup_test_result = 'success';
|
||||
|
||||
for($i=0; $i<10; $i++) {
|
||||
# Settle OS.
|
||||
system('/bin/sh -c "sync; sleep 5"');
|
||||
|
||||
# Generate URL of form file:///<path>/startup-test.html?begin=986869495000
|
||||
# Where begin value is current time.
|
||||
my ($time, $url, $cwd);
|
||||
|
||||
#
|
||||
# Test for Time::HiRes and report the time.
|
||||
$time = Time::PossiblyHiRes::getTime();
|
||||
|
||||
$cwd = get_system_cwd();
|
||||
print "cwd = $cwd\n";
|
||||
$url = "$startup_url?begin=$time";
|
||||
|
||||
print "url = $url\n";
|
||||
|
||||
# Then load startup-test.html, which will pull off the begin argument
|
||||
# and compare it to the current time to compute startup time.
|
||||
# Since we are iterating here, save off logs as StartupPerformanceTest-0,1,2...
|
||||
#
|
||||
# -P $Settings::MozProfileName added 3% to startup time, assume one profile
|
||||
# and get the 3% back. (http://bugzilla.mozilla.org/show_bug.cgi?id=112767)
|
||||
#
|
||||
if($startup_test_result eq 'success') {
|
||||
$startuptime =
|
||||
AliveTestReturnToken("StartupPerformanceTest-$i",
|
||||
$build_dir,
|
||||
[$binary, @$startup_test_args, $url],
|
||||
$Settings::StartupPerformanceTestTimeout,
|
||||
"__startuptime",
|
||||
",");
|
||||
} else {
|
||||
print "Startup test failed.\n";
|
||||
}
|
||||
|
||||
if($startuptime) {
|
||||
$startup_test_result = 'success';
|
||||
|
||||
# Add our test to the total.
|
||||
$startup_count++;
|
||||
$agg_startuptime += $startuptime;
|
||||
|
||||
# Keep track of the results in an array.
|
||||
push(@times, $startuptime);
|
||||
} else {
|
||||
$startup_test_result = 'testfailed';
|
||||
Util::print_log("StartupPerformanceTest: test failed\n");
|
||||
}
|
||||
|
||||
} # for loop
|
||||
|
||||
if($startup_test_result eq 'success') {
|
||||
Util::print_log("\nSummary for startup test:\n");
|
||||
|
||||
# Print startup times.
|
||||
chomp(@times);
|
||||
my $times_string = join(" ", @times);
|
||||
Util::print_log("times = [$times_string]\n");
|
||||
|
||||
# Figure out the average startup time.
|
||||
$avg_startuptime = $agg_startuptime / $startup_count;
|
||||
Util::print_log("Average startup time: $avg_startuptime\n");
|
||||
|
||||
my $min_startuptime = min(@times);
|
||||
Util::print_log("Minimum startup time: $min_startuptime\n");
|
||||
|
||||
my $ts_prefix = "";
|
||||
if($Settings::BinaryName eq "TestGtkEmbed") {
|
||||
$ts_prefix = "m";
|
||||
}
|
||||
|
||||
Util::print_log_test_result_ms('startup', 'Best startup time out of 10 startups',
|
||||
$min_startuptime, $ts_prefix . 'Ts');
|
||||
|
||||
# Report data back to server
|
||||
if($Settings::TestsPhoneHome) {
|
||||
Util::print_log("phonehome = 1\n");
|
||||
Util::send_results_to_server($min_startuptime, $times_string, "startup");
|
||||
}
|
||||
}
|
||||
|
||||
return $startup_test_result;
|
||||
}
|
||||
|
||||
1;
|
73
testing/tinderbox-standalone-tests/Time/PossiblyHiRes.pm
Normal file
73
testing/tinderbox-standalone-tests/Time/PossiblyHiRes.pm
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Use high resolution routines if installed (on win32 or linux), using
|
||||
# eval as try/catch block around import of modules. Otherwise, just use 'time()'.
|
||||
#
|
||||
# 'Win32::API' <http://www.activestate.com/PPMPackages/zips/5xx-builds-only/Win32-API.zip>
|
||||
# 'Time::HiRes' <http://search.cpan.org/search?dist=Time-HiRes>
|
||||
# (also: http://rpmfind.net/linux/rpm2html/search.php?query=perl-Time-HiRes)
|
||||
#
|
||||
package Time::PossiblyHiRes;
|
||||
|
||||
use strict;
|
||||
|
||||
#use Time::HiRes qw(gettimeofday);
|
||||
|
||||
my $getLocalTime; # for win32
|
||||
my $lpSystemTime = pack("SSSSSSSS"); # for win32
|
||||
my $timesub; # code ref
|
||||
|
||||
# returns 12 char string "'s'x9.'m'x3" which is milliseconds since epoch,
|
||||
# although resolution may vary depending on OS and installed packages
|
||||
|
||||
sub getTime () {
|
||||
|
||||
return &$timesub
|
||||
if $timesub;
|
||||
|
||||
$timesub = sub { time() . "000"; }; # default
|
||||
|
||||
return &$timesub
|
||||
if $^O eq "MacOS"; # don't know a better way on Mac
|
||||
|
||||
if ($^O eq "MSWin32") {
|
||||
eval "use Win32::API;";
|
||||
$timesub = sub {
|
||||
# pass pointer to struct, void return
|
||||
$getLocalTime =
|
||||
eval "new Win32::API('kernel32', 'GetLocalTime', [qw{P}], qw{V});"
|
||||
unless $getLocalTime;
|
||||
$getLocalTime->Call($lpSystemTime);
|
||||
my @t = unpack("SSSSSSSS", $lpSystemTime);
|
||||
sprintf("%9s%03s", time(), pop @t);
|
||||
} if !$@;
|
||||
}
|
||||
|
||||
# ass-u-me if not mac/win32, then we're on a unix flavour
|
||||
else {
|
||||
eval "use Time::HiRes qw(gettimeofday);";
|
||||
$timesub = sub {
|
||||
my @t = gettimeofday();
|
||||
$t[0]*1000 + int($t[1]/1000);
|
||||
} if !$@;
|
||||
}
|
||||
|
||||
return &$timesub;
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#
|
||||
# Test script to compare with low-res time:
|
||||
#
|
||||
# require "gettime.pl";
|
||||
#
|
||||
# use POSIX qw(strftime);
|
||||
#
|
||||
# print "hires time = " . Time::PossiblyHiRes::getTime() . "\n";
|
||||
# print "lowres time = " . time() . "\n";
|
||||
#
|
||||
|
||||
|
||||
# end package
|
||||
1;
|
405
testing/tinderbox-standalone-tests/Util.pm
Normal file
405
testing/tinderbox-standalone-tests/Util.pm
Normal file
@ -0,0 +1,405 @@
|
||||
package Util;
|
||||
|
||||
use Sys::Hostname;
|
||||
use File::Copy;
|
||||
use POSIX qw(sys_wait_h strftime);
|
||||
|
||||
sub print_log {
|
||||
my ($text) = @_;
|
||||
#print LOG $text;
|
||||
print $text;
|
||||
}
|
||||
|
||||
sub print_logfile {
|
||||
my ($logfile, $test_name) = @_;
|
||||
print "DEBUG: $logfile\n";
|
||||
print_log "----------- Output from $test_name ------------- \n";
|
||||
open READRUNLOG, "$logfile" or die "Can't open log $logfile: $!\n";
|
||||
print_log " $_" while <READRUNLOG>;
|
||||
close READRUNLOG or die "Can't close log $logfile: $!\n";
|
||||
print_log "----------- End Output from $test_name --------- \n";
|
||||
}
|
||||
|
||||
sub print_test_errors {
|
||||
my ($result, $name) = @_;
|
||||
|
||||
if (not $result->{timed_out} and $result->{exit_value} != 0) {
|
||||
if ($result->{sig_name} ne '') {
|
||||
print_log "Error: $name: received SIG$result->{sig_name}\n";
|
||||
}
|
||||
print_log "Error: $name: exited with status $result->{exit_value}\n";
|
||||
if ($result->{dumped_core}) {
|
||||
print_log "Error: $name: dumped core.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Parse a file for $token, return the token.
|
||||
# Look for the line "<token><delimiter><return-value>", e.g.
|
||||
# for "__startuptime,5501"
|
||||
# token = "__startuptime"
|
||||
# delimiter = ","
|
||||
# return-value = "5501";
|
||||
#
|
||||
sub extract_token {
|
||||
my ($output, $token, $delimiter) = @_;
|
||||
use Data::Dumper;
|
||||
print Dumper("extract_token: @_");
|
||||
my $token_value = 0;
|
||||
if ($output =~ /$token/) {
|
||||
$token_value = substr($output, index($output, $delimiter) + 1);
|
||||
chomp($token_value);
|
||||
}
|
||||
return $token_value;
|
||||
}
|
||||
|
||||
sub run_cmd {
|
||||
my ($home_dir, $binary_dir, $args, $timeout_secs) = @_;
|
||||
my $now = localtime();
|
||||
my $pid = 0;
|
||||
my $shell_command = join(' ', @{$args});
|
||||
|
||||
my $exit_value = 1;
|
||||
my $signal_num;
|
||||
my $sig_name;
|
||||
my $dumped_core;
|
||||
my $timed_out;
|
||||
my $output;
|
||||
|
||||
print_log "Begin: $now\n";
|
||||
print_log "cmd = $shell_command\n";
|
||||
|
||||
eval{
|
||||
# Set XRE_NO_WINDOWS_CRASH_DIALOG to disable showing
|
||||
# the windows crash dialog in case the child process
|
||||
# crashes
|
||||
$ENV{XRE_NO_WINDOWS_CRASH_DIALOG} = 1;
|
||||
|
||||
# Now cd to dir where binary is..
|
||||
chdir $binary_dir or die "chdir($binary_dir): $!\n";
|
||||
|
||||
local $SIG{ALRM} = sub { die "alarm" };
|
||||
alarm $timeout_secs;
|
||||
$pid = open CMD, "$shell_command |"
|
||||
or die "Could not run command: $!";
|
||||
|
||||
while (<CMD>) {
|
||||
$output .= $_;
|
||||
print_log $_;
|
||||
}
|
||||
close CMD or die "Could not close command: $!";
|
||||
$exit_value = $? >> 8;
|
||||
$signal_num = $? >> 127;
|
||||
$sig_name = signal_name($signal_num);
|
||||
$dumped_core = $? & 128;
|
||||
$timed_out = 0;
|
||||
alarm 0;
|
||||
};
|
||||
if($@){
|
||||
if($@ =~ /alarm/){
|
||||
$timed_out = 1;
|
||||
kill_process($pid);
|
||||
}else{
|
||||
print_log("Error running $shell_command: $@\n");
|
||||
$output = $@;
|
||||
}
|
||||
}
|
||||
|
||||
$now = localtime();
|
||||
print_log "End: $now\n";
|
||||
|
||||
if ($exit_value || $timed_out || $dumped_core || $signal_num){
|
||||
print_log("Error running $shell_command\n");
|
||||
if($output){
|
||||
print_log("Output: $output\n");
|
||||
}
|
||||
if ($exit_value) {
|
||||
print_log("Exit value: $exit_value\n");
|
||||
}
|
||||
if ($timed_out) {
|
||||
print_log("Timed out\n");
|
||||
# callers expect exit_value to be non-zero if request timed out
|
||||
$exit_value = 1;
|
||||
}
|
||||
if ($dumped_core) {
|
||||
print_log("Segfault (core dumped)\n");
|
||||
}
|
||||
if ($signal_num) {
|
||||
print_log("Received signal: $sig_name\n");
|
||||
}
|
||||
}
|
||||
|
||||
return { timed_out=>$timed_out,
|
||||
exit_value=>$exit_value,
|
||||
sig_name=>$sig_name,
|
||||
output=>$output,
|
||||
dumped_core=>$dumped_core };
|
||||
}
|
||||
|
||||
|
||||
sub get_system_cwd {
|
||||
my $a = Cwd::getcwd()||`pwd`;
|
||||
chomp($a);
|
||||
return $a;
|
||||
}
|
||||
|
||||
sub get_graph_tbox_name {
|
||||
if ($Settings::GraphNameOverride ne '') {
|
||||
return $Settings::GraphNameOverride;
|
||||
}
|
||||
|
||||
my $name = hostname();
|
||||
if ($Settings::BuildTag ne '') {
|
||||
$name .= '_' . $Settings::BuildTag;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
sub print_log_test_result {
|
||||
my ($test_name, $test_title, $num_result, $units, $print_name, $print_result) = @_;
|
||||
|
||||
print_log "\nTinderboxPrint:";
|
||||
if ($Settings::TestsPhoneHome) {
|
||||
my $time = POSIX::strftime "%Y:%m:%d:%H:%M:%S", localtime;
|
||||
print_log "<a title=\"$test_title\" href=\"http://$Settings::results_server/graph/query.cgi?testname=" . $test_name . "&units=$units&tbox=" . get_graph_tbox_name() . "&autoscale=1&days=7&avg=1&showpoint=$time,$num_result\">";
|
||||
} else {
|
||||
print_log "<abbr title=\"$test_title\">";
|
||||
}
|
||||
print_log $print_name;
|
||||
if (!$Settings::TestsPhoneHome) {
|
||||
print_log "</abbr>";
|
||||
}
|
||||
print_log ':' . $print_result;
|
||||
if ($Settings::TestsPhoneHome) {
|
||||
print_log "</a>";
|
||||
}
|
||||
print_log "\n";
|
||||
|
||||
}
|
||||
|
||||
sub print_log_test_result_ms {
|
||||
my ($test_name, $test_title, $result, $print_name) = @_;
|
||||
print_log_test_result($test_name, $test_title, $result, 'ms',
|
||||
$print_name, $result . 'ms');
|
||||
}
|
||||
|
||||
sub print_log_test_result_bytes {
|
||||
my ($test_name, $test_title, $result, $print_name, $sig_figs) = @_;
|
||||
|
||||
print_log_test_result($test_name, $test_title, $result, 'bytes',
|
||||
$print_name, PrintSize($result, $sig_figs) . 'B');
|
||||
}
|
||||
|
||||
sub print_log_test_result_count {
|
||||
my ($test_name, $test_title, $result, $print_name, $sig_figs) = @_;
|
||||
print_log_test_result($test_name, $test_title, $result, 'count',
|
||||
$print_name, PrintSize($result, $sig_figs));
|
||||
}
|
||||
|
||||
|
||||
# Report test results back to a server.
|
||||
# Netscape-internal now, will push to mozilla.org, ask
|
||||
# mcafee or jrgm for details.
|
||||
#
|
||||
# Needs the following perl stubs, installed for rh7.1:
|
||||
# perl-Digest-MD5-2.13-1.i386.rpm
|
||||
# perl-MIME-Base64-2.12-6.i386.rpm
|
||||
# perl-libnet-1.0703-6.noarch.rpm
|
||||
# perl-HTML-Tagset-3.03-3.i386.rpm
|
||||
# perl-HTML-Parser-3.25-2.i386.rpm
|
||||
# perl-URI-1.12-5.noarch.rpm
|
||||
# perl-libwww-perl-5.53-3.noarch.rpm
|
||||
#
|
||||
sub send_results_to_server {
|
||||
my ($value, $raw_data, $testname) = @_;
|
||||
|
||||
# Prepend raw data with cvs checkout date, performance
|
||||
# Use MOZ_CO_DATE, but with same graph/collect.cgi format. (server)
|
||||
#my $data_plus_co_time = "MOZ_CO_DATE=$co_time_str\t$raw_data";
|
||||
my $data_plus_co_time = "MOZ_CO_DATE=test";
|
||||
my $tbox = get_graph_tbox_name();
|
||||
|
||||
my $tmpurl = "http://$Settings::results_server/graph/collect.cgi";
|
||||
$tmpurl .= "?value=$value&data=$data_plus_co_time&testname=$testname&tbox=$tbox";
|
||||
|
||||
print_log "send_results_to_server(): \n";
|
||||
print_log "tmpurl = $tmpurl\n";
|
||||
|
||||
# libwww-perl has process control problems on windows,
|
||||
# spawn wget instead.
|
||||
if ($Settings::OS =~ /^WIN/) {
|
||||
system ("wget", "-O", "/dev/null", $tmpurl);
|
||||
print_log "send_results_to_server() succeeded.\n";
|
||||
} else {
|
||||
my $res = eval q{
|
||||
use LWP::UserAgent;
|
||||
use HTTP::Request;
|
||||
my $ua = LWP::UserAgent->new;
|
||||
$ua->timeout(10); # seconds
|
||||
my $req = HTTP::Request->new(GET => $tmpurl);
|
||||
my $res = $ua->request($req);
|
||||
return $res;
|
||||
};
|
||||
if ($@) {
|
||||
warn "Failed to submit startup results: $@";
|
||||
print_log "send_results_to_server() failed.\n";
|
||||
} else {
|
||||
print_log "Results submitted to server: \n" .
|
||||
$res->status_line . "\n" . $res->content . "\n";
|
||||
print_log "send_results_to_server() succeeded.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub kill_process {
|
||||
my ($target_pid) = @_;
|
||||
my $start_time = time;
|
||||
|
||||
# Try to kill and wait 10 seconds, then try a kill -9
|
||||
my $sig;
|
||||
for $sig ('TERM', 'KILL') {
|
||||
print "kill $sig $target_pid\n";
|
||||
kill $sig => $target_pid;
|
||||
my $interval_start = time;
|
||||
while (time - $interval_start < 10) {
|
||||
# the following will work with 'cygwin' perl on win32, but not
|
||||
# with 'MSWin32' (ActiveState) perl
|
||||
my $pid = waitpid($target_pid, POSIX::WNOHANG());
|
||||
if (($pid == $target_pid and POSIX::WIFEXITED($?)) or $pid == -1) {
|
||||
my $secs = time - $start_time;
|
||||
$secs = $secs == 1 ? '1 second' : "$secs seconds";
|
||||
print_log "Process killed. Took $secs to die.\n";
|
||||
return;
|
||||
}
|
||||
sleep 1;
|
||||
}
|
||||
}
|
||||
die "Unable to kill process: $target_pid";
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
my %sig_num = ();
|
||||
my @sig_name = ();
|
||||
|
||||
sub signal_name {
|
||||
# Find the name of a signal number
|
||||
my ($number) = @_;
|
||||
|
||||
unless (@sig_name) {
|
||||
unless($Config::Config{sig_name} && $Config::Config{sig_num}) {
|
||||
die "No sigs?";
|
||||
} else {
|
||||
my @names = split ' ', $Config::Config{sig_name};
|
||||
@sig_num{@names} = split ' ', $Config::Config{sig_num};
|
||||
foreach (@names) {
|
||||
$sig_name[$sig_num{$_}] ||= $_;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $sig_name[$number];
|
||||
}
|
||||
}
|
||||
|
||||
sub PercentChange($$) {
|
||||
my ($old, $new) = @_;
|
||||
if ($old == 0) {
|
||||
return 0;
|
||||
}
|
||||
return ($new - $old) / $old;
|
||||
}
|
||||
|
||||
# Print a value of bytes out in a reasonable
|
||||
# KB, MB, or GB form. Sig figs should probably
|
||||
# be 3, 4, or 5 for most purposes here. This used
|
||||
# to default to 3 sig figs, but I wanted 4 so I
|
||||
# generalized here. -mcafee
|
||||
#
|
||||
# Usage: PrintSize(valueAsInteger, numSigFigs)
|
||||
#
|
||||
sub PrintSize($$) {
|
||||
|
||||
# print a number with 3 significant figures
|
||||
sub PrintNum($$) {
|
||||
my ($num, $sigs) = @_;
|
||||
my $rv;
|
||||
|
||||
# Figure out how many decimal places to show.
|
||||
# Only doing a few cases here, for normal range
|
||||
# of test numbers.
|
||||
|
||||
# Handle zero case first.
|
||||
if ($num == 0) {
|
||||
$rv = "0";
|
||||
} elsif ($num < 10**($sigs-5)) {
|
||||
$rv = sprintf "%.5f", ($num);
|
||||
} elsif ($num < 10**($sigs-4)) {
|
||||
$rv = sprintf "%.4f", ($num);
|
||||
} elsif ($num < 10**($sigs-3)) {
|
||||
$rv = sprintf "%.3f", ($num);
|
||||
} elsif ($num < 10**($sigs-2)) {
|
||||
$rv = sprintf "%.2f", ($num);
|
||||
} elsif ($num < 10**($sigs-1)) {
|
||||
$rv = sprintf "%.1f", ($num);
|
||||
} else {
|
||||
$rv = sprintf "%d", ($num);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
my ($size, $sigfigs) = @_;
|
||||
|
||||
# 1K = 1024, previously this was approximated as 1000.
|
||||
my $rv;
|
||||
if ($size > 1073741824) { # 1024^3
|
||||
$rv = PrintNum($size / 1073741824.0, $sigfigs) . "G";
|
||||
} elsif ($size > 1048576) { # 1024^2
|
||||
$rv = PrintNum($size / 1048576.0, $sigfigs) . "M";
|
||||
} elsif ($size > 1024) {
|
||||
$rv = PrintNum($size / 1024.0, $sigfigs) . "K";
|
||||
} else {
|
||||
$rv = PrintNum($size, $sigfigs);
|
||||
}
|
||||
}
|
||||
|
||||
# Page loader (-f option):
|
||||
# If you are building optimized, you need to add
|
||||
# --enable-trace-malloc --enable-perf-metrics
|
||||
# to turn the pageloader code on. If you are building debug you only
|
||||
# need
|
||||
# --enable-trace-malloc
|
||||
#
|
||||
|
||||
sub ReadLeakstatsLog($) {
|
||||
my ($filename) = @_;
|
||||
my $leaks = 0;
|
||||
my $leaked_allocs = 0;
|
||||
my $mhs = 0;
|
||||
my $bytes = 0;
|
||||
my $allocs = 0;
|
||||
|
||||
open LEAKSTATS, "$filename"
|
||||
or die "unable to open $filename";
|
||||
while (<LEAKSTATS>) {
|
||||
chop;
|
||||
my $line = $_;
|
||||
if ($line =~ /Leaks: (\d+) bytes, (\d+) allocations/) {
|
||||
$leaks = $1;
|
||||
$leaked_allocs = $2;
|
||||
} elsif ($line =~ /Maximum Heap Size: (\d+) bytes/) {
|
||||
$mhs = $1;
|
||||
} elsif ($line =~ /(\d+) bytes were allocated in (\d+) allocations./) {
|
||||
$bytes = $1;
|
||||
$allocs = $2;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'leaks' => $leaks,
|
||||
'leaked_allocs' => $leaked_allocs,
|
||||
'mhs' => $mhs,
|
||||
'bytes' => $bytes,
|
||||
'allocs' => $allocs
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
139
testing/tinderbox-standalone-tests/Util/Prefs.pm
Normal file
139
testing/tinderbox-standalone-tests/Util/Prefs.pm
Normal file
@ -0,0 +1,139 @@
|
||||
package Prefs;
|
||||
|
||||
sub set_pref {
|
||||
my ($pref_file, $pref, $value) = @_;
|
||||
# Make sure we get rid of whatever value was there,
|
||||
# to allow for resetting prefs
|
||||
system ("\\grep -v \\\"$pref\\\" '$pref_file' > '$pref_file.new'");
|
||||
File::Copy::move("$pref_file.new", "$pref_file") or die("move: $!\n");
|
||||
|
||||
Util::print_log("Setting $pref to $value\n");
|
||||
open PREFS, ">>$pref_file" or die "can't open $pref_file ($?)\n";
|
||||
print PREFS "user_pref(\"$pref\", $value);\n";
|
||||
close PREFS;
|
||||
}
|
||||
|
||||
sub get_prefs_file {
|
||||
my ($pref_file, $profile_dir);
|
||||
|
||||
if ($Settings::UseMozillaProfile) {
|
||||
# Profile directory. This lives in way-different places
|
||||
# depending on the OS.
|
||||
#
|
||||
my $profiledir = get_profile_dir($build_dir);
|
||||
|
||||
#
|
||||
# Make sure we have a profile to run tests. This is assumed to be called
|
||||
# $Settings::MozProfileName and will live in $build_dir/.mozilla.
|
||||
# Also assuming only one profile here.
|
||||
#
|
||||
my $cp_result = 0;
|
||||
|
||||
unless (-d "$profiledir") {
|
||||
Util::print_log("No profile found, creating profile.\n");
|
||||
$cp_result = create_profile($build_dir, $binary_dir, $binary);
|
||||
} else {
|
||||
Util::print_log("Found profile.\n");
|
||||
|
||||
# Recreate profile if we have $Settings::CleanProfile set.
|
||||
if ($Settings::CleanProfile) {
|
||||
my $deletedir = $profiledir;
|
||||
|
||||
Util::print_log("Creating clean profile ...\n");
|
||||
Util::print_log("Deleting $deletedir ...\n");
|
||||
File::Path::rmtree([$deletedir], 0, 0);
|
||||
if (-e "$deletedir") {
|
||||
Util::print_log("Error: rmtree([$deletedir], 0, 0) failed.\n");
|
||||
}
|
||||
$cp_result = create_profile($build_dir, $binary_dir, $binary);
|
||||
}
|
||||
}
|
||||
|
||||
# Set status, in case create profile failed.
|
||||
if ($cp_result) {
|
||||
# We should check $cp_result->{exit_value} too, except
|
||||
# semi-single-profile landing made 0 the success value (which is
|
||||
# good), so we now have inconsistent expected results.
|
||||
if (not $cp_result->{timed_out}) {
|
||||
$test_result = "success";
|
||||
} else {
|
||||
Util::print_log("cp_result failed\n");
|
||||
$test_result = "testfailed";
|
||||
Util::print_log("Error: create profile failed.\n");
|
||||
}
|
||||
}
|
||||
|
||||
# Call get_profile_dir again, so it can find the extension-salted
|
||||
# profile directory under the profile root.
|
||||
|
||||
$profiledir = get_profile_dir($build_dir);
|
||||
|
||||
#
|
||||
# Find the prefs file, remember we have that random string now
|
||||
# e.g. <build-dir>/.mozilla/default/uldx6pyb.slt/prefs.js
|
||||
# so File::Path::find will find the prefs.js file.
|
||||
##
|
||||
($pref_file, $profile_dir) = find_pref_file($profiledir);
|
||||
|
||||
#XXX this is ugly and hacky
|
||||
$test_result = 'testfailed' unless $pref_file;;
|
||||
if (!$pref_file) { Util::print_log("no pref file found\n"); }
|
||||
|
||||
} elsif($Settings::BinaryName eq "TestGtkEmbed") {
|
||||
Util::print_log("Using TestGtkEmbed profile\n");
|
||||
|
||||
$pref_file = "$build_dir/.TestGtkEmbed/TestGtkEmbed/prefs.js";
|
||||
$profile_dir = "$build_dir";
|
||||
|
||||
# Create empty prefs file if needed
|
||||
#unless (-e $pref_file) {
|
||||
# system("mkdir -p $build_dir/.TestGtkEmbed/TestGtkEmbed");
|
||||
# system("touch $pref_file");
|
||||
#}
|
||||
|
||||
# Run TestGtkEmbed to generate proper pref file.
|
||||
# This should only need to be run the first time for a given tree.
|
||||
unless (-e $pref_file) {
|
||||
$test_result = AliveTest("EmbedAliveTest_profile", $build_dir,
|
||||
["$embed_binary_dir/$embed_binary_basename"],
|
||||
$Settings::EmbedTestTimeout);
|
||||
}
|
||||
}
|
||||
return $pref_file;
|
||||
}
|
||||
|
||||
#
|
||||
# Given profile directory, find pref file hidden in salt directory.
|
||||
# profile $Settings::MozProfileName must exist before calling this sub.
|
||||
#
|
||||
sub find_pref_file {
|
||||
my $profile_dir = shift;
|
||||
|
||||
# default to *nix
|
||||
my $pref_file = "prefs.js";
|
||||
|
||||
unless (-e $profile_dir) {
|
||||
print_log "ERROR: profile $profile_dir does not exist\n";
|
||||
#XXX should make 'run_all_tests' throw a 'testfailed' exception
|
||||
# and just skip all the continual checking for $test_result
|
||||
return; # empty list
|
||||
}
|
||||
|
||||
my $found = undef;
|
||||
my $sub = sub {$pref_file = $File::Find::name, $found++ if $pref_file eq $_};
|
||||
File::Find::find($sub, $profile_dir);
|
||||
unless ($found) {
|
||||
print_log "ERROR: couldn't find prefs.js in $profile_dir\n";
|
||||
return; # empty list
|
||||
}
|
||||
|
||||
# Find full profile_dir while we're at it.
|
||||
$profile_dir = File::Basename::dirname($pref_file);
|
||||
|
||||
print_log "profile dir = $profile_dir\n";
|
||||
print_log "prefs.js = $pref_file\n";
|
||||
|
||||
return ($pref_file, $profile_dir);
|
||||
}
|
||||
|
||||
1;
|
53
testing/tinderbox-standalone-tests/Util/Settings.pm
Normal file
53
testing/tinderbox-standalone-tests/Util/Settings.pm
Normal file
@ -0,0 +1,53 @@
|
||||
package Settings;
|
||||
|
||||
# general settings
|
||||
$TestsPhoneHome = 1;
|
||||
$results_server = "build-graphs.mozilla.org";
|
||||
$GraphNameOverride = '';
|
||||
$BuildTag = '';
|
||||
$Compiler = 'gcc';
|
||||
$CleanProfile = 1; # remove profile on start
|
||||
$ObjDir = 1; # use objdir
|
||||
$pageload_server = 'axolotl.mozilla.org';
|
||||
$OS = 'Linux';
|
||||
$BinaryName = '/home/rhelmer/Apps/firefox/firefox-bin';
|
||||
$EmbedBinaryName = 'TestGTKEmbed';
|
||||
$MozProfileName = 'default';
|
||||
$BuildDir = '/home/rhelmer/Apps/firefox';
|
||||
|
||||
# tests to run
|
||||
$LayoutPerformanceTest = 1;
|
||||
$XpcomGlueTest = 0;
|
||||
$RegxpcomTestTimeout = 120;
|
||||
$ViewerTest = 0;
|
||||
$XULWindowOpenTestTimeout = 1; # Txul
|
||||
$CodesizeTestTimeout = 0; # Z, require
|
||||
# mozilla/tools/codesighs
|
||||
$AliveTest = 0;
|
||||
$EmbedCodesizeTest = 0; # mZ, require
|
||||
# mozilla/tools/codesighs
|
||||
$DomToTextConversionTest = 0;
|
||||
$RegxpcomTest = 0;
|
||||
$EditorTest = 0;
|
||||
$CodesizeTest = 0; # Z, require
|
||||
# mozilla/tools/codesighs
|
||||
$EmbedTest = 0; # Assumes you wanted
|
||||
# $BuildEmbed=1
|
||||
$JavaTest = 0;
|
||||
$NeckoUnitTest = 0;
|
||||
$StartupPerformanceTest = 0;
|
||||
|
||||
# timeouts
|
||||
$StartupPerformanceTestTimeout = 15; # seconds
|
||||
$LayoutPerformanceTestPageTimeout = 30000; # each page, ms
|
||||
$RenderTestTimeout = 1800; # seconds
|
||||
$DHTMLPerformanceTestTimeout = 0; # Tdhtml
|
||||
$ViewerTestTimeout = 45;
|
||||
$JavaTestTimeout = 45;
|
||||
$MailBloatTestTimeout = 120; # seconds
|
||||
$LayoutPerformanceTestTimeout = 1200; # entire test, seconds
|
||||
$AliveTestTimeout = 15;
|
||||
$NeckoUnitTestTimeout = 30; # seconds
|
||||
$QATestTimeout = 30; # seconds
|
||||
|
||||
1;
|
16
testing/tinderbox-standalone-tests/test-mozilla.pl
Executable file
16
testing/tinderbox-standalone-tests/test-mozilla.pl
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Util;
|
||||
use Util::Settings;
|
||||
use File::Basename;
|
||||
use strict;
|
||||
|
||||
use Tests::AliveTest;
|
||||
use Tests::RenderPerformanceTest;
|
||||
use Tests::LayoutPerformanceTest;
|
||||
use Tests::DHTMLPerformanceTest;
|
||||
|
||||
AliveTest($Settings::BuildDir, $Settings::BinaryName);
|
||||
LayoutPerformanceTest($Settings::BuildDir, $Settings::BinaryName);
|
||||
DHTMLPerformanceTest($Settings::BuildDir, $Settings::BinaryName);
|
||||
RenderPerformanceTest($Settings::BuildDir, $Settings::BinaryName);
|
Loading…
x
Reference in New Issue
Block a user