JavaScript Tests - sync Sisyphus support, bug 398005, not part of the build

This commit is contained in:
bclary%bclary.com 2007-10-01 19:10:41 +00:00
Родитель 2a91a9bd9d
Коммит 06a54736a1
15 изменённых файлов: 1898 добавлений и 15 удалений

Просмотреть файл

@ -5,7 +5,7 @@ TEST_JS = $(shell find . -name '*.js' -print)
CURRDIR=$(shell pwd)
JSDIR=$(shell basename $(CURRDIR))
all: menu.html 1.8.0-list.txt 1.8.1-list.txt 1.9.0-list.txt menu-list.txt excluded-n.tests spidermonkey-extensions-n.tests
all: menu.html 1.8.0-list.txt 1.8.1-list.txt 1.9.0-list.txt menu-list.txt excluded-n.tests spidermonkey-extensions-n.tests failures.txt
menu.html: menuhead.html menufoot.html Makefile excluded-n.tests $(TEST_JS)
perl mklistpage.pl > menubody.html
@ -31,11 +31,11 @@ menu-list.txt:
cat 1.8.1-list.txt > 1.9.0-list.txt
./list.sh js1_8 | sort >> 1.9.0-list.txt
#e4x-list.txt: $(TEST_JS)
# ./list.sh e4x | sort > e4x-list.txt
confidential-failures.txt:
touch confidential-failures.txt
#lc2-list.txt: $(TEST_JS)
# ./list.sh lc2 | sort > lc2-list.txt
failures.txt: public-failures.txt confidential-failures.txt
cat public-failures.txt confidential-failures.txt | sort | uniq > failures.txt
ecma_3/RegExp/re_tests:
curl -LsS -m 1800 "http://www.cpan.org/src/stable.tar.bz2" -o stable.tar.bz2
@ -44,5 +44,5 @@ ecma_3/RegExp/re_tests:
rm -fR `find . -maxdepth 1 -name 'perl-*'` stable.tar.bz2
clean:
rm -f menubody.html menu.html *-list.txt excluded-n.tests
rm -f menubody.html menu.html *-list.txt excluded-n.tests failures.txt

Просмотреть файл

Просмотреть файл

