зеркало из https://github.com/mozilla/pjs.git
* menuhead.html
make all targets "other_window" to reduce number of open windows. * mklistpage.pl make all targets "other_window" to reduce number of open windows. * runtests2.pl more hacking, still not done.
This commit is contained in:
Родитель
66eace8ec4
Коммит
6130ec762c
|
@ -54,7 +54,7 @@
|
|||
var suite, testDir, test, radioName;
|
||||
var elements = document.forms["testCases"].elements;
|
||||
|
||||
var win = window.open ("about:blank", "output");
|
||||
var win = window.open ("about:blank", "other_window");
|
||||
win.document.open();
|
||||
win.document.write ("<pre>\n");
|
||||
|
||||
|
@ -111,8 +111,8 @@
|
|||
if (isNaN(pct))
|
||||
pct = 0;
|
||||
|
||||
elements["SUMMARY_" + suite].value = selected + "/" + available + " (" +
|
||||
pct + "%) selected";
|
||||
elements["SUMMARY_" + suite].value = selected + "/" + available +
|
||||
" (" + pct + "%) selected";
|
||||
}
|
||||
|
||||
pct = parseInt((totalSelected / totalAvailable) * 100);
|
||||
|
@ -135,4 +135,4 @@
|
|||
<form name="testCases">
|
||||
<input type='button' value='Export Test List' onClick='createList();'>
|
||||
<input type='button' value='Import Test List'
|
||||
onClick='window.open("importList.html", "import");'>
|
||||
onClick='window.open("importList.html", "other_window");'>
|
||||
|
|
|
@ -202,7 +202,7 @@ sub process_test {
|
|||
"[\"$test\"] = \"radio$uid\"\n";
|
||||
$html .= " <input type='radio' value='$test' name='radio$uid' ".
|
||||
"onclick='onRadioClick(\"radio$uid\")'>" .
|
||||
"<a href='$lxr_url$suite/$test_dir/$test' target='lxr_window'>" .
|
||||
"<a href='$lxr_url$suite/$test_dir/$test' target='other_window'>" .
|
||||
"$test</a> $title<br>\n";
|
||||
|
||||
}
|
||||
|
|
|
@ -56,138 +56,174 @@ local $options = "c=s classpath>c d smdebug>d f=s file>f h help>h l=s list>l " .
|
|||
|
||||
&parse_args;
|
||||
|
||||
local $user_exit = 0;
|
||||
local $html = "";
|
||||
local @failed_tests;
|
||||
local $os_type = &get_os_type;
|
||||
local @test_list = &get_test_list;
|
||||
|
||||
&dd ("output file is '$opt_output_file'");
|
||||
|
||||
$SIG{INT} = 'int_handler';
|
||||
|
||||
&execute_tests (@test_list);
|
||||
|
||||
&dd ("=============================================================");
|
||||
&dd ($html);
|
||||
&dd ("=============================================================");
|
||||
&dd (join ("\n", @failed_tests));
|
||||
|
||||
sub execute_tests {
|
||||
local (@test_list) = @_;
|
||||
local $engine_command = &get_engine_command . " -f";
|
||||
local $engine_command = &get_engine_command . " ";
|
||||
local $test, $shell_command, $line, @output;
|
||||
local $file_param = ($opt_engine_type eq "rhino") ? " " : " -f ";
|
||||
local $last_suite, $last_test_dir;
|
||||
local $failure_lines;
|
||||
|
||||
foreach $test (@test_list) {
|
||||
local ($suite, $test_dir) = split("/", $test);
|
||||
local ($suite, $test_dir, $test_file) = split("/", $test);
|
||||
local $expected_exit = 0;
|
||||
local $got_exit, $exit_signal;
|
||||
|
||||
if ($last_suite ne $suite || $last_test_dir ne $test_dir) {
|
||||
$shell_command = $engine_command;
|
||||
if ($user_exit) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($last_suite ne $suite || $last_test_dir ne $test_dir) {
|
||||
$shell_command = $engine_command;
|
||||
|
||||
if (-f $opt_suite_path . $suite . "/shell.js") {
|
||||
$shell_command .= $file_param . $opt_suite_path . $suite .
|
||||
"/shell.js";
|
||||
}
|
||||
if (-f $opt_suite_path . $suite . "/" . $test_dir . "/shell.js") {
|
||||
$shell_command .= $file_param . $opt_suite_path . $suite .
|
||||
"/" . $test_dir . "/shell.js";
|
||||
}
|
||||
|
||||
$last_suite = $suite;
|
||||
$last_test_dir = $test_dir;
|
||||
}
|
||||
|
||||
&dd ("executing: " . $shell_command . $file_param . $opt_suite_path .
|
||||
$test);
|
||||
|
||||
open (OUTPUT, $shell_command . $file_param . $opt_suite_path . $test .
|
||||
" 2>&1 |");
|
||||
@output = <OUTPUT>;
|
||||
close (OUTPUT);
|
||||
|
||||
$got_exit = ($? >> 8);
|
||||
$exit_signal = ($? & 255);
|
||||
$failure_lines = "";
|
||||
|
||||
if (-f $opt_suite_path . $suite . "/shell.js") {
|
||||
$shell_command .= $file_param . $opt_suite_path . $suite .
|
||||
"/shell.js";
|
||||
}
|
||||
if (-f $opt_suite_path . $suite . "/" . $test_dir . "/shell.js") {
|
||||
$shell_command .= $file_param . $opt_suite_path . $suite .
|
||||
"/" . $test_dir . "/shell.js";
|
||||
}
|
||||
foreach $line (@output) {
|
||||
|
||||
$last_suite = $suite;
|
||||
$last_test_dir = $test_dir;
|
||||
}
|
||||
|
||||
&dd ("executing: " . $shell_command . $file_param . $opt_suite_path .
|
||||
$test);
|
||||
if ($line =~ /expected\s*exit\s*code\s*\:?\s*(\n+)/i) {
|
||||
$expected_exit = $1;
|
||||
}
|
||||
|
||||
open (OUTPUT, $shell_command . $file_param . $opt_suite_path . $test .
|
||||
" 2>&1 |");
|
||||
@output = <OUTPUT>;
|
||||
close (OUTPUT);
|
||||
if ($line =~ /failed!/i) {
|
||||
$failure_lines .= $line;
|
||||
}
|
||||
|
||||
foreach $line (@output) {
|
||||
local
|
||||
|
||||
if (!@output) {
|
||||
&dd ("Test case produced no output!!");
|
||||
}
|
||||
|
||||
&dd (@output);
|
||||
|
||||
&dd ("exit code $?");
|
||||
}
|
||||
|
||||
if (!@output) {
|
||||
&report_failure ($test, "Test case produced no output!");
|
||||
} elsif ($got_exit != $expected_exit) {
|
||||
&report_failure ($test, "Expected exit code " .
|
||||
"$expected_exit, got $got_exit\n" .
|
||||
"Testcase terminated with signal $exit_signal\n" .
|
||||
"Complete testcase output was:\n" .
|
||||
join ("\n",@output));
|
||||
} elsif ($failure_lines) {
|
||||
&report_failure ($test, $failure_lines);
|
||||
}
|
||||
|
||||
&dd ("exit code $got_exit, exit signal $exit_signal.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub parse_args {
|
||||
local $option, $value;
|
||||
|
||||
|
||||
&dd ("checking command line options.");
|
||||
|
||||
|
||||
Getopt::Mixed::init ($options);
|
||||
|
||||
while (($option, $value) = nextOption()) {
|
||||
if ($option eq "c") {
|
||||
&dd ("opt: setting classpath to '$value'.");
|
||||
$opt_classpath = $value;
|
||||
|
||||
} elsif ($option eq "d") {
|
||||
|
||||
&dd ("opt: using smdebug engine");
|
||||
$opt_engine_type = "smdebug";
|
||||
|
||||
} elsif ($option eq "f") {
|
||||
if (!$value) {
|
||||
die ("Output file cannot be null.\n");
|
||||
}
|
||||
&dd ("opt: setting output file to '$value'.");
|
||||
$opt_output_file = $value;
|
||||
|
||||
} elsif ($option eq "h") {
|
||||
&usage;
|
||||
|
||||
} elsif ($option eq "l") {
|
||||
&dd ("opt: setting test list to '$value'.");
|
||||
$opt_test_list_file = $value;
|
||||
|
||||
} elsif ($option eq "o") {
|
||||
&dd ("opt: using smopt engine");
|
||||
$opt_engine_type = "smopt";
|
||||
|
||||
} elsif ($option eq "p") {
|
||||
$opt_suite_path = $value;
|
||||
if (!($opt_suite_path =~ /[\/\\]$/)) {
|
||||
$opt_suite_path .= "/";
|
||||
}
|
||||
&dd ("opt: setting suite path to '$opt_suite_path'.");
|
||||
|
||||
} elsif ($option eq "r") {
|
||||
&dd ("opt: using rhino engine");
|
||||
$opt_engine_type = "rhino";
|
||||
|
||||
} elsif ($option eq "s") {
|
||||
$opt_shell_path = $value;
|
||||
if (!($opt_shell_path =~ /[\/\\]$/)) {
|
||||
$opt_shell_path .= "/";
|
||||
}
|
||||
&dd ("opt: setting shell path to '$opt_shell_path'.");
|
||||
|
||||
} elsif ($option eq "t") {
|
||||
&dd ("opt: tracing output.");
|
||||
$opt_trace = 1;
|
||||
|
||||
} elsif ($option eq "v") {
|
||||
&dd ("opt: setting verbose mode.");
|
||||
$opt_verbose = 1;
|
||||
|
||||
} elsif ($option eq "x") {
|
||||
&dd ("opt: setting lxr url to '$value'.");
|
||||
$opt_lxr_url = $value;
|
||||
|
||||
} else {
|
||||
&usage;
|
||||
}
|
||||
if ($option eq "c") {
|
||||
&dd ("opt: setting classpath to '$value'.");
|
||||
$opt_classpath = $value;
|
||||
|
||||
} elsif ($option eq "d") {
|
||||
|
||||
&dd ("opt: using smdebug engine");
|
||||
$opt_engine_type = "smdebug";
|
||||
|
||||
} elsif ($option eq "f") {
|
||||
if (!$value) {
|
||||
die ("Output file cannot be null.\n");
|
||||
}
|
||||
&dd ("opt: setting output file to '$value'.");
|
||||
$opt_output_file = $value;
|
||||
|
||||
} elsif ($option eq "h") {
|
||||
&usage;
|
||||
|
||||
} elsif ($option eq "l") {
|
||||
&dd ("opt: setting test list to '$value'.");
|
||||
$opt_test_list_file = $value;
|
||||
|
||||
} elsif ($option eq "o") {
|
||||
&dd ("opt: using smopt engine");
|
||||
$opt_engine_type = "smopt";
|
||||
|
||||
} elsif ($option eq "p") {
|
||||
$opt_suite_path = $value;
|
||||
if (!($opt_suite_path =~ /[\/\\]$/)) {
|
||||
$opt_suite_path .= "/";
|
||||
}
|
||||
&dd ("opt: setting suite path to '$opt_suite_path'.");
|
||||
|
||||
} elsif ($option eq "r") {
|
||||
&dd ("opt: using rhino engine");
|
||||
$opt_engine_type = "rhino";
|
||||
|
||||
} elsif ($option eq "s") {
|
||||
$opt_shell_path = $value;
|
||||
if (!($opt_shell_path =~ /[\/\\]$/)) {
|
||||
$opt_shell_path .= "/";
|
||||
}
|
||||
&dd ("opt: setting shell path to '$opt_shell_path'.");
|
||||
|
||||
} elsif ($option eq "t") {
|
||||
&dd ("opt: tracing output.");
|
||||
$opt_trace = 1;
|
||||
|
||||
} elsif ($option eq "v") {
|
||||
&dd ("opt: setting verbose mode.");
|
||||
$opt_verbose = 1;
|
||||
|
||||
} elsif ($option eq "x") {
|
||||
&dd ("opt: setting lxr url to '$value'.");
|
||||
$opt_lxr_url = $value;
|
||||
|
||||
} else {
|
||||
&usage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Getopt::Mixed::cleanup();
|
||||
|
||||
|
||||
if (!$opt_output_file) {
|
||||
$opt_output_file = "results-" . $opt_engine_type . "-" .
|
||||
&get_tempfile_id . ".html";
|
||||
$opt_output_file = "results-" . $opt_engine_type . "-" .
|
||||
&get_tempfile_id . ".html";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -213,30 +249,30 @@ sub usage {
|
|||
" (default is\n" .
|
||||
" http://lxr.mozilla.org/mozilla/source/js/" .
|
||||
"tests/)\n\n");
|
||||
|
||||
|
||||
exit (1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# get the shell command used to start the (either) engine
|
||||
#
|
||||
sub get_engine_command {
|
||||
|
||||
|
||||
local $retval;
|
||||
|
||||
|
||||
if ($opt_engine_type eq "rhino") {
|
||||
&dd ("getting rhino engine command.");
|
||||
$retval = &get_rhino_engine_command;
|
||||
&dd ("getting rhino engine command.");
|
||||
$retval = &get_rhino_engine_command;
|
||||
} else {
|
||||
&dd ("getting spidermonkey engine command.");
|
||||
$retval = &get_sm_engine_command;
|
||||
&dd ("getting spidermonkey engine command.");
|
||||
$retval = &get_sm_engine_command;
|
||||
}
|
||||
|
||||
|
||||
&dd ("got '$retval'");
|
||||
|
||||
|
||||
return $retval;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -244,21 +280,21 @@ sub get_engine_command {
|
|||
#
|
||||
sub get_rhino_engine_command {
|
||||
local $retval = "java ";
|
||||
|
||||
|
||||
if ($opt_shell_path) {
|
||||
$opt_classpath = ($opt_classpath) ?
|
||||
$opt_classpath . ":" . $opt_shell_path :
|
||||
$opt_shell_path;
|
||||
$opt_classpath = ($opt_classpath) ?
|
||||
$opt_classpath . ":" . $opt_shell_path :
|
||||
$opt_shell_path;
|
||||
}
|
||||
|
||||
if ($opt_classpath) {
|
||||
$retval .= "-classpath $opt_classpath ";
|
||||
$retval .= "-classpath $opt_classpath ";
|
||||
}
|
||||
|
||||
$retval .= "org.mozilla.javascript.tools.shell.Main";
|
||||
|
||||
|
||||
return $retval;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -268,98 +304,98 @@ sub get_sm_engine_command {
|
|||
local $retval;
|
||||
|
||||
if ($os_type eq "WIN") {
|
||||
# spidermonkey on windows
|
||||
|
||||
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/";
|
||||
}
|
||||
}
|
||||
$retval .= "jsshell.exe";
|
||||
|
||||
# spidermonkey on windows
|
||||
|
||||
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/";
|
||||
}
|
||||
}
|
||||
$retval .= "jsshell.exe";
|
||||
|
||||
} else {
|
||||
# spidermonkey on un*x
|
||||
|
||||
if ($opt_shell_path) {
|
||||
$retval = $opt_shell_path;
|
||||
if (!($retval =~ /[\/\\]$/)) {
|
||||
$retval .= "/";
|
||||
}
|
||||
} else {
|
||||
$retval = $opt_suite_path . "../src/";
|
||||
opendir (SRC_DIR_FILES, $retval);
|
||||
local @src_dir_files = readdir(SRC_DIR_FILES);
|
||||
closedir (SRC_DIR_FILES);
|
||||
|
||||
local $dir, $object_dir;
|
||||
local $pattern = ($opt_engine_type eq "smdebug") ?
|
||||
'DBG.OBJ' : 'OPT.OBJ';
|
||||
|
||||
foreach $dir (@src_dir_files) {
|
||||
if ($dir =~ $pattern) {
|
||||
$object_dir = $dir;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$object_dir) {
|
||||
die ("Could not locate an object directory in $retval " .
|
||||
"matching the pattern *$pattern. Have you built the " .
|
||||
"engine?\n");
|
||||
}
|
||||
|
||||
$retval .= $object_dir . "/";
|
||||
}
|
||||
|
||||
$retval .= "js";
|
||||
|
||||
# spidermonkey on un*x
|
||||
|
||||
if ($opt_shell_path) {
|
||||
$retval = $opt_shell_path;
|
||||
if (!($retval =~ /[\/\\]$/)) {
|
||||
$retval .= "/";
|
||||
}
|
||||
} else {
|
||||
$retval = $opt_suite_path . "../src/";
|
||||
opendir (SRC_DIR_FILES, $retval);
|
||||
local @src_dir_files = readdir(SRC_DIR_FILES);
|
||||
closedir (SRC_DIR_FILES);
|
||||
|
||||
local $dir, $object_dir;
|
||||
local $pattern = ($opt_engine_type eq "smdebug") ?
|
||||
'DBG.OBJ' : 'OPT.OBJ';
|
||||
|
||||
foreach $dir (@src_dir_files) {
|
||||
if ($dir =~ $pattern) {
|
||||
$object_dir = $dir;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$object_dir) {
|
||||
die ("Could not locate an object directory in $retval " .
|
||||
"matching the pattern *$pattern. Have you built the " .
|
||||
"engine?\n");
|
||||
}
|
||||
|
||||
$retval .= $object_dir . "/";
|
||||
}
|
||||
|
||||
$retval .= "js";
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!(-x $retval)) {
|
||||
die ("$retval is not a valid executable on this system.\n");
|
||||
die ("$retval is not a valid executable on this system.\n");
|
||||
}
|
||||
|
||||
|
||||
return $retval;
|
||||
|
||||
|
||||
}
|
||||
|
||||
sub get_os_type {
|
||||
|
||||
|
||||
local $uname = `uname -a`;
|
||||
|
||||
|
||||
if ($uname =~ /WIN/) {
|
||||
$uname = "WIN";
|
||||
$uname = "WIN";
|
||||
} else {
|
||||
chop $uname;
|
||||
chop $uname;
|
||||
}
|
||||
|
||||
|
||||
&dd ("get_os_type returning '$uname'.");
|
||||
return $uname;
|
||||
|
||||
|
||||
}
|
||||
|
||||
sub get_test_list {
|
||||
local @test_list;
|
||||
|
||||
|
||||
if ($opt_test_list_file) {
|
||||
&dd ("getting test list from file $opt_test_list_file.");
|
||||
@test_list = &get_user_test_list($opt_test_list_file);
|
||||
&dd ("getting test list from file $opt_test_list_file.");
|
||||
@test_list = &get_user_test_list($opt_test_list_file);
|
||||
} else {
|
||||
&dd ("no list file, groveling in '$opt_suite_path'.");
|
||||
@test_list = &get_default_test_list($opt_suite_path);
|
||||
&dd ("no list file, groveling in '$opt_suite_path'.");
|
||||
@test_list = &get_default_test_list($opt_suite_path);
|
||||
}
|
||||
|
||||
|
||||
&dd ("$#test_list test(s) found.");
|
||||
|
||||
|
||||
return @test_list;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -368,21 +404,29 @@ sub get_test_list {
|
|||
sub get_user_test_list {
|
||||
local ($list_file) = @_;
|
||||
local @retval;
|
||||
|
||||
if (!(-f $list_file)) {
|
||||
die ("Test List file '$list_file' not found.");
|
||||
}
|
||||
|
||||
if ($list_file =~ /\.js$/) {
|
||||
return $list_file;
|
||||
}
|
||||
|
||||
open (TESTLIST, $list_file) ||
|
||||
die("Error opening test list file '$list_file': $!\n");
|
||||
|
||||
|
||||
while (<TESTLIST>) {
|
||||
chop;
|
||||
if (!(/\s*\#/)) {
|
||||
$retval[$#retval + 1] = $_;
|
||||
}
|
||||
chop;
|
||||
if (!(/\s*\#/)) {
|
||||
$retval[$#retval + 1] = $_;
|
||||
}
|
||||
}
|
||||
|
||||
close (TESTLIST);
|
||||
|
||||
|
||||
return @retval;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -394,25 +438,25 @@ sub get_default_test_list {
|
|||
local @suite_list = &get_subdirs($suite_path);
|
||||
local $suite;
|
||||
local @retval;
|
||||
|
||||
|
||||
foreach $suite (@suite_list) {
|
||||
local @test_dir_list = get_subdirs ($suite_path . $suite);
|
||||
local $test_dir;
|
||||
|
||||
foreach $test_dir (@test_dir_list) {
|
||||
local @test_list = get_js_files ($suite_path . $suite . "/" .
|
||||
$test_dir);
|
||||
local $test;
|
||||
|
||||
foreach $test (@test_list) {
|
||||
$retval[$#retval + 1] = $suite_path . $suite . "/" . $test_dir .
|
||||
"/" . $test;
|
||||
}
|
||||
}
|
||||
local @test_dir_list = get_subdirs ($suite_path . $suite);
|
||||
local $test_dir;
|
||||
|
||||
foreach $test_dir (@test_dir_list) {
|
||||
local @test_list = get_js_files ($suite_path . $suite . "/" .
|
||||
$test_dir);
|
||||
local $test;
|
||||
|
||||
foreach $test (@test_list) {
|
||||
$retval[$#retval + 1] = $suite_path . $suite . "/" . $test_dir .
|
||||
"/" . $test;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return @retval;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -421,15 +465,15 @@ sub get_default_test_list {
|
|||
sub get_tempfile_id {
|
||||
local ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
|
||||
&get_padded_localtime;
|
||||
|
||||
|
||||
return $year . "-" . $mon . "-" . $mday . "-" . $hour . $min . $sec;
|
||||
|
||||
|
||||
}
|
||||
|
||||
sub get_padded_localtime {
|
||||
local ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
|
||||
localtime;
|
||||
|
||||
|
||||
$mon++;
|
||||
$mon = &zero_pad($mon);
|
||||
$year= ($year < 2000) ? "19" . $year : $year;
|
||||
|
@ -437,14 +481,14 @@ sub get_padded_localtime {
|
|||
$sec = &zero_pad($sec);
|
||||
$min = &zero_pad($min);
|
||||
$hour = &zero_pad($hour);
|
||||
|
||||
|
||||
return ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
|
||||
|
||||
|
||||
}
|
||||
|
||||
sub zero_pad {
|
||||
local ($string) = @_;
|
||||
|
||||
|
||||
$string = ($string < 10) ? "0" . $string : $string;
|
||||
return $string;
|
||||
}
|
||||
|
@ -455,21 +499,21 @@ sub zero_pad {
|
|||
sub get_subdirs {
|
||||
local ($dir) = @_;
|
||||
local @subdirs;
|
||||
|
||||
|
||||
if (!($dir =~ /\/$/)) {
|
||||
$dir = $dir . "/";
|
||||
$dir = $dir . "/";
|
||||
}
|
||||
|
||||
|
||||
opendir (DIR, $dir) || die ("couldn't open directory $dir: $!");
|
||||
local @testdir_contents = readdir(DIR);
|
||||
closedir(DIR);
|
||||
|
||||
|
||||
foreach (@testdir_contents) {
|
||||
if ((-d ($dir . $_)) && ($_ ne 'CVS') && ($_ ne '.') && ($_ ne '..')) {
|
||||
@subdirs[$#subdirs + 1] = $_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return @subdirs;
|
||||
}
|
||||
|
||||
|
@ -479,26 +523,56 @@ sub get_subdirs {
|
|||
sub get_js_files {
|
||||
local ($test_subdir) = @_;
|
||||
local @js_file_array;
|
||||
|
||||
opendir ( TEST_SUBDIR, $test_subdir) || die ("couldn't open directory " .
|
||||
"$test_subdir: $!");
|
||||
@subdir_files = readdir( TEST_SUBDIR );
|
||||
|
||||
opendir (TEST_SUBDIR, $test_subdir) || die ("couldn't open directory " .
|
||||
"$test_subdir: $!");
|
||||
@subdir_files = readdir(TEST_SUBDIR);
|
||||
closedir( TEST_SUBDIR );
|
||||
|
||||
foreach ( @subdir_files ) {
|
||||
if ( $_ =~ /\.js$/ ) {
|
||||
|
||||
foreach (@subdir_files) {
|
||||
if ($_ =~ /\.js$/) {
|
||||
$js_file_array[$#js_file_array+1] = $_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return @js_file_array;
|
||||
}
|
||||
|
||||
sub dd {
|
||||
sub report_failure {
|
||||
local ($test, $message) = @_;
|
||||
|
||||
if ($opt_trace) {
|
||||
print ("-*- ", @_ , "\n");
|
||||
}
|
||||
dd ("<> Testcase $test failed with message '$message'");
|
||||
$message =~ s/\n/<br>\n/g;
|
||||
$html .= $message;
|
||||
@failed_tests[$#failed_tests + 1] = $test;
|
||||
|
||||
}
|
||||
|
||||
sub dd {
|
||||
|
||||
if ($opt_trace) {
|
||||
print ("-*- ", @_ , "\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub int_handler {
|
||||
local $resp;
|
||||
|
||||
$SIG{INT} = 'DEFAULT';
|
||||
|
||||
do {
|
||||
print ("\n** User Break: [Q]uit Now, Quit and [R]eport, [C]ontinue ?");
|
||||
$resp = <STDIN>;
|
||||
} until ($resp =~ /[QqRrCc]/);
|
||||
|
||||
if ($resp =~ /[Qq]/) {
|
||||
print ("User Exit.");
|
||||
exit;
|
||||
} elsif ($resp =~ /[Rr]/) {
|
||||
$user_exit = 1;
|
||||
}
|
||||
|
||||
$SIG{INT} = 'int_handler';
|
||||
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче