1999-12-05 05:15:22 +03:00
|
|
|
#!/usr/bin/perl
|
2005-09-08 23:16:27 +04:00
|
|
|
# -*- Mode: Perl; tab-width: 4; indent-tabs-mode: nil; -*-
|
2005-07-12 04:23:45 +04:00
|
|
|
# vim: set ts=4 sw=4 et tw=80:
|
2005-02-12 23:11:18 +03:00
|
|
|
# ***** BEGIN LICENSE BLOCK *****
|
|
|
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-12-05 05:15:22 +03:00
|
|
|
#
|
2005-02-12 23:11:18 +03:00
|
|
|
# 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/
|
1999-12-05 05:15:22 +03:00
|
|
|
#
|
2005-02-12 23:11:18 +03:00
|
|
|
# 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.
|
1999-12-05 05:15:22 +03:00
|
|
|
#
|
2005-02-12 23:11:18 +03:00
|
|
|
# The Original Code is JavaScript Core Tests.
|
1999-12-05 05:15:22 +03:00
|
|
|
#
|
2005-02-12 23:11:18 +03:00
|
|
|
# The Initial Developer of the Original Code is
|
|
|
|
# Netscape Communications Corporation.
|
|
|
|
# Portions created by the Initial Developer are Copyright (C) 1997-1999
|
|
|
|
# the Initial Developer. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s):
|
|
|
|
# Robert Ginda <rginda@netscape.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 *****
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
# Second cut at runtests.pl script originally by
|
|
|
|
# Christine Begle (cbegle@netscape.com)
|
|
|
|
# Branched 11/01/99
|
|
|
|
|
2000-01-08 00:39:36 +03:00
|
|
|
use strict;
|
1999-12-05 05:15:22 +03:00
|
|
|
use Getopt::Mixed "nextOption";
|
2005-09-08 23:16:27 +04:00
|
|
|
use File::Temp qw/ tempfile tempdir /;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
my $os_type = &get_os_type;
|
|
|
|
my $unixish = (($os_type ne "WIN") && ($os_type ne "MAC"));
|
|
|
|
my $path_sep = ($os_type eq "MAC") ? ":" : "/";
|
2002-10-26 05:24:21 +04:00
|
|
|
my $win_sep = ($os_type eq "WIN")? &get_win_sep : "";
|
2000-03-10 22:12:53 +03:00
|
|
|
my $redirect_command = ($os_type ne "MAC") ? " 2>&1" : "";
|
2000-01-13 01:02:23 +03:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
# command line option defaults
|
2000-01-13 01:02:23 +03:00
|
|
|
my $opt_suite_path;
|
|
|
|
my $opt_trace = 0;
|
2000-01-08 00:39:36 +03:00
|
|
|
my $opt_classpath = "";
|
2000-05-24 22:10:55 +04:00
|
|
|
my $opt_rhino_opt = 0;
|
2000-03-10 23:38:57 +03:00
|
|
|
my $opt_rhino_ms = 0;
|
2000-03-10 21:54:21 +03:00
|
|
|
my @opt_engine_list;
|
2000-01-08 00:39:36 +03:00
|
|
|
my $opt_engine_type = "";
|
2000-04-07 01:14:23 +04:00
|
|
|
my $opt_engine_params = "";
|
2000-03-10 21:54:21 +03:00
|
|
|
my $opt_user_output_file = 0;
|
2000-01-08 00:39:36 +03:00
|
|
|
my $opt_output_file = "";
|
|
|
|
my @opt_test_list_files;
|
|
|
|
my @opt_neg_list_files;
|
|
|
|
my $opt_shell_path = "";
|
|
|
|
my $opt_java_path = "";
|
2005-03-18 22:09:59 +03:00
|
|
|
my $opt_bug_url = "https://bugzilla.mozilla.org/show_bug.cgi?id=";
|
2000-01-08 00:39:36 +03:00
|
|
|
my $opt_console_failures = 0;
|
|
|
|
my $opt_lxr_url = "http://lxr.mozilla.org/mozilla/source/js/tests/";
|
2000-01-13 01:02:23 +03:00
|
|
|
my $opt_exit_munge = ($os_type ne "MAC") ? 1 : 0;
|
2005-07-12 04:23:45 +04:00
|
|
|
my $opt_enable_narcissus = 0;
|
|
|
|
my $opt_narcissus_path = "";
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
# command line option definition
|
2000-01-08 00:39:36 +03:00
|
|
|
my $options = "b=s bugurl>b c=s classpath>c e=s engine>e f=s file>f " .
|
1999-12-05 05:15:22 +03:00
|
|
|
"h help>h i j=s javapath>j k confail>k l=s list>l L=s neglist>L " .
|
2000-04-07 01:14:23 +04:00
|
|
|
"o=s opt>o p=s testpath>p s=s shellpath>s t trace>t u=s lxrurl>u " .
|
2005-07-12 04:23:45 +04:00
|
|
|
"x noexitmunge>x n:s narcissus>n";
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2000-03-10 22:12:53 +03:00
|
|
|
if ($os_type eq "MAC") {
|
|
|
|
$opt_suite_path = `directory`;
|
|
|
|
$opt_suite_path =~ s/[\n\r]//g;
|
|
|
|
$opt_suite_path .= ":";
|
|
|
|
} else {
|
|
|
|
$opt_suite_path = "./";
|
|
|
|
}
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
&parse_args;
|
|
|
|
|
2000-01-08 00:39:36 +03:00
|
|
|
my $user_exit = 0;
|
2000-03-10 21:54:21 +03:00
|
|
|
my ($engine_command, $html, $failures_reported, $tests_completed,
|
2000-03-10 22:12:53 +03:00
|
|
|
$exec_time_string);
|
2000-01-08 00:39:36 +03:00
|
|
|
my @failed_tests;
|
2000-03-10 21:54:21 +03:00
|
|
|
my @test_list = &get_test_list;
|
|
|
|
|
|
|
|
if ($#test_list == -1) {
|
|
|
|
die ("Nothing to test.\n");
|
|
|
|
}
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
if ($unixish) {
|
2000-01-08 00:39:36 +03:00
|
|
|
# on unix, ^C pauses the tests, and gives the user a chance to quit but
|
1999-12-07 02:38:23 +03:00
|
|
|
# report on what has been done, to just quit, or to continue (the
|
|
|
|
# interrupted test will still be skipped.)
|
|
|
|
# windows doesn't handle the int handler they way we want it to,
|
|
|
|
# so don't even pretend to let the user continue.
|
1999-12-05 05:15:22 +03:00
|
|
|
$SIG{INT} = 'int_handler';
|
|
|
|
}
|
|
|
|
|
2000-03-10 21:54:21 +03:00
|
|
|
&main;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2000-03-10 21:54:21 +03:00
|
|
|
#End.
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2000-03-10 21:54:21 +03:00
|
|
|
sub main {
|
|
|
|
my $start_time;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2000-03-10 21:54:21 +03:00
|
|
|
while ($opt_engine_type = pop (@opt_engine_list)) {
|
|
|
|
dd ("Testing engine '$opt_engine_type'");
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2000-03-10 21:54:21 +03:00
|
|
|
$engine_command = &get_engine_command;
|
|
|
|
$html = "";
|
|
|
|
@failed_tests = ();
|
|
|
|
$failures_reported = 0;
|
|
|
|
$tests_completed = 0;
|
|
|
|
$start_time = time;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2000-03-10 21:54:21 +03:00
|
|
|
|
|
|
|
&execute_tests (@test_list);
|
|
|
|
|
|
|
|
my $exec_time = (time - $start_time);
|
|
|
|
my $exec_hours = int($exec_time / 60 / 60);
|
|
|
|
$exec_time -= $exec_hours * 60 * 60;
|
|
|
|
my $exec_mins = int($exec_time / 60);
|
|
|
|
$exec_time -= $exec_mins * 60;
|
|
|
|
my $exec_secs = ($exec_time % 60);
|
|
|
|
|
|
|
|
if ($exec_hours > 0) {
|
|
|
|
$exec_time_string = "$exec_hours hours, $exec_mins minutes, " .
|
|
|
|
"$exec_secs seconds";
|
|
|
|
} elsif ($exec_mins > 0) {
|
|
|
|
$exec_time_string = "$exec_mins minutes, $exec_secs seconds";
|
|
|
|
} else {
|
|
|
|
$exec_time_string = "$exec_secs seconds";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$opt_user_output_file) {
|
|
|
|
$opt_output_file = &get_tempfile_name;
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-03-10 21:54:21 +03:00
|
|
|
&write_results;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-03-10 21:54:21 +03:00
|
|
|
}
|
|
|
|
}
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2005-07-12 04:23:45 +04:00
|
|
|
sub append_file_to_command {
|
|
|
|
my ($command, $file) = @_;
|
|
|
|
|
|
|
|
if ($opt_enable_narcissus == 1) {
|
|
|
|
$command .= " -e 'evaluate(\"load(\\\"$file\\\")\")'"
|
|
|
|
} else {
|
|
|
|
$command .= " -f $file";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
sub execute_tests {
|
2000-01-08 00:39:36 +03:00
|
|
|
my (@test_list) = @_;
|
2002-10-28 06:31:03 +03:00
|
|
|
my ($test, $shell_command, $line, @output, $path);
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($last_suite, $last_test_dir);
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
&status ("Executing " . ($#test_list + 1) . " test(s).");
|
|
|
|
|
|
|
|
foreach $test (@test_list) {
|
2000-01-13 01:02:23 +03:00
|
|
|
my ($suite, $test_dir, $test_file) = split($path_sep, $test);
|
1999-12-05 05:15:22 +03:00
|
|
|
# *-n.js is a negative test, expect exit code 3 (runtime error)
|
2000-01-08 00:39:36 +03:00
|
|
|
my $expected_exit = ($test =~ /\-n\.js$/) ? 3 : 0;
|
|
|
|
my ($got_exit, $exit_signal);
|
2001-05-31 04:17:45 +04:00
|
|
|
my $failure_lines;
|
|
|
|
my $bug_number;
|
|
|
|
my $status_lines;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
1999-12-06 07:29:18 +03:00
|
|
|
# user selected [Q]uit from ^C handler.
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($user_exit) {
|
|
|
|
return;
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-06 07:29:18 +03:00
|
|
|
# Append the shell.js files to the shell_command if they're there.
|
|
|
|
# (only check for their existance if the suite or test_dir has changed
|
|
|
|
# since the last time we looked.)
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($last_suite ne $suite || $last_test_dir ne $test_dir) {
|
2000-01-13 01:02:23 +03:00
|
|
|
$shell_command = &xp_path($engine_command);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2002-10-28 06:31:03 +03:00
|
|
|
$path = &xp_path($opt_suite_path . $suite . "/shell.js");
|
|
|
|
if (-f $path) {
|
2005-07-12 04:23:45 +04:00
|
|
|
$shell_command = &append_file_to_command($shell_command,
|
|
|
|
$path);
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
2002-10-28 06:31:03 +03:00
|
|
|
|
|
|
|
$path = &xp_path($opt_suite_path . $suite . "/" .
|
|
|
|
$test_dir . "/shell.js");
|
|
|
|
if (-f $path) {
|
2005-07-12 04:23:45 +04:00
|
|
|
$shell_command = &append_file_to_command($shell_command,
|
|
|
|
$path);
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
$last_suite = $suite;
|
|
|
|
$last_test_dir = $test_dir;
|
|
|
|
}
|
2002-10-28 06:31:03 +03:00
|
|
|
|
|
|
|
$path = &xp_path($opt_suite_path . $test);
|
2005-07-12 04:23:45 +04:00
|
|
|
my $command = &append_file_to_command($shell_command, $path);
|
|
|
|
&dd ("executing: " . $command);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2005-09-08 23:16:27 +04:00
|
|
|
my $jsout;
|
|
|
|
(undef, $jsout) = tempfile();
|
|
|
|
system "$command > $jsout $redirect_command";
|
|
|
|
open (OUTPUT, "$jsout") or
|
|
|
|
die "failed to open temporary file $jsout: $!\n";
|
1999-12-05 05:15:22 +03:00
|
|
|
@output = <OUTPUT>;
|
|
|
|
close (OUTPUT);
|
2005-09-08 23:16:27 +04:00
|
|
|
unlink "$jsout";
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
@output = grep (!/js\>/, @output);
|
1999-12-09 01:21:41 +03:00
|
|
|
|
|
|
|
if ($opt_exit_munge == 1) {
|
|
|
|
# signal information in the lower 8 bits, exit code above that
|
|
|
|
$got_exit = ($? >> 8);
|
|
|
|
$exit_signal = ($? & 255);
|
|
|
|
} else {
|
|
|
|
# user says not to munge the exit code
|
|
|
|
$got_exit = $?;
|
|
|
|
$exit_signal = 0;
|
|
|
|
}
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
$failure_lines = "";
|
2001-05-31 04:17:45 +04:00
|
|
|
$bug_number = "";
|
|
|
|
$status_lines = "";
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
foreach $line (@output) {
|
|
|
|
|
1999-12-06 07:29:18 +03:00
|
|
|
# watch for testcase to proclaim what exit code it expects to
|
|
|
|
# produce (0 by default)
|
2001-06-09 02:05:32 +04:00
|
|
|
if ($line =~ /expect(ed)?\s*exit\s*code\s*\:?\s*(\d+)/i) {
|
|
|
|
$expected_exit = $2;
|
2000-01-08 00:39:36 +03:00
|
|
|
&dd ("Test case expects exit code $expected_exit");
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
1999-12-06 07:29:18 +03:00
|
|
|
# watch for failures
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($line =~ /failed!/i) {
|
|
|
|
$failure_lines .= $line;
|
|
|
|
}
|
|
|
|
|
1999-12-06 07:29:18 +03:00
|
|
|
# and watch for bugnumbers
|
|
|
|
# XXX This only allows 1 bugnumber per testfile, should be
|
|
|
|
# XXX modified to allow for multiple.
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($line =~ /bugnumber\s*\:?\s*(.*)/i) {
|
2005-09-08 23:16:27 +04:00
|
|
|
my $bugline = $1;
|
2005-03-18 22:09:59 +03:00
|
|
|
$bugline =~ /(\d+)/;
|
2001-06-07 02:15:13 +04:00
|
|
|
$bug_number = $1;
|
2001-05-31 04:17:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# and watch for status
|
|
|
|
if ($line =~ /status/i) {
|
|
|
|
$status_lines .= $line;
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
if (!@output) {
|
|
|
|
@output = ("Testcase produced no output!");
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($got_exit != $expected_exit) {
|
1999-12-06 07:29:18 +03:00
|
|
|
# full testcase output dumped on mismatched exit codes,
|
1999-12-05 05:15:22 +03:00
|
|
|
&report_failure ($test, "Expected exit code " .
|
|
|
|
"$expected_exit, got $got_exit\n" .
|
|
|
|
"Testcase terminated with signal $exit_signal\n" .
|
|
|
|
"Complete testcase output was:\n" .
|
2001-06-07 02:15:13 +04:00
|
|
|
join ("\n",@output), $bug_number);
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($failure_lines) {
|
1999-12-06 07:29:18 +03:00
|
|
|
# only offending lines if exit codes matched
|
2001-06-07 02:15:13 +04:00
|
|
|
&report_failure ($test, "$status_lines\n".
|
|
|
|
"Failure messages were:\n$failure_lines",
|
|
|
|
$bug_number);
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
&dd ("exit code $got_exit, exit signal $exit_signal.");
|
|
|
|
|
|
|
|
$tests_completed++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub write_results {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($list_name, $neglist_name);
|
|
|
|
my $completion_date = localtime;
|
|
|
|
my $failure_pct = int(($failures_reported / $tests_completed) * 10000) /
|
1999-12-05 05:15:22 +03:00
|
|
|
100;
|
|
|
|
&dd ("Writing output to $opt_output_file.");
|
|
|
|
|
1999-12-07 02:38:23 +03:00
|
|
|
if ($#opt_test_list_files == -1) {
|
1999-12-06 07:29:18 +03:00
|
|
|
$list_name = "All tests";
|
1999-12-07 02:38:23 +03:00
|
|
|
} elsif ($#opt_test_list_files < 10) {
|
|
|
|
$list_name = join (", ", @opt_test_list_files);
|
1999-12-06 07:29:18 +03:00
|
|
|
} else {
|
1999-12-07 02:38:23 +03:00
|
|
|
$list_name = "($#opt_test_list_files test files specified)";
|
1999-12-06 07:29:18 +03:00
|
|
|
}
|
|
|
|
|
1999-12-07 02:38:23 +03:00
|
|
|
if ($#opt_neg_list_files == -1) {
|
1999-12-06 07:29:18 +03:00
|
|
|
$neglist_name = "(none)";
|
1999-12-07 02:38:23 +03:00
|
|
|
} elsif ($#opt_test_list_files < 10) {
|
|
|
|
$neglist_name = join (", ", @opt_neg_list_files);
|
1999-12-06 07:29:18 +03:00
|
|
|
} else {
|
1999-12-07 02:38:23 +03:00
|
|
|
$neglist_name = "($#opt_neg_list_files skip files specified)";
|
1999-12-06 07:29:18 +03:00
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
open (OUTPUT, "> $opt_output_file") ||
|
|
|
|
die ("Could not create output file $opt_output_file");
|
|
|
|
|
|
|
|
print OUTPUT
|
|
|
|
("<html><head>\n" .
|
1999-12-06 07:29:18 +03:00
|
|
|
"<title>Test results, $opt_engine_type</title>\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
"</head>\n" .
|
|
|
|
"<body bgcolor='white'>\n" .
|
|
|
|
"<a name='tippy_top'></a>\n" .
|
1999-12-06 07:29:18 +03:00
|
|
|
"<h2>Test results, $opt_engine_type</h2><br>\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
"<p class='results_summary'>\n" .
|
1999-12-06 07:29:18 +03:00
|
|
|
"Test List: $list_name<br>\n" .
|
|
|
|
"Skip List: $neglist_name<br>\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
($#test_list + 1) . " test(s) selected, $tests_completed test(s) " .
|
|
|
|
"completed, $failures_reported failures reported " .
|
|
|
|
"($failure_pct% failed)<br>\n" .
|
|
|
|
"Engine command line: $engine_command<br>\n" .
|
|
|
|
"OS type: $os_type<br>\n");
|
|
|
|
|
2000-04-07 04:05:50 +04:00
|
|
|
if ($opt_engine_type =~ /^rhino/) {
|
2000-01-13 01:02:23 +03:00
|
|
|
open (JAVAOUTPUT, $opt_java_path . "java -fullversion " .
|
|
|
|
$redirect_command . " |");
|
1999-12-05 05:15:22 +03:00
|
|
|
print OUTPUT <JAVAOUTPUT>;
|
|
|
|
print OUTPUT "<BR>";
|
|
|
|
close (JAVAOUTPUT);
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
print OUTPUT
|
|
|
|
("Testcase execution time: $exec_time_string.<br>\n" .
|
|
|
|
"Tests completed on $completion_date.<br><br>\n");
|
|
|
|
|
|
|
|
if ($failures_reported > 0) {
|
|
|
|
print OUTPUT
|
|
|
|
("[ <a href='#fail_detail'>Failure Details</a> | " .
|
|
|
|
"<a href='#retest_list'>Retest List</a> | " .
|
2005-03-18 22:09:59 +03:00
|
|
|
"<a href='$opt_lxr_url" . "menu.html'>Test Selection Page</a> ]<br>\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
"<hr>\n" .
|
|
|
|
"<a name='fail_detail'></a>\n" .
|
|
|
|
"<h2>Failure Details</h2><br>\n<dl>" .
|
|
|
|
$html .
|
|
|
|
"</dl>\n[ <a href='#tippy_top'>Top of Page</a> | " .
|
|
|
|
"<a href='#fail_detail'>Top of Failures</a> ]<br>\n" .
|
2002-11-20 01:00:38 +03:00
|
|
|
"<hr>\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
"<a name='retest_list'></a>\n" .
|
|
|
|
"<h2>Retest List</h2><br>\n" .
|
2002-11-20 01:00:38 +03:00
|
|
|
"<pre>\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
"# Retest List, $opt_engine_type, " .
|
|
|
|
"generated $completion_date.\n" .
|
2005-07-28 07:37:12 +04:00
|
|
|
"FAILURE: # Original test base was: $list_name.\n" .
|
|
|
|
"FAILURE: # $tests_completed of " . ($#test_list + 1) .
|
1999-12-05 05:15:22 +03:00
|
|
|
" test(s) were completed, " .
|
|
|
|
"$failures_reported failures reported.\n" .
|
2005-09-08 23:16:27 +04:00
|
|
|
"FAILURE: Engine command line: $engine_command<br>\n" .
|
2005-07-28 07:37:12 +04:00
|
|
|
join ("\n", map { "FAILURE: $_" } @failed_tests) .
|
2005-04-09 00:02:47 +04:00
|
|
|
"\n</pre>\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
"[ <a href='#tippy_top'>Top of Page</a> | " .
|
|
|
|
"<a href='#retest_list'>Top of Retest List</a> ]<br>\n");
|
|
|
|
} else {
|
|
|
|
print OUTPUT
|
|
|
|
("<h1>Whoop-de-doo, nothing failed!</h1>\n");
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
print OUTPUT "</body>";
|
|
|
|
|
|
|
|
close (OUTPUT);
|
|
|
|
|
|
|
|
&status ("Wrote results to '$opt_output_file'.");
|
|
|
|
|
|
|
|
if ($opt_console_failures) {
|
|
|
|
&status ("$failures_reported test(s) failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
sub parse_args {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($option, $value, $lastopt);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
&dd ("checking command line options.");
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
Getopt::Mixed::init ($options);
|
|
|
|
$Getopt::Mixed::order = $Getopt::Mixed::RETURN_IN_ORDER;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
while (($option, $value) = nextOption()) {
|
|
|
|
|
|
|
|
if ($option eq "b") {
|
|
|
|
&dd ("opt: setting bugurl to '$value'.");
|
|
|
|
$opt_bug_url = $value;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($option eq "c") {
|
|
|
|
&dd ("opt: setting classpath to '$value'.");
|
|
|
|
$opt_classpath = $value;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-03-10 21:54:21 +03:00
|
|
|
} elsif (($option eq "e") || (($option eq "") && ($lastopt eq "e"))) {
|
|
|
|
&dd ("opt: adding engine $value.");
|
|
|
|
push (@opt_engine_list, $value);
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($option eq "f") {
|
|
|
|
if (!$value) {
|
|
|
|
die ("Output file cannot be null.\n");
|
|
|
|
}
|
|
|
|
&dd ("opt: setting output file to '$value'.");
|
2000-03-10 21:54:21 +03:00
|
|
|
$opt_user_output_file = 1;
|
1999-12-05 05:15:22 +03:00
|
|
|
$opt_output_file = $value;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($option eq "h") {
|
|
|
|
&usage;
|
|
|
|
|
|
|
|
} elsif ($option eq "j") {
|
|
|
|
if (!($value =~ /[\/\\]$/)) {
|
|
|
|
$value .= "/";
|
|
|
|
}
|
|
|
|
&dd ("opt: setting java path to '$value'.");
|
2000-01-08 00:39:36 +03:00
|
|
|
$opt_java_path = $value;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($option eq "k") {
|
|
|
|
&dd ("opt: displaying failures on console.");
|
|
|
|
$opt_console_failures=1;
|
|
|
|
|
|
|
|
} elsif ($option eq "l" || (($option eq "") && ($lastopt eq "l"))) {
|
|
|
|
$option = "l";
|
|
|
|
&dd ("opt: adding test list '$value'.");
|
|
|
|
push (@opt_test_list_files, $value);
|
|
|
|
|
|
|
|
} elsif ($option eq "L" || (($option eq "") && ($lastopt eq "L"))) {
|
|
|
|
$option = "L";
|
|
|
|
&dd ("opt: adding negative list '$value'.");
|
|
|
|
push (@opt_neg_list_files, $value);
|
2000-04-07 01:14:23 +04:00
|
|
|
|
|
|
|
} elsif ($option eq "o") {
|
|
|
|
$opt_engine_params = $value;
|
|
|
|
&dd ("opt: setting engine params to '$opt_engine_params'.");
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($option eq "p") {
|
|
|
|
$opt_suite_path = $value;
|
2001-10-04 06:08:16 +04:00
|
|
|
|
|
|
|
if ($os_type eq "MAC") {
|
|
|
|
if (!($opt_suite_path =~ /\:$/)) {
|
|
|
|
$opt_suite_path .= ":";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!($opt_suite_path =~ /[\/\\]$/)) {
|
|
|
|
$opt_suite_path .= "/";
|
|
|
|
}
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
2001-10-04 06:08:16 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
&dd ("opt: setting suite path to '$opt_suite_path'.");
|
2001-10-04 06:08:16 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($option eq "s") {
|
|
|
|
$opt_shell_path = $value;
|
|
|
|
&dd ("opt: setting shell path to '$opt_shell_path'.");
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($option eq "t") {
|
|
|
|
&dd ("opt: tracing output. (console failures at no extra charge.)");
|
|
|
|
$opt_console_failures = 1;
|
|
|
|
$opt_trace = 1;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($option eq "u") {
|
|
|
|
&dd ("opt: setting lxr url to '$value'.");
|
|
|
|
$opt_lxr_url = $value;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-09 01:21:41 +03:00
|
|
|
} elsif ($option eq "x") {
|
|
|
|
&dd ("opt: turning off exit munging.");
|
|
|
|
$opt_exit_munge = 0;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2005-07-12 04:23:45 +04:00
|
|
|
} elsif ($option eq "n") {
|
|
|
|
&dd ("opt: enabling narcissus.");
|
|
|
|
$opt_enable_narcissus = 1;
|
|
|
|
if ($value) {
|
|
|
|
$opt_narcissus_path = $value;
|
|
|
|
}
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
} else {
|
2005-07-28 07:37:12 +04:00
|
|
|
&dd ("opt: unknown option $option '$value'.");
|
1999-12-05 05:15:22 +03:00
|
|
|
&usage;
|
|
|
|
}
|
|
|
|
|
|
|
|
$lastopt = $option;
|
|
|
|
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
Getopt::Mixed::cleanup();
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-03-10 21:54:21 +03:00
|
|
|
if ($#opt_engine_list == -1) {
|
1999-12-05 05:15:22 +03:00
|
|
|
die "You must select a shell to test in.\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# print the arguments that this script expects
|
|
|
|
#
|
|
|
|
sub usage {
|
|
|
|
print STDERR
|
|
|
|
("\nusage: $0 [<options>] \n" .
|
|
|
|
"(-b|--bugurl) Bugzilla URL.\n" .
|
|
|
|
" (default is $opt_bug_url)\n" .
|
|
|
|
"(-c|--classpath) Classpath (Rhino only.)\n" .
|
2000-03-10 21:58:45 +03:00
|
|
|
"(-e|--engine) <type> ... Specify the type of engine(s) to test.\n" .
|
2000-03-10 21:54:21 +03:00
|
|
|
" <type> is one or more of\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
" (smopt|smdebug|lcopt|lcdebug|xpcshell|" .
|
2000-05-24 22:10:55 +04:00
|
|
|
"rhino|rhinoi|rhinoms|rhinomsi|rhino9|rhinoms9).\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
"(-f|--file) <file> Redirect output to file named <file>.\n" .
|
|
|
|
" (default is " .
|
|
|
|
"results-<engine-type>-<date-stamp>.html)\n" .
|
|
|
|
"(-h|--help) Print this message.\n" .
|
|
|
|
"(-j|--javapath) Location of java executable.\n" .
|
|
|
|
"(-k|--confail) Log failures to console (also.)\n" .
|
|
|
|
"(-l|--list) <file> ... List of tests to execute.\n" .
|
|
|
|
"(-L|--neglist) <file> ... List of tests to skip.\n" .
|
2000-04-07 01:50:03 +04:00
|
|
|
"(-o|--opt) <options> Options to pass to the JavaScript engine.\n" .
|
2000-04-07 01:14:23 +04:00
|
|
|
" (Make sure to quote them!)\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
"(-p|--testpath) <path> Root of the test suite. (default is ./)\n" .
|
|
|
|
"(-s|--shellpath) <path> Location of JavaScript shell.\n" .
|
|
|
|
"(-t|--trace) Trace script execution.\n" .
|
|
|
|
"(-u|--lxrurl) <url> Complete URL to tests subdirectory on lxr.\n" .
|
1999-12-09 01:26:19 +03:00
|
|
|
" (default is $opt_lxr_url)\n" .
|
|
|
|
"(-x|--noexitmunge) Don't do exit code munging (try this if it\n" .
|
1999-12-09 01:21:41 +03:00
|
|
|
" seems like your exit codes are turning up\n" .
|
2005-07-12 04:23:45 +04:00
|
|
|
" as exit signals.)\n" .
|
|
|
|
"(-n|--narcissus)[=<path>] Run the test suite through Narcissus, run\n" .
|
|
|
|
" through the given shell. The optional path\n".
|
|
|
|
" is the path to Narcissus' js.js file.\n");
|
1999-12-05 05:15:22 +03:00
|
|
|
exit (1);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# get the shell command used to start the (either) engine
|
|
|
|
#
|
|
|
|
sub get_engine_command {
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-08 00:39:36 +03:00
|
|
|
my $retval;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($opt_engine_type eq "rhino") {
|
|
|
|
&dd ("getting rhino engine command.");
|
2000-05-24 22:10:55 +04:00
|
|
|
$opt_rhino_opt = 0;
|
2000-03-10 23:38:57 +03:00
|
|
|
$opt_rhino_ms = 0;
|
2000-03-07 00:28:57 +03:00
|
|
|
$retval = &get_rhino_engine_command;
|
|
|
|
} elsif ($opt_engine_type eq "rhinoi") {
|
|
|
|
&dd ("getting rhinoi engine command.");
|
2000-05-24 22:10:55 +04:00
|
|
|
$opt_rhino_opt = -1;
|
|
|
|
$opt_rhino_ms = 0;
|
|
|
|
$retval = &get_rhino_engine_command;
|
|
|
|
} elsif ($opt_engine_type eq "rhino9") {
|
|
|
|
&dd ("getting rhino engine command.");
|
|
|
|
$opt_rhino_opt = 9;
|
2000-03-10 23:38:57 +03:00
|
|
|
$opt_rhino_ms = 0;
|
|
|
|
$retval = &get_rhino_engine_command;
|
|
|
|
} elsif ($opt_engine_type eq "rhinoms") {
|
|
|
|
&dd ("getting rhinoms engine command.");
|
2000-05-24 22:10:55 +04:00
|
|
|
$opt_rhino_opt = 0;
|
2000-03-10 23:38:57 +03:00
|
|
|
$opt_rhino_ms = 1;
|
|
|
|
$retval = &get_rhino_engine_command;
|
|
|
|
} elsif ($opt_engine_type eq "rhinomsi") {
|
|
|
|
&dd ("getting rhinomsi engine command.");
|
2000-05-24 22:10:55 +04:00
|
|
|
$opt_rhino_opt = -1;
|
|
|
|
$opt_rhino_ms = 1;
|
|
|
|
$retval = &get_rhino_engine_command;
|
|
|
|
} elsif ($opt_engine_type eq "rhinoms9") {
|
|
|
|
&dd ("getting rhinomsi engine command.");
|
|
|
|
$opt_rhino_opt = 9;
|
2000-03-10 23:38:57 +03:00
|
|
|
$opt_rhino_ms = 1;
|
1999-12-05 05:15:22 +03:00
|
|
|
$retval = &get_rhino_engine_command;
|
|
|
|
} elsif ($opt_engine_type eq "xpcshell") {
|
|
|
|
&dd ("getting xpcshell engine command.");
|
2001-06-07 02:15:13 +04:00
|
|
|
$retval = &get_xpc_engine_command;
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($opt_engine_type =~ /^lc(opt|debug)$/) {
|
|
|
|
&dd ("getting liveconnect engine command.");
|
2001-06-07 02:15:13 +04:00
|
|
|
$retval = &get_lc_engine_command;
|
1999-12-05 05:15:22 +03:00
|
|
|
} elsif ($opt_engine_type =~ /^sm(opt|debug)$/) {
|
|
|
|
&dd ("getting spidermonkey engine command.");
|
2001-06-07 02:15:13 +04:00
|
|
|
$retval = &get_sm_engine_command;
|
2005-07-12 04:23:45 +04:00
|
|
|
} elsif ($opt_engine_type =~ /^ep(opt|debug)$/) {
|
2002-11-09 00:56:41 +03:00
|
|
|
&dd ("getting epimetheus engine command.");
|
|
|
|
$retval = &get_ep_engine_command;
|
1999-12-05 05:15:22 +03:00
|
|
|
} else {
|
|
|
|
die ("Unknown engine type selected, '$opt_engine_type'.\n");
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-04-07 01:14:23 +04:00
|
|
|
$retval .= " $opt_engine_params";
|
|
|
|
|
2005-07-12 04:23:45 +04:00
|
|
|
if ($opt_enable_narcissus == 1) {
|
|
|
|
my $narcissus_path = &get_narcissus_path;
|
|
|
|
$retval .= " -f $narcissus_path";
|
|
|
|
}
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
&dd ("got '$retval'");
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
return $retval;
|
2005-07-12 04:23:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# get the path to the Narcissus js.js file.
|
|
|
|
#
|
|
|
|
sub get_narcissus_path {
|
|
|
|
my $retval;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2005-07-12 04:23:45 +04:00
|
|
|
if ($opt_narcissus_path) {
|
|
|
|
$retval = $opt_narcissus_path;
|
|
|
|
} else {
|
|
|
|
# For now, just assume that we're in js/tests.
|
|
|
|
$retval = "../narcissus/js.js";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!-e $retval) {
|
|
|
|
# XXX if it didn't exist, try something more fancy?
|
|
|
|
die "Unable to find Narcissus' js.js at $retval";
|
|
|
|
}
|
|
|
|
|
|
|
|
return $retval;
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# get the shell command used to run rhino
|
|
|
|
#
|
2001-10-27 01:37:51 +04:00
|
|
|
sub get_rhino_engine_command {
|
2000-03-10 23:38:57 +03:00
|
|
|
my $retval = $opt_java_path . ($opt_rhino_ms ? "jview " : "java ");
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($opt_shell_path) {
|
|
|
|
$opt_classpath = ($opt_classpath) ?
|
|
|
|
$opt_classpath . ":" . $opt_shell_path :
|
|
|
|
$opt_shell_path;
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($opt_classpath) {
|
2000-03-10 23:38:57 +03:00
|
|
|
$retval .= ($opt_rhino_ms ? "/cp:p" : "-classpath") . " $opt_classpath ";
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
$retval .= "org.mozilla.javascript.tools.shell.Main";
|
2000-03-07 00:28:57 +03:00
|
|
|
|
2000-05-24 22:10:55 +04:00
|
|
|
if ($opt_rhino_opt) {
|
|
|
|
$retval .= " -opt $opt_rhino_opt";
|
2000-03-07 00:28:57 +03:00
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
return $retval;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# get the shell command used to run xpcshell
|
|
|
|
#
|
2001-10-27 01:37:51 +04:00
|
|
|
sub get_xpc_engine_command {
|
2002-10-28 06:31:03 +03:00
|
|
|
my $retval;
|
2000-01-08 00:39:36 +03:00
|
|
|
my $m5_home = @ENV{"MOZILLA_FIVE_HOME"} ||
|
1999-12-05 05:15:22 +03:00
|
|
|
die ("You must set MOZILLA_FIVE_HOME to use the xpcshell" ,
|
2000-01-13 01:02:23 +03:00
|
|
|
(!$unixish) ? "." : ", also " .
|
1999-12-05 05:15:22 +03:00
|
|
|
"setting LD_LIBRARY_PATH to the same directory may get rid of " .
|
|
|
|
"any 'library not found' errors.\n");
|
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
if (($unixish) && (!@ENV{"LD_LIBRARY_PATH"})) {
|
1999-12-05 05:15:22 +03:00
|
|
|
print STDERR "-#- WARNING: LD_LIBRARY_PATH is not set, xpcshell may " .
|
|
|
|
"not be able to find the required components.\n";
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
if (!($m5_home =~ /[\/\\]$/)) {
|
|
|
|
$m5_home .= "/";
|
|
|
|
}
|
|
|
|
|
2002-10-28 06:31:03 +03:00
|
|
|
$retval = $m5_home . "xpcshell";
|
|
|
|
|
|
|
|
if ($os_type eq "WIN") {
|
|
|
|
$retval .= ".exe";
|
|
|
|
}
|
|
|
|
|
|
|
|
$retval = &xp_path($retval);
|
|
|
|
|
|
|
|
if (($os_type ne "MAC") && !(-x $retval)) {
|
|
|
|
# mac doesn't seem to deal with -x correctly
|
|
|
|
die ($retval . " is not a valid executable on this system.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return $retval;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# get the shell command used to run spidermonkey
|
|
|
|
#
|
|
|
|
sub get_sm_engine_command {
|
2000-01-08 00:39:36 +03:00
|
|
|
my $retval;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-07 22:35:45 +03:00
|
|
|
# Look for Makefile.ref style make first.
|
|
|
|
# (On Windows, spidermonkey can be made by two makefiles, each putting the
|
|
|
|
# executable in a diferent directory, under a different name.)
|
1999-12-07 22:47:06 +03:00
|
|
|
|
1999-12-07 22:35:45 +03:00
|
|
|
if ($opt_shell_path) {
|
1999-12-07 22:47:06 +03:00
|
|
|
# if the user provided a path to the shell, return that.
|
1999-12-07 22:35:45 +03:00
|
|
|
$retval = $opt_shell_path;
|
1999-12-07 22:47:06 +03:00
|
|
|
|
1999-12-07 22:35:45 +03:00
|
|
|
} else {
|
1999-12-07 22:47:06 +03:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
if ($os_type eq "MAC") {
|
|
|
|
$retval = $opt_suite_path . ":src:macbuild:JS";
|
|
|
|
} else {
|
|
|
|
$retval = $opt_suite_path . "../src/";
|
|
|
|
opendir (SRC_DIR_FILES, $retval);
|
|
|
|
my @src_dir_files = readdir(SRC_DIR_FILES);
|
|
|
|
closedir (SRC_DIR_FILES);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
my ($dir, $object_dir);
|
|
|
|
my $pattern = ($opt_engine_type eq "smdebug") ?
|
|
|
|
'DBG.OBJ' : 'OPT.OBJ';
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
# scan for the first directory matching
|
|
|
|
# the pattern expected to hold this type (debug or opt) of engine
|
|
|
|
foreach $dir (@src_dir_files) {
|
|
|
|
if ($dir =~ $pattern) {
|
|
|
|
$object_dir = $dir;
|
|
|
|
last;
|
1999-12-07 22:47:06 +03:00
|
|
|
}
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
if (!$object_dir && $os_type ne "WIN") {
|
|
|
|
die ("Could not locate an object directory in $retval " .
|
|
|
|
"matching the pattern *$pattern. Have you built the " .
|
|
|
|
"engine?\n");
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
if (!(-x $retval . $object_dir . "/js.exe") && ($os_type eq "WIN")) {
|
|
|
|
# On windows, you can build with js.mak as well as Makefile.ref
|
|
|
|
# (Can you say WTF boys and girls? I knew you could.)
|
|
|
|
# So, if the exe the would have been built by Makefile.ref isn't
|
|
|
|
# here, check for the js.mak version before dying.
|
|
|
|
if ($opt_shell_path) {
|
|
|
|
$retval = $opt_shell_path;
|
|
|
|
if (!($retval =~ /[\/\\]$/)) {
|
|
|
|
$retval .= "/";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($opt_engine_type eq "smopt") {
|
|
|
|
$retval = "../src/Release/";
|
|
|
|
} else {
|
|
|
|
$retval = "../src/Debug/";
|
|
|
|
}
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
$retval .= "jsshell.exe";
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
} else {
|
|
|
|
$retval .= $object_dir . "/js";
|
|
|
|
if ($os_type eq "WIN") {
|
|
|
|
$retval .= ".exe";
|
2001-10-27 01:37:51 +04:00
|
|
|
}
|
2000-01-13 01:02:23 +03:00
|
|
|
}
|
|
|
|
} # mac/ not mac
|
1999-12-07 22:35:45 +03:00
|
|
|
|
2002-10-28 06:31:03 +03:00
|
|
|
$retval = &xp_path($retval);
|
|
|
|
|
1999-12-07 22:47:06 +03:00
|
|
|
} # (user provided a path)
|
1999-12-07 22:35:45 +03:00
|
|
|
|
2002-10-28 06:31:03 +03:00
|
|
|
|
|
|
|
if (($os_type ne "MAC") && !(-x $retval)) {
|
2000-01-13 01:02:23 +03:00
|
|
|
# mac doesn't seem to deal with -x correctly
|
2002-10-28 06:31:03 +03:00
|
|
|
die ($retval . " is not a valid executable on this system.\n");
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2002-10-28 06:31:03 +03:00
|
|
|
return $retval;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
2001-08-08 04:12:50 +04:00
|
|
|
#
|
2002-11-09 00:56:41 +03:00
|
|
|
# get the shell command used to run epimetheus
|
2001-08-08 04:12:50 +04:00
|
|
|
#
|
2002-11-09 00:56:41 +03:00
|
|
|
sub get_ep_engine_command {
|
2001-08-08 04:12:50 +04:00
|
|
|
my $retval;
|
|
|
|
|
|
|
|
if ($opt_shell_path) {
|
|
|
|
# if the user provided a path to the shell, return that -
|
|
|
|
$retval = $opt_shell_path;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
my $dir;
|
|
|
|
my $os;
|
|
|
|
my $debug;
|
|
|
|
my $opt;
|
|
|
|
my $exe;
|
|
|
|
|
2002-11-09 00:56:41 +03:00
|
|
|
$dir = $opt_suite_path . "../../js2/src/";
|
2001-08-08 04:12:50 +04:00
|
|
|
|
|
|
|
if ($os_type eq "MAC") {
|
|
|
|
#
|
|
|
|
# On the Mac, the debug and opt builds lie in the same directory -
|
|
|
|
#
|
|
|
|
$os = "macbuild:";
|
|
|
|
$debug = "";
|
|
|
|
$opt = "";
|
|
|
|
$exe = "JS2";
|
|
|
|
} elsif ($os_type eq "WIN") {
|
2002-11-09 00:56:41 +03:00
|
|
|
$os = "winbuild/Epimetheus/";
|
2002-03-30 03:35:16 +03:00
|
|
|
$debug = "Debug/";
|
2001-08-08 04:12:50 +04:00
|
|
|
$opt = "Release/";
|
2002-11-09 00:56:41 +03:00
|
|
|
$exe = "Epimetheus.exe";
|
2001-08-08 04:12:50 +04:00
|
|
|
} else {
|
|
|
|
$os = "";
|
|
|
|
$debug = "";
|
|
|
|
$opt = ""; # <<<----- XXX THIS IS NOT RIGHT! CHANGE IT!
|
2002-11-09 00:56:41 +03:00
|
|
|
$exe = "epimetheus";
|
2001-08-08 04:12:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-11-09 00:56:41 +03:00
|
|
|
if ($opt_engine_type eq "epdebug") {
|
2002-10-28 06:31:03 +03:00
|
|
|
$retval = $dir . $os . $debug . $exe;
|
2001-08-08 04:12:50 +04:00
|
|
|
} else {
|
2002-10-28 06:31:03 +03:00
|
|
|
$retval = $dir . $os . $opt . $exe;
|
2001-08-08 04:12:50 +04:00
|
|
|
}
|
|
|
|
|
2002-10-28 06:31:03 +03:00
|
|
|
$retval = &xp_path($retval);
|
2001-08-08 04:12:50 +04:00
|
|
|
|
2002-10-28 06:31:03 +03:00
|
|
|
}# (user provided a path)
|
|
|
|
|
|
|
|
|
|
|
|
if (($os_type ne "MAC") && !(-x $retval)) {
|
|
|
|
# mac doesn't seem to deal with -x correctly
|
|
|
|
die ($retval . " is not a valid executable on this system.\n");
|
2001-08-08 04:12:50 +04:00
|
|
|
}
|
|
|
|
|
2002-10-28 06:31:03 +03:00
|
|
|
return $retval;
|
2001-08-08 04:12:50 +04:00
|
|
|
}
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
#
|
|
|
|
# get the shell command used to run the liveconnect shell
|
|
|
|
#
|
|
|
|
sub get_lc_engine_command {
|
2001-10-27 01:37:51 +04:00
|
|
|
my $retval;
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($opt_shell_path) {
|
|
|
|
$retval = $opt_shell_path;
|
|
|
|
} else {
|
2000-01-13 01:02:23 +03:00
|
|
|
if ($os_type eq "MAC") {
|
|
|
|
die "Don't know how to run the lc shell on the mac yet.\n";
|
|
|
|
} else {
|
|
|
|
$retval = $opt_suite_path . "../src/liveconnect/";
|
|
|
|
opendir (SRC_DIR_FILES, $retval);
|
|
|
|
my @src_dir_files = readdir(SRC_DIR_FILES);
|
|
|
|
closedir (SRC_DIR_FILES);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
my ($dir, $object_dir);
|
|
|
|
my $pattern = ($opt_engine_type eq "lcdebug") ?
|
|
|
|
'DBG.OBJ' : 'OPT.OBJ';
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
foreach $dir (@src_dir_files) {
|
|
|
|
if ($dir =~ $pattern) {
|
|
|
|
$object_dir = $dir;
|
|
|
|
last;
|
|
|
|
}
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
if (!$object_dir) {
|
|
|
|
die ("Could not locate an object directory in $retval " .
|
|
|
|
"matching the pattern *$pattern. Have you built the " .
|
|
|
|
"engine?\n");
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
$retval .= $object_dir . "/";
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
if ($os_type eq "WIN") {
|
|
|
|
$retval .= "lcshell.exe";
|
|
|
|
} else {
|
|
|
|
$retval .= "lcshell";
|
|
|
|
}
|
|
|
|
} # mac/ not mac
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2002-10-28 06:31:03 +03:00
|
|
|
$retval = &xp_path($retval);
|
|
|
|
|
|
|
|
} # (user provided a path)
|
|
|
|
|
|
|
|
|
|
|
|
if (($os_type ne "MAC") && !(-x $retval)) {
|
|
|
|
# mac doesn't seem to deal with -x correctly
|
1999-12-05 05:15:22 +03:00
|
|
|
die ("$retval is not a valid executable on this system.\n");
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2002-10-28 06:31:03 +03:00
|
|
|
return $retval;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
sub get_os_type {
|
|
|
|
|
|
|
|
if ("\n" eq "\015") {
|
|
|
|
return "MAC";
|
|
|
|
}
|
|
|
|
|
2000-01-08 00:39:36 +03:00
|
|
|
my $uname = `uname -a`;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($uname =~ /WIN/) {
|
|
|
|
$uname = "WIN";
|
|
|
|
} else {
|
|
|
|
chop $uname;
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
&dd ("get_os_type returning '$uname'.");
|
|
|
|
return $uname;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
sub get_test_list {
|
2000-01-08 00:39:36 +03:00
|
|
|
my @test_list;
|
|
|
|
my @neg_list;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
if ($#opt_test_list_files > -1) {
|
2000-01-08 00:39:36 +03:00
|
|
|
my $list_file;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
&dd ("getting test list from user specified source.");
|
|
|
|
|
|
|
|
foreach $list_file (@opt_test_list_files) {
|
|
|
|
push (@test_list, &expand_user_test_list($list_file));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
&dd ("no list file, groveling in '$opt_suite_path'.");
|
2000-01-08 00:39:36 +03:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
@test_list = &get_default_test_list($opt_suite_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($#opt_neg_list_files > -1) {
|
2000-01-08 00:39:36 +03:00
|
|
|
my $list_file;
|
|
|
|
my $orig_size = $#test_list + 1;
|
|
|
|
my $actually_skipped;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
&dd ("getting negative list from user specified source.");
|
|
|
|
|
|
|
|
foreach $list_file (@opt_neg_list_files) {
|
|
|
|
push (@neg_list, &expand_user_test_list($list_file));
|
|
|
|
}
|
|
|
|
|
|
|
|
@test_list = &subtract_arrays (\@test_list, \@neg_list);
|
|
|
|
|
|
|
|
$actually_skipped = $orig_size - ($#test_list + 1);
|
|
|
|
|
2002-10-28 06:44:09 +03:00
|
|
|
&dd ($actually_skipped . " of " . $orig_size .
|
1999-12-05 05:15:22 +03:00
|
|
|
" tests will be skipped.");
|
|
|
|
&dd ((($#neg_list + 1) - $actually_skipped) . " skip tests were " .
|
|
|
|
"not actually part of the test list.");
|
|
|
|
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2003-03-27 00:28:19 +03:00
|
|
|
|
|
|
|
# Don't run any shell.js files as tests; they are only utility files
|
|
|
|
@test_list = grep (!/shell\.js$/, @test_list);
|
|
|
|
|
2005-03-18 22:09:59 +03:00
|
|
|
# Don't run any browser.js files as tests; they are only utility files
|
|
|
|
@test_list = grep (!/browser\.js$/, @test_list);
|
|
|
|
|
|
|
|
# Don't run any jsref.js files as tests; they are only utility files
|
|
|
|
@test_list = grep (!/jsref\.js$/, @test_list);
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
return @test_list;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# reads $list_file, storing non-comment lines into an array.
|
|
|
|
# lines in the form suite_dir/[*] or suite_dir/test_dir/[*] are expanded
|
|
|
|
# to include all test files under the specified directory
|
|
|
|
#
|
|
|
|
sub expand_user_test_list {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($list_file) = @_;
|
|
|
|
my @retval = ();
|
1999-12-05 05:15:22 +03:00
|
|
|
|
2001-07-03 04:40:46 +04:00
|
|
|
#
|
|
|
|
# Trim off the leading path separator that begins relative paths on the Mac.
|
|
|
|
# Each path will get concatenated with $opt_suite_path, which ends in one.
|
|
|
|
#
|
|
|
|
# Also note:
|
|
|
|
#
|
|
|
|
# We will call expand_test_list_entry(), which does pattern-matching on $list_file.
|
|
|
|
# This will make the pattern-matching the same as it would be on Linux/Windows -
|
|
|
|
#
|
|
|
|
if ($os_type eq "MAC") {
|
|
|
|
$list_file =~ s/^$path_sep//;
|
|
|
|
}
|
|
|
|
|
2001-06-26 01:04:02 +04:00
|
|
|
if ($list_file =~ /\.js$/ || -d $opt_suite_path . $list_file) {
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
push (@retval, &expand_test_list_entry($list_file));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2001-10-27 01:37:51 +04:00
|
|
|
open (TESTLIST, $list_file) ||
|
1999-12-05 05:15:22 +03:00
|
|
|
die("Error opening test list file '$list_file': $!\n");
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
while (<TESTLIST>) {
|
2001-03-27 02:00:53 +04:00
|
|
|
s/\r*\n*$//;
|
1999-12-05 05:15:22 +03:00
|
|
|
if (!(/\s*\#/)) {
|
|
|
|
# It's not a comment, so process it
|
2002-10-26 04:11:50 +04:00
|
|
|
push (@retval, &expand_test_list_entry($_));
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
close (TESTLIST);
|
|
|
|
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
return @retval;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
2001-05-12 07:52:20 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# Currently expect all paths to be RELATIVE to the top-level tests directory.
|
|
|
|
# One day, this should be improved to allow absolute paths as well -
|
|
|
|
#
|
1999-12-05 05:15:22 +03:00
|
|
|
sub expand_test_list_entry {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($entry) = @_;
|
|
|
|
my @retval;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
if ($entry =~ /\.js$/) {
|
|
|
|
# it's a regular entry, add it to the list
|
2001-07-03 04:40:46 +04:00
|
|
|
if (-f $opt_suite_path . $entry) {
|
1999-12-05 05:15:22 +03:00
|
|
|
push (@retval, $entry);
|
|
|
|
} else {
|
|
|
|
status ("testcase '$entry' not found.");
|
|
|
|
}
|
2001-05-12 07:52:20 +04:00
|
|
|
} elsif ($entry =~ /(.*$path_sep[^\*][^$path_sep]*)$path_sep?\*?$/) {
|
1999-12-05 05:15:22 +03:00
|
|
|
# Entry is in the form suite_dir/test_dir[/*]
|
|
|
|
# so iterate all tests under it
|
2000-01-08 00:39:36 +03:00
|
|
|
my $suite_and_test_dir = $1;
|
|
|
|
my @test_files = &get_js_files ($opt_suite_path .
|
2000-01-13 01:02:23 +03:00
|
|
|
$suite_and_test_dir);
|
2000-01-08 00:39:36 +03:00
|
|
|
my $i;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
foreach $i (0 .. $#test_files) {
|
2002-10-26 04:11:50 +04:00
|
|
|
$test_files[$i] = $suite_and_test_dir . $path_sep .
|
|
|
|
$test_files[$i];
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
splice (@retval, $#retval + 1, 0, @test_files);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2001-05-12 07:52:20 +04:00
|
|
|
} elsif ($entry =~ /([^\*][^$path_sep]*)$path_sep?\*?$/) {
|
1999-12-05 05:15:22 +03:00
|
|
|
# Entry is in the form suite_dir[/*]
|
|
|
|
# so iterate all test dirs and tests under it
|
2000-01-08 00:39:36 +03:00
|
|
|
my $suite = $1;
|
|
|
|
my @test_dirs = &get_subdirs ($opt_suite_path . $suite);
|
|
|
|
my $test_dir;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
foreach $test_dir (@test_dirs) {
|
2001-10-27 01:37:51 +04:00
|
|
|
my @test_files = &get_js_files ($opt_suite_path . $suite .
|
|
|
|
$path_sep . $test_dir);
|
2000-01-08 00:39:36 +03:00
|
|
|
my $i;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
foreach $i (0 .. $#test_files) {
|
2001-10-27 01:37:51 +04:00
|
|
|
$test_files[$i] = $suite . $path_sep . $test_dir . $path_sep .
|
1999-12-05 05:15:22 +03:00
|
|
|
$test_files[$i];
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
splice (@retval, $#retval + 1, 0, @test_files);
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
} else {
|
2005-11-25 11:16:51 +03:00
|
|
|
die ("Don't know what to do with list entry '$entry'.\n");
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return @retval;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Grovels through $suite_path, searching for *all* test files. Used when the
|
|
|
|
# user doesn't supply a test list.
|
|
|
|
#
|
|
|
|
sub get_default_test_list {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($suite_path) = @_;
|
|
|
|
my @suite_list = &get_subdirs($suite_path);
|
|
|
|
my $suite;
|
|
|
|
my @retval;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
foreach $suite (@suite_list) {
|
2000-01-08 00:39:36 +03:00
|
|
|
my @test_dir_list = get_subdirs ($suite_path . $suite);
|
|
|
|
my $test_dir;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
foreach $test_dir (@test_dir_list) {
|
2000-01-13 01:02:23 +03:00
|
|
|
my @test_list = get_js_files ($suite_path . $suite . $path_sep .
|
|
|
|
$test_dir);
|
2000-01-08 00:39:36 +03:00
|
|
|
my $test;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
foreach $test (@test_list) {
|
2001-10-27 01:37:51 +04:00
|
|
|
$retval[$#retval + 1] = $suite . $path_sep . $test_dir .
|
|
|
|
$path_sep . $test;
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
return @retval;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# generate an output file name based on the date
|
|
|
|
#
|
2000-01-13 01:02:23 +03:00
|
|
|
sub get_tempfile_name {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
|
1999-12-05 05:15:22 +03:00
|
|
|
&get_padded_time (localtime);
|
2000-01-13 01:02:23 +03:00
|
|
|
my $rv;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
if ($os_type ne "MAC") {
|
2001-10-27 01:37:51 +04:00
|
|
|
$rv = "results-" . $year . "-" . $mon . "-" . $mday . "-" . $hour .
|
2000-03-16 00:49:13 +03:00
|
|
|
$min . $sec . "-" . $opt_engine_type;
|
2000-01-13 01:02:23 +03:00
|
|
|
} else {
|
2000-03-16 00:49:13 +03:00
|
|
|
$rv = "res-" . $year . $mon . $mday . $hour . $min . $sec . "-" .
|
|
|
|
$opt_engine_type
|
2000-01-13 01:02:23 +03:00
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
return $rv . ".html";
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
sub get_padded_time {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = @_;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
$mon++;
|
|
|
|
$mon = &zero_pad($mon);
|
2000-01-08 00:39:36 +03:00
|
|
|
$year += 1900;
|
1999-12-05 05:15:22 +03:00
|
|
|
$mday= &zero_pad($mday);
|
|
|
|
$sec = &zero_pad($sec);
|
|
|
|
$min = &zero_pad($min);
|
|
|
|
$hour = &zero_pad($hour);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
return ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
sub zero_pad {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($string) = @_;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
$string = ($string < 10) ? "0" . $string : $string;
|
|
|
|
return $string;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub subtract_arrays {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($whole_ref, $part_ref) = @_;
|
|
|
|
my @whole = @$whole_ref;
|
|
|
|
my @part = @$part_ref;
|
|
|
|
my $line;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
foreach $line (@part) {
|
2001-10-27 01:37:51 +04:00
|
|
|
@whole = grep (!/$line/, @whole);
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return @whole;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
#
|
|
|
|
# Convert unix path to mac style.
|
|
|
|
#
|
|
|
|
sub unix_to_mac {
|
|
|
|
my ($path) = @_;
|
|
|
|
my @path_elements = split ("/", $path);
|
|
|
|
my $rv = "";
|
|
|
|
my $i;
|
|
|
|
|
|
|
|
foreach $i (0 .. $#path_elements) {
|
|
|
|
if ($path_elements[$i] eq ".") {
|
|
|
|
if (!($rv =~ /\:$/)) {
|
|
|
|
$rv .= ":";
|
|
|
|
}
|
|
|
|
} elsif ($path_elements[$i] eq "..") {
|
|
|
|
if (!($rv =~ /\:$/)) {
|
|
|
|
$rv .= "::";
|
|
|
|
} else {
|
|
|
|
$rv .= ":";
|
|
|
|
}
|
|
|
|
} elsif ($path_elements[$i] ne "") {
|
|
|
|
$rv .= $path_elements[$i] . ":";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$rv =~ s/\:$//;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
return $rv;
|
|
|
|
}
|
|
|
|
|
2002-10-12 05:57:16 +04:00
|
|
|
#
|
|
|
|
# Convert unix path to win style.
|
|
|
|
#
|
|
|
|
sub unix_to_win {
|
|
|
|
my ($path) = @_;
|
2002-10-26 05:24:21 +04:00
|
|
|
|
|
|
|
if ($path_sep ne $win_sep) {
|
|
|
|
$path =~ s/$path_sep/$win_sep/g;
|
|
|
|
}
|
|
|
|
|
2002-10-12 05:57:16 +04:00
|
|
|
return $path;
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Windows shells require "/" or "\" as path separator.
|
|
|
|
# Find out the one used in the current Windows shell.
|
|
|
|
#
|
|
|
|
sub get_win_sep {
|
|
|
|
my $path = $ENV{"PATH"} || $ENV{"Path"} || $ENV{"path"};
|
|
|
|
$path =~ /\\|\//;
|
|
|
|
return $&;
|
|
|
|
}
|
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
#
|
|
|
|
# Convert unix path to correct style based on platform.
|
|
|
|
#
|
|
|
|
sub xp_path {
|
|
|
|
my ($path) = @_;
|
|
|
|
|
|
|
|
if ($os_type eq "MAC") {
|
|
|
|
return &unix_to_mac($path);
|
2002-10-12 05:57:16 +04:00
|
|
|
} elsif($os_type eq "WIN") {
|
|
|
|
return &unix_to_win($path);
|
2000-01-13 01:02:23 +03:00
|
|
|
} else {
|
|
|
|
return $path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
#
|
|
|
|
# given a directory, return an array of all subdirectories
|
|
|
|
#
|
|
|
|
sub get_subdirs {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($dir) = @_;
|
|
|
|
my @subdirs;
|
2001-10-27 01:37:51 +04:00
|
|
|
|
2000-01-13 01:02:23 +03:00
|
|
|
if ($os_type ne "MAC") {
|
|
|
|
if (!($dir =~ /\/$/)) {
|
|
|
|
$dir = $dir . "/";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!($dir =~ /\:$/)) {
|
|
|
|
$dir = $dir . ":";
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
}
|
1999-12-05 05:15:22 +03:00
|
|
|
opendir (DIR, $dir) || die ("couldn't open directory $dir: $!");
|
2000-01-08 00:39:36 +03:00
|
|
|
my @testdir_contents = readdir(DIR);
|
1999-12-05 05:15:22 +03:00
|
|
|
closedir(DIR);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
foreach (@testdir_contents) {
|
|
|
|
if ((-d ($dir . $_)) && ($_ ne 'CVS') && ($_ ne '.') && ($_ ne '..')) {
|
|
|
|
@subdirs[$#subdirs + 1] = $_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return @subdirs;
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# given a directory, return an array of all the js files that are in it.
|
|
|
|
#
|
|
|
|
sub get_js_files {
|
2000-01-08 00:39:36 +03:00
|
|
|
my ($test_subdir) = @_;
|
|
|
|
my (@js_file_array, @subdir_files);
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
opendir (TEST_SUBDIR, $test_subdir) || die ("couldn't open directory " .
|
|
|
|
"$test_subdir: $!");
|
|
|
|
@subdir_files = readdir(TEST_SUBDIR);
|
|
|
|
closedir( TEST_SUBDIR );
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
foreach (@subdir_files) {
|
|
|
|
if ($_ =~ /\.js$/) {
|
|
|
|
$js_file_array[$#js_file_array+1] = $_;
|
|
|
|
}
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
return @js_file_array;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub report_failure {
|
2001-06-07 02:15:13 +04:00
|
|
|
my ($test, $message, $bug_number) = @_;
|
|
|
|
my $bug_line = "";
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
$failures_reported++;
|
|
|
|
|
1999-12-17 01:38:49 +03:00
|
|
|
$message =~ s/\n+/\n/g;
|
2005-03-18 22:09:59 +03:00
|
|
|
$message =~ s/&/&/g;
|
|
|
|
$message =~ s/</</g;
|
|
|
|
$message =~ s/>/>/g;
|
2000-01-13 01:02:23 +03:00
|
|
|
$test =~ s/\:/\//g;
|
2001-06-07 02:15:13 +04:00
|
|
|
|
|
|
|
if ($opt_console_failures) {
|
2001-06-06 20:52:20 +04:00
|
|
|
if($bug_number) {
|
2001-06-07 02:15:13 +04:00
|
|
|
print STDERR ("*-* Testcase $test failed:\nBug Number $bug_number".
|
|
|
|
"\n$message\n");
|
2001-06-06 20:52:20 +04:00
|
|
|
} else {
|
|
|
|
print STDERR ("*-* Testcase $test failed:\n$message\n");
|
|
|
|
}
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
$message =~ s/\n/<br>\n/g;
|
2001-06-07 02:15:13 +04:00
|
|
|
|
|
|
|
if ($bug_number) {
|
2004-02-25 16:01:29 +03:00
|
|
|
my $bug_url = ($bug_number =~ /^\d+$/) ? "$opt_bug_url$bug_number" : $bug_number;
|
|
|
|
$bug_line = "<a href='$bug_url' target='other_window'>".
|
2001-06-07 02:15:13 +04:00
|
|
|
"Bug Number $bug_number</a>";
|
|
|
|
}
|
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($opt_lxr_url) {
|
|
|
|
$test =~ /\/?([^\/]+\/[^\/]+\/[^\/]+)$/;
|
|
|
|
$test = $1;
|
|
|
|
$html .= "<dd><b>".
|
|
|
|
"Testcase <a target='other_window' href='$opt_lxr_url$test'>$1</a> " .
|
|
|
|
"failed</b> $bug_line<br>\n";
|
|
|
|
} else {
|
|
|
|
$html .= "<dd><b>".
|
|
|
|
"Testcase $test failed</b> $bug_line<br>\n";
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
$html .= " [ ";
|
|
|
|
|
2005-04-09 00:02:47 +04:00
|
|
|
$html .= "<a href='#tippy_top'>Top of Page</a> ]<br>\n" .
|
1999-12-05 05:15:22 +03:00
|
|
|
"<tt>$message</tt><br>\n";
|
|
|
|
|
|
|
|
@failed_tests[$#failed_tests + 1] = $test;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sub dd {
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
if ($opt_trace) {
|
|
|
|
print ("-*- ", @_ , "\n");
|
|
|
|
}
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
sub status {
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
print ("-#- ", @_ , "\n");
|
2001-10-27 01:37:51 +04:00
|
|
|
|
1999-12-05 05:15:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
sub int_handler {
|
2000-01-08 00:39:36 +03:00
|
|
|
my $resp;
|
1999-12-05 05:15:22 +03:00
|
|
|
|
|
|
|
do {
|
1999-12-17 01:38:49 +03:00
|
|
|
print ("\n*** User Break: Just [Q]uit, Quit and [R]eport, [C]ontinue ?");
|
1999-12-05 05:15:22 +03:00
|
|
|
$resp = <STDIN>;
|
|
|
|
} until ($resp =~ /[QqRrCc]/);
|
|
|
|
|
|
|
|
if ($resp =~ /[Qq]/) {
|
|
|
|
print ("User Exit. No results were generated.\n");
|
|
|
|
exit;
|
|
|
|
} elsif ($resp =~ /[Rr]/) {
|
|
|
|
$user_exit = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|