@ -359,6 +359,14 @@ sub execute_tests {
"Actual exit $got_exit, signal $exit_signal",
join("\n",@output));
}
elsif ($got_exit != 0) {
# abnormal termination but the test passed, so output a summary line
&report_summary_result($test, $bug_number, "PASSED",
"",
"Expected exit $expected_exit",
"Actual exit $got_exit, signal $exit_signal",
join("\n",@output));
}
}
elsif ($timed_out) {
# test was terminated due to timeout
@ -1537,6 +1545,11 @@ sub report_summary_result
$actual =~ s/[\n\r]+/ /mg;
$reason =~ s/[\n\r]+/ /mg;
if ($result !~ /PASSED/)
{
$failures_reported++;
}
print STDERR ("jstest: $test " .
"bug: $bug_number " .
"result: $result " .

569
js/tests/known-failures.pl Executable file
Просмотреть файл

@ -0,0 +1,569 @@
#!/usr/bin/perl
# -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla JavaScript Testing Utilities
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Bob Clary <bclary@bclary.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
use strict;
use Getopt::Mixed "nextOption";
# predeclarations
sub debug;
sub usage;
sub parse_options;
sub escape_pattern;
sub unescape_pattern;
# option arguments
my $option_desc = "b=s branch>b T=s buildtype>T t=s testtype>t l=s rawlogfile>l f=s failurelogfile>f o=s os>o r=s patterns>r z=s timezone>z O=s outputprefix>O A=s arch>A K=s kernel>K D debug>D";
my $branch;
my $buildtype;
my $testtype;
my $rawlogfile;
my $failurelogfile;
my $os;
my $patterns;
my $timezone;
my $outputprefix;
my $arch;
my $kernel;
my $debug = $ENV{DEBUG};
# pattern variables
my $knownfailurebranchpattern;
my $failurebranchpattern;
my $knownfailureospattern;
my $failureospattern;
my $knownfailurebuildtypepattern;
my $failurebuildtypepattern;
my $knownfailuretesttypepattern;
my $failuretesttypepattern;
my $knownfailuretimezonepattern;
my $failuretimezonepattern;
my $knownfailurearchpattern;
my $failurearchpattern;
my $knownfailurekernelpattern;
my $failurekernelpattern;
my @patterns;
my $pattern;
my @failures;
my @fixes;
my @excludedtests;
my $excludedtest;
my @results;
my $regchars = '\[\^\-\]\|\{\}\?\*\+\.\<\>\$\(\)';
my @excludedfiles = ('spidermonkey-n.tests', 'slow-n.tests', 'performance.tests');
my $excludedfile;
&parse_options;
my $jsdir = $ENV{TEST_JSDIR};
if (!defined($jsdir)) {
$jsdir = "/work/mozilla/mozilla.com/test.mozilla.com/www/tests/mozilla.org/js";
}
# create working patterns file consisting of matches to users selection
# and which has the test description patterns escaped
# remove the excluded tests from the possible fixes log
foreach $excludedfile ( @excludedfiles ) {
open EXCLUDED, "<$jsdir/$excludedfile" or die "Unable to open excluded file $jsdir/$excludedfile: $!\n";
while (<EXCLUDED>) {
chomp;
next if ($_ =~ /^\#/);
push @excludedtests, ($_);
}
close EXCLUDED;
}
@excludedtests = sort @excludedtests;
debug "loading patterns $patterns";
debug "pattern filter: /^TEST_ID=[^,]*, TEST_BRANCH=$knownfailurebranchpattern, TEST_RESULT=[^,]*, TEST_BUILDTYPE=$knownfailurebuildtypepattern, TEST_TYPE=$knownfailuretesttypepattern, TEST_OS=$knownfailureospattern, TEST_MACHINE=[^,]*, TEST_PROCESSORTYPE=$knownfailurearchpattern, TEST_KERNEL=$knownfailurekernelpattern, TEST_DATE=[^,]*, TEST_TIMEZONE=$knownfailuretimezonepattern,/\n";
open PATTERNS, "<$patterns" or die "Unable to open known failure patterns file $patterns: $!\n";
while (<PATTERNS>) {
chomp;
if ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$knownfailurebranchpattern, TEST_RESULT=[^,]*, TEST_BUILDTYPE=$knownfailurebuildtypepattern, TEST_TYPE=$knownfailuretesttypepattern, TEST_OS=$knownfailureospattern, TEST_MACHINE=[^,]*, TEST_PROCESSORTYPE=$knownfailurearchpattern, TEST_KERNEL=$knownfailurekernelpattern, TEST_DATE=[^,]*, TEST_TIMEZONE=$knownfailuretimezonepattern,/) {
debug "adding pattern: $_";
push @patterns, (escape_pattern($_));
}
else {
debug "skipping pattern: $_";
}
}
close PATTERNS;
# create a working copy of the current failures which match the users selection
debug "failure filter: ^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_RESULT=FAIL[^,]*, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$failuretesttypepattern, TEST_OS=$failureospattern, TEST_MACHINE=[^,]*, TEST_PROCESSORTYPE=$failurearchpattern, TEST_KERNEL=$failurekernelpattern, TEST_DATE=[^,]*, TEST_TIMEZONE=$failuretimezonepattern,";
if (defined($rawlogfile)) {
$failurelogfile = "$outputprefix-results-failures.log";
my $alllog = "$outputprefix-results-all.log";
debug "writing failures $failurelogfile";
open INPUTLOG, "$jsdir/post-process-logs.pl $rawlogfile|sort|uniq|" or die "Unable to open $rawlogfile $!\n";
open ALLLOG, ">$alllog" or die "Unable to open $alllog $!\n";
open FAILURELOG, ">$failurelogfile" or die "Unable to open $failurelogfile $!\n";
while (<INPUTLOG>) {
chomp;
print ALLLOG "$_\n";
if ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_RESULT=FAIL[^,]*, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$failuretesttypepattern, TEST_OS=$failureospattern, TEST_MACHINE=[^,]*, TEST_PROCESSORTYPE=$failurearchpattern, TEST_KERNEL=$failurekernelpattern, TEST_DATE=[^,]*, TEST_TIMEZONE=$failuretimezonepattern,/) {
debug "failure: $_";
push @failures, ($_);
print FAILURELOG "$_\n";
}
}
close INPUTLOG;
close ALLLOG;
close FAILURELOG;
}
else {
debug "loading failures $failurelogfile";
open FAILURES, "<$failurelogfile" or die "Unable to open current failure log $failurelogfile: $!\n";
while (<FAILURES>) {
chomp;
if ($_ =~ /^TEST_ID=[^,]*, TEST_BRANCH=$failurebranchpattern, TEST_RESULT=FAIL[^,]*, TEST_BUILDTYPE=$failurebuildtypepattern, TEST_TYPE=$failuretesttypepattern, TEST_OS=$failureospattern, TEST_MACHINE=[^,]*, TEST_PROCESSORTYPE=$failurearchpattern, TEST_KERNEL=$failurekernelpattern, TEST_DATE=[^,]*, TEST_TIMEZONE=$failuretimezonepattern,/) {
debug "failure: $_";
push @failures, ($_);
}
}
close FAILURES;
}
debug "finding fixed bugs";
unlink "$outputprefix-results-possible-fixes.log";
foreach $pattern (@patterns) {
# look for known failure patterns that don't have matches in the
# the current failures selected by the user.
@results = grep m@^$pattern@, @failures;
if ($#results == -1) {
debug "fix: $pattern";
push @fixes, ($pattern)
}
}
foreach $excludedtest ( @excludedtests ) {
if ($debug) {
@results = grep m@$excludedtest@, @fixes;
if ($#results > -1) {
print "excluding: " . (join ', ', @results) . "\n";
}
}
@results = grep !m@$excludedtest@, @fixes;
@fixes = @results;
}
my $fix;
open OUTPUT, ">$outputprefix-results-possible-fixes.log" or die "Unable to open $outputprefix-results-possible-fixes.log: $!";
foreach $fix (@fixes) {
print OUTPUT unescape_pattern($fix) . "\n";
if ($debug) {
debug "fix: $fix";
}
}
close OUTPUT;
print STDOUT "$outputprefix-results-possible-fixes.log\n";
debug "finding regressions";
my $pass = 0;
my $changed = ($#patterns != -1);
while ($changed) {
$pass = $pass + 1;
$changed = 0;
debug "pass $pass";
foreach $pattern (@patterns) {
debug "Pattern: $pattern";
my @nomatches = grep !m@^$pattern@, @failures;
my @matches = grep m@^$pattern@, @failures;
if ($debug) {
my $temp = join ', ', @nomatches;
debug "nomatches: $#nomatches $temp";
$temp = join ', ', @matches;
debug "matches: $#matches $temp";
}
@failures = @nomatches;
if ($#matches > -1) {
$changed = 1;
}
debug "*****************************************";
}
}
foreach $excludedtest ( @excludedtests ) {
if ($debug) {
@results = grep m@$excludedtest@, @failures;
if ($#results > -1) {
print "excluding: " . (join ', ', @results) . "\n";
}
}
@results = grep !m@$excludedtest@, @failures;
@failures = @results;
}
open OUTPUT, ">$outputprefix-results-possible-regressions.log" or die "Unable to open $outputprefix-results-possible-regressions.log: $!";
my $failure;
foreach $failure (@failures) {
print OUTPUT "$failure\n";
if ($debug) {
debug "regression: $failure";
}
}
close OUTPUT;
print STDOUT "$outputprefix-results-possible-regressions.log\n";
sub debug {
if ($debug) {
my $msg = shift;
print "DEBUG: $msg\n";
}
}
sub usage {
my $msg = shift;
print STDERR <<EOF;
usage: $msg
known-failures.pl [-b|--branch] branch [-T|--buildtype] buildtype
[-t|--testtype] testtype [-o os|--os]
([-f|--failurelogfile] failurelogfile|[-l|--logfile] rawlogfile])
[-r|--patterns] patterns [-z|--timezone] timezone
[-O|--outputprefix] outputprefix
variable description
=============== ============================================================
-b branch branch 1.8.1, 1.9.0, all
-T buildtype build type opt, debug, all
-t testtype test type browser, shell, all
-l rawlogfile raw logfile
-f failurelogfile failure logfile
-o os operating system win32, mac, linux, all
-r patterns known failure patterns
-z timezone -0400, -0700, etc. default to user\'s zone
-O outputprefix output files will be generated with this prefix
-A arch architecture, all or a specific pattern
-K kernel kernel, all or a specific pattern
-D turn on debugging output
EOF
exit(2);
}
sub parse_options {
my ($option, $value);
Getopt::Mixed::init ($option_desc);
$Getopt::Mixed::order = $Getopt::Mixed::RETURN_IN_ORDER;
while (($option, $value) = nextOption()) {
if ($option eq "b") {
$branch = $value;
}
elsif ($option eq "T") {
$buildtype = $value;
}
elsif ($option eq "t") {
$testtype = $value;
}
elsif ($option eq "l") {
$rawlogfile = $value;
}
elsif ($option eq "f") {
$failurelogfile = $value;
}
elsif ($option eq "o") {
$os = $value;
}
elsif ($option eq "r") {
$patterns = $value;
}
elsif ($option eq "z") {
$timezone = $value;
}
elsif ($option eq "O") {
$outputprefix = $value;
}
elsif ($option eq "A") {
$arch = $value;
}
elsif ($option eq "K") {
$kernel = $value;
}
elsif ($option eq "D") {
$debug = 1;
}
}
if ($debug) {
print "branch=$branch, rawlogfile=$rawlogfile failurelogfile=$failurelogfile, os=$os, buildtype=$buildtype, testtype=$testtype, patterns=$patterns, timezone=$timezone, outputprefix=$outputprefix\n";
}
Getopt::Mixed::cleanup();
if ( !defined($branch) ) {
usage "missing branch";
}
if (!defined($rawlogfile) && !defined($failurelogfile)) {
usage "missing logfile";
}
if (!defined($os)) {
usage "missing os";
}
if (!defined($buildtype)) {
usage "missing buildtype";
}
if (!defined($testtype)) {
usage "missing testtype";
}
if (!defined($patterns)) {
usage "missing patterns";
}
if (!defined($timezone)) {
usage "missing timezone";
}
if (!defined($outputprefix)) {
usage "missing outputprefix";
}
if ($branch eq "1.8.1") {
$knownfailurebranchpattern = "([^,]*1\\.8\\.1[^,]*|\\.\\*)";
$failurebranchpattern = "1\\.8\\.1";
}
elsif ($branch eq "1.9.0") {
$knownfailurebranchpattern = "([^,]*1\\.9\\.0[^,]*|\\.\\*)";
$failurebranchpattern = "1\\.9\\.0";
}
elsif ($branch eq "all") {
$knownfailurebranchpattern = "[^,]*";
$failurebranchpattern = "[^,]*";
}
if ($os eq "win32") {
$knownfailureospattern = "([^,]*win32[^,]*|\\.\\*)";
$failureospattern = "win32";
}
elsif ($os eq "mac") {
$knownfailureospattern = "([^,]*mac[^,]*|\\.\\*)";
$failureospattern = "mac";
}
elsif ($os eq "linux") {
$knownfailureospattern = "([^,]*linux[^,]*|\\.\\*)";
$failureospattern = "linux";
}
elsif ($os eq "all") {
$knownfailureospattern = "[^,]*";
$failureospattern = "[^,]*";
}
if ($buildtype eq "opt") {
$knownfailurebuildtypepattern = "([^,]*opt[^,]*|\\.\\*)";
$failurebuildtypepattern = "opt";
}
elsif ($buildtype eq "debug") {
$knownfailurebuildtypepattern = "([^,]*debug[^,]*|\\.\\*)";
$failurebuildtypepattern = "debug";
}
elsif ($buildtype eq "all") {
$knownfailurebuildtypepattern = "[^,]*";
$failurebuildtypepattern = "[^,]*";
}
if ($testtype eq "shell") {
$knownfailuretesttypepattern = "([^,]*shell[^,]*|\\.\\*)";
$failuretesttypepattern = "shell";
}
elsif ($testtype eq "browser") {
$knownfailuretesttypepattern = "([^,]*browser[^,]*|\\.\\*)";
$failuretesttypepattern = "browser";
}
elsif ($testtype eq "all") {
$knownfailuretesttypepattern = "[^,]*";
$failuretesttypepattern = "[^,]*";
}
if ($timezone eq "all") {
$knownfailuretimezonepattern = "[^,]*";
$failuretimezonepattern = "[^,]*";
}
else {
$knownfailuretimezonepattern = "([^,]*" . $timezone . "[^,]*|\\.\\*)";
$failuretimezonepattern = "$timezone";
}
if ($arch ne "all") {
$knownfailurearchpattern = "([^,]*" . $arch . "[^,]*|\\.\\*)";
$failurearchpattern = "$arch";
}
else {
$knownfailurearchpattern = "[^,]*";
$failurearchpattern = "[^,]*";
}
if ($kernel ne "all") {
$knownfailurekernelpattern = "([^,]*" . $kernel . "[^,]*|\\.\\*)";
$failurekernelpattern = "$kernel";
}
else {
$knownfailurekernelpattern = "[^,]*";
$failurekernelpattern = "[^,]*";
}
}
sub escape_pattern {
my $line = shift;
chomp;
my ($leading, $trailing) = $line =~ /(.*TEST_DESCRIPTION=)(.*)/;
# debug "escape_pattern: before: $leading$trailing";
# replace unescaped regular expression characters in the
# description so they are not interpreted as regexp chars
# when matching descriptions. leave the escaped regexp chars
# `regexp alone so they can be unescaped later and used in
# pattern matching.
# see perldoc perlre
$trailing =~ s/\\/\\\\/g;
# escape non word chars that aren't surrounded by ``
$trailing =~ s/(?<!`)([$regchars])(?!`)/\\$1/g;
$trailing =~ s/(?<!`)([$regchars])(?=`)/\\$1/g;
$trailing =~ s/(?<=`)([$regchars])(?!`)/\\$1/g;
# $trailing =~ s/(?<!`)(\W)(?!`)/\\$1/g;
# unquote the regchars
$trailing =~ s/\`([^\`])\`/$1/g;
debug "escape_pattern: after: $leading$trailing";
return "$leading$trailing";
}
sub unescape_pattern {
my $line = shift;
chomp;
my ($leading, $trailing) = $line =~ /(.*TEST_DESCRIPTION=)(.*)/;
# quote the unescaped non word chars
$trailing =~ s/(?<!\\)([$regchars])/`$1`/g;
# unescape the escaped non word chars
$trailing =~ s/\\([$regchars])/$1/g;
$trailing =~ s/\\\\/\\/g;
debug "unescape_pattern: after: $leading$trailing";
return "$leading$trailing";
}
####
1;

389
js/tests/post-process-logs.pl Executable file
Просмотреть файл

@ -0,0 +1,389 @@
#!/usr/bin/perl -w
# -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla JavaScript Testing Utilities
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Bob Clary <bclary@bclary.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
use Getopt::Mixed "nextOption";
use File::Temp qw/ tempfile tempdir /;
use File::Basename;
sub dbg;
sub outresults;
sub outputrecord;
local $file;
local $temp;
local $DEBUG = 0;
(undef, $temp) = tempfile();
open TEMP, ">$temp" or
die "Unable to open temporary file $temp for writing: $!\n";
local ($test_id, $test_bug, $test_result, $test_type,
$test_description, $in_browser_test, @messages,
$test_processortype, $test_kernel, $test_suite,
$last_test);
local $count_begintests = 0;
local $count_jstests = 0;
local $count_exitonlytestsnormal = 0;
local $count_exitonlytestsabnormal = 0;
local $count_records = 0;
while ($file = shift @ARGV)
{
dbg "initializing in_browser_test, messages";
$in_browser_test = 0;
@messages = ();
dbg "file: $file";
my $filename = basename $file;
dbg "filename: $file";
local ($test_date, $test_product, $test_branchid, $test_buildtype,
$test_os,
$test_machine,$test_global_target) = split /,/, $filename;
$test_branchid =~ s/[^0-9.]//g;
$test_global_target =~ s/.log$//;
local ($test_timezone) = $test_date;
$test_timezone =~ s/.*([-+]\d{4,4})/$1/;
# dbg "test_date: $test_date";
# dbg "test_timezone: $test_timezone";
# dbg "test_product: $test_product";
# dbg "test_branchid: $test_branchid";
# dbg "test_buildtype: $test_buildtype";
# dbg "test_os: $test_os";
# dbg "test_machine: $test_machine";
# dbg "test_suite: $test_suite";
open FILE, "$file" or die "unable to open $file for reading: $!\n";
if ($test_product eq "js")
{
while (<FILE>)
{
chomp;
dbg "INPUT: $_";
$_ =~ s/[\r]$//;
$_ =~ s/[\r]/CR/g;
$_ =~ s/[\x01-\x08]//g;
$_ =~ s/\s+$//;
if ( $_ =~ /^jstest: /)
{
++$count_jstests;
($test_id) = $_ =~ /^jstest: (.*?) *bug:/;
($test_bug) = $_ =~ /bug: (.*?) *result:/;
($test_result) = $_ =~ /result: (.*?) *type:/;
($test_type) = $_ =~ /type: (.*?) *description:/;
($test_description) = $_ =~ /description: (.*)/;
if (!$test_description)
{
$test_description = "";
}
dbg "test_id: $test_id";
dbg "test_bug: $test_bug";
dbg "test_result: $test_result";
dbg "test_type: $test_type";
dbg "test_description: $test_description";
outputrecord;
dbg "-";
}
elsif (($envvar, $envval) = $_ =~ /^environment: (TEST_[A-Z0-9_]*)=(.*)/ )
{
dbg "envvar=$envvar, envval=$envval";
$envvar =~ tr/A-Z/a-z/;
$$envvar = $envval;
dbg $envvar . "=" . $$envvar;
}
elsif (($envval) = $_ =~ /^environment: OSID=(.*)/ )
{
$test_os = $envval;
}
}
}
elsif ($test_product eq "firefox")
{
$test_id = "__UNDEFINED__";
$test_bug = "__UNDEFINED__";
$test_result = "__UNDEFINED__";
$test_type = "__UNDEFINED__";
$test_description = "__UNDEFINED__";
$last_test = "__UNDEFINED__";
$in_browser_test = 0;
@messages = ();
while (<FILE>)
{
chomp;
# remove carriage returns, bels and other annoyances.
$_ =~ s/[\r]$//;
$_ =~ s/[\r]/CR/g;
$_ =~ s/[\x01-\x08]//g;
$_ =~ s/\s+$//;
dbg "INPUT: $_";
if ( $_ =~ /^jstest: /)
{
++$count_jstests;
($test_id) = $_ =~ /^jstest: (.*?) *bug:/;
($test_bug) = $_ =~ /bug: (.*?) *result:/;
($test_result) = $_ =~ /result: (.*?) *type:/;
($test_type) = $_ =~ /type: (.*?) *description:/;
($test_description) = $_ =~ /description: (.*)/;
if (!$test_description)
{
$test_description = "";
}
dbg "test_id: $test_id";
dbg "test_bug: $test_bug";
dbg "test_result: $test_result";
dbg "test_type: $test_type";
dbg "test_description: $test_description";
dbg "test_result: $test_result";
outputrecord;
}
elsif ( ($test_id, $exit_status) = $_ =~
/^http:.*test=([^;]*);.*: EXIT STATUS: (.*)/)
{
dbg "Processing EXIT STATUS: test_id: $test_id, exit_status: $exit_status";
$test_buildtype = "nightly" unless $test_buildtype;
$test_type = "browser";
if ($exit_status =~ /^NORMAL/)
{
if ($last_test ne $test_id)
{
++$count_exitonlytestsnormal;
$test_description = join '; ', @messages;
if ($test_description =~ /(out of memory|malloc:.*vm_allocate)/i)
{
$test_result = "FAILED";
}
else
{
$test_result = "FAILED";
}
# if we got here, the test terminated but it
# didn't report a result either because it
# crashed or the harness messed up.
outputrecord;
}
}
else
{
++$count_exitonlytestsabnormal;
dbg "Abnormal result";
dbg "creating test_description from messages array";
$test_description = join '; ', @messages;
# if we got here, the test terminated but it
# didn't report a result either because it is one
# of the old style -n.js negative tests, it
# crashed or the harness messed up.
if ($test_id =~ /-n.js$/ && $test_description =~
/JavaScript (Exception|Error)/i)
{
# force -n.js tests which pass if they end
# with an error or exception to 'pass'
$test_result = "PASSED";
}
else
{
$test_result = "FAILED";
$test_description = "EXIT STATUS: $exit_status, $test_description";
}
outputrecord;
}
$in_browser_test = 0;
@messages = ();
dbg "not in browser test";
dbg "--";
}
elsif ( ($test_id) =
$_ =~ /Begin loading .*http.*test=([^;]*).*/)
{
dbg "Begin loading $test_id";
$in_browser_test = 1;
++$count_begintests;
}
elsif ( ($test_id) =
$_ =~ /Finish loading .*http.*test=([^;]*).*/)
{
dbg "Finish loading $test_id";
if ($test_id eq "__UNDEFINED__")
{
$test_id = $test_id;
}
dbg "test_id: $test_id, test_id: $test_id";
die if ($test_id ne $test_id);
}
elsif ($in_browser_test)
{
if (! /^[-+]{2,2}(WEBSHELL|DOMWINDOW)/ && ! /^Spider:/ && ! /^JavaScriptTest:/ && !/^WARNING:/)
{
dbg "Saving message $_";
push @messages, ($_);
}
}
elsif (($envvar, $envval) = $_ =~ /^environment: (TEST_[A-Z0-9_]*)=(.*)/ )
{
dbg "envvar=$envvar, envval=$envval";
$envvar =~ tr/A-Z/a-z/;
$$envvar = $envval;
dbg $envvar . "=" . $$envvar;
}
elsif (($envval) = $_ =~ /^environment: OSID=(.*)/ )
{
$test_os = $envval;
}
}
}
close FILE;
undef $test_branchid;
undef $test_date;
undef $test_buildtype;
undef $test_machine;
undef $test_product;
undef $test_suite;
}
close TEMP;
outresults;
unlink $temp;
if ($DEBUG)
{
print "begintests $count_begintests\n";
print "jstests $count_jstests\n";
print "exit normal $count_exitonlytestsnormal\n";
print "exit abnormal $count_exitonlytestsabnormal\n";
print "total records $count_records\n";
print "jstests + exit normal + exit abnormal = " . ($count_jstests + $count_exitonlytestsnormal + $count_exitonlytestsabnormal) . "\n";
}
die "test counts do not match: total records $count_records; jstests + exit normal + exit abnormal = " .
($count_jstests + $count_exitonlytestsnormal + $count_exitonlytestsabnormal) . "\n"
if ($count_records != ($count_jstests + $count_exitonlytestsnormal + $count_exitonlytestsabnormal));
sub dbg {
if ($DEBUG)
{
my $msg = shift;
print STDOUT "DEBUG: $msg\n";
}
}
sub outresults
{
system("sort < $temp | uniq");
}
sub outputrecord
{
++$count_records;
# cut off the extra jstest: summaries as they duplicate the other
# output and follow it.
$test_description =~ s/jstest:.*//;
if (length($test_description) > 6000)
{
$test_description = substr($test_description, 0, 6000);
}
my $output =
"TEST_ID=$test_id, TEST_BRANCH=$test_branchid, TEST_RESULT=$test_result, " .
"TEST_BUILDTYPE=$test_buildtype, TEST_TYPE=$test_type, TEST_OS=$test_os, " .
"TEST_MACHINE=$test_machine, TEST_PROCESSORTYPE=$test_processortype, " .
"TEST_KERNEL=$test_kernel, TEST_DATE=$test_date, TEST_TIMEZONE=$test_timezone, " .
"TEST_DESCRIPTION=$test_description\n";
if ($DEBUG)
{
print "RECORD: $output";
}
print TEMP $output;
$last_test = $test_id;
$test_id = "__UNDEFINED__";
$test_bug = "__UNDEFINED__";
$test_result = "__UNDEFINED__";
$test_type = "__UNDEFINED__";
$test_description = "__UNDEFINED__";
}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

197
js/tests/runtests.sh Executable file
Просмотреть файл

@ -0,0 +1,197 @@
#!/usr/local/bin/bash -e
# -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla JavaScript Testing Utilities
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Bob Clary <bclary@bclary.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
TEST_DIR=${TEST_DIR:-/work/mozilla/mozilla.com/test.mozilla.com/www}
TEST_BIN=${TEST_BIN:-$TEST_DIR/bin}
TEST_JSDIR=${TEST_JSDIR:-$TEST_DIR/tests/mozilla.org/js}
if [[ ! -e $TEST_BIN/library.sh ]]; then
echo "TEST_DIR=$TEST_DIR"
echo ""
echo "This script requires the Sisyphus testing framework. Please "
echo "cvs check out the Sisyphys framework from mozilla/testing/sisyphus"
echo "and set the environment variable TEST_DIR to the directory where it"
echo "located."
echo ""
fi
if [[ ! -e $TEST_JSDIR/runtests.sh ]]; then
echo "TEST_JSDIR=$TEST_JSDIR"
echo ""
echo "If the TEST_JSDIR environment variable is not set, this script "
echo "assumes the JavaScript Tests live in \${TEST_DIR}/www/tests/mozilla.org/js"
echo "If this is not correct, please set the TEST_JSDIR environment variable"
echo "to point to the directory containing the JavaScript Test Library."
echo ""
fi
if [[ ! -e $TEST_BIN/library.sh || ! -e $TEST_JSDIR/runtests.sh ]]; then
exit 2
fi
source ${TEST_BIN}/library.sh
usage()
{
cat <<EOF
usage: runtests.sh -p products -b branches -T buildtypes -B buildcommands [-e extra]
usage: runtests.sh -p "$products" -b "$branches" -T "$buildtypes" -B "$buildcommands" -e "$extra"
variable description
=============== ============================================================
-p products space separated list of js, firefox
-b branches space separated list of branches 1.8.1, 1.9.0
-T buildtypes space separated list of build types opt debug
-e extra optional. extra qualifier to pick build tree and mozconfig.
-B buildcommands optional space separated list of build commands
clean, checkout, build. If not specified, defaults to
'clean checkout build'.
If you wish to skip any build steps, simply specify a value
not containing any of the build commands, e.g. 'none'.
if an argument contains more than one value, it must be quoted.
EOF
exit 2
}
while getopts "p:b:T:B:e:" optname;
do
case $optname in
p) products=$OPTARG;;
b) branches=$OPTARG;;
T) buildtypes=$OPTARG;;
e) extra="$OPTARG"
extraflag="-e $OPTARG";;
B) buildcommands=$OPTARG;;
esac
done
if [[ -z "$products" || -z "$branches" || -z "$buildtypes" ]]; then
usage
fi
if [[ -z "$buildcommands" ]]; then
buildcommands="clean checkout build"
fi
case $buildtypes in
nightly)
buildtypes="nightly-$OSID"
;;
opt|debug|opt*debug)
if [[ -n "$buildcommands" ]]; then
builder.sh -p "$products" -b "$branches" $extraflag -B "$buildcommands" -T "$buildtypes"
fi
;;
esac
testlogfilelist=`mktemp /tmp/TESTLOGFILES.XXXX`
export testlogfiles
export testlogfile
if [[ -z "$extra" ]]; then
if tester.sh -t $TEST_JSDIR/test.sh "$products" "$branches" "$buildtypes" | tee -a $testlogfilelist; then
testlogfiles="`cat $testlogfilelist`"
fi
else
if tester.sh -t $TEST_JSDIR/test.sh "$products" "$branches" "$extra" "$buildtypes" | tee -a $testlogfilelist; then
testlogfiles="`cat $testlogfilelist`"
fi
fi
rm $testlogfilelist
case "$OSID" in
win32)
arch=all
kernel=all
;;
linux)
arch="`uname -p`"
kernel="`uname -r`"
case "$kernel" in
*el5PAE)
kernel='.*el5PAE'
;;
*ELsmp)
kernel='.*ELsmp'
;;
*fc*)
kernel='.*fc.'
;;
*)
kernel='[.][*]'
;;
esac
;;
mac)
arch="`uname -p`"
kernel=all
;;
*)
error "$OSID not supported"
;;
esac
for testlogfile in $testlogfiles; do
case "$testlogfile" in
*,js,*) testtype=shell;;
*,firefox,*) testtype=browser;;
*) error "unknown testtype in logfile $testlogfile";;
esac
case "$testlogfile" in
*,opt,*) buildtype=opt;;
*,debug,*) buildtype=debug;;
*) error "unknown buildtype in logfile $testlogfile";;
esac
case "$testlogfile" in
*,1.8.1,*) branch=1.8.1;;
*,1.9.0,*) branch=1.9.0;;
*) error "unknown branch in logfile $testlogfile";;
esac
outputprefix=$testlogfile
if [[ -n "$DEBUG" ]]; then
dumpvars branch buildtype testtype OSID testlogfile arch kernel outputprefix
fi
$TEST_DIR/tests/mozilla.org/js/known-failures.pl -b $branch -T $buildtype -t $testtype -o "$OSID" -z `date +%z` -l $testlogfile -A "$arch" -K "$kernel" -r $TEST_JSDIR/failures.txt -O $outputprefix
done

Просмотреть файл

@ -1,14 +1,74 @@
#!/usr/local/bin/bash
# -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla JavaScript Testing Utilities
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Bob Clary <bclary@bclary.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
TEST_DIR=${TEST_DIR:-/work/mozilla/mozilla.com/test.mozilla.com/www}
TEST_BIN=${TEST_BIN:-$TEST_DIR/bin}
source ${TEST_BIN}/library.sh
TEST_JSDIR=${TEST_JSDIR:-$TEST_DIR/tests/mozilla.org/js}
TEST_JSEACH_TIMEOUT=${TEST_JSEACH_TIMEOUT:-240}
TEST_JSEACH_PAGE_TIMEOUT=${TEST_JSEACH_PAGE_TIMEOUT:-240}
if [[ ! -e $TEST_BIN/library.sh ]]; then
echo "TEST_DIR=$TEST_DIR"
echo ""
echo "This script requires the Sisyphus testing framework. Please "
echo "cvs check out the Sisyphys framework from mozilla/testing/sisyphus"
echo "and set the environment variable TEST_DIR to the directory where it"
echo "located."
echo ""
fi
if [[ ! -e $TEST_JSDIR/runtests.sh ]]; then
echo "TEST_JSDIR=$TEST_JSDIR"
echo ""
echo "If the TEST_JSDIR environment variable is not set, this script "
echo "assumes the JavaScript Tests live in \${TEST_DIR}/www/tests/mozilla.org/js"
echo "If this is not correct, please set the TEST_JSDIR environment variable"
echo "to point to the directory containing the JavaScript Test Library."
echo ""
fi
if [[ ! -e $TEST_BIN/library.sh || ! -e $TEST_JSDIR/runtests.sh ]]; then
exit 2
fi
source ${TEST_BIN}/library.sh
TEST_JSEACH_TIMEOUT=${TEST_JSEACH_TIMEOUT:-900}
TEST_JSEACH_PAGE_TIMEOUT=${TEST_JSEACH_PAGE_TIMEOUT:-900}
TEST_WWW_JS=`echo $TEST_JSDIR|sed "s|$TEST_DIR||"`
#
@ -78,6 +138,8 @@ esac
pushd $TEST_JSDIR
# clock skew causes failures. clean first
make clean
make
cat "$list" | while read url; do

Просмотреть файл

@ -1,13 +1,73 @@
#!/usr/local/bin/bash
# -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla JavaScript Testing Utilities
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Bob Clary <bclary@bclary.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
TEST_DIR=${TEST_DIR:-/work/mozilla/mozilla.com/test.mozilla.com/www}
TEST_BIN=${TEST_BIN:-$TEST_DIR/bin}
source ${TEST_BIN}/library.sh
TEST_JSDIR=${TEST_JSDIR:-$TEST_DIR/tests/mozilla.org/js}
TEST_JSSHELL_TIMEOUT=${TEST_JSSHELL_TIMEOUT:-240}
if [[ ! -e $TEST_BIN/library.sh ]]; then
echo "TEST_DIR=$TEST_DIR"
echo ""
echo "This script requires the Sisyphus testing framework. Please "
echo "cvs check out the Sisyphys framework from mozilla/testing/sisyphus"
echo "and set the environment variable TEST_DIR to the directory where it"
echo "located."
echo ""
fi
if [[ ! -e $TEST_JSDIR/runtests.sh ]]; then
echo "TEST_JSDIR=$TEST_JSDIR"
echo ""
echo "If the TEST_JSDIR environment variable is not set, this script "
echo "assumes the JavaScript Tests live in \${TEST_DIR}/www/tests/mozilla.org/js"
echo "If this is not correct, please set the TEST_JSDIR environment variable"
echo "to point to the directory containing the JavaScript Test Library."
echo ""
fi
if [[ ! -e $TEST_BIN/library.sh || ! -e $TEST_JSDIR/runtests.sh ]]; then
exit 2
fi
source ${TEST_BIN}/library.sh
TEST_JSSHELL_TIMEOUT=${TEST_JSSHELL_TIMEOUT:-900}
#
# options processing
@ -72,6 +132,8 @@ esac
TEST_HTML_LOG="${TEST_DIR}/results/mozilla.org/js/${TEST_DATE},js,$branch,$buildtype,$OSID,${TEST_MACHINE},$TEST_SUITE-shell.html"
# clock skew causes failures. clean first
make clean
make
time perl jsDriver.pl \

Просмотреть файл

@ -1,12 +1,72 @@
#!/usr/local/bin/bash
# -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla JavaScript Testing Utilities
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): Bob Clary <bclary@bclary.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
TEST_DIR=${TEST_DIR:-/work/mozilla/mozilla.com/test.mozilla.com/www}
TEST_BIN=${TEST_BIN:-$TEST_DIR/bin}
source ${TEST_BIN}/library.sh
TEST_JSDIR=${TEST_JSDIR:-$TEST_DIR/tests/mozilla.org/js}
if [[ ! -e $TEST_BIN/library.sh ]]; then
echo "TEST_DIR=$TEST_DIR"
echo ""
echo "This script requires the Sisyphus testing framework. Please "
echo "cvs check out the Sisyphys framework from mozilla/testing/sisyphus"
echo "and set the environment variable TEST_DIR to the directory where it"
echo "located."
echo ""
fi
if [[ ! -e $TEST_JSDIR/runtests.sh ]]; then
echo "TEST_JSDIR=$TEST_JSDIR"
echo ""
echo "If the TEST_JSDIR environment variable is not set, this script "
echo "assumes the JavaScript Tests live in \${TEST_DIR}/www/tests/mozilla.org/js"
echo "If this is not correct, please set the TEST_JSDIR environment variable"
echo "to point to the directory containing the JavaScript Test Library."
echo ""
fi
if [[ ! -e $TEST_BIN/library.sh || ! -e $TEST_JSDIR/runtests.sh ]]; then
exit 2
fi
source ${TEST_BIN}/library.sh
#
# options processing
#

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

125
js/tests/userhookeach.js Executable file
Просмотреть файл

@ -0,0 +1,125 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Bob Clary
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* Spider hook function to check if an individual browser based JS test
* has completed executing.
*/
var gCheckInterval = 1000;
var gCurrentTestId;
var gReport;
function userOnStart()
{
dlog('userOnStart');
registerDialogCloser();
}
function userOnBeforePage()
{
dlog('userOnBeforePage');
gCurrentTestId = /test=(.*);language/.exec(gSpider.mCurrentUrl.mUrl)[1];
cdump('JavaScriptTest: Begin Test ' + gCurrentTestId);
cdump('JavaScriptTest: Begin Execution ' + gCurrentTestId);
}
function userOnAfterPage()
{
dlog('userOnAfterPage');
cdump('JavaScriptTest: End Execution ' + gCurrentTestId);
checkTestCompleted();
}
function userOnStop()
{
// close any pending dialogs
cdump('JavaScriptTest: End Test ' + gCurrentTestId);
closeDialog();
unregisterDialogCloser();
}
function checkTestCompleted()
{
dlog('checkTestCompleted()');
var win = gSpider.mDocument.defaultView;
if (win.wrappedJSObject)
{
win = win.wrappedJSObject;
}
if (win.gPageCompleted)
{
dlog('Page Completed');
cdump('JavaScriptTest: Begin Summary ' + gCurrentTestId);
gPageCompleted = true;
var gTestcases = win.gTestcases;
if (typeof gTestcases == 'undefined')
{
cdump('JavaScriptTest: ' + gCurrentTestId +
' gTestcases array not defined. Possible test failure.');
}
else if (gTestcases.length == 0)
{
cdump('JavaScriptTest: ' + gCurrentTestId +
' gTestcases array is empty. Tests not run.');
}
else
{
}
cdump('JavaScriptTest: End Summary ' + gCurrentTestId);
// added in Spider 0.0.1.8
// gc to flush out issues quickly
collectGarbage();
}
else
{
dlog('page not completed, recheck');
setTimeout(checkTestCompleted, gCheckInterval);
}
}
gConsoleListener.onConsoleMessage =
function userOnConsoleMessage(s)
{
dump(s);
};